Commit 7d53a617 authored by 鲁鸿波's avatar 鲁鸿波

首页天气修改(用户线下培训使用)

parent 126046a4
......@@ -11,6 +11,8 @@ import java.util.List;
public interface WeatherDao extends SuperDao<WeatherDomain> {
List<WeatherWarnInfoVO> getInfoByList(@Param("list") List<String> codeList);
List<WeatherWarnInfoVO> getInfoByListTemp(@Param("list") List<String> codeList);
String selectDirct(@Param("code") String code);
/**
......
......@@ -17,6 +17,7 @@ import com.testor.module.mq.dao.WeatherDao;
import com.testor.module.mq.domain.OrganizationEntity;
import com.testor.module.mq.domain.WeatherDomain;
import com.testor.module.mq.service.WeatherService;
import com.testor.module.mq.util.RandomCity;
import com.testor.module.mq.vo.WeatherDetailInfoVO;
import com.testor.module.mq.vo.WeatherWarnInfoVO;
import com.testor.module.sys.model.domian.NewSysOrg;
......@@ -68,17 +69,25 @@ public class WeatherServiceImpl extends SuperServiceImpl<WeatherDao, WeatherDoma
return new ArrayList<>();
}
List<WeatherWarnInfoVO> warnInfoVOList = this.baseMapper.getInfoByList(cityCodeList);
//List<WeatherWarnInfoVO> warnInfoVOList = this.baseMapper.getInfoByList(cityCodeList);
//临时修改,培训使用
List<WeatherWarnInfoVO> warnInfoVOList = this.baseMapper.getInfoByListTemp(cityCodeList);
if (CollectionUtils.isEmpty(warnInfoVOList)) {
return new ArrayList<>();
}
RandomCity randomCity = new RandomCity();
for (WeatherWarnInfoVO weatherWarnInfoVO : warnInfoVOList) {
if (weatherWarnInfoVO != null){
//根据编码查询预警内容
String info = this.baseMapper.selectDirct(weatherWarnInfoVO.getCode());
//查询当前区县所在的市
String araInfo = getMessageInfo(weatherWarnInfoVO.getAreaCode());
String resultMessage = araInfo + "发布" + info;
/*String araInfo = getMessageInfo(weatherWarnInfoVO.getAreaCode());
String resultMessage = araInfo + "发布" + info;*/
//临时修改,培训使用
String resultMessage =randomCity.getRandomCity()+ "发布" + info;
weatherWarnInfoVO.setWarnMessage(resultMessage);
}
}
......
package com.testor.module.mq.util;
import com.testor.module.mq.vo.WeatherWarnInfoVO;
import java.util.Random;
public class RandomCity {
// 在类中添加市名数组
private static final String[] CITIES = {
"北京", "上海", "天津", "重庆",
"石家庄", "太原", "呼和浩特", "沈阳", "长春", "哈尔滨",
"南京", "杭州", "合肥", "福州", "南昌", "济南",
"郑州", "武汉", "长沙", "广州", "南宁", "海口",
"成都", "贵阳", "昆明", "拉萨", "西安", "兰州",
"西宁", "银川", "乌鲁木齐"
};
// 添加随机市名生成方法
public String getRandomCity() {
Random random = new Random();
return CITIES[random.nextInt(CITIES.length)];
}
}
......@@ -18,6 +18,13 @@
order by record_time desc
</select>
<select id="getInfoByListTemp" parameterType="java.lang.String" resultType="com.testor.module.mq.vo.WeatherWarnInfoVO">
select id, signal_type_code as code,record_time as warnTime,sender,signal_level_code as colorMsg,sender_area_code as
areaCode from t_weather_notice
order by record_time desc
limit 50
</select>
<select id="selectDirct" resultType="java.lang.String">
select message
......
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