Commit 4b45c434 authored by 赵啸非's avatar 赵啸非

修改热门词汇

parent 56e64773
Pipeline #2405 failed with stages
...@@ -148,21 +148,34 @@ CREATE TABLE mortals_xhx_pubdatum( ...@@ -148,21 +148,34 @@ CREATE TABLE mortals_xhx_pubdatum(
-- ---------------------------- -- ----------------------------
-- 热门词汇业务 -- 填单服务基础设置
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_hotword`; DROP TABLE IF EXISTS `mortals_xhx_baseset`;
CREATE TABLE mortals_xhx_hotword( CREATE TABLE mortals_xhx_baseset(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长', `id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长',
`siteId` bigint(20) COMMENT '站点ID', `siteId` bigint(20) COMMENT '站点ID',
`hotwords` varchar(512) COMMENT '热门词汇',
`printDisplay` int(4) COMMENT '空白打印材料展示数量', `printDisplay` int(4) COMMENT '空白打印材料展示数量',
`newsSource` tinyint(4) COMMENT '新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)', `newsSource` tinyint(4) COMMENT '新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)',
`searchCount` int(9) COMMENT '查询次数',
`wordsSource` tinyint(4) COMMENT '热门词汇来源(1.手动添加,2.查询添加)',
`createTime` datetime COMMENT '创建时间', `createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户', `createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间', `updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='填单服务基础设置';
-- ----------------------------
-- 热门词汇业务表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_hotword`;
CREATE TABLE mortals_xhx_hotword(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键,自增长',
`siteId` bigint(20) COMMENT '站点ID',
`hotwords` varchar(512) COMMENT '热门词汇',
`searchCount` int(9) COMMENT '查询次数',
`wordsSource` tinyint(4) COMMENT '热门词汇来源(1.手动添加,2.查询添加)',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='热门词汇业务'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='热门词汇业务';
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 热门词汇来源(1.手动添加,2.查询添加)枚举类
*
* @author zxfei
*/
public enum WordsSourceEnum {
手动添加(1, "手动添加"),
查询添加(2, "查询添加");
private Integer value;
private String desc;
WordsSourceEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static WordsSourceEnum getByValue(Integer value) {
for (WordsSourceEnum wordsSourceEnum : WordsSourceEnum.values()) {
if (wordsSourceEnum.getValue() == value) {
return wordsSourceEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (WordsSourceEnum item : WordsSourceEnum.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
...@@ -31,4 +31,7 @@ public final class Constant { ...@@ -31,4 +31,7 @@ public final class Constant {
public final static String PARAMS_NOTICE_URL = "notice_url"; public final static String PARAMS_NOTICE_URL = "notice_url";
public final static String PARAMS_HOTWORDS_DEFAULT_NUM = "hotwords_default_num";
} }
package com.mortals.xhx.module.baseset.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import java.util.List;
/**
* 填单服务基础设置Dao
* 填单服务基础设置 DAO接口
*
* @author zxfei
* @date 2022-12-08
*/
public interface BasesetDao extends ICRUDDao<BasesetEntity,Long>{
}
package com.mortals.xhx.module.baseset.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.baseset.dao.BasesetDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 填单服务基础设置DaoImpl DAO接口
*
* @author zxfei
* @date 2022-12-08
*/
@Repository("basesetDao")
public class BasesetDaoImpl extends BaseCRUDDaoMybatis<BasesetEntity,Long> implements BasesetDao {
}
package com.mortals.xhx.module.baseset.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.baseset.model.vo.BasesetVo;
/**
* 填单服务基础设置实体对象
*
* @author zxfei
* @date 2022-12-08
*/
public class BasesetEntity extends BasesetVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 空白打印材料展示数量
*/
private Integer printDisplay;
/**
* 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
*/
private Integer newsSource;
public BasesetEntity(){}
/**
* 获取 站点ID
* @return Long
*/
public Long getSiteId(){
return siteId;
}
/**
* 设置 站点ID
* @param siteId
*/
public void setSiteId(Long siteId){
this.siteId = siteId;
}
/**
* 获取 空白打印材料展示数量
* @return Integer
*/
public Integer getPrintDisplay(){
return printDisplay;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplay
*/
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;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof BasesetEntity) {
BasesetEntity tmp = (BasesetEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",printDisplay:").append(getPrintDisplay());
sb.append(",newsSource:").append(getNewsSource());
return sb.toString();
}
public void initAttrValue(){
this.siteId = null;
this.printDisplay = 0;
this.newsSource = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 填单服务基础设置视图对象
*
* @author zxfei
* @date 2022-12-08
*/
@Data
public class BasesetVo extends BaseEntityLong {
private List<HotwordEntity> hotwordList;
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
/**
* BasesetService
*
* 填单服务基础设置 service接口
*
* @author zxfei
* @date 2022-12-08
*/
public interface BasesetService extends ICRUDService<BasesetEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.service.impl;
import com.mortals.framework.model.PageInfo;
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 org.springframework.beans.factory.annotation.Autowired;
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.baseset.dao.BasesetDao;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.service.BasesetService;
import java.util.List;
/**
* BasesetService
* 填单服务基础设置 service实现
*
* @author zxfei
* @date 2022-12-08
*/
@Service("basesetService")
public class BasesetServiceImpl extends AbstractCRUDServiceImpl<BasesetDao, BasesetEntity, Long> implements BasesetService {
@Autowired
private HotwordService hotwordService;
@Override
protected void findAfter(BasesetEntity params, PageInfo pageInfo, Context context, List<BasesetEntity> list) throws AppException {
list.forEach(item -> {
List<HotwordEntity> hotwordEntities = hotwordService.find(new HotwordQuery().siteId(item.getSiteId()));
item.setHotwordList(hotwordEntities);
});
super.findAfter(params, pageInfo, context, list);
}
}
\ No newline at end of file
package com.mortals.xhx.module.baseset.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
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.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.service.BasesetService;
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-12-08
*/
@RestController
@RequestMapping("baseset")
public class BasesetController extends BaseCRUDJsonBodyMappingController<BasesetService,BasesetEntity,Long> {
@Autowired
private ParamService paramService;
public BasesetController(){
super.setModuleDesc( "填单服务基础设置");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "newsSource", paramService.getParamBySecondOrganize("Baseset","newsSource"));
super.init(model, context);
}
}
\ No newline at end of file
...@@ -27,6 +27,9 @@ import com.mortals.xhx.feign.base.pdu.DeptPdu; ...@@ -27,6 +27,9 @@ import com.mortals.xhx.feign.base.pdu.DeptPdu;
import com.mortals.xhx.feign.base.pdu.SitePdu; import com.mortals.xhx.feign.base.pdu.SitePdu;
import com.mortals.xhx.feign.rsp.ApiResp; import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
import com.mortals.xhx.module.baseset.model.BasesetQuery;
import com.mortals.xhx.module.baseset.service.BasesetService;
import com.mortals.xhx.module.home.pdu.HomeQueryPdu; import com.mortals.xhx.module.home.pdu.HomeQueryPdu;
import com.mortals.xhx.module.home.pdu.NoticeQueryPdu; import com.mortals.xhx.module.home.pdu.NoticeQueryPdu;
import com.mortals.xhx.module.hotword.model.HotwordEntity; import com.mortals.xhx.module.hotword.model.HotwordEntity;
...@@ -64,6 +67,8 @@ public class HomeController extends BaseJsonBodyController { ...@@ -64,6 +67,8 @@ public class HomeController extends BaseJsonBodyController {
private HotwordService hotwordService; private HotwordService hotwordService;
@Autowired @Autowired
private ISiteFeign siteFeign; private ISiteFeign siteFeign;
@Autowired
private BasesetService basesetService;
@PostMapping({"site/list"}) @PostMapping({"site/list"})
public Rest<Object> list() { public Rest<Object> list() {
...@@ -248,21 +253,26 @@ public class HomeController extends BaseJsonBodyController { ...@@ -248,21 +253,26 @@ public class HomeController extends BaseJsonBodyController {
String busiDesc = "获取首页数据"; String busiDesc = "获取首页数据";
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
HotwordQuery hotwordQuery = new HotwordQuery(); HotwordQuery hotwordQuery = new HotwordQuery();
hotwordQuery.siteId(homeQueryPdu.getSiteId()); hotwordQuery.siteId(homeQueryPdu.getSiteId());
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("searchCount", OrderCol.DESCENDING)); orderColList.add(new OrderCol("searchCount", OrderCol.DESCENDING));
orderColList.add(new OrderCol("wordsSource", OrderCol.ASCENDING)); orderColList.add(new OrderCol("wordsSource", OrderCol.ASCENDING));
hotwordQuery.setOrderColList(orderColList); hotwordQuery.setOrderColList(orderColList);
List<String> hotwordEntities = hotwordService.find(hotwordQuery, new PageInfo(), null).getList().stream() PageInfo pageInfo = new PageInfo();
int nums = GlobalSysInfo.getParamIntValue(Constant.PARAMS_HOTWORDS_DEFAULT_NUM, 10);
pageInfo.setPrePageResult(nums);
List<HotwordEntity> hotwordEntities = hotwordService.find(hotwordQuery, pageInfo, null).getList();
/* List<String> hotwordEntities = hotwordService.find(hotwordQuery, new PageInfo(), null).getList().stream()
.map(HotwordEntity::getHotwords) .map(HotwordEntity::getHotwords)
.flatMap(item -> StrUtil.split(item, ",".charAt(0)).stream()) .flatMap(item -> StrUtil.split(item, ",".charAt(0)).stream())
.collect(Collectors.toList()); .collect(Collectors.toList());*/
model.put("hotWords", hotwordEntities); model.put("hotWords", hotwordEntities);
MatterQuery matterQuery = new MatterQuery(); MatterQuery matterQuery = new MatterQuery();
matterQuery.setSiteId(homeQueryPdu.getSiteId()); matterQuery.setSiteId(homeQueryPdu.getSiteId());
int matterCont = matterService.count(matterQuery, this.getContext()); int matterCont = matterService.count(matterQuery, this.getContext());
...@@ -285,9 +295,12 @@ public class HomeController extends BaseJsonBodyController { ...@@ -285,9 +295,12 @@ public class HomeController extends BaseJsonBodyController {
Rest<com.mortals.xhx.common.pdu.site.SitePdu> info = siteFeign.info(homeQueryPdu.getSiteId()); Rest<com.mortals.xhx.common.pdu.site.SitePdu> info = siteFeign.info(homeQueryPdu.getSiteId());
model.put("title", info == null ? "" : info.getData().getSiteName()); //标题 model.put("title", info == null ? "" : info.getData().getSiteName()); //标题
HotwordEntity hotwordEntity = hotwordService.selectOne(hotwordQuery.siteId(homeQueryPdu.getSiteId())); //HotwordEntity hotwordEntity = hotwordService.selectOne(hotwordQuery.siteId(homeQueryPdu.getSiteId()));
model.put("blankCount", hotwordEntity == null ? 20 : hotwordEntity.getPrintDisplay()); //空白样表数量
model.put("newsSource", hotwordEntity == null ? 1 : hotwordEntity.getNewsSource()); //新闻来源 BasesetEntity basesetEntity = basesetService.selectOne(new BasesetQuery().siteId(homeQueryPdu.getSiteId()));
model.put("blankCount", basesetEntity == null ? 20 : basesetEntity.getPrintDisplay()); //空白样表数量
model.put("newsSource", basesetEntity == null ? 1 : basesetEntity.getNewsSource()); //新闻来源
model.put("message_info", busiDesc + "成功"); model.put("message_info", busiDesc + "成功");
this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap()); this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap());
this.recordSysLog(this.request, busiDesc + " 【成功】"); this.recordSysLog(this.request, busiDesc + " 【成功】");
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
* 热门词汇业务 DAO接口 * 热门词汇业务 DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-12-06 * @date 2022-12-08
*/ */
public interface HotwordDao extends ICRUDDao<HotwordEntity,Long>{ public interface HotwordDao extends ICRUDDao<HotwordEntity,Long>{
......
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
* 热门词汇业务DaoImpl DAO接口 * 热门词汇业务DaoImpl DAO接口
* *
* @author zxfei * @author zxfei
* @date 2022-12-06 * @date 2022-12-08
*/ */
@Repository("hotwordDao") @Repository("hotwordDao")
public class HotwordDaoImpl extends BaseCRUDDaoMybatis<HotwordEntity,Long> implements HotwordDao { public class HotwordDaoImpl extends BaseCRUDDaoMybatis<HotwordEntity,Long> implements HotwordDao {
......
package com.mortals.xhx.module.hotword.model; 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; import com.mortals.xhx.module.hotword.model.vo.HotwordVo;
/** /**
* 热门词汇业务实体对象 * 热门词汇业务实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-12-07 * @date 2022-12-08
*/ */
public class HotwordEntity extends HotwordVo { public class HotwordEntity extends HotwordVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 站点ID * 站点ID
*/ */
private Long siteId; private Long siteId;
/** /**
* 热门词汇 * 热门词汇
*/ */
private String hotwords; private String hotwords;
/** /**
* 空白打印材料展示数量 * 查询次数
*/ */
private Integer printDisplay;
/**
* 新闻来源(1.热点新闻,2.本地要闻,3.政策发布,4.通知公告)
*/
private Integer newsSource;
/**
* 查询次数
*/
private Integer searchCount; private Integer searchCount;
/** /**
* 热门词汇来源(1.手动添加,2.查询添加) * 热门词汇来源(1.手动添加,2.查询添加)
*/ */
private Integer wordsSource; private Integer wordsSource;
public HotwordEntity(){} public HotwordEntity(){}
/** /**
* 获取 站点ID * 获取 站点ID
* @return Long * @return Long
*/ */
public Long getSiteId(){ public Long getSiteId(){
return siteId; return siteId;
} }
/** /**
* 设置 站点ID * 设置 站点ID
* @param siteId * @param siteId
*/ */
public void setSiteId(Long siteId){ public void setSiteId(Long siteId){
this.siteId = siteId; this.siteId = siteId;
} }
/** /**
* 获取 热门词汇 * 获取 热门词汇
* @return String * @return String
*/ */
public String getHotwords(){ public String getHotwords(){
return hotwords; return hotwords;
} }
/** /**
* 设置 热门词汇 * 设置 热门词汇
* @param hotwords * @param hotwords
*/ */
public void setHotwords(String hotwords){ public void setHotwords(String hotwords){
this.hotwords = hotwords; this.hotwords = hotwords;
} }
/** /**
* 获取 空白打印材料展示数量 * 获取 查询次数
* @return Integer * @return Integer
*/ */
public Integer getPrintDisplay(){
return printDisplay;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplay
*/
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;
}
/**
* 获取 查询次数
* @return Integer
*/
public Integer getSearchCount(){ public Integer getSearchCount(){
return searchCount; return searchCount;
} }
/** /**
* 设置 查询次数 * 设置 查询次数
* @param searchCount * @param searchCount
*/ */
public void setSearchCount(Integer searchCount){ public void setSearchCount(Integer searchCount){
this.searchCount = searchCount; this.searchCount = searchCount;
} }
/** /**
* 获取 热门词汇来源(1.手动添加,2.查询添加) * 获取 热门词汇来源(1.手动添加,2.查询添加)
* @return Integer * @return Integer
*/ */
public Integer getWordsSource(){ public Integer getWordsSource(){
return wordsSource; return wordsSource;
} }
/** /**
* 设置 热门词汇来源(1.手动添加,2.查询添加) * 设置 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSource * @param wordsSource
*/ */
public void setWordsSource(Integer wordsSource){ public void setWordsSource(Integer wordsSource){
this.wordsSource = wordsSource; this.wordsSource = wordsSource;
} }
...@@ -129,7 +98,7 @@ public class HotwordEntity extends HotwordVo { ...@@ -129,7 +98,7 @@ public class HotwordEntity extends HotwordVo {
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -137,7 +106,7 @@ public class HotwordEntity extends HotwordVo { ...@@ -137,7 +106,7 @@ public class HotwordEntity extends HotwordVo {
if (obj instanceof HotwordEntity) { if (obj instanceof HotwordEntity) {
HotwordEntity tmp = (HotwordEntity) obj; HotwordEntity tmp = (HotwordEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
...@@ -147,8 +116,6 @@ public class HotwordEntity extends HotwordVo { ...@@ -147,8 +116,6 @@ public class HotwordEntity extends HotwordVo {
StringBuilder sb = new StringBuilder(""); StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId()); sb.append(",siteId:").append(getSiteId());
sb.append(",hotwords:").append(getHotwords()); sb.append(",hotwords:").append(getHotwords());
sb.append(",printDisplay:").append(getPrintDisplay());
sb.append(",newsSource:").append(getNewsSource());
sb.append(",searchCount:").append(getSearchCount()); sb.append(",searchCount:").append(getSearchCount());
sb.append(",wordsSource:").append(getWordsSource()); sb.append(",wordsSource:").append(getWordsSource());
return sb.toString(); return sb.toString();
...@@ -156,16 +123,12 @@ public class HotwordEntity extends HotwordVo { ...@@ -156,16 +123,12 @@ public class HotwordEntity extends HotwordVo {
public void initAttrValue(){ public void initAttrValue(){
this.siteId = null; this.siteId = null;
this.hotwords = "";
this.printDisplay = 0;
this.newsSource = 1; this.hotwords = "";
this.searchCount = 0; this.searchCount = 0;
this.wordsSource = 1; this.wordsSource = 1;
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import java.util.List; ...@@ -7,7 +7,7 @@ import java.util.List;
* 热门词汇业务视图对象 * 热门词汇业务视图对象
* *
* @author zxfei * @author zxfei
* @date 2022-12-06 * @date 2022-12-08
*/ */
public class HotwordVo extends BaseEntityLong { public class HotwordVo extends BaseEntityLong {
......
...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.hotword.model.HotwordEntity; ...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.hotword.model.HotwordEntity;
* 热门词汇业务 service接口 * 热门词汇业务 service接口
* *
* @author zxfei * @author zxfei
* @date 2022-12-06 * @date 2022-12-08
*/ */
public interface HotwordService extends ICRUDService<HotwordEntity,Long>{ public interface HotwordService extends ICRUDService<HotwordEntity,Long>{
......
package com.mortals.xhx.module.hotword.service.impl; package com.mortals.xhx.module.hotword.service.impl;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -7,16 +6,14 @@ import com.mortals.framework.model.Context; ...@@ -7,16 +6,14 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.hotword.dao.HotwordDao; import com.mortals.xhx.module.hotword.dao.HotwordDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity; import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService; import com.mortals.xhx.module.hotword.service.HotwordService;
import org.springframework.util.ObjectUtils;
/** /**
* HotwordService * HotwordService
* 热门词汇业务 service实现 * 热门词汇业务 service实现
* *
* @author zxfei * @author zxfei
* @date 2022-12-06 * @date 2022-12-08
*/ */
@Service("hotwordService") @Service("hotwordService")
public class HotwordServiceImpl extends AbstractCRUDServiceImpl<HotwordDao, HotwordEntity, Long> implements HotwordService { public class HotwordServiceImpl extends AbstractCRUDServiceImpl<HotwordDao, HotwordEntity, Long> implements HotwordService {
} }
\ No newline at end of file
package com.mortals.xhx.module.hotword.web; package com.mortals.xhx.module.hotword.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.NewsSourceEnum;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.hotword.model.HotwordEntity; import com.mortals.xhx.module.hotword.model.HotwordEntity;
import com.mortals.xhx.module.hotword.service.HotwordService; import com.mortals.xhx.module.hotword.service.HotwordService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays; import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* 热门词汇业务 *
* * 热门词汇业务
* @author zxfei *
* @date 2022-12-06 * @author zxfei
*/ * @date 2022-12-08
*/
@RestController @RestController
@RequestMapping("hotword") @RequestMapping("hotword")
public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService, HotwordEntity, Long> { public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService,HotwordEntity,Long> {
public HotwordController() { @Autowired
super.setModuleDesc("热门词汇业务"); private ParamService paramService;
public HotwordController(){
super.setModuleDesc( "热门词汇业务");
} }
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "newsSource", NewsSourceEnum.getEnumMap()); this.addDict(model, "wordsSource", paramService.getParamBySecondOrganize("Hotword","wordsSource"));
super.init(model, context); 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
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###填单服务基础设置列表
POST {{baseUrl}}/baseset/list
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":824,
"printDisplay":0,
"newsSource":1,
"page":1,
"size":10
}
###填单服务基础设置更新与保存
POST {{baseUrl}}/baseset/save
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":564,
"printDisplay":0,
"newsSource":1,
}
> {%
client.global.set("Baseset_id", JSON.parse(response.body).data.id);
%}
###填单服务基础设置查看
GET {{baseUrl}}/baseset/info?id={{Baseset_id}}
Authorization: {{authToken}}
Accept: application/json
###填单服务基础设置编辑
GET {{baseUrl}}/baseset/edit?id={{Baseset_id}}
Authorization: {{authToken}}
Accept: application/json
###填单服务基础设置删除
GET {{baseUrl}}/baseset/delete?id={{Baseset_id}}
Authorization: {{authToken}}
Accept: application/json
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###热门词汇业务列表
POST {{baseUrl}}/hotword/list
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":889,
"hotwords":"jdjiit",
"searchCount":0,
"wordsSource":1,
"page":1,
"size":10
}
###热门词汇业务更新与保存
POST {{baseUrl}}/hotword/save
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":324,
"hotwords":"qxfiww",
"searchCount":0,
"wordsSource":1,
}
> {%
client.global.set("Hotword_id", JSON.parse(response.body).data.id);
%}
###热门词汇业务查看
GET {{baseUrl}}/hotword/info?id={{Hotword_id}}
Authorization: {{authToken}}
Accept: application/json
###热门词汇业务编辑
GET {{baseUrl}}/hotword/edit?id={{Hotword_id}}
Authorization: {{authToken}}
Accept: application/json
###热门词汇业务删除
GET {{baseUrl}}/hotword/delete?id={{Hotword_id}}
Authorization: {{authToken}}
Accept: application/json
...@@ -33,9 +33,8 @@ Content-Type: application/json ...@@ -33,9 +33,8 @@ Content-Type: application/json
{ {
"siteId": 3, "siteId": 3,
"page": 1, "page": 2,
"size": 10, "size": 10
"materiaFullName": "测试1"
} }
......
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