增加问卷调查展示逻辑

This commit is contained in:
2025-06-27 15:32:35 +08:00
parent e77392e74f
commit f120195f04
11 changed files with 557 additions and 0 deletions

View File

@ -89,4 +89,7 @@ public class CjOptionController extends BaseController
return toAjax(cjOptionService.deleteCjOptionByIds(ids)); return toAjax(cjOptionService.deleteCjOptionByIds(ids));
} }
} }

View File

@ -0,0 +1,115 @@
package com.ruoyi.dw.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dw.domain.DwIndexConfig;
import com.ruoyi.dw.service.IDwIndexConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 调查问卷统计展示Controller
*
* @author sunyg
* @date 2025-06-27
*/
@RestController
@RequestMapping("/dw/config")
public class DwIndexConfigController extends BaseController
{
@Autowired
private IDwIndexConfigService dwIndexConfigService;
/**
* 查询调查问卷统计展示列表
*/
@GetMapping("/list")
public TableDataInfo list(DwIndexConfig dwIndexConfig)
{
startPage();
List<DwIndexConfig> list = dwIndexConfigService.selectDwIndexConfigList(dwIndexConfig);
return getDataTable(list);
}
/**
* 导出调查问卷统计展示列表
*/
@Log(title = "调查问卷统计展示", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DwIndexConfig dwIndexConfig)
{
List<DwIndexConfig> list = dwIndexConfigService.selectDwIndexConfigList(dwIndexConfig);
ExcelUtil<DwIndexConfig> util = new ExcelUtil<DwIndexConfig>(DwIndexConfig.class);
util.exportExcel(response, list, "调查问卷统计展示数据");
}
/**
* 获取调查问卷统计展示详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dwIndexConfigService.selectDwIndexConfigById(id));
}
/**
* 新增调查问卷统计展示
*/
@Log(title = "调查问卷统计展示", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DwIndexConfig dwIndexConfig)
{
if (StringUtils.isEmpty(dwIndexConfig.getQuestionId())){
return AjaxResult.error("请先选择展示调查问题");
}
String[] question_ids = dwIndexConfig.getQuestionId().split(",");
if (question_ids.length > 1 && dwIndexConfig.getIndexType() == 0){
return AjaxResult.error("饼状图只能选择一个问题");
}
return toAjax(dwIndexConfigService.insertDwIndexConfig(dwIndexConfig));
}
/**
* 修改调查问卷统计展示
*/
@Log(title = "调查问卷统计展示", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DwIndexConfig dwIndexConfig)
{
if (StringUtils.isEmpty(dwIndexConfig.getQuestionId())){
return AjaxResult.error("请先选择展示调查问题");
}
String[] question_ids = dwIndexConfig.getQuestionId().split(",");
if (question_ids.length > 1 && dwIndexConfig.getIndexType() == 0){
return AjaxResult.error("饼状图只能选择一个问题");
}
return toAjax(dwIndexConfigService.updateDwIndexConfig(dwIndexConfig));
}
/**
* 删除调查问卷统计展示
*/
@Log(title = "调查问卷统计展示", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dwIndexConfigService.deleteDwIndexConfigByIds(ids));
}
}

View File

@ -10,6 +10,7 @@ import com.ruoyi.dw.domain.DwInfo;
import com.ruoyi.dw.service.IDwInfoService; import com.ruoyi.dw.service.IDwInfoService;
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 javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
@ -99,4 +100,6 @@ public class DwInfoController extends BaseController
{ {
return toAjax(dwInfoService.deleteDwInfoByIds(ids)); return toAjax(dwInfoService.deleteDwInfoByIds(ids));
} }
} }

View File

@ -10,6 +10,7 @@ import com.ruoyi.dw.domain.DwQuestion;
import com.ruoyi.dw.service.IDwQuestionService; import com.ruoyi.dw.service.IDwQuestionService;
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 javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
@ -88,4 +89,10 @@ public class DwQuestionController extends BaseController
{ {
return toAjax(dwQuestionService.deleteDwQuestionByIds(ids)); return toAjax(dwQuestionService.deleteDwQuestionByIds(ids));
} }
public AjaxResult importData(MultipartFile file, int infoId) throws Exception{
return AjaxResult.success();
}
} }

View File

