修改了一些BUG
parent
389e6e3e18
commit
8779081d62
|
|
@ -1,8 +1,11 @@
|
||||||
package com.gunshi.project.hsz.common.mapper;
|
package com.gunshi.project.hsz.common.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
import com.gunshi.project.hsz.common.model.StRiverR;
|
import com.gunshi.project.hsz.common.model.StRiverR;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述:
|
* 描述:
|
||||||
|
|
@ -12,4 +15,25 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface StRiverRMapper extends BaseMapper<StRiverR> {
|
public interface StRiverRMapper extends BaseMapper<StRiverR> {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select * from st_river_r t1
|
||||||
|
where 1=1
|
||||||
|
<if test="stcd != null and stcd != ''">
|
||||||
|
and t1.stcd = #{stcd}
|
||||||
|
</if>
|
||||||
|
<if test="obj != null">
|
||||||
|
<if test="obj.start != null">
|
||||||
|
and t1.tm >= #{obj.start}
|
||||||
|
</if>
|
||||||
|
<if test="obj.end != null">
|
||||||
|
and t1.tm <= #{obj.end}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
order by t1.tm desc
|
||||||
|
limit 1
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
StRiverR queryByOneByTimeRange(@Param("stcd") String stcd, @Param("obj") DateTimeRangeSo dateTimeRangeSo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Tag(name = "白蚁监测数据")
|
//@Tag(name = "白蚁监测数据")
|
||||||
@RestController
|
//@RestController
|
||||||
@RequestMapping(value="/termite/survey")
|
//@RequestMapping(value="/termite/survey")
|
||||||
public class JcskByRController {
|
public class JcskByRController {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import com.gunshi.project.hsz.service.*;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
@ -158,4 +159,10 @@ public class ReservoirWaterController {
|
||||||
}
|
}
|
||||||
return R.ok(detail);
|
return R.ok(detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Post(path = "/listV3",summary = "获取溢洪道水位站")
|
||||||
|
public R<List<AttResBaseVo>> listV3(){
|
||||||
|
return R.ok(reservoirWaterService.listV3());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,7 @@ public class SzRegulatoryFrameworkController extends AbstractCommonFileControlle
|
||||||
|
|
||||||
dto.setCreateTime(new Date());
|
dto.setCreateTime(new Date());
|
||||||
dto.setId(IdWorker.getId());
|
dto.setId(IdWorker.getId());
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(dto.getFiles())){
|
|
||||||
dto.setUploadDate(new Date());
|
dto.setUploadDate(new Date());
|
||||||
}
|
|
||||||
boolean result = service.save(dto);
|
boolean result = service.save(dto);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -77,10 +74,6 @@ public class SzRegulatoryFrameworkController extends AbstractCommonFileControlle
|
||||||
.count() > 0) {
|
.count() > 0) {
|
||||||
throw new IllegalArgumentException("当前名称已存在");
|
throw new IllegalArgumentException("当前名称已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(dto.getFiles())){
|
|
||||||
dto.setUploadDate(new Date());
|
|
||||||
}
|
|
||||||
dto.setCreateBy(null);
|
dto.setCreateBy(null);
|
||||||
dto.setCreateName(null);
|
dto.setCreateName(null);
|
||||||
dto.setUpdateTime(new Date());
|
dto.setUpdateTime(new Date());
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import com.gunshi.project.hsz.common.validate.markers.Insert;
|
||||||
import com.gunshi.project.hsz.common.validate.markers.Update;
|
import com.gunshi.project.hsz.common.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
@ -27,9 +28,9 @@ import java.util.stream.Collectors;
|
||||||
* author: xusan
|
* author: xusan
|
||||||
* date: 2024-08-28 10:29:58
|
* date: 2024-08-28 10:29:58
|
||||||
*/
|
*/
|
||||||
//@Tag(name = "白蚁普查")
|
@Tag(name = "白蚁普查")
|
||||||
//@RestController
|
@RestController
|
||||||
//@RequestMapping(value="/termite/survey")
|
@RequestMapping(value="/termite/survey")
|
||||||
public class TermiteSurveyController extends AbstractCommonFileController{
|
public class TermiteSurveyController extends AbstractCommonFileController{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,6 @@ public class WaterDispatchController extends AbstractCommonFileController {
|
||||||
@Operation(summary = "反馈")
|
@Operation(summary = "反馈")
|
||||||
@PostMapping("/feedback")
|
@PostMapping("/feedback")
|
||||||
public R<WaterDispatch> feedback(@RequestBody WaterDispatch dto, HttpServletRequest request) {
|
public R<WaterDispatch> feedback(@RequestBody WaterDispatch dto, HttpServletRequest request) {
|
||||||
SessionUser sessionUser = checkLogin(request);
|
|
||||||
if(sessionUser != null){
|
|
||||||
dto.setResPerson(sessionUser.getUserId().toString());
|
|
||||||
dto.setResPersonName(sessionUser.getUserName());
|
|
||||||
}
|
|
||||||
boolean flag = waterDispatchService.feedBack(dto);
|
boolean flag = waterDispatchService.feedBack(dto);
|
||||||
if(flag){
|
if(flag){
|
||||||
fileService.saveFile(dto.getResFiles(),getResGroupId(),dto.getId().toString());
|
fileService.saveFile(dto.getResFiles(),getResGroupId(),dto.getId().toString());
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ public class WaterAlarmPageSo {
|
||||||
@Schema(description = "告警类型")
|
@Schema(description = "告警类型")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "测点名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
@Schema(description="告警时间段")
|
@Schema(description="告警时间段")
|
||||||
private DateTimeRangeSo timeRangeSo;
|
private DateTimeRangeSo timeRangeSo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.gunshi.project.hsz.entity.vo;
|
package com.gunshi.project.hsz.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.project.hsz.common.model.JcskByR;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -39,4 +40,5 @@ public class HomeWarnVo {
|
||||||
|
|
||||||
@Schema(description="AI告警个数")
|
@Schema(description="AI告警个数")
|
||||||
private Long aiWarnCount;
|
private Long aiWarnCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,15 +125,16 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
||||||
<script>
|
<script>
|
||||||
select
|
select
|
||||||
<if test="type == 1 ">
|
<if test="type == 1 ">
|
||||||
t.z from public.st_river_r t
|
min(t.z) from public.st_river_r t
|
||||||
</if>
|
</if>
|
||||||
<if test="type == 2">
|
<if test="type == 2">
|
||||||
t.rz from public.st_rsvr_r t
|
min(t.rz) from public.st_rsvr_r t
|
||||||
</if>
|
</if>
|
||||||
where t.stcd = #{stcd} and t.tm = #{dateTime}
|
where t.stcd = #{stcd}
|
||||||
|
and t.tm <![CDATA[>=]]> #{dateTime} and t.tm <![CDATA[<=]]> #{nowTime}
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
BigDecimal oldRz(@Param("stcd") String stcd,@Param("type") Integer type, @Param("dateTime") Date dateTime);
|
BigDecimal oldRz(@Param("stcd") String stcd,@Param("type") Integer type, @Param("dateTime") Date dateTime,@Param("nowTime") Date nowTime);
|
||||||
|
|
||||||
@Select("""
|
@Select("""
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -306,4 +307,11 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
||||||
""")
|
""")
|
||||||
List<String> getRiverStcd();
|
List<String> getRiverStcd();
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
select t1.stcd,t1.stnm,t1.lgtd lgtd,t1lttd lttd,t1source,t1.sttp,t1.stlc,t1.adcd,t1.esstym, from st_stbprp_b t1
|
||||||
|
join st_stbprp_b_elem t2 on t1.stcd = t2.stcd
|
||||||
|
where t1.stcd = #{stcd}
|
||||||
|
""")
|
||||||
|
List<AttResBaseVo> queryYhd(@Param("stcd") String stcd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.gunshi.project.hsz.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.project.hsz.model.StWaterFlow;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StWaterFlowMapper extends BaseMapper<StWaterFlow> {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
select * from st_water_flow t1
|
||||||
|
where t1.stcd = #{stcd}
|
||||||
|
order by t1.z asc
|
||||||
|
""")
|
||||||
|
List<StWaterFlow> selectListByStcd(@Param("stcd") String stcd);
|
||||||
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ public class MentencePlan {
|
||||||
@Schema(description = "审批人id")
|
@Schema(description = "审批人id")
|
||||||
private String approvePersonId;
|
private String approvePersonId;
|
||||||
|
|
||||||
@TableField("approve_person_name")
|
@TableField(exist = false)
|
||||||
@Schema(description = "审批人名称")
|
@Schema(description = "审批人名称")
|
||||||
private String approvePersonName;
|
private String approvePersonName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.gunshi.project.hsz.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StWaterFlow {
|
||||||
|
|
||||||
|
@TableField("stcd")
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField("z")
|
||||||
|
private BigDecimal z;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField("flow")
|
||||||
|
private BigDecimal flow;
|
||||||
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ public class WaterDispatch {
|
||||||
/**
|
/**
|
||||||
* 执行人员名称
|
* 执行人员名称
|
||||||
*/
|
*/
|
||||||
@TableField("exe_person_name")
|
@TableField(exist = false)
|
||||||
@Schema(description = "执行人员名称")
|
@Schema(description = "执行人员名称")
|
||||||
private String exePersonName;
|
private String exePersonName;
|
||||||
|
|
||||||
|
|
@ -109,9 +109,9 @@ public class WaterDispatch {
|
||||||
@Schema(description = "执行结果反馈")
|
@Schema(description = "执行结果反馈")
|
||||||
private String resFb;
|
private String resFb;
|
||||||
|
|
||||||
@TableField("res_person")
|
@TableField("res_person_id")
|
||||||
@Schema(description = "反馈人员id")
|
@Schema(description = "反馈人员id")
|
||||||
private String resPerson;
|
private String resPersonId;
|
||||||
|
|
||||||
@TableField("res_person_name")
|
@TableField("res_person_name")
|
||||||
@Schema(description = "反馈人员名称")
|
@Schema(description = "反馈人员名称")
|
||||||
|
|
|
||||||
|
|
@ -219,12 +219,24 @@ public class RainBasinDivisionService {
|
||||||
StPptnDetailsVo stPptnDetailsVo = new StPptnDetailsVo();
|
StPptnDetailsVo stPptnDetailsVo = new StPptnDetailsVo();
|
||||||
if (stPptnRReal != null){
|
if (stPptnRReal != null){
|
||||||
BeanUtil.copyProperties(stPptnRReal, stPptnDetailsVo);
|
BeanUtil.copyProperties(stPptnRReal, stPptnDetailsVo);
|
||||||
|
Date tm = stPptnRReal.getTm();
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
LocalDateTime latestTime = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
|
|
||||||
|
boolean isToday = latestTime.toLocalDate().equals(nowTime.toLocalDate());
|
||||||
|
|
||||||
|
if(!isToday){
|
||||||
|
stPptnDetailsVo.setH1(null);
|
||||||
|
stPptnDetailsVo.setH3(null);
|
||||||
|
stPptnDetailsVo.setH6(null);
|
||||||
|
stPptnDetailsVo.setH12(null);
|
||||||
|
stPptnDetailsVo.setH24(null);
|
||||||
|
stPptnDetailsVo.setH48(null);
|
||||||
|
stPptnDetailsVo.setDrp(null);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
stPptnDetailsVo.setStcd(stcd);
|
stPptnDetailsVo.setStcd(stcd);
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal value0 = new BigDecimal(0);
|
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
||||||
// //48小时降雨量
|
// //48小时降雨量
|
||||||
|
|
@ -246,7 +258,7 @@ public class RainBasinDivisionService {
|
||||||
//昨日雨量
|
//昨日雨量
|
||||||
BigDecimal yesterdayDrp = queryYesterdayDrpByStcdAndTime(stcd, date);
|
BigDecimal yesterdayDrp = queryYesterdayDrpByStcdAndTime(stcd, date);
|
||||||
if (yesterdayDrp == null) {
|
if (yesterdayDrp == null) {
|
||||||
stPptnDetailsVo.setYesterdayDrp(value0);
|
stPptnDetailsVo.setYesterdayDrp(null);
|
||||||
} else {
|
} else {
|
||||||
stPptnDetailsVo.setYesterdayDrp(yesterdayDrp);
|
stPptnDetailsVo.setYesterdayDrp(yesterdayDrp);
|
||||||
}
|
}
|
||||||
|
|
@ -254,7 +266,7 @@ public class RainBasinDivisionService {
|
||||||
//本月降雨量
|
//本月降雨量
|
||||||
BigDecimal monthDay = queryMonthDrpByStcdAndTime(stcd, date);
|
BigDecimal monthDay = queryMonthDrpByStcdAndTime(stcd, date);
|
||||||
if (monthDay == null) {
|
if (monthDay == null) {
|
||||||
stPptnDetailsVo.setMonthDrp(value0);
|
stPptnDetailsVo.setMonthDrp(null);
|
||||||
} else {
|
} else {
|
||||||
stPptnDetailsVo.setMonthDrp(monthDay);
|
stPptnDetailsVo.setMonthDrp(monthDay);
|
||||||
}
|
}
|
||||||
|
|
@ -262,7 +274,7 @@ public class RainBasinDivisionService {
|
||||||
//本年降雨量
|
//本年降雨量
|
||||||
BigDecimal yearDrp = queryYearDrpByStcdAndTime(stcd, date);
|
BigDecimal yearDrp = queryYearDrpByStcdAndTime(stcd, date);
|
||||||
if (yearDrp == null) {
|
if (yearDrp == null) {
|
||||||
stPptnDetailsVo.setYearDrp(value0);
|
stPptnDetailsVo.setYearDrp(null);
|
||||||
} else {
|
} else {
|
||||||
stPptnDetailsVo.setYearDrp(yearDrp);
|
stPptnDetailsVo.setYearDrp(yearDrp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -300,14 +300,24 @@ public class ReservoirWaterService {
|
||||||
Date tm = monitorVo.getTm();
|
Date tm = monitorVo.getTm();
|
||||||
BigDecimal rz = monitorVo.getRz();
|
BigDecimal rz = monitorVo.getRz();
|
||||||
|
|
||||||
|
// 判断最新水位时间是否是今天
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
LocalDateTime latestTime = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
|
|
||||||
|
boolean isToday = latestTime.toLocalDate().equals(nowTime.toLocalDate());
|
||||||
|
if(isToday){
|
||||||
//最新水位时间往前推24小时水位
|
//最新水位时间往前推24小时水位
|
||||||
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
LocalDateTime dateTime = now.minusDays(1);
|
LocalDateTime dateTime = now.minusDays(1);
|
||||||
BigDecimal oldRz = attResBaseMapper.oldRz(stcd,2,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
BigDecimal oldRz = attResBaseMapper.oldRz(stcd,2,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()),Date.from(now.atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
|
||||||
if(oldRz != null){
|
if(oldRz != null){
|
||||||
vo.setRzDiff(rz.subtract(oldRz));
|
vo.setRzDiff(rz.subtract(oldRz));
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
vo.setRzDiff(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//本年最高水位
|
//本年最高水位
|
||||||
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
||||||
|
|
@ -365,4 +375,10 @@ public class ReservoirWaterService {
|
||||||
}
|
}
|
||||||
return rzData;
|
return rzData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AttResBaseVo> listV3() {
|
||||||
|
String stcd = "9999";
|
||||||
|
List<AttResBaseVo> voList = attResBaseMapper.queryYhd(stcd);
|
||||||
|
return voList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -242,15 +242,26 @@ public class RiverWaterService {
|
||||||
Date tm = monitorVo.getTm();
|
Date tm = monitorVo.getTm();
|
||||||
BigDecimal rz = monitorVo.getZ();
|
BigDecimal rz = monitorVo.getZ();
|
||||||
|
|
||||||
|
// 判断最新水位时间是否是今天
|
||||||
|
LocalDateTime nowTime = LocalDateTime.now();
|
||||||
|
LocalDateTime latestTime = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
|
|
||||||
|
// 检查是否同一天(年、月、日相同)
|
||||||
|
boolean isToday = latestTime.toLocalDate().equals(nowTime.toLocalDate());
|
||||||
|
|
||||||
|
if(isToday){
|
||||||
//最新水位时间往前推24小时水位
|
//最新水位时间往前推24小时水位
|
||||||
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
LocalDateTime dateTime = now.minusDays(1);
|
LocalDateTime dateTime = now.minusDays(1);
|
||||||
BigDecimal oldRz = attRvBaseMapper.oldRz(stcd,1,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
BigDecimal oldRz = attRvBaseMapper.oldRz(stcd,1,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()),Date.from(now.atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
|
||||||
if(oldRz != null){
|
if(oldRz != null){
|
||||||
//设置水位涨跌情况
|
|
||||||
vo.setRzDiff(rz.subtract(oldRz));
|
vo.setRzDiff(rz.subtract(oldRz));
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
vo.setRzDiff(null);
|
||||||
|
}
|
||||||
|
|
||||||
//本年最高水位
|
//本年最高水位
|
||||||
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
||||||
vo.setMaxRz(maxYearRz);
|
vo.setMaxRz(maxYearRz);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
|
import com.gunshi.project.hsz.common.model.JcskByR;
|
||||||
|
import com.gunshi.project.hsz.common.model.StRiverR;
|
||||||
import com.gunshi.project.hsz.common.model.StRiverRReal;
|
import com.gunshi.project.hsz.common.model.StRiverRReal;
|
||||||
import com.gunshi.project.hsz.entity.vo.*;
|
import com.gunshi.project.hsz.entity.vo.*;
|
||||||
import com.gunshi.project.hsz.mapper.AttResBaseMapper;
|
import com.gunshi.project.hsz.mapper.AttResBaseMapper;
|
||||||
|
|
@ -22,6 +24,7 @@ import org.apache.http.entity.ContentType;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -62,6 +65,16 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
@Resource
|
@Resource
|
||||||
private StRiverRRealService stRiverRRealService;
|
private StRiverRRealService stRiverRRealService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StRiverRService stRiverRService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISCAIEventService iscaiEventService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private JcskByRService jcskByRService;
|
||||||
|
|
||||||
public HomeWarnVo homeWarn(DateTimeRangeSo dateTimeRangeSo) {
|
public HomeWarnVo homeWarn(DateTimeRangeSo dateTimeRangeSo) {
|
||||||
HomeWarnVo vo = new HomeWarnVo();
|
HomeWarnVo vo = new HomeWarnVo();
|
||||||
|
|
||||||
|
|
@ -98,25 +111,26 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
vo.setPressWarn(warnVos.stream().filter(o -> o.getType() == 1).collect(Collectors.toList()));
|
vo.setPressWarn(warnVos.stream().filter(o -> o.getType() == 1).collect(Collectors.toList()));
|
||||||
vo.setFlowWarn(warnVos.stream().filter(o -> o.getType() == 2).collect(Collectors.toList()));
|
vo.setFlowWarn(warnVos.stream().filter(o -> o.getType() == 2).collect(Collectors.toList()));
|
||||||
vo.setShiftWarn(warnVos.stream().filter(o -> o.getType() == 3).collect(Collectors.toList()));
|
vo.setShiftWarn(warnVos.stream().filter(o -> o.getType() == 3).collect(Collectors.toList()));
|
||||||
|
Long aiWarnCount = iscaiEventService.lambdaQuery()
|
||||||
Long aiWarnCount = imgWarnRService.lambdaQuery()
|
.ge(ISCAIEvent::getStartTime, dateTimeRangeSo.getStart())
|
||||||
.ge(StImgWarnR::getTm, dateTimeRangeSo.getStart()).lt(StImgWarnR::getTm, dateTimeRangeSo.getEnd()).count();
|
.le(ISCAIEvent::getStartTime,dateTimeRangeSo.getEnd())
|
||||||
|
.count();
|
||||||
vo.setAiWarnCount(aiWarnCount);
|
vo.setAiWarnCount(aiWarnCount);
|
||||||
|
|
||||||
//TODO 超河道上游
|
//TODO 超河道上游
|
||||||
String upperStcd = "123";//固定的站点编码
|
String upperStcd = "123";//固定的站点编码
|
||||||
setUpAndDownOverRvUp(upperStcd,vo);
|
setUpAndDownOverRvUp(upperStcd,vo,dateTimeRangeSo);
|
||||||
|
|
||||||
//TODO 超河道下游
|
//TODO 超河道下游
|
||||||
String lowerStcd = "61610700";//固定的站点编码
|
String lowerStcd = "61610700";//固定的站点编码
|
||||||
setUpAndDownOverRvDown(lowerStcd,vo);
|
setUpAndDownOverRvDown(lowerStcd,vo,dateTimeRangeSo);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpAndDownOverRvUp(String stcd,HomeWarnVo vo){
|
private void setUpAndDownOverRvUp(String stcd, HomeWarnVo vo, DateTimeRangeSo dateTimeRangeSo){
|
||||||
//StRsvrRReal stRsvrRReal = stRsvrRRealService.getBaseMapper().queryRzByStcd(stcd);
|
//StRsvrRReal stRsvrRReal = stRsvrRRealService.getBaseMapper().queryRzByStcd(stcd);
|
||||||
StRiverRReal stRiverRReal = stRiverRRealService.getBaseMapper().queryQByStcd(stcd);
|
//StRiverRReal stRiverRReal = stRiverRRealService.getBaseMapper().queryQByStcd(stcd);
|
||||||
if(stRiverRReal != null){
|
StRiverR stRiverR = stRiverRService.getBaseMapper().queryByOneByTimeRange(stcd,dateTimeRangeSo);
|
||||||
|
if(stRiverR != null){
|
||||||
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
||||||
//警告水位
|
//警告水位
|
||||||
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
||||||
|
|
@ -125,7 +139,7 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
if(alarmSet == null){
|
if(alarmSet == null){
|
||||||
vo.setOverRvUp("告警设置未配置,请检查");
|
vo.setOverRvUp("告警设置未配置,请检查");
|
||||||
}else{
|
}else{
|
||||||
BigDecimal rz = stRiverRReal.getZ();
|
BigDecimal rz = stRiverR.getZ();
|
||||||
if(rz == null){
|
if(rz == null){
|
||||||
vo.setOverRvUp("无水位数据");
|
vo.setOverRvUp("无水位数据");
|
||||||
return;
|
return;
|
||||||
|
|
@ -139,13 +153,13 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
vo.setOverRvUp("暂无水库水位数据");
|
vo.setOverRvUp("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpAndDownOverRvDown(String stcd,HomeWarnVo vo){
|
private void setUpAndDownOverRvDown(String stcd, HomeWarnVo vo, DateTimeRangeSo dateTimeRangeSo){
|
||||||
StRiverRReal stRiverRReal = stRiverRRealService.getBaseMapper().queryQByStcd(stcd);
|
StRiverR stRiverR = stRiverRService.getBaseMapper().queryByOneByTimeRange(stcd,dateTimeRangeSo);
|
||||||
if(stRiverRReal != null){
|
if(stRiverR != null){
|
||||||
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
||||||
//警告水位
|
//警告水位
|
||||||
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
||||||
|
|
@ -155,7 +169,7 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
vo.setOverRvDown("告警设置未配置,请检查");
|
vo.setOverRvDown("告警设置未配置,请检查");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
BigDecimal rz = stRiverRReal.getZ();
|
BigDecimal rz = stRiverR.getZ();
|
||||||
if(rz == null){
|
if(rz == null){
|
||||||
vo.setOverRvUp("无水位数据");
|
vo.setOverRvUp("无水位数据");
|
||||||
return;
|
return;
|
||||||
|
|
@ -169,7 +183,7 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
vo.setOverRvDown("暂无水库水位数据");
|
vo.setOverRvDown("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ import com.gunshi.project.hsz.entity.so.HomeStStbprpBSo;
|
||||||
import com.gunshi.project.hsz.entity.vo.*;
|
import com.gunshi.project.hsz.entity.vo.*;
|
||||||
import com.gunshi.project.hsz.mapper.OsmoticPressRMapper;
|
import com.gunshi.project.hsz.mapper.OsmoticPressRMapper;
|
||||||
import com.gunshi.project.hsz.mapper.OsmoticShiftRMapper;
|
import com.gunshi.project.hsz.mapper.OsmoticShiftRMapper;
|
||||||
|
import com.gunshi.project.hsz.mapper.StWaterFlowMapper;
|
||||||
import com.gunshi.project.hsz.mapper.StbprpBVoMapper;
|
import com.gunshi.project.hsz.mapper.StbprpBVoMapper;
|
||||||
import com.gunshi.project.hsz.common.model.StRsvrR;
|
import com.gunshi.project.hsz.common.model.StRsvrR;
|
||||||
|
import com.gunshi.project.hsz.model.StWaterFlow;
|
||||||
import com.gunshi.project.hsz.model.StZqrlB;
|
import com.gunshi.project.hsz.model.StZqrlB;
|
||||||
import com.gunshi.project.hsz.model.StZvarlB;
|
import com.gunshi.project.hsz.model.StZvarlB;
|
||||||
import com.gunshi.project.hsz.util.DateUtil;
|
import com.gunshi.project.hsz.util.DateUtil;
|
||||||
|
|
@ -61,6 +63,9 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StbprpBVoMapper stbprpBVoMapper;
|
private StbprpBVoMapper stbprpBVoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StWaterFlowMapper stWaterFlowMapper;
|
||||||
|
|
||||||
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
||||||
return stbprpBVoMapper.rainfallStationDetailsList(dto);
|
return stbprpBVoMapper.rainfallStationDetailsList(dto);
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +130,7 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
vo.setTm(o.getTm());
|
vo.setTm(o.getTm());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
|
//视频点
|
||||||
for (StStatusVo vo : list) {
|
for (StStatusVo vo : list) {
|
||||||
String tm = vo.getTm();
|
String tm = vo.getTm();
|
||||||
if (StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24) {
|
if (StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24) {
|
||||||
|
|
@ -242,6 +247,9 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
List<StZqrlB> zqrlList = stZqrlBService.list();
|
List<StZqrlB> zqrlList = stZqrlBService.list();
|
||||||
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
||||||
|
|
||||||
|
//获取水位-溢洪量关系
|
||||||
|
List<StWaterFlow> stWaterFlows = stWaterFlowMapper.selectListByStcd(stcd.toString());
|
||||||
|
|
||||||
List<RsvrComplexVo> complexList = new ArrayList<>();
|
List<RsvrComplexVo> complexList = new ArrayList<>();
|
||||||
BigDecimal maxYearSv = BigDecimal.ZERO;
|
BigDecimal maxYearSv = BigDecimal.ZERO;
|
||||||
Date maxQStartTime = null;
|
Date maxQStartTime = null;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.gunshi.project.hsz.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.hsz.mapper.StEvpoMapper;
|
||||||
|
import com.gunshi.project.hsz.mapper.StWaterFlowMapper;
|
||||||
|
import com.gunshi.project.hsz.model.StEvpo;
|
||||||
|
import com.gunshi.project.hsz.model.StWaterFlow;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class StWaterFlowSerivce extends ServiceImpl<StWaterFlowMapper, StWaterFlow> {
|
||||||
|
}
|
||||||
|
|
@ -228,6 +228,9 @@ public class StZqrlBService extends ServiceImpl<StZqrlBMapper, StZqrlB> {
|
||||||
*/
|
*/
|
||||||
public BigDecimal getFlowQSum(List<RsvrComplexVo> complexList) {
|
public BigDecimal getFlowQSum(List<RsvrComplexVo> complexList) {
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
BigDecimal sum = BigDecimal.ZERO;
|
||||||
|
if(complexList.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
for (int i = 0; i < complexList.size(); i++) {
|
for (int i = 0; i < complexList.size(); i++) {
|
||||||
RsvrComplexVo current = complexList.get(i);
|
RsvrComplexVo current = complexList.get(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||||
|
|
@ -39,6 +40,9 @@ public class WaterAlarmService extends ServiceImpl<WaterAlarmMapper, WaterAlarm>
|
||||||
if(pageSo.getType() != null){
|
if(pageSo.getType() != null){
|
||||||
queryWrapper.eq(WaterAlarm::getAlarmType,pageSo.getType());
|
queryWrapper.eq(WaterAlarm::getAlarmType,pageSo.getType());
|
||||||
}
|
}
|
||||||
|
if(!StringUtils.isBlank(pageSo.getName())){
|
||||||
|
queryWrapper.like(WaterAlarm::getStnm,pageSo.getName());
|
||||||
|
}
|
||||||
|
|
||||||
if(pageSo.getTimeRangeSo() != null){
|
if(pageSo.getTimeRangeSo() != null){
|
||||||
queryWrapper.between(WaterAlarm::getAlarmTime,pageSo.getTimeRangeSo().getStart(),pageSo.getTimeRangeSo().getEnd());
|
queryWrapper.between(WaterAlarm::getAlarmTime,pageSo.getTimeRangeSo().getStart(),pageSo.getTimeRangeSo().getEnd());
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,6 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
if(Objects.nonNull(one)){
|
if(Objects.nonNull(one)){
|
||||||
throw new IllegalArgumentException("该调度已存在");
|
throw new IllegalArgumentException("该调度已存在");
|
||||||
}
|
}
|
||||||
if(dto.getExePersonId() != null){
|
|
||||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(dto.getExePersonId()));
|
|
||||||
if(sysUser != null){
|
|
||||||
dto.setExePersonName(sysUser.getNickName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
||||||
dto.setExeStatus(2);//状态改为下发中
|
dto.setExeStatus(2);//状态改为下发中
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -71,12 +65,6 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
if(byId == null){
|
if(byId == null){
|
||||||
throw new IllegalArgumentException("抱歉,该调度不存在");
|
throw new IllegalArgumentException("抱歉,该调度不存在");
|
||||||
}
|
}
|
||||||
if(dto.getExePersonId() != null){
|
|
||||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(dto.getExePersonId()));
|
|
||||||
if(sysUser != null){
|
|
||||||
dto.setExePersonName(sysUser.getNickName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
if(dto.getIsDistribute() != null && dto.getIsDistribute() == 0){//如果选择下发
|
||||||
dto.setExeStatus(2);//状态改为下发中
|
dto.setExeStatus(2);//状态改为下发中
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -96,6 +84,20 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
||||||
queryWrapper.eq(WaterDispatch::getExeStatus, pageSo.getStatus());
|
queryWrapper.eq(WaterDispatch::getExeStatus, pageSo.getStatus());
|
||||||
}
|
}
|
||||||
Page<WaterDispatch> waterDispatchPage = baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
Page<WaterDispatch> waterDispatchPage = baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
|
||||||
|
for (WaterDispatch record : waterDispatchPage.getRecords()) {
|
||||||
|
if(record.getExePersonId() != null){
|
||||||
|
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(record.getExePersonId()));
|
||||||
|
if(sysUser != null){
|
||||||
|
record.setExePersonName(sysUser.getNickName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(record.getResPersonId() != null){
|
||||||
|
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(record.getResPersonId()));
|
||||||
|
if(sysUser != null){
|
||||||
|
record.setResPersonName(sysUser.getNickName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return waterDispatchPage;
|
return waterDispatchPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.math.RoundingMode;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -125,8 +126,9 @@ public class SysUserLoginLogController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LambdaQueryWrapper<SysVisitMenuLog> wrapperMenuLog = Wrappers.lambdaQuery(SysVisitMenuLog.class)
|
Date start = DateUtil.convertStringToDate(LocalDate.now().toString() + " 00:00:00");
|
||||||
.eq(SysVisitMenuLog::getCreateTime, new Date());
|
LambdaQueryWrapper<SysVisitMenuLog> wrapperMenuLog = new LambdaQueryWrapper<>();
|
||||||
|
wrapperMenuLog.between(SysVisitMenuLog::getCreateTime,start,new Date());
|
||||||
|
|
||||||
vo.setWeb2Count(0L);
|
vo.setWeb2Count(0L);
|
||||||
vo.setApp2Count(0L);
|
vo.setApp2Count(0L);
|
||||||
|
|
@ -152,38 +154,69 @@ public class SysUserLoginLogController {
|
||||||
|
|
||||||
@Post(path = "/visitCount", summary = "访问用户前十")
|
@Post(path = "/visitCount", summary = "访问用户前十")
|
||||||
public R<VisitCountVo> visitCount(@RequestBody @Validated UserLoginLogSo so) {
|
public R<VisitCountVo> visitCount(@RequestBody @Validated UserLoginLogSo so) {
|
||||||
|
//C N M 的xjm,你妈的写的什么Ghots代码?嗯哼? 你TM自己都不测一下?
|
||||||
List<SysUserLoginLog> logs = thisMapper.getUserLoginLog(so.getStm(), so.getEtm());
|
// List<SysUserLoginLog> logs = thisMapper.getUserLoginLog(so.getStm(), so.getEtm());
|
||||||
|
List<SysVisitMenuLog> logs = thisMenuMapper.getUserVisitLog(so.getStm(), so.getEtm());
|
||||||
VisitCountVo vo = new VisitCountVo();
|
VisitCountVo vo = new VisitCountVo();
|
||||||
if (CollectionUtils.isEmpty(logs)) {
|
if (CollectionUtils.isEmpty(logs)) {
|
||||||
return R.ok(vo);
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
vo.setWebList(logs.stream()
|
vo.setWebList(
|
||||||
|
logs.stream()
|
||||||
.filter(o -> "0".equals(o.getLoginType()))
|
.filter(o -> "0".equals(o.getLoginType()))
|
||||||
.collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
.collect(Collectors.groupingBy(SysVisitMenuLog::getName, Collectors.counting()))
|
||||||
.entrySet().stream()
|
|
||||||
.map(o -> {
|
|
||||||
VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
|
||||||
dataVo.setCount(o.getValue());
|
|
||||||
dataVo.setName(o.getKey());
|
|
||||||
return dataVo;
|
|
||||||
}).collect(Collectors.toList())
|
|
||||||
);
|
|
||||||
vo.setAppList(logs.stream()
|
|
||||||
.filter(o -> "1".equals(o.getLoginType()))
|
|
||||||
.collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
|
||||||
.entrySet().stream()
|
.entrySet().stream()
|
||||||
|
.sorted(Map.Entry.<String, Long>comparingByValue().reversed()) // 按数量降序排序
|
||||||
|
.limit(10) // 取前10名
|
||||||
.map(o -> {
|
.map(o -> {
|
||||||
VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||||
dataVo.setCount(o.getValue());
|
dataVo.setCount(o.getValue());
|
||||||
dataVo.setName(o.getKey());
|
dataVo.setName(o.getKey());
|
||||||
return dataVo;
|
return dataVo;
|
||||||
})
|
})
|
||||||
.limit(10)
|
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
vo.setAppList(
|
||||||
|
logs.stream()
|
||||||
|
.filter(o -> "1".equals(o.getLoginType()))
|
||||||
|
.collect(Collectors.groupingBy(SysVisitMenuLog::getName, Collectors.counting()))
|
||||||
|
.entrySet().stream()
|
||||||
|
.sorted(Map.Entry.<String, Long>comparingByValue().reversed()) // 按数量降序排序
|
||||||
|
.limit(10) // 取前10名
|
||||||
|
.map(o -> {
|
||||||
|
VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||||
|
dataVo.setCount(o.getValue());
|
||||||
|
dataVo.setName(o.getKey());
|
||||||
|
return dataVo;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
// vo.setWebList(logs.stream()
|
||||||
|
// .filter(o -> "0".equals(o.getLoginType()))
|
||||||
|
// .collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
||||||
|
// .entrySet().stream()
|
||||||
|
// .map(o -> {
|
||||||
|
// VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||||
|
// dataVo.setCount(o.getValue());
|
||||||
|
// dataVo.setName(o.getKey());
|
||||||
|
// return dataVo;
|
||||||
|
// }).collect(Collectors.toList())
|
||||||
|
// );
|
||||||
|
// vo.setAppList(logs.stream()
|
||||||
|
// .filter(o -> "1".equals(o.getLoginType()))
|
||||||
|
// .collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
||||||
|
// .entrySet().stream()
|
||||||
|
// .map(o -> {
|
||||||
|
// VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||||
|
// dataVo.setCount(o.getValue());
|
||||||
|
// dataVo.setName(o.getKey());
|
||||||
|
// return dataVo;
|
||||||
|
// })
|
||||||
|
// .limit(10)
|
||||||
|
// .collect(Collectors.toList())
|
||||||
|
//
|
||||||
|
// );
|
||||||
return R.ok(vo);
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.project.hsz.system.model.SysVisitMenuLog;
|
import com.gunshi.project.hsz.system.model.SysVisitMenuLog;
|
||||||
import com.gunshi.project.hsz.system.so.VisitMenuLogPageSo;
|
import com.gunshi.project.hsz.system.so.VisitMenuLogPageSo;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysVisitMenuLogMapper extends BaseMapper<SysVisitMenuLog> {
|
public interface SysVisitMenuLogMapper extends BaseMapper<SysVisitMenuLog> {
|
||||||
|
|
||||||
|
|
@ -20,4 +25,13 @@ public interface SysVisitMenuLogMapper extends BaseMapper<SysVisitMenuLog> {
|
||||||
""")
|
""")
|
||||||
Page<SysVisitMenuLog> pageQuery(Page<Object> page, VisitMenuLogPageSo dto);
|
Page<SysVisitMenuLog> pageQuery(Page<Object> page, VisitMenuLogPageSo dto);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
SELECT su.*,ub.nick_name as name
|
||||||
|
FROM sys_visit_menu_log su LEFT JOIN sys_user ub on su.create_id = ub.user_id
|
||||||
|
WHERE su.create_time between #{stm} and #{etm}
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<SysVisitMenuLog> getUserVisitLog(@Param("stm") Date stm, @Param("etm") Date etm);
|
||||||
}
|
}
|
||||||
|
|
@ -57,4 +57,8 @@ public class SysVisitMenuLog implements Serializable {
|
||||||
@Schema(description="统计数量")
|
@Schema(description="统计数量")
|
||||||
private String count;
|
private String count;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description = "名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue