Commit 2e334160 authored by 赵啸非's avatar 赵啸非

添加材料数量统计

parent 2b6945b6
......@@ -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-08
*/
public interface HotwordDao extends ICRUDDao<HotwordEntity,Long>{
......
package com.mortals.xhx.module.hotword.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.hotword.dao.HotwordDao;
import com.mortals.xhx.module.hotword.model.HotwordEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
import org.springframework.stereotype.Repository;
/**
* 热门词汇业务DaoImpl DAO接口
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-08
*/
@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-08
*/
public class HotwordEntity extends HotwordVo {
......@@ -25,9 +20,13 @@ public class HotwordEntity extends HotwordVo {
*/
private String hotwords;
/**
* 空白打印材料展示数量
* 查询次数
*/
private Integer printDisplay;
private Integer searchCount;
/**
* 热门词汇来源(1.手动添加,2.查询添加)
*/
private Integer wordsSource;
......@@ -61,18 +60,32 @@ public class HotwordEntity extends HotwordVo {
this.hotwords = hotwords;
}
/**
* 获取 空白打印材料展示数量
* 获取 查询次数
* @return Integer
*/
public Integer getSearchCount(){
return searchCount;
}
/**
* 设置 查询次数
* @param searchCount
*/
public void setSearchCount(Integer searchCount){
this.searchCount = searchCount;
}
/**
* 获取 热门词汇来源(1.手动添加,2.查询添加)
* @return Integer
*/
public Integer getPrintDisplay(){
return printDisplay;
public Integer getWordsSource(){
return wordsSource;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplay
* 设置 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSource
*/
public void setPrintDisplay(Integer printDisplay){
this.printDisplay = printDisplay;
public void setWordsSource(Integer wordsSource){
this.wordsSource = wordsSource;
}
......@@ -98,7 +111,8 @@ public class HotwordEntity extends HotwordVo {
StringBuilder sb = new StringBuilder("");
sb.append(",siteId:").append(getSiteId());
sb.append(",hotwords:").append(getHotwords());
sb.append(",printDisplay:").append(getPrintDisplay());
sb.append(",searchCount:").append(getSearchCount());
sb.append(",wordsSource:").append(getWordsSource());
return sb.toString();
}
......@@ -108,6 +122,8 @@ public class HotwordEntity extends HotwordVo {
this.hotwords = "";
this.printDisplay = 0;
this.searchCount = 0;
this.wordsSource = 1;
}
}
\ 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-08
*/
public class HotwordQuery extends HotwordEntity {
/** 开始 主键,自增长 */
......@@ -36,17 +36,29 @@ public class HotwordQuery extends HotwordEntity {
/** 热门词汇 */
private List<String> hotwordsList;
/** 开始 空白打印材料展示数量 */
private Integer printDisplayStart;
/** 开始 查询次数 */
private Integer searchCountStart;
/** 结束 查询次数 */
private Integer searchCountEnd;
/** 增加 查询次数 */
private Integer searchCountIncrement;
/** 查询次数列表 */
private List <Integer> searchCountList;
/** 结束 空白打印材料展示数量 */
private Integer printDisplayEnd;
/** 开始 热门词汇来源(1.手动添加,2.查询添加) */
private Integer wordsSourceStart;
/** 增加 空白打印材料展示数量 */
private Integer printDisplayIncrement;
/** 结束 热门词汇来源(1.手动添加,2.查询添加) */
private Integer wordsSourceEnd;
/** 空白打印材料展示数量列表 */
private List <Integer> printDisplayList;
/** 增加 热门词汇来源(1.手动添加,2.查询添加) */
private Integer wordsSourceIncrement;
/** 热门词汇来源(1.手动添加,2.查询添加)列表 */
private List <Integer> wordsSourceList;
/** 开始 创建时间 */
private String createTimeStart;
......@@ -224,67 +236,131 @@ public class HotwordQuery extends HotwordEntity {
this.hotwordsList = hotwordsList;
}
/**
* 获取 开始 空白打印材料展示数量
* @return printDisplayStart
* 获取 开始 查询次数
* @return searchCountStart
*/
public Integer getSearchCountStart(){
return this.searchCountStart;
}
/**
* 设置 开始 查询次数
* @param searchCountStart
*/
public void setSearchCountStart(Integer searchCountStart){
this.searchCountStart = searchCountStart;
}
/**
* 获取 结束 查询次数
* @return $searchCountEnd
*/
public Integer getSearchCountEnd(){
return this.searchCountEnd;
}
/**
* 设置 结束 查询次数
* @param searchCountEnd
*/
public void setSearchCountEnd(Integer searchCountEnd){
this.searchCountEnd = searchCountEnd;
}
/**
* 获取 增加 查询次数
* @return searchCountIncrement
*/
public Integer getSearchCountIncrement(){
return this.searchCountIncrement;
}
/**
* 设置 增加 查询次数
* @param searchCountIncrement
*/
public void setSearchCountIncrement(Integer searchCountIncrement){
this.searchCountIncrement = searchCountIncrement;
}
/**
* 获取 查询次数
* @return searchCountList
*/
public List<Integer> getSearchCountList(){
return this.searchCountList;
}
/**
* 设置 查询次数
* @param searchCountList
*/
public void setSearchCountList(List<Integer> searchCountList){
this.searchCountList = searchCountList;
}
/**
* 获取 开始 热门词汇来源(1.手动添加,2.查询添加)
* @return wordsSourceStart
*/
public Integer getPrintDisplayStart(){
return this.printDisplayStart;
public Integer getWordsSourceStart(){
return this.wordsSourceStart;
}
/**
* 设置 开始 空白打印材料展示数量
* @param printDisplayStart
* 设置 开始 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceStart
*/
public void setPrintDisplayStart(Integer printDisplayStart){
this.printDisplayStart = printDisplayStart;
public void setWordsSourceStart(Integer wordsSourceStart){
this.wordsSourceStart = wordsSourceStart;
}
/**
* 获取 结束 空白打印材料展示数量
* @return $printDisplayEnd
* 获取 结束 热门词汇来源(1.手动添加,2.查询添加)
* @return $wordsSourceEnd
*/
public Integer getPrintDisplayEnd(){
return this.printDisplayEnd;
public Integer getWordsSourceEnd(){
return this.wordsSourceEnd;
}
/**
* 设置 结束 空白打印材料展示数量
* @param printDisplayEnd
* 设置 结束 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceEnd
*/
public void setPrintDisplayEnd(Integer printDisplayEnd){
this.printDisplayEnd = printDisplayEnd;
public void setWordsSourceEnd(Integer wordsSourceEnd){
this.wordsSourceEnd = wordsSourceEnd;
}
/**
* 获取 增加 空白打印材料展示数量
* @return printDisplayIncrement
* 获取 增加 热门词汇来源(1.手动添加,2.查询添加)
* @return wordsSourceIncrement
*/
public Integer getPrintDisplayIncrement(){
return this.printDisplayIncrement;
public Integer getWordsSourceIncrement(){
return this.wordsSourceIncrement;
}
/**
* 设置 增加 空白打印材料展示数量
* @param printDisplayIncrement
* 设置 增加 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceIncrement
*/
public void setPrintDisplayIncrement(Integer printDisplayIncrement){
this.printDisplayIncrement = printDisplayIncrement;
public void setWordsSourceIncrement(Integer wordsSourceIncrement){
this.wordsSourceIncrement = wordsSourceIncrement;
}
/**
* 获取 空白打印材料展示数量
* @return printDisplayList
* 获取 热门词汇来源(1.手动添加,2.查询添加)
* @return wordsSourceList
*/
public List<Integer> getPrintDisplayList(){
return this.printDisplayList;
public List<Integer> getWordsSourceList(){
return this.wordsSourceList;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplayList
* 设置 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceList
*/
public void setPrintDisplayList(List<Integer> printDisplayList){
this.printDisplayList = printDisplayList;
public void setWordsSourceList(List<Integer> wordsSourceList){
this.wordsSourceList = wordsSourceList;
}
/**
......@@ -525,47 +601,92 @@ public class HotwordQuery extends HotwordEntity {
}
/**
* 设置 空白打印材料展示数量
* @param printDisplay
* 设置 查询次数
* @param searchCount
*/
public HotwordQuery searchCount(Integer searchCount){
setSearchCount(searchCount);
return this;
}
/**
* 设置 开始 查询次数
* @param searchCountStart
*/
public HotwordQuery searchCountStart(Integer searchCountStart){
this.searchCountStart = searchCountStart;
return this;
}
/**
* 设置 结束 查询次数
* @param searchCountEnd
*/
public HotwordQuery searchCountEnd(Integer searchCountEnd){
this.searchCountEnd = searchCountEnd;
return this;
}
/**
* 设置 增加 查询次数
* @param searchCountIncrement
*/
public HotwordQuery searchCountIncrement(Integer searchCountIncrement){
this.searchCountIncrement = searchCountIncrement;
return this;
}
/**
* 设置 查询次数
* @param searchCountList
*/
public HotwordQuery searchCountList(List<Integer> searchCountList){
this.searchCountList = searchCountList;
return this;
}
/**
* 设置 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSource
*/
public HotwordQuery printDisplay(Integer printDisplay){
setPrintDisplay(printDisplay);
public HotwordQuery wordsSource(Integer wordsSource){
setWordsSource(wordsSource);
return this;
}
/**
* 设置 开始 空白打印材料展示数量
* @param printDisplayStart
* 设置 开始 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceStart
*/
public HotwordQuery printDisplayStart(Integer printDisplayStart){
this.printDisplayStart = printDisplayStart;
public HotwordQuery wordsSourceStart(Integer wordsSourceStart){
this.wordsSourceStart = wordsSourceStart;
return this;
}
/**
* 设置 结束 空白打印材料展示数量
* @param printDisplayEnd
* 设置 结束 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceEnd
*/
public HotwordQuery printDisplayEnd(Integer printDisplayEnd){
this.printDisplayEnd = printDisplayEnd;
public HotwordQuery wordsSourceEnd(Integer wordsSourceEnd){
this.wordsSourceEnd = wordsSourceEnd;
return this;
}
/**
* 设置 增加 空白打印材料展示数量
* @param printDisplayIncrement
* 设置 增加 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceIncrement
*/
public HotwordQuery printDisplayIncrement(Integer printDisplayIncrement){
this.printDisplayIncrement = printDisplayIncrement;
public HotwordQuery wordsSourceIncrement(Integer wordsSourceIncrement){
this.wordsSourceIncrement = wordsSourceIncrement;
return this;
}
/**
* 设置 空白打印材料展示数量
* @param printDisplayList
* 设置 热门词汇来源(1.手动添加,2.查询添加)
* @param wordsSourceList
*/
public HotwordQuery printDisplayList(List<Integer> printDisplayList){
this.printDisplayList = printDisplayList;
public HotwordQuery wordsSourceList(List<Integer> wordsSourceList){
this.wordsSourceList = wordsSourceList;
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-08
*/
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-08
*/
public interface HotwordService extends ICRUDService<HotwordEntity,Long>{
......
package com.mortals.xhx.module.hotword.service.impl;
import com.mortals.xhx.module.hotword.model.HotwordQuery;
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.util.ObjectUtils;
import org.springframework.stereotype.Service;
/**
* HotwordService
* 热门词汇业务 service实现
*
* @author zxfei
* @date 2022-11-17
* @date 2022-12-08
*/
@Service("hotwordService")
public class HotwordServiceImpl extends AbstractCRUDServiceImpl<HotwordDao, HotwordEntity, Long> implements HotwordService {
}
\ No newline at end of file
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 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.Date;
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
* @date 2022-12-08
*/
@RestController
@RequestMapping("hotword")
public class HotwordController extends BaseCRUDJsonBodyMappingController<HotwordService, HotwordEntity, Long> {
@Autowired
private ParamService paramService;
public HotwordController() {
super.setModuleDesc("热门词汇业务");
......@@ -51,15 +35,31 @@ public class HotwordController extends BaseCRUDJsonBodyMappingController<Hotword
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "wordsSource", paramService.getParamBySecondOrganize("Hotword", "wordsSource"));
super.init(model, context);
}
@Override
protected void batchSaveBefore(List<HotwordEntity> list, Map<String, Object> model, Context context) throws AppException {
//查询是否存在当前关键词,
list.forEach(item -> {
HotwordEntity hotwordEntity = this.service.selectOne(new HotwordQuery().siteId(item.getSiteId()).hotwords(item.getHotwords()));
if (!ObjectUtils.isEmpty(hotwordEntity)) {
item.setId(hotwordEntity.getId());
item.setSearchCount(hotwordEntity.getSearchCount());
item.setUpdateTime(new Date());
}
});
super.batchSaveBefore(list, 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)) {
if(!ObjectUtils.isEmpty(hotwordEntity)){
entity.setId(hotwordEntity.getId());
entity.setSearchCount(hotwordEntity.getSearchCount());
entity.setUpdateTime(new Date());
}
super.saveBefore(entity, model, context);
}
......
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