协议管理接口增加归属协议分布chart接口
parent
8aefdef0ae
commit
ce8bddf61b
|
|
@ -2,12 +2,14 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.mapper.BzProtocolInfoChartMapper;
|
||||
import com.gunshi.project.xyt.model.BzProtocolInfo;
|
||||
import com.gunshi.project.xyt.model.BzProtocolInfoAutoDao;
|
||||
import com.gunshi.project.xyt.service.ProtocolInfoService;
|
||||
import com.gunshi.project.xyt.so.BzProtocolInfoSo;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import com.gunshi.project.xyt.vo.BzProtocolInfoChart1Vo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -15,6 +17,9 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 协议信息控制器接口类
|
||||
|
|
@ -33,6 +38,9 @@ public class BzProtocolInfoController {
|
|||
@Autowired
|
||||
private ProtocolInfoService service;
|
||||
|
||||
@Autowired
|
||||
private BzProtocolInfoChartMapper chartMapper;
|
||||
|
||||
@Operation(summary = "新增协议信息")
|
||||
@PostMapping("/save")
|
||||
public R<Boolean> save(@Validated({Insert.class}) @RequestBody BzProtocolInfo entity) {
|
||||
|
|
@ -65,4 +73,27 @@ public class BzProtocolInfoController {
|
|||
public R<Page<BzProtocolInfo>> page(@Validated @RequestBody BzProtocolInfoSo so) {
|
||||
return R.ok(service.page(so));
|
||||
}
|
||||
|
||||
@Operation(summary = "归属协议分布")
|
||||
@GetMapping("/chart1")
|
||||
public R chart1() {
|
||||
List<BzProtocolInfoChart1Vo> vos = chartMapper.chart1();
|
||||
|
||||
Map<String, Long> protocolCountMap = vos.stream()
|
||||
.collect(Collectors.groupingBy(BzProtocolInfoChart1Vo::getProtocolName, Collectors.counting()));
|
||||
|
||||
return R.ok(protocolCountMap);
|
||||
}
|
||||
|
||||
@Operation(summary = "测站类型分布")
|
||||
@GetMapping("/chart2")
|
||||
public R chart2() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Operation(summary = "测站在线情况")
|
||||
@GetMapping("/chart3")
|
||||
public R chart3() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.gunshi.project.xyt.vo.BzProtocolInfoChart1Vo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类描述
|
||||
*
|
||||
* @author lyf
|
||||
* @version 1.0.0
|
||||
* @since 2024-01-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface BzProtocolInfoChartMapper {
|
||||
|
||||
@Select("""
|
||||
SELECT p.id protocolId,p.name protocolName,b.STCD,b.STNM FROM REL_PROTOCOL_ST_MAPPING ps
|
||||
LEFT JOIN BZ_PROTOCOL_INFO p ON ps.PROTOCOL_ID=p.ID
|
||||
LEFT JOIN ST_STBPRP_B b ON ps.STCD=b.STCD
|
||||
""")
|
||||
List<BzProtocolInfoChart1Vo> chart1();
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类描述
|
||||
*
|
||||
* @author lyf
|
||||
* @version 1.0.0
|
||||
* @since 2024-01-30
|
||||
*/
|
||||
@Data
|
||||
@TableName("REL_PROTOCOL_ST_MAPPING")
|
||||
public class RelProtocolStMapping {
|
||||
@MppMultiId("PROTOCOL_ID")
|
||||
@Schema(description = "协议ID")
|
||||
private String protocolId;
|
||||
|
||||
@MppMultiId("STCD")
|
||||
@Schema(description = "测站编码")
|
||||
private String stcd;
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public class RcvLogUpMockJob {
|
|||
@Autowired
|
||||
private RcvLogUpRAutoDao dao;
|
||||
|
||||
@Scheduled(cron = "0 */1 * * * ?")
|
||||
@Scheduled(cron = "0 */5 * * * ?")
|
||||
public void mock() {
|
||||
RcvLogUpR one = dao.page(new Page<RcvLogUpR>(1,1,1).addOrder(OrderItem.desc("RECEIVE_TM"))).getRecords().getFirst();
|
||||
one.setId(IdWorker.getId());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.gunshi.project.xyt.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 类描述
|
||||
*
|
||||
* @author lyf
|
||||
* @version 1.0.0
|
||||
* @since 2024-01-30
|
||||
*/
|
||||
@Data
|
||||
public class BzProtocolInfoChart1Vo {
|
||||
private String protocolId;
|
||||
private String protocolName;
|
||||
private String stcd;
|
||||
private String stnm;
|
||||
}
|
||||
Loading…
Reference in New Issue