xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpCruiseCheckInRuleController.java
@@ -14,6 +14,8 @@ import com.xiaopeng.maintenance.service.IXpCruiseCheckInRuleService; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordQuery; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordVO; import com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsQuery; import com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsVO; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -108,4 +110,11 @@ return R.ok(xpCruiseCheckInRecordVO); } @ApiOperation(value = "巡游打卡统计", tags = {"管理后台-巡游打卡管理"}) @PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/statistic") public R<XpCruiseCheckInRecordVO> pageList(@RequestBody XpCruiseCheckInStatisticsQuery query) { return R.ok(xpCruiseCheckInRecordService.statistics(query)); } } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/mapper/XpCruiseCheckInRecordMapper.java
@@ -5,6 +5,7 @@ import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordQuery; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordVO; import com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsQuery; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -14,4 +15,6 @@ List<XpCruiseCheckInRecordVO> selectCruiseCheckInRecordList(@Param("pageInfo") PageInfo<XpCruiseCheckInRecordVO> pageInfo, @Param("query") XpCruiseCheckInRecordQuery query); XpCruiseCheckInRecordVO detail(Long id); XpCruiseCheckInRecordVO selectCruiseCheckInStatistics(XpCruiseCheckInStatisticsQuery query); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/IXpCruiseCheckInRecordService.java
@@ -5,10 +5,13 @@ import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordQuery; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordVO; import com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsQuery; public interface IXpCruiseCheckInRecordService extends IService<XpCruiseCheckInRecord> { PageInfo<XpCruiseCheckInRecordVO> pageList(XpCruiseCheckInRecordQuery query); XpCruiseCheckInRecordVO detail(Long id); XpCruiseCheckInRecordVO statistics(XpCruiseCheckInStatisticsQuery query); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpCruiseCheckInRecordServiceImpl.java
@@ -7,6 +7,7 @@ import com.xiaopeng.maintenance.service.IXpCruiseCheckInRecordService; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordQuery; import com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordVO; import com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsQuery; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -30,4 +31,9 @@ public XpCruiseCheckInRecordVO detail(Long id) { return xpCruiseCheckInRecordMapper.detail(id); } @Override public XpCruiseCheckInRecordVO statistics(XpCruiseCheckInStatisticsQuery query) { return xpCruiseCheckInRecordMapper.selectCruiseCheckInStatistics(query); } } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/vo/XpCruiseCheckInStatisticsQuery.java
New file @@ -0,0 +1,30 @@ package com.xiaopeng.maintenance.vo; import com.fasterxml.jackson.annotation.JsonFormat; import com.xiaopeng.common.core.web.page.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import java.time.LocalDate; @Data @EqualsAndHashCode(callSuper = true) @ApiModel(value = "巡游打卡记录查询参数") public class XpCruiseCheckInStatisticsQuery extends BasePage { @ApiModelProperty(value = "打卡规则名称(模糊匹配)") private String ruleName; @ApiModelProperty(value = "打卡点位名称(模糊匹配)") private String fleet; @ApiModelProperty(value = "开始日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDate startDate; @ApiModelProperty(value = "结束日期") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDate endDate; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/vo/XpCruiseCheckInStatisticsVO.java
New file @@ -0,0 +1,32 @@ package com.xiaopeng.maintenance.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; @Data @ApiModel(value = "巡游打卡记录返回VO") public class XpCruiseCheckInStatisticsVO implements Serializable { @ApiModelProperty(value = "日期") LocalDate date; @ApiModelProperty(value = "准时次数") private Integer punctual; @ApiModelProperty(value = "迟到次数") private Integer late; @ApiModelProperty(value = "通畅次数") private Integer noTraffic; @ApiModelProperty(value = "堵车次数") private Integer traffic; } xp-robotaxi-maintenance-boot/src/main/resources/mapper/maintenance/XpCruiseCheckInRecordMapper.xml
@@ -18,6 +18,14 @@ <result column="scene_description" property="sceneDescription"/> </resultMap> <resultMap id="CruiseCheckInStatisticsMap" type="com.xiaopeng.maintenance.vo.XpCruiseCheckInStatisticsVO"> <result column="date" property="date"/> <result column="punctual" property="punctual"/> <result column="late" property="late"/> <result column="noTraffic" property="noTraffic"/> <result column="traffic" property="traffic"/> </resultMap> <select id="selectCruiseCheckInRecordList" resultMap="CruiseCheckInRecordVOMap"> SELECT r.id, @@ -91,4 +99,24 @@ AND r.del_flag = '0' </select> <select id="selectCruiseCheckInStatistics" resultMap="CruiseCheckInStatisticsMap"> SELECT DATE(r.check_in_time) AS date, COUNT(CASE WHEN r.check_in_result = 1 THEN 1 END) AS punctual, COUNT(CASE WHEN r.check_in_result = 2 THEN 1 END) AS late, COUNT(CASE WHEN r.field_situation = 1 THEN 1 END) AS noTraffic, COUNT(CASE WHEN r.field_situation = 2 THEN 1 END) AS traffic FROM xp_cruise_check_in_record r WHERE r.del_flag = '0' AND r.check_in_time IS NOT NULL <if test="query.startDate != null"> AND DATE(r.check_in_time) >= #{query.startDate} </if> <if test="query.endDate != null"> AND DATE(r.check_in_time) <= #{query.endDate} </if> GROUP BY DATE(r.check_in_time) ORDER BY date DESC </select> </mapper>