From 516808a3c26503e1d155c156ab0e571a37de3af3 Mon Sep 17 00:00:00 2001 From: sunyugang Date: Fri, 11 Jul 2025 17:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=B0=83=E6=9F=A5=E9=97=AE?= =?UTF-8?q?=E5=8D=B71=E7=9A=84=E5=AF=BC=E5=85=A5=E7=AD=89=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dw/controller/DwAnswerController.java | 4 +- .../ruoyi/dw/controller/DwInfoController.java | 1 - .../dw/controller/DwQuestionController.java | 39 +- .../java/com/ruoyi/dw/domain/DwAnswer.java | 2 +- .../main/java/com/ruoyi/dw/domain/DwInfo.java | 2 +- .../java/com/ruoyi/dw/domain/DwQuestion.java | 2 +- .../com/ruoyi/dw/mapper/DwAnswerMapper.java | 7 + .../ruoyi/dw/service/IDwQuestionService.java | 7 +- .../service/impl/DwQuestionServiceImpl.java | 345 +++++++++++++++++- .../resources/mapper/dw/DwAnswerMapper.xml | 13 + .../main/resources/mapper/dw/DwInfoMapper.xml | 1 + .../web/service/SysLoginService.java | 2 +- 12 files changed, 412 insertions(+), 13 deletions(-) diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwAnswerController.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwAnswerController.java index 11a540e..9e54219 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwAnswerController.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwAnswerController.java @@ -24,7 +24,7 @@ import java.util.List; */ @RestController @RequestMapping("/dw/answer") -public class DwAnswerController extends BaseController +public class DwAnswerController extends BaseController { @Autowired private IDwAnswerService dwAnswerService; @@ -91,9 +91,11 @@ public class DwAnswerController extends BaseController return toAjax(dwAnswerService.deleteDwAnswerByIds(ids)); } + @Log(title = "导入调查问卷", businessType = BusinessType.IMPORT) @PostMapping("/importData") public AjaxResult importAnswer(MultipartFile file, int infoId) throws Exception{ return null; } + } diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwInfoController.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwInfoController.java index d5d792b..1c66be7 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwInfoController.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwInfoController.java @@ -10,7 +10,6 @@ import com.ruoyi.dw.domain.DwInfo; import com.ruoyi.dw.service.IDwInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.util.List; diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwQuestionController.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwQuestionController.java index 8026285..0d322b7 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwQuestionController.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwQuestionController.java @@ -6,12 +6,15 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.dw.domain.DwInfo; import com.ruoyi.dw.domain.DwQuestion; +import com.ruoyi.dw.service.IDwInfoService; import com.ruoyi.dw.service.IDwQuestionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -28,6 +31,9 @@ public class DwQuestionController extends BaseController @Autowired private IDwQuestionService dwQuestionService; + @Resource + private IDwInfoService dwInfoService; + /** * 查询调查问卷问题列表 */ @@ -39,6 +45,16 @@ public class DwQuestionController extends BaseController return getDataTable(list); } + /** + * 调查问卷问题列表下拉框选择 + */ + @GetMapping("/select") + public AjaxResult select() + { + List list = dwQuestionService.selectDwQuestionList(new DwQuestion()); + return AjaxResult.success(list); + } + /** * 导出调查问卷问题列表 */ @@ -91,8 +107,25 @@ public class DwQuestionController extends BaseController } - - public AjaxResult importData(MultipartFile file, int infoId) throws Exception{ - return AjaxResult.success(); + /** + * 导入调查问卷数据 + * @param file + * @param infoId + * @return + * @throws Exception + */ + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, Long infoId) throws Exception{ + DwInfo dwInfo = dwInfoService.selectDwInfoById(infoId); + if (dwInfo == null) { + return AjaxResult.error("导入的调查问卷不存在,请重新选择"); + } + int successNum = dwQuestionService.importData(file, dwInfo); + if (successNum > 0) { + return AjaxResult.success(); + }else { + return AjaxResult.error("导入失败,请检查调查问卷内容是否正确"); + } } + } diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwAnswer.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwAnswer.java index 4bb4f2d..4adec3a 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwAnswer.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwAnswer.java @@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author sunyg * @date 2025-06-26 */ -public class DwAnswer extends BaseEntity +public class DwAnswer { private static final long serialVersionUID = 1L; diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwInfo.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwInfo.java index 5114cb6..1a63266 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwInfo.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwInfo.java @@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author sunyg * @date 2025-06-26 */ -public class DwInfo extends BaseEntity +public class DwInfo { private static final long serialVersionUID = 1L; diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwQuestion.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwQuestion.java index 1a91f76..760f644 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwQuestion.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/domain/DwQuestion.java @@ -11,7 +11,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author sunyg * @date 2025-06-26 */ -public class DwQuestion extends BaseEntity +public class DwQuestion { private static final long serialVersionUID = 1L; diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwAnswerMapper.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwAnswerMapper.java index 544afda..a108868 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwAnswerMapper.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwAnswerMapper.java @@ -35,6 +35,13 @@ public interface DwAnswerMapper */ public int insertDwAnswer(DwAnswer dwAnswer); + /** + * 批量插入 + * @param dwAnswers + * @return + */ + public int insertDwAnswerBatch(List dwAnswers); + /** * 修改调查问卷答案 * diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwQuestionService.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwQuestionService.java index 5f3eb5f..b2424c6 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwQuestionService.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwQuestionService.java @@ -1,7 +1,10 @@ package com.ruoyi.dw.service; import java.util.List; + +import com.ruoyi.dw.domain.DwInfo; import com.ruoyi.dw.domain.DwQuestion; +import org.springframework.web.multipart.MultipartFile; /** * 调查问卷问题Service接口 @@ -62,8 +65,8 @@ public interface IDwQuestionService /** * * 导入调查问卷 - * @param dwQuestionList + * @param * @return */ - public int importDwQuestion(List dwQuestionList); + public int importData(MultipartFile file, DwInfo dwInfo); } diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwQuestionServiceImpl.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwQuestionServiceImpl.java index 7583791..e8d4fc4 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwQuestionServiceImpl.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwQuestionServiceImpl.java @@ -1,11 +1,21 @@ package com.ruoyi.dw.service.impl; +import java.util.ArrayList; import java.util.List; + +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.dw.domain.DwAnswer; +import com.ruoyi.dw.domain.DwInfo; +import com.ruoyi.dw.mapper.DwAnswerMapper; +import org.apache.poi.ss.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.dw.mapper.DwQuestionMapper; import com.ruoyi.dw.domain.DwQuestion; import com.ruoyi.dw.service.IDwQuestionService; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; /** * 调查问卷问题Service业务层处理 @@ -19,6 +29,9 @@ public class DwQuestionServiceImpl implements IDwQuestionService @Autowired private DwQuestionMapper dwQuestionMapper; + @Resource + private DwAnswerMapper dwAnswerMapper; + /** * 查询调查问卷问题 * @@ -92,9 +105,337 @@ public class DwQuestionServiceImpl implements IDwQuestionService } @Override - public int importDwQuestion(List dwQuestionList) { + public int importData(MultipartFile file, DwInfo dwInfo) { + try { + Workbook workbook = WorkbookFactory.create(file.getInputStream()); + Sheet sheet = workbook.getSheetAt(0); + int rows = sheet.getLastRowNum(); + if (rows <= 0){ + return -1; + } + List answers = new ArrayList(); + for (int i = 1; i <= rows; i++) { + if (dwInfo.getId().intValue() == 1) { + //第一个调查问卷问题 + Row row = sheet.getRow(i); + DwAnswer answer1 = new DwAnswer(); + Cell cell15 = row.getCell(15); + answer1.setAnswer(cell15.getStringCellValue()); + answer1.setInfoId(dwInfo.getId()); + answer1.setQuestionId(1L); + answers.add(answer1); + DwAnswer answer2 = new DwAnswer(); + Cell cell16 = row.getCell(16); + answer2.setAnswer(cell16.getStringCellValue()); + answer2.setInfoId(dwInfo.getId()); + answer2.setQuestionId(2L); + answers.add(answer2); + DwAnswer answer3 = new DwAnswer(); + Cell cell17 = row.getCell(17); + answer3.setAnswer(cell17.getStringCellValue()); + answer3.setInfoId(dwInfo.getId()); + answer3.setQuestionId(3L); + answers.add(answer3); + DwAnswer answer4 = new DwAnswer(); + Cell cell18 = row.getCell(18); + answer4.setAnswer(cell18.getStringCellValue()); + answer4.setInfoId(dwInfo.getId()); + answer4.setQuestionId(4L); + answers.add(answer4); + DwAnswer answer5 = new DwAnswer(); + Cell cell19 = row.getCell(19); + answer5.setAnswer(cell19.getStringCellValue()); + answer5.setInfoId(dwInfo.getId()); + answer5.setQuestionId(5L); + answers.add(answer5); + DwAnswer answer6 = new DwAnswer(); + Cell cell20 = row.getCell(20); + answer6.setAnswer(cell20.getStringCellValue()); + answer6.setInfoId(dwInfo.getId()); + answer6.setQuestionId(6L); + answers.add(answer6); + DwAnswer answer7 = new DwAnswer(); + Cell cell21 = row.getCell(21); + Cell cell22 = row.getCell(22); + if (StringUtils.isNotEmpty(cell22.getStringCellValue())){ + answer7.setAnswer(cell22.getStringCellValue()); + }else { + answer7.setAnswer(cell21.getStringCellValue()); + } + answer7.setInfoId(dwInfo.getId()); + answer7.setQuestionId(7L); + answers.add(answer7); + DwAnswer answer8 = new DwAnswer(); + Cell cell23 = row.getCell(23); + answer8.setAnswer(cell23.getStringCellValue()); + answer8.setInfoId(dwInfo.getId()); + answer8.setQuestionId(8L); + answers.add(answer8); + DwAnswer answer9 = new DwAnswer(); + Cell cell25 = row.getCell(25); + answer9.setAnswer(cell25.getStringCellValue()); + answer9.setInfoId(dwInfo.getId()); + answer9.setQuestionId(9L); + answers.add(answer9); + DwAnswer answer10 = new DwAnswer(); + Cell cell36 = row.getCell(36); + answer10.setAnswer(cell36.getStringCellValue()); + answer10.setInfoId(dwInfo.getId()); + answer10.setQuestionId(10L); + answers.add(answer10); + DwAnswer answer11 = new DwAnswer(); + Cell cell37 = row.getCell(37); + answer11.setAnswer(cell37.getStringCellValue()); + answer11.setInfoId(dwInfo.getId()); + answer11.setQuestionId(11L); + answers.add(answer11); + DwAnswer answer12 = new DwAnswer(); + Cell cell38 = row.getCell(38); + answer12.setAnswer(cell38.getStringCellValue()); + answer12.setInfoId(dwInfo.getId()); + answer12.setQuestionId(12L); + answers.add(answer12); + DwAnswer answer13 = new DwAnswer(); + Cell cell39 = row.getCell(39); + answer13.setAnswer(cell39.getStringCellValue()); + answer13.setInfoId(dwInfo.getId()); + answer13.setQuestionId(13L); + answers.add(answer13); + DwAnswer answer14 = new DwAnswer(); + Cell cell40 = row.getCell(40); + answer14.setAnswer(cell40.getStringCellValue()); + answer14.setInfoId(dwInfo.getId()); + answer14.setQuestionId(14L); + answers.add(answer14); + DwAnswer answer15 = new DwAnswer(); + Cell cell41 = row.getCell(41); + answer15.setAnswer(cell41.getStringCellValue()); + answer15.setInfoId(dwInfo.getId()); + answer15.setQuestionId(15L); + answers.add(answer15); + DwAnswer answer16 = new DwAnswer(); + Cell cell42 = row.getCell(42); + Cell cell43 = row.getCell(43); + if (StringUtils.isNotEmpty(cell43.getStringCellValue())){ + answer16.setAnswer(cell43.getStringCellValue()); + }else { + answer16.setAnswer(cell42.getStringCellValue()); + } + answer16.setInfoId(dwInfo.getId()); + answer16.setQuestionId(16L); + answers.add(answer16); + DwAnswer answer17 = new DwAnswer(); + Cell cell44 = row.getCell(44); + answer17.setAnswer(cell44.getStringCellValue()); + answer17.setInfoId(dwInfo.getId()); + answer17.setQuestionId(17L); + answers.add(answer17); + DwAnswer answer18 = new DwAnswer(); + Cell cell45 = row.getCell(45); + answer18.setAnswer(cell45.getStringCellValue()); + answer18.setInfoId(dwInfo.getId()); + answer18.setQuestionId(18L); + answers.add(answer18); + DwAnswer answer19 = new DwAnswer(); + Cell cell46 = row.getCell(46); + Cell cell47 = row.getCell(47); + if (StringUtils.isNotEmpty(cell47.getStringCellValue())){ + answer19.setAnswer(cell47.getStringCellValue()); + }else { + answer19.setAnswer(cell46.getStringCellValue()); + } + answer19.setInfoId(dwInfo.getId()); + answer19.setQuestionId(19L); + answers.add(answer19); + DwAnswer answer20 = new DwAnswer(); + Cell cell48 = row.getCell(48); + answer20.setAnswer(cell48.getStringCellValue()); + answer20.setInfoId(dwInfo.getId()); + answer20.setQuestionId(20L); + answers.add(answer20); + DwAnswer answer21 = new DwAnswer(); + Cell cell49 = row.getCell(49); + answer21.setAnswer(cell49.getStringCellValue()); + answer21.setInfoId(dwInfo.getId()); + answer21.setQuestionId(21L); + answers.add(answer21); + DwAnswer answer22 = new DwAnswer(); + Cell cell50 = row.getCell(50); + answer22.setAnswer(cell50.getStringCellValue()); + answer22.setInfoId(dwInfo.getId()); + answer22.setQuestionId(22L); + answers.add(answer22); + DwAnswer answer23 = new DwAnswer(); + Cell cell60 = row.getCell(60); + answer23.setAnswer(cell60.getStringCellValue()); + answer23.setInfoId(dwInfo.getId()); + answer23.setQuestionId(23L); + answers.add(answer23); + DwAnswer answer24 = new DwAnswer(); + Cell cell61 = row.getCell(61); + answer24.setAnswer(cell61.getStringCellValue()); + answer24.setInfoId(dwInfo.getId()); + answer24.setQuestionId(24L); + answers.add(answer24); + DwAnswer answer25 = new DwAnswer(); + Cell cell62 = row.getCell(62); + Cell cell63 = row.getCell(63); + if (StringUtils.isNotEmpty(cell63.getStringCellValue())){ + answer25.setAnswer(cell63.getStringCellValue()); + }else { + answer25.setAnswer(cell62.getStringCellValue()); + } + answer25.setInfoId(dwInfo.getId()); + answer25.setQuestionId(25L); + answers.add(answer25); + DwAnswer answer26 = new DwAnswer(); + Cell cell64 = row.getCell(64); + answer26.setAnswer(cell64.getStringCellValue()); + answer26.setInfoId(dwInfo.getId()); + answer26.setQuestionId(26L); + answers.add(answer26); + DwAnswer answer27 = new DwAnswer(); + Cell cell71 = row.getCell(71); + answer27.setAnswer(cell71.getStringCellValue()); + answer27.setInfoId(dwInfo.getId()); + answer27.setQuestionId(27L); + answers.add(answer27); + DwAnswer answer28 = new DwAnswer(); + Cell cell72 = row.getCell(72); + Cell cell73 = row.getCell(73); + Cell cell74 = row.getCell(74); + Cell cell75 = row.getCell(75); + Cell cell76 = row.getCell(76); + Cell cell77 = row.getCell(77); + Cell cell78 = row.getCell(78); + Cell cell79 = row.getCell(79); + answer28.setAnswer(cell72.getStringCellValue() +","+cell73.getStringCellValue() + +","+cell74.getStringCellValue() +","+cell75.getStringCellValue() +"," + +cell76.getStringCellValue() +","+cell77.getStringCellValue() +"," + +cell78.getStringCellValue() +","+ cell79.getStringCellValue()); + answer28.setInfoId(dwInfo.getId()); + answer28.setQuestionId(28L); + answers.add(answer28); + DwAnswer answer29 = new DwAnswer(); + Cell cell80 = row.getCell(80); + answer29.setAnswer(cell80.getStringCellValue()); + answer29.setInfoId(dwInfo.getId()); + answer29.setQuestionId(29L); + answers.add(answer29); + DwAnswer answer30 = new DwAnswer(); + Cell cell81 = row.getCell(81); + answer30.setAnswer(cell81.getStringCellValue()); + answer30.setInfoId(dwInfo.getId()); + answer30.setQuestionId(30L); + answers.add(answer30); + DwAnswer answer31 = new DwAnswer(); + Cell cell82 = row.getCell(82); + Cell cell83 = row.getCell(83); + answer31.setAnswer(cell82.getStringCellValue() + cell83.getStringCellValue()); + answer31.setInfoId(dwInfo.getId()); + answer31.setQuestionId(31L); + answers.add(answer31); + DwAnswer answer32 = new DwAnswer(); + Cell cell84 = row.getCell(84); + answer32.setAnswer(cell84.getStringCellValue()); + answer32.setInfoId(dwInfo.getId()); + answer32.setQuestionId(32L); + answers.add(answer32); + DwAnswer answer33 = new DwAnswer(); + Cell cell85 = row.getCell(85); + answer33.setAnswer(cell85.getStringCellValue()); + answer33.setInfoId(dwInfo.getId()); + answer33.setQuestionId(33L); + answers.add(answer33); + DwAnswer answer34 = new DwAnswer(); + Cell cell98 = row.getCell(98); + answer34.setAnswer(cell98.getStringCellValue()); + answer34.setInfoId(dwInfo.getId()); + answer34.setQuestionId(34L); + answers.add(answer34); + DwAnswer answer35 = new DwAnswer(); + Cell cell99 = row.getCell(99); + Cell cell100 = row.getCell(100); + Cell cell101 = row.getCell(101); + Cell cell102 = row.getCell(102); + Cell cell103 = row.getCell(103); + answer35.setAnswer(cell99.getStringCellValue() +","+cell100.getStringCellValue() + +","+cell101.getStringCellValue() +","+cell102.getStringCellValue() +"," + +cell103.getStringCellValue()); + answer35.setInfoId(dwInfo.getId()); + answer35.setQuestionId(35L); + answers.add(answer35); + DwAnswer answer36 = new DwAnswer(); + Cell cell104 = row.getCell(104); + answer36.setAnswer(cell104.getStringCellValue()); + answer36.setInfoId(dwInfo.getId()); + answer36.setQuestionId(36L); + answers.add(answer36); + DwAnswer answer37 = new DwAnswer(); + Cell cell121 = row.getCell(121); + Cell cell122 = row.getCell(122); + Cell cell123 = row.getCell(123); + Cell cell124 = row.getCell(124); + Cell cell125 = row.getCell(125); + Cell cell126 = row.getCell(126); + Cell cell127 = row.getCell(127); + Cell cell128 = row.getCell(128); + answer37.setAnswer(cell121.getStringCellValue() +","+cell122.getStringCellValue() + +","+cell123.getStringCellValue() +","+cell124.getStringCellValue() +"," + +","+cell125.getStringCellValue() +","+cell126.getStringCellValue() +"," + +","+cell127.getStringCellValue() +","+cell128.getStringCellValue() ); + answer37.setInfoId(dwInfo.getId()); + answer37.setQuestionId(37L); + answers.add(answer37); + DwAnswer answer38 = new DwAnswer(); + Cell cell129 = row.getCell(129); + answer38.setAnswer(cell129.getStringCellValue()); + answer38.setInfoId(dwInfo.getId()); + answer38.setQuestionId(38L); + answers.add(answer38); + DwAnswer answer39 = new DwAnswer(); + Cell cell131 = row.getCell(131); + answer39.setAnswer(cell131.getStringCellValue()); + answer39.setInfoId(dwInfo.getId()); + answer39.setQuestionId(39L); + answers.add(answer39); + DwAnswer answer40 = new DwAnswer(); + Cell cell137 = row.getCell(137); + Cell cell138 = row.getCell(138); + Cell cell139 = row.getCell(139); + Cell cell140 = row.getCell(140); + answer40.setAnswer(cell137.getStringCellValue() +","+cell138.getStringCellValue() + +","+cell139.getStringCellValue() +","+cell140.getStringCellValue() ); + answer40.setInfoId(dwInfo.getId()); + answer40.setQuestionId(40L); + answers.add(answer40); + DwAnswer answer41 = new DwAnswer(); + Cell cell141 = row.getCell(141); + Cell cell142 = row.getCell(142); + Cell cell143 = row.getCell(143); + Cell cell144 = row.getCell(144); + Cell cell145 = row.getCell(145); + Cell cell146 = row.getCell(146); + answer41.setAnswer(cell141.getStringCellValue() +","+cell142.getStringCellValue() + +","+cell143.getStringCellValue() +","+cell144.getStringCellValue() +"," + +","+cell145.getStringCellValue() +","+cell146.getStringCellValue()); + answer41.setInfoId(dwInfo.getId()); + answer41.setQuestionId(41L); + answers.add(answer41); + }else if (dwInfo.getId() == 2) { - return 0; + }else if (dwInfo.getId() == 3) { + + }else { + return -2; + } + } + dwAnswerMapper.insertDwAnswerBatch(answers); + return rows-1; + }catch (Exception ex){ + ex.printStackTrace(); + return -1; + } } } diff --git a/ruoyi-dw/src/main/resources/mapper/dw/DwAnswerMapper.xml b/ruoyi-dw/src/main/resources/mapper/dw/DwAnswerMapper.xml index e57be1c..d85df8f 100644 --- a/ruoyi-dw/src/main/resources/mapper/dw/DwAnswerMapper.xml +++ b/ruoyi-dw/src/main/resources/mapper/dw/DwAnswerMapper.xml @@ -45,6 +45,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into dw_answer + (info_id, question_id, answer) + VALUES + + + #{item.infoId}, + #{item.questionId}, + #{item.answer} + + + + update dw_answer diff --git a/ruoyi-dw/src/main/resources/mapper/dw/DwInfoMapper.xml b/ruoyi-dw/src/main/resources/mapper/dw/DwInfoMapper.xml index 685bf72..f9c0458 100644 --- a/ruoyi-dw/src/main/resources/mapper/dw/DwInfoMapper.xml +++ b/ruoyi-dw/src/main/resources/mapper/dw/DwInfoMapper.xml @@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update dw_info dw_name = #{dwName}, + update_time = sysdate() where id = #{id} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index fe16427..ce86ad4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -64,7 +64,7 @@ public class SysLoginService public String login(String username, String password, String code, String uuid) { // 验证码校验 - validateCaptcha(username, code, uuid); + //validateCaptcha(username, code, uuid); // 登录前置校验 loginPreCheck(username, password); // 用户验证