소스 검색

bug修改

zouxuan 3 년 전
부모
커밋
c42d525e82

+ 2 - 10
cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java

@@ -1,8 +1,5 @@
 package com.ym.mec.cms.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
@@ -10,14 +7,9 @@ import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
-public interface SysNewsInformationService extends BaseService<Long, SysNewsInformation> {
+import java.util.Map;
 
-	/**
-	 * 根据类型查询资讯列表
-	 * @param type
-	 * @return
-	 */
-	List<SysNewsInformation> queryByType(Integer type);
+public interface SysNewsInformationService extends BaseService<Long, SysNewsInformation> {
 
 	/**
 	 * 逻辑删除

+ 5 - 61
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -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;

+ 2 - 1
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsTypeServiceImpl.java

@@ -61,8 +61,9 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
             }
         });
         List<SysNewsType> treeMenus = all.stream()
-                .filter((e) -> e.getParentId().equals(newsType.getParentId()) || e.getId().equals(id))
+                .filter((e) -> e.getParentId().equals(newsType.getParentId()))
                 .map((menu) -> menu.setChildren(getChildren(menu, all)))
+                .filter(e -> e.getId().equals(id))
                 .collect(Collectors.toList());
         return treeMenus;
     }

+ 2 - 1
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -171,7 +171,8 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
-		SELECT sni.*,GROUP_CONCAT(distinct s.name_) subject_name_,GROUP_CONCAT(distinct o.name_) organ_name_list_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
+		SELECT sni.*,GROUP_CONCAT(distinct s.name_) subject_name_,GROUP_CONCAT(distinct o.name_) organ_name_list_
+		FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
 		left join organization o on find_in_set(o.id_,sni.organ_id_list_)
 		<include refid="queryCondition" />
 		group by sni.id_