Commit 9c908849 authored by 赵啸非's avatar 赵啸非

添加新闻来源

parent 9b48b0b5
Pipeline #2379 canceled with stages
This diff is collapsed.
......@@ -150,10 +150,11 @@ CREATE TABLE mortals_xhx_hotword(
`siteId` bigint(20) COMMENT '站点ID',
`hotwords` varchar(512) COMMENT '热门词汇',
`printDisplay` int(4) COMMENT '空白打印材料展示数量',
`newsSource` tinyint(4) COMMENT '新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`)
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='热门词汇业务';
-- ----------------------------
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)枚举类
*
* @author zxfei
*/
public enum NewsSourceEnum {
热点新闻(1, "热点新闻"),
本地要闻(2, "本地要闻"),
政策发布(3, "政策发布"),
通知公告(4, "通知公告");
private Integer value;
private String desc;
NewsSourceEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static NewsSourceEnum getByValue(Integer value) {
for (NewsSourceEnum newsSourceEnum : NewsSourceEnum.values()) {
if (newsSourceEnum.getValue() == value) {
return newsSourceEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (NewsSourceEnum item : NewsSourceEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
......@@ -191,6 +191,9 @@ public class HomeController extends BaseJsonBodyController {
.flatMap(item -> StrUtil.split(item, ",".charAt(0)).stream())
.collect(Collectors.toList());
model.put("hotWords", hotwordEntities);
MatterQuery matterQuery = new MatterQuery();
matterQuery.setSiteId(homeQueryPdu.getSiteId());
int matterCont = matterService.count(matterQuery, this.getContext());
......@@ -215,6 +218,7 @@ public class HomeController extends BaseJsonBodyController {
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(homeQueryPdu.getSiteId()));
model.put("blankCount", hotwordEntity==null?20:hotwordEntity.getPrintDisplay()); //空白样表数量
model.put("newsSource", hotwordEntity==null?1:hotwordEntity.getNewsSource()); //新闻来源
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
......
......@@ -2,13 +2,13 @@ package com.mortals.xhx.module.hotword.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import java.util.List;
/**
* 热门词汇业务Dao
* 热门词汇业务 DAO接口
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
public interface HotwordDao extends ICRUDDao<HotwordEntity,Long>{
......
package com.mortals.xhx.module.hotword.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.hotword.dao.HotwordDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import org.springframework.stereotype.Repository;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 热门词汇业务DaoImpl DAO接口
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
@Repository("hotwordDao")
public class HotwordDaoImpl extends BaseCRUDDaoMybatis<HotwordEntity,Long> implements HotwordDao {
......
package com.mortals.xhx.module.hotword.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.hotword.model.vo.HotwordVo;
/**
* 热门词汇业务实体对象
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
public class HotwordEntity extends HotwordVo {
......@@ -23,6 +28,10 @@ public class HotwordEntity extends HotwordVo {
* 空白打印材料展示数量
*/
private Integer printDisplay;
/**
* 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
*/
private Integer newsSource;
......@@ -69,6 +78,20 @@ public class HotwordEntity extends HotwordVo {
public void setPrintDisplay(Integer printDisplay){
this.printDisplay = printDisplay;
}
/**
* 获取 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return Integer
*/
public Integer getNewsSource(){
return newsSource;
}
/**
* 设置 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSource
*/
public void setNewsSource(Integer newsSource){
this.newsSource = newsSource;
}
......@@ -94,6 +117,7 @@ public class HotwordEntity extends HotwordVo {
sb.append(",siteId:").append(getSiteId());
sb.append(",hotwords:").append(getHotwords());
sb.append(",printDisplay:").append(getPrintDisplay());
sb.append(",newsSource:").append(getNewsSource());
return sb.toString();
}
......@@ -101,8 +125,10 @@ public class HotwordEntity extends HotwordVo {
this.siteId = null;
this.hotwords = "";
this.hotwords = null;
this.printDisplay = null;
this.printDisplay = 0;
this.newsSource = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.hotword.model;
import java.util.List;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
/**
* 热门词汇业务查询对象
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
public class HotwordQuery extends HotwordEntity {
/** 开始 主键,自增长 */
......@@ -48,6 +48,18 @@ public class HotwordQuery extends HotwordEntity {
/** 空白打印材料展示数量列表 */
private List <Integer> printDisplayList;
/** 开始 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告) */
private Integer newsSourceStart;
/** 结束 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告) */
private Integer newsSourceEnd;
/** 增加 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告) */
private Integer newsSourceIncrement;
/** 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)列表 */
private List <Integer> newsSourceList;
/** 开始 创建时间 */
private String createTimeStart;
......@@ -287,6 +299,70 @@ public class HotwordQuery extends HotwordEntity {
this.printDisplayList = printDisplayList;
}
/**
* 获取 开始 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return newsSourceStart
*/
public Integer getNewsSourceStart(){
return this.newsSourceStart;
}
/**
* 设置 开始 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceStart
*/
public void setNewsSourceStart(Integer newsSourceStart){
this.newsSourceStart = newsSourceStart;
}
/**
* 获取 结束 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return $newsSourceEnd
*/
public Integer getNewsSourceEnd(){
return this.newsSourceEnd;
}
/**
* 设置 结束 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceEnd
*/
public void setNewsSourceEnd(Integer newsSourceEnd){
this.newsSourceEnd = newsSourceEnd;
}
/**
* 获取 增加 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return newsSourceIncrement
*/
public Integer getNewsSourceIncrement(){
return this.newsSourceIncrement;
}
/**
* 设置 增加 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceIncrement
*/
public void setNewsSourceIncrement(Integer newsSourceIncrement){
this.newsSourceIncrement = newsSourceIncrement;
}
/**
* 获取 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @return newsSourceList
*/
public List<Integer> getNewsSourceList(){
return this.newsSourceList;
}
/**
* 设置 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceList
*/
public void setNewsSourceList(List<Integer> newsSourceList){
this.newsSourceList = newsSourceList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
......@@ -569,6 +645,51 @@ public class HotwordQuery extends HotwordEntity {
return this;
}
/**
* 设置 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSource
*/
public HotwordQuery newsSource(Integer newsSource){
setNewsSource(newsSource);
return this;
}
/**
* 设置 开始 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceStart
*/
public HotwordQuery newsSourceStart(Integer newsSourceStart){
this.newsSourceStart = newsSourceStart;
return this;
}
/**
* 设置 结束 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceEnd
*/
public HotwordQuery newsSourceEnd(Integer newsSourceEnd){
this.newsSourceEnd = newsSourceEnd;
return this;
}
/**
* 设置 增加 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceIncrement
*/
public HotwordQuery newsSourceIncrement(Integer newsSourceIncrement){
this.newsSourceIncrement = newsSourceIncrement;
return this;
}
/**
* 设置 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
* @param newsSourceList
*/
public HotwordQuery newsSourceList(List<Integer> newsSourceList){
this.newsSourceList = newsSourceList;
return this;
}
/**
* 设置 创建用户
......
package com.mortals.xhx.module.hotword.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 热门词汇业务视图对象
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
public class HotwordVo extends BaseEntityLong {
......
......@@ -7,7 +7,7 @@ import com.mortals.xhx.module.hotword.model.HotwordEntity;
* 热门词汇业务 service接口
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
public interface HotwordService extends ICRUDService<HotwordEntity,Long>{
......
package com.mortals.xhx.module.hotword.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.hotword.dao.HotwordDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService;
import org.springframework.stereotype.Service;
/**
* HotwordService
* 热门词汇业务 service实现
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-06
*/
@Service("hotwordService")
public class HotwordServiceImpl extends AbstractCRUDServiceImpl<HotwordDao, HotwordEntity, Long> implements HotwordService {
......
package com.mortals.xhx.module.hotword.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import com.mortals.xhx.module.hotword.service.HotwordService;
import com.mortals.xhx.common.code.NewsSourceEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 热门词汇业务
*
* @author zxfei
* @date 2022-11-17
*/
* 热门词汇业务
*
* @author zxfei
* @date 2022-12-06
*/
@RestController
@RequestMapping("hotword")
public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService,HotwordEntity,Long> {
public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService, HotwordEntity, Long> {
@Autowired
private ParamService paramService;
public HotwordController(){
super.setModuleDesc( "热门词汇业务");
public HotwordController() {
super.setModuleDesc("热门词汇业务");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap());
super.init(model, context);
}
@Override
protected void saveBefore(HotwordEntity entity, Map<String, Object> model, Context context) throws AppException {
HotwordEntity hotwordEntity = this.service.selectOne(new HotwordQuery().siteId(entity.getSiteId()));
if(!ObjectUtils.isEmpty(hotwordEntity)){
entity.setId(hotwordEntity.getId());
}
super.saveBefore(entity, model, context);
}
}
\ No newline at end of file
......@@ -75,7 +75,6 @@ import java.util.stream.Collectors;
@Service("matterDatumService")
public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumDao, MatterDatumEntity, Long> implements MatterDatumService {
@Value("${upload.path}")
private String filePath;
@Value("${upload.url:http://localhost:17215/fsm/file/commonupload?prePath=/file/uploadfile}")
......@@ -83,8 +82,6 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Autowired
private UploadService uploadService;
@Autowired
private ParamService paramService;
@Autowired
private MatterService matterService;
@Autowired
......@@ -496,8 +493,6 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
// for (int i = 0; i <strings.length ; i++) {
// System.out.println(strings[i]);
// }
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.hotword.dao.ibatis.HotwordDaoImpl">
<!-- 字段和属性映射 -->
......@@ -9,6 +9,7 @@
<result property="siteId" column="siteId" />
<result property="hotwords" column="hotwords" />
<result property="printDisplay" column="printDisplay" />
<result property="newsSource" column="newsSource" />
<result property="createTime" column="createTime" />
<result property="createUserId" column="createUserId" />
<result property="updateTime" column="updateTime" />
......@@ -31,6 +32,9 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('printDisplay') or colPickMode == 1 and data.containsKey('printDisplay')))">
a.printDisplay,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('newsSource') or colPickMode == 1 and data.containsKey('newsSource')))">
a.newsSource,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
......@@ -45,18 +49,18 @@
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="HotwordEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_hotword
(siteId,hotwords,printDisplay,createTime,createUserId,updateTime)
(siteId,hotwords,printDisplay,newsSource,createTime,createUserId,updateTime)
VALUES
(#{siteId},#{hotwords},#{printDisplay},#{createTime},#{createUserId},#{updateTime})
(#{siteId},#{hotwords},#{printDisplay},#{newsSource},#{createTime},#{createUserId},#{updateTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_hotword
(siteId,hotwords,printDisplay,createTime,createUserId,updateTime)
(siteId,hotwords,printDisplay,newsSource,createTime,createUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.siteId},#{item.hotwords},#{item.printDisplay},#{item.createTime},#{item.createUserId},#{item.updateTime})
(#{item.siteId},#{item.hotwords},#{item.printDisplay},#{item.newsSource},#{item.createTime},#{item.createUserId},#{item.updateTime})
</foreach>
</insert>
......@@ -81,6 +85,12 @@
<if test="(colPickMode==0 and data.containsKey('printDisplayIncrement')) or (colPickMode==1 and !data.containsKey('printDisplayIncrement'))">
a.printDisplay=ifnull(a.printDisplay,0) + #{data.printDisplayIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('newsSource')) or (colPickMode==1 and !data.containsKey('newsSource'))">
a.newsSource=#{data.newsSource},
</if>
<if test="(colPickMode==0 and data.containsKey('newsSourceIncrement')) or (colPickMode==1 and !data.containsKey('newsSourceIncrement'))">
a.newsSource=ifnull(a.newsSource,0) + #{data.newsSourceIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
......@@ -136,6 +146,18 @@
</choose>
</foreach>
</trim>
<trim prefix="newsSource=(case" suffix="ELSE newsSource end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('newsSource')) or (colPickMode==1 and !item.containsKey('newsSource'))">
when a.id=#{item.id} then #{item.newsSource}
</when>
<when test="(colPickMode==0 and item.containsKey('newsSourceIncrement')) or (colPickMode==1 and !item.containsKey('newsSourceIncrement'))">
when a.id=#{item.id} then ifnull(a.newsSource,0) + #{item.newsSourceIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
......@@ -356,6 +378,27 @@
${_conditionType_} a.printDisplay <![CDATA[ <= ]]> #{${_conditionParam_}.printDisplayEnd}
</if>
<if test="conditionParamRef.containsKey('newsSource')">
<if test="conditionParamRef.newsSource != null ">
${_conditionType_} a.newsSource = #{${_conditionParam_}.newsSource}
</if>
<if test="conditionParamRef.newsSource == null">
${_conditionType_} a.newsSource is null
</if>
</if>
<if test="conditionParamRef.containsKey('newsSourceList')">
${_conditionType_} a.newsSource in
<foreach collection="conditionParamRef.newsSourceList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('newsSourceStart') and conditionParamRef.newsSourceStart != null">
${_conditionType_} a.newsSource <![CDATA[ >= ]]> #{${_conditionParam_}.newsSourceStart}
</if>
<if test="conditionParamRef.containsKey('newsSourceEnd') and conditionParamRef.newsSourceEnd != null">
${_conditionType_} a.newsSource <![CDATA[ <= ]]> #{${_conditionParam_}.newsSourceEnd}
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
......@@ -440,6 +483,11 @@
<if test='orderCol.printDisplay != null and "DESC".equalsIgnoreCase(orderCol.printDisplay)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('newsSource')">
a.newsSource
<if test='orderCol.newsSource != null and "DESC".equalsIgnoreCase(orderCol.newsSource)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
......
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