class MySurveyAnswerController {

    @Autowired
    private SurveyDirectoryManager surveyDirectoryManager;
    @Autowired
    private SurveyAnswerManager surveyAnswerManager;
    @Autowired
    private AccountManager accountManager;
    @Autowired
    private AnUploadFileManager anUploadFileManager;
    /**
     * 获取答卷列表
     * @return
     */
    @RequestMapping(value = "/list.do",method = RequestMethod.GET)
    @ResponseBody
    public PageResult survey(HttpServletRequest request,PageResult<SurveyAnswer> pageResult, String surveyId,String ipAddr,String city,Integer isEffective) {
        UserAgentUtils.userAgent(request);
        User user = accountManager.getCurUser();
        if(user!=null){
            Page page = ResultUtils.getPageByPageResult(pageResult);
            SurveyDirectory survey=surveyDirectoryManager.get(surveyId);
            if(survey!=null){
                if(!user.getId().equals(survey.getUserId())){
                    pageResult.setSuccess(false);
                    return pageResult;
                }
                page=surveyAnswerManager.answerPage(page, surveyId);
            }
            pageResult = ResultUtils.getPageResultByPage(page,pageResult);
        }
        return pageResult;

    }

    @RequestMapping(value = "/info.do",method = RequestMethod.GET)
    @ResponseBody
    public HttpResult info(String answerId) throws Exception {
        try {
            SurveyAnswer answer = null;
            if (StringUtils.isNotEmpty(answerId)) {
                answer = surveyAnswerManager.findById(answerId);
            }
            if(answer!=null){
                SurveyDirectory survey = surveyDirectoryManager.findUniqueBy(answer.getSurveyId());
                User user= accountManager.getCurUser();
                if(user!=null && survey!=null) {
                    if(!user.getId().equals(survey.getUserId())) {
                        return HttpResult.FAILURE_MSG("没有相应数据权限");
                    }
                    List<Question> questions = surveyAnswerManager.findAnswerDetail(answer);
                    survey.setQuestions(questions);
                    survey.setSurveyAnswer(answer);
                    return HttpResult.SUCCESS(survey);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return HttpResult.FAILURE();
    }


    /**
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/delete.do",method = RequestMethod.DELETE)
    @ResponseBody
    public HttpResult delete(@RequestBody Map<String, String[]> map) throws Exception {<FILL_FUNCTION_BODY>}


    @RequestMapping("/export-xls.do")
    @ResponseBody
    public String exportXLS(HttpServletRequest request, HttpServletResponse response, String surveyId,String expUpQu) throws Exception{
        try{
            String savePath = DWSurveyConfig.DWSURVEY_WEB_FILE_PATH;
            User user=accountManager.getCurUser();
            if(user!=null){
                SurveyDirectory survey = surveyDirectoryManager.get(surveyId);
                if(survey!=null){
                    if(!user.getId().equals(survey.getUserId())){
                        return "没有相应数据权限";
                    }
                    List<AnUplodFile> anUplodFiles = anUploadFileManager.findAnswer(surveyId);
                    if(anUplodFiles!=null && anUplodFiles.size()>0 && expUpQu!=null && "1".equals(expUpQu)){
                        //直接导出excel，不存在上传文件的问题
                        savePath = surveyAnswerManager.exportXLS(surveyId,savePath,true);
                        //启用压缩导出
                        String fromPath =DWSurveyConfig.DWSURVEY_WEB_FILE_PATH+"/webin/expfile/"+surveyId;
                        fromPath = fromPath.replace("/", File.separator);

                        String zipPath = DWSurveyConfig.DWSURVEY_WEB_FILE_PATH+"/webin/zip/".replace("/", File.separator);
                        File file = new File(zipPath);
                        if (!file.exists())
                            file.mkdirs();

                        String toPath = zipPath+surveyId + ".zip";
                        toPath = toPath.replace("/",File.separator);
                        ZipUtil.createZip(fromPath, toPath, false);
                        response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode("dwsurvey_"+survey.getSid()+".zip", "UTF-8"));
                        request.getRequestDispatcher("/webin/zip/"+ surveyId + ".zip").forward(request,response);
                    }else{
                        //直接导出excel，不存在上传文件的问题
                        savePath=surveyAnswerManager.exportXLS(surveyId,savePath, false);
                        response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode("dwsurvey_"+survey.getSid()+".xlsx", "UTF-8"));
                        request.getRequestDispatcher(savePath).forward(request,response);
                    }
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }


}

//		HttpResult httpResultRP = ShiroAuthorizationUtils.isDefaultAdminRoleAndPermissionHttpResult(PermissionCode.HT_CASCADEDB_DELETE);
//		if (httpResultRP != null) return httpResultRP;
        try{
            if(map!=null){
                if(map.containsKey("id")){
                    String[] ids = map.get("id");
                    if(ids!=null){
                        surveyAnswerManager.deleteData(ids);
                    }
                }
            }
            return HttpResult.SUCCESS();
        }catch (Exception e){
            e.printStackTrace();
        }
        return HttpResult.FAILURE();
    
<no_super_class>