|  |  |  | 
|---|
|  |  |  | package com.doumee.api.web; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //import com.doumee.api.Repeat.RepeatSubmit; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.annotation.LoginRequired; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.constants.Constants; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.dao.business.model.BaseParam; | 
|---|
|  |  |  | import com.doumee.dao.business.model.MemberRides; | 
|---|
|  |  |  | import com.doumee.dao.business.model.RentSite; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Transactions; | 
|---|
|  |  |  | import com.doumee.dao.business.model.*; | 
|---|
|  |  |  | import com.doumee.dao.business.web.request.BackElecBikeRequest; | 
|---|
|  |  |  | import com.doumee.dao.business.web.request.OpenElecBikeRequest; | 
|---|
|  |  |  | import com.doumee.dao.business.web.request.RepairRequest; | 
|---|
|  |  |  | import com.doumee.dao.business.web.response.HomeResponse; | 
|---|
|  |  |  | import com.doumee.dao.business.web.response.MemberRidesDetailResponse; | 
|---|
|  |  |  | import com.doumee.dao.business.web.response.MemberRidesResponse; | 
|---|
|  |  |  | import com.doumee.dao.business.web.response.RidesDetailResponse; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemDictData; | 
|---|
|  |  |  | import com.doumee.jtt808.web.service.Jtt808Service; | 
|---|
|  |  |  | import com.doumee.service.business.*; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.yzh.commons.model.APIResult; | 
|---|
|  |  |  | import org.yzh.protocol.t808.T0201_0500; | 
|---|
|  |  |  | import org.yzh.protocol.t808.T8500; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private GoodsorderService goodsorderService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private Jtt808Service jtt808Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RentSiteService rentSiteService; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private MemberRidesService memberRidesService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DiscountService discountService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SitesService  sitesService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private BikesService bikesService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "押金支付", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/createGoodsOrderPay") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<Object> createGoodsOrderPay() { | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",goodsorderService.createGoodsOrderPay(getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "套餐购买", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/createDiscountOrderPay") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "discountId", value = "套餐主键", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<Object> createDiscountOrderPay(@RequestParam String discountId) { | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",goodsorderService.createDiscountOrderPay(getMemberId(),discountId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<RidesDetailResponse> ridesDetail(@RequestParam String goodsOrderId) { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",goodsorderService.getRidesDetailResponse(goodsOrderId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "租车点列表", notes = "小程序端") | 
|---|
|  |  |  | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",rentSiteService.findList(rentSite)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "电动车站点列表", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/eleSiteList") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<List<Sites>> eleSiteList() { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",sitesService.getSiteList(Constants.ONE)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "查询所有电动车信息", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/eleBikeList") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<List<Bikes>> eleBikeList() { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",bikesService.getEleBikes(getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取电动车运营区域", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/getEleBusinessArea") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<String> getEleBusinessArea() { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.PARK_LAT_LNG_LIST).getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation("消费明细") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<PageData<Transactions>> transactionsPage (@RequestBody PageWrap pageWrap) { | 
|---|
|  |  |  | return ApiResponse.success(transactionsService.findPageForMini(pageWrap,getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "热销套餐", notes = "热销套餐") | 
|---|
|  |  |  | @PostMapping("/discountPage") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<PageData<Discount>> discountPage (@RequestBody PageWrap<Discount> pageWrap) { | 
|---|
|  |  |  | Discount discount = new Discount(); | 
|---|
|  |  |  | discount.setStatus(Constants.ZERO); | 
|---|
|  |  |  | discount.setMinShow(Constants.ZERO); | 
|---|
|  |  |  | pageWrap.setModel(discount); | 
|---|
|  |  |  | return ApiResponse.success(discountService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "套餐详情", notes = "套餐详情") | 
|---|
|  |  |  | @GetMapping("/discountDetail") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "id", value = "套餐主键", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<Discount> discountPage (@RequestParam String id) { | 
|---|
|  |  |  | return ApiResponse.success(discountService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation("基础配置数据") | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<String> onlineBike() { | 
|---|
|  |  |  | public ApiResponse<MemberRides> onlineBike() { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",memberRidesService.getOnlineBike(getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "扫码获取车辆信息", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/getBikeChargingRule") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "锁头码、电车码", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<MemberRidesResponse> getBikeChargingRule(@RequestParam String code) { | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",memberRidesService.getBikeChargingRule(code,getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "扫码解锁", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/openLock") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<MemberRidesDetailResponse> openLock(@RequestParam String code) { | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",memberRidesService.openLock(code,getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "刷新解锁情况", notes = "小程序端") | 
|---|
|  |  |  | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",memberRidesService.refreshLock(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation(value = "订单结算", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/goodsOrderSettlement") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "orderId", value = "订单主键", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse goodsOrderSettlement(@RequestParam String orderId) { | 
|---|
|  |  |  | goodsorderService.goodsOrderSettlement(orderId); | 
|---|
|  |  |  | public ApiResponse goodsOrderSettlement() { | 
|---|
|  |  |  | goodsorderService.goodsOrderSettlement(getMemberId()); | 
|---|
|  |  |  | return  ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取字典值信息", notes = "小程序端") | 
|---|
|  |  |  | @GetMapping("/getSysDict") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "dicCode", value = "字典编码", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "label", value = "字典数值编码", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<SystemDictData> getSysDict(@RequestParam String dicCode, @RequestParam String label) { | 
|---|
|  |  |  | return  ApiResponse.success("查询成功",systemDictDataBiz.queryByCode(dicCode,label)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "电车站点还车", notes = "电车站点还车") | 
|---|
|  |  |  | @PostMapping("/backElecBike") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse backElecBike(@RequestBody BackElecBikeRequest param) { | 
|---|
|  |  |  | param.setMemberId(getMemberId()); | 
|---|
|  |  |  | jtt808Service.backElecBike(param); | 
|---|
|  |  |  | return  ApiResponse.success( null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "电车临时停车", notes = "电车临时停车") | 
|---|
|  |  |  | @PostMapping("/pauseElecBike") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse pauseElecBike(@RequestBody BackElecBikeRequest param) { | 
|---|
|  |  |  | param.setMemberId(getMemberId()); | 
|---|
|  |  |  | jtt808Service.pauseElecBike(param); | 
|---|
|  |  |  | return  ApiResponse.success( null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "电车开锁", notes = "电车开锁") | 
|---|
|  |  |  | @PostMapping("/openElecBike") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<MemberRidesDetailResponse> openElecBike(@RequestBody OpenElecBikeRequest param) { | 
|---|
|  |  |  | param.setMemberId(getMemberId()); | 
|---|
|  |  |  | return  ApiResponse.success(jtt808Service.openLock(param)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "临停开锁", notes = "临停开锁") | 
|---|
|  |  |  | @PostMapping("/pauseOpenElecBike") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse pauseOpenElecBike(@RequestBody BackElecBikeRequest param) { | 
|---|
|  |  |  | param.setMemberId(getMemberId()); | 
|---|
|  |  |  | jtt808Service.pauseOpenElecBike(param); | 
|---|
|  |  |  | return  ApiResponse.success( null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "强制还车", notes = "强制还车") | 
|---|
|  |  |  | @PostMapping("/forceBack") | 
|---|
|  |  |  | public ApiResponse forceBack(@RequestBody Goodsorder goodsorder) { | 
|---|
|  |  |  | jtt808Service.forceBack(goodsorder.getId()); | 
|---|
|  |  |  | return  ApiResponse.success( null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|