Commit b1fb8505 authored by 赵啸非's avatar 赵啸非

添加材料数量统计

parent 95603598
...@@ -178,14 +178,14 @@ CREATE TABLE mortals_xhx_hotword ...@@ -178,14 +178,14 @@ CREATE TABLE mortals_xhx_hotword
`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 '热门词汇', `hotwords` varchar(512) COMMENT '热门词汇',
`printDisplay` int(4) COMMENT '空白打印材料展示数量', `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='热门词汇业务'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='热门词汇业务';
-- ---------------------------- -- ----------------------------
-- 打印提交表 -- 打印提交表
-- ---------------------------- -- ----------------------------
......
package com.mortals.xhx.module.matter.web; package com.mortals.xhx.module.matter.web;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.YesNo; import com.mortals.framework.common.code.YesNo;
...@@ -11,6 +12,9 @@ import com.mortals.xhx.base.system.param.service.ParamService; ...@@ -11,6 +12,9 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.MatterSourceEnum; import com.mortals.xhx.common.code.MatterSourceEnum;
import com.mortals.xhx.common.key.ParamKey; import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.utils.StringUtils; import com.mortals.xhx.common.utils.StringUtils;
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.module.matter.model.MatterDatumQuery; import com.mortals.xhx.module.matter.model.MatterDatumQuery;
import com.mortals.xhx.module.matter.service.MatterDatumService; import com.mortals.xhx.module.matter.service.MatterDatumService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -51,6 +55,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -51,6 +55,8 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
private ParamService paramService; private ParamService paramService;
@Autowired @Autowired
private MatterDatumService matterDatumService; private MatterDatumService matterDatumService;
@Autowired
private HotwordService hotwordService;
public MatterController() { public MatterController() {
super.setModuleDesc("事项"); super.setModuleDesc("事项");
...@@ -68,10 +74,29 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe ...@@ -68,10 +74,29 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
if (StringUtils.isNotEmpty(query.getMatterName())) { if (StringUtils.isNotEmpty(query.getMatterName())) {
query.setMatterName("%".concat(query.getMatterName()).concat("%")); query.setMatterName("%".concat(query.getMatterName()).concat("%"));
} }
if (StringUtils.isNotEmpty(query.getMatterFullName())) {
query.setMatterFullName("%".concat(query.getMatterFullName()).concat("%"));
}
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING)); orderColList.add(new OrderCol("isRecommend",OrderCol.DESCENDING));
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING)); orderColList.add(new OrderCol("createTime",OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
//添加更新热门词汇
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(query.getSiteId()).hotwords(query.getMatterFullName()), context);
if (ObjectUtils.isEmpty(hotwordEntity)) {
//新增
hotwordEntity = new HotwordEntity();
hotwordEntity.initAttrValue();
hotwordEntity.setHotwords(StrUtil.subBetween(query.getMatterFullName(),"%"));
hotwordEntity.setSearchCount(1);
hotwordService.save(hotwordEntity, context);
} else {
//更新
hotwordEntity.setSearchCount(1+hotwordEntity.getSearchCount());
hotwordService.update(hotwordEntity,context);
}
super.doListBefore(query, model, context); super.doListBefore(query, 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