add: 拆分首页国内外标准法规

This commit is contained in:
wxyclub
2023-09-27 17:43:41 +08:00
parent 236079159b
commit f108a5f840
@@ -1,11 +1,9 @@
package com.adc.da.slrs.NewsFeed.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.http.PageInfo;
import com.adc.da.slrs.NewsFeed.entity.NewsFeed;
import com.adc.da.slrs.NewsFeed.page.NewsFeedPage;
import com.adc.da.slrs.NewsFeed.service.Impl.NewsFeedServiceImpl;
import com.adc.da.slrs.msgDynamicInfo.entity.MsgDynamicInfoEO;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -20,7 +18,12 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -42,9 +45,15 @@ public class NewsFeedController extends BaseController<NewsFeed> {
iPage.setCurrent(page.getPage());
iPage.setSize(page.getPageSize());
List<String> list = new ArrayList<>();
if("GNWBZFG".equals(page.getMessageType())){
QueryWrapper<NewsFeed> queryWrapper = new QueryWrapper<>();
if("GNBZFG".equals(page.getMessageType())){
list.add("hc99551723c");
}else if("ZYBZFG".equals(page.getMessageType())){
queryWrapper.eq("RESOURCE_TYPE","INLAND");
}else if ("GWBZFG".equals(page.getMessageType())){
list.add("hc99551723c");
queryWrapper.eq("RESOURCE_TYPE","FOREIGN");
}
else if("ZYBZFG".equals(page.getMessageType())){
list.add("hya6gay4vx");
list.add("8rjsx83ows");
list.add("ncb6osftj8");
@@ -52,7 +61,7 @@ public class NewsFeedController extends BaseController<NewsFeed> {
}else if("QYBZFB".equals(page.getMessageType())){
list.add("6jnqba2mby");
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.isNotEmpty(page.getStandardId()),"STANDARD_ID",page.getStandardId());
queryWrapper.eq(StringUtils.isNotEmpty(page.getStandardName()),"STANDARD_NAME",page.getStandardName());
queryWrapper.eq("MESSAGE_TYPE",page.getMessageType());
@@ -61,6 +70,17 @@ public class NewsFeedController extends BaseController<NewsFeed> {
}
queryWrapper.orderByDesc("RENEW_TIME");
IPage<NewsFeed> newsFeedList = newsFeedService.page(iPage,queryWrapper);
// 标准名称或标准编号后三天之内直接显示(new),修改标准名称
List<NewsFeed> records = newsFeedList.getRecords();
for (NewsFeed record : records) {
LocalDate localDate = LocalDate.now().plusDays(-3);
Instant instant = localDate.atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant();
Date date = Date.from(instant);
if (record.getRenewTime().compareTo(date) >= 0) {
record.setStandardName(record.getStandardName() + "(new)");
}
}
newsFeedList.setRecords(records);
return Result.success(newsFeedList);
}