45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
|
|
package com.gunshi.project.xyt.controller;
|
|||
|
|
|
|||
|
|
import com.gunshi.core.annotation.Post;
|
|||
|
|
import com.gunshi.core.result.R;
|
|||
|
|
import com.gunshi.project.xyt.entity.so.RealRainBaseSo;
|
|||
|
|
import com.gunshi.project.xyt.entity.vo.RealRainListVo;
|
|||
|
|
import com.gunshi.project.xyt.service.RealRainService;
|
|||
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
|
|
import lombok.Data;
|
|||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
|
import org.springframework.web.bind.annotation.RestController;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
|
|||
|
|
|
|||
|
|
@RestController
|
|||
|
|
@RequestMapping("/real/rain")
|
|||
|
|
@Tag(name = "降雨信息查询接口")
|
|||
|
|
@Data
|
|||
|
|
public class RealRainController {
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private RealRainService realRainService;
|
|||
|
|
|
|||
|
|
@Post(path="/list", summary = "实时雨情-降雨信息-查询接口")
|
|||
|
|
public R<List<RealRainListVo>> getRealRainList(@RequestBody RealRainBaseSo realRainBaseSo) {
|
|||
|
|
List<RealRainListVo> list = realRainService.getRealRainList(realRainBaseSo);
|
|||
|
|
//按RealRainListVo.drp倒序排列,null的排在最后面
|
|||
|
|
list.sort((o1, o2) -> {
|
|||
|
|
if (o1.getDrp() == null) {
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
if (o2.getDrp() == null) {
|
|||
|
|
return -1;
|
|||
|
|
}
|
|||
|
|
return o2.getDrp().compareTo(o1.getDrp());
|
|||
|
|
});
|
|||
|
|
return R.ok(list);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|