Commit c7593d2e authored by xulihui's avatar xulihui

新增舆情管理,修改投诉处置汇总分析

parent ea0f20e1
package com.zehong.web.controller.supervision;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TPublicSentiment;
import com.zehong.system.domain.vo.ComplainDealSummaryAnalysisTableVo;
import com.zehong.system.service.ITPublicSentimentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 舆情处置Controller
*
* @author zehong
* @date 2025-08-15
*/
@RestController
@RequestMapping("/system/sentiment")
public class TPublicSentimentController extends BaseController
{
@Autowired
private ITPublicSentimentService tPublicSentimentService;
/**
* 查询舆情处置列表
*/
@GetMapping("/list")
public TableDataInfo list(TPublicSentiment tPublicSentiment)
{
startPage();
List<TPublicSentiment> list = tPublicSentimentService.selectTPublicSentimentList(tPublicSentiment);
return getDataTable(list);
}
/**
* 导出舆情处置列表
*/
@Log(title = "舆情处置", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TPublicSentiment tPublicSentiment)
{
List<TPublicSentiment> list = tPublicSentimentService.selectTPublicSentimentList(tPublicSentiment);
ExcelUtil<TPublicSentiment> util = new ExcelUtil<TPublicSentiment>(TPublicSentiment.class);
return util.exportExcel(list, "舆情处置数据");
}
/**
* 获取舆情处置详细信息
*/
@GetMapping(value = "/{sentimentId}")
public AjaxResult getInfo(@PathVariable("sentimentId") Long sentimentId)
{
return AjaxResult.success(tPublicSentimentService.selectTPublicSentimentById(sentimentId));
}
/**
* 新增舆情处置
*/
@Log(title = "舆情处置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TPublicSentiment tPublicSentiment)
{
return toAjax(tPublicSentimentService.insertTPublicSentiment(tPublicSentiment));
}
/**
* 修改舆情处置
*/
@Log(title = "舆情处置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TPublicSentiment tPublicSentiment)
{
return toAjax(tPublicSentimentService.updateTPublicSentiment(tPublicSentiment));
}
/**
* 删除舆情处置
*/
@Log(title = "舆情处置", businessType = BusinessType.DELETE)
@DeleteMapping("/{sentimentIds}")
public AjaxResult remove(@PathVariable Long[] sentimentIds)
{
return toAjax(tPublicSentimentService.deleteTPublicSentimentByIds(sentimentIds));
}
@GetMapping("/sentimentSummaryAnalysisMethodTableViews")
public AjaxResult sentimentSummaryAnalysisMethodTableViews(ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo) {
return AjaxResult.success(tPublicSentimentService.sentimentSummaryAnalysisMethodTableViews(complainDealSummaryAnalysisTableVo));
}
/**
* 导出投诉处置列表
*/
@Log(title = "投诉处置", businessType = BusinessType.EXPORT)
@PostMapping("/sentimentSummaryAnalysisExport")
public void sentimentSummaryAnalysisExport(HttpServletResponse httpServletResponse,
@RequestBody ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo) throws Exception
{
tPublicSentimentService.sentimentSummaryAnalysisExport(httpServletResponse,complainDealSummaryAnalysisTableVo);
}
}
package com.zehong.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 舆情处置对象 t_public_sentiment
*
* @author zehong
* @date 2025-08-15
*/
public class TPublicSentiment extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 舆情处置id */
private Long sentimentId;
/** 省平台id */
private String shengId;
/** 舆情标题 */
@Excel(name = "舆情标题")
private String title;
/** 舆情内容 */
@Excel(name = "舆情内容")
private String content;
/** 舆情文件 */
@Excel(name = "舆情文件")
private String sentimentFile;
/** 指派企业 */
private String enterpriseId;
@Excel(name = "指派企业")
private String enterpriseName;
/** 状态 0未反馈 1已反馈 */
@Excel(name = "状态 0未反馈 1已反馈")
private String status;
/** 处置标题 */
@Excel(name = "处置标题")
private String disposeTitle;
/** 处置内容 */
@Excel(name = "处置内容")
private String disposeContent;
/** 处置文件 */
@Excel(name = "处置文件")
private String disposeFile;
/** 处置人 */
@Excel(name = "处置人")
private String person;
/** 联系方式 */
@Excel(name = "联系方式")
private String phone;
/** $column.columnComment */
private Long isDel;
private String region;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public void setSentimentId(Long sentimentId)
{
this.sentimentId = sentimentId;
}
public Long getSentimentId()
{
return sentimentId;
}
public void setShengId(String shengId)
{
this.shengId = shengId;
}
public String getShengId()
{
return shengId;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setSentimentFile(String sentimentFile)
{
this.sentimentFile = sentimentFile;
}
public String getSentimentFile()
{
return sentimentFile;
}
public void setEnterpriseId(String enterpriseId)
{
this.enterpriseId = enterpriseId;
}
public String getEnterpriseId()
{
return enterpriseId;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDisposeTitle(String disposeTitle)
{
this.disposeTitle = disposeTitle;
}
public String getDisposeTitle()
{
return disposeTitle;
}
public void setDisposeContent(String disposeContent)
{
this.disposeContent = disposeContent;
}
public String getDisposeContent()
{
return disposeContent;
}
public void setDisposeFile(String disposeFile)
{
this.disposeFile = disposeFile;
}
public String getDisposeFile()
{
return disposeFile;
}
public void setPerson(String person)
{
this.person = person;
}
public String getPerson()
{
return person;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("sentimentId", getSentimentId())
.append("shengId", getShengId())
.append("title", getTitle())
.append("content", getContent())
.append("sentimentFile", getSentimentFile())
.append("enterpriseId", getEnterpriseId())
.append("status", getStatus())
.append("disposeTitle", getDisposeTitle())
.append("disposeContent", getDisposeContent())
.append("disposeFile", getDisposeFile())
.append("person", getPerson())
.append("phone", getPhone())
.append("createTime", getCreateTime())
.append("isDel", getIsDel())
.toString();
}
}
...@@ -28,4 +28,6 @@ public class TComplainDealDTO { ...@@ -28,4 +28,6 @@ public class TComplainDealDTO {
/*投诉类别 */ /*投诉类别 */
private String complainType; private String complainType;
private String township;
} }
...@@ -35,6 +35,17 @@ public class ComplainDealSummaryAnalysisTableVo { ...@@ -35,6 +35,17 @@ public class ComplainDealSummaryAnalysisTableVo {
*/ */
private String dynamicTitle; private String dynamicTitle;
//所属区域
private String township;
public String getTownship() {
return township;
}
public void setTownship(String township) {
this.township = township;
}
public String getDynamicTitle() { public String getDynamicTitle() {
return dynamicTitle; return dynamicTitle;
} }
......
...@@ -60,7 +60,8 @@ public interface TComplainDealMapper ...@@ -60,7 +60,8 @@ public interface TComplainDealMapper
*/ */
public List<TComplainDealDTO> queryAllByNotDeleteAndCreateTime(@Param("startOfMonth") Date startOfMonth, public List<TComplainDealDTO> queryAllByNotDeleteAndCreateTime(@Param("startOfMonth") Date startOfMonth,
@Param("endOfMonth") Date endOfMonth, @Param("endOfMonth") Date endOfMonth,
@Param("complaintCategory") String complaintCategory); @Param("complaintCategory") String complaintCategory,
@Param("township") String township);
/** /**
* 修改投诉处置 * 修改投诉处置
* *
......
package com.zehong.system.mapper;
import com.zehong.system.domain.TPublicSentiment;
import com.zehong.system.domain.dto.TComplainDealDTO;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 舆情处置Mapper接口
*
* @author zehong
* @date 2025-08-15
*/
public interface TPublicSentimentMapper
{
/**
* 查询舆情处置
*
* @param sentimentId 舆情处置ID
* @return 舆情处置
*/
public TPublicSentiment selectTPublicSentimentById(Long sentimentId);
/**
* 查询舆情处置列表
*
* @param tPublicSentiment 舆情处置
* @return 舆情处置集合
*/
public List<TPublicSentiment> selectTPublicSentimentList(TPublicSentiment tPublicSentiment);
/**
* 新增舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
public int insertTPublicSentiment(TPublicSentiment tPublicSentiment);
/**
* 修改舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
public int updateTPublicSentiment(TPublicSentiment tPublicSentiment);
/**
* 删除舆情处置
*
* @param sentimentId 舆情处置ID
* @return 结果
*/
public int deleteTPublicSentimentById(Long sentimentId);
/**
* 批量删除舆情处置
*
* @param sentimentIds 需要删除的数据ID
* @return 结果
*/
public int deleteTPublicSentimentByIds(Long[] sentimentIds);
public List<TComplainDealDTO> queryAllByNotDeleteAndCreateTime(@Param("startOfMonth") Date startOfMonth,
@Param("endOfMonth") Date endOfMonth,
@Param("township") String township);
}
package com.zehong.system.service;
import com.zehong.system.domain.TPublicSentiment;
import com.zehong.system.domain.vo.ComplainDealSummaryAnalysisTableVo;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 舆情处置Service接口
*
* @author zehong
* @date 2025-08-15
*/
public interface ITPublicSentimentService
{
/**
* 查询舆情处置
*
* @param sentimentId 舆情处置ID
* @return 舆情处置
*/
public TPublicSentiment selectTPublicSentimentById(Long sentimentId);
/**
* 查询舆情处置列表
*
* @param tPublicSentiment 舆情处置
* @return 舆情处置集合
*/
public List<TPublicSentiment> selectTPublicSentimentList(TPublicSentiment tPublicSentiment);
/**
* 新增舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
public int insertTPublicSentiment(TPublicSentiment tPublicSentiment);
/**
* 修改舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
public int updateTPublicSentiment(TPublicSentiment tPublicSentiment);
/**
* 批量删除舆情处置
*
* @param sentimentIds 需要删除的舆情处置ID
* @return 结果
*/
public int deleteTPublicSentimentByIds(Long[] sentimentIds);
/**
* 删除舆情处置信息
*
* @param sentimentId 舆情处置ID
* @return 结果
*/
public int deleteTPublicSentimentById(Long sentimentId);
public List<ComplainDealSummaryAnalysisTableVo> sentimentSummaryAnalysisMethodTableViews(ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo);
public void sentimentSummaryAnalysisExport(HttpServletResponse httpServletResponse, ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo) throws IOException;
}
...@@ -186,9 +186,10 @@ public class TComplainDealServiceImpl implements ITComplainDealService ...@@ -186,9 +186,10 @@ public class TComplainDealServiceImpl implements ITComplainDealService
Date startOfMonth = DateUtils.parseDate(date1 + "-01-01 00:00:00"); Date startOfMonth = DateUtils.parseDate(date1 + "-01-01 00:00:00");
Date endOfMonth = DateUtils.parseDate(date1 + "-12-31 23:59:59");; Date endOfMonth = DateUtils.parseDate(date1 + "-12-31 23:59:59");;
String complaintCategory = complainDealSummaryAnalysisTableVo.getComplainType(); String complaintCategory = complainDealSummaryAnalysisTableVo.getComplainType();
String township = complainDealSummaryAnalysisTableVo.getTownship();
//所有所有发生的投诉 //所有所有发生的投诉
List<TComplainDealDTO> tComplainDeals = tComplainDealMapper.queryAllByNotDeleteAndCreateTime(startOfMonth,endOfMonth,complaintCategory); List<TComplainDealDTO> tComplainDeals = tComplainDealMapper.queryAllByNotDeleteAndCreateTime(startOfMonth,endOfMonth,complaintCategory,township);
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>(); List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>();
...@@ -654,6 +655,7 @@ public class TComplainDealServiceImpl implements ITComplainDealService ...@@ -654,6 +655,7 @@ public class TComplainDealServiceImpl implements ITComplainDealService
String date = map.get("date"); String date = map.get("date");
String complaintCategory = map.get("complaintCategory"); String complaintCategory = map.get("complaintCategory");
String township = map.get("township");
// 管理制度 // 管理制度
List<TComplainDealManSysSet> tComplainDealManSysSets = tComplainDealManSysSetMapper.selectTComplainDealManSysSetList(new TComplainDealManSysSet()); List<TComplainDealManSysSet> tComplainDealManSysSets = tComplainDealManSysSetMapper.selectTComplainDealManSysSetList(new TComplainDealManSysSet());
...@@ -701,7 +703,7 @@ public class TComplainDealServiceImpl implements ITComplainDealService ...@@ -701,7 +703,7 @@ public class TComplainDealServiceImpl implements ITComplainDealService
Date endOfMonth = DateUtils.parseDate(date + "-12-31 23:59:59"); Date endOfMonth = DateUtils.parseDate(date + "-12-31 23:59:59");
//所有所有发生的投诉 //所有所有发生的投诉
List<TComplainDealDTO> tComplainDeals = tComplainDealMapper.queryAllByNotDeleteAndCreateTime(startOfMonth,endOfMonth,complaintCategory); List<TComplainDealDTO> tComplainDeals = tComplainDealMapper.queryAllByNotDeleteAndCreateTime(startOfMonth,endOfMonth,complaintCategory,township);
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>(); List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>();
......
package com.zehong.system.service.impl;
import com.alibaba.excel.EasyExcel;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.config.easyexcel.CustomCellWriteHeightConfig;
import com.zehong.system.config.easyexcel.CustomCellWriteWidthConfig;
import com.zehong.system.domain.TComplainDealManSysSet;
import com.zehong.system.domain.TPublicSentiment;
import com.zehong.system.domain.dto.TComplainDealDTO;
import com.zehong.system.domain.vo.ComplainDealSummaryAnalysisTableVo;
import com.zehong.system.mapper.TPublicSentimentMapper;
import com.zehong.system.service.ITPublicSentimentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 舆情处置Service业务层处理
*
* @author zehong
* @date 2025-08-15
*/
@Service
public class TPublicSentimentServiceImpl implements ITPublicSentimentService
{
@Autowired
private TPublicSentimentMapper tPublicSentimentMapper;
/**
* 查询舆情处置
*
* @param sentimentId 舆情处置ID
* @return 舆情处置
*/
@Override
public TPublicSentiment selectTPublicSentimentById(Long sentimentId)
{
return tPublicSentimentMapper.selectTPublicSentimentById(sentimentId);
}
/**
* 查询舆情处置列表
*
* @param tPublicSentiment 舆情处置
* @return 舆情处置
*/
@Override
public List<TPublicSentiment> selectTPublicSentimentList(TPublicSentiment tPublicSentiment)
{
return tPublicSentimentMapper.selectTPublicSentimentList(tPublicSentiment);
}
/**
* 新增舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
@Override
public int insertTPublicSentiment(TPublicSentiment tPublicSentiment)
{
tPublicSentiment.setCreateTime(DateUtils.getNowDate());
return tPublicSentimentMapper.insertTPublicSentiment(tPublicSentiment);
}
/**
* 修改舆情处置
*
* @param tPublicSentiment 舆情处置
* @return 结果
*/
@Override
public int updateTPublicSentiment(TPublicSentiment tPublicSentiment)
{
tPublicSentiment.setUpdateTime(new Date());
return tPublicSentimentMapper.updateTPublicSentiment(tPublicSentiment);
}
/**
* 批量删除舆情处置
*
* @param sentimentIds 需要删除的舆情处置ID
* @return 结果
*/
@Override
public int deleteTPublicSentimentByIds(Long[] sentimentIds)
{
return tPublicSentimentMapper.deleteTPublicSentimentByIds(sentimentIds);
}
/**
* 删除舆情处置信息
*
* @param sentimentId 舆情处置ID
* @return 结果
*/
@Override
public int deleteTPublicSentimentById(Long sentimentId)
{
return tPublicSentimentMapper.deleteTPublicSentimentById(sentimentId);
}
/**
* 舆情 统计分析 table 方式 方法
* @return list
*/
@Override
public List<ComplainDealSummaryAnalysisTableVo> sentimentSummaryAnalysisMethodTableViews(ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo) {
//规定办结时间
long duration = 7 * 24L * 60 * 60 * 1000;
//总发生量
BigDecimal totalAmount = BigDecimal.ZERO;
//总办结量
BigDecimal totalCompletionRate = BigDecimal.ZERO;
//总及时办结量
BigDecimal totalTimelyCompletionRate = BigDecimal.ZERO;
String date1 = complainDealSummaryAnalysisTableVo.getDate();
if(StringUtils.isEmpty(date1)) {
return initEmptyList();
}
//查询当前年的开始时间和结束时间
Date startOfMonth = DateUtils.parseDate(date1 + "-01-01 00:00:00");
Date endOfMonth = DateUtils.parseDate(date1 + "-12-31 23:59:59");;
String township = complainDealSummaryAnalysisTableVo.getTownship();
//所有所有发生的投诉
List<TComplainDealDTO> tComplainDeals = tPublicSentimentMapper.queryAllByNotDeleteAndCreateTime(startOfMonth,endOfMonth,township);
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>();
//先初始化一个空的,然后再循环往里面放值
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVosEmpty = initEmptyList();
//如果没数据,就返回一个都是null的数据的集合
if(tComplainDeals.size() == 0) {
return complainDealSummaryAnalysisTableVosEmpty;
}
Map<String, List<TComplainDealDTO>> collect = tComplainDeals.stream().collect(Collectors.groupingBy(TComplainDealDTO::getCreateTimeYear));
ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo1;
for (Map.Entry<String, List<TComplainDealDTO>> stringListEntry : collect.entrySet()) {
String key = stringListEntry.getKey();
List<TComplainDealDTO> value = stringListEntry.getValue();
BigDecimal count = new BigDecimal(value.size());
// 发生量统计
totalAmount = totalAmount.add(count);
complainDealSummaryAnalysisTableVo1 = new ComplainDealSummaryAnalysisTableVo();
complainDealSummaryAnalysisTableVo1.setDate(key + "月");
// 发生量
complainDealSummaryAnalysisTableVo1.setAmount(value.size() + "");
// 如果有发生量
if (value.size() > 0) {
//办结率
List<TComplainDealDTO> completionRateCollect = value.stream().filter(item -> "1".equals(item.getComplainStatus())).collect(Collectors.toList());
if (completionRateCollect.size() == 0) {
complainDealSummaryAnalysisTableVo1.setCompletionRate("0");
} else {
BigDecimal completedCount = new BigDecimal(completionRateCollect.size());
BigDecimal divide = completedCount.multiply(new BigDecimal(100)).divide(count, 2, BigDecimal.ROUND_HALF_UP);
//统计 发生率
totalCompletionRate = totalCompletionRate.add(completedCount);
complainDealSummaryAnalysisTableVo1.setCompletionRate(divide.toString());
}
// 及时办结率
if( completionRateCollect.size() == 0) {
complainDealSummaryAnalysisTableVo1.setTimelyCompletionRate("0");
} else {
int timelyCompletionRateInt = 0;
for (TComplainDealDTO tComplainDealDTO : completionRateCollect) {
String complainType = tComplainDealDTO.getComplainType();
Date createTime = tComplainDealDTO.getCreateTime();
Date updateTime = tComplainDealDTO.getUpdateTime();
if (complainType != null && !"".equals(complainType)
&& createTime != null && updateTime != null) {
long diff = updateTime.getTime() - createTime.getTime();
if (diff - duration < 0) {
timelyCompletionRateInt ++;
}
}
}
if (timelyCompletionRateInt > 0) {
BigDecimal CompletionRateIntDecimal = new BigDecimal(timelyCompletionRateInt);
BigDecimal divide = CompletionRateIntDecimal.multiply(new BigDecimal(100)).divide(count, 2, BigDecimal.ROUND_HALF_UP);
//统计 及时办结率
totalTimelyCompletionRate = totalTimelyCompletionRate.add(CompletionRateIntDecimal);
complainDealSummaryAnalysisTableVo1.setTimelyCompletionRate(divide.toString());
} else {
complainDealSummaryAnalysisTableVo1.setTimelyCompletionRate("0");
}
}
// 如果没有发生量则别的都是0
} else {
complainDealSummaryAnalysisTableVo1.setCompletionRate("0");
complainDealSummaryAnalysisTableVo1.setTimelyCompletionRate("0");
}
complainDealSummaryAnalysisTableVos.add(complainDealSummaryAnalysisTableVo1);
}
// 如果有数据,则往 empty集合里面放值
if (complainDealSummaryAnalysisTableVos.size() > 0) {
for (int i = 0; i < complainDealSummaryAnalysisTableVosEmpty.size(); i++) {
ComplainDealSummaryAnalysisTableVo dealSummaryAnalysisTableVo = complainDealSummaryAnalysisTableVosEmpty.get(i);
for (ComplainDealSummaryAnalysisTableVo summaryAnalysisTableVo : complainDealSummaryAnalysisTableVos) {
if (dealSummaryAnalysisTableVo.getDate().equals(summaryAnalysisTableVo.getDate())) {
dealSummaryAnalysisTableVo.setAmount(summaryAnalysisTableVo.getAmount());
dealSummaryAnalysisTableVo.setCompletionRate(summaryAnalysisTableVo.getCompletionRate());
dealSummaryAnalysisTableVo.setTimelyCompletionRate(summaryAnalysisTableVo.getTimelyCompletionRate());
}
}
//说明是 统计
if (i == 12 ) {
dealSummaryAnalysisTableVo.setAmount(totalAmount.toString());
// 统计 办结率
BigDecimal divide = totalCompletionRate.multiply(new BigDecimal(100)).divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP);
dealSummaryAnalysisTableVo.setCompletionRate(divide.toString());
// 统计 及时办结率
BigDecimal divide1 = totalTimelyCompletionRate.multiply(new BigDecimal(100)).divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP);
dealSummaryAnalysisTableVo.setTimelyCompletionRate(divide1.toString());
}
}
}
return complainDealSummaryAnalysisTableVosEmpty;
}
private List<ComplainDealSummaryAnalysisTableVo> initEmptyList() {
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = new ArrayList<>(13);
ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo;
for (int i = 0; i < 13; i++) {
complainDealSummaryAnalysisTableVo = new ComplainDealSummaryAnalysisTableVo();
if (i <12) {
complainDealSummaryAnalysisTableVo.setDate((i + 1) + "月");
} else {
complainDealSummaryAnalysisTableVo.setDate("统计");
}
complainDealSummaryAnalysisTableVo.setAmount(null);
complainDealSummaryAnalysisTableVo.setCompletionRate(null);
complainDealSummaryAnalysisTableVo.setTimelyCompletionRate(null);
complainDealSummaryAnalysisTableVos.add(complainDealSummaryAnalysisTableVo);
}
return complainDealSummaryAnalysisTableVos;
}
/**
* 统计分析导出
* @param complainDealSummaryAnalysisTableVo c
*/
@Override
public void sentimentSummaryAnalysisExport(HttpServletResponse response, ComplainDealSummaryAnalysisTableVo complainDealSummaryAnalysisTableVo) throws IOException {
List<ComplainDealSummaryAnalysisTableVo> complainDealSummaryAnalysisTableVos = sentimentSummaryAnalysisMethodTableViews(complainDealSummaryAnalysisTableVo);
// 设置动态头
String dynamicTitle = complainDealSummaryAnalysisTableVo.getDynamicTitle();
List<List<String>> headList = new ArrayList<>();
List<String> head0 = new ArrayList<>();
head0.add(dynamicTitle);
head0.add("日期");
List<String> head1 = new ArrayList<>();
head1.add(dynamicTitle);
head1.add("发生量");
List<String> head2 = new ArrayList<>();
head2.add(dynamicTitle);
head2.add("办结率");
List<String> head3 = new ArrayList<>();
head3.add(dynamicTitle);
head3.add("办结及时率");
headList.add(head0);
headList.add(head1);
headList.add(head2);
headList.add(head3);
List<List<Object>> dataList = complainDealSummaryAnalysisTableVos.stream().map(vo -> {
List<Object> objectList = new ArrayList<>();
objectList.add(vo.getDate());
objectList.add(vo.getAmount());
objectList.add(vo.getCompletionRate());
objectList.add(vo.getTimelyCompletionRate());
return objectList;
}).collect(Collectors.toList());
// 设置响应头
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
// 设置防止中文名乱码
String filename = URLEncoder.encode("投诉汇总分析", "utf-8");
response.setHeader("content-disposition", "attachment;filename=" + filename + ".xlsx");
// 先仅仅写入头,再以不写入头的方式写入数据
EasyExcel.write(response.getOutputStream())
.registerWriteHandler(new CustomCellWriteHeightConfig())
.registerWriteHandler(new CustomCellWriteWidthConfig()).head(headList).sheet("投诉汇总分析列表").doWrite(dataList);
}
}
...@@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where is_del = '0' where is_del = '0'
</select> </select>
<select id="queryAllByNotDeleteAndCreateTime" resultType="com.zehong.system.domain.dto.TComplainDealDTO"> <select id="queryAllByNotDeleteAndCreateTime" resultType="com.zehong.system.domain.dto.TComplainDealDTO">
select complain_deal_id as complainDealId,complain_status as complainStatus ,create_time as createTime, update_time as updateTime,MONTH(create_time) as createTimeYear ,complain_type as complainType from t_complain_deal select complain_deal_id as complainDealId,complain_status as complainStatus ,create_time as createTime, update_time as updateTime,MONTH(create_time) as createTimeYear ,complain_type as complainType,township from t_complain_deal
where is_del = '0' where is_del = '0'
<if test="startOfMonth != null and endOfMonth != null"> <if test="startOfMonth != null and endOfMonth != null">
and create_time <![CDATA[>=]]> #{startOfMonth} and create_time <![CDATA[<=]]> #{endOfMonth} and create_time <![CDATA[>=]]> #{startOfMonth} and create_time <![CDATA[<=]]> #{endOfMonth}
...@@ -97,6 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -97,6 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="complaintCategory != null and complaintCategory != '' and complaintCategory != 0 "> <if test="complaintCategory != null and complaintCategory != '' and complaintCategory != 0 ">
and complain_type = #{complaintCategory} and complain_type = #{complaintCategory}
</if> </if>
<if test="township != null and township != '' and township != 0 ">
and township = #{township}
</if>
order by create_time asc order by create_time asc
</select> </select>
......
<?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.zehong.system.mapper.TPublicSentimentMapper">
<resultMap type="com.zehong.system.domain.TPublicSentiment" id="TPublicSentimentResult">
<result property="sentimentId" column="sentiment_id" />
<result property="shengId" column="sheng_id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="sentimentFile" column="sentiment_file" />
<result property="enterpriseId" column="enterprise_id" />
<result property="status" column="status" />
<result property="disposeTitle" column="dispose_title" />
<result property="disposeContent" column="dispose_content" />
<result property="disposeFile" column="dispose_file" />
<result property="person" column="person" />
<result property="phone" column="phone" />
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
<result property="region" column="region" />
<result property="startTime" column="start_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTPublicSentimentVo">
select sentiment_id, sheng_id, title, content, sentiment_file, enterprise_id, status,
(SELECT enterprise_name FROM t_enterprise_info e WHERE e.enterprise_id = f.enterprise_id) as enterpriseName,
dispose_title, dispose_content, dispose_file, person, phone, create_time, is_del, region, start_time,update_time from t_public_sentiment f
</sql>
<select id="selectTPublicSentimentList" parameterType="TPublicSentiment" resultMap="TPublicSentimentResult">
<include refid="selectTPublicSentimentVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="enterpriseId != null and enterpriseId != ''"> and enterprise_id = #{enterpriseId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="region != null and region != ''"> and region = #{region}</if>
<if test="startTime != null and startTime != ''"> AND date_format(start_time,'%y') &gt;= date_format(#{startTime},'%y')</if>
</where>
</select>
<select id="selectTPublicSentimentById" parameterType="Long" resultMap="TPublicSentimentResult">
<include refid="selectTPublicSentimentVo"/>
where sentiment_id = #{sentimentId}
</select>
<insert id="insertTPublicSentiment" parameterType="TPublicSentiment" useGeneratedKeys="true" keyProperty="sentimentId">
insert into t_public_sentiment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shengId != null">sheng_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if>
<if test="sentimentFile != null">sentiment_file,</if>
<if test="enterpriseId != null">enterprise_id,</if>
<if test="status != null">status,</if>
<if test="disposeTitle != null and disposeTitle != ''">dispose_title,</if>
<if test="disposeContent != null and disposeContent != ''">dispose_content,</if>
<if test="disposeFile != null">dispose_file,</if>
<if test="person != null">person,</if>
<if test="phone != null">phone,</if>
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="region != null">region,</if>
<if test="startTime != null">start_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shengId != null">#{shengId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="sentimentFile != null">#{sentimentFile},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="status != null">#{status},</if>
<if test="disposeTitle != null and disposeTitle != ''">#{disposeTitle},</if>
<if test="disposeContent != null and disposeContent != ''">#{disposeContent},</if>
<if test="disposeFile != null">#{disposeFile},</if>
<if test="person != null">#{person},</if>
<if test="phone != null">#{phone},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="region != null">#{region},</if>
<if test="startTime != null">#{startTime},</if>
</trim>
</insert>
<update id="updateTPublicSentiment" parameterType="TPublicSentiment">
update t_public_sentiment
<trim prefix="SET" suffixOverrides=",">
<if test="shengId != null">sheng_id = #{shengId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="sentimentFile != null">sentiment_file = #{sentimentFile},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="status != null">status = #{status},</if>
<if test="disposeTitle != null and disposeTitle != ''">dispose_title = #{disposeTitle},</if>
<if test="disposeContent != null and disposeContent != ''">dispose_content = #{disposeContent},</if>
<if test="disposeFile != null">dispose_file = #{disposeFile},</if>
<if test="person != null">person = #{person},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="region != null">region = #{region},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where sentiment_id = #{sentimentId}
</update>
<delete id="deleteTPublicSentimentById" parameterType="Long">
delete from t_public_sentiment where sentiment_id = #{sentimentId}
</delete>
<delete id="deleteTPublicSentimentByIds" parameterType="String">
delete from t_public_sentiment where sentiment_id in
<foreach item="sentimentId" collection="array" open="(" separator="," close=")">
#{sentimentId}
</foreach>
</delete>
<select id="queryAllByNotDeleteAndCreateTime" resultType="com.zehong.system.domain.dto.TComplainDealDTO">
select sentiment_id as complainDealId,status as complainStatus ,start_time as createTime, update_time as updateTime,MONTH(start_time) as createTimeYear ,region as township from t_public_sentiment
where is_del = '0'
<if test="startOfMonth != null and endOfMonth != null">
and start_time <![CDATA[>=]]> #{startOfMonth} and start_time <![CDATA[<=]]> #{endOfMonth}
</if>
<if test="township != null and township != '' and township != 0 ">
and region = #{township}
</if>
order by create_time asc
</select>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询舆情处置列表
export function listSentiment(query) {
return request({
url: '/system/sentiment/list',
method: 'get',
params: query
})
}
// 查询舆情处置详细
export function getSentiment(sentimentId) {
return request({
url: '/system/sentiment/' + sentimentId,
method: 'get'
})
}
// 新增舆情处置
export function addSentiment(data) {
return request({
url: '/system/sentiment',
method: 'post',
data: data
})
}
// 修改舆情处置
export function updateSentiment(data) {
return request({
url: '/system/sentiment',
method: 'put',
data: data
})
}
// 删除舆情处置
export function delSentiment(sentimentId) {
return request({
url: '/system/sentiment/' + sentimentId,
method: 'delete'
})
}
// 导出舆情处置
export function exportSentiment(query) {
return request({
url: '/system/sentiment/export',
method: 'get',
params: query
})
}
export function sentimentSummaryAnalysisMethodTableViews(query) {
return request({
url: '/system/sentiment/sentimentSummaryAnalysisMethodTableViews' ,
method: 'get',
params: query
})
}
export function sentimentSummaryAnalysisExport(data) {
return request({
url: '/system/sentiment/sentimentSummaryAnalysisExport' ,
method: 'post',
data: data,
responseType:'blob'
})
}
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="statisticalAnalysisForm" ref="statisticalAnalysisForm" :rules="rules" :inline="true"> <el-form :model="statisticalAnalysisForm" ref="statisticalAnalysisForm" :rules="rules" :inline="true">
<el-form-item label="年度" prop="date" > <el-form-item label="年度" prop="date" >
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="statisticalAnalysisForm.date" v-model="statisticalAnalysisForm.date"
type="year" type="year"
...@@ -9,25 +9,37 @@ ...@@ -9,25 +9,37 @@
placeholder="请选择年度"> placeholder="请选择年度">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<!-- 1-投诉举报,2-服务申请,3-咨询建议 --> <!-- 1-投诉举报,2-服务申请,3-咨询建议 -->
<el-form-item label="投诉类别" prop="complainType"> <el-form-item label="投诉类别" prop="complainType">
<el-select style="width: 100%" v-model="statisticalAnalysisForm.complainType"> <el-select style="width: 100%" v-model="statisticalAnalysisForm.complainType">
<el-option label="全部" value="0"/> <el-option label="全部" value="0"/>
<el-option label="投诉举报" value="1"/> <el-option label="投诉举报" value="1"/>
<el-option label="服务申请" value="2"/> <el-option label="服务申请" value="2"/>
<el-option label="咨询建议" value="3"/> <el-option label="咨询建议" value="3"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item label="所属区域" prop="township">
<el-select style="width: 100%" v-model="statisticalAnalysisForm.township" clearable size="small">
<el-option label="全部" value="0"/>
<el-option
v-for="dict in townshipOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" <el-button type="primary" icon="el-icon-search" size="mini"
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table style="width: 100%" border :data="summaryAnalysisDataList"> <el-table style="width: 100%" border :data="summaryAnalysisDataList">
<el-table-column align="center" :label="dynamicTitle"> <el-table-column align="center" :label="dynamicTitle">
<el-table-column fixed prop="date" label="日期"> <el-table-column fixed prop="date" label="日期">
...@@ -37,29 +49,32 @@ ...@@ -37,29 +49,32 @@
<el-table-column prop="completionRate" label="办结率"> <el-table-column prop="completionRate" label="办结率">
</el-table-column> </el-table-column>
<el-table-column prop="timelyCompletionRate" label="办结及时率"> <el-table-column prop="timelyCompletionRate" label="办结及时率">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</template> </template>
<script> <script>
import { complainDealSummaryAnalysisMethodTableViews,complainDealSummaryAnalysisExport } from "@/api/complainDeal/complainDeal"; import { complainDealSummaryAnalysisMethodTableViews,complainDealSummaryAnalysisExport } from "@/api/complainDeal/complainDeal";
import axios from "axios"; import axios from "axios";
export default { export default {
name: "complainSummaryAnalysis", name: "complainSummaryAnalysis",
data() { data() {
return{ return{
statisticalAnalysisForm:{ statisticalAnalysisForm:{
complainType:'', complainType:'',
date: '', date: '',
township:''
}, },
// 所属乡镇字典
townshipOptions: [],
summaryAnalysisDataList:[], summaryAnalysisDataList:[],
dynamicTitle:"", dynamicTitle:"",
// 导出遮罩层 // 导出遮罩层
exportLoading: false, exportLoading: false,
rules: { rules: {
...@@ -77,12 +92,16 @@ export default { ...@@ -77,12 +92,16 @@ export default {
} }
}, },
created(){ created(){
this.getDicts("t_township").then(response => {
this.townshipOptions = response.data;
});
this.statisticalAnalysisForm.date = this.currentYear; this.statisticalAnalysisForm.date = this.currentYear;
this.statisticalAnalysisForm.complainType = '0'; this.statisticalAnalysisForm.complainType = '0';
this.statisticalAnalysisForm.township = '0';
this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 投诉类别为全部统计分析数据" this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 投诉类别为全部统计分析数据"
complainDealSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => { complainDealSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => {
this.summaryAnalysisDataList = response.data; this.summaryAnalysisDataList = response.data;
}) })
}, },
methods:{ methods:{
handleQuery(){ handleQuery(){
...@@ -101,22 +120,22 @@ export default { ...@@ -101,22 +120,22 @@ export default {
this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 投诉类别为" + complainTypeValue + "统计分析数据"; this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 投诉类别为" + complainTypeValue + "统计分析数据";
complainDealSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => { complainDealSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => {
this.summaryAnalysisDataList = response.data; this.summaryAnalysisDataList = response.data;
}) })
} else { } else {
return false; return false;
} }
}); });
}, },
handleExport(){ handleExport(){
const queryParams = this.statisticalAnalysisForm; const queryParams = this.statisticalAnalysisForm;
queryParams.dynamicTitle = this.dynamicTitle; queryParams.dynamicTitle = this.dynamicTitle;
this.$confirm('是否确认导出?', "警告", { this.$confirm('是否确认导出?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(() => { }).then(() => {
complainDealSummaryAnalysisExport(queryParams).then((response) => { complainDealSummaryAnalysisExport(queryParams).then((response) => {
// console.log("res data = "+response.data); // console.log("res data = "+response.data);
// const str = response.headers["content-disposition"]; // const str = response.headers["content-disposition"];
// console.log("response.headers = "+str); // console.log("response.headers = "+str);
...@@ -133,11 +152,11 @@ export default { ...@@ -133,11 +152,11 @@ export default {
document.body.appendChild(aLink); // 将a标签挂载上去 document.body.appendChild(aLink); // 将a标签挂载上去
aLink.click(); // a标签click事件 aLink.click(); // a标签click事件
document.body.removeChild(aLink); // 移除a标签 document.body.removeChild(aLink); // 移除a标签
window.URL.revokeObjectURL(url); // 销毁下载链接 window.URL.revokeObjectURL(url); // 销毁下载链接
}).catch(error => { }).catch(error => {
console.error('导出失败', error); console.error('导出失败', error);
}); });
}).catch(() => {}); }).catch(() => {});
}, },
exportExcel(){ exportExcel(){
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="舆情标题" prop="title">
<el-input
v-model="queryParams.title"
placeholder="请输入舆情标题"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!--<el-form-item label="指派企业" prop="enterpriseId">-->
<!--<el-input-->
<!--v-model="queryParams.enterpriseId"-->
<!--placeholder="请输入指派企业"-->
<!--clearable-->
<!--size="small"-->
<!--@keyup.enter.native="handleQuery"-->
<!--/>-->
<!--</el-form-item>-->
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option label="未处置" value="0" />
<el-option label="已处置" value="1" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:sentiment:add']"
>新增</el-button>
</el-col>
<!--<el-col :span="1.5">-->
<!--<el-button-->
<!--type="success"-->
<!--plain-->
<!--icon="el-icon-edit"-->
<!--size="mini"-->
<!--:disabled="single"-->
<!--@click="handleUpdate"-->
<!--v-hasPermi="['system:sentiment:edit']"-->
<!--&gt;修改</el-button>-->
<!--</el-col>-->
<!--<el-col :span="1.5">-->
<!--<el-button-->
<!--type="danger"-->
<!--plain-->
<!--icon="el-icon-delete"-->
<!--size="mini"-->
<!--:disabled="multiple"-->
<!--@click="handleDelete"-->
<!--v-hasPermi="['system:sentiment:remove']"-->
<!--&gt;删除</el-button>-->
<!--</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:sentiment:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="sentimentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="舆情标题" align="center" prop="title" />
<el-table-column label="舆情内容" align="center" prop="content" />
<el-table-column label="舆情文件" align="center" prop="sentimentFile" >
<template slot-scope="scope">
<span
class="dbtn"
@click="checkFile(scope.row.sentimentFile)"
v-if="scope.row.sentimentFile != null && scope.row.sentimentFile!=''"
>
<i class="el-icon el-icon-view"></i>查看/下载
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="发生时间" align="center" prop="startTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="发生区域" align="center" prop="region" :formatter="regionFormat" />
<!-- <el-table-column label="指派企业" align="center" prop="enterpriseName" />-->
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<span v-if="scope.row.status == '0' ">未处置</span>
<span v-else>已处置</span>
</template>
</el-table-column>
<el-table-column label="处置标题" align="center" prop="disposeTitle" />
<el-table-column label="处置内容" align="center" prop="disposeContent" />
<el-table-column label="处置文件" align="center" prop="disposeFile" >
<template slot-scope="scope">
<span
class="dbtn"
@click="checkFile(scope.row.disposeFile)"
v-if="scope.row.disposeFile != null && scope.row.disposeFile!=''"
>
<i class="el-icon el-icon-view"></i>查看/下载
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="处置人" align="center" prop="person" />
<el-table-column label="联系方式" align="center" prop="phone" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:sentiment:edit']"
>处置</el-button>
<el-button
size="mini"
type="text"
@click="report(scope.row)"
>上报</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:sentiment:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改舆情处置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="舆情标题" prop="title">
<el-input v-model="form.title" placeholder="请输入舆情标题" />
</el-form-item>
<el-form-item label="舆情内容" prop="content">
<el-input v-model="form.content" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="舆情文件">
<!--<fileUpload v-model="form.sentimentFile"/>-->
<FileUpload
listType="picture"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList"
/>
</el-form-item>
<!-- <el-form-item label="指派企业" prop="enterpriseId">
<el-input v-model="form.enterpriseId" placeholder="请输入指派企业" />
</el-form-item>-->
<el-form-item label="发生区域" prop="region">
<el-select v-model="form.region" placeholder="请选择所属区域">
<el-option
v-for="dict in regionOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发生时间" prop="startTime">
<el-date-picker clearable size="small"
v-model="form.startTime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择发生时间">
</el-date-picker>
</el-form-item>
<!--<el-form-item label="状态 0未反馈 1已反馈">-->
<!--<el-radio-group v-model="form.status">-->
<!--<el-radio label="1">请选择字典生成</el-radio>-->
<!--</el-radio-group>-->
<!--</el-form-item>-->
<!--<el-form-item label="处置标题" prop="disposeTitle">-->
<!--<el-input v-model="form.disposeTitle" placeholder="请输入处置标题" />-->
<!--</el-form-item>-->
<!--<el-form-item label="处置内容">-->
<!--<el-input v-model="form.disposeContent" type="textarea" placeholder="请输处置内容"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="处置文件">-->
<!--<fileUpload v-model="form.disposeFile"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="处置人" prop="person">-->
<!--<el-input v-model="form.person" placeholder="请输入处置人" />-->
<!--</el-form-item>-->
<!--<el-form-item label="联系方式" prop="phone">-->
<!--<el-input v-model="form.phone" placeholder="请输入联系方式" />-->
<!--</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改舆情处置对话框 -->
<el-dialog :title="title" :visible.sync="open2" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="处置标题" prop="disposeTitle">
<el-input v-model="form.disposeTitle" placeholder="请输入处置标题" />
</el-form-item>
<el-form-item label="处置内容" prop="disposeContent">
<el-input v-model="form.disposeContent" type="textarea" placeholder="请输处置内容"/>
</el-form-item>
<el-form-item label="处置文件">
<FileUpload
listType="picture"
@resFun="getFileInfo2"
@remove="listRemove2"
:fileArr="fileList2"
/>
</el-form-item>
<el-form-item label="处置人" prop="person">
<el-input v-model="form.person" placeholder="请输入处置人" />
</el-form-item>
<el-form-item label="联系方式" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系方式" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSentiment, getSentiment, delSentiment, addSentiment, updateSentiment, exportSentiment } from "@/api/system/sentiment";
import FileUpload from '@/components/FileUpload';
import Editor from '@/components/Editor';
import {updateTask} from "@/api/inspectionWork/workTask";
let uploadfile = require("@/assets/uploadfile.png");
export default {
name: "Sentiment",
components: {
FileUpload,
Editor,
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 舆情处置表格数据
sentimentList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
open2:false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: null,
enterpriseId: null,
status: null,
},
fileList:[],
fileList2:[],
// 表单参数
form: {},
// 所属区域字典
regionOptions:[],
// 表单校验
rules: {
title: [
{ required: true, message: "舆情标题不能为空", trigger: "blur" }
],
content: [
{ required: true, message: "舆情内容不能为空", trigger: "blur" }
],
disposeTitle: [
{ required: true, message: "处置标题不能为空", trigger: "blur" }
],
disposeContent: [
{ required: true, message: "处置内容不能为空", trigger: "blur" }
],
},
rules2: {
disposeTitle: [
{ required: true, message: "处置标题不能为空", trigger: "blur" }
],
disposeContent: [
{ required: true, message: "处置内容不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getDicts("t_township").then(response => {
this.regionOptions = response.data;
});
this.getList();
},
methods: {
/** 查询舆情处置列表 */
getList() {
this.loading = true;
listSentiment(this.queryParams).then(response => {
this.sentimentList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 字典状态字典翻译
regionFormat(row, column) {
return this.selectDictLabel(this.regionOptions, row.region);
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
this.open2 = false;
this.fileList=[]
this.fileList2=[]
},
//上传
getFileInfo(res){
//this.form.dealPlan = res.fileName;
this.form.sentimentFile = res.url;
this.fileList.push({
name: res.fileName,
url: uploadfile,
});
},
listRemove(e) {
this.form.sentimentFile = "";
this.fileList = [];
},
//上传
getFileInfo2(res){
//this.form.dealPlan = res.fileName;
this.form.disposeFile = res.url;
this.fileList2.push({
name: res.fileName,
url: uploadfile,
});
},
listRemove2(e) {
this.form.disposeFile = "";
this.fileList2 = [];
},
checkFile(url) {
window.open(url,'_blank');
},
// 表单重置
reset() {
this.fileList=[],
this.fileList2=[],
this.form = {
sentimentId: null,
shengId: null,
title: null,
content: null,
sentimentFile: null,
enterpriseId: null,
status: "0",
disposeTitle: null,
disposeContent: null,
disposeFile: null,
person: null,
phone: null,
createTime: null,
isDel: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.sentimentId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加舆情处置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const sentimentId = row.sentimentId || this.ids
getSentiment(sentimentId).then(response => {
this.form = response.data;
if(this.form.sentimentFile!=null && this.form.sentimentFile!=''){
this.fileList.push({
name: "督导文件",
url: uploadfile,
});
}
if(this.form.disposeFile && this.form.disposeFile!=''){
this.fileList2.push({
name: "督导文件",
url: uploadfile,
});
}
this.open2 = true;
this.title = "舆情处置";
});
},
report(row){
this.$confirm('是否确认上报入户舆情标题为"' + row.title + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
//return updateTask({taskId:row.taskId,isReport:"1"});
}).then(() => {
this.getList();
this.msgSuccess("上报成功");
}).catch(() => {});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.sentimentId != null) {
updateSentiment(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.open2 = false;
this.getList();
});
} else {
addSentiment(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const sentimentIds = row.sentimentId || this.ids;
this.$confirm('是否确认删除舆情处置编号为"' + sentimentIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delSentiment(sentimentIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有舆情处置数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportSentiment(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
<style scoped lang="scss">
::v-deep .el-select{
width: 100%;
}
.dbtn {
display: inline-block;
line-height: normal;
padding-left: 2px;
padding-right: 2px;
cursor: pointer;
border-radius: 3px;
border-style: solid;
border-width: 0;
color: rgb(48, 180, 107);
}
</style>
<template>
<div class="app-container">
<el-form :model="statisticalAnalysisForm" ref="statisticalAnalysisForm" :rules="rules" :inline="true">
<el-form-item label="年度" prop="date" >
<el-date-picker clearable size="small"
v-model="statisticalAnalysisForm.date"
type="year"
value-format="yyyy"
placeholder="请选择年度">
</el-date-picker>
</el-form-item>
<el-form-item label="所属区域" prop="township">
<el-select style="width: 100%" v-model="statisticalAnalysisForm.township" clearable size="small">
<el-option label="全部" value="0"/>
<el-option
v-for="dict in townshipOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button type="primary" icon="el-icon-search" size="mini"
@click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<el-table style="width: 100%" border :data="summaryAnalysisDataList">
<el-table-column align="center" :label="dynamicTitle">
<el-table-column fixed prop="date" label="日期">
</el-table-column>
<el-table-column prop="amount" label="发生量">
</el-table-column>
<el-table-column prop="completionRate" label="办结率">
</el-table-column>
<el-table-column prop="timelyCompletionRate" label="办结及时率">
</el-table-column>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { sentimentSummaryAnalysisMethodTableViews,sentimentSummaryAnalysisExport } from "@/api/system/sentiment";
import axios from "axios";
export default {
name: "complainSummaryAnalysis",
data() {
return{
statisticalAnalysisForm:{
date: '',
township:''
},
// 所属乡镇字典
townshipOptions: [],
summaryAnalysisDataList:[],
dynamicTitle:"",
// 导出遮罩层
exportLoading: false,
rules: {
date: [
{ required: true, message: '请选择时间', trigger: 'change' }
]
}
}
},
mounted() {
},
computed: {
currentYear() {
return new Date().getFullYear().toString();
}
},
created(){
this.getDicts("t_township").then(response => {
this.townshipOptions = response.data;
});
this.statisticalAnalysisForm.date = this.currentYear;
this.statisticalAnalysisForm.township = '0';
this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 所属区域为全部统计分析数据"
sentimentSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => {
this.summaryAnalysisDataList = response.data;
})
},
methods:{
handleQuery(){
this.$refs.statisticalAnalysisForm.validate(valid => {
if (valid) {
let townshipValue = this.statisticalAnalysisForm.township;
if (townshipValue == '0') {
townshipValue = "全部"
} else{
townshipValue = this.selectDictLabel(this.townshipOptions, townshipValue)
}
this.dynamicTitle = this.statisticalAnalysisForm.date + "年度, 所属区域为" + townshipValue + "统计分析数据";
sentimentSummaryAnalysisMethodTableViews(this.statisticalAnalysisForm).then(response => {
this.summaryAnalysisDataList = response.data;
})
} else {
return false;
}
});
},
handleExport(){
const queryParams = this.statisticalAnalysisForm;
queryParams.dynamicTitle = this.dynamicTitle;
this.$confirm('是否确认导出?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
sentimentSummaryAnalysisExport(queryParams).then((response) => {
// console.log("res data = "+response.data);
// const str = response.headers["content-disposition"];
// console.log("response.headers = "+str);
let blob = new Blob([response], {type: 'application/vnd.ms-excel;charset=utf-8'}) // 文件类型
// console.log(response.headers['Content-disposition']); // 从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx") 设置的文件名;
//以=分割取数组[1]元素为文件名
// let filename = window.decodeURI(response.headers['Content-disposition'].split('=')[1])
let url = window.URL.createObjectURL(blob); // 创建下载链接
let aLink = document.createElement("a"); // 赋值给a标签的href属性
aLink.style.display = "none";
aLink.href = url;
aLink.setAttribute("download", "投诉汇总分析.xlsx");
document.body.appendChild(aLink); // 将a标签挂载上去
aLink.click(); // a标签click事件
document.body.removeChild(aLink); // 移除a标签
window.URL.revokeObjectURL(url); // 销毁下载链接
}).catch(error => {
console.error('导出失败', error);
});
}).catch(() => {});
},
exportExcel(){
}
}
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment