Compare commits
	
		
			No commits in common. "35a16f6f494e407d32fcd4751c33699a0796d46a" and "27f313e939ac94bbb030cace4a4ff46f286cba8b" have entirely different histories.
		
	
	
		
			35a16f6f49
			...
			27f313e939
		
	
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -48,4 +48,3 @@ gen
 | 
				
			|||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 | 
					# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 | 
				
			||||||
hs_err_pid*
 | 
					hs_err_pid*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/upload/**
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								pom.xml
									
									
									
									
									
								
							@ -82,17 +82,6 @@
 | 
				
			|||||||
            <groupId>org.springframework.boot</groupId>
 | 
					            <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
            <artifactId>spring-boot-starter-aop</artifactId>
 | 
					            <artifactId>spring-boot-starter-aop</artifactId>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
                    <groupId>io.springfox</groupId>
 | 
					 | 
				
			||||||
                    <artifactId>springfox-swagger2</artifactId>
 | 
					 | 
				
			||||||
                    <version>2.9.2</version>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
        <dependency>
 | 
					 | 
				
			||||||
                    <groupId>io.springfox</groupId>
 | 
					 | 
				
			||||||
                    <artifactId>springfox-swagger-ui</artifactId>
 | 
					 | 
				
			||||||
                    <version>2.10.5</version>
 | 
					 | 
				
			||||||
        </dependency>
 | 
					 | 
				
			||||||
    </dependencies>
 | 
					    </dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <build>
 | 
					    <build>
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ package com.example.survey;
 | 
				
			|||||||
import org.springframework.boot.SpringApplication;
 | 
					import org.springframework.boot.SpringApplication;
 | 
				
			||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
					import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
@SpringBootApplication
 | 
					@SpringBootApplication
 | 
				
			||||||
public class SurveyApplication {
 | 
					public class SurveyApplication {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ import com.example.survey.util.TokenUtil;
 | 
				
			|||||||
import com.example.survey.vo.ResultVO;
 | 
					import com.example.survey.vo.ResultVO;
 | 
				
			||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.servlet.*;
 | 
					import javax.servlet.*;
 | 
				
			||||||
import javax.servlet.http.HttpServletRequest;
 | 
					import javax.servlet.http.HttpServletRequest;
 | 
				
			||||||
 | 
				
			|||||||
@ -4,10 +4,14 @@ import lombok.extern.log4j.Log4j2;
 | 
				
			|||||||
import org.aspectj.lang.ProceedingJoinPoint;
 | 
					import org.aspectj.lang.ProceedingJoinPoint;
 | 
				
			||||||
import org.aspectj.lang.annotation.Around;
 | 
					import org.aspectj.lang.annotation.Around;
 | 
				
			||||||
import org.aspectj.lang.annotation.Aspect;
 | 
					import org.aspectj.lang.annotation.Aspect;
 | 
				
			||||||
 | 
					import org.aspectj.lang.annotation.Before;
 | 
				
			||||||
import org.aspectj.lang.annotation.Pointcut;
 | 
					import org.aspectj.lang.annotation.Pointcut;
 | 
				
			||||||
 | 
					import org.springframework.aop.MethodBeforeAdvice;
 | 
				
			||||||
import org.springframework.context.annotation.Configuration;
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 | 
				
			|||||||
@ -1,25 +0,0 @@
 | 
				
			|||||||
package com.example.survey.config;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.springframework.context.annotation.Bean;
 | 
					 | 
				
			||||||
import org.springframework.context.annotation.Configuration;
 | 
					 | 
				
			||||||
import springfox.documentation.builders.PathSelectors;
 | 
					 | 
				
			||||||
import springfox.documentation.builders.RequestHandlerSelectors;
 | 
					 | 
				
			||||||
import springfox.documentation.spi.DocumentationType;
 | 
					 | 
				
			||||||
import springfox.documentation.spring.web.plugins.Docket;
 | 
					 | 
				
			||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Configuration
 | 
					 | 
				
			||||||
@EnableSwagger2
 | 
					 | 
				
			||||||
public class SwaggerConfig {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Bean
 | 
					 | 
				
			||||||
    public Docket api() {
 | 
					 | 
				
			||||||
        return new Docket(DocumentationType.SWAGGER_2)
 | 
					 | 
				
			||||||
                .select()
 | 
					 | 
				
			||||||
                .apis(RequestHandlerSelectors.basePackage("com.example.survey.controller"))
 | 
					 | 
				
			||||||
                .paths(PathSelectors.any())
 | 
					 | 
				
			||||||
                .build();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -3,12 +3,9 @@ package com.example.survey.controller;
 | 
				
			|||||||
import com.example.survey.dto.metaData.CreateMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.CreateMetaDataDTO;
 | 
				
			||||||
import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
				
			||||||
import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.service.MetaDataService;
 | 
					import com.example.survey.service.MetaDataService;
 | 
				
			||||||
import com.example.survey.vo.ResultVO;
 | 
					import com.example.survey.vo.ResultVO;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.apache.commons.lang3.EnumUtils;
 | 
					 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
import org.springframework.web.multipart.MultipartFile;
 | 
					import org.springframework.web.multipart.MultipartFile;
 | 
				
			||||||
@ -33,22 +30,14 @@ public class MetaDataController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/nameList")
 | 
					    @GetMapping("/nameList")
 | 
				
			||||||
    public ResultVO listMetaData(
 | 
					    public ResultVO listMetaData(@RequestParam(value = "name",required = false) String name,
 | 
				
			||||||
                                @RequestParam(value = "type",required = false) String type,
 | 
					                                @RequestParam("currentPage")int currentPage,
 | 
				
			||||||
                                @RequestParam(value = "name",required = false) String name,
 | 
					 | 
				
			||||||
                                @RequestParam(value = "currentPage",defaultValue = "0")int currentPage,
 | 
					 | 
				
			||||||
                                @RequestParam(value = "pageSize",defaultValue = "30")int pageSize){
 | 
					                                @RequestParam(value = "pageSize",defaultValue = "30")int pageSize){
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // if (type != null && (! EnumUtils.isValidEnum(MetaDataTypeEnum.class, type))) {
 | 
					 | 
				
			||||||
        //     ResultVO resultVO = new ResultVO(ResultEnum.NOT_EXIST_METADATA);
 | 
					 | 
				
			||||||
        //     resultVO.setMsg("元数据类型不存在");
 | 
					 | 
				
			||||||
        //     return resultVO;
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
        Map<String, Object> resultMap = new HashMap<>(16,0.75F);
 | 
					        Map<String, Object> resultMap = new HashMap<>(16,0.75F);
 | 
				
			||||||
        resultMap.put("totalCount", metaDataService.countMetaData(name, type));
 | 
					        resultMap.put("totalCount", metaDataService.countMetaData(name));
 | 
				
			||||||
        resultMap.put("currentPage", currentPage);
 | 
					        resultMap.put("currentPage", currentPage);
 | 
				
			||||||
        resultMap.put("pageSize", pageSize);
 | 
					        resultMap.put("pageSize", pageSize);
 | 
				
			||||||
        resultMap.put("data", metaDataService.listMetaDataNameLimit(name, type ,currentPage,pageSize));
 | 
					        resultMap.put("data", metaDataService.listMetaDataNameLimit(name,currentPage,pageSize));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
					        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
        resultVO.setData(resultMap);
 | 
					        resultVO.setData(resultMap);
 | 
				
			||||||
@ -74,4 +63,11 @@ public class MetaDataController {
 | 
				
			|||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/wordTemplate")
 | 
				
			||||||
 | 
					    public ResultVO bindWordTemplate(@RequestParam("template")MultipartFile template,
 | 
				
			||||||
 | 
					                                     @RequestParam("name")String name){
 | 
				
			||||||
 | 
					        metaDataService.bindWordTemplate(template,name);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,18 @@
 | 
				
			|||||||
package com.example.survey.controller;
 | 
					package com.example.survey.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dto.project.AddRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.CreateProjectDTO;
 | 
					import com.example.survey.dto.project.CreateProjectDTO;
 | 
				
			||||||
import com.example.survey.dto.project.DeleteRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.ModifyProjectDTO;
 | 
					import com.example.survey.dto.project.ModifyProjectDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.project.ModifyStateDTO;
 | 
				
			||||||
// import com.example.survey.enumeration.RespondentStateEnum;
 | 
					import com.example.survey.enumeration.RespondentStateEnum;
 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.service.ProjectService;
 | 
					import com.example.survey.service.ProjectService;
 | 
				
			||||||
import com.example.survey.util.TokenUtil;
 | 
					import com.example.survey.vo.ProjectVO;
 | 
				
			||||||
import com.example.survey.vo.ResultVO;
 | 
					import com.example.survey.vo.ResultVO;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -28,29 +27,43 @@ public class ProjectController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PostMapping("/project")
 | 
					    @PostMapping("/project")
 | 
				
			||||||
    public ResultVO createProject(@RequestBody CreateProjectDTO createProjectDTO,
 | 
					    public ResultVO createProject(@RequestBody CreateProjectDTO createProjectDTO) {
 | 
				
			||||||
                                  @RequestHeader("Authorization") String token) {
 | 
					 | 
				
			||||||
        createProjectDTO.setPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					 | 
				
			||||||
        projectService.createProject(createProjectDTO);
 | 
					        projectService.createProject(createProjectDTO);
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/projectList")
 | 
					    @GetMapping("/projectList")
 | 
				
			||||||
    public ResultVO getProject(@RequestParam(value = "name",required = false) String name,
 | 
					    public ResultVO getProject(@RequestParam(value = "name",required = false) String name,
 | 
				
			||||||
                               @RequestParam(value = "date_gt", required = false, defaultValue = "0") long date_gt,
 | 
					                               @RequestParam(value = "state", required = false)String state,
 | 
				
			||||||
                               @RequestParam(value = "date_lt", required = false, defaultValue = "0") long date_lt,
 | 
					                               @RequestParam(value = "currentPage") 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);
 | 
					        Map<String, Object> resultMap = new HashMap<>(16,0.75F);
 | 
				
			||||||
        resultMap.put("totalCount", projectService.countProject(name, date_gt, date_lt));
 | 
					        resultMap.put("totalCount", projectService.countProject(name,state));
 | 
				
			||||||
        resultMap.put("currentPage", currentPage);
 | 
					        resultMap.put("currentPage", currentPage);
 | 
				
			||||||
        resultMap.put("pageSize", pageSize);
 | 
					        resultMap.put("pageSize", pageSize);
 | 
				
			||||||
        resultMap.put("data", projectService.listProjectLimit(name, date_gt, date_lt, currentPage, pageSize));
 | 
					        resultMap.put("data", projectService.listProjectLimit(name,state, currentPage, pageSize));
 | 
				
			||||||
        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
					        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
        resultVO.setData(resultMap);
 | 
					        resultVO.setData(resultMap);
 | 
				
			||||||
        return resultVO;
 | 
					        return resultVO;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/respondentCount")
 | 
				
			||||||
 | 
					    public ResultVO getRespondentCount(@RequestParam(value = "name") String name) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<String, Object> resultMap = new HashMap<>(16, 0.75F);
 | 
				
			||||||
 | 
					        resultMap.put("respondentCount", projectService.countRespondent(name));
 | 
				
			||||||
 | 
					        resultMap.put("notInvestigatedRespondentCount", projectService.countRespondent(name, RespondentStateEnum.NOT_INVESTIGATED.getValue()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					        resultVO.setData(resultMap);
 | 
				
			||||||
 | 
					        return resultVO;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/projectState")
 | 
				
			||||||
 | 
					    public ResultVO modifyProjectState(@RequestBody ModifyStateDTO modifyStateDTO){
 | 
				
			||||||
 | 
					        projectService.modifyProjectState(modifyStateDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PutMapping("/project")
 | 
					    @PutMapping("/project")
 | 
				
			||||||
    public ResultVO modifyProject(@RequestBody ModifyProjectDTO modifyProjectDTO){
 | 
					    public ResultVO modifyProject(@RequestBody ModifyProjectDTO modifyProjectDTO){
 | 
				
			||||||
@ -58,15 +71,4 @@ public class ProjectController {
 | 
				
			|||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PutMapping("/record")
 | 
					 | 
				
			||||||
    public ResultVO addRecord(@RequestBody AddRecordDTO addRecordDTO){
 | 
					 | 
				
			||||||
        projectService.addRecord(addRecordDTO);
 | 
					 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @DeleteMapping("/record")
 | 
					 | 
				
			||||||
    public ResultVO deleteRecord(@RequestBody DeleteRecordDTO deleteRecordDTO){
 | 
					 | 
				
			||||||
        projectService.deleteRecord(deleteRecordDTO);
 | 
					 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@ package com.example.survey.controller;
 | 
				
			|||||||
import com.example.survey.dto.record.*;
 | 
					import com.example.survey.dto.record.*;
 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.service.RecordService;
 | 
					import com.example.survey.service.RecordService;
 | 
				
			||||||
import com.example.survey.util.TokenUtil;
 | 
					 | 
				
			||||||
import com.example.survey.vo.ResultVO;
 | 
					import com.example.survey.vo.ResultVO;
 | 
				
			||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@ -27,22 +26,19 @@ public class RecordController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/recordList")
 | 
					    @GetMapping("/recordList")
 | 
				
			||||||
    public ResultVO getRecord(@RequestParam(value = "idNumber", required = false) String idNumber,
 | 
					    public ResultVO getRecord(@RequestParam(value = "idNumber", required = false) String idNumber,
 | 
				
			||||||
            @RequestParam(value = "state", required = false) String state,
 | 
					                              @RequestParam(value = "userPhone", required = false) String userPhone,
 | 
				
			||||||
            @RequestParam(value = "templateName", required = false) String templateName,
 | 
					 | 
				
			||||||
            @RequestParam(value = "templateType", required = false) String templateType,
 | 
					 | 
				
			||||||
            @RequestParam(value = "uuid", required = false) String uuid,
 | 
					 | 
				
			||||||
            @RequestParam(value = "submitTimeGt", required = false, defaultValue = "0") long submitTimeGt,
 | 
					 | 
				
			||||||
            @RequestParam(value = "submitTimeLt", required = false, defaultValue = "0") long submitTimeLt,
 | 
					 | 
				
			||||||
                              @RequestParam(value = "projectName", required = false) String projectName,
 | 
					                              @RequestParam(value = "projectName", required = false) String projectName,
 | 
				
			||||||
            @RequestParam(value = "currentPage", defaultValue = "0") Integer currentPage,
 | 
					                              @RequestParam(value = "state", required = false) String state,
 | 
				
			||||||
            @RequestParam(value = "pageSize", defaultValue = "30") Integer pageSize) {
 | 
					                              @RequestParam(value = "version", required = false) String version,
 | 
				
			||||||
 | 
					                              @RequestParam(value = "questionnaireNumber", required = false) String questionnaireNumber,
 | 
				
			||||||
 | 
					                              @RequestParam(value = "currentPage") Integer currentPage,
 | 
				
			||||||
 | 
					                              @RequestParam(value = "pageSize", defaultValue = "30") Integer pageSize
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
        Map<String, Object> resultMap = new HashMap<>(16, 0.75F);
 | 
					        Map<String, Object> resultMap = new HashMap<>(16, 0.75F);
 | 
				
			||||||
        resultMap.put("totalCount", recordService.countRecord(idNumber, state, uuid, templateName, templateType,
 | 
					        resultMap.put("totalCount", recordService.countRecord(idNumber, userPhone, projectName, state, version, questionnaireNumber));
 | 
				
			||||||
                submitTimeGt, submitTimeLt, projectName));
 | 
					 | 
				
			||||||
        resultMap.put("currentPage", currentPage);
 | 
					        resultMap.put("currentPage", currentPage);
 | 
				
			||||||
        resultMap.put("pageSize", pageSize);
 | 
					        resultMap.put("pageSize", pageSize);
 | 
				
			||||||
        resultMap.put("data", recordService.listRecordLimit(idNumber, state, uuid, templateName, templateType,
 | 
					        resultMap.put("data", recordService.listRecordLimit(idNumber, userPhone, projectName, state, version, questionnaireNumber, currentPage, pageSize));
 | 
				
			||||||
                submitTimeGt, submitTimeLt, projectName, currentPage, pageSize));
 | 
					 | 
				
			||||||
        ResultVO resultVo = new ResultVO(ResultEnum.SUCCESS);
 | 
					        ResultVO resultVo = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
        resultVo.setData(resultMap);
 | 
					        resultVo.setData(resultMap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -50,41 +46,43 @@ public class RecordController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/recordValues")
 | 
					    @GetMapping("/recordValues")
 | 
				
			||||||
    public ResultVO getRecordValue(@RequestParam("uuid") String uuid) {
 | 
					    public ResultVO getRecordValue(@RequestParam("projectName") String projectName,
 | 
				
			||||||
 | 
					                                   @RequestParam("idNumber") String idNumber,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "version", required = false) String version) {
 | 
				
			||||||
        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
					        ResultVO resultVO = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
        resultVO.setData(recordService.getRecordValues(uuid));
 | 
					        resultVO.setData(recordService.getRecordValues(projectName, idNumber, version));
 | 
				
			||||||
        return resultVO;
 | 
					        return resultVO;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PutMapping("/review")
 | 
					    @GetMapping("/underReviewRecordCount")
 | 
				
			||||||
    public ResultVO reviewRecord(@RequestBody ReviewRecordDTO reviewRecordDTO,
 | 
					    public ResultVO countUnderReviewRecord(@RequestParam(value = "userPhone") String userPhone,
 | 
				
			||||||
            @RequestHeader("Authorization") String token) {
 | 
					                                           @RequestParam(value = "projectName") String projectName) {
 | 
				
			||||||
        reviewRecordDTO.setReviewerPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					        ResultVO resultVo = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					        resultVo.setData(recordService.countRecord(userPhone, projectName));
 | 
				
			||||||
 | 
					        return resultVo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/underReviewRecord")
 | 
				
			||||||
 | 
					    public ResultVO reviewRecord(@RequestBody ReviewRecordDTO reviewRecordDTO) {
 | 
				
			||||||
        recordService.reviewRecord(reviewRecordDTO);
 | 
					        recordService.reviewRecord(reviewRecordDTO);
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PutMapping("/record")
 | 
					    @PutMapping("/record")
 | 
				
			||||||
    public ResultVO modifyRecord(@RequestBody ModifyRecordDTO modifyRecordDTO,
 | 
					    public ResultVO modifyRecord(@RequestBody ModifyRecordDTO modifyRecordDTO) {
 | 
				
			||||||
            @RequestHeader("Authorization") String token) {
 | 
					 | 
				
			||||||
        modifyRecordDTO.setUserPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					 | 
				
			||||||
        recordService.modifyRecord(modifyRecordDTO);
 | 
					        recordService.modifyRecord(modifyRecordDTO);
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PostMapping("/record")
 | 
					    @PostMapping("/record")
 | 
				
			||||||
    public ResultVO submitRecord(@RequestBody SubmitRecordDTO submitRecordDTO,
 | 
					    public ResultVO submitRecord(@RequestBody SubmitRecordDTO submitRecordDTO) {
 | 
				
			||||||
            @RequestHeader("Authorization") String token) {
 | 
					 | 
				
			||||||
        submitRecordDTO.setUserPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					 | 
				
			||||||
        recordService.createRecord(submitRecordDTO);
 | 
					        recordService.createRecord(submitRecordDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DeleteMapping("/record")
 | 
					    @DeleteMapping("/record")
 | 
				
			||||||
    public ResultVO deleteRecord(@RequestBody DeleteRecordDTO deleteRecordDTO,
 | 
					    public ResultVO deleteRecord(@RequestBody DeleteRecordDTO deleteRecordDTO){
 | 
				
			||||||
            @RequestHeader("Authorization") String token) {
 | 
					 | 
				
			||||||
        deleteRecordDTO.setPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					 | 
				
			||||||
        recordService.deleteRecord(deleteRecordDTO);
 | 
					        recordService.deleteRecord(deleteRecordDTO);
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -97,15 +95,24 @@ public class RecordController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/record2word")
 | 
					    @GetMapping("/record2word")
 | 
				
			||||||
    public void record2word(@RequestParam("uuid") String uuid, HttpServletResponse response) {
 | 
					    public void record2word(@RequestParam("idNumber")String idNumber,
 | 
				
			||||||
        recordService.record2word(uuid, response);
 | 
					                            @RequestParam("projectName")String projectName,
 | 
				
			||||||
 | 
					                            HttpServletResponse response){
 | 
				
			||||||
 | 
					        recordService.record2word(idNumber,projectName,response);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/project")
 | 
				
			||||||
 | 
					    public ResultVO modifyProject(@RequestBody ModifyProjectDTO modifyProjectDTO){
 | 
				
			||||||
 | 
					        recordService.modifyProject(modifyProjectDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PutMapping("/metaData")
 | 
					    @PutMapping("/metaData")
 | 
				
			||||||
    public ResultVO modifyMetaData(@RequestBody ModifyMetaDataDTO modifyMetaDataDTO,
 | 
					    public ResultVO modifyMetaData(@RequestBody ModifyMetaDataDTO modifyMetaDataDTO){
 | 
				
			||||||
                                    @RequestHeader("Authorization") String token) {
 | 
					 | 
				
			||||||
        modifyMetaDataDTO.setPhone((String) TokenUtil.get(token + " : USER_PHONE"));
 | 
					 | 
				
			||||||
        recordService.modifyMetaData(modifyMetaDataDTO);
 | 
					        recordService.modifyMetaData(modifyMetaDataDTO);
 | 
				
			||||||
        return new ResultVO(ResultEnum.SUCCESS);
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					package com.example.survey.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.*;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
 | 
					import com.example.survey.service.RespondentService;
 | 
				
			||||||
 | 
					import com.example.survey.vo.ResultVO;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/respondent")
 | 
				
			||||||
 | 
					public class RespondentController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private RespondentService respondentService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/respondent")
 | 
				
			||||||
 | 
					    public ResultVO addRespondent(@RequestBody CreateRespondentDTO createRespondentDTO) {
 | 
				
			||||||
 | 
					        respondentService.createRespondent(createRespondentDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/respondentList")
 | 
				
			||||||
 | 
					    public ResultVO listRespondent(@RequestParam(value = "userPhone", required = false) String userPhone,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "projectName", required = false) String projectName,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "state", required = false) String state,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "idNumber", required = false) String idNumber,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "name", required = false) String name,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "phone", required = false) String phone,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "province", required = false) String province,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "city", required = false) String city,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "county", required = false) String county,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "currentPage") int currentPage,
 | 
				
			||||||
 | 
					                                   @RequestParam(value = "pageSize", defaultValue = "30") int pageSize
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
 | 
					        Map<String, Object> resultMap = new HashMap<>(16, 0.75F);
 | 
				
			||||||
 | 
					        resultMap.put("totalCount", respondentService.countRespondent(userPhone, state, idNumber, name, phone, province, city, county, projectName));
 | 
				
			||||||
 | 
					        resultMap.put("currentPage", currentPage);
 | 
				
			||||||
 | 
					        resultMap.put("pageSize", pageSize);
 | 
				
			||||||
 | 
					        resultMap.put("data", respondentService.listRespondentLimit(userPhone, state, idNumber, name, phone, province, city, county, projectName, currentPage, pageSize));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ResultVO resultVo = new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					        resultVo.setData(resultMap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return resultVo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/respondent")
 | 
				
			||||||
 | 
					    public ResultVO modifyRespondent(@RequestBody ModifyRespondentDTO modifyRespondentDTO) {
 | 
				
			||||||
 | 
					        respondentService.modifyRespondent(modifyRespondentDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @DeleteMapping("/respondent")
 | 
				
			||||||
 | 
					    public ResultVO deleteRespondent(@RequestBody DeleteRespondentDTO deleteRespondentDTO) {
 | 
				
			||||||
 | 
					        respondentService.deleteRespondent(deleteRespondentDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/user")
 | 
				
			||||||
 | 
					    public ResultVO modifyUser(@RequestBody ModifyRespondentUserDTO modifyRespondentUserDTO) {
 | 
				
			||||||
 | 
					        respondentService.modifyUser(modifyRespondentUserDTO);
 | 
				
			||||||
 | 
					        return new ResultVO(ResultEnum.SUCCESS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
package com.example.survey.dao;
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.Audit;
 | 
					import com.example.survey.entity.Audit;
 | 
				
			||||||
 | 
					import com.example.survey.vo.AuditVO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,8 @@
 | 
				
			|||||||
package com.example.survey.dao;
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					import com.example.survey.vo.MetaDataVO;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.query.Meta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -41,7 +42,7 @@ public interface MetaDataDao {
 | 
				
			|||||||
     * @param pageSize 页大小
 | 
					     * @param pageSize 页大小
 | 
				
			||||||
     * @return 元数据
 | 
					     * @return 元数据
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<MetaData> listMetaDataLimit(String name, String type,  int offset, int pageSize);
 | 
					    List<MetaData> listMetaDataLimit(String name, int offset, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据元数据名查询数量
 | 
					     * 根据元数据名查询数量
 | 
				
			||||||
@ -49,7 +50,7 @@ public interface MetaDataDao {
 | 
				
			|||||||
     * @param name 元数据名
 | 
					     * @param name 元数据名
 | 
				
			||||||
     * @return 数量
 | 
					     * @return 数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countMetaData(String name, String type);
 | 
					    long countMetaData(String name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取所有元数据
 | 
					     * 获取所有元数据
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,6 @@
 | 
				
			|||||||
package com.example.survey.dao;
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.Project;
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
import com.example.survey.entity.Record;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -43,7 +42,7 @@ public interface ProjectDao {
 | 
				
			|||||||
     * @param pageSize 页大小
 | 
					     * @param pageSize 页大小
 | 
				
			||||||
     * @return 项目列表
 | 
					     * @return 项目列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<Project> listProjectLimit(String name, long date_gt, long date_lt, int offset, int pageSize);
 | 
					    List<Project> listProjectLimit(String name,String state, int offset, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据项目名查询数量
 | 
					     * 根据项目名查询数量
 | 
				
			||||||
@ -52,7 +51,5 @@ public interface ProjectDao {
 | 
				
			|||||||
     * @param state 状态
 | 
					     * @param state 状态
 | 
				
			||||||
     * @return 数量
 | 
					     * @return 数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countProject(String name, long date_gt, long date_lt);
 | 
					    long countProject(String name,String state);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,9 @@
 | 
				
			|||||||
package com.example.survey.dao;
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
import com.example.survey.entity.Record;
 | 
					import com.example.survey.entity.Record;
 | 
				
			||||||
// import com.example.survey.entity.Respondent;
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
import com.example.survey.entity.User;
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.RecordStateEnum;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20,7 +19,7 @@ public interface RecordDao {
 | 
				
			|||||||
     * @param state      流调记录状态
 | 
					     * @param state      流调记录状态
 | 
				
			||||||
     * @return 是否存在符合条件的流调记录
 | 
					     * @return 是否存在符合条件的流调记录
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    boolean existRecord(String uuid);
 | 
					    boolean existRecord(Respondent respondent, Project project, String state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据调查对象身份证号与流调记录状态查询流调记录
 | 
					     * 根据调查对象身份证号与流调记录状态查询流调记录
 | 
				
			||||||
@ -30,7 +29,7 @@ public interface RecordDao {
 | 
				
			|||||||
     * @param state      流调记录状态
 | 
					     * @param state      流调记录状态
 | 
				
			||||||
     * @return 流调记录
 | 
					     * @return 流调记录
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    Record getRecord(String uuid);
 | 
					    Record getRecord(Respondent respondent,Project project, String state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 保存流调记录,若已有相同id的则更新
 | 
					     * 保存流调记录,若已有相同id的则更新
 | 
				
			||||||
@ -44,20 +43,20 @@ public interface RecordDao {
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param respondent 调查对象
 | 
					     * @param respondent 调查对象
 | 
				
			||||||
     * @param user 分配的人员
 | 
					     * @param user 分配的人员
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
     * @param state 流调记录状态
 | 
					     * @param state 流调记录状态
 | 
				
			||||||
     * @param version 流调记录版本
 | 
					     * @param version 流调记录版本
 | 
				
			||||||
     * @param questionnaireNumber 问卷编号
 | 
					     * @param questionnaireNumber 问卷编号
 | 
				
			||||||
     * @return 数量
 | 
					     * @return 数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countRecord(String idNumber, String state, String uuid, 
 | 
					    long countRecord(Respondent respondent, User user, Project project, String state, String version, String questionnaireNumber);
 | 
				
			||||||
                    String templateName, String templateType, 
 | 
					 | 
				
			||||||
                    long submitTimeGt, long submitTimeLt, String projectName);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据筛选条件分页查询流调记录
 | 
					     * 根据筛选条件分页查询流调记录
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param respondent 调查对象
 | 
					     * @param respondent 调查对象
 | 
				
			||||||
     * @param user 分配的人员
 | 
					     * @param user 分配的人员
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
     * @param state 流调记录状态
 | 
					     * @param state 流调记录状态
 | 
				
			||||||
     * @param version 流调记录版本
 | 
					     * @param version 流调记录版本
 | 
				
			||||||
     * @param questionnaireNumber 问卷编号
 | 
					     * @param questionnaireNumber 问卷编号
 | 
				
			||||||
@ -65,9 +64,34 @@ public interface RecordDao {
 | 
				
			|||||||
     * @param pageSize 页大小
 | 
					     * @param pageSize 页大小
 | 
				
			||||||
     * @return 流调记录
 | 
					     * @return 流调记录
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<Record> listRecordLimit(String idNumber, String state, String uuid, 
 | 
					    List<Record> listRecordLimit(Respondent respondent, User user, Project project, String state, String version, String questionnaireNumber, int offset, int pageSize);
 | 
				
			||||||
                                String templateName, String templateType, 
 | 
					 | 
				
			||||||
                                long submitTimeGt, long submitTimeLt,  String projectName, int offset, int pageSize);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据筛选条件查询流调记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param respondent 调查对象
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
 | 
					     * @param version 版本号
 | 
				
			||||||
 | 
					     * @return 流调记录
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Record selectRecord(Respondent respondent, Project project, String version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据筛选条件查询流调记录
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param respondent 调查对象
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
 | 
					     * @param states 记录状态
 | 
				
			||||||
 | 
					     * @return 流调记录
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Record selectRecord(Respondent respondent, Project project, List<String> states);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询流调记录列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
 | 
					     * @param respondent 调查对象
 | 
				
			||||||
 | 
					     * @return 流调记录列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<Record> listRecord(Project project, Respondent respondent);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										101
									
								
								src/main/java/com/example/survey/dao/RespondentDao.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								src/main/java/com/example/survey/dao/RespondentDao.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,101 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface RespondentDao {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 插入待调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param respondent 待调查对象
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void saveRespondent(Respondent respondent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据流调人员电话号码分页查询待调查对象列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param user     分配的人员
 | 
				
			||||||
 | 
					     * @param state    状态
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     * @param name     调查对象姓名
 | 
				
			||||||
 | 
					     * @param phone    调查对象电话
 | 
				
			||||||
 | 
					     * @param province 省份
 | 
				
			||||||
 | 
					     * @param city     城市
 | 
				
			||||||
 | 
					     * @param county   区县
 | 
				
			||||||
 | 
					     * @param project  项目
 | 
				
			||||||
 | 
					     * @param offset   偏移量
 | 
				
			||||||
 | 
					     * @param pageSize 大小
 | 
				
			||||||
 | 
					     * @return 待调查对象列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<Respondent> listRespondentLimit(User user, String state, String idNumber, String name, String phone, String province, String city, String county, Project project, int offset, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 判断是否存在对应id的调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     * @param project  项目
 | 
				
			||||||
 | 
					     * @return 是否存在该调查对象
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    boolean existRespondent(String idNumber, Project project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 判断是否存在符合条件的调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     * @param project  项目
 | 
				
			||||||
 | 
					     * @param state    调查对象状态
 | 
				
			||||||
 | 
					     * @return 是否存在该调查对象
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    boolean existRespondent(String idNumber, Project project, String state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根绝筛选条件获取调查对象数量
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param user     分配的人员
 | 
				
			||||||
 | 
					     * @param state    状态
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     * @param name     调查对象姓名
 | 
				
			||||||
 | 
					     * @param phone    调查对象电话
 | 
				
			||||||
 | 
					     * @param province 省份
 | 
				
			||||||
 | 
					     * @param city     城市
 | 
				
			||||||
 | 
					     * @param county   区县
 | 
				
			||||||
 | 
					     * @param project  项目
 | 
				
			||||||
 | 
					     * @return 数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    long countRespondent(User user, String state, String idNumber, String name, String phone, String province, String city, String county, Project project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据身份证号查询调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     * @param project  项目
 | 
				
			||||||
 | 
					     * @return 调查对象
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Respondent selectRespondent(String idNumber, Project project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param idNumber 身份证号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void deleteRespondent(String idNumber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据项目与调查对象状态查询调查对象数量
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param project 项目
 | 
				
			||||||
 | 
					     * @param state   调查对象状态
 | 
				
			||||||
 | 
					     * @return 调查对象数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    long countRespondent(Project project, String state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,8 +1,10 @@
 | 
				
			|||||||
package com.example.survey.dao;
 | 
					package com.example.survey.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.Role;
 | 
					import com.example.survey.entity.Role;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.AuthEnum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,8 @@ import org.springframework.data.mongodb.core.MongoTemplate;
 | 
				
			|||||||
import org.springframework.data.mongodb.core.query.Criteria;
 | 
					import org.springframework.data.mongodb.core.query.Criteria;
 | 
				
			||||||
import org.springframework.data.mongodb.core.query.Query;
 | 
					import org.springframework.data.mongodb.core.query.Query;
 | 
				
			||||||
import org.springframework.stereotype.Repository;
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@ package com.example.survey.dao.impl;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dao.MetaDataDao;
 | 
					import com.example.survey.dao.MetaDataDao;
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.exception.MetaDataException;
 | 
					import com.example.survey.exception.MetaDataException;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@ -45,28 +44,22 @@ public class MetaDataDaoImpl implements MetaDataDao {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<MetaData> listMetaDataLimit(String name, String type, int offset, int pageSize) {
 | 
					    public List<MetaData> listMetaDataLimit(String name, int offset, int pageSize) {
 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (name != null) {
 | 
					        if (name != null) {
 | 
				
			||||||
            criteria.and("name").regex(name);
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (type != null) {
 | 
					 | 
				
			||||||
            criteria.and("type").is(type);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Query query = new Query(criteria).skip(offset).limit(pageSize);
 | 
					        Query query = new Query(criteria).skip(offset).limit(pageSize);
 | 
				
			||||||
        return mongoTemplate.find(query, MetaData.class);
 | 
					        return mongoTemplate.find(query, MetaData.class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countMetaData(String name, String type) {
 | 
					    public long countMetaData(String name) {
 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (name != null) {
 | 
					        if (name != null) {
 | 
				
			||||||
            criteria.and("name").regex(name);
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (type != null) {
 | 
					 | 
				
			||||||
            criteria.and("type").is(type);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        Query query = new Query(criteria);
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
        return mongoTemplate.count(query, MetaData.class);
 | 
					        return mongoTemplate.count(query, MetaData.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@ package com.example.survey.dao.impl;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dao.ProjectDao;
 | 
					import com.example.survey.dao.ProjectDao;
 | 
				
			||||||
import com.example.survey.entity.Project;
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
import com.example.survey.entity.Record;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.exception.ProjectException;
 | 
					import com.example.survey.exception.ProjectException;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@ -11,9 +10,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
 | 
				
			|||||||
import org.springframework.data.mongodb.core.query.Query;
 | 
					import org.springframework.data.mongodb.core.query.Query;
 | 
				
			||||||
import org.springframework.stereotype.Repository;
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Set;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -48,16 +45,13 @@ public class ProjectDaoImpl implements ProjectDao {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<Project> listProjectLimit(String name, long date_gt, long date_lt, int offset, int pageSize) {
 | 
					    public List<Project> listProjectLimit(String name,String state, int offset, int pageSize) {
 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (name != null) {
 | 
					        if (name != null) {
 | 
				
			||||||
            criteria.and("name").regex(name);
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (date_gt != 0) {
 | 
					        if(state!=null){
 | 
				
			||||||
            criteria.and("date").gt(date_gt);
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(date_lt != 0) {
 | 
					 | 
				
			||||||
            criteria.and("date").lt(date_lt);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        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);
 | 
				
			||||||
@ -65,19 +59,15 @@ public class ProjectDaoImpl implements ProjectDao {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countProject(String name, long date_gt, long date_lt) {
 | 
					    public long countProject(String name,String state) {
 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (name != null) {
 | 
					        if (name != null) {
 | 
				
			||||||
            criteria.and("name").regex(name);
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (date_gt != 0) {
 | 
					        if(state!=null){
 | 
				
			||||||
            criteria.and("date").gt(date_gt);
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(date_lt != 0) {
 | 
					 | 
				
			||||||
            criteria.and("date").lt(date_lt);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Query query = new Query(criteria);
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
        return mongoTemplate.count(query, Project.class);
 | 
					        return mongoTemplate.count(query, Project.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,9 @@
 | 
				
			|||||||
package com.example.survey.dao.impl;
 | 
					package com.example.survey.dao.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dao.MetaDataDao;
 | 
					 | 
				
			||||||
import com.example.survey.dao.RecordDao;
 | 
					import com.example.survey.dao.RecordDao;
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
import com.example.survey.entity.Record;
 | 
					import com.example.survey.entity.Record;
 | 
				
			||||||
// import com.example.survey.entity.Respondent;
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
import com.example.survey.entity.User;
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
import com.example.survey.enumeration.RecordStateEnum;
 | 
					import com.example.survey.enumeration.RecordStateEnum;
 | 
				
			||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
@ -14,7 +13,6 @@ import org.springframework.data.mongodb.core.query.Criteria;
 | 
				
			|||||||
import org.springframework.data.mongodb.core.query.Query;
 | 
					import org.springframework.data.mongodb.core.query.Query;
 | 
				
			||||||
import org.springframework.stereotype.Repository;
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -27,22 +25,23 @@ public class RecordDaoImpl implements RecordDao {
 | 
				
			|||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    MongoTemplate mongoTemplate;
 | 
					    MongoTemplate mongoTemplate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    MetaDataDao metaDataDao;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean existRecord(String uuid) {
 | 
					    public boolean existRecord(Respondent respondent, Project project, String state) {
 | 
				
			||||||
        Criteria criteria = new Criteria()
 | 
					        Criteria criteria = new Criteria()
 | 
				
			||||||
                .and("uuid").is(uuid);
 | 
					                .and("respondent.$id").is(respondent.getId())
 | 
				
			||||||
 | 
					                .and("project.$id").is(project.getId())
 | 
				
			||||||
 | 
					                .and("state").is(state);
 | 
				
			||||||
        Query query = new Query(criteria);
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
        return mongoTemplate.exists(query, Record.class);
 | 
					        return mongoTemplate.exists(query, Record.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Record getRecord(String uuid) {
 | 
					    public Record getRecord(Respondent respondent, Project project, String state) {
 | 
				
			||||||
        Criteria criteria = new Criteria()
 | 
					        Criteria criteria = new Criteria()
 | 
				
			||||||
                    .and("uuid").is(uuid);
 | 
					                .and("respondent.$id").is(respondent.getId())
 | 
				
			||||||
 | 
					                .and("project.$id").is(project.getId())
 | 
				
			||||||
 | 
					                .and("state").is(state);
 | 
				
			||||||
        Query query = new Query(criteria);
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return mongoTemplate.findOne(query, Record.class);
 | 
					        return mongoTemplate.findOne(query, Record.class);
 | 
				
			||||||
@ -54,98 +53,90 @@ public class RecordDaoImpl implements RecordDao {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countRecord(String idNumber, String state, String uuid, 
 | 
					    public long countRecord(Respondent respondent, User user, Project project, String state, String version, String questionnaireNumber) {
 | 
				
			||||||
                            String templateName, String templateType, 
 | 
					 | 
				
			||||||
                            long submitTimeGt, long submitTimeLt, String projectName) {
 | 
					 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (idNumber != null) {
 | 
					        if (respondent != null) {
 | 
				
			||||||
            criteria.and("idNumber").is(idNumber);
 | 
					            criteria.and("respondent.$id").is(respondent.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (user != null) {
 | 
				
			||||||
 | 
					            criteria.and("user.$id").is(user.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (project != null) {
 | 
				
			||||||
 | 
					            criteria.and("project.$id").is(project.getId());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (state != null) {
 | 
					        if (state != null) {
 | 
				
			||||||
            criteria.and("state").is(state);
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
        } 
 | 
					        } else {
 | 
				
			||||||
        if (uuid != null) {
 | 
					            criteria.and("state").in(RecordStateEnum.REVIEWED.getValue(), RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
            criteria.and("uuid").is(uuid);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (templateName != null) {
 | 
					 | 
				
			||||||
            MetaData metaData = metaDataDao.selectMetaData(templateName);
 | 
					 | 
				
			||||||
            if (metaData != null) {
 | 
					 | 
				
			||||||
                criteria.and("metaData.$id").is(metaData.getId());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else{
 | 
					 | 
				
			||||||
                return 0;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (templateType != null) {
 | 
					        if (version != null) {
 | 
				
			||||||
            criteria.and("metaDataType").is(templateType);
 | 
					            criteria.and("version").is(version);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (questionnaireNumber != null) {
 | 
				
			||||||
        if (submitTimeGt != 0) {
 | 
					            criteria.and("value.questionnaireNumber").is(questionnaireNumber);
 | 
				
			||||||
            criteria.and("submitTime").gt(submitTimeGt);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (submitTimeLt != 0) {
 | 
					 | 
				
			||||||
            criteria.and("submitTime").lt(submitTimeLt);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (projectName != null) {
 | 
					 | 
				
			||||||
            criteria.and("projectList").elemMatch(new Criteria().in(projectName));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Query query = new Query(criteria);
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
        return mongoTemplate.count(query, Record.class);
 | 
					        return mongoTemplate.count(query, Record.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<Record> listRecordLimit(String idNumber, String state, String uuid, 
 | 
					    public List<Record> listRecordLimit(Respondent respondent, User user, Project project, String state, String version, String questionnaireNumber, int offset, int pageSize) {
 | 
				
			||||||
                                        String templateName, String templateType, 
 | 
					 | 
				
			||||||
                                        long submitTimeGt, long submitTimeLt, String projectName,
 | 
					 | 
				
			||||||
                                        int offset, int pageSize) {
 | 
					 | 
				
			||||||
        Criteria criteria = new Criteria();
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
        if (idNumber != null) {
 | 
					        if (respondent != null) {
 | 
				
			||||||
            criteria.and("idNumber").is(idNumber);
 | 
					            criteria.and("respondent.$id").is(respondent.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (user != null) {
 | 
				
			||||||
 | 
					            criteria.and("user.$id").is(user.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (project != null) {
 | 
				
			||||||
 | 
					            criteria.and("project.$id").is(project.getId());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (state != null) {
 | 
					        if (state != null) {
 | 
				
			||||||
            criteria.and("state").is(state);
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
        } 
 | 
					        } else {
 | 
				
			||||||
        else {
 | 
					            criteria.and("state").in(RecordStateEnum.REVIEWED.getValue(), RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
            criteria.and("state").nin(RecordStateEnum.FILED.getValue());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (uuid != null) {
 | 
					 | 
				
			||||||
            criteria.and("uuid").is(uuid);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (templateName != null) {
 | 
					 | 
				
			||||||
            MetaData metaData = metaDataDao.selectMetaData(templateName);
 | 
					 | 
				
			||||||
            if (metaData != null) {
 | 
					 | 
				
			||||||
                criteria.and("metaData.$id").is(metaData.getId());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else{
 | 
					 | 
				
			||||||
                return new ArrayList<Record>();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (templateType != null) {
 | 
					        if (version != null) {
 | 
				
			||||||
            criteria.and("metaDataType").is(templateType);
 | 
					            criteria.and("version").is(version);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (questionnaireNumber != null) {
 | 
				
			||||||
        if (submitTimeGt != 0) {
 | 
					            criteria.and("value.questionnaireNumber").is(questionnaireNumber);
 | 
				
			||||||
            criteria.and("submitTime").gt(submitTimeGt);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (submitTimeLt != 0) {
 | 
					 | 
				
			||||||
            criteria.and("submitTime").lt(submitTimeLt);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (projectName != null) {
 | 
					 | 
				
			||||||
            criteria.and("projectList").elemMatch(new Criteria().in(projectName));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Query query = new Query(criteria).skip(offset).limit(pageSize);
 | 
					        Query query = new Query(criteria).skip(offset).limit(pageSize);
 | 
				
			||||||
        return mongoTemplate.find(query, Record.class);
 | 
					        return mongoTemplate.find(query, Record.class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Record selectRecord(Respondent respondent, Project project, String version) {
 | 
				
			||||||
 | 
					        Criteria criteria = Criteria
 | 
				
			||||||
 | 
					                .where("respondent.$id").is(respondent.getId())
 | 
				
			||||||
 | 
					                .and("project.$id").is(project.getId());
 | 
				
			||||||
 | 
					        if (version != null) {
 | 
				
			||||||
 | 
					            criteria.and("version").is(version);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					        return mongoTemplate.findOne(query, Record.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Record selectRecord(Respondent respondent, Project project, List<String> states) {
 | 
				
			||||||
 | 
					        Criteria criteria = new Criteria()
 | 
				
			||||||
 | 
					                .and("respondent.$id").is(respondent.getId())
 | 
				
			||||||
 | 
					                .and("project.$id").is(project.getId())
 | 
				
			||||||
 | 
					                .and("state").in(states);
 | 
				
			||||||
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					        return mongoTemplate.findOne(query, Record.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<Record> listRecord(Project project, Respondent respondent) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Query query = new Query(Criteria.where("project.$id").is(project.getId())
 | 
				
			||||||
 | 
					                .and("respondent.$id").is(respondent.getId()));
 | 
				
			||||||
 | 
					        return mongoTemplate.find(query,Record.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										152
									
								
								src/main/java/com/example/survey/dao/impl/RespondentDaoImpl.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								src/main/java/com/example/survey/dao/impl/RespondentDaoImpl.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,152 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dao.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.dao.RespondentDao;
 | 
				
			||||||
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
 | 
					import com.example.survey.exception.RespondentException;
 | 
				
			||||||
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.MongoTemplate;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.query.Criteria;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.query.Query;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Log4j2
 | 
				
			||||||
 | 
					@Repository
 | 
				
			||||||
 | 
					public class RespondentDaoImpl implements RespondentDao {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private MongoTemplate mongoTemplate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void saveRespondent(Respondent respondent) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            mongoTemplate.save(respondent);
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.ALREADY_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<Respondent> listRespondentLimit(User user, String state, String idNumber, String name, String phone, String province, String city, String county, Project project, int offset, int pageSize) {
 | 
				
			||||||
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (idNumber != null) {
 | 
				
			||||||
 | 
					            criteria.and("idNumber").is(idNumber);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (name != null) {
 | 
				
			||||||
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (phone != null) {
 | 
				
			||||||
 | 
					            criteria.and("phone").is(phone);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (province != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.province").is(province);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (city != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.city").is(city);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (county != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.county").is(county);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (project != null) {
 | 
				
			||||||
 | 
					            criteria.and("project.$id").is(project.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (user != null) {
 | 
				
			||||||
 | 
					            criteria.and("user.$id").is(user.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (state != null) {
 | 
				
			||||||
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Query query = new Query(criteria).skip(offset).limit(pageSize);
 | 
				
			||||||
 | 
					        return mongoTemplate.find(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public long countRespondent(User user, String state, String idNumber, String name, String phone, String province, String city, String county, Project project) {
 | 
				
			||||||
 | 
					        Criteria criteria = new Criteria();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (idNumber != null) {
 | 
				
			||||||
 | 
					            criteria.and("idNumber").is(idNumber);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (name != null) {
 | 
				
			||||||
 | 
					            criteria.and("name").regex(name);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (phone != null) {
 | 
				
			||||||
 | 
					            criteria.and("phone").is(phone);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (province != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.province").is(province);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (city != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.city").is(city);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (county != null) {
 | 
				
			||||||
 | 
					            criteria.and("administrativeArea.county").is(county);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (project != null) {
 | 
				
			||||||
 | 
					            criteria.and("project.$id").is(project.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (user != null) {
 | 
				
			||||||
 | 
					            criteria.and("user.$id").is(user.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (state != null) {
 | 
				
			||||||
 | 
					            criteria.and("state").is(state);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					        return mongoTemplate.count(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean existRespondent(String idNumber, Project project) {
 | 
				
			||||||
 | 
					        Criteria criteria = Criteria.where("idNumber").is(idNumber);
 | 
				
			||||||
 | 
					        if (project != null) {
 | 
				
			||||||
 | 
					            criteria.and("project.$id").is(project.getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return mongoTemplate.exists(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean existRespondent(String idNumber, Project project, String state) {
 | 
				
			||||||
 | 
					        Query query = new Query(
 | 
				
			||||||
 | 
					                Criteria.where("idNumber").is(idNumber)
 | 
				
			||||||
 | 
					                        .and("project.$id").is(project.getId())
 | 
				
			||||||
 | 
					                        .and("state").is(state));
 | 
				
			||||||
 | 
					        return mongoTemplate.exists(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Respondent selectRespondent(String idNumber, Project project) {
 | 
				
			||||||
 | 
					        Query query = new Query(Criteria.where("idNumber").is(idNumber).and("project.$id").is(project.getId()));
 | 
				
			||||||
 | 
					        return mongoTemplate.findOne(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void deleteRespondent(String idNumber) {
 | 
				
			||||||
 | 
					        Query query = new Query(Criteria.where("idNumber").is(idNumber));
 | 
				
			||||||
 | 
					        mongoTemplate.remove(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public long countRespondent(Project project, String state) {
 | 
				
			||||||
 | 
					        Criteria criteria = Criteria.where("project.$id").is(project.getId()).and("state").is(state);
 | 
				
			||||||
 | 
					        Query query = new Query(criteria);
 | 
				
			||||||
 | 
					        return mongoTemplate.count(query, Respondent.class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -2,6 +2,7 @@ package com.example.survey.dao.impl;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dao.RoleDao;
 | 
					import com.example.survey.dao.RoleDao;
 | 
				
			||||||
import com.example.survey.entity.Role;
 | 
					import com.example.survey.entity.Role;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.AuthEnum;
 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.exception.RoleException;
 | 
					import com.example.survey.exception.RoleException;
 | 
				
			||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
@ -12,6 +13,7 @@ import org.springframework.data.mongodb.core.query.Query;
 | 
				
			|||||||
import org.springframework.stereotype.Repository;
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,6 @@
 | 
				
			|||||||
package com.example.survey.dto.metaData;
 | 
					package com.example.survey.dto.metaData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.inner.FieldToName;
 | 
					import com.example.survey.entity.inner.FieldToName;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@ -15,5 +13,7 @@ import java.util.Map;
 | 
				
			|||||||
public class CreateMetaDataDTO {
 | 
					public class CreateMetaDataDTO {
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private Map<String,Object> form;
 | 
					    private Map<String,Object> form;
 | 
				
			||||||
    private String type;
 | 
					    private List<FieldToName> fieldToNameList;
 | 
				
			||||||
 | 
					    private Map<String, Object> config;
 | 
				
			||||||
 | 
					    private String wordTemplate;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,6 @@
 | 
				
			|||||||
package com.example.survey.dto.metaData;
 | 
					package com.example.survey.dto.metaData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.inner.FieldToName;
 | 
					import com.example.survey.entity.inner.FieldToName;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@ -15,5 +13,6 @@ import java.util.Map;
 | 
				
			|||||||
public class ModifyMetaDataDTO {
 | 
					public class ModifyMetaDataDTO {
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private Map<String,Object> form;
 | 
					    private Map<String,Object> form;
 | 
				
			||||||
    private String type;
 | 
					    private List<FieldToName> fieldToNameList;
 | 
				
			||||||
 | 
					    private Map<String, Object> config;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -16,10 +16,31 @@ public class CreateProjectDTO {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 描述信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String detail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 元数据名字
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String metaDataName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 开始时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 结束时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 负责人电话号码
 | 
					     * 负责人电话号码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private long date;
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String phone;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +0,0 @@
 | 
				
			|||||||
package com.example.survey.dto.project;
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @author Pope
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
@Data
 | 
					 | 
				
			||||||
public class DeleteRecordDTO {
 | 
					 | 
				
			||||||
    private String name;
 | 
					 | 
				
			||||||
    private String uuid;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -11,5 +11,10 @@ import java.util.Date;
 | 
				
			|||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class ModifyProjectDTO {
 | 
					public class ModifyProjectDTO {
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private String phone;
 | 
					    private String detail;
 | 
				
			||||||
 | 
					    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date startTime;
 | 
				
			||||||
 | 
					    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
 | 
					    private Date endTime;
 | 
				
			||||||
 | 
					    private String userPhone;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,12 @@
 | 
				
			|||||||
package com.example.survey.dto.project;
 | 
					package com.example.survey.dto.project;
 | 
				
			||||||
import lombok.Data;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class AddRecordDTO {
 | 
					public class ModifyStateDTO {
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private String uuid;
 | 
					    private String state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -7,7 +7,11 @@ import lombok.Data;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class DeleteRecordDTO {
 | 
					public class DeleteRecordDTO {
 | 
				
			||||||
    private String uuid;
 | 
					    private String idNumber;
 | 
				
			||||||
    private String phone;
 | 
					
 | 
				
			||||||
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String msg;
 | 
					    private String msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
package com.example.survey.dto.record;
 | 
					package com.example.survey.dto.record;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.inner.AdministrativeArea;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -7,7 +8,9 @@ import lombok.Data;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class ModifyMetaDataDTO {
 | 
					public class ModifyMetaDataDTO {
 | 
				
			||||||
    private String uuid;
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String metaDataName;
 | 
					    private String metaDataName;
 | 
				
			||||||
    private String phone;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,12 @@ import lombok.Data;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class ModifyProjectDTO {
 | 
					public class ModifyProjectDTO {
 | 
				
			||||||
    private String uuid;
 | 
					    private String idNumber;
 | 
				
			||||||
    private String project;
 | 
					    private String phone;
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					    private String msg;
 | 
				
			||||||
 | 
					    private String gender;
 | 
				
			||||||
 | 
					    private AdministrativeArea administrativeArea;
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					    private String newProjectName;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,14 +3,16 @@ package com.example.survey.dto.record;
 | 
				
			|||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class ModifyRecordDTO {
 | 
					public class ModifyRecordDTO {
 | 
				
			||||||
    private String uuid;
 | 
					    private String idNumber;
 | 
				
			||||||
    private Map<String, Object> values;
 | 
					    private Map<String, Object> values;
 | 
				
			||||||
    private String userPhone;
 | 
					    private String userPhone;
 | 
				
			||||||
    private String msg;
 | 
					    private String msg;
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,8 @@ import lombok.*;
 | 
				
			|||||||
@NoArgsConstructor
 | 
					@NoArgsConstructor
 | 
				
			||||||
@AllArgsConstructor
 | 
					@AllArgsConstructor
 | 
				
			||||||
public class ReviewRecordDTO {
 | 
					public class ReviewRecordDTO {
 | 
				
			||||||
    private String uuid;
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
    private Boolean pass;
 | 
					    private Boolean pass;
 | 
				
			||||||
    private String msg;
 | 
					    private String msg;
 | 
				
			||||||
    private String reviewerPhone;
 | 
					    private String reviewerPhone;
 | 
				
			||||||
 | 
				
			|||||||
@ -13,8 +13,6 @@ import java.util.Map;
 | 
				
			|||||||
@NoArgsConstructor
 | 
					@NoArgsConstructor
 | 
				
			||||||
@AllArgsConstructor
 | 
					@AllArgsConstructor
 | 
				
			||||||
public class SubmitRecordDTO {
 | 
					public class SubmitRecordDTO {
 | 
				
			||||||
    private String uuid;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private String idNumber;
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Map<String, Object> values;
 | 
					    private Map<String, Object> values;
 | 
				
			||||||
@ -25,6 +23,6 @@ public class SubmitRecordDTO {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private String metaDataName;
 | 
					    private String metaDataName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // private String projectName;
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,59 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dto.respondent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
 | 
					import com.example.survey.entity.inner.AdministrativeArea;
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@ToString
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class CreateRespondentDTO {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 身份证号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 电话
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String phone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 姓名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 备注
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 性别
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String gender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 行政区划
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private AdministrativeArea administrativeArea;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分配人员
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 项目名集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dto.respondent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@ToString
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class DeleteRespondentDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dto.respondent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.inner.AdministrativeArea;
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Getter
 | 
				
			||||||
 | 
					@Setter
 | 
				
			||||||
 | 
					@ToString
 | 
				
			||||||
 | 
					@NoArgsConstructor
 | 
				
			||||||
 | 
					@AllArgsConstructor
 | 
				
			||||||
 | 
					public class ModifyRespondentDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 身份证号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 电话
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String phone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 姓名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 备注
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 性别
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String gender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 行政区划
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private AdministrativeArea administrativeArea;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 项目名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					package com.example.survey.dto.respondent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class ModifyRespondentUserDTO {
 | 
				
			||||||
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					    private String projectName;
 | 
				
			||||||
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -2,6 +2,7 @@ package com.example.survey.dto.role;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
package com.example.survey.dto.user;
 | 
					package com.example.survey.dto.user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import com.example.survey.entity.Department;
 | 
					import com.example.survey.entity.Department;
 | 
				
			||||||
import com.example.survey.entity.inner.AdministrativeArea;
 | 
					import com.example.survey.entity.inner.AdministrativeArea;
 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ package com.example.survey.dto.user;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -2,11 +2,10 @@ package com.example.survey.entity;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
import org.bson.types.ObjectId;
 | 
					import org.bson.types.ObjectId;
 | 
				
			||||||
// import org.springframework.data.mongodb.core.index.Indexed;
 | 
					import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.Document;
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,8 @@
 | 
				
			|||||||
package com.example.survey.entity;
 | 
					package com.example.survey.entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					import com.example.survey.entity.inner.FieldToName;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
import org.bson.types.ObjectId;
 | 
					import org.bson.types.ObjectId;
 | 
				
			||||||
import org.springframework.data.mongodb.core.index.Indexed;
 | 
					 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.Document;
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@ -17,9 +15,9 @@ import java.util.Map;
 | 
				
			|||||||
@Document(collection = "metaData")
 | 
					@Document(collection = "metaData")
 | 
				
			||||||
public class MetaData {
 | 
					public class MetaData {
 | 
				
			||||||
    private ObjectId id;
 | 
					    private ObjectId id;
 | 
				
			||||||
    private String type;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    @Indexed(unique = true)
 | 
					 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private Map<String,Object> form;
 | 
					    private Map<String,Object> form;
 | 
				
			||||||
 | 
					    private List<FieldToName> fieldToNameList;
 | 
				
			||||||
 | 
					    private String wordTemplate;
 | 
				
			||||||
 | 
					    private Map<String, Object> config;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,9 +7,7 @@ import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			|||||||
import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.Document;
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -31,9 +29,39 @@ public class Project {
 | 
				
			|||||||
    @Indexed(unique = true)
 | 
					    @Indexed(unique = true)
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private long date;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 描述信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String detail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 调查对象数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private long respondentCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 未调查调查对象数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private long notInvestigatedRespondentCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 负责人
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DBRef
 | 
				
			||||||
    private User user;
 | 
					    private User user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private long count;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 开始时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Date startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 结束时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Date endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,17 +1,12 @@
 | 
				
			|||||||
package com.example.survey.entity;
 | 
					package com.example.survey.entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.inner.Operation;
 | 
					import com.example.survey.entity.inner.Operation;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.RecordStateEnum;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.*;
 | 
					import lombok.*;
 | 
				
			||||||
import org.bson.types.ObjectId;
 | 
					import org.bson.types.ObjectId;
 | 
				
			||||||
import org.springframework.data.annotation.Id;
 | 
					import org.springframework.data.annotation.Id;
 | 
				
			||||||
import org.springframework.data.mongodb.core.index.Indexed;
 | 
					 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.Document;
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -26,10 +21,11 @@ public class Record {
 | 
				
			|||||||
    @Id
 | 
					    @Id
 | 
				
			||||||
    private ObjectId id;
 | 
					    private ObjectId id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Indexed(unique = true)
 | 
					    /**
 | 
				
			||||||
    private String uuid;
 | 
					     * 调查对象
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private String idNumber;
 | 
					    @DBRef
 | 
				
			||||||
 | 
					    private Respondent respondent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 用于存放前端传的字段
 | 
					     * 用于存放前端传的字段
 | 
				
			||||||
@ -47,19 +43,24 @@ public class Record {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private List<Operation> operationList;
 | 
					    private List<Operation> operationList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 记录版本
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 记录状态
 | 
					     * 记录状态
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String state;
 | 
					    private String state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 项目集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DBRef
 | 
				
			||||||
 | 
					    private Project project;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DBRef
 | 
					    @DBRef
 | 
				
			||||||
    private MetaData metaData;
 | 
					    private MetaData metaData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String metaDataType;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private List<String> projectList;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private long submitTime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										79
									
								
								src/main/java/com/example/survey/entity/Respondent.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								src/main/java/com/example/survey/entity/Respondent.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,79 @@
 | 
				
			|||||||
 | 
					package com.example.survey.entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.entity.inner.AdministrativeArea;
 | 
				
			||||||
 | 
					import com.example.survey.entity.inner.ProjectPart;
 | 
				
			||||||
 | 
					import lombok.*;
 | 
				
			||||||
 | 
					import org.bson.types.ObjectId;
 | 
				
			||||||
 | 
					import org.springframework.data.annotation.Id;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.index.CompoundIndex;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.index.CompoundIndexes;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 * 调查对象表
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					@Document(collection = "respondent")
 | 
				
			||||||
 | 
					@CompoundIndexes({
 | 
				
			||||||
 | 
					        @CompoundIndex(name = "unique",def = "{idNumber : 1, project : 1}",unique = true)
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					public class Respondent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * id
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    private ObjectId id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 身份证号
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 电话
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String phone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 姓名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 备注
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 性别
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String gender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 行政区划
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private AdministrativeArea administrativeArea;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分配的人员
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DBRef
 | 
				
			||||||
 | 
					    private User user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 项目
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @DBRef
 | 
				
			||||||
 | 
					    private Project project;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 调查对象状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String state;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -9,7 +9,6 @@ import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			|||||||
import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.Document;
 | 
					import org.springframework.data.mongodb.core.mapping.Document;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,11 @@ public class Operation {
 | 
				
			|||||||
    @DBRef
 | 
					    @DBRef
 | 
				
			||||||
    private User user;
 | 
					    private User user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 版本信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 备注
 | 
					     * 备注
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
@ -41,51 +46,45 @@ public class Operation {
 | 
				
			|||||||
    private String result;
 | 
					    private String result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static Operation submitOp(User user, String msg) {
 | 
					    public static Operation submitOp(User user, String msg, String version) {
 | 
				
			||||||
        Operation submit = new Operation();
 | 
					        Operation submit = new Operation();
 | 
				
			||||||
        submit.setType(OpTypeEnum.SUBMIT.getValue());
 | 
					        submit.setType(OpTypeEnum.SUBMIT.getValue());
 | 
				
			||||||
        submit.setTime(new Date());
 | 
					        submit.setTime(new Date());
 | 
				
			||||||
        submit.setUser(user);
 | 
					        submit.setUser(user);
 | 
				
			||||||
 | 
					        submit.setVersion(version);
 | 
				
			||||||
        submit.setMsg(msg);
 | 
					        submit.setMsg(msg);
 | 
				
			||||||
        submit.setResult("提交成功");
 | 
					        submit.setResult("提交成功");
 | 
				
			||||||
        return submit;
 | 
					        return submit;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static Operation modifyOp(User user, String msg) {
 | 
					    public static Operation modifyOp(User user, String msg, String version) {
 | 
				
			||||||
        Operation modify = new Operation();
 | 
					        Operation modify = new Operation();
 | 
				
			||||||
        modify.setType(OpTypeEnum.MODIFY.getValue());
 | 
					        modify.setType(OpTypeEnum.MODIFY.getValue());
 | 
				
			||||||
        modify.setTime(new Date());
 | 
					        modify.setTime(new Date());
 | 
				
			||||||
        modify.setUser(user);
 | 
					        modify.setUser(user);
 | 
				
			||||||
 | 
					        modify.setVersion(version);
 | 
				
			||||||
        modify.setMsg(msg);
 | 
					        modify.setMsg(msg);
 | 
				
			||||||
        modify.setResult("提交修改");
 | 
					        modify.setResult("提交修改");
 | 
				
			||||||
        return modify;
 | 
					        return modify;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static Operation modifyMetaOp(User user, String msg) {
 | 
					    public static Operation deleteOp(User user, String msg, String version) {
 | 
				
			||||||
        Operation modify = new Operation();
 | 
					 | 
				
			||||||
        modify.setType(OpTypeEnum.META.getValue());
 | 
					 | 
				
			||||||
        modify.setTime(new Date());
 | 
					 | 
				
			||||||
        modify.setUser(user);
 | 
					 | 
				
			||||||
        modify.setMsg(msg);
 | 
					 | 
				
			||||||
        modify.setResult("提交修改");
 | 
					 | 
				
			||||||
        return modify;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static Operation deleteOp(User user, String msg) {
 | 
					 | 
				
			||||||
        Operation delete = new Operation();
 | 
					        Operation delete = new Operation();
 | 
				
			||||||
        delete.setType(OpTypeEnum.DELETE.getValue());
 | 
					        delete.setType(OpTypeEnum.DELETE.getValue());
 | 
				
			||||||
        delete.setTime(new Date());
 | 
					        delete.setTime(new Date());
 | 
				
			||||||
        delete.setUser(user);
 | 
					        delete.setUser(user);
 | 
				
			||||||
 | 
					        delete.setVersion(version);
 | 
				
			||||||
        delete.setMsg(msg);
 | 
					        delete.setMsg(msg);
 | 
				
			||||||
        delete.setResult("删除成功");
 | 
					        delete.setResult("删除成功");
 | 
				
			||||||
        return delete;
 | 
					        return delete;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static Operation reviewOp(User user, String msg, boolean result) {
 | 
					    public static Operation reviewOp(User user, String msg, String version, boolean result) {
 | 
				
			||||||
        Operation review = new Operation();
 | 
					        Operation review = new Operation();
 | 
				
			||||||
        review.setType(OpTypeEnum.REVIEW.getValue());
 | 
					        review.setType(OpTypeEnum.REVIEW.getValue());
 | 
				
			||||||
        review.setTime(new Date());
 | 
					        review.setTime(new Date());
 | 
				
			||||||
        review.setUser(user);
 | 
					        review.setUser(user);
 | 
				
			||||||
 | 
					        review.setVersion(version);
 | 
				
			||||||
        review.setMsg(msg);
 | 
					        review.setMsg(msg);
 | 
				
			||||||
        if (result) {
 | 
					        if (result) {
 | 
				
			||||||
            review.setResult("审核通过");
 | 
					            review.setResult("审核通过");
 | 
				
			||||||
@ -100,6 +99,7 @@ public class Operation {
 | 
				
			|||||||
        cover.setType(OpTypeEnum.COVER.getValue());
 | 
					        cover.setType(OpTypeEnum.COVER.getValue());
 | 
				
			||||||
        cover.setTime(new Date());
 | 
					        cover.setTime(new Date());
 | 
				
			||||||
        cover.setUser(user);
 | 
					        cover.setUser(user);
 | 
				
			||||||
 | 
					        cover.setVersion(version);
 | 
				
			||||||
        cover.setMsg("因重复提交覆盖");
 | 
					        cover.setMsg("因重复提交覆盖");
 | 
				
			||||||
        cover.setResult("被覆盖");
 | 
					        cover.setResult("被覆盖");
 | 
				
			||||||
        return cover;
 | 
					        return cover;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,30 +0,0 @@
 | 
				
			|||||||
package com.example.survey.enumeration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.HashSet;
 | 
					 | 
				
			||||||
import java.util.LinkedList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Set;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * @author Pope
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public enum MetaDataTypeEnum {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    META_CONFIG("配置"),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    RECORD_TEMP("流调记录"),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    REPORT_TEMP("流调报告")
 | 
					 | 
				
			||||||
    ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private final String value;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    MetaDataTypeEnum(String value) {
 | 
					 | 
				
			||||||
        this.value = value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getValue() {
 | 
					 | 
				
			||||||
        return value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -28,7 +28,6 @@ public enum OpTypeEnum {
 | 
				
			|||||||
     * 覆盖
 | 
					     * 覆盖
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    COVER("覆盖"),
 | 
					    COVER("覆盖"),
 | 
				
			||||||
    META("修改模板"),
 | 
					 | 
				
			||||||
    ;
 | 
					    ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final String value;
 | 
					    private final String value;
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ public enum RecordStateEnum {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 已审核状态
 | 
					     * 已审核状态
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    REVIEWED("已通过"),
 | 
					    REVIEWED("已审核"),
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 待审核状态
 | 
					     * 待审核状态
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					package com.example.survey.enumeration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public enum RespondentStateEnum {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 已调查状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    INVESTIGATED("已调查"),
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 未调查状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    NOT_INVESTIGATED("未调查"),
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 已归档
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    FILED("已归档"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final String value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    RespondentStateEnum(String value) {
 | 
				
			||||||
 | 
					        this.value = value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getValue() {
 | 
				
			||||||
 | 
					        return value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -4,7 +4,6 @@ import com.example.survey.dto.metaData.CreateMetaDataDTO;
 | 
				
			|||||||
import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
				
			||||||
import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.vo.MetaDataVO;
 | 
					import com.example.survey.vo.MetaDataVO;
 | 
				
			||||||
import org.springframework.web.multipart.MultipartFile;
 | 
					import org.springframework.web.multipart.MultipartFile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -28,7 +27,7 @@ public interface MetaDataService {
 | 
				
			|||||||
     * @param pageSize 页大小
 | 
					     * @param pageSize 页大小
 | 
				
			||||||
     * @return 元数据名称
 | 
					     * @return 元数据名称
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<String> listMetaDataNameLimit(String name, String type, int currentPage, int pageSize);
 | 
					    List<String> listMetaDataNameLimit(String name, int currentPage, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据元数据名查询数量
 | 
					     * 根据元数据名查询数量
 | 
				
			||||||
@ -36,7 +35,7 @@ public interface MetaDataService {
 | 
				
			|||||||
     * @param name 元数据名
 | 
					     * @param name 元数据名
 | 
				
			||||||
     * @return 数量
 | 
					     * @return 数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countMetaData(String name, String type);
 | 
					    long countMetaData(String name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取所有元数据名字的列表
 | 
					     * 获取所有元数据名字的列表
 | 
				
			||||||
@ -63,4 +62,12 @@ public interface MetaDataService {
 | 
				
			|||||||
     * @param deleteMetaDataDTO 删除信息
 | 
					     * @param deleteMetaDataDTO 删除信息
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void deleteMetaData(DeleteMetaDataDTO deleteMetaDataDTO);
 | 
					    void deleteMetaData(DeleteMetaDataDTO deleteMetaDataDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 给元数据绑定模板文件
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param template 模板文件
 | 
				
			||||||
 | 
					     * @param name 元数据名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void bindWordTemplate(MultipartFile template, String name);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,8 @@
 | 
				
			|||||||
package com.example.survey.service;
 | 
					package com.example.survey.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dto.project.AddRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.CreateProjectDTO;
 | 
					import com.example.survey.dto.project.CreateProjectDTO;
 | 
				
			||||||
import com.example.survey.dto.project.DeleteRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.ModifyProjectDTO;
 | 
					import com.example.survey.dto.project.ModifyProjectDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.project.ModifyStateDTO;
 | 
				
			||||||
import com.example.survey.vo.ProjectVO;
 | 
					import com.example.survey.vo.ProjectVO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@ -14,6 +12,7 @@ import java.util.List;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public interface ProjectService {
 | 
					public interface ProjectService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 创建新项目
 | 
					     * 创建新项目
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -21,6 +20,7 @@ public interface ProjectService {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void createProject(CreateProjectDTO createProjectDTO);
 | 
					    void createProject(CreateProjectDTO createProjectDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据筛选条件分页查询项目
 | 
					     * 根据筛选条件分页查询项目
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -30,7 +30,7 @@ public interface ProjectService {
 | 
				
			|||||||
     * @param pageSize    页大小
 | 
					     * @param pageSize    页大小
 | 
				
			||||||
     * @return 项目vo
 | 
					     * @return 项目vo
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<ProjectVO> listProjectLimit(String name, long date_gt, long date_lt, int currentPage, int pageSize);
 | 
					    List<ProjectVO> listProjectLimit(String name, String state, int currentPage, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据项目名查询调查对象数量
 | 
					     * 根据项目名查询调查对象数量
 | 
				
			||||||
@ -38,7 +38,23 @@ public interface ProjectService {
 | 
				
			|||||||
     * @param name 项目名
 | 
					     * @param name 项目名
 | 
				
			||||||
     * @return 调查对象数量
 | 
					     * @return 调查对象数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countRecord(String name);
 | 
					    long countRespondent(String name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据项目名与调查对象状态查询调查对象数量
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param name            项目名
 | 
				
			||||||
 | 
					     * @param respondentState 调查对象状态
 | 
				
			||||||
 | 
					     * @return 调查对象数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    long countRespondent(String name, String respondentState);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改项目状态
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param modifyStateDTO 修改信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void modifyProjectState(ModifyStateDTO modifyStateDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 修改项目数据
 | 
					     * 修改项目数据
 | 
				
			||||||
@ -48,16 +64,11 @@ public interface ProjectService {
 | 
				
			|||||||
    void modifyProject(ModifyProjectDTO modifyProjectDTO);
 | 
					    void modifyProject(ModifyProjectDTO modifyProjectDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据项目名查询数量
 | 
					     * 根据项目吗查询数量
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param name  项目名
 | 
					     * @param name  项目名
 | 
				
			||||||
     * @param state 项目状态
 | 
					     * @param state 项目状态
 | 
				
			||||||
     * @return 数量
 | 
					     * @return 数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countProject(String name, long date_gt, long date_lt);
 | 
					    long countProject(String name, String state);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void addRecord(AddRecordDTO addRecordDTO);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void deleteRecord(DeleteRecordDTO deleteRecordDTO);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,15 @@ import java.util.Map;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public interface RecordService {
 | 
					public interface RecordService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据筛选条件查询流调记录数量
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param userPhone 用户电话号码
 | 
				
			||||||
 | 
					     * @param projectName 项目名
 | 
				
			||||||
 | 
					     * @return 符合筛选条件的调查记录数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    long countRecord(String userPhone, String projectName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 审核流调记录
 | 
					     * 审核流调记录
 | 
				
			||||||
@ -46,9 +55,8 @@ public interface RecordService {
 | 
				
			|||||||
     * @param questionnaireNumber 问卷编号
 | 
					     * @param questionnaireNumber 问卷编号
 | 
				
			||||||
     * @return 流调记录数量
 | 
					     * @return 流调记录数量
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    long countRecord(String idNumber, String state, String uuid, 
 | 
					    long countRecord(String idNumber, String userPhone, String projectName, String state, String version, String questionnaireNumber);
 | 
				
			||||||
                    String templateName, String templateType, 
 | 
					
 | 
				
			||||||
                    long submitTimeGt, long submitTimeLt, String projectName);
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据筛选条件查询流调记录
 | 
					     * 根据筛选条件查询流调记录
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -62,9 +70,7 @@ public interface RecordService {
 | 
				
			|||||||
     * @param pageSize            页大小
 | 
					     * @param pageSize            页大小
 | 
				
			||||||
     * @return 流调记录VO
 | 
					     * @return 流调记录VO
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    List<RecordVO> listRecordLimit(String idNumber, String state, String uuid, 
 | 
					    List<RecordVO> listRecordLimit(String idNumber, String userPhone, String projectName, String state, String version, String questionnaireNumber, int currentPage, int pageSize);
 | 
				
			||||||
                                String templateName, String templateType, 
 | 
					 | 
				
			||||||
                                long submitTimeGt, long submitTimeLt,  String projectName, int offset, int pageSize);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据筛选条件查询流调记录的values
 | 
					     * 根据筛选条件查询流调记录的values
 | 
				
			||||||
@ -74,7 +80,7 @@ public interface RecordService {
 | 
				
			|||||||
     * @param version 版本号
 | 
					     * @param version 版本号
 | 
				
			||||||
     * @return 流调记录的values
 | 
					     * @return 流调记录的values
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    Map<String,Object> getRecordValues(String uuid);
 | 
					    Map<String,Object> getRecordValues(String projectName, String idNumber, String version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 上传文件
 | 
					     * 上传文件
 | 
				
			||||||
@ -98,8 +104,14 @@ public interface RecordService {
 | 
				
			|||||||
     * @param projectName 项目名
 | 
					     * @param projectName 项目名
 | 
				
			||||||
     * @param response 响应
 | 
					     * @param response 响应
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void record2word(String idNumber, HttpServletResponse response);
 | 
					    void record2word(String idNumber, String projectName, HttpServletResponse response);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改流调记录对应项目
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param modifyProjectDTO 修改信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void modifyProject(ModifyProjectDTO modifyProjectDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 修改流调记录所绑定元数据
 | 
					     * 修改流调记录所绑定元数据
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,74 @@
 | 
				
			|||||||
 | 
					package com.example.survey.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.*;
 | 
				
			||||||
 | 
					import com.example.survey.vo.RespondentVO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface RespondentService {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 创建待调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param createRespondentDTO 待调查对象信息
 | 
				
			||||||
 | 
					     * @return 是否创建成功
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void createRespondent(CreateRespondentDTO createRespondentDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据流调人员电话号码分页查询待调查对象数据
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param userPhone   分配的人员电话号码
 | 
				
			||||||
 | 
					     * @param state       状态
 | 
				
			||||||
 | 
					     * @param idNumber    身份证号
 | 
				
			||||||
 | 
					     * @param name        调查对象姓名
 | 
				
			||||||
 | 
					     * @param phone       调查对象电话
 | 
				
			||||||
 | 
					     * @param province    省份
 | 
				
			||||||
 | 
					     * @param city        城市
 | 
				
			||||||
 | 
					     * @param county      区县
 | 
				
			||||||
 | 
					     * @param projectName 项目名
 | 
				
			||||||
 | 
					     * @param currentPage 当前页数
 | 
				
			||||||
 | 
					     * @param pageSize    页大小
 | 
				
			||||||
 | 
					     * @return 页数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<RespondentVO> listRespondentLimit(String userPhone, String state, String idNumber, String name, String phone, String province, String city, String county, String projectName, int currentPage, int pageSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据筛选条件查询调查对象数量
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param userPhone   分配的人员电话号码
 | 
				
			||||||
 | 
					     * @param state       状态
 | 
				
			||||||
 | 
					     * @param idNumber    身份证号
 | 
				
			||||||
 | 
					     * @param name        调查对象姓名
 | 
				
			||||||
 | 
					     * @param phone       调查对象电话
 | 
				
			||||||
 | 
					     * @param province    省份
 | 
				
			||||||
 | 
					     * @param city        城市
 | 
				
			||||||
 | 
					     * @param county      区县
 | 
				
			||||||
 | 
					     * @param projectName 项目名
 | 
				
			||||||
 | 
					     * @return 数量
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    long countRespondent(String userPhone, String state, String idNumber, String name, String phone, String province, String city, String county, String projectName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改调查对象信息
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param modifyRespondentDTO 修改信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void modifyRespondent(ModifyRespondentDTO modifyRespondentDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分配人员
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param modifyRespondentUserDTO 绑定用户信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void modifyUser(ModifyRespondentUserDTO modifyRespondentUserDTO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除调查对象
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param deleteRespondentDTO 删除信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void deleteRespondent(DeleteRespondentDTO deleteRespondentDTO);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -5,7 +5,6 @@ import com.example.survey.dto.metaData.CreateMetaDataDTO;
 | 
				
			|||||||
import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.DeleteMetaDataDTO;
 | 
				
			||||||
import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
					import com.example.survey.dto.metaData.ModifyMetaDataDTO;
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
import com.example.survey.enumeration.MetaDataTypeEnum;
 | 
					 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.exception.MetaDataException;
 | 
					import com.example.survey.exception.MetaDataException;
 | 
				
			||||||
import com.example.survey.service.MetaDataService;
 | 
					import com.example.survey.service.MetaDataService;
 | 
				
			||||||
@ -44,16 +43,15 @@ public class MetaDataServiceImpl implements MetaDataService {
 | 
				
			|||||||
        MetaData metaData = new MetaData();
 | 
					        MetaData metaData = new MetaData();
 | 
				
			||||||
        metaData.setName(createMetaDataDTO.getName());
 | 
					        metaData.setName(createMetaDataDTO.getName());
 | 
				
			||||||
        metaData.setForm(createMetaDataDTO.getForm());
 | 
					        metaData.setForm(createMetaDataDTO.getForm());
 | 
				
			||||||
        metaData.setType(createMetaDataDTO.getType());
 | 
					        metaData.setFieldToNameList(createMetaDataDTO.getFieldToNameList());
 | 
				
			||||||
        // metaData.setFieldToNameList(createMetaDataDTO.getFieldToNameList());
 | 
					        metaData.setConfig(createMetaDataDTO.getConfig());
 | 
				
			||||||
        // metaData.setConfig(createMetaDataDTO.getConfig());
 | 
					        metaData.setWordTemplate(createMetaDataDTO.getWordTemplate());
 | 
				
			||||||
        // metaData.setWordTemplate(createMetaDataDTO.getWordTemplate());
 | 
					 | 
				
			||||||
        metaDataDao.saveMetaData(metaData);
 | 
					        metaDataDao.saveMetaData(metaData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<String> listMetaDataNameLimit(String name, String type, int currentPage, int pageSize) {
 | 
					    public List<String> listMetaDataNameLimit(String name, int currentPage, int pageSize) {
 | 
				
			||||||
        List<MetaData> metaDataList = metaDataDao.listMetaDataLimit(name, type, currentPage * pageSize, pageSize);
 | 
					        List<MetaData> metaDataList = metaDataDao.listMetaDataLimit(name, currentPage * pageSize, pageSize);
 | 
				
			||||||
        if (metaDataList == null) {
 | 
					        if (metaDataList == null) {
 | 
				
			||||||
            return new ArrayList<>();
 | 
					            return new ArrayList<>();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -63,8 +61,8 @@ public class MetaDataServiceImpl implements MetaDataService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countMetaData(String name, String type) {
 | 
					    public long countMetaData(String name) {
 | 
				
			||||||
        return metaDataDao.countMetaData(name, type);
 | 
					        return metaDataDao.countMetaData(name);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@ -79,12 +77,8 @@ public class MetaDataServiceImpl implements MetaDataService {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        MetaData metaData = metaDataDao.selectMetaData(modifyMetaDataDTO.getName());
 | 
					        MetaData metaData = metaDataDao.selectMetaData(modifyMetaDataDTO.getName());
 | 
				
			||||||
        metaData.setForm(modifyMetaDataDTO.getForm());
 | 
					        metaData.setForm(modifyMetaDataDTO.getForm());
 | 
				
			||||||
        if(modifyMetaDataDTO.getType() != null) {
 | 
					        metaData.setFieldToNameList(modifyMetaDataDTO.getFieldToNameList());
 | 
				
			||||||
            metaData.setType(modifyMetaDataDTO.getType());
 | 
					        metaData.setConfig(modifyMetaDataDTO.getConfig());
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        // metaData.setFieldToNameList(modifyMetaDataDTO.getFieldToNameList());
 | 
					 | 
				
			||||||
        // metaData.setConfig(modifyMetaDataDTO.getConfig());
 | 
					 | 
				
			||||||
        metaDataDao.saveMetaData(metaData);
 | 
					        metaDataDao.saveMetaData(metaData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -99,9 +93,50 @@ public class MetaDataServiceImpl implements MetaDataService {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void deleteMetaData(DeleteMetaDataDTO deleteMetaDataDTO) {
 | 
					    public void deleteMetaData(DeleteMetaDataDTO deleteMetaDataDTO) {
 | 
				
			||||||
        if (!metaDataDao.existMetaData(deleteMetaDataDTO.getName())) {
 | 
					        if (!metaDataDao.existMetaData(deleteMetaDataDTO.getName())) {
 | 
				
			||||||
            throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
 | 
					            throw new MetaDataException(ResultEnum.ALREADY_EXIST_METADATA);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        metaDataDao.deleteMetaData(deleteMetaDataDTO.getName());
 | 
					        metaDataDao.deleteMetaData(deleteMetaDataDTO.getName());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void bindWordTemplate(MultipartFile template, String name) {
 | 
				
			||||||
 | 
					        if (!metaDataDao.existMetaData(name)) {
 | 
				
			||||||
 | 
					            throw new MetaDataException(ResultEnum.ALREADY_EXIST_METADATA);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        MetaData metaData = metaDataDao.selectMetaData(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String filename = template.getOriginalFilename();
 | 
				
			||||||
 | 
					        String suffix = filename.substring(filename.lastIndexOf('.'));
 | 
				
			||||||
 | 
					        String newName = UUID.randomUUID().toString() + suffix;
 | 
				
			||||||
 | 
					        File newFile = new File(path + newName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        OutputStream os = null;
 | 
				
			||||||
 | 
					        InputStream is = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            os = new FileOutputStream(newFile);
 | 
				
			||||||
 | 
					            is = template.getInputStream();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            byte[] buffer = new byte[1024];
 | 
				
			||||||
 | 
					            int len;
 | 
				
			||||||
 | 
					            while ((len = is.read(buffer)) != -1) {
 | 
				
			||||||
 | 
					                os.write(buffer, 0, len);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					        } finally {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                if (os != null) {
 | 
				
			||||||
 | 
					                    os.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (is != null) {
 | 
				
			||||||
 | 
					                    is.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } catch (IOException e) {
 | 
				
			||||||
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        metaData.setWordTemplate(path + newName);
 | 
				
			||||||
 | 
					        metaDataDao.saveMetaData(metaData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,31 +2,24 @@ package com.example.survey.service.impl;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.survey.dao.MetaDataDao;
 | 
					import com.example.survey.dao.MetaDataDao;
 | 
				
			||||||
import com.example.survey.dao.ProjectDao;
 | 
					import com.example.survey.dao.ProjectDao;
 | 
				
			||||||
import com.example.survey.dao.RecordDao;
 | 
					import com.example.survey.dao.RespondentDao;
 | 
				
			||||||
import com.example.survey.dao.UserDao;
 | 
					import com.example.survey.dao.UserDao;
 | 
				
			||||||
import com.example.survey.dto.project.AddRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.CreateProjectDTO;
 | 
					import com.example.survey.dto.project.CreateProjectDTO;
 | 
				
			||||||
import com.example.survey.dto.project.DeleteRecordDTO;
 | 
					 | 
				
			||||||
import com.example.survey.dto.project.ModifyProjectDTO;
 | 
					import com.example.survey.dto.project.ModifyProjectDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.project.ModifyStateDTO;
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
import com.example.survey.entity.Project;
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
import com.example.survey.entity.Record;
 | 
					 | 
				
			||||||
import com.example.survey.entity.User;
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
import com.example.survey.enumeration.ProjectStateEnum;
 | 
					import com.example.survey.enumeration.ProjectStateEnum;
 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
import com.example.survey.exception.MetaDataException;
 | 
					import com.example.survey.exception.MetaDataException;
 | 
				
			||||||
import com.example.survey.exception.ProjectException;
 | 
					import com.example.survey.exception.ProjectException;
 | 
				
			||||||
import com.example.survey.exception.RecordException;
 | 
					 | 
				
			||||||
import com.example.survey.exception.UserException;
 | 
					import com.example.survey.exception.UserException;
 | 
				
			||||||
import com.example.survey.service.ProjectService;
 | 
					import com.example.survey.service.ProjectService;
 | 
				
			||||||
import com.example.survey.vo.ProjectVO;
 | 
					import com.example.survey.vo.ProjectVO;
 | 
				
			||||||
 | 
					 | 
				
			||||||
// import org.apache.poi.ss.formula.functions.T;
 | 
					 | 
				
			||||||
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.ArrayList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -39,127 +32,108 @@ public class ProjectServiceImpl implements ProjectService {
 | 
				
			|||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    ProjectDao projectDao;
 | 
					    ProjectDao projectDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    RespondentDao respondentDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    MetaDataDao metaDataDao;
 | 
					    MetaDataDao metaDataDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    UserDao userDao;
 | 
					    UserDao userDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    RecordDao recordDao;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void createProject(CreateProjectDTO createProjectDTO) {
 | 
					    public void createProject(CreateProjectDTO createProjectDTO) {
 | 
				
			||||||
 | 
					        if (!userDao.existUser(createProjectDTO.getUserPhone())) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!metaDataDao.existMetaData(createProjectDTO.getMetaDataName())) {
 | 
				
			||||||
 | 
					            throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(createProjectDTO.getUserPhone());
 | 
				
			||||||
 | 
					        MetaData metaData = metaDataDao.selectMetaData(createProjectDTO.getMetaDataName());
 | 
				
			||||||
        Project project = new Project();
 | 
					        Project project = new Project();
 | 
				
			||||||
        project.setName(createProjectDTO.getName());
 | 
					        project.setName(createProjectDTO.getName());
 | 
				
			||||||
        project.setDate(System.currentTimeMillis());
 | 
					        // project.setMetaData(metaData);
 | 
				
			||||||
        User user = userDao.selectUser(createProjectDTO.getPhone());
 | 
					        project.setStartTime(createProjectDTO.getStartTime());
 | 
				
			||||||
 | 
					        project.setEndTime(createProjectDTO.getEndTime());
 | 
				
			||||||
 | 
					        project.setDetail(createProjectDTO.getDetail());
 | 
				
			||||||
 | 
					        project.setState(ProjectStateEnum.IN_PROGRESS.getValue());
 | 
				
			||||||
        project.setUser(user);
 | 
					        project.setUser(user);
 | 
				
			||||||
        projectDao.saveProject(project);
 | 
					        projectDao.saveProject(project);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<ProjectVO> listProjectLimit(String name, long date_gt, long date_lt, int currentPage, int pageSize) {
 | 
					    public List<ProjectVO> listProjectLimit(String name, String state, int currentPage, int pageSize) {
 | 
				
			||||||
        return projectDao.listProjectLimit(name, date_gt, date_lt, currentPage * pageSize, pageSize).stream()
 | 
					        return projectDao.listProjectLimit(name, state, currentPage * pageSize, pageSize).stream()
 | 
				
			||||||
                .map(project -> {
 | 
					                .map(project -> {
 | 
				
			||||||
                    ProjectVO projectVO = new ProjectVO();
 | 
					                    ProjectVO projectVO = new ProjectVO();
 | 
				
			||||||
                    projectVO.setName(project.getName());
 | 
					                    projectVO.setName(project.getName());
 | 
				
			||||||
                    projectVO.setDate(project.getDate());
 | 
					                    projectVO.setDetail(project.getDetail());
 | 
				
			||||||
                    projectVO.setUserName(project.getUser().getUsername());
 | 
					                    projectVO.setStartTime(project.getStartTime());
 | 
				
			||||||
                    projectVO.setUserPhone(project.getUser().getPhone());
 | 
					                    projectVO.setEndTime(project.getEndTime());
 | 
				
			||||||
                    projectVO.setCount(project.getCount());
 | 
					                    projectVO.setUsername(project.getUser().getUsername());
 | 
				
			||||||
 | 
					                    // if (project.getMetaData() != null) {
 | 
				
			||||||
 | 
					                    //     projectVO.setMetaDataName(project.getMetaData().getName());
 | 
				
			||||||
 | 
					                    // }
 | 
				
			||||||
 | 
					                    projectVO.setState(project.getState());
 | 
				
			||||||
                    return projectVO;
 | 
					                    return projectVO;
 | 
				
			||||||
                }).collect(Collectors.toList());
 | 
					                }).collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countRecord(String name) {
 | 
					    public long countRespondent(String name) {
 | 
				
			||||||
        if (!projectDao.existProject(name)) {
 | 
					        if (!projectDao.existProject(name)) {
 | 
				
			||||||
            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        return projectDao.selectProject(name).getRespondentCount();
 | 
				
			||||||
        return recordDao.countRecord(null, null, null, 
 | 
					 | 
				
			||||||
                                    null, null, 0, 0, name);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public long countRespondent(String name, String respondentState) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(name)) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(name);
 | 
				
			||||||
 | 
					        return project.getNotInvestigatedRespondentCount();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void modifyProjectState(ModifyStateDTO modifyStateDTO) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(modifyStateDTO.getName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyStateDTO.getName());
 | 
				
			||||||
 | 
					        for (ProjectStateEnum value : ProjectStateEnum.values()) {
 | 
				
			||||||
 | 
					            if (value.getValue().equals(modifyStateDTO.getState())) {
 | 
				
			||||||
 | 
					                project.setState(modifyStateDTO.getState());
 | 
				
			||||||
 | 
					                projectDao.saveProject(project);
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT_STATE);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void modifyProject(ModifyProjectDTO modifyProjectDTO) {
 | 
					    public void modifyProject(ModifyProjectDTO modifyProjectDTO) {
 | 
				
			||||||
      
 | 
					        if (!userDao.existUser(modifyProjectDTO.getUserPhone())) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (!projectDao.existProject(modifyProjectDTO.getName())) {
 | 
					        if (!projectDao.existProject(modifyProjectDTO.getName())) {
 | 
				
			||||||
            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        User user = userDao.selectUser(modifyProjectDTO.getPhone());
 | 
					        User user = userDao.selectUser(modifyProjectDTO.getUserPhone());
 | 
				
			||||||
        Project project = projectDao.selectProject(modifyProjectDTO.getName());
 | 
					        Project project = projectDao.selectProject(modifyProjectDTO.getName());
 | 
				
			||||||
 | 
					        project.setDetail(modifyProjectDTO.getDetail());
 | 
				
			||||||
 | 
					        project.setStartTime(modifyProjectDTO.getStartTime());
 | 
				
			||||||
 | 
					        project.setEndTime(modifyProjectDTO.getEndTime());
 | 
				
			||||||
        project.setUser(user);
 | 
					        project.setUser(user);
 | 
				
			||||||
        projectDao.saveProject(project);
 | 
					        projectDao.saveProject(project);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countProject(String name, long date_gt, long date_lt) {
 | 
					    public long countProject(String name, String state) {
 | 
				
			||||||
        return projectDao.countProject(name, date_gt, date_lt);
 | 
					        return projectDao.countProject(name, state);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void addRecord(AddRecordDTO addRecordDTO) {
 | 
					 | 
				
			||||||
        if(!projectDao.existProject(addRecordDTO.getName()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(!recordDao.existRecord(addRecordDTO.getUuid()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Project project = projectDao.selectProject(addRecordDTO.getName());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Record record = recordDao.getRecord(addRecordDTO.getUuid());
 | 
					 | 
				
			||||||
        List<String> t =  record.getProjectList();
 | 
					 | 
				
			||||||
        if(t == null) {
 | 
					 | 
				
			||||||
            t = new ArrayList<>();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(!t.contains(project.getName()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            t.add(project.getName());
 | 
					 | 
				
			||||||
            record.setProjectList(t);
 | 
					 | 
				
			||||||
            recordDao.saveRecord(record);
 | 
					 | 
				
			||||||
            project.setCount(project.getCount() + 1);
 | 
					 | 
				
			||||||
            projectDao.saveProject(project);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void deleteRecord(DeleteRecordDTO deleteRecordDTO) {
 | 
					 | 
				
			||||||
        if(!projectDao.existProject(deleteRecordDTO.getName()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(!recordDao.existRecord(deleteRecordDTO.getUuid()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Project project = projectDao.selectProject(deleteRecordDTO.getName());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Record record = recordDao.getRecord(deleteRecordDTO.getUuid());
 | 
					 | 
				
			||||||
        List<String> t =  record.getProjectList();
 | 
					 | 
				
			||||||
        if(t == null) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if(t.contains(project.getName()))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
        //    List<String> t =  record.getProjectList();
 | 
					 | 
				
			||||||
            t.remove(project.getName());
 | 
					 | 
				
			||||||
            record.setProjectList(t);
 | 
					 | 
				
			||||||
            recordDao.saveRecord(record);
 | 
					 | 
				
			||||||
            project.setCount(project.getCount() - 1);
 | 
					 | 
				
			||||||
            projectDao.saveProject(project);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ import com.example.survey.dto.record.*;
 | 
				
			|||||||
import com.example.survey.entity.*;
 | 
					import com.example.survey.entity.*;
 | 
				
			||||||
import com.example.survey.entity.inner.Operation;
 | 
					import com.example.survey.entity.inner.Operation;
 | 
				
			||||||
import com.example.survey.enumeration.RecordStateEnum;
 | 
					import com.example.survey.enumeration.RecordStateEnum;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.RespondentStateEnum;
 | 
				
			||||||
import com.example.survey.enumeration.ResultEnum;
 | 
					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;
 | 
				
			||||||
@ -33,9 +33,13 @@ import java.util.stream.Collectors;
 | 
				
			|||||||
@Service
 | 
					@Service
 | 
				
			||||||
public class RecordServiceImpl implements RecordService {
 | 
					public class RecordServiceImpl implements RecordService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private RecordDao recordDao;
 | 
					    private RecordDao recordDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private RespondentDao respondentDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private UserDao userDao;
 | 
					    private UserDao userDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -51,6 +55,18 @@ public class RecordServiceImpl implements RecordService {
 | 
				
			|||||||
    @Value("${file.url}")
 | 
					    @Value("${file.url}")
 | 
				
			||||||
    private String url;
 | 
					    private String url;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public long countRecord(String userPhone, String projectName) {
 | 
				
			||||||
 | 
					        if (userPhone != null && !userDao.existUser(userPhone)) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (projectName != null && !projectDao.existProject(projectName)) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(userPhone);
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					        return recordDao.countRecord(null, user, project, RecordStateEnum.UNDER_REVIEW.getValue(), null, null);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void reviewRecord(ReviewRecordDTO reviewRecordDTO) {
 | 
					    public void reviewRecord(ReviewRecordDTO reviewRecordDTO) {
 | 
				
			||||||
@ -58,15 +74,23 @@ public class RecordServiceImpl implements RecordService {
 | 
				
			|||||||
            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 (!projectDao.existProject(reviewRecordDTO.getProjectName())) {
 | 
				
			||||||
        if (!recordDao.existRecord(reviewRecordDTO.getUuid())) {
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(reviewRecordDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(reviewRecordDTO.getIdNumber(), project, RespondentStateEnum.INVESTIGATED.getValue())) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(reviewRecordDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					        if (!recordDao.existRecord(respondent, project, RecordStateEnum.UNDER_REVIEW.getValue())) {
 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Record record = recordDao.getRecord( reviewRecordDTO.getUuid());
 | 
					        Record record = recordDao.getRecord(respondent, project, RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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(), record.getVersion(), reviewRecordDTO.getPass());
 | 
				
			||||||
        List<Operation> opList = record.getOperationList();
 | 
					        List<Operation> opList = record.getOperationList();
 | 
				
			||||||
        opList.add(reviewOp);
 | 
					        opList.add(reviewOp);
 | 
				
			||||||
        record.setOperationList(opList);
 | 
					        record.setOperationList(opList);
 | 
				
			||||||
@ -80,18 +104,44 @@ 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());
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(modifyRecordDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyRecordDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(modifyRecordDTO.getIdNumber(), project, RespondentStateEnum.INVESTIGATED.getValue())) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(modifyRecordDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Record record = recordDao.getRecord(modifyRecordDTO.getUuid());
 | 
					        List<String> stateList = new ArrayList<>();
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.REVIEWED.getValue());
 | 
				
			||||||
 | 
					        Record record = recordDao.selectRecord(respondent, project, stateList);
 | 
				
			||||||
        if (record == null) {
 | 
					        if (record == null) {
 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        List<Operation> operationList = record.getOperationList();
 | 
					 | 
				
			||||||
        Operation modifyOp = Operation.modifyOp(user, modifyRecordDTO.getMsg());
 | 
					 | 
				
			||||||
        operationList.add(modifyOp);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        record.setOperationList(operationList);
 | 
					        String newVersion = UUID.randomUUID().toString();
 | 
				
			||||||
        record.setState(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
					        List<Operation> oldOperationList = record.getOperationList();
 | 
				
			||||||
 | 
					        List<Operation> newOperationList = record.getOperationList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Operation coverOp = Operation.coverOp(user, newVersion);
 | 
				
			||||||
 | 
					        oldOperationList.add(coverOp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Operation modifyOp = Operation.modifyOp(user, modifyRecordDTO.getMsg(), newVersion);
 | 
				
			||||||
 | 
					        newOperationList.add(modifyOp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        record.setOperationList(oldOperationList);
 | 
				
			||||||
 | 
					        record.setState(RecordStateEnum.FILED.getValue());
 | 
				
			||||||
        recordDao.saveRecord(record);
 | 
					        recordDao.saveRecord(record);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        record.setId(null);
 | 
				
			||||||
 | 
					        record.setValues(modifyRecordDTO.getValues());
 | 
				
			||||||
 | 
					        record.setOperationList(newOperationList);
 | 
				
			||||||
 | 
					        record.setState(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        recordDao.saveRecord(record);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@ -100,67 +150,128 @@ public class RecordServiceImpl implements RecordService {
 | 
				
			|||||||
            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        User user = userDao.selectUser(submitRecordDTO.getUserPhone());
 | 
					        User user = userDao.selectUser(submitRecordDTO.getUserPhone());
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(submitRecordDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(submitRecordDTO.getProjectName());
 | 
				
			||||||
        if (!metaDataDao.existMetaData(submitRecordDTO.getMetaDataName())) {
 | 
					        if (!metaDataDao.existMetaData(submitRecordDTO.getMetaDataName())) {
 | 
				
			||||||
            throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
 | 
					            throw new MetaDataException(ResultEnum.NOT_EXIST_METADATA);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        MetaData metaData = metaDataDao.selectMetaData(submitRecordDTO.getMetaDataName());
 | 
					        MetaData metaData = metaDataDao.selectMetaData(submitRecordDTO.getMetaDataName());
 | 
				
			||||||
        Record record = new Record();
 | 
					        if (!respondentDao.existRespondent(submitRecordDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(submitRecordDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					        //设置调查对象为已调查
 | 
				
			||||||
 | 
					        respondent.setState(RespondentStateEnum.INVESTIGATED.getValue());
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<String> stateList = new ArrayList<>();
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.REVIEWED.getValue());
 | 
				
			||||||
 | 
					        Record record = recordDao.selectRecord(respondent, project, stateList);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String newVersion = UUID.randomUUID().toString();
 | 
				
			||||||
 | 
					        List<Operation> oldOperationList = new ArrayList<>();
 | 
				
			||||||
 | 
					        List<Operation> newOperationList = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (record != null) {
 | 
				
			||||||
 | 
					            oldOperationList = record.getOperationList();
 | 
				
			||||||
 | 
					            newOperationList = record.getOperationList();
 | 
				
			||||||
 | 
					            Operation coverOp = Operation.coverOp(user, newVersion);
 | 
				
			||||||
 | 
					            oldOperationList.add(coverOp);
 | 
				
			||||||
 | 
					            record.setOperationList(oldOperationList);
 | 
				
			||||||
 | 
					            record.setState(RecordStateEnum.FILED.getValue());
 | 
				
			||||||
 | 
					            recordDao.saveRecord(record);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            record = new Record();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        record.setProject(project);
 | 
				
			||||||
        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(), newVersion);
 | 
				
			||||||
        List<Operation> operations = new ArrayList<>();
 | 
					        newOperationList.add(submitOp);
 | 
				
			||||||
        operations.add(submitOp);
 | 
					        record.setOperationList(newOperationList);
 | 
				
			||||||
        record.setOperationList(operations);
 | 
					 | 
				
			||||||
        record.setUuid(submitRecordDTO.getUuid());
 | 
					 | 
				
			||||||
        record.setIdNumber(submitRecordDTO.getIdNumber());
 | 
					 | 
				
			||||||
        record.setState(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
					        record.setState(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
        record.setMetaData(metaData);
 | 
					        record.setMetaData(metaData);
 | 
				
			||||||
        record.setMetaDataType(metaData.getType());
 | 
					        record.setVersion(newVersion);
 | 
				
			||||||
        record.setSubmitTime(System.currentTimeMillis());
 | 
					 | 
				
			||||||
        recordDao.saveRecord(record);
 | 
					        recordDao.saveRecord(record);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long countRecord(String idNumber, String state, String uuid, 
 | 
					    public long countRecord(String idNumber, String userPhone, String projectName, String state, String version, String questionnaireNumber) {
 | 
				
			||||||
                String templateName, String templateType, 
 | 
					        if (projectName != null && !projectDao.existProject(projectName)) {
 | 
				
			||||||
                long submitTimeGt, long submitTimeLt, String projectName) {
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return recordDao.countRecord(idNumber, state, uuid, templateName, templateType, submitTimeGt, submitTimeLt, projectName);
 | 
					        if (userPhone != null && !userDao.existUser(userPhone)) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(userPhone);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (idNumber != null && !respondentDao.existRespondent(idNumber, project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(idNumber, project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return recordDao.countRecord(respondent, user, project, state, version, questionnaireNumber);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<RecordVO> listRecordLimit(String idNumber, String state, String uuid, 
 | 
					    public List<RecordVO> listRecordLimit(String idNumber, String userPhone, String projectName, String state, String version, String questionnaireNumber, int currentPage, int pageSize) {
 | 
				
			||||||
            String templateName, String templateType, 
 | 
					        if (userPhone != null && !userDao.existUser(userPhone)) {
 | 
				
			||||||
            long submitTimeGt, long submitTimeLt, String projectName, int currentPage, int pageSize) {
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(userPhone);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<Record> recordList = recordDao.listRecordLimit(idNumber, state, uuid, templateName, templateType, submitTimeGt, submitTimeLt, projectName, currentPage * pageSize, pageSize);
 | 
					        if (projectName != null && !projectDao.existProject(projectName)) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (idNumber != null && !respondentDao.existRespondent(idNumber, project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(idNumber, project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Record> recordList = recordDao.listRecordLimit(respondent, user, project, state, version, questionnaireNumber, 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.getRespondent().getIdNumber());
 | 
				
			||||||
            recordVO.setUuid(record.getUuid());
 | 
					            recordVO.setUserPhone(record.getUser().getPhone());
 | 
				
			||||||
            recordVO.setTemplate(record.getMetaData().getName());
 | 
					            recordVO.setProjectName(record.getProject().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());
 | 
				
			||||||
                operationInfo.setTime(op.getTime());
 | 
					                operationInfo.setTime(op.getTime());
 | 
				
			||||||
                operationInfo.setPersonId(op.getUser().getPhone());
 | 
					                operationInfo.setUserPhone(op.getUser().getPhone());
 | 
				
			||||||
                operationInfo.setPersonName(op.getUser().getUsername());
 | 
					 | 
				
			||||||
                operationInfo.setMsg(op.getMsg());
 | 
					                operationInfo.setMsg(op.getMsg());
 | 
				
			||||||
                operationInfo.setResult(op.getResult());
 | 
					                operationInfo.setResult(op.getResult());
 | 
				
			||||||
 | 
					                operationInfo.setVersion(op.getVersion());
 | 
				
			||||||
                return operationInfo;
 | 
					                return operationInfo;
 | 
				
			||||||
            }).collect(Collectors.toList()));
 | 
					            }).collect(Collectors.toList()));
 | 
				
			||||||
 | 
					            recordVO.setVersion(record.getVersion());
 | 
				
			||||||
            recordVO.setState(record.getState());
 | 
					            recordVO.setState(record.getState());
 | 
				
			||||||
            recordVO.setSubmitTime(record.getSubmitTime());
 | 
					 | 
				
			||||||
            return recordVO;
 | 
					            return recordVO;
 | 
				
			||||||
        }).collect(Collectors.toList());
 | 
					        }).collect(Collectors.toList());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Map<String, Object> getRecordValues(String uuid) {
 | 
					    public Map<String, Object> getRecordValues(String projectName, String idNumber, String version) {
 | 
				
			||||||
        
 | 
					        if (!projectDao.existProject(projectName)) {
 | 
				
			||||||
        Record record = recordDao.getRecord(uuid);
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(idNumber, project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(idNumber, project);
 | 
				
			||||||
 | 
					        Record record = recordDao.selectRecord(respondent, project, version);
 | 
				
			||||||
        if (record == null) {
 | 
					        if (record == null) {
 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -206,17 +317,29 @@ public class RecordServiceImpl implements RecordService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void deleteRecord(DeleteRecordDTO deleteRecordDTO) {
 | 
					    public void deleteRecord(DeleteRecordDTO deleteRecordDTO) {
 | 
				
			||||||
        if (!userDao.existUser(deleteRecordDTO.getPhone())) {
 | 
					        if (!userDao.existUser(deleteRecordDTO.getUserPhone())) {
 | 
				
			||||||
            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.getUserPhone());
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(deleteRecordDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(deleteRecordDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(deleteRecordDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(deleteRecordDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Record record = recordDao.getRecord(deleteRecordDTO.getUuid());
 | 
					        List<String> stateList = new ArrayList<>();
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.REVIEWED.getValue());
 | 
				
			||||||
 | 
					        stateList.add(RecordStateEnum.NOT_PASS.getValue());
 | 
				
			||||||
 | 
					        Record record = recordDao.selectRecord(respondent, project, stateList);
 | 
				
			||||||
        if (record == null) {
 | 
					        if (record == null) {
 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        List<Operation> operationList = record.getOperationList();
 | 
					        List<Operation> operationList = record.getOperationList();
 | 
				
			||||||
        Operation deleteOp = Operation.deleteOp(user, deleteRecordDTO.getMsg());
 | 
					        Operation deleteOp = Operation.deleteOp(user, deleteRecordDTO.getMsg(), record.getVersion());
 | 
				
			||||||
        operationList.add(deleteOp);
 | 
					        operationList.add(deleteOp);
 | 
				
			||||||
        record.setOperationList(operationList);
 | 
					        record.setOperationList(operationList);
 | 
				
			||||||
        record.setState(RecordStateEnum.FILED.getValue());
 | 
					        record.setState(RecordStateEnum.FILED.getValue());
 | 
				
			||||||
@ -224,37 +347,70 @@ public class RecordServiceImpl implements RecordService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void record2word(String uuid, HttpServletResponse response) {
 | 
					    public void record2word(String idNumber, String projectName, HttpServletResponse response) {
 | 
				
			||||||
        Record record = recordDao.getRecord(uuid);
 | 
					        //TODO 导出为word
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void modifyProject(ModifyProjectDTO modifyProjectDTO) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(modifyProjectDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyProjectDTO.getProjectName());
 | 
				
			||||||
 | 
					        if(!projectDao.existProject(modifyProjectDTO.getNewProjectName())){
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project newProject = projectDao.selectProject(modifyProjectDTO.getNewProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(modifyProjectDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(modifyProjectDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<String> states = new ArrayList<>();
 | 
				
			||||||
 | 
					        states.add(RecordStateEnum.REVIEWED.getValue());
 | 
				
			||||||
 | 
					        states.add(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
 | 
					        Record record = recordDao.selectRecord(respondent, project, states);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //如果新项目已经存在调查对象则覆盖
 | 
				
			||||||
 | 
					        respondent.setId(null);
 | 
				
			||||||
 | 
					        respondent.setPhone(modifyProjectDTO.getPhone());
 | 
				
			||||||
 | 
					        respondent.setName(modifyProjectDTO.getName());
 | 
				
			||||||
 | 
					        respondent.setMsg(modifyProjectDTO.getMsg());
 | 
				
			||||||
 | 
					        respondent.setGender(modifyProjectDTO.getGender());
 | 
				
			||||||
 | 
					        respondent.setAdministrativeArea(modifyProjectDTO.getAdministrativeArea());
 | 
				
			||||||
 | 
					        respondent.setProject(newProject);
 | 
				
			||||||
 | 
					        if(respondentDao.existRespondent(modifyProjectDTO.getIdNumber(),newProject)){
 | 
				
			||||||
 | 
					            respondent.setId(respondentDao.selectRespondent(modifyProjectDTO.getIdNumber(), project).getId());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        record.setRespondent(respondent);
 | 
				
			||||||
 | 
					        record.setProject(project);
 | 
				
			||||||
 | 
					        recordDao.saveRecord(record);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void modifyMetaData(ModifyMetaDataDTO modifyMetaDataDTO) {
 | 
					    public void modifyMetaData(ModifyMetaDataDTO modifyMetaDataDTO) {
 | 
				
			||||||
       
 | 
					        if (!projectDao.existProject(modifyMetaDataDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyMetaDataDTO.getProjectName());
 | 
				
			||||||
        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());
 | 
				
			||||||
       
 | 
					        if (!respondentDao.existRespondent(modifyMetaDataDTO.getIdNumber(), project)) {
 | 
				
			||||||
        Record record = recordDao.getRecord(modifyMetaDataDTO.getUuid());
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
        if(record == null) {
 | 
					 | 
				
			||||||
            throw new RecordException(ResultEnum.NOT_EXIST_RECORD);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(modifyMetaDataDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!userDao.existUser(modifyMetaDataDTO.getPhone())) {
 | 
					        List<String> states = new ArrayList<>();
 | 
				
			||||||
            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
					        states.add(RecordStateEnum.REVIEWED.getValue());
 | 
				
			||||||
        }
 | 
					        states.add(RecordStateEnum.UNDER_REVIEW.getValue());
 | 
				
			||||||
        User user = userDao.selectUser(modifyMetaDataDTO.getPhone());
 | 
					        Record record = recordDao.selectRecord(respondent, project, states);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        List<Operation> operationList = record.getOperationList();
 | 
					 | 
				
			||||||
        String msg = record.getMetaData().getName() +"->" + modifyMetaDataDTO.getMetaDataName();
 | 
					 | 
				
			||||||
        Operation modifyMetaOp = Operation.modifyMetaOp(user, msg);
 | 
					 | 
				
			||||||
        // modifyMetaOp.setMsg();
 | 
					 | 
				
			||||||
        operationList.add(modifyMetaOp);
 | 
					 | 
				
			||||||
        record.setOperationList(operationList);
 | 
					 | 
				
			||||||
        record.setMetaData(metaData);
 | 
					        record.setMetaData(metaData);
 | 
				
			||||||
        recordDao.saveRecord(record);
 | 
					        recordDao.saveRecord(record);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,175 @@
 | 
				
			|||||||
 | 
					package com.example.survey.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.example.survey.dao.ProjectDao;
 | 
				
			||||||
 | 
					import com.example.survey.dao.RespondentDao;
 | 
				
			||||||
 | 
					import com.example.survey.dao.UserDao;
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.CreateRespondentDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.DeleteRespondentDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.ModifyRespondentDTO;
 | 
				
			||||||
 | 
					import com.example.survey.dto.respondent.ModifyRespondentUserDTO;
 | 
				
			||||||
 | 
					import com.example.survey.entity.Project;
 | 
				
			||||||
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
 | 
					import com.example.survey.entity.User;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.RespondentStateEnum;
 | 
				
			||||||
 | 
					import com.example.survey.enumeration.ResultEnum;
 | 
				
			||||||
 | 
					import com.example.survey.exception.ProjectException;
 | 
				
			||||||
 | 
					import com.example.survey.exception.RespondentException;
 | 
				
			||||||
 | 
					import com.example.survey.exception.UserException;
 | 
				
			||||||
 | 
					import com.example.survey.service.RespondentService;
 | 
				
			||||||
 | 
					import com.example.survey.vo.RespondentVO;
 | 
				
			||||||
 | 
					import com.example.survey.vo.inner.UserInfo;
 | 
				
			||||||
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @author Pope
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Log4j2
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class RespondentServiceImpl implements RespondentService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private RespondentDao respondentDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private ProjectDao projectDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private UserDao userDao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void createRespondent(CreateRespondentDTO createRespondentDTO) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(createRespondentDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!userDao.existUser(createRespondentDTO.getUserPhone())) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(createRespondentDTO.getProjectName());
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(createRespondentDTO.getPhone());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Respondent respondent = new Respondent();
 | 
				
			||||||
 | 
					        respondent.setIdNumber(createRespondentDTO.getIdNumber());
 | 
				
			||||||
 | 
					        respondent.setPhone(createRespondentDTO.getPhone());
 | 
				
			||||||
 | 
					        respondent.setName(createRespondentDTO.getName());
 | 
				
			||||||
 | 
					        respondent.setGender(createRespondentDTO.getGender());
 | 
				
			||||||
 | 
					        respondent.setMsg(createRespondentDTO.getMsg());
 | 
				
			||||||
 | 
					        respondent.setAdministrativeArea(createRespondentDTO.getAdministrativeArea());
 | 
				
			||||||
 | 
					        respondent.setProject(project);
 | 
				
			||||||
 | 
					        respondent.setUser(user);
 | 
				
			||||||
 | 
					        respondent.setState(RespondentStateEnum.NOT_INVESTIGATED.getValue());
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        project.setRespondentCount(project.getRespondentCount() + 1);
 | 
				
			||||||
 | 
					        project.setNotInvestigatedRespondentCount(project.getNotInvestigatedRespondentCount() + 1);
 | 
				
			||||||
 | 
					        projectDao.saveProject(project);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<RespondentVO> listRespondentLimit(String userPhone, String state, String idNumber, String name, String phone, String province, String city, String county, String projectName, int currentPage, int pageSize) {
 | 
				
			||||||
 | 
					        if (userPhone != null && !userDao.existUser(userPhone)) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (projectName != null && !projectDao.existProject(projectName)) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User tmpUser = userDao.selectUser(userPhone);
 | 
				
			||||||
 | 
					        Project tmpProject = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<Respondent> respondentList = respondentDao.listRespondentLimit(tmpUser, state, idNumber, name, phone, province, city, county, tmpProject, currentPage * pageSize, pageSize);
 | 
				
			||||||
 | 
					        if (respondentList == null) {
 | 
				
			||||||
 | 
					            return new ArrayList<>();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return respondentList.stream().map(respondent -> {
 | 
				
			||||||
 | 
					            RespondentVO respondentVO = new RespondentVO();
 | 
				
			||||||
 | 
					            respondentVO.setIdNumber(respondent.getIdNumber());
 | 
				
			||||||
 | 
					            respondentVO.setPhone(respondent.getPhone());
 | 
				
			||||||
 | 
					            respondentVO.setName(respondent.getName());
 | 
				
			||||||
 | 
					            respondentVO.setMsg(respondent.getMsg());
 | 
				
			||||||
 | 
					            respondentVO.setGender(respondent.getGender());
 | 
				
			||||||
 | 
					            respondentVO.setAdministrativeArea(respondent.getAdministrativeArea());
 | 
				
			||||||
 | 
					            respondentVO.setProjectName(respondent.getProject().getName());
 | 
				
			||||||
 | 
					            respondentVO.setState(respondent.getState());
 | 
				
			||||||
 | 
					            User user = respondent.getUser();
 | 
				
			||||||
 | 
					            if (user != null) {
 | 
				
			||||||
 | 
					                UserInfo userInfo = new UserInfo();
 | 
				
			||||||
 | 
					                userInfo.setIdNumber(user.getIdNumber());
 | 
				
			||||||
 | 
					                userInfo.setUsername(user.getUsername());
 | 
				
			||||||
 | 
					                userInfo.setPhone(user.getPhone());
 | 
				
			||||||
 | 
					                respondentVO.setUserInfo(userInfo);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return respondentVO;
 | 
				
			||||||
 | 
					        }).collect(Collectors.toList());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public long countRespondent(String userPhone, String state, String idNumber, String name, String phone, String province, String city, String county, String projectName) {
 | 
				
			||||||
 | 
					        if (userPhone != null && !userDao.existUser(userPhone)) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (projectName != null && !projectDao.existProject(projectName)) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(userPhone);
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(projectName);
 | 
				
			||||||
 | 
					        return respondentDao.countRespondent(user, state, idNumber, name, phone, province, city, county, project);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void modifyRespondent(ModifyRespondentDTO modifyRespondentDTO) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(modifyRespondentDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyRespondentDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(modifyRespondentDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(modifyRespondentDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					        respondent.setPhone(modifyRespondentDTO.getPhone());
 | 
				
			||||||
 | 
					        respondent.setName(modifyRespondentDTO.getName());
 | 
				
			||||||
 | 
					        respondent.setMsg(modifyRespondentDTO.getMsg());
 | 
				
			||||||
 | 
					        respondent.setGender(modifyRespondentDTO.getGender());
 | 
				
			||||||
 | 
					        respondent.setAdministrativeArea(modifyRespondentDTO.getAdministrativeArea());
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void modifyUser(ModifyRespondentUserDTO modifyRespondentUserDTO) {
 | 
				
			||||||
 | 
					        if (!userDao.existUser(modifyRespondentUserDTO.getUserPhone())) {
 | 
				
			||||||
 | 
					            throw new UserException(ResultEnum.NOT_EXIST_USER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        User user = userDao.selectUser(modifyRespondentUserDTO.getUserPhone());
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(modifyRespondentUserDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(modifyRespondentUserDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(modifyRespondentUserDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(modifyRespondentUserDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        respondent.setUser(user);
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void deleteRespondent(DeleteRespondentDTO deleteRespondentDTO) {
 | 
				
			||||||
 | 
					        if (!projectDao.existProject(deleteRespondentDTO.getProjectName())) {
 | 
				
			||||||
 | 
					            throw new ProjectException(ResultEnum.NOT_EXIST_PROJECT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Project project = projectDao.selectProject(deleteRespondentDTO.getProjectName());
 | 
				
			||||||
 | 
					        if (!respondentDao.existRespondent(deleteRespondentDTO.getIdNumber(), project)) {
 | 
				
			||||||
 | 
					            throw new RespondentException(ResultEnum.NOT_EXIST_RESPONDENT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Respondent respondent = respondentDao.selectRespondent(deleteRespondentDTO.getIdNumber(), project);
 | 
				
			||||||
 | 
					        respondent.setState(RespondentStateEnum.FILED.getValue());
 | 
				
			||||||
 | 
					        respondentDao.saveRespondent(respondent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -57,7 +57,7 @@ public class WordUtil {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public static void export2Word(HttpServletResponse response, MetaData metaData, Record record){
 | 
					    public static void export2Word(HttpServletResponse response, MetaData metaData, Record record){
 | 
				
			||||||
        Map<String, Object> values = record.getValues();
 | 
					        Map<String, Object> values = record.getValues();
 | 
				
			||||||
        // String templatePath = metaData.getWordTemplate();
 | 
					        String templatePath = metaData.getWordTemplate();
 | 
				
			||||||
        for (Map.Entry<String, Object> entry : metaData.getForm().entrySet()) {
 | 
					        for (Map.Entry<String, Object> entry : metaData.getForm().entrySet()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ import java.util.Map;
 | 
				
			|||||||
public class MetaDataVO {
 | 
					public class MetaDataVO {
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
    private Map<String,Object> form;
 | 
					    private Map<String,Object> form;
 | 
				
			||||||
    private String type;
 | 
					    private List<FieldToName> fieldToNameList;
 | 
				
			||||||
    // private List<FieldToName> fieldToNameList;
 | 
					    private Map<String, Object> config;
 | 
				
			||||||
    // private Map<String, Object> config;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,7 @@
 | 
				
			|||||||
package com.example.survey.vo;
 | 
					package com.example.survey.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.example.survey.entity.MetaData;
 | 
					import com.example.survey.entity.MetaData;
 | 
				
			||||||
// import com.example.survey.entity.Respondent;
 | 
					import com.example.survey.entity.Respondent;
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import org.springframework.data.mongodb.core.index.Indexed;
 | 
					import org.springframework.data.mongodb.core.index.Indexed;
 | 
				
			||||||
import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
					import org.springframework.data.mongodb.core.mapping.DBRef;
 | 
				
			||||||
@ -21,11 +19,33 @@ public class ProjectVO {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private String name;
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private long date;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 描述信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String detail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String userPhone;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 元数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String metaDataName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String userName;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 开始时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Date startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private long count;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 结束时间
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Date endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 负责人姓名
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String username;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 状态
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -14,15 +14,15 @@ public class RecordVO {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private String idNumber;
 | 
					    private String idNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // private List<String> projectList;
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String template;
 | 
					    private String projectName;
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    private String uuid;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private long submitTime;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private List<OperationInfo> operationInfoList;
 | 
					    private List<OperationInfo> operationInfoList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String state;
 | 
					    private String state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,8 +4,6 @@ import lombok.Data;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.Date;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author Pope
 | 
					 * @author Pope
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -19,15 +17,17 @@ public class OperationInfo {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 时间
 | 
					     * 时间
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
					 | 
				
			||||||
    private Date time;
 | 
					    private Date time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 操作者
 | 
					     * 操作者
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String personId;
 | 
					    private String userPhone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String personName;
 | 
					    /**
 | 
				
			||||||
 | 
					     * 版本信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private String version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 备注
 | 
					     * 备注
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ spring:
 | 
				
			|||||||
      auto-index-creation: true
 | 
					      auto-index-creation: true
 | 
				
			||||||
      host: 8.136.133.77
 | 
					      host: 8.136.133.77
 | 
				
			||||||
      port: 27017
 | 
					      port: 27017
 | 
				
			||||||
      database: dev
 | 
					      database: survey
 | 
				
			||||||
      username: cveo
 | 
					      username: cveo
 | 
				
			||||||
      password: cveo123456
 | 
					      password: cveo123456
 | 
				
			||||||
      authentication-database: admin
 | 
					      authentication-database: admin
 | 
				
			||||||
@ -16,5 +16,5 @@ spring:
 | 
				
			|||||||
    port: 6379
 | 
					    port: 6379
 | 
				
			||||||
 | 
					
 | 
				
			||||||
file:
 | 
					file:
 | 
				
			||||||
  path: ./upload/
 | 
					  path: E:\
 | 
				
			||||||
  url: /upload/
 | 
					  url: E:\
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user