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

添加应用白名单接口

parent b0a1caed
Pipeline #2485 canceled with stages
......@@ -285,6 +285,7 @@ public class HomeController extends BaseJsonBodyController {
int nums = GlobalSysInfo.getParamIntValue(Constant.PARAMS_HOTWORDS_DEFAULT_NUM, 10);
pageInfo.setPrePageResult(nums);
List<HotwordEntity> hotwordEntities = hotwordService.find(hotwordQuery, pageInfo, null).getList();
model.put("hotWords", hotwordEntities);
MatterQuery matterQuery = new MatterQuery();
......
......@@ -37,6 +37,9 @@ import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import com.mortals.xhx.common.plugin.LoopSingleRowTableRenderPolicy;
import com.mortals.xhx.common.utils.ExportDocUtil;
import com.mortals.xhx.common.utils.WordUtil;
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.dao.MatterDao;
import com.mortals.xhx.module.matter.model.MatterDatumQuery;
import com.mortals.xhx.module.matter.model.MatterEntity;
......@@ -87,6 +90,8 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Autowired
private PubdatumService pubdatumService;
@Autowired
private HotwordService hotwordService;
public static String word[] = {"doc", "dot", "wps", "wpt", "docx", "dotx", "docm", "dotm"};
......@@ -172,8 +177,6 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
if (!ObjectUtils.isEmpty(entity.getTemplatePath())) {
parseDocxToJson(entity);
}
}
@Override
......@@ -540,6 +543,27 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
entity.setMatterName(matterEntity.getMatterName());
}
});
if (ObjectUtils.isEmpty(list)) {
//添加更新热门词汇
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(params.getSiteId()).hotwords(params.getMateriaFullName()), context);
if (ObjectUtils.isEmpty(hotwordEntity)) {
//新增
hotwordEntity = new HotwordEntity();
hotwordEntity.initAttrValue();
hotwordEntity.setSiteId(params.getSiteId());
hotwordEntity.setHotwords(params.getMateriaFullName());
hotwordEntity.setSearchCount(1);
hotwordEntity.setCreateTime(new Date());
hotwordEntity.setCreateUserId(this.getContextUserId(context));
hotwordService.save(hotwordEntity, context);
} else {
//更新
hotwordEntity.setSearchCount(1 + hotwordEntity.getSearchCount());
hotwordEntity.setUpdateTime(new Date());
hotwordService.update(hotwordEntity, context);
}
}
super.findAfter(params, pageInfo, context, list);
}
......
......@@ -11,6 +11,9 @@ import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.feign.site.ISiteFeign;
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.MatterDatumEntity;
import com.mortals.xhx.module.matter.model.MatterDatumQuery;
import com.mortals.xhx.module.matter.model.MatterQuery;
......@@ -48,6 +51,8 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
private MatterDatumService matterDatumService;
@Autowired
private ISiteFeign siteFeign;
@Autowired
private HotwordService hotwordService;
@Override
protected void findAfter(MatterEntity entity, PageInfo pageInfo, Context context, List<MatterEntity> list) throws AppException {
......@@ -61,7 +66,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
if (entity.getIsTerminal() == YesNoEnum.YES.getValue()) {
String searchMatterName = StrUtil.subBetween(entity.getMatterFullName(), "%");
if(!ObjectUtils.isEmpty(searchMatterName)){
if (!ObjectUtils.isEmpty(searchMatterName)) {
//终端访问,标红查询参数
String str = "<span style=\"color:red;font-weight:bold\">%s</span>";
String replaceStr = StrUtil.replace(matterEntity.getMatterName(), searchMatterName, String.format(str, searchMatterName));
......@@ -70,6 +75,23 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
}
}
if (!ObjectUtils.isEmpty(list)) {
//添加更新热门词汇
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(entity.getSiteId()).hotwords(entity.getMatterFullName()), context);
if (ObjectUtils.isEmpty(hotwordEntity)) {
//新增
hotwordEntity = new HotwordEntity();
hotwordEntity.initAttrValue();
hotwordEntity.setHotwords(StrUtil.subBetween(entity.getMatterFullName(), "%"));
hotwordEntity.setSearchCount(1);
hotwordEntity.setSiteId(entity.getSiteId());
hotwordService.save(hotwordEntity, context);
} else {
//更新
hotwordEntity.setSearchCount(1 + hotwordEntity.getSearchCount());
hotwordService.update(hotwordEntity, context);
}
}
}
@Override
......@@ -109,6 +131,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
}
return Rest.ok(msg);
}
private MatterEntity updateOrSave(SheetMatterEntity sheetMatterEntity, Long siteId, Context context) {
int count = this.count(new MatterQuery().siteId(siteId).matterNo(sheetMatterEntity.getMatterNo()), context);
if (count == 0) {
......@@ -161,5 +184,4 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
}
}
\ No newline at end of file
......@@ -87,21 +87,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
if ("%%".equals(query.getMatterFullName()) || "%null%".equals(query.getMatterFullName())) {
return;
}
//添加更新热门词汇
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);
hotwordEntity.setSiteId(query.getSiteId());
hotwordService.save(hotwordEntity, context);
} else {
//更新
hotwordEntity.setSearchCount(1 + hotwordEntity.getSearchCount());
hotwordService.update(hotwordEntity, context);
}
super.doListBefore(query, model, context);
}
......
......@@ -76,28 +76,7 @@ public class MatterDatumController extends BaseCRUDJsonBodyMappingController<Mat
@Override
protected void doListBefore(MatterDatumEntity query, Map<String, Object> model, Context context) throws AppException {
if (StringUtils.isNotEmpty(query.getMateriaFullName())) {
query.setMatterName("%".concat(query.getMateriaFullName()).concat("%"));
//添加更新热门词汇
HotwordEntity hotwordEntity = hotwordService.selectOne(new HotwordQuery().siteId(query.getSiteId()).hotwords(query.getMateriaFullName()), context);
if (ObjectUtils.isEmpty(hotwordEntity)) {
//新增
hotwordEntity = new HotwordEntity();
hotwordEntity.initAttrValue();
hotwordEntity.setSiteId(query.getSiteId());
hotwordEntity.setHotwords(query.getMateriaFullName());
hotwordEntity.setSearchCount(1);
hotwordEntity.setCreateTime(new Date());
hotwordEntity.setCreateUserId(this.service.getContextUserId(context));
hotwordService.save(hotwordEntity, context);
} else {
//更新
hotwordEntity.setSearchCount(1 + hotwordEntity.getSearchCount());
hotwordEntity.setUpdateTime(new Date());
hotwordService.update(hotwordEntity, context);
}
}
List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("isRecommend", OrderCol.DESCENDING));
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING));
......
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