From adeaaa07674022e2d502dd579e45bb8148ccf75b Mon Sep 17 00:00:00 2001 From: zhangxb Date: Tue, 13 Sep 2022 10:17:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?YCHZ-486-zhangxb-=E5=86=92=E7=83=9F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=91=E8=AF=84=E4=BB=B7=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E6=A8=A1=E6=9D=BF=E5=90=8E=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=90=8C=E5=90=8D=E6=A8=A1=E6=9D=BF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/diaowen/estimate/dao/impl/SurveyDirectoryDaoImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/diaowen/estimate/dao/impl/SurveyDirectoryDaoImpl.java b/src/main/java/net/diaowen/estimate/dao/impl/SurveyDirectoryDaoImpl.java index 5f00e0e..0809e4e 100644 --- a/src/main/java/net/diaowen/estimate/dao/impl/SurveyDirectoryDaoImpl.java +++ b/src/main/java/net/diaowen/estimate/dao/impl/SurveyDirectoryDaoImpl.java @@ -27,7 +27,7 @@ public class SurveyDirectoryDaoImpl extends BaseDaoImpl Integer count = 0; String id = surveyDirectory.getId(); if (StringUtils.isEmpty(id)) { - String sql = "select * from t_survey_directory t where t.survey_name = ? and t.business_type_id = ?"; + String sql = "select * from t_survey_directory t where t.survey_name = ? and t.business_type_id = ? and t.visibility = 1"; List list = this.getSession().createSQLQuery(sql) .setParameter(1, surveyDirectory.getSurveyName()) .setParameter(2, surveyDirectory.getBusinessTypeId()) @@ -35,7 +35,7 @@ public class SurveyDirectoryDaoImpl extends BaseDaoImpl if(list!=null) count = list.size(); } else { - String sql = "select * from t_survey_directory t where t.survey_name = ? and t.business_type_id = ? and t.id !=?"; + String sql = "select * from t_survey_directory t where t.survey_name = ? and t.business_type_id = ? and t.id !=? and t.visibility = 1"; List list = this.getSession().createSQLQuery(sql) .setParameter(1, surveyDirectory.getSurveyName()) .setParameter(2, surveyDirectory.getBusinessTypeId()) -- Gitee From 664360afbd79e2c07b3fc68a8fd6f6ef84875dc0 Mon Sep 17 00:00:00 2001 From: zhangxb Date: Tue, 13 Sep 2022 10:23:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?YCHZ-494-zhangxb-=E3=80=90=E5=86=92?= =?UTF-8?q?=E7=83=9F=E6=B5=8B=E8=AF=95=E3=80=91=E8=AF=84=E4=BB=B7=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E8=AF=84=E4=BB=B7=E8=AE=B0=E5=BD=95=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=EF=BC=8C=E5=AF=BC=E5=87=BA=E6=96=87=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E2=80=9C=E4=BB=85=E4=B8=8B=E8=BD=BD=E6=95=B0?= =?UTF-8?q?=E6=8D=AEExcel=E2=80=9D=E6=8C=89=E9=92=AE=E4=B8=8E=E4=B8=8D?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E6=97=B6=E5=AF=BC=E5=87=BA=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B2=A1=E6=9C=89=E5=B7=AE=E5=88=AB,=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=80=89=E6=8B=A9=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/MySurveyAnswerController.java | 6 ++--- .../estimate/service/SurveyAnswerManager.java | 2 +- .../service/impl/SurveyAnswerManagerImpl.java | 24 +++++++++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java b/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java index 108273c..8ab74a4 100644 --- a/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java +++ b/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java @@ -222,7 +222,7 @@ public class MySurveyAnswerController { @RequestMapping("/export-xls.do") @ResponseBody - public String exportXLS(HttpServletRequest request, HttpServletResponse response, String surveyId, String expUpQu) throws Exception { + public String exportXLS(HttpServletRequest request, HttpServletResponse response, String surveyId, String expUpQu,@RequestParam(value = "exportIds", required = false) List exportIds) throws Exception { try { String savePath = DWSurveyConfig.DWSURVEY_WEB_FILE_PATH; User user = accountManager.getCurUser(); @@ -235,7 +235,7 @@ public class MySurveyAnswerController { List anUplodFiles = anUploadFileManager.findAnswer(surveyId); if (anUplodFiles != null && anUplodFiles.size() > 0 && expUpQu != null && "1".equals(expUpQu)) { //直接导出excel,不存在上传文件的问题 - savePath = surveyAnswerManager.exportXLS(surveyId, savePath, true); + savePath = surveyAnswerManager.exportXLS(surveyId, savePath, true,exportIds); //启用压缩导出 String fromPath = DWSurveyConfig.DWSURVEY_WEB_FILE_PATH + "/webin/expfile/" + surveyId; fromPath = fromPath.replace("/", File.separator); @@ -252,7 +252,7 @@ public class MySurveyAnswerController { request.getRequestDispatcher("/webin/zip/" + surveyId + ".zip").forward(request, response); } else { //直接导出excel,不存在上传文件的问题 - savePath = surveyAnswerManager.exportXLS(surveyId, savePath, false); + savePath = surveyAnswerManager.exportXLS(surveyId, savePath, false,exportIds); response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode("dwsurvey_" + survey.getSid() + ".xlsx", "UTF-8")); request.getRequestDispatcher(savePath).forward(request, response); } diff --git a/src/main/java/net/diaowen/estimate/service/SurveyAnswerManager.java b/src/main/java/net/diaowen/estimate/service/SurveyAnswerManager.java index 793a24d..4e4a7da 100644 --- a/src/main/java/net/diaowen/estimate/service/SurveyAnswerManager.java +++ b/src/main/java/net/diaowen/estimate/service/SurveyAnswerManager.java @@ -26,7 +26,7 @@ public interface SurveyAnswerManager extends BaseService{ public Long getCountByIp(String surveyId, String ip); - public String exportXLS(String surveyId, String savePath, boolean isExpUpQu); + public String exportXLS(String surveyId, String savePath, boolean isExpUpQu,List exportIds); public SurveyStats surveyStatsData(SurveyStats surveyStats); diff --git a/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java b/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java index 7af7616..4797048 100644 --- a/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java +++ b/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java @@ -215,7 +215,7 @@ public class SurveyAnswerManagerImpl extends @Override - public String exportXLS(String surveyId, String savePath, boolean isExpUpQu) { + public String exportXLS(String surveyId, String savePath, boolean isExpUpQu,List exportIds) { String basepath = surveyId + ""; String urlPath = "/webin/expfile/" + basepath + "/";// 下载所用的地址 String path = urlPath.replace("/", File.separator);// 文件系统路径 @@ -238,7 +238,7 @@ public class SurveyAnswerManagerImpl extends try { // page = findPage(page,cri1); // int totalPage = page.getTotalPage(); - List answers = answerList(surveyId, 1); + List answers = answerList(surveyId, 1,exportIds); List questions = questionManager.findDetails(surveyId,"2"); exportXLSTitle(exportUtil, questions); int answerListSize = answers.size(); @@ -759,14 +759,30 @@ public class SurveyAnswerManagerImpl extends return page; } - public List answerList(String surveyId,Integer isEff) { + public List answerList(String surveyId,Integer isEff,List exportIds) { + + List listCriterion = new ArrayList<>(); + + Criterion cri1=Restrictions.eq("surveyId", surveyId); Criterion cri2=Restrictions.lt("handleState", 2); Criterion cri3=Restrictions.eq("isEffective", 1); if(isEff!=null){ cri3=Restrictions.eq("isEffective", isEff); } - return surveyAnswerDao.findByOrder("endAnDate",false,cri1, cri2); + listCriterion.add(cri1); + listCriterion.add(cri2); + //listCriterion.add(cri3); + + if((exportIds!=null) && (exportIds.size()>0)) + { + Criterion cri4 = Restrictions.in("id",exportIds); + listCriterion.add(cri4); + } + //return surveyAnswerDao.findByOrder("endAnDate",false,cri1, cri2); + Criterion [] criterions = listCriterion.toArray(new Criterion[listCriterion.size()]); + + return surveyAnswerDao.findByOrder("endAnDate",false,criterions); } -- Gitee From 6d1535b5cd4f70d3187234fed61e890e71683a85 Mon Sep 17 00:00:00 2001 From: zhangxb Date: Tue, 13 Sep 2022 11:05:58 +0800 Subject: [PATCH 3/5] =?UTF-8?q?YCHZ-494-zhangxb-=20=E7=AD=94=E6=A1=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=B4=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/ResponseController.java | 3 ++- .../survey/MySurveyAnswerController.java | 5 +---- .../diaowen/estimate/entity/SurveyAnswer.java | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java b/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java index 9bfc9cc..8fc3b80 100644 --- a/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java +++ b/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java @@ -196,7 +196,8 @@ public class ResponseController { SurveyAnswer entity=new SurveyAnswer(); entity.setBusinessTypeId(directory.getBusinessTypeId()); - + entity.setAppraise(directory.getAppraise()); + if(StringUtils.isNotEmpty(answerId)) { entity.setAnswerId(answerId); diff --git a/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java b/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java index 8ab74a4..4847bbe 100644 --- a/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java +++ b/src/main/java/net/diaowen/estimate/controller/survey/MySurveyAnswerController.java @@ -21,10 +21,7 @@ import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/src/main/java/net/diaowen/estimate/entity/SurveyAnswer.java b/src/main/java/net/diaowen/estimate/entity/SurveyAnswer.java index f0fecb1..031535c 100644 --- a/src/main/java/net/diaowen/estimate/entity/SurveyAnswer.java +++ b/src/main/java/net/diaowen/estimate/entity/SurveyAnswer.java @@ -181,6 +181,11 @@ public class SurveyAnswer extends IdEntity { @Column(name = "business_order_code") private String businessOrderCode; + // 评价维度 + private String appraise; + + private String appraiseName; + public String getEstimateTemplateName() { return estimateTemplateName; } @@ -483,5 +488,19 @@ public class SurveyAnswer extends IdEntity { this.surveyDirectory = surveyDirectory; } + public String getAppraise() { + return appraise; + } + public void setAppraise(String appraise) { + this.appraise = appraise; + } + + @Transient + public String getAppraiseName() { + return appraiseName; + } + public void setAppraiseName(String appraiseName) { + this.appraiseName = appraiseName; + } } -- Gitee From 4b1cca927996bff607b24984198dd0cbad5727c9 Mon Sep 17 00:00:00 2001 From: zhangxb Date: Wed, 14 Sep 2022 10:23:47 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=8E=BB=E6=8E=89IP=E5=92=8CIP=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estimate/controller/question/ResponseController.java | 2 +- .../estimate/service/impl/SurveyAnswerManagerImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java b/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java index 8fc3b80..74a957e 100644 --- a/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java +++ b/src/main/java/net/diaowen/estimate/controller/question/ResponseController.java @@ -197,7 +197,7 @@ public class ResponseController { entity.setBusinessTypeId(directory.getBusinessTypeId()); entity.setAppraise(directory.getAppraise()); - + if(StringUtils.isNotEmpty(answerId)) { entity.setAnswerId(answerId); diff --git a/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java b/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java index 4797048..7fcd23b 100644 --- a/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java +++ b/src/main/java/net/diaowen/estimate/service/impl/SurveyAnswerManagerImpl.java @@ -467,8 +467,8 @@ public class SurveyAnswerManagerImpl extends } } - exportUtil.setCell(cellIndex++, surveyAnswer.getIpAddr()); - exportUtil.setCell(cellIndex++, surveyAnswer.getCity()); + //exportUtil.setCell(cellIndex++, surveyAnswer.getIpAddr()); + //exportUtil.setCell(cellIndex++, surveyAnswer.getCity()); exportUtil.setCell(cellIndex++, new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒").format(surveyAnswer.getEndAnDate())); @@ -571,8 +571,8 @@ public class SurveyAnswerManagerImpl extends } } - exportUtil.setCell(cellIndex++, "回答者IP"); - exportUtil.setCell(cellIndex++, "IP所在地"); + //exportUtil.setCell(cellIndex++, "回答者IP"); + //exportUtil.setCell(cellIndex++, "IP所在地"); exportUtil.setCell(cellIndex++, "回答时间"); } -- Gitee From 717055c021508368b0393f9cb53cd84ea0755363 Mon Sep 17 00:00:00 2001 From: zhangxb Date: Wed, 14 Sep 2022 14:59:02 +0800 Subject: [PATCH 5/5] =?UTF-8?q?YCHZ-498-zhangxb=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E3=80=91=E8=AF=84=E4=BB=B7=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9=E5=9C=B0=E5=9D=80=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=89=93=E5=BC=80=E3=80=81=E5=A4=8D=E5=88=B6=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=89=93=E5=BC=80=E8=AF=84=E4=BB=B7=E7=BB=B4=E5=BA=A6=E6=9C=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=20=E6=B3=A8:=E5=90=8C=E6=97=B6=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8Cjson=E6=9B=B4=E6=96=B0=E6=88=96=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=EF=BC=8C=E5=8F=AA=E5=9C=A8=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SurveyDirectoryManagerImpl.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/diaowen/estimate/service/impl/SurveyDirectoryManagerImpl.java b/src/main/java/net/diaowen/estimate/service/impl/SurveyDirectoryManagerImpl.java index 7490d8e..4db0671 100644 --- a/src/main/java/net/diaowen/estimate/service/impl/SurveyDirectoryManagerImpl.java +++ b/src/main/java/net/diaowen/estimate/service/impl/SurveyDirectoryManagerImpl.java @@ -1,6 +1,7 @@ package net.diaowen.estimate.service.impl; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import net.diaowen.common.QuType; import net.diaowen.common.base.entity.User; import net.diaowen.common.base.service.AccountManager; @@ -10,10 +11,7 @@ import net.diaowen.common.service.BaseServiceImpl; import net.diaowen.common.utils.RandomUtils; import net.diaowen.estimate.config.DWSurveyConfig; import net.diaowen.estimate.dao.SurveyDirectoryDao; -import net.diaowen.estimate.entity.Question; -import net.diaowen.estimate.entity.SurveyDetail; -import net.diaowen.estimate.entity.SurveyDirectory; -import net.diaowen.estimate.entity.SurveyStats; +import net.diaowen.estimate.entity.*; import net.diaowen.estimate.service.*; import org.apache.commons.lang3.StringUtils; import org.hibernate.criterion.Criterion; @@ -25,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -57,6 +56,9 @@ public class SurveyDirectoryManagerImpl extends BaseServiceImpl