@ -0,0 +1,105 @@
package com.ruoyi.dw.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 调查问卷统计展示对象 dw_index_config
*
* @author sunyg
* @date 2025-06-27
*/
public class DwIndexConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 展位名称 */
@Excel(name = "展位名称")
private String indexName;
/** 问题id多个逗号隔开 */
@Excel(name = "问题id多个逗号隔开")
private String questionId;
/** 调查问卷id */
@Excel(name = "调查问卷id")
private Long infoId;
/**
* 展现形式
* 0-饼状图2-柱状图3-折线图
* */
@Excel(name = "展现形式")
private Long indexType;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setIndexName(String indexName)
{
this.indexName = indexName;
}
public String getIndexName()
{
return indexName;
}
public void setQuestionId(String questionId)
{
this.questionId = questionId;
}
public String getQuestionId()
{
return questionId;
}
public void setInfoId(Long infoId)
{
this.infoId = infoId;
}
public Long getInfoId()
{
return infoId;
}
public void setIndexType(Long indexType)
{
this.indexType = indexType;
}
public Long getIndexType()
{
return indexType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("indexName", getIndexName())
.append("questionId", getQuestionId())
.append("infoId", getInfoId())
.append("indexType", getIndexType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.dw.mapper;
import java.util.List;
import com.ruoyi.dw.domain.DwIndexConfig;
/**
* 调查问卷统计展示Mapper接口
*
* @author sunyg
* @date 2025-06-27
*/
public interface DwIndexConfigMapper
{
/**
* 查询调查问卷统计展示
*
* @param id 调查问卷统计展示主键
* @return 调查问卷统计展示
*/
public DwIndexConfig selectDwIndexConfigById(Long id);
/**
* 查询调查问卷统计展示列表
*
* @param dwIndexConfig 调查问卷统计展示
* @return 调查问卷统计展示集合
*/
public List<DwIndexConfig> selectDwIndexConfigList(DwIndexConfig dwIndexConfig);
/**
* 新增调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
public int insertDwIndexConfig(DwIndexConfig dwIndexConfig);
/**
* 修改调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
public int updateDwIndexConfig(DwIndexConfig dwIndexConfig);
/**
* 删除调查问卷统计展示
*
* @param id 调查问卷统计展示主键
* @return 结果
*/
public int deleteDwIndexConfigById(Long id);
/**
* 批量删除调查问卷统计展示
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDwIndexConfigByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.dw.service;
import java.util.List;
import com.ruoyi.dw.domain.DwIndexConfig;
/**
* 调查问卷统计展示Service接口
*
* @author sunyg
* @date 2025-06-27
*/
public interface IDwIndexConfigService
{
/**
* 查询调查问卷统计展示
*
* @param id 调查问卷统计展示主键
* @return 调查问卷统计展示
*/
public DwIndexConfig selectDwIndexConfigById(Long id);
/**
* 查询调查问卷统计展示列表
*
* @param dwIndexConfig 调查问卷统计展示
* @return 调查问卷统计展示集合
*/
public List<DwIndexConfig> selectDwIndexConfigList(DwIndexConfig dwIndexConfig);
/**
* 新增调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
public int insertDwIndexConfig(DwIndexConfig dwIndexConfig);
/**
* 修改调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
public int updateDwIndexConfig(DwIndexConfig dwIndexConfig);
/**
* 批量删除调查问卷统计展示
*
* @param ids 需要删除的调查问卷统计展示主键集合
* @return 结果
*/
public int deleteDwIndexConfigByIds(Long[] ids);
/**
* 删除调查问卷统计展示信息
*
* @param id 调查问卷统计展示主键
* @return 结果
*/
public int deleteDwIndexConfigById(Long id);
}

View File

@ -58,4 +58,12 @@ public interface IDwQuestionService
* @return 结果 * @return 结果
*/ */
public int deleteDwQuestionById(Long id); public int deleteDwQuestionById(Long id);
/**
*
* 导入调查问卷
* @param dwQuestionList
* @return
*/
public int importDwQuestion(List<DwQuestion> dwQuestionList);
} }

View File

@ -0,0 +1,96 @@
package com.ruoyi.dw.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dw.mapper.DwIndexConfigMapper;
import com.ruoyi.dw.domain.DwIndexConfig;
import com.ruoyi.dw.service.IDwIndexConfigService;
/**
* 调查问卷统计展示Service业务层处理
*
* @author sunyg
* @date 2025-06-27
*/
@Service
public class DwIndexConfigServiceImpl implements IDwIndexConfigService
{
@Autowired
private DwIndexConfigMapper dwIndexConfigMapper;
/**
* 查询调查问卷统计展示
*
* @param id 调查问卷统计展示主键
* @return 调查问卷统计展示
*/
@Override
public DwIndexConfig selectDwIndexConfigById(Long id)
{
return dwIndexConfigMapper.selectDwIndexConfigById(id);
}
/**
* 查询调查问卷统计展示列表
*
* @param dwIndexConfig 调查问卷统计展示
* @return 调查问卷统计展示
*/
@Override
public List<DwIndexConfig> selectDwIndexConfigList(DwIndexConfig dwIndexConfig)
{
return dwIndexConfigMapper.selectDwIndexConfigList(dwIndexConfig);
}
/**
* 新增调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
@Override
public int insertDwIndexConfig(DwIndexConfig dwIndexConfig)
{
dwIndexConfig.setCreateTime(DateUtils.getNowDate());
return dwIndexConfigMapper.insertDwIndexConfig(dwIndexConfig);
}
/**
* 修改调查问卷统计展示
*
* @param dwIndexConfig 调查问卷统计展示
* @return 结果
*/
@Override
public int updateDwIndexConfig(DwIndexConfig dwIndexConfig)
{
dwIndexConfig.setUpdateTime(DateUtils.getNowDate());
return dwIndexConfigMapper.updateDwIndexConfig(dwIndexConfig);
}
/**
* 批量删除调查问卷统计展示
*
* @param ids 需要删除的调查问卷统计展示主键
* @return 结果
*/
@Override
public int deleteDwIndexConfigByIds(Long[] ids)
{
return dwIndexConfigMapper.deleteDwIndexConfigByIds(ids);
}
/**
* 删除调查问卷统计展示信息
*
* @param id 调查问卷统计展示主键
* @return 结果
*/
@Override
public int deleteDwIndexConfigById(Long id)
{
return dwIndexConfigMapper.deleteDwIndexConfigById(id);
}
}

View File

@ -90,4 +90,11 @@ public class DwQuestionServiceImpl implements IDwQuestionService
{ {
return dwQuestionMapper.deleteDwQuestionById(id); return dwQuestionMapper.deleteDwQuestionById(id);
} }
@Override
public int importDwQuestion(List<DwQuestion> dwQuestionList) {
return 0;
}
} }

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.dw.mapper.DwIndexConfigMapper">
<resultMap type="DwIndexConfig" id="DwIndexConfigResult">
<result property="id" column="id" />
<result property="indexName" column="index_name" />
<result property="questionId" column="question_id" />
<result property="infoId" column="info_id" />
<result property="indexType" column="index_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectDwIndexConfigVo">
select id, index_name, question_id, info_id, index_type, create_by, create_time, update_by, update_time, remark from dw_index_config
</sql>
<select id="selectDwIndexConfigList" parameterType="DwIndexConfig" resultMap="DwIndexConfigResult">
<include refid="selectDwIndexConfigVo"/>
<where>
<if test="indexName != null and indexName != ''"> and index_name like concat('%', #{indexName}, '%')</if>
<if test="questionId != null and questionId != ''"> and question_id = #{questionId}</if>
<if test="infoId != null "> and info_id = #{infoId}</if>
<if test="indexType != null "> and index_type = #{indexType}</if>
</where>
</select>
<select id="selectDwIndexConfigById" parameterType="Long" resultMap="DwIndexConfigResult">
<include refid="selectDwIndexConfigVo"/>
where id = #{id}
</select>
<insert id="insertDwIndexConfig" parameterType="DwIndexConfig" useGeneratedKeys="true" keyProperty="id">
insert into dw_index_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="indexName != null">index_name,</if>
<if test="questionId != null">question_id,</if>
<if test="infoId != null">info_id,</if>
<if test="indexType != null">index_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="indexName != null">#{indexName},</if>
<if test="questionId != null">#{questionId},</if>
<if test="infoId != null">#{infoId},</if>
<if test="indexType != null">#{indexType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateDwIndexConfig" parameterType="DwIndexConfig">
update dw_index_config
<trim prefix="SET" suffixOverrides=",">
<if test="indexName != null">index_name = #{indexName},</if>
<if test="questionId != null">question_id = #{questionId},</if>
<if test="infoId != null">info_id = #{infoId},</if>
<if test="indexType != null">index_type = #{indexType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDwIndexConfigById" parameterType="Long">
delete from dw_index_config where id = #{id}
</delete>
<delete id="deleteDwIndexConfigByIds" parameterType="String">
delete from dw_index_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>