Merge remote-tracking branch 'origin/1.0' into 1.0
| | |
| | | |
| | | import com.xiaopeng.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户收藏地址列表查询参数") |
| | | public class XpUserCollectAddrListQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private Double latitude; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private Double longitude; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("用户收藏地址列表") |
| | | public class XpAppUserCollectAddrVO { |
| | |
| | | |
| | | @ApiModelProperty("展示地址。站点收藏展示点位地址,场站收藏展示代表点位地址") |
| | | private String pointAddress; |
| | | |
| | | |
| | | // 新增字段 |
| | | @ApiModelProperty(value = "区域id") |
| | | private Long electronicAreaId; |
| | | |
| | | @ApiModelProperty(value = "停车时长") |
| | | private Integer time; |
| | | |
| | | |
| | | @ApiModelProperty(value = "距离 米") |
| | | private Double distance; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String endTime; |
| | | |
| | | |
| | | @ApiModelProperty("是否收藏 1是 2否") |
| | | private Integer isCollect=1; |
| | | |
| | | @ApiModelProperty("场站下面的站点") |
| | | private List<XpPointsListVo> children; |
| | | } |
| | |
| | | @ApiModelProperty(value = "活动名称") |
| | | private String acticityName; |
| | | |
| | | private Long couponid; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long operationCouponId; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.xiaopeng.account.mapper.XpAppUserCollectAddrMapper; |
| | | import com.xiaopeng.account.model.dto.CollectAddrDTO; |
| | | import com.xiaopeng.account.model.query.XpUserCollectAddrListQuery; |
| | |
| | | import com.xiaopeng.api.model.account.XpAppUserCollectAddr; |
| | | import com.xiaopeng.api.model.operation.XpPoint; |
| | | import com.xiaopeng.api.model.operation.XpStation; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | public Page<XpAppUserCollectAddrVO> userCollectAddrList(XpUserCollectAddrListQuery query, String uid) { |
| | | Page<XpAppUserCollectAddrVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | Page<XpAppUserCollectAddrVO> pageData = this.baseMapper.userCollectAddrPageList(page, query, Long.parseLong(uid)); |
| | | Set<Long> collectedPointIds = new HashSet<>(getPointIdsByUserId(Long.parseLong(uid))); |
| | | pageData.getRecords().forEach(xpAppUserCollectAddrVO -> { |
| | | if(xpAppUserCollectAddrVO.getItemType() == 1){ |
| | | XpPointExportExcelQuery xpPointExportExcelQuery = new XpPointExportExcelQuery(); |
| | | xpPointExportExcelQuery.setPointIds(Arrays.asList(xpAppUserCollectAddrVO.getPointId())); |
| | | List<XpPoint> data = xpPointClient.getByIds(xpPointExportExcelQuery).getData(); |
| | | if(null != data && data.size() > 0){ |
| | | xpAppUserCollectAddrVO.setPointName(data.get(0).getPointName()); |
| | | xpAppUserCollectAddrVO.setPointAddress(data.get(0).getPointAddress()); |
| | | fillPointInfo(xpAppUserCollectAddrVO, data.get(0), query); |
| | | } |
| | | } |
| | | if(xpAppUserCollectAddrVO.getItemType() == 2){ |
| | | fillCollectPointInfo(xpAppUserCollectAddrVO, query); |
| | | XpStation data = xpStationClient.getXpStationById(xpAppUserCollectAddrVO.getStationId()).getData(); |
| | | if(null != data){ |
| | | xpAppUserCollectAddrVO.setPointName(data.getStationName()); |
| | | } |
| | | xpAppUserCollectAddrVO.setChildren(buildStationChildren(xpAppUserCollectAddrVO.getStationId(), query, collectedPointIds)); |
| | | } |
| | | }); |
| | | |
| | |
| | | return page; |
| | | } |
| | | |
| | | private List<XpPointsListVo> buildStationChildren(Long stationId, XpUserCollectAddrListQuery query, Set<Long> collectedPointIds) { |
| | | if (stationId == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | R<List<XpPointsListVo>> result = xpPointClient.getStationChildren(stationId); |
| | | List<XpPointsListVo> children = result == null ? Collections.emptyList() : result.getData(); |
| | | if (children == null || children.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return children.stream() |
| | | .peek(child -> fillChildInfo(child, query, collectedPointIds)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private void fillChildInfo(XpPointsListVo child, XpUserCollectAddrListQuery query, Set<Long> collectedPointIds) { |
| | | fillChildDistance(child, query); |
| | | if (collectedPointIds.contains(child.getId())) { |
| | | child.setIsCollect(1); |
| | | } |
| | | } |
| | | |
| | | private void fillChildDistance(XpPointsListVo child, XpUserCollectAddrListQuery query) { |
| | | if (query.getLatitude() == null || query.getLongitude() == null || child.getLatitude() == null || child.getLongitude() == null) { |
| | | return; |
| | | } |
| | | double distance = distanceFast(query.getLatitude(), query.getLongitude(), child.getLatitude(), child.getLongitude()); |
| | | child.setDistance(BigDecimal.valueOf(distance).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | |
| | | private void fillCollectPointInfo(XpAppUserCollectAddrVO collectAddrVO, XpUserCollectAddrListQuery query) { |
| | | XpPointExportExcelQuery xpPointExportExcelQuery = new XpPointExportExcelQuery(); |
| | | xpPointExportExcelQuery.setPointIds(Arrays.asList(collectAddrVO.getPointId())); |
| | | List<XpPoint> data = xpPointClient.getByIds(xpPointExportExcelQuery).getData(); |
| | | if (data == null || data.isEmpty()) { |
| | | return; |
| | | } |
| | | fillPointInfo(collectAddrVO, data.get(0), query); |
| | | } |
| | | |
| | | private void fillPointInfo(XpAppUserCollectAddrVO collectAddrVO, XpPoint point, XpUserCollectAddrListQuery query) { |
| | | collectAddrVO.setPointName(point.getPointName()); |
| | | collectAddrVO.setPointAddress(point.getPointAddress()); |
| | | collectAddrVO.setElectronicAreaId(point.getElectronicAreaId()); |
| | | collectAddrVO.setTime(point.getParkingTimeLimit()); |
| | | fillEffectiveTime(collectAddrVO, point.getEffectiveTimePeriod()); |
| | | fillDistance(collectAddrVO, point, query); |
| | | } |
| | | |
| | | private void fillEffectiveTime(XpAppUserCollectAddrVO collectAddrVO, String effectiveTimePeriod) { |
| | | if (effectiveTimePeriod == null || effectiveTimePeriod.isEmpty()) { |
| | | return; |
| | | } |
| | | List<String> timeRanges; |
| | | try { |
| | | timeRanges = JSON.parseArray(effectiveTimePeriod, String.class); |
| | | } catch (Exception e) { |
| | | return; |
| | | } |
| | | if (timeRanges == null || timeRanges.isEmpty()) { |
| | | return; |
| | | } |
| | | String[] timeRange = timeRanges.get(0).split("-"); |
| | | if (timeRange.length != 2) { |
| | | return; |
| | | } |
| | | collectAddrVO.setStartTime(timeRange[0].trim()); |
| | | collectAddrVO.setEndTime(timeRange[1].trim()); |
| | | } |
| | | |
| | | private void fillDistance(XpAppUserCollectAddrVO collectAddrVO, XpPoint point, XpUserCollectAddrListQuery query) { |
| | | if (query.getLatitude() == null || query.getLongitude() == null || point.getPointLat() == null || point.getPointLon() == null) { |
| | | return; |
| | | } |
| | | double distance = distanceFast(query.getLatitude(), query.getLongitude(), point.getPointLat(), point.getPointLon()); |
| | | collectAddrVO.setDistance(BigDecimal.valueOf(distance).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | |
| | | private double distanceFast(double lat1, double lon1, double lat2, double lon2) { |
| | | double latDistance = Math.toRadians(lat2 - lat1); |
| | | double lonDistance = Math.toRadians(lon2 - lon1); |
| | | double value = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) |
| | | + Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) |
| | | * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); |
| | | return 6371000 * 2 * Math.atan2(Math.sqrt(value), Math.sqrt(1 - value)); |
| | | } |
| | | |
| | | @Override |
| | | public List<Long> getPointIdsByUserId(Long uid) { |
| | | return this.list(buildUserCollectQuery(uid) |
| | |
| | | Page<XpAppUserCouponListVo> list = baseMapper.userCouponList(page, query, Long.valueOf(uid)); |
| | | List<XpAppUserCouponListVo> records = list.getRecords(); |
| | | for (XpAppUserCouponListVo record : records) { |
| | | XpCoupon data = xpCouponClient.getCouponById(record.getCouponid()).getData(); |
| | | XpCoupon data = xpCouponClient.getCouponById(record.getOperationCouponId()).getData(); |
| | | if(null != data){ |
| | | record.setConditionAmount(data.getConditionalAmount()); |
| | | } |
| | |
| | | <select id="userCouponList" resultType="com.xiaopeng.account.model.vo.XpAppUserCouponListVo"> |
| | | select t.*,t.status from ( |
| | | SELECT id as couponId, |
| | | coupon_id as couponid, |
| | | coupon_id as operationCouponId, |
| | | coupon_name as title, |
| | | money as discountAmount, |
| | | use_time as useTime, |
| New file |
| | |
| | | package com.xiaopeng.api.dto.operation; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xiaopeng.api.model.operation.XpActicityStrategy; |
| | | import com.xiaopeng.api.model.operation.XpActicityUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "活动信息Dto") |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class XpActivityDto { |
| | | |
| | | @ApiModelProperty(value = "活动id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "活动名称") |
| | | private String acticityName; |
| | | |
| | | @ApiModelProperty(value = "活动类型 如新人活动、媒体邀约活动、日常提频等") |
| | | private Integer activityType; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "状态 1=未开始 2=进行中 3=已结束 4=暂停") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty(value = "注册启用 1=是 0=否") |
| | | private Boolean registerEnable; |
| | | |
| | | @ApiModelProperty(value = "邀请启用 1=是 0=否") |
| | | private Boolean inviteEnable; |
| | | |
| | | @ApiModelProperty(value = "图片") |
| | | private String img; |
| | | |
| | | @ApiModelProperty(value = "富文本内容") |
| | | private String richText; |
| | | |
| | | @ApiModelProperty(value = "活动策略") |
| | | List<XpActicityStrategy> strategy; |
| | | |
| | | @ApiModelProperty(value = "发放用户") |
| | | List<XpActicityUser> activityUser; |
| | | |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.api.factory.account; |
| | | |
| | | import com.xiaopeng.api.feignClient.account.XpOperationsUserClient; |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserProfileVO; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class XpOperationsUserClientFallbackFactory implements FallbackFactory<XpOperationsUserClient> { |
| | | |
| | | @Override |
| | | public XpOperationsUserClient create(Throwable cause) { |
| | | return new XpOperationsUserClient() { |
| | | @Override |
| | | public R<List<XpOperationsUser>> listByIds(List<Long> ids) { |
| | | log.error("查询运维人员信息失败,ids={}, err={}", ids, cause.getMessage()); |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<XpOperationsUser>> listByName(String nickName) { |
| | | log.error("查询运维人员信息失败,nickName={}, err={}", nickName, cause.getMessage()); |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | |
| | | @Override |
| | | public R<XpOperationsUserProfileVO> getProfile(Long id) { |
| | | log.error("查询运维人员信息失败,id={}, err={}", id, cause.getMessage()); |
| | | return R.ok(new XpOperationsUserProfileVO()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointInfoVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<XpPointsListVo>> getStationChildren(Long stationId) { |
| | | log.error("get station children failed:{}", cause.getMessage()); |
| | | return R.ok(Collections.emptyList()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> nowInTimePoint(Long pointId) { |
| | | log.error("判断点位是在有效期内失败:{}", cause.getMessage()); |
| | | return R.fail("判断点位是在有效期内失败"); |
| | |
| | | package com.xiaopeng.api.feignClient.account; |
| | | |
| | | import com.xiaopeng.api.factory.account.XpOperationUserClientFallbackFactory; |
| | | import com.xiaopeng.api.factory.account.XpOperationsUserClientFallbackFactory; |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserProfileVO; |
| | | import com.xiaopeng.common.core.domain.R; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 小程序用户Feign客户端 |
| | | * |
| | | * @author mitao |
| | | */ |
| | | @FeignClient(contextId = "XpOperationsUserClient", |
| | | value = ServiceNameConstantsEnum.XP_ACCOUNT_SERVICE, |
| | | fallbackFactory = XpOperationUserClientFallbackFactory.class) |
| | | fallbackFactory = XpOperationsUserClientFallbackFactory.class) |
| | | public interface XpOperationsUserClient { |
| | | |
| | | /** |
| | |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | |
| | | @PostMapping("/logan/inner/v1/point/getPointsInfo") |
| | | R<List<XpPoint>> getPointsInfo(@RequestBody Set<Long> points); |
| | | |
| | | @GetMapping("/logan/inner/v1/point/getStationChildren") |
| | | R<List<XpPointsListVo>> getStationChildren(@RequestParam Long stationId); |
| | | |
| | | /** |
| | | * 判断点位是在有效期内 |
| | | * |
| | |
| | | @ApiModelProperty(value = "指定用户json数组") |
| | | private String userList; |
| | | |
| | | @ApiModelProperty(value = "策略组名称") |
| | | private String strategyName; |
| | | } |
| | |
| | | @ApiModel(value="XpActicity对象", description="活动管理") |
| | | public class XpActivity extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | |
| | | @ApiModelProperty("状态 1=可用 0=不可用") |
| | | private Integer state = 1; |
| | | |
| | | @ApiModelProperty(value = "停车时长") |
| | | private Integer time; |
| | | |
| | | @ApiModelProperty("场站子点位列表") |
| | | private List<XpPointsListVo> children; |
| | | } |
| | |
| | | com.xiaopeng.api.factory.operation.XpActicityClientFallbackFactory |
| | | com.xiaopeng.api.factory.maintenance.XpVehicleModelClientFallbackFactory |
| | | com.xiaopeng.api.factory.operation.XpTargetedServiceClientFallbackFactory |
| | | com.xiaopeng.api.factory.vehicleConvoy.VehicleMacClientFallbackFactory |
| | | com.xiaopeng.api.factory.vehicleConvoy.VehicleMacClientFallbackFactory |
| | | com.xiaopeng.api.factory.account.XpOperationsUserClientFallbackFactory |
| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xiaopeng.api.model.maintenance.XpCruiseCheckInRecord; |
| | | import com.xiaopeng.api.model.maintenance.XpCruiseCheckInRule; |
| | | import com.xiaopeng.api.model.operation.SysOperLog; |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.utils.poi.ExcelUtil; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.maintenance.dto.XpCruiseCheckInRuleDto; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | @Slf4j |
| | | public class XpCruiseCheckInRuleController { |
| | | |
| | | @Resource |
| | |
| | | @ApiOperation(value = "巡游打卡统计", tags = {"管理后台-巡游打卡管理"}) |
| | | @PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/statistic") |
| | | public R<List<XpCruiseCheckInStatisticsVO>> pageList(@RequestBody XpCruiseCheckInStatisticsQuery query) { |
| | | |
| | | return R.ok(xpCruiseCheckInRecordService.statistics(query)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/maintenance-admin/api/v1/cruiseCheckInRecord/export") |
| | | public R<PageInfo<XpCruiseCheckInRecordVO>> pageListExport(@RequestBody XpCruiseCheckInRecordQuery query, HttpServletResponse response) { |
| | | List<XpCruiseCheckInRecordVO> list = xpCruiseCheckInRecordService.all(query); |
| | | ExcelUtil<XpCruiseCheckInRecordVO> util = new ExcelUtil<>(XpCruiseCheckInRecordVO.class); |
| | | util.exportExcel(response, list, "巡游打卡记录"); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), XpCruiseCheckInRecordVO.class, list); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("巡游打卡记录.xls", "utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | outputStream.flush(); |
| | | } catch (IOException e) { |
| | | log.error("导出巡游打卡记录失败", e); |
| | | } finally { |
| | | try { |
| | | if (outputStream != null) { |
| | | outputStream.close(); |
| | | } |
| | | if (workbook != null) { |
| | | workbook.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | log.error("关闭输出流失败", e); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | List<XpCruiseCheckInStatisticsVO> selectCruiseCheckInStatistics(@Param("query") XpCruiseCheckInStatisticsQuery query); |
| | | |
| | | List<XpCruiseCheckInRecordVO> selectCruiseCheckInRecordList(@Param("query") XpCruiseCheckInRecordQuery query); |
| | | |
| | | List<XpCruiseCheckInRecordVO> exportList(@Param("query") XpCruiseCheckInRecordQuery query); |
| | | |
| | | } |
| | |
| | | public PageInfo<XpCruiseCheckInRecordVO> pageList(XpCruiseCheckInRecordQuery query) { |
| | | |
| | | PageInfo<XpCruiseCheckInRecordVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | List<XpCruiseCheckInRecordVO> list = xpCruiseCheckInRecordMapper.selectCruiseCheckInRecordList(pageInfo, query); |
| | | |
| | | List<Long> ids = list.stream().map(XpCruiseCheckInRecordVO::getOperationsUserId).collect(Collectors.toList()); |
| | | |
| | | List<XpOperationsUser> xpOperationsUsers = xpOperationsUserClient.listByIds(ids).getData(); |
| | | |
| | | Map<Long, XpOperationsUser> userMap = xpOperationsUsers.stream().collect(Collectors.toMap(XpOperationsUser::getId, Function.identity())); |
| | | list = list.stream().map(record -> { |
| | | XpOperationsUser user = userMap.get(record.getOperationsUserId()); |
| | | if (user == null) return null; |
| | | record.setOperationsUserId(user.getId()); |
| | | record.setOperationsUserName(user.getNickName()); |
| | | record.setPhoneNumber(user.getPhoneNumber()); |
| | | if (StringUtils.isNotBlank(query.getOperationsUserName()) && !record.getOperationsUserName().contains(query.getOperationsUserName())) { |
| | | return null; |
| | | } |
| | | if (StringUtils.isNotBlank(query.getPhoneNumber()) && !record.getPhoneNumber().contains(query.getPhoneNumber())) { |
| | | return null; |
| | | } |
| | | return record; |
| | | }) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | for (XpCruiseCheckInRecordVO xpCruiseCheckInRecordVO : list) { |
| | | |
| | | XpOperationsUser user = userMap.get(xpCruiseCheckInRecordVO.getOperationsUserId()); |
| | | if (user == null) continue; |
| | | xpCruiseCheckInRecordVO.setOperationsUserId(user.getId()); |
| | | xpCruiseCheckInRecordVO.setOperationsUserName(user.getNickName()); |
| | | xpCruiseCheckInRecordVO.setPhoneNumber(user.getPhoneNumber()); |
| | | |
| | | } |
| | | |
| | | list.removeIf(vo -> { |
| | | if (StringUtils.isNotBlank(query.getOperationsUserName()) && !vo.getOperationsUserName().contains(query.getOperationsUserName())) { |
| | | return true; |
| | | } |
| | | return StringUtils.isNotBlank(query.getPhoneNumber()) && !vo.getPhoneNumber().contains(query.getPhoneNumber()); |
| | | }); |
| | | |
| | | pageInfo.setRecords(list); |
| | | |
| | | return pageInfo; |
| | |
| | | vo.setOperationsUserId(user.getId()); |
| | | vo.setOperationsUserName(user.getNickName()); |
| | | vo.setPhoneNumber(user.getPhoneNumber()); |
| | | vo.setFleetName(profile.getFleet().getFleetName()); |
| | | if (profile.getFleet() != null) { |
| | | vo.setFleetName(profile.getFleet().getFleetName()); |
| | | } |
| | | vo.setRole(profile.getRoles().stream().map(XpOperationsUserProfileVO.RoleInfoVO::getRoleName).collect(Collectors.joining(","))); |
| | | } |
| | | return vo; |
| | |
| | | if (CollectionUtils.isEmpty(vos) || vos.size() < 7) { |
| | | String date = vos.get(vos.size() - 1).getDate(); |
| | | LocalDate endDate = LocalDate.parse(date); |
| | | LocalDate startDate = endDate.minusDays(6); |
| | | LocalDate startDate = endDate.minusDays(vos.size() + 1); |
| | | for (int i = 7 - vos.size(); i > 0; i--) { |
| | | XpCruiseCheckInStatisticsVO v = new XpCruiseCheckInStatisticsVO(); |
| | | v.setDate(startDate.toString()); |
| | | startDate = startDate.plusDays(1); |
| | | startDate = startDate.minusDays(1); |
| | | vos.add(0, v); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public List<XpCruiseCheckInRecordVO> all(XpCruiseCheckInRecordQuery query) { |
| | | |
| | | List<XpCruiseCheckInRecordVO> list = xpCruiseCheckInRecordMapper.selectCruiseCheckInRecordList(query); |
| | | List<XpCruiseCheckInRecordVO> list = xpCruiseCheckInRecordMapper.exportList(query); |
| | | |
| | | List<Long> ids = list.stream().map(XpCruiseCheckInRecordVO::getOperationsUserId).collect(Collectors.toList()); |
| | | |
| | | List<XpOperationsUser> xpOperationsUsers = xpOperationsUserClient.listByIds(ids).getData(); |
| | | |
| | | Map<Long, XpOperationsUser> userMap = xpOperationsUsers.stream().collect(Collectors.toMap(XpOperationsUser::getId, Function.identity())); |
| | | list = list.stream().map(record -> { |
| | | XpOperationsUser user = userMap.get(record.getOperationsUserId()); |
| | | if (user == null) return null; |
| | | record.setOperationsUserId(user.getId()); |
| | | record.setOperationsUserName(user.getNickName()); |
| | | record.setPhoneNumber(user.getPhoneNumber()); |
| | | if (StringUtils.isNotBlank(query.getOperationsUserName()) && !record.getOperationsUserName().contains(query.getOperationsUserName())) { |
| | | return null; |
| | | } |
| | | if (StringUtils.isNotBlank(query.getPhoneNumber()) && !record.getPhoneNumber().contains(query.getPhoneNumber())) { |
| | | return null; |
| | | } |
| | | return record; |
| | | }) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | for (XpCruiseCheckInRecordVO xpCruiseCheckInRecordVO : list) { |
| | | |
| | | XpOperationsUser user = userMap.get(xpCruiseCheckInRecordVO.getOperationsUserId()); |
| | | if (user == null) continue; |
| | | xpCruiseCheckInRecordVO.setOperationsUserId(user.getId()); |
| | | xpCruiseCheckInRecordVO.setOperationsUserName(user.getNickName()); |
| | | xpCruiseCheckInRecordVO.setPhoneNumber(user.getPhoneNumber()); |
| | | |
| | | } |
| | | |
| | | list.removeIf(vo -> { |
| | | if (StringUtils.isNotBlank(query.getOperationsUserName()) && !vo.getOperationsUserName().contains(query.getOperationsUserName())) { |
| | | return true; |
| | | } |
| | | return StringUtils.isNotBlank(query.getPhoneNumber()) && !vo.getPhoneNumber().contains(query.getPhoneNumber()); |
| | | }); |
| | | |
| | | return list; |
| | | } |
| | |
| | | package com.xiaopeng.maintenance.vo; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xiaopeng.api.model.maintenance.XpCheckLocation; |
| | |
| | | @ApiModelProperty(value = "规则id") |
| | | private Long ruleId; |
| | | @ApiModelProperty(value = "打卡规则名称") |
| | | @Excel(name = "打卡规则名称", width = 20) |
| | | private String ruleName; |
| | | @ApiModelProperty(value = "(0=不循环,1=每天循环)") |
| | | private Integer cyclicMode; |
| | |
| | | @ApiModelProperty(value = "运维人员id") |
| | | private Long operationsUserId; |
| | | @ApiModelProperty(value = "运维人员姓名") |
| | | @Excel(name = "运维人员", width = 20) |
| | | private String operationsUserName; |
| | | @Excel(name = "手机号", width = 20) |
| | | @ApiModelProperty(value = "运维人员手机号") |
| | | private String phoneNumber; |
| | | @ApiModelProperty(value = "所属分队") |
| | |
| | | private BigDecimal locationLatitude; |
| | | |
| | | @ApiModelProperty(value = "打卡点位名称") |
| | | @Excel(name = "打卡点位", width = 20) |
| | | private String locationAddress; |
| | | |
| | | @ApiModelProperty(value = "打卡点位范围") |
| | |
| | | |
| | | @ApiModelProperty(value = "打卡时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @Excel(name = "打卡时间", width = 20) |
| | | private LocalDateTime checkInTime; |
| | | |
| | | @ApiModelProperty(value = "打卡结果(1=正常打卡,2=迟到打卡,3=未打卡)") |
| | | @Excel(name = "打卡状态", width= 20, replace = {"正常打卡_1", "迟到打卡_2", "未打卡_3"}) |
| | | private Integer checkInResult; |
| | | |
| | | @ApiModelProperty(value = "现场情况(1=正常,2=拥堵)") |
| | | @Excel(name = "巡游结果", width = 20,replace = {"正常_1", "拥堵_2"}) |
| | | private Integer fieldSituation; |
| | | |
| | | @ApiModelProperty(value = "现场照片JSON数组") |
| | |
| | | |
| | | <select id="selectCruiseCheckInRecordList" resultMap="CruiseCheckInRecordVOMap"> |
| | | SELECT |
| | | <include refid="CruiseCheckInRecordColumns"/> |
| | | |
| | | r.id, |
| | | r.check_in_time, |
| | | r.check_in_result, |
| | | r.field_situation, |
| | | cl.location_address, |
| | | cr.name AS rule_name |
| | | FROM xp_cruise_check_in_record r |
| | | LEFT JOIN xp_cruise_check_in_rule_location rl ON r.cruise_check_in_rule_id = rl.cruise_check_in_rule_id AND r.check_location_id = rl.check_location_id AND rl.is_deleted = '0' |
| | | LEFT JOIN xp_check_location cl ON r.check_location_id = cl.id AND cl.is_deleted = '0' |
| | | LEFT JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | JOIN xp_check_location cl ON r.check_location_id = cl.id AND cl.is_deleted = '0' |
| | | JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | WHERE r.is_deleted = '0' |
| | | <if test="query.fieldSituation != null"> |
| | | AND r.field_situation = #{query.fieldSituation} |
| | |
| | | SELECT |
| | | <include refid="CruiseCheckInRecordColumns"/> |
| | | FROM xp_cruise_check_in_record r |
| | | LEFT JOIN xp_cruise_check_in_rule_location rl ON r.cruise_check_in_rule_id = rl.cruise_check_in_rule_id AND r.check_location_id = rl.check_location_id AND rl.is_deleted = '0' |
| | | LEFT JOIN xp_check_location cl ON r.check_location_id = cl.id AND cl.is_deleted = '0' |
| | | LEFT JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | JOIN xp_cruise_check_in_rule_location rl ON r.cruise_check_in_rule_id = rl.cruise_check_in_rule_id AND r.check_location_id = rl.check_location_id |
| | | JOIN xp_check_location cl ON r.check_location_id = cl.id AND cl.is_deleted = '0' |
| | | JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | WHERE r.id = #{id} |
| | | AND r.is_deleted = '0' |
| | | </select> |
| | |
| | | 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 |
| | | LEFT JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | LEFT JOIN xp_fleet_operations fo ON r.operations_user_id = fo.operations_user_id |
| | | LEFT JOIN xp_fleet f ON fo.fleet_id = f.id |
| | | JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | JOIN xp_fleet_operations fo ON r.operations_user_id = fo.operations_user_id |
| | | JOIN xp_fleet f ON fo.fleet_id = f.id |
| | | WHERE r.is_deleted = '0' |
| | | AND r.check_in_time IS NOT NULL |
| | | <if test="query.ruleName != null and query.ruleName != ''"> |
| | |
| | | ORDER BY `date` DESC |
| | | </select> |
| | | |
| | | <select id="exportList" resultType="com.xiaopeng.maintenance.vo.XpCruiseCheckInRecordVO"> |
| | | SELECT |
| | | r.id, |
| | | r.check_in_time, |
| | | r.check_in_result, |
| | | r.field_situation, |
| | | cl.location_address, |
| | | cr.name AS rule_name |
| | | FROM xp_cruise_check_in_record r |
| | | JOIN xp_check_location cl ON r.check_location_id = cl.id AND cl.is_deleted = '0' |
| | | JOIN xp_cruise_check_in_rule cr ON r.cruise_check_in_rule_id = cr.id AND cr.is_deleted = '0' |
| | | WHERE r.is_deleted = '0' |
| | | <if test="query.fieldSituation != null"> |
| | | AND r.field_situation = #{query.fieldSituation} |
| | | </if> |
| | | <if test="query.checkInResult != null and query.checkInResult == 3"> |
| | | AND r.check_in_result IS NULL |
| | | </if> |
| | | <if test="query.checkInResult != null and query.checkInResult != 3"> |
| | | AND r.check_in_result = #{query.checkInResult} |
| | | </if> |
| | | <if test="query.ruleName != null and query.ruleName != ''"> |
| | | AND cr.name LIKE CONCAT('%', #{query.ruleName}, '%') |
| | | </if> |
| | | <if test="query.locationAddress != null and query.locationAddress != ''"> |
| | | AND cl.location_address LIKE CONCAT('%', #{query.locationAddress}, '%') |
| | | </if> |
| | | <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> |
| | | ORDER BY r.check_in_time DESC |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.model.operation.XpCoupon; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | |
| | | @Api(tags = "活动管理") |
| | | @RestController |
| | | @RequestMapping("") |
| | | @Slf4j |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class XpActicityController { |
| | | |
| | | @Resource |
| | | private IXpActicityService service; |
| | | |
| | | |
| | | /** |
| | | * 获取所有白名单手机号 |
| | |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/add") |
| | | @ApiOperation(value = "添加活动",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<?> add(@RequestBody XpActivity xpActivity){ |
| | | service.save(xpActivity); |
| | | public R<?> add(@RequestBody XpActivityDto dto){ |
| | | service.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/v1/api/appUserCoupon/update") |
| | | @ApiOperation(value = "修改活动",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@RequestBody XpActivity xpActivity){ |
| | | service.updateById(xpActivity); |
| | | @PostMapping("/v1/api/appUserCoupon/{op}") |
| | | @ApiOperation(value = "修改活动状态,release,pause,resume,stop,del",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> updateById(@PathVariable String op,@RequestParam Long id){ |
| | | |
| | | XpActivity activity = service.getById(id); |
| | | switch (op){ |
| | | case "release": |
| | | activity.setStatus(2); |
| | | break; |
| | | case "pause": |
| | | activity.setStatus(4); |
| | | break; |
| | | case "resume": |
| | | activity.setStatus(1); |
| | | break; |
| | | case "stop": |
| | | activity.setStatus(3); |
| | | break; |
| | | case "del": |
| | | activity.setDeleted(true); |
| | | break; |
| | | default: |
| | | throw new UnsupportedOperationException("Unsupported" + op); |
| | | } |
| | | service.updateById(activity); |
| | | log.info("修改活动状态:{}",activity); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/v1/api/appUserCoupon/update") |
| | | @GetMapping("/v1/api/appUserCoupon/detail") |
| | | @ApiOperation(value = "活动详情",tags = {"管理后台-活动管理"},response = XpCoupon.class) |
| | | public R<XpActivity> queryById(@RequestBody XpActivity xpActivity){ |
| | | public R<XpActivityDto> queryById(@RequestParam Long id){ |
| | | |
| | | return R.ok(service.getById(xpActivity)); |
| | | return R.ok(service.detail(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointInfoVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsSearchVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | |
| | | return R.ok(xpPoints); |
| | | } |
| | | |
| | | @GetMapping("/logan/inner/v1/point/getStationChildren") |
| | | public R<List<XpPointsListVo>> getStationChildren(@RequestParam Long stationId){ |
| | | return R.ok(xpPointService.getStationChildren(stationId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取下单最大距离 最小距离 |
| | | */ |
| | |
| | | package com.xiaopeng.operation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | |
| | | List<String> findListToIds(String acticityName); |
| | | |
| | | XpActivity activiting(); |
| | | |
| | | void save(XpActivityDto dto); |
| | | |
| | | XpActivityDto detail(Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpActicityStrategy; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 活动策略配置 服务类 |
| | |
| | | */ |
| | | public interface IXpActicityStrategyService extends IService<XpActicityStrategy> { |
| | | |
| | | List<XpActicityStrategy> listByActicityId(Long id); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xiaopeng.api.model.operation.XpActicityUser; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 活动发放用户 服务类 |
| | |
| | | */ |
| | | public interface IXpActicityUserService extends IService<XpActicityUser> { |
| | | |
| | | List<XpActicityUser> listByActicityId(Long id); |
| | | } |
| | |
| | | import com.xiaopeng.api.query.operation.PointPageListListQuery; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsListVo; |
| | | import com.xiaopeng.api.vo.order.XpPointsSearchVo; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.dto.NearestDto; |
| | |
| | | */ |
| | | XpPointsSearchVo queryPointByName(@Valid PointByNameQuery query,String uid); |
| | | |
| | | List<XpPointsListVo> getStationChildren(Long stationId); |
| | | |
| | | |
| | | /** |
| | | * 获取可下单距离 |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.dto.operation.XpActivityDto; |
| | | import com.xiaopeng.api.model.operation.XpActicityStrategy; |
| | | import com.xiaopeng.api.model.operation.XpActicityUser; |
| | | import com.xiaopeng.api.model.operation.XpActivity; |
| | | import com.xiaopeng.api.query.operation.XpActivityPageListQuery; |
| | | import com.xiaopeng.common.core.utils.bean.BeanUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.operation.mapper.XpActicityMapper; |
| | | import com.xiaopeng.operation.service.IXpActicityService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.operation.service.IXpActicityStrategyService; |
| | | import com.xiaopeng.operation.service.IXpActicityUserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class XpActicityServiceImpl extends ServiceImpl<XpActicityMapper, XpActivity> implements IXpActicityService { |
| | | |
| | | @Resource |
| | | private IXpActicityStrategyService strategyService; |
| | | |
| | | @Resource |
| | | private IXpActicityUserService userService; |
| | | |
| | | @Override |
| | | public PageInfo<XpActivity> pageList(XpActivityPageListQuery query) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void save(XpActivityDto dto) { |
| | | |
| | | XpActivity activity = new XpActivity(); |
| | | BeanUtils.copyBeanProp(activity, dto); |
| | | save(activity); |
| | | |
| | | List<XpActicityStrategy> strategy = dto.getStrategy(); |
| | | List<XpActicityUser> activityUser = dto.getActivityUser(); |
| | | strategy.forEach(e -> e.setActitcityId(activity.getId().intValue())); |
| | | strategyService.saveBatch(strategy); |
| | | |
| | | Map<String, XpActicityStrategy> strategyMap = strategy.stream().collect(Collectors.toMap( |
| | | XpActicityStrategy::getName, |
| | | Function.identity() |
| | | )); |
| | | activityUser.forEach(item -> { |
| | | item.setActitcityId(activity.getId().intValue()); |
| | | item.setActitcityStrategeId(strategyMap.get(item.getStrategyName()).getId()); |
| | | }); |
| | | userService.saveBatch(activityUser); |
| | | } |
| | | |
| | | @Override |
| | | public XpActivityDto detail(Long id) { |
| | | XpActivity byId = getById(id); |
| | | XpActivityDto ret = new XpActivityDto(); |
| | | BeanUtils.copyBeanProp(ret, byId); |
| | | ret.setStrategy(strategyService.listByActicityId(id)); |
| | | ret.setActivityUser(userService.listByActicityId(id)); |
| | | return ret; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.model.operation.XpActicityStrategy; |
| | | import com.xiaopeng.operation.mapper.XpActicityStrategyMapper; |
| | | import com.xiaopeng.operation.service.IXpActicityStrategyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class XpActicityStrategyServiceImpl extends ServiceImpl<XpActicityStrategyMapper, XpActicityStrategy> implements IXpActicityStrategyService { |
| | | |
| | | @Override |
| | | public List<XpActicityStrategy> listByActicityId(Long id) { |
| | | return baseMapper.selectList(new LambdaQueryWrapper<XpActicityStrategy>().eq(XpActicityStrategy::getActitcityId, id)); |
| | | } |
| | | } |
| | |
| | | package com.xiaopeng.operation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xiaopeng.api.model.operation.XpActicityUser; |
| | | import com.xiaopeng.operation.mapper.XpActicityUserMapper; |
| | | import com.xiaopeng.operation.service.IXpActicityUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class XpActicityUserServiceImpl extends ServiceImpl<XpActicityUserMapper, XpActicityUser> implements IXpActicityUserService { |
| | | |
| | | @Override |
| | | public List<XpActicityUser> listByActicityId(Long id) { |
| | | return baseMapper.selectList(new LambdaQueryWrapper<XpActicityUser>().eq(XpActicityUser::getActitcityId, id)); |
| | | } |
| | | } |
| | |
| | | nearestNextVo.setAddress(xpPoint.getPointAddress()); |
| | | nearestNextVo.setTime(xpPoint.getParkingTimeLimit()); |
| | | nearestNextVo.setElectronicAreaId(xpPoint.getElectronicAreaId()); |
| | | nearestNextVo.setStationId(xpPoint.getStationId().toString()); |
| | | nearestNextVo.setStationId(xpPoint.getStationId()==null?null:xpPoint.getStationId().toString()); |
| | | |
| | | // 判断是否收藏 |
| | | if(pointIdsByUserId!=null && !pointIdsByUserId.getData().isEmpty()){ |
| | |
| | | return searchVo; |
| | | } |
| | | |
| | | @Override |
| | | public List<XpPointsListVo> getStationChildren(Long stationId) { |
| | | if (stationId == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return this.baseMapper.queryStationChildren(Arrays.asList(stationId)); |
| | | } |
| | | |
| | | private List<XpPointsListVo> buildStationSearchResults(List<XpPointsListVo> stationList, |
| | | List<XpPointsListVo> stationChildren, |
| | | PointByNameQuery query) { |
| | |
| | | p.point_address as address, |
| | | p.point_lon as longitude, |
| | | p.point_lat as latitude, |
| | | p.parking_time_limit as time, |
| | | p.station_sort_no as stationSortNo, |
| | | p.effective_period as effectivePeriod, |
| | | p.effective_time_period as effectiveTimePeriod |
| | |
| | | coalesce(dp.point_address, fp.point_address) as address, |
| | | coalesce(s.center_lon, dp.point_lon, fp.point_lon) as longitude, |
| | | coalesce(s.center_lat, dp.point_lat, fp.point_lat) as latitude, |
| | | coalesce(dp.parking_time_limit, fp.parking_time_limit) as time, |
| | | s.effective_period as effectivePeriod, |
| | | s.effective_time_period as effectiveTimePeriod |
| | | from xp_station s |
| | |
| | | limit 1 |
| | | ) |
| | | where s.is_deleted = 0 |
| | | and s.status = 6 |
| | | and s.status = 2 |
| | | and xefa.is_deleted = 0 |
| | | and xefa.area_status = 1 |
| | | and s.city_code = #{query.cityCode} |
| | |
| | | p.point_address as address, |
| | | p.point_lon as longitude, |
| | | p.point_lat as latitude, |
| | | p.parking_time_limit as time, |
| | | p.station_sort_no as stationSortNo, |
| | | p.effective_period as effectivePeriod, |
| | | p.effective_time_period as effectiveTimePeriod |
| | |
| | | and p.point_type = 1 |
| | | and p.operation_status = 2 |
| | | and s.is_deleted = 0 |
| | | and s.status = 6 |
| | | and s.status = 2 |
| | | and xefa.is_deleted = 0 |
| | | and xefa.area_status = 1 |
| | | and p.station_id in |
| | |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | | //@Component |
| | | @Slf4j |
| | | //public class TestMsgHandler implements BusinessMsgHandler{ |
| | | public class TestMsgSchedule { |
| | |
| | | @Resource |
| | | MongoTemplate mongoTemplate; |
| | | @ApiOperation(value = "车辆", tags = {"流量接入-信息录入-车辆"}) |
| | | @PostMapping("/api/v1/xp-rt/vehicle/position") |
| | | @PostMapping("/api/v1/xp-rt/vehicle/info") |
| | | public R<?> JoinUs( |
| | | @ApiParam(value = "车辆位置信息", required = true) |
| | | @RequestBody VehiclePosition vp |