Merge branch 'main' of http://39.103.203.80:8102/yaowang/kn-vordm
This commit is contained in:
commit
1d4b8c1e9f
|
@ -857,8 +857,72 @@ public class DisasterInfoController {
|
||||||
|
|
||||||
//home页面 受影响国家统计
|
//home页面 受影响国家统计
|
||||||
@GetMapping("/getAffectedCountryCount")
|
@GetMapping("/getAffectedCountryCount")
|
||||||
public R<Integer> getAffectedCountryCount() {
|
public R<Integer> getAffectedCountryCount(@RequestParam Map<String, String> params) {
|
||||||
return R.data(disasterInfoService.getAffectedCountryCount());
|
String dateType = String.valueOf(params.get("dateType"));
|
||||||
|
if (StringUtils.isNotBlank(dateType) && !"4".equals(dateType) && !"null".equals(dateType)) {
|
||||||
|
LocalDate date = LocalDate.now();
|
||||||
|
//如果有时间类型
|
||||||
|
switch (dateType) {
|
||||||
|
case "1":
|
||||||
|
//Latest week 上一周
|
||||||
|
date = LocalDate.now().minusWeeks(1);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
//Latest month 上一个月
|
||||||
|
date = LocalDate.now().minusMonths(1);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
//Latest six month 上3个月
|
||||||
|
date = LocalDate.now().minusMonths(3);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
//Latest six month 上6个月
|
||||||
|
date = LocalDate.now().minusMonths(6);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.data(disasterInfoService.getAffectedCountryCount(params));
|
||||||
|
}
|
||||||
|
|
||||||
|
//home页面 灾害类型数量统计
|
||||||
|
@GetMapping("/getDisasterCountryCount")
|
||||||
|
public R<Integer> getDisasterCountryCount(@RequestParam Map<String, String> params) {
|
||||||
|
String dateType = String.valueOf(params.get("dateType"));
|
||||||
|
if (StringUtils.isNotBlank(dateType) && !"4".equals(dateType) && !"null".equals(dateType)) {
|
||||||
|
LocalDate date = LocalDate.now();
|
||||||
|
//如果有时间类型
|
||||||
|
switch (dateType) {
|
||||||
|
case "1":
|
||||||
|
//Latest week 上一周
|
||||||
|
date = LocalDate.now().minusWeeks(1);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
//Latest month 上一个月
|
||||||
|
date = LocalDate.now().minusMonths(1);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
//Latest six month 上3个月
|
||||||
|
date = LocalDate.now().minusMonths(3);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
//Latest six month 上6个月
|
||||||
|
date = LocalDate.now().minusMonths(6);
|
||||||
|
params.put("startTime",date.toString());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.data(disasterInfoService.getDisasterCountryCount(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,5 +118,7 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
|
||||||
|
|
||||||
void updateApplyForCount(@Param("id") Long id);
|
void updateApplyForCount(@Param("id") Long id);
|
||||||
|
|
||||||
Integer getAffectedCountryCount();
|
Integer getAffectedCountryCount(@Param("params")Map<String, String> params);
|
||||||
|
|
||||||
|
Integer getDisasterCountryCount(@Param("params")Map<String, String> params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1753,6 +1753,46 @@
|
||||||
|
|
||||||
<select id="getAffectedCountryCount" resultType="java.lang.Integer">
|
<select id="getAffectedCountryCount" resultType="java.lang.Integer">
|
||||||
SELECT count(*) FROM
|
SELECT count(*) FROM
|
||||||
(SELECT disaster_country FROM `disaster_info` GROUP BY disaster_country) disaster
|
(SELECT disaster_country FROM `disaster_info`
|
||||||
|
<where>
|
||||||
|
<if test="params.respondStatus!=null and params.respondStatus!=''">
|
||||||
|
and respond_status = #{params.respondStatus}
|
||||||
|
</if>
|
||||||
|
<if test="params.affectedArea!=null and params.affectedArea!=''">
|
||||||
|
and disaster_country = #{params.affectedArea}
|
||||||
|
</if>
|
||||||
|
<if test="params.disasterType!=null and params.disasterType!=''">
|
||||||
|
and disaster_type = #{params.disasterType}
|
||||||
|
</if>
|
||||||
|
<if test="params.startTime!=null and params.startTime!=''">
|
||||||
|
and disaster_time >= #{params.startTime}
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime!=null and params.endTime!=''">
|
||||||
|
and disaster_time <= #{params.endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY disaster_country) disaster
|
||||||
|
</select>
|
||||||
|
<select id="getDisasterCountryCount" resultType="java.lang.Integer">
|
||||||
|
SELECT count(*) FROM
|
||||||
|
(SELECT disaster_type FROM `disaster_info`
|
||||||
|
<where>
|
||||||
|
<if test="params.respondStatus!=null and params.respondStatus!=''">
|
||||||
|
and respond_status = #{params.respondStatus}
|
||||||
|
</if>
|
||||||
|
<if test="params.affectedArea!=null and params.affectedArea!=''">
|
||||||
|
and disaster_country = #{params.affectedArea}
|
||||||
|
</if>
|
||||||
|
<if test="params.disasterType!=null and params.disasterType!=''">
|
||||||
|
and disaster_type = #{params.disasterType}
|
||||||
|
</if>
|
||||||
|
<if test="params.startTime!=null and params.startTime!=''">
|
||||||
|
and disaster_time >= #{params.startTime}
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime!=null and params.endTime!=''">
|
||||||
|
and disaster_time <= #{params.endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY disaster_type) disaster
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -99,5 +99,7 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
|
||||||
|
|
||||||
void updateApplyForCount(Long disasterId);
|
void updateApplyForCount(Long disasterId);
|
||||||
|
|
||||||
Integer getAffectedCountryCount();
|
Integer getAffectedCountryCount(Map<String, String> params);
|
||||||
|
|
||||||
|
Integer getDisasterCountryCount(Map<String, String> params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,12 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getAffectedCountryCount() {
|
public Integer getAffectedCountryCount(Map<String, String> params) {
|
||||||
return baseMapper.getAffectedCountryCount();
|
return baseMapper.getAffectedCountryCount(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getDisasterCountryCount(Map<String, String> params) {
|
||||||
|
return baseMapper.getDisasterCountryCount(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue