网络舆情大屏接口编写,字典接口编写

dongdingding
董丁丁 2 years ago
parent 5d600313b9
commit f623de0977

@ -2,10 +2,7 @@ package com.ruoyi.screen.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.screen.domain.request.ZongzhiSentimenClassificationRequest;
import com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentCountResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentTypeResponse;
import com.ruoyi.screen.domain.response.ZongzhiSourceResponse;
import com.ruoyi.screen.domain.response.*;
import com.ruoyi.screen.service.ZongzhiScreenOpinionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -65,4 +62,25 @@ public class ZongzhiScreenOpinionController {
return AjaxResult.success(zongzhiSentimenClassificationResponse);
}
/**
*
*/
@ApiOperation(value = "动态筛选", response = ZongzhiSentimenFilteringResponse.class)
@GetMapping("/sentimenfiltering")
private AjaxResult getSentimenFiltering() {
return null;
// return AjaxResult.success(zongzhiScreenOpinionService.getSentimenFiltering());
}
/**
*
*/
@ApiOperation(value = "词云", response = ZongzhiSentimenWordCloudResponse.class)
@GetMapping("/wordcloud")
private AjaxResult getWordCloud() {
return AjaxResult.success(zongzhiScreenOpinionService.getWordCloud());
}
}

@ -0,0 +1,37 @@
package com.ruoyi.screen.domain.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
@ApiModel("隐患处置最新隐患响应类")
public class ZongzhiSentimenFilteringResponse {
/**
*
*/
@ApiModelProperty(value = "隐患名称")
private String riskName;
/**
*1. 2. 3.
*/
@ApiModelProperty(value = "等级1.低级 2.中级 3.高级")
private Integer level;
/**
*
*/
@ApiModelProperty(value = "单位名称")
private String unitName;
/**
*1.2.3.
*/
@ApiModelProperty(value = "隐患来源1.众测2.态势感知平台3.网信办")
private Integer riskSource;
}

@ -0,0 +1,20 @@
package com.ruoyi.screen.domain.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
*/
@Data
@ApiModel("词云响应类")
public class ZongzhiSentimenWordCloudResponse {
/**
*1. 2..
*/
@ApiModelProperty(value = "词云类别1.开门红 2.城乡文明融合")
private Integer type;
}

@ -1,6 +1,7 @@
package com.ruoyi.screen.mapper;
import com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimenWordCloudResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentCountResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentTypeResponse;
@ -38,4 +39,12 @@ public interface ZongzhiScreenOpinionMapper {
*
*/
public List<ZongzhiSentimenClassificationResponse> getSentimenClassificationByeventType();
/**
*
*/
public List<ZongzhiSentimenWordCloudResponse> getWordCloud();
}

@ -1,9 +1,6 @@
package com.ruoyi.screen.service;
import com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentCountResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentTypeResponse;
import com.ruoyi.screen.domain.response.ZongzhiSourceResponse;
import com.ruoyi.screen.domain.response.*;
import java.util.List;
@ -25,16 +22,22 @@ public interface ZongzhiScreenOpinionService {
public List<ZongzhiSentimentCountResponse> getSentimenCount();
/**
*
*/
public List<ZongzhiSentimenClassificationResponse> getSentimenClassificationBymediaType();
/**
*
*/
public List<ZongzhiSentimenClassificationResponse> getSentimenClassificationByeventType();
/**
*
*/
public List<ZongzhiSentimenWordCloudResponse> getWordCloud();
}

@ -1,6 +1,7 @@
package com.ruoyi.screen.service.impl;
import com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimenWordCloudResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentCountResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimentTypeResponse;
import com.ruoyi.screen.mapper.ZongzhiScreenOpinionMapper;
@ -37,4 +38,9 @@ public class ZongzhiScreenOpinionServiceImpl implements ZongzhiScreenOpinionServ
public List<ZongzhiSentimenClassificationResponse> getSentimenClassificationByeventType() {
return zongzhiScreenOpinionMapper.getSentimenClassificationByeventType();
}
@Override
public List<ZongzhiSentimenWordCloudResponse> getWordCloud() {
return zongzhiScreenOpinionMapper.getWordCloud();
}
}

