|
@@ -2,6 +2,7 @@ package org.jeecg.modules.adminwjdc2.controller;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -27,203 +28,204 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.boot.autoconfigure.security.oauth2.resource.IssuerUriCondition;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
|
|
- /**
|
|
|
|
|
|
+/**
|
|
* @Description: 问卷调查
|
|
* @Description: 问卷调查
|
|
* @Author: jeecg-boot
|
|
* @Author: jeecg-boot
|
|
- * @Date: 2023-02-25
|
|
|
|
|
|
+ * @Date: 2023-02-25
|
|
* @Version: V1.0
|
|
* @Version: V1.0
|
|
*/
|
|
*/
|
|
-@Api(tags="问卷调查二")
|
|
|
|
|
|
+@Api(tags = "问卷调查二")
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/adminwjdc2/adminTopic2")
|
|
@RequestMapping("/adminwjdc2/adminTopic2")
|
|
@Slf4j
|
|
@Slf4j
|
|
public class AdminTopicController2 extends JeecgController<AdminTopicTwo, IAdminTopicaTwoService> {
|
|
public class AdminTopicController2 extends JeecgController<AdminTopicTwo, IAdminTopicaTwoService> {
|
|
- @Autowired
|
|
|
|
- private IAdminTopicaTwoService adminTopicService;
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 分页列表查询
|
|
|
|
- *
|
|
|
|
- * @param adminTopic
|
|
|
|
- * @param pageNo
|
|
|
|
- * @param pageSize
|
|
|
|
- * @param req
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- //@AutoLog(value = "问卷调查-分页列表查询")
|
|
|
|
- @ApiOperation(value="问卷调查二-分页列表查询", notes="问卷调查二-分页列表查询")
|
|
|
|
- @GetMapping(value = "/list")
|
|
|
|
- public Result<IPage<AdminTopicTwo>> queryPageList(AdminTopicTwo adminTopic,
|
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
|
- HttpServletRequest req, String ssusername, String sstopic) {
|
|
|
|
- QueryWrapper<AdminTopicTwo> queryWrapper = QueryGenerator.initQueryWrapper(adminTopic, req.getParameterMap());
|
|
|
|
- if (ssusername != null){
|
|
|
|
- queryWrapper.like("username",ssusername);
|
|
|
|
- }
|
|
|
|
- if (sstopic != null){
|
|
|
|
- queryWrapper.like("topic",sstopic);
|
|
|
|
- }
|
|
|
|
- Page<AdminTopicTwo> page = new Page<AdminTopicTwo>(pageNo, pageSize);
|
|
|
|
- IPage<AdminTopicTwo> pageList = adminTopicService.page(page, queryWrapper);
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAdminTopicaTwoService adminTopicService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页列表查询
|
|
|
|
+ *
|
|
|
|
+ * @param adminTopic
|
|
|
|
+ * @param pageNo
|
|
|
|
+ * @param pageSize
|
|
|
|
+ * @param req
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ //@AutoLog(value = "问卷调查-分页列表查询")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-分页列表查询", notes = "问卷调查二-分页列表查询")
|
|
|
|
+ @GetMapping(value = "/list")
|
|
|
|
+ public Result<IPage<AdminTopicTwo>> queryPageList(AdminTopicTwo adminTopic,
|
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
|
+ HttpServletRequest req, String ssusername, String sstopic, Date createTime[]) {
|
|
|
|
+ QueryWrapper<AdminTopicTwo> queryWrapper = QueryGenerator.initQueryWrapper(adminTopic, req.getParameterMap());
|
|
|
|
+ if (ssusername != null) {
|
|
|
|
+ queryWrapper.like("username", ssusername);
|
|
|
|
+ }
|
|
|
|
+ if (sstopic != null) {
|
|
|
|
+ queryWrapper.like("topic", sstopic);
|
|
|
|
+ }
|
|
|
|
+ Page<AdminTopicTwo> page = new Page<AdminTopicTwo>(pageNo, pageSize);
|
|
|
|
+ IPage<AdminTopicTwo> pageList = adminTopicService.page(page, queryWrapper);
|
|
// for (int i = 0;i<pageList.getRecords().size();i++){
|
|
// for (int i = 0;i<pageList.getRecords().size();i++){
|
|
//
|
|
//
|
|
// }
|
|
// }
|
|
- return Result.OK(pageList);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加
|
|
|
|
- *
|
|
|
|
- * @param adminTopic
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @AutoLog(value = "问卷调查二-添加")
|
|
|
|
- @ApiOperation(value="问卷调查二-添加", notes="问卷调查二-添加")
|
|
|
|
- @PostMapping(value = "/add")
|
|
|
|
- public Result<String> add(@RequestBody AdminTopicTwo adminTopic) {
|
|
|
|
- adminTopicService.save(adminTopic);
|
|
|
|
- return Result.OK("添加成功!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 编辑
|
|
|
|
- *
|
|
|
|
- * @param adminTopic
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @AutoLog(value = "问卷调查二-编辑")
|
|
|
|
- @ApiOperation(value="问卷调查二-编辑", notes="问卷调查二-编辑")
|
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
- public Result<String> edit(@RequestBody AdminTopicTwo adminTopic) {
|
|
|
|
- adminTopicService.updateById(adminTopic);
|
|
|
|
- return Result.OK("编辑成功!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 通过id删除
|
|
|
|
- *
|
|
|
|
- * @param id
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @AutoLog(value = "问卷调查二-通过id删除")
|
|
|
|
- @ApiOperation(value="问卷调查二-通过id删除", notes="问卷调查二-通过id删除")
|
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
|
- adminTopicService.removeById(id);
|
|
|
|
- return Result.OK("删除成功!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 批量删除
|
|
|
|
- *
|
|
|
|
- * @param ids
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @AutoLog(value = "问卷调查二-批量删除")
|
|
|
|
- @ApiOperation(value="问卷调查二-批量删除", notes="问卷调查二-批量删除")
|
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
|
- this.adminTopicService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 通过id查询
|
|
|
|
- *
|
|
|
|
- * @param id
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- //@AutoLog(value = "问卷调查-通过id查询")
|
|
|
|
- @ApiOperation(value="问卷调查二-通过id查询", notes="问卷调查二-通过id查询")
|
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
|
- public Result<AdminTopicTwo> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
|
- AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
|
|
- if(adminTopic==null) {
|
|
|
|
- return Result.error("未找到对应数据",null);
|
|
|
|
- }
|
|
|
|
- return Result.OK(adminTopic);
|
|
|
|
- }
|
|
|
|
|
|
+ return Result.OK(pageList);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加
|
|
|
|
+ *
|
|
|
|
+ * @param adminTopic
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "问卷调查二-添加")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-添加", notes = "问卷调查二-添加")
|
|
|
|
+ @PostMapping(value = "/add")
|
|
|
|
+ public Result<String> add(@RequestBody AdminTopicTwo adminTopic) {
|
|
|
|
+ adminTopicService.save(adminTopic);
|
|
|
|
+ return Result.OK("添加成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 编辑
|
|
|
|
+ *
|
|
|
|
+ * @param adminTopic
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "问卷调查二-编辑")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-编辑", notes = "问卷调查二-编辑")
|
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
|
+ public Result<String> edit(@RequestBody AdminTopicTwo adminTopic) {
|
|
|
|
+ adminTopicService.updateById(adminTopic);
|
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过id删除
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "问卷调查二-通过id删除")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-通过id删除", notes = "问卷调查二-通过id删除")
|
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
|
+ adminTopicService.removeById(id);
|
|
|
|
+ return Result.OK("删除成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量删除
|
|
|
|
+ *
|
|
|
|
+ * @param ids
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "问卷调查二-批量删除")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-批量删除", notes = "问卷调查二-批量删除")
|
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
|
+ this.adminTopicService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过id查询
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ //@AutoLog(value = "问卷调查-通过id查询")
|
|
|
|
+ @ApiOperation(value = "问卷调查二-通过id查询", notes = "问卷调查二-通过id查询")
|
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
|
+ public Result<AdminTopicTwo> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
|
+ AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
|
|
+ if (adminTopic == null) {
|
|
|
|
+ return Result.error("未找到对应数据", null);
|
|
|
|
+ }
|
|
|
|
+ return Result.OK(adminTopic);
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 导出excel
|
|
|
|
- */
|
|
|
|
|
|
+ * 导出excel
|
|
|
|
+ */
|
|
@RequestMapping(value = "/exportXls/{id}")
|
|
@RequestMapping(value = "/exportXls/{id}")
|
|
public ModelAndView exportXls(@PathVariable String id) {
|
|
public ModelAndView exportXls(@PathVariable String id) {
|
|
// return super.exportXls(request, adminTopic, AdminTopic.class, "问卷调查");
|
|
// return super.exportXls(request, adminTopic, AdminTopic.class, "问卷调查");
|
|
// QueryWrapper<AdminTopic2> queryWrapper = new QueryWrapper<>( );
|
|
// QueryWrapper<AdminTopic2> queryWrapper = new QueryWrapper<>( );
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
- AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
// String title = adminTopic.getTopicTop();
|
|
// String title = adminTopic.getTopicTop();
|
|
- String title = adminTopic.getTopicTop();
|
|
|
|
- String topic = adminTopic.getTopicTwo();
|
|
|
|
- String res = StringEscapeUtils.unescapeJava(topic);
|
|
|
|
|
|
+ String title = adminTopic.getTopicTop();
|
|
|
|
+ String topic = adminTopic.getTopicTwo();
|
|
|
|
+ String res = StringEscapeUtils.unescapeJava(topic);
|
|
// String topic = "[{\"topicT\":\"题目1\",\"topicD\":\"答案\"}]";
|
|
// String topic = "[{\"topicT\":\"题目1\",\"topicD\":\"答案\"}]";
|
|
- // Step.2 获取导出数据
|
|
|
|
- List<AdminTopicTwo2> exportList = null;
|
|
|
|
- List<AdminTopicTwo3> exportList3 = new ArrayList<>( );
|
|
|
|
- JSONArray jsonArray = JSONArray.fromObject(res);//把String转换为json
|
|
|
|
- exportList = JSONArray.toList(jsonArray, AdminTopicTwo2.class);
|
|
|
|
-
|
|
|
|
- for (int i = 0;i<exportList.size();i++){
|
|
|
|
- AdminTopicTwo3 adminTopic3 = new AdminTopicTwo3();
|
|
|
|
- adminTopic3.setTopicT( exportList.get( i ).getTopicT() );
|
|
|
|
- List<String> result = Arrays.asList(exportList.get( i ).getTopicD().split(","));
|
|
|
|
- adminTopic3.setA( "" );
|
|
|
|
- adminTopic3.setB( "" );
|
|
|
|
- adminTopic3.setC( "" );
|
|
|
|
- adminTopic3.setD( "" );
|
|
|
|
- adminTopic3.setE( "" );
|
|
|
|
- adminTopic3.setF( "" );
|
|
|
|
- adminTopic3.setG( "" );
|
|
|
|
- adminTopic3.setH( "" );
|
|
|
|
- adminTopic3.setI( "" );
|
|
|
|
- adminTopic3.setJ( "" );
|
|
|
|
- adminTopic3.setK( "" );
|
|
|
|
- adminTopic3.setL( "" );
|
|
|
|
|
|
+ // Step.2 获取导出数据
|
|
|
|
+ List<AdminTopicTwo2> exportList = null;
|
|
|
|
+ List<AdminTopicTwo3> exportList3 = new ArrayList<>();
|
|
|
|
+ JSONArray jsonArray = JSONArray.fromObject(res);//把String转换为json
|
|
|
|
+ exportList = JSONArray.toList(jsonArray, AdminTopicTwo2.class);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < exportList.size(); i++) {
|
|
|
|
+ AdminTopicTwo3 adminTopic3 = new AdminTopicTwo3();
|
|
|
|
+ adminTopic3.setTopicT(exportList.get(i).getTopicT());
|
|
|
|
+ List<String> result = Arrays.asList(exportList.get(i).getTopicD().split(","));
|
|
|
|
+ adminTopic3.setA("");
|
|
|
|
+ adminTopic3.setB("");
|
|
|
|
+ adminTopic3.setC("");
|
|
|
|
+ adminTopic3.setD("");
|
|
|
|
+ adminTopic3.setE("");
|
|
|
|
+ adminTopic3.setF("");
|
|
|
|
+ adminTopic3.setG("");
|
|
|
|
+ adminTopic3.setH("");
|
|
|
|
+ adminTopic3.setI("");
|
|
|
|
+ adminTopic3.setJ("");
|
|
|
|
+ adminTopic3.setK("");
|
|
|
|
+ adminTopic3.setL("");
|
|
// exportList3.add( adminTopic3 );
|
|
// exportList3.add( adminTopic3 );
|
|
|
|
|
|
- for (int j = 0;j<result.size();j++){
|
|
|
|
- if (j == 0){
|
|
|
|
- adminTopic3.setA( result.get( 0 ) );
|
|
|
|
- }else if (j == 1){
|
|
|
|
- adminTopic3.setB( result.get( 1 ) );
|
|
|
|
- }else if (j == 2){
|
|
|
|
- adminTopic3.setC( result.get( 2 ) );
|
|
|
|
- }else if (j == 3){
|
|
|
|
- adminTopic3.setD( result.get( 3 ) );
|
|
|
|
- }else if (j == 4){
|
|
|
|
- adminTopic3.setE( result.get( 4 ) );
|
|
|
|
- }else if (j == 5){
|
|
|
|
- adminTopic3.setF( result.get( 5 ) );
|
|
|
|
- }else if (j == 6){
|
|
|
|
- adminTopic3.setG( result.get( 6 ) );
|
|
|
|
- }else if (j == 7){
|
|
|
|
- adminTopic3.setH( result.get( 7 ) );
|
|
|
|
- }else if (j == 8){
|
|
|
|
- adminTopic3.setI( result.get( 8 ) );
|
|
|
|
- }else if (j == 9){
|
|
|
|
- adminTopic3.setJ( result.get( 9 ) );
|
|
|
|
- }else if (j == 10){
|
|
|
|
- adminTopic3.setK( result.get( 10 ) );
|
|
|
|
- }else if (j == 11){
|
|
|
|
- adminTopic3.setL( result.get( 11 ) );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- exportList3.add( adminTopic3 );
|
|
|
|
- }
|
|
|
|
|
|
+ for (int j = 0; j < result.size(); j++) {
|
|
|
|
+ if (j == 0) {
|
|
|
|
+ adminTopic3.setA(result.get(0));
|
|
|
|
+ } else if (j == 1) {
|
|
|
|
+ adminTopic3.setB(result.get(1));
|
|
|
|
+ } else if (j == 2) {
|
|
|
|
+ adminTopic3.setC(result.get(2));
|
|
|
|
+ } else if (j == 3) {
|
|
|
|
+ adminTopic3.setD(result.get(3));
|
|
|
|
+ } else if (j == 4) {
|
|
|
|
+ adminTopic3.setE(result.get(4));
|
|
|
|
+ } else if (j == 5) {
|
|
|
|
+ adminTopic3.setF(result.get(5));
|
|
|
|
+ } else if (j == 6) {
|
|
|
|
+ adminTopic3.setG(result.get(6));
|
|
|
|
+ } else if (j == 7) {
|
|
|
|
+ adminTopic3.setH(result.get(7));
|
|
|
|
+ } else if (j == 8) {
|
|
|
|
+ adminTopic3.setI(result.get(8));
|
|
|
|
+ } else if (j == 9) {
|
|
|
|
+ adminTopic3.setJ(result.get(9));
|
|
|
|
+ } else if (j == 10) {
|
|
|
|
+ adminTopic3.setK(result.get(10));
|
|
|
|
+ } else if (j == 11) {
|
|
|
|
+ adminTopic3.setL(result.get(11));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ exportList3.add(adminTopic3);
|
|
|
|
+ }
|
|
|
|
|
|
// List<AdminTopic2> exportList = null;
|
|
// List<AdminTopic2> exportList = null;
|
|
|
|
|
|
|
|
|
|
- // 过滤选中数据
|
|
|
|
|
|
+ // 过滤选中数据
|
|
// String selections = request.getParameter("selections");
|
|
// String selections = request.getParameter("selections");
|
|
// if (oConvertUtils.isNotEmpty(selections)) {
|
|
// if (oConvertUtils.isNotEmpty(selections)) {
|
|
// List<String> selectionList = Arrays.asList(selections.split(","));
|
|
// List<String> selectionList = Arrays.asList(selections.split(","));
|
|
@@ -232,87 +234,87 @@ public class AdminTopicController2 extends JeecgController<AdminTopicTwo, IAdmin
|
|
// exportList = pageList;
|
|
// exportList = pageList;
|
|
// }
|
|
// }
|
|
|
|
|
|
- // Step.3 AutoPoi 导出Excel
|
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, AdminTopicTwo3.class);
|
|
|
|
- //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
- ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
- //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, exportList3);
|
|
|
|
- return mv;
|
|
|
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, AdminTopicTwo3.class);
|
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
+ ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, exportList3);
|
|
|
|
+ return mv;
|
|
}
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/exportXls2/{id}")
|
|
|
|
- public ModelAndView exportXls2(@PathVariable String id) {
|
|
|
|
|
|
+ @RequestMapping(value = "/exportXls2/{id}")
|
|
|
|
+ public ModelAndView exportXls2(@PathVariable String id) {
|
|
// return super.exportXls(request, adminTopic, AdminTopic.class, "问卷调查");
|
|
// return super.exportXls(request, adminTopic, AdminTopic.class, "问卷调查");
|
|
// QueryWrapper<AdminTopic2> queryWrapper = new QueryWrapper<>( );
|
|
// QueryWrapper<AdminTopic2> queryWrapper = new QueryWrapper<>( );
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
- AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ AdminTopicTwo adminTopic = adminTopicService.getById(id);
|
|
// String title = adminTopic.getTopicTop();
|
|
// String title = adminTopic.getTopicTop();
|
|
- String title = adminTopic.getTopicTop();
|
|
|
|
- String topic = adminTopic.getTopic();
|
|
|
|
- String res = StringEscapeUtils.unescapeJava(topic);
|
|
|
|
|
|
+ String title = adminTopic.getTopicTop();
|
|
|
|
+ String topic = adminTopic.getTopic();
|
|
|
|
+ String res = StringEscapeUtils.unescapeJava(topic);
|
|
// String topic = "[{\"topicT\":\"题目1\",\"topicD\":\"答案\"}]";
|
|
// String topic = "[{\"topicT\":\"题目1\",\"topicD\":\"答案\"}]";
|
|
- // Step.2 获取导出数据
|
|
|
|
- List<AdminTopicTwo2> exportList = null;
|
|
|
|
- List<AdminTopicTwo3> exportList3 = new ArrayList<>( );
|
|
|
|
- JSONArray jsonArray = JSONArray.fromObject(res);//把String转换为json
|
|
|
|
- exportList = JSONArray.toList(jsonArray, AdminTopicTwo2.class);
|
|
|
|
-
|
|
|
|
- for (int i = 0;i<exportList.size();i++){
|
|
|
|
- AdminTopicTwo3 adminTopic3 = new AdminTopicTwo3();
|
|
|
|
- adminTopic3.setTopicT( exportList.get( i ).getTopicT() );
|
|
|
|
- List<String> result = Arrays.asList(exportList.get( i ).getTopicD().split(","));
|
|
|
|
- adminTopic3.setA( "" );
|
|
|
|
- adminTopic3.setB( "" );
|
|
|
|
- adminTopic3.setC( "" );
|
|
|
|
- adminTopic3.setD( "" );
|
|
|
|
- adminTopic3.setE( "" );
|
|
|
|
- adminTopic3.setF( "" );
|
|
|
|
- adminTopic3.setG( "" );
|
|
|
|
- adminTopic3.setH( "" );
|
|
|
|
- adminTopic3.setI( "" );
|
|
|
|
- adminTopic3.setJ( "" );
|
|
|
|
- adminTopic3.setK( "" );
|
|
|
|
- adminTopic3.setL( "" );
|
|
|
|
|
|
+ // Step.2 获取导出数据
|
|
|
|
+ List<AdminTopicTwo2> exportList = null;
|
|
|
|
+ List<AdminTopicTwo3> exportList3 = new ArrayList<>();
|
|
|
|
+ JSONArray jsonArray = JSONArray.fromObject(res);//把String转换为json
|
|
|
|
+ exportList = JSONArray.toList(jsonArray, AdminTopicTwo2.class);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < exportList.size(); i++) {
|
|
|
|
+ AdminTopicTwo3 adminTopic3 = new AdminTopicTwo3();
|
|
|
|
+ adminTopic3.setTopicT(exportList.get(i).getTopicT());
|
|
|
|
+ List<String> result = Arrays.asList(exportList.get(i).getTopicD().split(","));
|
|
|
|
+ adminTopic3.setA("");
|
|
|
|
+ adminTopic3.setB("");
|
|
|
|
+ adminTopic3.setC("");
|
|
|
|
+ adminTopic3.setD("");
|
|
|
|
+ adminTopic3.setE("");
|
|
|
|
+ adminTopic3.setF("");
|
|
|
|
+ adminTopic3.setG("");
|
|
|
|
+ adminTopic3.setH("");
|
|
|
|
+ adminTopic3.setI("");
|
|
|
|
+ adminTopic3.setJ("");
|
|
|
|
+ adminTopic3.setK("");
|
|
|
|
+ adminTopic3.setL("");
|
|
// exportList3.add( adminTopic3 );
|
|
// exportList3.add( adminTopic3 );
|
|
|
|
|
|
- for (int j = 0;j<result.size();j++){
|
|
|
|
- if (j == 0){
|
|
|
|
- adminTopic3.setA( result.get( 0 ) );
|
|
|
|
- }else if (j == 1){
|
|
|
|
- adminTopic3.setB( result.get( 1 ) );
|
|
|
|
- }else if (j == 2){
|
|
|
|
- adminTopic3.setC( result.get( 2 ) );
|
|
|
|
- }else if (j == 3){
|
|
|
|
- adminTopic3.setD( result.get( 3 ) );
|
|
|
|
- }else if (j == 4){
|
|
|
|
- adminTopic3.setE( result.get( 4 ) );
|
|
|
|
- }else if (j == 5){
|
|
|
|
- adminTopic3.setF( result.get( 5 ) );
|
|
|
|
- }else if (j == 6){
|
|
|
|
- adminTopic3.setG( result.get( 6 ) );
|
|
|
|
- }else if (j == 7){
|
|
|
|
- adminTopic3.setH( result.get( 7 ) );
|
|
|
|
- }else if (j == 8){
|
|
|
|
- adminTopic3.setI( result.get( 8 ) );
|
|
|
|
- }else if (j == 9){
|
|
|
|
- adminTopic3.setJ( result.get( 9 ) );
|
|
|
|
- }else if (j == 10){
|
|
|
|
- adminTopic3.setK( result.get( 10 ) );
|
|
|
|
- }else if (j == 11){
|
|
|
|
- adminTopic3.setL( result.get( 11 ) );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- exportList3.add( adminTopic3 );
|
|
|
|
- }
|
|
|
|
|
|
+ for (int j = 0; j < result.size(); j++) {
|
|
|
|
+ if (j == 0) {
|
|
|
|
+ adminTopic3.setA(result.get(0));
|
|
|
|
+ } else if (j == 1) {
|
|
|
|
+ adminTopic3.setB(result.get(1));
|
|
|
|
+ } else if (j == 2) {
|
|
|
|
+ adminTopic3.setC(result.get(2));
|
|
|
|
+ } else if (j == 3) {
|
|
|
|
+ adminTopic3.setD(result.get(3));
|
|
|
|
+ } else if (j == 4) {
|
|
|
|
+ adminTopic3.setE(result.get(4));
|
|
|
|
+ } else if (j == 5) {
|
|
|
|
+ adminTopic3.setF(result.get(5));
|
|
|
|
+ } else if (j == 6) {
|
|
|
|
+ adminTopic3.setG(result.get(6));
|
|
|
|
+ } else if (j == 7) {
|
|
|
|
+ adminTopic3.setH(result.get(7));
|
|
|
|
+ } else if (j == 8) {
|
|
|
|
+ adminTopic3.setI(result.get(8));
|
|
|
|
+ } else if (j == 9) {
|
|
|
|
+ adminTopic3.setJ(result.get(9));
|
|
|
|
+ } else if (j == 10) {
|
|
|
|
+ adminTopic3.setK(result.get(10));
|
|
|
|
+ } else if (j == 11) {
|
|
|
|
+ adminTopic3.setL(result.get(11));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ exportList3.add(adminTopic3);
|
|
|
|
+ }
|
|
|
|
|
|
// List<AdminTopic2> exportList = null;
|
|
// List<AdminTopic2> exportList = null;
|
|
|
|
|
|
|
|
|
|
- // 过滤选中数据
|
|
|
|
|
|
+ // 过滤选中数据
|
|
// String selections = request.getParameter("selections");
|
|
// String selections = request.getParameter("selections");
|
|
// if (oConvertUtils.isNotEmpty(selections)) {
|
|
// if (oConvertUtils.isNotEmpty(selections)) {
|
|
// List<String> selectionList = Arrays.asList(selections.split(","));
|
|
// List<String> selectionList = Arrays.asList(selections.split(","));
|
|
@@ -321,426 +323,32 @@ public class AdminTopicController2 extends JeecgController<AdminTopicTwo, IAdmin
|
|
// exportList = pageList;
|
|
// exportList = pageList;
|
|
// }
|
|
// }
|
|
|
|
|
|
- // Step.3 AutoPoi 导出Excel
|
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, AdminTopicTwo3.class);
|
|
|
|
- //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
- ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
- //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, exportList3);
|
|
|
|
- return mv;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "/exportXls")
|
|
|
|
- public ModelAndView exportXls1(HttpServletRequest request, AdminTopicTwo adminTopic, String ssusername, String sstopic) {
|
|
|
|
- // Step.1 组装查询条件查询数据
|
|
|
|
-// QueryWrapper<AdminTopic> queryWrapper = QueryGenerator.initQueryWrapper( adminTopic, request.getParameterMap() );
|
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
-// if (ssusername != null){
|
|
|
|
-// queryWrapper.like("username",ssusername);
|
|
|
|
-// }
|
|
|
|
-// if (sstopic != null){
|
|
|
|
-// queryWrapper.like("topic",sstopic);
|
|
|
|
-// }
|
|
|
|
- //Step.2 获取导出数据
|
|
|
|
-// List<AdminTopic> queryList = adminTopicService.list( queryWrapper );
|
|
|
|
- // 过滤选中数据
|
|
|
|
- String selections = request.getParameter( "selections" );
|
|
|
|
- List<AdminTopicTwo> adminTopics = new ArrayList<AdminTopicTwo>();
|
|
|
|
- List<AdminTopicTwo4> adminTopics4 = new ArrayList<AdminTopicTwo4>();
|
|
|
|
- if (oConvertUtils.isEmpty( selections )) {
|
|
|
|
-// adminTopics = queryList;
|
|
|
|
- } else {
|
|
|
|
- List<String> selectionList = Arrays.asList( selections.split( "," ) );
|
|
|
|
-// adminTopics = queryList.stream().filter( item -> selectionList.contains( item.getId() ) ).collect( Collectors.toList() );
|
|
|
|
|
|
+ // Step.3 AutoPoi 导出Excel
|
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, AdminTopicTwo3.class);
|
|
|
|
+ //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
|
|
|
+ ExportParams exportParams = new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
|
|
|
|
+ //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, exportList3);
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
|
|
- QueryWrapper<AdminTopicTwo> queryWrapper = new QueryWrapper<>( );
|
|
|
|
- queryWrapper.in( "id", selectionList);
|
|
|
|
- List<AdminTopicTwo> queryList = adminTopicService.list( queryWrapper );
|
|
|
|
- adminTopics = queryList;
|
|
|
|
- }
|
|
|
|
- //下面对数据做处理
|
|
|
|
-// 转成AdminTopic4对象的类型
|
|
|
|
- int a = adminTopics.size();
|
|
|
|
- for (int i=0;i<a;i++){
|
|
|
|
- AdminTopicTwo4 adminTopic4 = new AdminTopicTwo4();
|
|
|
|
- adminTopic4.setXuhao( i+1 );
|
|
|
|
- adminTopic4.setName( adminTopics.get( i ).getUsername() );
|
|
|
|
- adminTopic4.setPhone( adminTopics.get( i ).getPhone() );
|
|
|
|
- adminTopic4.setHospital( adminTopics.get( i ).getHospital() );
|
|
|
|
- adminTopic4.setOutpatientServiceTime( adminTopics.get( i ).getOutpatientServiceTime() );
|
|
|
|
- adminTopic4.setCreateTime( adminTopics.get( i ).getCreateTime() );
|
|
|
|
- String s = adminTopics.get( i ).getTopicTop();
|
|
|
|
- String numStr = s.substring(s.indexOf("人数") + 3, s.indexOf("(人)"));
|
|
|
|
- adminTopic4.setDiaoyan( numStr );
|
|
|
|
-
|
|
|
|
- String topic = adminTopics.get( i ).getTopicTwo();
|
|
|
|
- String res = StringEscapeUtils.unescapeJava(topic);
|
|
|
|
- List<AdminTopicTwo2> exportList = null;
|
|
|
|
- JSONArray jsonArray = JSONArray.fromObject(res);//把String转换为json
|
|
|
|
- exportList = JSONArray.toList(jsonArray, AdminTopicTwo2.class);
|
|
|
|
- //1、
|
|
|
|
- AdminTopicTwo2 adminTopic1 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "1、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- /* if (adminTopic1 != null) {
|
|
|
|
- String[] split = adminTopic1.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setA1( split[0] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setA1( "" );
|
|
|
|
- }*/
|
|
|
|
- //2、
|
|
|
|
- AdminTopicTwo2 adminTopic2 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "2、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic2 != null) {
|
|
|
|
- String[] split = adminTopic2.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setB1( split[0] );
|
|
|
|
-// adminTopic4.setB2( split[1] );
|
|
|
|
-// adminTopic4.setB3( split[2] );
|
|
|
|
-// adminTopic4.setB4( split[3] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setB1( "" );
|
|
|
|
-// adminTopic4.setB2( "" );
|
|
|
|
-// adminTopic4.setB3( "" );
|
|
|
|
-// adminTopic4.setB4( "" );
|
|
|
|
- }
|
|
|
|
- //3、
|
|
|
|
- AdminTopicTwo2 adminTopic3 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "3、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic3 != null) {
|
|
|
|
- String[] split = adminTopic3.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setC1( split[0] );
|
|
|
|
-// adminTopic4.setC2( split[1] );
|
|
|
|
-// adminTopic4.setC3( split[2] );
|
|
|
|
-// adminTopic4.setC4( split[3] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setC1( "" );
|
|
|
|
-// adminTopic4.setC2( "" );
|
|
|
|
-// adminTopic4.setC3( "" );
|
|
|
|
-// adminTopic4.setC4( "" );
|
|
|
|
- }
|
|
|
|
- //4、
|
|
|
|
- AdminTopicTwo2 adminTopic44 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "4、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic44 != null) {
|
|
|
|
- String[] split = adminTopic44.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setD1( split[0] );
|
|
|
|
- adminTopic4.setD2( split[1] );
|
|
|
|
- adminTopic4.setD3( split[2] );
|
|
|
|
- adminTopic4.setD4( split[3] );
|
|
|
|
- adminTopic4.setD5( split[4] );
|
|
|
|
- adminTopic4.setD6( split[5] );
|
|
|
|
-// adminTopic4.setD7( split[6] );
|
|
|
|
-// adminTopic4.setD8( split[7] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setD1( "" );
|
|
|
|
- adminTopic4.setD2( "" );
|
|
|
|
- adminTopic4.setD3( "" );
|
|
|
|
- adminTopic4.setD4( "" );
|
|
|
|
- adminTopic4.setD5( "" );
|
|
|
|
- adminTopic4.setD6( "" );
|
|
|
|
-// adminTopic4.setD7( "" );
|
|
|
|
-// adminTopic4.setD8( "" );
|
|
|
|
- }
|
|
|
|
- //5、
|
|
|
|
- AdminTopicTwo2 adminTopic5 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "5、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic5 != null) {
|
|
|
|
- String[] split = adminTopic5.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setE1( split[0] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setE1( "" );
|
|
|
|
- }
|
|
|
|
- //6、
|
|
|
|
- AdminTopicTwo2 adminTopic6 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "6、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic6 != null) {
|
|
|
|
- String[] split = adminTopic6.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setF1( split[0] );
|
|
|
|
- adminTopic4.setF2( split[1] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setF1( "" );
|
|
|
|
- adminTopic4.setF2( "" );
|
|
|
|
- }
|
|
|
|
- //7、
|
|
|
|
- AdminTopicTwo2 adminTopic7 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "7、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic7 != null) {
|
|
|
|
- String[] split = adminTopic7.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setG1( split[0] );
|
|
|
|
-// adminTopic4.setG2( split[1] );
|
|
|
|
-// adminTopic4.setG3( split[2] );
|
|
|
|
-// adminTopic4.setG4( split[3] );
|
|
|
|
-// adminTopic4.setG5( split[4] );
|
|
|
|
-// adminTopic4.setG6( split[5] );
|
|
|
|
-// adminTopic4.setG7( split[6] );
|
|
|
|
-// adminTopic4.setG8( split[7] );
|
|
|
|
-// adminTopic4.setG9( split[8] );
|
|
|
|
-// adminTopic4.setG10( split[9] );
|
|
|
|
-// adminTopic4.setG11( split[10] );
|
|
|
|
-// adminTopic4.setG12( split[11] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setG1( "" );
|
|
|
|
-// adminTopic4.setG2( "" );
|
|
|
|
-// adminTopic4.setG3( "" );
|
|
|
|
-// adminTopic4.setG4( "" );
|
|
|
|
-// adminTopic4.setG5( "" );
|
|
|
|
-// adminTopic4.setG6( "" );
|
|
|
|
-// adminTopic4.setG7( "" );
|
|
|
|
-// adminTopic4.setG8( "" );
|
|
|
|
-// adminTopic4.setG9( "" );
|
|
|
|
-// adminTopic4.setG10( "" );
|
|
|
|
-// adminTopic4.setG11( "" );
|
|
|
|
-// adminTopic4.setG12( "" );
|
|
|
|
- }
|
|
|
|
- //8、
|
|
|
|
- AdminTopicTwo2 adminTopic8 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "8、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic8 != null) {
|
|
|
|
- String[] split = adminTopic8.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setH1( split[0] );
|
|
|
|
- adminTopic4.setH2( split[1] );
|
|
|
|
-// adminTopic4.setH3( split[2] );
|
|
|
|
-// adminTopic4.setH4( split[3] );
|
|
|
|
-// adminTopic4.setH5( split[4] );
|
|
|
|
-// adminTopic4.setH6( split[5] );
|
|
|
|
-// adminTopic4.setH7( split[6] );
|
|
|
|
-// adminTopic4.setH8( split[7] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setH1( "" );
|
|
|
|
- adminTopic4.setH2( "" );
|
|
|
|
-// adminTopic4.setH3( "" );
|
|
|
|
-// adminTopic4.setH4( "" );
|
|
|
|
-// adminTopic4.setH5( "" );
|
|
|
|
-// adminTopic4.setH6( "" );
|
|
|
|
-// adminTopic4.setH7( "" );
|
|
|
|
-// adminTopic4.setH8( "" );
|
|
|
|
- }
|
|
|
|
- //9、
|
|
|
|
- AdminTopicTwo2 adminTopic9 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "9、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic9 != null) {
|
|
|
|
- String[] split = adminTopic9.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setI1( split[0] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setI1( "" );
|
|
|
|
- }
|
|
|
|
- //10、
|
|
|
|
- AdminTopicTwo2 adminTopic10 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "10、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic10 != null) {
|
|
|
|
- String[] split = adminTopic10.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setJ1( split[0] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setJ1( "" );
|
|
|
|
- }
|
|
|
|
- //11、
|
|
|
|
- AdminTopicTwo2 adminTopic11 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "11、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic11 != null) {
|
|
|
|
- String[] split = adminTopic11.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setK1( split[0] );
|
|
|
|
- adminTopic4.setK2( split[1] );
|
|
|
|
- adminTopic4.setK3( split[2] );
|
|
|
|
- adminTopic4.setK4( split[3] );
|
|
|
|
-// adminTopic4.setK5( split[4] );
|
|
|
|
-// adminTopic4.setK6( split[5] );
|
|
|
|
-// adminTopic4.setK7( split[6] );
|
|
|
|
-// adminTopic4.setK8( split[7] );
|
|
|
|
-// adminTopic4.setK9( split[8] );
|
|
|
|
-// adminTopic4.setK10( split[9] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setK1( "" );
|
|
|
|
- adminTopic4.setK2( "" );
|
|
|
|
- adminTopic4.setK3( "" );
|
|
|
|
- adminTopic4.setK4( "" );
|
|
|
|
-// adminTopic4.setK5( "" );
|
|
|
|
-// adminTopic4.setK6( "" );
|
|
|
|
-// adminTopic4.setK7( "" );
|
|
|
|
-// adminTopic4.setK8( "" );
|
|
|
|
-// adminTopic4.setK9( "" );
|
|
|
|
-// adminTopic4.setK10( "" );
|
|
|
|
- }
|
|
|
|
- //12、
|
|
|
|
- AdminTopicTwo2 adminTopic12 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "12、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic12 != null) {
|
|
|
|
- String[] split = adminTopic12.getTopicD().split( "," );
|
|
|
|
- if (split[0].equals( "是" )){
|
|
|
|
- adminTopic4.setL1( split[0] );
|
|
|
|
- adminTopic4.setL2( "" );
|
|
|
|
- adminTopic4.setL3( "" );
|
|
|
|
- adminTopic4.setL4( "" );
|
|
|
|
- adminTopic4.setL5( "" );
|
|
|
|
- }else {
|
|
|
|
- adminTopic4.setL1( split[0] );
|
|
|
|
- adminTopic4.setL2( split[1] );
|
|
|
|
- adminTopic4.setL3( split[2] );
|
|
|
|
- adminTopic4.setL4( split[3] );
|
|
|
|
- adminTopic4.setL5( split[4] );
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setL1( "" );
|
|
|
|
- adminTopic4.setL2( "" );
|
|
|
|
- adminTopic4.setL3( "" );
|
|
|
|
- adminTopic4.setL4( "" );
|
|
|
|
- adminTopic4.setL5( "" );
|
|
|
|
- }
|
|
|
|
- //13、
|
|
|
|
- AdminTopicTwo2 adminTopic13 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "13、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic13 != null) {
|
|
|
|
- String[] split = adminTopic13.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setM1( split[0] );
|
|
|
|
- adminTopic4.setM2( split[1] );
|
|
|
|
-// adminTopic4.setM3( split[2] );
|
|
|
|
-// adminTopic4.setM4( split[3] );
|
|
|
|
-// adminTopic4.setM5( split[4] );
|
|
|
|
-// adminTopic4.setM6( split[5] );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setM1( "" );
|
|
|
|
- adminTopic4.setM2( "" );
|
|
|
|
-// adminTopic4.setM3( "" );
|
|
|
|
-// adminTopic4.setM4( "" );
|
|
|
|
-// adminTopic4.setM5( "" );
|
|
|
|
-// adminTopic4.setM6( "" );
|
|
|
|
- }
|
|
|
|
- //14、
|
|
|
|
- AdminTopicTwo2 adminTopic14 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "14、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic14 != null) {
|
|
|
|
- String[] split = adminTopic14.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setN1( split[0] );
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setN1( "" );
|
|
|
|
- }
|
|
|
|
- //15、
|
|
|
|
- AdminTopicTwo2 adminTopic15 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "15、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic15 != null) {
|
|
|
|
- String[] split = adminTopic15.getTopicD().split( "," );
|
|
|
|
-// adminTopic4.setO1( split[0] );
|
|
|
|
-// adminTopic4.setO2( split[1] );
|
|
|
|
-// adminTopic4.setO3( split[2] );
|
|
|
|
- } else {
|
|
|
|
-// adminTopic4.setO1( "" );
|
|
|
|
-// adminTopic4.setO2( "" );
|
|
|
|
-// adminTopic4.setO3( "" );
|
|
|
|
- }
|
|
|
|
- //16、
|
|
|
|
- AdminTopicTwo2 adminTopic16 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "16、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic16 != null) {
|
|
|
|
- String[] split = adminTopic16.getTopicD().split( "," );
|
|
|
|
- adminTopic4.setP1( split[0] );
|
|
|
|
- adminTopic4.setP2( split[1] );
|
|
|
|
- adminTopic4.setP3( split[2] );
|
|
|
|
- adminTopic4.setP4( split[3] );
|
|
|
|
- adminTopic4.setP5( split[4] );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- adminTopic4.setP1( "" );
|
|
|
|
- adminTopic4.setP2( "" );
|
|
|
|
- adminTopic4.setP3( "" );
|
|
|
|
- adminTopic4.setP4( "" );
|
|
|
|
- adminTopic4.setP5( "" );
|
|
|
|
- }
|
|
|
|
- //17、
|
|
|
|
- AdminTopicTwo2 adminTopic17 = exportList.stream()
|
|
|
|
- .filter( p -> p.getTopicT().matches( "17、" + ".*" ) )
|
|
|
|
- .findFirst()
|
|
|
|
- .orElse( null );
|
|
|
|
-
|
|
|
|
- if (adminTopic17 != null) {
|
|
|
|
- String[] split = adminTopic17.getTopicD().split( "," );
|
|
|
|
-// adminTopic4.setQ1( split[0] );
|
|
|
|
-// adminTopic4.setQ2( split[1] );
|
|
|
|
-// adminTopic4.setQ3( split[2] );
|
|
|
|
-// adminTopic4.setQ4( split[3] );
|
|
|
|
-// adminTopic4.setQ5( split[4] );
|
|
|
|
-// adminTopic4.setQ6( split[5] );
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-// adminTopic4.setQ1( "" );
|
|
|
|
-// adminTopic4.setQ2( "" );
|
|
|
|
-// adminTopic4.setQ3( "" );
|
|
|
|
-// adminTopic4.setQ4( "" );
|
|
|
|
-// adminTopic4.setQ5( "" );
|
|
|
|
-// adminTopic4.setQ6( "" );
|
|
|
|
- }
|
|
|
|
-// //18、
|
|
|
|
-// AdminTopicTwo2 adminTopic18 = exportList.stream()
|
|
|
|
-// .filter( p -> p.getTopicT().matches( "18、" + ".*" ) )
|
|
|
|
-// .findFirst()
|
|
|
|
-// .orElse( null );
|
|
|
|
-//
|
|
|
|
-// if (adminTopic18 != null) {
|
|
|
|
-// String[] split = adminTopic18.getTopicD().split( "," );
|
|
|
|
-// adminTopic4.setX1( split[0] );
|
|
|
|
-// } else {
|
|
|
|
-// adminTopic4.setX1( "" );
|
|
|
|
-// }
|
|
|
|
- adminTopics4.add( adminTopic4 );
|
|
|
|
- }
|
|
|
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
|
+ public ModelAndView exportXls1(HttpServletRequest request, AdminTopicTwo adminTopic, String ssusername, String sstopic) {
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
- // Step.4 AutoPoi 导出Excel
|
|
|
|
- ModelAndView mv = new ModelAndView( new JeecgEntityExcelView() );
|
|
|
|
- mv.addObject( NormalExcelConstants.FILE_NAME, "问卷调查列表" );
|
|
|
|
- mv.addObject( NormalExcelConstants.CLASS, AdminTopicTwo4.class );
|
|
|
|
- mv.addObject( NormalExcelConstants.PARAMS, new ExportParams( "问卷调查数据", "导出人:" + sysUser.getRealname(), "问卷调查" ) );
|
|
|
|
- mv.addObject( NormalExcelConstants.DATA_LIST, adminTopics4 );
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
|
|
+ List<AdminTopicTwo4> adminTopics4= adminTopicService.exportXls1(request);
|
|
|
|
+
|
|
|
|
+ // Step.4 AutoPoi 导出Excel
|
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "问卷调查列表");
|
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, AdminTopicTwo4.class);
|
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("问卷调查数据", "导出人:" + sysUser.getRealname(), "问卷调查"));
|
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, adminTopics4);
|
|
|
|
+ return mv;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
// @RequestMapping(value = "/exportXls")
|
|
// @RequestMapping(value = "/exportXls")
|
|
@@ -918,21 +526,22 @@ public class AdminTopicController2 extends JeecgController<AdminTopicTwo, IAdmin
|
|
// return mv;
|
|
// return mv;
|
|
// }
|
|
// }
|
|
|
|
|
|
- private String getId(AdminTopicTwo2 item) {
|
|
|
|
- try {
|
|
|
|
- return PropertyUtils.getProperty(item, "id").toString();
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ private String getId(AdminTopicTwo2 item) {
|
|
|
|
+ try {
|
|
|
|
+ return PropertyUtils.getProperty(item, "id").toString();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 通过excel导入数据
|
|
|
|
- *
|
|
|
|
- * @param request
|
|
|
|
- * @param response
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
|
|
+ * 通过excel导入数据
|
|
|
|
+ *
|
|
|
|
+ * @param request
|
|
|
|
+ * @param response
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
return super.importExcel(request, response, AdminTopicTwo.class);
|
|
return super.importExcel(request, response, AdminTopicTwo.class);
|