|
@@ -1,16 +1,5 @@
|
|
|
package com.ym.mec.cms.service.impl;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
|
|
|
import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
|
|
@@ -23,7 +12,10 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
-import com.ym.mec.web.WebFeignService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNewsInformation> implements SysNewsInformationService {
|
|
@@ -31,29 +23,12 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
|
|
|
@Autowired
|
|
|
private SysNewsInformationDao sysNewsInformationDao;
|
|
|
|
|
|
- @Autowired
|
|
|
- private WebFeignService webFeignService;
|
|
|
-
|
|
|
- @Value("${cms.server.context.path}")
|
|
|
- private String serverContextPath;
|
|
|
-
|
|
|
- private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
- public void setServerContextPath(String serverContextPath) {
|
|
|
- this.serverContextPath = serverContextPath;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public BaseDAO<Long, SysNewsInformation> getDAO() {
|
|
|
return sysNewsInformationDao;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SysNewsInformation> queryByType(Integer type) {
|
|
|
- return sysNewsInformationDao.queryByType(type);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public boolean deleteWithLogical(Long id) {
|
|
|
sysNewsInformationDao.deleteWithLogical(id);
|
|
|
return true;
|
|
@@ -82,37 +57,6 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
|
|
|
queryInfo.setMemo(null);
|
|
|
}
|
|
|
PageInfo<SysNewsInformation> pageInfos = queryHomePage(queryInfo);
|
|
|
-
|
|
|
- /*boolean isNewer = false;
|
|
|
- Date date = new Date();
|
|
|
- Date startDate = queryInfo.getDate();
|
|
|
- Date endDate = null;
|
|
|
- if (startDate == null) {
|
|
|
- try {
|
|
|
- String startDateStr = "2020-05-01";
|
|
|
- startDate = sdf.parse(startDateStr);
|
|
|
- endDate = sdf.parse("2021-02-01");
|
|
|
- } catch (ParseException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- }
|
|
|
- if (queryInfo.getTenantId() == 1 && date.after(startDate) && date.before(endDate)) {
|
|
|
- if (user != null && "18696158274".equals(user.getPhone()) == false) {
|
|
|
- isNewer = webFeignService.isPurchasedPracticeCourse(user.getId()) == false;
|
|
|
- SysNewsInformation info = new SysNewsInformation();
|
|
|
- info.setOrder(1);
|
|
|
- info.setCreateTime(date);
|
|
|
- info.setUpdateTime(date);
|
|
|
- if (isNewer) {
|
|
|
- info.setLinkUrl(serverContextPath + "/#/auditionActive");
|
|
|
- info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/3_1.png");
|
|
|
- } else {
|
|
|
- info.setLinkUrl(serverContextPath + "/#/auditionActive");
|
|
|
- info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/3_2.png");
|
|
|
- }
|
|
|
- pageInfos.getRows().add(info);
|
|
|
- }
|
|
|
- }*/
|
|
|
homeList.put("banner",pageInfos);
|
|
|
|
|
|
queryInfo.setMemo(null);
|
|
@@ -154,7 +98,7 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
|
|
|
dataList = sysNewsInformationDao.queryHomePage(params);
|
|
|
}
|
|
|
if (count == 0) {
|
|
|
- dataList = new ArrayList<SysNewsInformation>();
|
|
|
+ dataList = new ArrayList<>();
|
|
|
}
|
|
|
pageInfo.setRows(dataList);
|
|
|
return pageInfo;
|