@ -2,18 +2,17 @@ package com.ruoyi.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.DictDataResponse;
import com.ruoyi.screen.domain.response.ZongzhiSentimenWordCloudResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@ -40,7 +39,6 @@ public class SysDictDataController extends BaseController
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
@ -49,8 +47,7 @@ public class SysDictDataController extends BaseController
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
@ -62,7 +59,7 @@ public class SysDictDataController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
@ -86,8 +83,7 @@ public class SysDictDataController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
@ -98,8 +94,7 @@ public class SysDictDataController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
@ -110,12 +105,26 @@ public class SysDictDataController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
/**
*
*
* @return
*/
@ApiOperation(value = "查询所有字典数据", response = DictDataResponse.class)
@GetMapping("/getlist")
public AjaxResult list(@RequestParam("list") List<String> list) {
List<DictDataResponse> resList = dictDataService.getDicttypeList(list);
Map<String, List<DictDataResponse>> prodMap = resList.stream().collect(Collectors.groupingBy(DictDataResponse::getDictType));
return AjaxResult.success(prodMap);
}
}

@ -125,6 +125,16 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.6</version>
<scope>compile</scope>
</dependency>
</dependencies>

@ -0,0 +1,24 @@
package com.ruoyi.common.core.domain.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("字典数据响应类")
public class DictDataResponse {
@ApiModelProperty(value = "字典类型")
private String dictType;
@ApiModelProperty(value = "字典值")
private String dictLabel;
@ApiModelProperty(value = "字典键值")
private Integer dictValue;
}

@ -123,7 +123,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/*/api-docs").anonymous()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/zongzhi/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/zongzhi/**","/system/dict/data/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()

@ -1,6 +1,8 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.DictDataResponse;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysDictData;
@ -92,4 +94,13 @@ public interface SysDictDataMapper
* @return
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
/**
*
*
* @return
*/
List<DictDataResponse> getDicttypeList(List<String> list);
}

@ -1,6 +1,8 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.DictDataResponse;
import com.ruoyi.common.core.domain.entity.SysDictData;
/**
@ -57,4 +59,12 @@ public interface ISysDictDataService
* @return
*/
public int updateDictData(SysDictData dictData);
/**
*
*
* @return
*/
public List<DictDataResponse> getDicttypeList(List<String> list);
}

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.domain.entity.DictDataResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.domain.entity.SysDictData;
@ -108,4 +110,11 @@ public class SysDictDataServiceImpl implements ISysDictDataService
}
return row;
}
@Override
public List<DictDataResponse> getDicttypeList(List<String> list) {
return dictDataMapper.getDicttypeList(list);
}
}

@ -1,7 +1,7 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.screen.mapper.ZongzhiScreenOpinionMapper">
@ -17,7 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sentiment_type !='2'
GROUP BY sentiment_type
</select>
<select id="getSentimenClassificationBymediaType" resultType="com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse">
<select id="getSentimenClassificationBymediaType"
resultType="com.ruoyi.screen.domain.response.ZongzhiSentimenClassificationResponse">
select media_type as type, ROUND(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (), 1) AS pt
from tc_network_sentiment
GROUP BY media_type
@ -28,4 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from tc_network_sentiment
GROUP BY event_type
</select>
<select id="getWordCloud" resultType="com.ruoyi.screen.domain.response.ZongzhiSentimenWordCloudResponse">
select yuci_type AS type
from tc_network_sentiment
GROUP BY yuci_type
</select>
</mapper>

@ -59,6 +59,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<select id="getDicttypeList" resultType="com.ruoyi.common.core.domain.entity.DictDataResponse">
select a.dict_type as dictType ,a.dict_label as dictLabel ,a.dict_value as dictValue from sys_dict_data a
where a.dict_type in
<foreach item="item"
collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode}
@ -121,4 +130,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
</mapper>
Loading…
Cancel
Save