| | |
| | | <version>1.18.20</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.OpenCityWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverPosition") |
| | | @ServiceLog(name = "获取5公里范围内的司机", url = "/api/driver/queryDriverPosition") |
| | | @ApiOperation(value = "获取5公里范围内的司机", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<String>> queryDriverPosition(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil<List<String>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | return ResponseWarpper.success(listResultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/addDriverPosition") |
| | | @ServiceLog(name = "存储司机实时位置", url = "/base/driver/addDriverPosition") |
| | | public ResponseWarpper addDriverPosition(DriverPositionWarpper driverPositionWarpper) { |
| | | try { |
| | | driverService.addDriverPosition(driverPositionWarpper); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 司机上下班控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/15 15:39 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class DriverWorkController { |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/home/driverWork") |
| | | @ServiceLog(name = "司机上班操作", url = "/api/home/driverWork") |
| | | @ApiOperation(value = "司机上班操作", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverWork(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = driverWorkService.driverWork(uid); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/home/driverOffWork") |
| | | @ServiceLog(name = "司机下班操作", url = "/api/home/driverOffWork") |
| | | @ApiOperation(value = "司机下班操作", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "在线时长(秒)", name = "onlineTime", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverOffWork(Long onlineTime, HttpServletRequest request){ |
| | | if(null == onlineTime){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("onlineTime")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = driverWorkService.driverOffWork(uid, onlineTime); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 订单控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:02 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryDriverServerOrder") |
| | | @ServiceLog(name = "获取司机服务中的订单id", url = "/api/order/queryDriverServerOrder") |
| | | @ApiOperation(value = "获取司机服务中的订单id", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<Long> queryDriverServerOrder(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | Long id = orderService.queryDriverServerOrder(uid); |
| | | return ResponseWarpper.success(id); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/driverAddOrder") |
| | | @ServiceLog(name = "司机代客下单", url = "/api/order/driverAddOrder") |
| | | @ApiOperation(value = "司机代客下单", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverAddOrder(AddOrderWarpper addOrderWarpper, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.driverAddOrder(uid, addOrderWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemBulletinService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinListWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统公告 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class SystemBulletinController { |
| | | |
| | | @Autowired |
| | | private ISystemBulletinService systemBulletinService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemBulletin/querySystemBulletinList") |
| | | @ServiceLog(name = "获取系统公告列表", url = "/api/systemBulletin/querySystemBulletinList") |
| | | @ApiOperation(value = "获取系统公告列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<SystemBulletinListWarpper>> querySystemBulletinList(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | if(ToolUtil.isEmpty(pageNum)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(ToolUtil.isEmpty(size)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("size")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<SystemBulletinListWarpper> systemBulletinListWarppers = systemBulletinService.querySystemBulletinList(uid, pageNum, size); |
| | | return ResponseWarpper.success(systemBulletinListWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemBulletin/querySystemBulletinInfo") |
| | | @ServiceLog(name = "获取系统公告详情", url = "/api/systemBulletin/querySystemBulletinInfo") |
| | | @ApiOperation(value = "获取系统公告详情", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "公告id", name = "id", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<SystemBulletinInfo> querySystemBulletinInfo(Long id, HttpServletRequest request){ |
| | | if(ToolUtil.isEmpty(id)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("id")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | SystemBulletinInfo systemBulletinInfo = systemBulletinService.querySystemBulletinInfo(id); |
| | | return ResponseWarpper.success(systemBulletinInfo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemMessageService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemMessageWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统消息 |
| | | * @author pzb |
| | | * @Date 2023/2/10 15:35 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class SystemMessageController { |
| | | |
| | | @Autowired |
| | | private ISystemMessageService systemMessageService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/querySystemMessageList") |
| | | @ServiceLog(name = "获取系统消息列表", url = "/api/systemMessage/querySystemMessageList") |
| | | @ApiOperation(value = "获取系统消息列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "size", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<SystemMessageWarpper>> querySystemMessageList(Integer pageNum, Integer size, HttpServletRequest request){ |
| | | if(ToolUtil.isEmpty(pageNum)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(ToolUtil.isEmpty(size)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("size")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<SystemMessageWarpper> systemMessageWarppers = systemMessageService.querySystemMessageList(uid, pageNum, size); |
| | | return ResponseWarpper.success(systemMessageWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/readSystems") |
| | | @ServiceLog(name = "阅读系统消息", url = "/api/systemMessage/readSystems") |
| | | @ApiOperation(value = "阅读系统消息", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "消息id,多个逗号分隔", name = "ids", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper readSystems(String ids, HttpServletRequest request){ |
| | | if(ToolUtil.isEmpty(ids)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("ids")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | systemMessageService.readSystems(uid, ids); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | |
| | | public interface DriverWorkMapper extends BaseMapper<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletin; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinListWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface SystemBulletinMapper extends BaseMapper<SystemBulletin> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统公告 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<SystemBulletinListWarpper> querySystemBulletinList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | /** |
| | | * 获取公告详情 |
| | | * @param uid |
| | | * @param id |
| | | * @return |
| | | */ |
| | | SystemBulletinInfo querySystemBulletinInfo(@Param("id") Long id); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | |
| | | public interface SystemBulletinUserMapper extends BaseMapper<SystemBulletinUser> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | |
| | | public interface SystemConfigMapper extends BaseMapper<SystemConfig> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemMessageWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface SystemMessageMapper extends BaseMapper<SystemMessage> { |
| | | |
| | | |
| | | /** |
| | | * 获取个人系统消息列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | */ |
| | | List<SystemMessageWarpper> querySystemMessageList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.DriverWorkMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.DriverWork"> |
| | | <id column="id" property="id"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="workTime" property="workTime"/> |
| | | <result column="offWorkTime" property="offWorkTime"/> |
| | | <result column="onlineTime" property="onlineTime"/> |
| | | <result column="status" property="status"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.OrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.Order"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="source" property="source" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="branchOfficeId" property="branchOfficeId" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="startAddress" property="startAddress" /> |
| | | <result column="startLat" property="startLat" /> |
| | | <result column="startLng" property="startLng" /> |
| | | <result column="endAddress" property="endAddress" /> |
| | | <result column="endLat" property="endLat" /> |
| | | <result column="endLng" property="endLng" /> |
| | | <result column="boardingTime" property="boardingTime" /> |
| | | <result column="getoffTime" property="getoffTime" /> |
| | | <result column="startDistance" property="startDistance" /> |
| | | <result column="startPrice" property="startPrice" /> |
| | | <result column="overDriveDistance" property="overDriveDistance" /> |
| | | <result column="overDrivePrice" property="overDrivePrice" /> |
| | | <result column="longDistance" property="longDistance" /> |
| | | <result column="longDistancePrice" property="longDistancePrice" /> |
| | | <result column="overLongDistance" property="overLongDistance" /> |
| | | <result column="overLongDistancePrice" property="overLongDistancePrice" /> |
| | | <result column="waitTime" property="waitTime" /> |
| | | <result column="waitTimePrice" property="waitTimePrice" /> |
| | | <result column="outWaitTime" property="outWaitTime" /> |
| | | <result column="outWaitTimePrice" property="outWaitTimePrice" /> |
| | | <result column="badWeatherDistance" property="badWeatherDistance" /> |
| | | <result column="badWeatherPrice" property="badWeatherPrice" /> |
| | | <result column="overBadWeatherDistance" property="overBadWeatherDistance" /> |
| | | <result column="overBadWeatherPrice" property="overBadWeatherPrice" /> |
| | | <result column="estimatedPrice" property="estimatedPrice" /> |
| | | <result column="orderMoney" property="orderMoney" /> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="discountedPrice" property="discountedPrice" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="state" property="state" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.SystemBulletinMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.SystemBulletin"> |
| | | <id column="id" property="id" /> |
| | | <result column="introduce" property="introduce" /> |
| | | <result column="img" property="img" /> |
| | | <result column="content" property="content" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="querySystemBulletinList" resultType="com.supersavedriving.driver.modular.system.warpper.SystemBulletinListWarpper"> |
| | | select |
| | | b.id, |
| | | a.introduce, |
| | | a.img, |
| | | b.isRead, |
| | | (UNIX_TIMESTAMP(b.createTime) * 1000) as createTime |
| | | from t_system_bulletin a |
| | | left join t_system_bulletin_user b on (a.id = b.systemBulletinId) |
| | | where b.status = 1 and b.userType = 2 and b.userId = #{uid} order by b.createTime desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="querySystemBulletinInfo" resultType="com.supersavedriving.driver.modular.system.warpper.SystemBulletinInfo"> |
| | | select |
| | | b.id, |
| | | a.content |
| | | from t_system_bulletin a |
| | | left join t_system_bulletin_user b on (a.id = b.systemBulletinId) |
| | | where b.id = #{id} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.SystemBulletinUserMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.SystemBulletinUser"> |
| | | <id column="id" property="id" /> |
| | | <result column="systemBulletinId" property="systemBulletinId" /> |
| | | <result column="userType" property="userType" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="isRead" property="isRead" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.SystemConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.SystemConfig"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="content" property="content"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.driver.modular.system.dao.SystemMessageMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.SystemMessage"> |
| | | <id column="id" property="id" /> |
| | | <result column="userType" property="userType" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="title" property="title" /> |
| | | <result column="content" property="content" /> |
| | | <result column="isRead" property="isRead" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="querySystemMessageList" resultType="com.supersavedriving.driver.modular.system.warpper.SystemMessageWarpper"> |
| | | select |
| | | id, |
| | | title, |
| | | content, |
| | | isRead, |
| | | (UNIX_TIMESTAMP(createTime) * 1000) as createTime |
| | | from t_system_message where status = 1 |
| | | <if test="null != uid"> |
| | | and userType = 2 and userId = #{uid} |
| | | </if> |
| | | order by createTime desc |
| | | <if test="null != pageNum and null != size"> |
| | | limit #{pageNum}, #{size} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | * 在线时长(秒) |
| | | */ |
| | | @TableField("onlineTime") |
| | | private |
| | | private Long onlineTime; |
| | | /** |
| | | * 状态(1=上班,2=下班) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:59 |
| | | */ |
| | | @Data |
| | | @TableName("t_order") |
| | | public class Order { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 订单来源(1=小程序,2=APP) |
| | | */ |
| | | @TableField("source") |
| | | private Integer source; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 开始服务时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 起点地址 |
| | | */ |
| | | @TableField("startAddress") |
| | | private String startAddress; |
| | | /** |
| | | * 起点纬度 |
| | | */ |
| | | @TableField("startLat") |
| | | private String startLat; |
| | | /** |
| | | * 起点经度 |
| | | */ |
| | | @TableField("startLng") |
| | | private String startLng; |
| | | /** |
| | | * 终点地址 |
| | | */ |
| | | @TableField("endAddress") |
| | | private String endAddress; |
| | | /** |
| | | * 终点纬度 |
| | | */ |
| | | @TableField("endLat") |
| | | private String endLat; |
| | | /** |
| | | * 终点经度 |
| | | */ |
| | | @TableField("endLng") |
| | | private String endLng; |
| | | /** |
| | | * 上车时间 |
| | | */ |
| | | @TableField("boardingTime") |
| | | private Date boardingTime; |
| | | /** |
| | | * 下车时间 |
| | | */ |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 起步里程 |
| | | */ |
| | | @TableField("startDistance") |
| | | private Double startDistance; |
| | | /** |
| | | * 起步价 |
| | | */ |
| | | @TableField("startPrice") |
| | | private Double startPrice; |
| | | /** |
| | | * 超出起步里程 |
| | | */ |
| | | @TableField("overDriveDistance") |
| | | private Double overDriveDistance; |
| | | /** |
| | | * 超出起步里程费 |
| | | */ |
| | | @TableField("overDrivePrice") |
| | | private Double overDrivePrice; |
| | | /** |
| | | * 长途里程 |
| | | */ |
| | | @TableField("longDistance") |
| | | private String longDistance; |
| | | /** |
| | | * 长途里程费 |
| | | */ |
| | | @TableField("longDistancePrice") |
| | | private Double longDistancePrice; |
| | | /** |
| | | * 超出长途里程 |
| | | */ |
| | | @TableField("overLongDistance") |
| | | private Double overLongDistance; |
| | | /** |
| | | * 超出长途里程费 |
| | | */ |
| | | @TableField("overLongDistancePrice") |
| | | private Double overLongDistancePrice; |
| | | /** |
| | | * 等待时长(分钟) |
| | | */ |
| | | @TableField("waitTime") |
| | | private Integer waitTime; |
| | | /** |
| | | * 等待费 |
| | | */ |
| | | @TableField("waitTimePrice") |
| | | private Double waitTimePrice; |
| | | /** |
| | | * 超出等待时长(分钟) |
| | | */ |
| | | @TableField("outWaitTime") |
| | | private Integer outWaitTime; |
| | | /** |
| | | * 超出等待时长费 |
| | | */ |
| | | @TableField("outWaitTimePrice") |
| | | private Double outWaitTimePrice; |
| | | /** |
| | | * 恶劣天气里程 |
| | | */ |
| | | @TableField("badWeatherDistance") |
| | | private Double badWeatherDistance; |
| | | /** |
| | | * 恶劣天气里程费 |
| | | */ |
| | | @TableField("badWeatherPrice") |
| | | private Double badWeatherPrice; |
| | | /** |
| | | * 恶劣天气超出里程 |
| | | */ |
| | | @TableField("overBadWeatherDistance") |
| | | private Double overBadWeatherDistance; |
| | | /** |
| | | * 恶劣天气超出里程费 |
| | | */ |
| | | @TableField("overBadWeatherPrice") |
| | | private Double overBadWeatherPrice; |
| | | /** |
| | | * 预估价 |
| | | */ |
| | | @TableField("estimatedPrice") |
| | | private Double estimatedPrice; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | @TableField("discountedPrice") |
| | | private Double discountedPrice; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 支付类型(1=微信支付,2=余额支付,3=线下支付) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待评价,108=已完成,201=转单中,301=已取消) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统公告 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:13 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_bulletin") |
| | | public class SystemBulletin { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 介绍 |
| | | */ |
| | | @TableField("introduce") |
| | | private String introduce; |
| | | /** |
| | | * 图片 |
| | | */ |
| | | @TableField("img") |
| | | private String img; |
| | | /** |
| | | * 富文本内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 用户系统公告关系数据 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:49 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_bulletin_user") |
| | | public class SystemBulletinUser { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 系统公告id |
| | | */ |
| | | @TableField("systemBulletinId") |
| | | private Integer systemBulletinId; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 阅读(0=否,1=是) |
| | | */ |
| | | @TableField("isRead") |
| | | private Integer isRead; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:22 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_config") |
| | | public class SystemConfig { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=派单规则,2=佣金分成规则,3=抽成规则,4=积分规则,5=价格规则,6=余额规则,7=客服管理) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统消息 |
| | | * @author pzb |
| | | * @Date 2023/2/10 15:28 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_message") |
| | | public class SystemMessage { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @TableField("title") |
| | | private String title; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 阅读状态(0=否,1=是) |
| | | */ |
| | | @TableField("isRead") |
| | | private Integer isRead; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 司机 |
| | |
| | | * @throws Exception |
| | | */ |
| | | void setPassword(Integer uid, String password) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机坐标 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<List<String>> queryDriverPosition(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 存储司机实时位置 |
| | | * @throws Exception |
| | | */ |
| | | void addDriverPosition(DriverPositionWarpper driverPositionWarpper) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | |
| | | public interface IDriverWorkService extends IService<DriverWork> { |
| | | |
| | | |
| | | /** |
| | | * 上班操作 |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil driverWork(Integer driverId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 司机下班操作 |
| | | * @param driverId 司机id |
| | | * @param onlineTime 在线时长(秒) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil driverOffWork(Integer driverId, Long onlineTime) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderPositionWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IOrderPositionService { |
| | | |
| | | |
| | | /** |
| | | * 存储最新订单坐标 |
| | | * @param driverPositionWarpper |
| | | * @throws Exception |
| | | */ |
| | | void saveOrderPosition(DriverPositionWarpper driverPositionWarpper) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单坐标 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<OrderPositionWarpper> queryPosition(Integer orderId, Integer orderType) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.BaseWarpper; |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:47 |
| | | */ |
| | | public interface IOrderService extends IService<Order> { |
| | | |
| | | |
| | | /** |
| | | * 获取司机服务中的订单 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Long queryDriverServerOrder(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 司机代客下单 |
| | | * @param uid |
| | | * @param addOrderWarpper |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil driverAddOrder(Integer uid, AddOrderWarpper addOrderWarpper) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletin; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinListWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ISystemBulletinService extends IService<SystemBulletin> { |
| | | |
| | | |
| | | /** |
| | | * 获取系统公告列表 |
| | | * @param uid 司机id |
| | | * @param pageNum 页码 |
| | | * @param size 页条数 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<SystemBulletinListWarpper> querySystemBulletinList(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取公告详情 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | SystemBulletinInfo querySystemBulletinInfo(Long id) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | public interface ISystemConfigService extends IService<SystemConfig> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemMessageWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 系统消息 |
| | | * @author pzb |
| | | * @Date 2023/2/10 15:34 |
| | | */ |
| | | public interface ISystemMessageService extends IService<SystemMessage> { |
| | | |
| | | |
| | | /** |
| | | * 获取个人系统消息列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<SystemMessageWarpper> querySystemMessageList(Integer uid, Integer pageNum, Integer size) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 阅读系统消息 |
| | | * @param uid |
| | | * @param ids |
| | | * @throws Exception |
| | | */ |
| | | void readSystems(Integer uid, String ids) throws Exception; |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.core.common.constant.JwtConstants; |
| | |
| | | import com.supersavedriving.driver.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.driver.modular.system.model.BranchOffice; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | import com.supersavedriving.driver.modular.system.service.IBranchOfficeService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderPositionService; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import static org.bouncycastle.asn1.x500.style.RFC4519Style.c; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | /** |
| | |
| | | driver.setPassword(ShiroKit.md5(password, salt)); |
| | | this.updateById(driver); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<List<String>> queryDriverPosition(Integer uid) throws Exception { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("请先上班"); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | List<String> list = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | String[] split = value.split(","); |
| | | String lon = split[0]; |
| | | String lat = split[1]; |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(lon), Double.valueOf(lat)); |
| | | //构造半径 |
| | | Distance distanceR = new Distance(5D, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | locations.forEach(s -> { |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | }); |
| | | } |
| | | return ResultUtil.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addDriverPosition(DriverPositionWarpper driverPositionWarpper) throws Exception { |
| | | //实时位置存入redis中 |
| | | Double lon = driverPositionWarpper.getLon(); |
| | | Double lat = driverPositionWarpper.getLat(); |
| | | Integer driverId = driverPositionWarpper.getDriverId(); |
| | | Integer orderId = driverPositionWarpper.getOrderId(); |
| | | redisUtil.setStrValue("DRIVER" + driverId, lon + "," + lat, 30); |
| | | Query query = Query.query(Criteria.where("driverId").is(driverId)); |
| | | Location old = this.mongoTemplate.findOne(query, Location.class); |
| | | if (Objects.isNull(old)) { |
| | | old = new Location(); |
| | | old.setDriverId(driverId); |
| | | old.setLocation(new GeoJsonPoint(lon, lat)); |
| | | old.setUpdated(System.currentTimeMillis()); |
| | | old.setLastUpdated(System.currentTimeMillis()); |
| | | this.mongoTemplate.save(old); |
| | | } else { |
| | | //更新 |
| | | Update update = Update |
| | | .update("location", new GeoJsonPoint(lon, lat)) |
| | | .set("updated", System.currentTimeMillis()) |
| | | .set("lastUpdated", System.currentTimeMillis()); |
| | | this.mongoTemplate.updateFirst(query, update, Location.class); |
| | | } |
| | | |
| | | //存储订单轨迹 |
| | | if(null != orderId){ |
| | | orderPositionService.saveOrderPosition(driverPositionWarpper); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.DriverWorkMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemConfigService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 司机上下班操作记录 |
| | | * @author pzb |
| | | * @Date 2023/2/15 15:48 |
| | | */ |
| | | @Service |
| | | public class DriverWorkServiceImpl extends ServiceImpl<DriverWorkMapper, DriverWork> implements IDriverWorkService { |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 司机上班操作 |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil driverWork(Integer driverId) throws Exception { |
| | | Driver driver = driverService.selectById(driverId); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | Double num1 = JSON.parseObject(systemConfig.getContent()).getDouble("num1"); |
| | | if(driver.getBalance() == null || driver.getBalance().compareTo(num1) < 0){ |
| | | return ResultUtil.error("账户余额不足,请先充值"); |
| | | } |
| | | DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", 1).eq("status", 1)); |
| | | if(null != driverWork){ |
| | | return ResultUtil.error("您正在上班中"); |
| | | } |
| | | driverWork = new DriverWork(); |
| | | driverWork.setDriverId(driverId); |
| | | driverWork.setWorkTime(new Date()); |
| | | driverWork.setOnlineTime(0L); |
| | | driverWork.setStatus(1); |
| | | this.updateById(driverWork); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 司机下班操作 |
| | | * @param driverId 司机id |
| | | * @param onlineTime 在线时长(秒) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil driverOffWork(Integer driverId, Long onlineTime) throws Exception { |
| | | DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", 1).eq("status", 2)); |
| | | if(null != driverWork){ |
| | | return ResultUtil.error("您已下班,不能重复操作"); |
| | | } |
| | | driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", 1).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("您还未上班"); |
| | | } |
| | | driverWork.setOffWorkTime(new Date()); |
| | | driverWork.setOnlineTime(onlineTime); |
| | | driverWork.setStatus(2); |
| | | this.updateById(driverWork); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderPositionService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderPositionWarpper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 订单轨迹逻辑类 |
| | | */ |
| | | @Service |
| | | public class OrderPositionServiceImpl implements IOrderPositionService { |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存订单最新坐标 |
| | | * @param driverPositionWarpper |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveOrderPosition(DriverPositionWarpper driverPositionWarpper) throws Exception { |
| | | Integer orderId = driverPositionWarpper.getOrderId(); |
| | | Integer orderType = driverPositionWarpper.getOrderType(); |
| | | File file = new File(filePath + orderId + "_" + orderType + ".json"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | } |
| | | List<OrderPositionWarpper> orderPositionWarppers = queryPosition(orderId, orderType); |
| | | OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper(); |
| | | BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper); |
| | | orderPositionWarpper.setInsertTime(new Date()); |
| | | orderPositionWarppers.add(orderPositionWarpper); |
| | | |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | out.write(JSON.toJSONString(driverPositionWarpper)); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单坐标数据 |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderPositionWarpper> queryPosition(Integer orderId, Integer orderType) throws Exception { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderId + "_" + orderType + ".txt"); |
| | | if(!file.exists()){ |
| | | return new ArrayList<>(); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<OrderPositionWarpper> list = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(sb.toString())){ |
| | | list = JSONArray.parseArray(sb.toString(), OrderPositionWarpper.class); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.OrderMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverWork; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemConfigService; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.BaseWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.xml.crypto.Data; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:57 |
| | | */ |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单id |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Long queryDriverServerOrder(Integer uid) throws Exception { |
| | | Order order = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201))); |
| | | if(null != order){ |
| | | return order.getId(); |
| | | } |
| | | return 0L; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil driverAddOrder(Integer uid, AddOrderWarpper addOrderWarpper) throws Exception { |
| | | /** |
| | | * 司机上线且空闲,下单直接给当前司机,其余进大厅 |
| | | * 司机下的订单不需要创建新用户,且只能走线下支付 |
| | | */ |
| | | Driver driver = driverService.selectById(uid); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | | Order order1 = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201))); |
| | | Order order = new Order(); |
| | | if(driverWork != null && null == order1){ |
| | | order.setDriverId(uid); |
| | | } |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); |
| | | order.setSource(2); |
| | | order.setAgentId(driver.getAgentId()); |
| | | order.setBranchOfficeId(driver.getBranchOfficeId()); |
| | | order.setStartAddress(addOrderWarpper.getStartAddress()); |
| | | order.setStartLat(addOrderWarpper.getStartLat()); |
| | | order.setStartLng(addOrderWarpper.getStartLng()); |
| | | order.setEndAddress(addOrderWarpper.getEndAddress()); |
| | | order.setEndLat(addOrderWarpper.getEndLat()); |
| | | order.setEndLng(addOrderWarpper.getEndLng()); |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | Double d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order = getOrderPrice(1, d, 0, order); |
| | | order.setState(null == order.getDriverId() ? 101 : 102); |
| | | order.setStatus(1); |
| | | order.setCreateTime(new Date()); |
| | | this.insert(order); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单价格 |
| | | * @param type |
| | | * @param distance |
| | | * @param waitTime |
| | | * @param order |
| | | * @return |
| | | */ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order){ |
| | | order = getOrderInitialPrice(order); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | if(null == systemConfig){ |
| | | if(type == 1){//预估金额 |
| | | order.setEstimatedPrice(0D); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(0D); |
| | | } |
| | | return order; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | Double num3 = jsonObject1.getDouble("num3");//起步里程 |
| | | Double num4 = jsonObject1.getDouble("num4");//起步价格 |
| | | Double num5 = jsonObject1.getDouble("num5");//超过公里 |
| | | Double num6 = jsonObject1.getDouble("num6");//超过num3每num5公里收取num6 |
| | | Double num7 = jsonObject1.getDouble("num7");//长途起始公里 |
| | | Double num8 = jsonObject1.getDouble("num8");//长途结束公里 |
| | | Double num9 = jsonObject1.getDouble("num9");//长途费 |
| | | Double num10 = jsonObject1.getDouble("num10");//超出长途里程每num10公里 |
| | | Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(num3.compareTo(distance) >= 0){//起步里程内 |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 |
| | | order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 |
| | | |
| | | //计算长途费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | order.setLongDistance(num7 + "-" + num8);//长途里程 |
| | | order.setLongDistancePrice(num9);//长途费 |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //计算额外费用 |
| | | Integer num1 = extraCost.getInteger("num1");//等待时长 |
| | | Double num2 = extraCost.getDouble("num2");//等待费 |
| | | Integer num3 = extraCost.getInteger("num3");//等待超出时长 |
| | | Double num4 = extraCost.getDouble("num4");//等到超出时长费用单价 X/分钟 |
| | | Double num5 = extraCost.getDouble("num5");//恶劣天气公里 |
| | | Double num6 = extraCost.getDouble("num6");//恶劣天气费 |
| | | Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 |
| | | Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | | order.setWaitTime(num1);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | | } |
| | | |
| | | //恶劣天气 |
| | | if(true){ |
| | | order.setBadWeatherDistance(num5);//恶劣天气公里 |
| | | order.setBadWeatherPrice(num6);//恶劣天气费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); |
| | | BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); |
| | | order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 |
| | | order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | |
| | | double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) |
| | | if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 |
| | | order.setBadWeatherPrice(num9);//恶劣天气费 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); |
| | | order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | } |
| | | } |
| | | |
| | | //计算总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + |
| | | order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | if(type == 1){//预估价 |
| | | order.setEstimatedPrice(bigDecimal.doubleValue()); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(bigDecimal.doubleValue()); |
| | | } |
| | | return order; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始订单费用 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | public Order getOrderInitialPrice(Order order){ |
| | | order.setStartDistance(0D);//起步里程 |
| | | order.setStartPrice(0D);//起步价 |
| | | order.setOverDriveDistance(0D);//超出起步里程 |
| | | order.setOverDrivePrice(0D);//超出起步里程费 |
| | | order.setLongDistance("");//长途里程 |
| | | order.setLongDistancePrice(0D);//长途里程费 |
| | | order.setOverLongDistance(0D);//超出长途里程 |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | | order.setBadWeatherDistance(0D);//恶劣天气里程 |
| | | order.setBadWeatherPrice(0D);//恶劣天气里程费 |
| | | order.setOverBadWeatherDistance(0D);//恶劣天气超出里程 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出里程费 |
| | | order.setDiscountedPrice(0D);//优惠金额 |
| | | order.setCouponId(null);//优惠券 |
| | | return order; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.SystemBulletinMapper; |
| | | import com.supersavedriving.driver.modular.system.dao.SystemBulletinUserMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletin; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemBulletinService; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemBulletinListWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统公告 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:18 |
| | | */ |
| | | @Service |
| | | public class SystemBulletinServiceImpl extends ServiceImpl<SystemBulletinMapper, SystemBulletin> implements ISystemBulletinService { |
| | | |
| | | @Resource |
| | | private SystemBulletinUserMapper systemBulletinUserMapper; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取公告列表 |
| | | * @param uid 司机id |
| | | * @param pageNum 页码 |
| | | * @param size 页条数 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<SystemBulletinListWarpper> querySystemBulletinList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | return this.baseMapper.querySystemBulletinList(uid, pageNum, size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取公告详情 |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public SystemBulletinInfo querySystemBulletinInfo(Long id) throws Exception { |
| | | SystemBulletinInfo systemBulletinInfo = this.baseMapper.querySystemBulletinInfo(id); |
| | | SystemBulletinUser systemBulletinUser = systemBulletinUserMapper.selectById(id); |
| | | systemBulletinUser.setIsRead(1); |
| | | systemBulletinUserMapper.updateById(systemBulletinUser); |
| | | return systemBulletinInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.SystemConfigMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemConfigService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | @Service |
| | | public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.SystemMessageMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemMessageService; |
| | | import com.supersavedriving.driver.modular.system.warpper.SystemMessageWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统消息逻辑类 |
| | | * @author pzb |
| | | * @Date 2023/2/10 15:34 |
| | | */ |
| | | @Service |
| | | public class SystemMessageServiceImpl extends ServiceImpl<SystemMessageMapper, SystemMessage> implements ISystemMessageService { |
| | | |
| | | |
| | | /** |
| | | * 获取个人系统消息列表 |
| | | * @param uid |
| | | * @param pageNum |
| | | * @param size |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<SystemMessageWarpper> querySystemMessageList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<SystemMessageWarpper> systemMessageWarppers = this.baseMapper.querySystemMessageList(uid, pageNum, size); |
| | | return systemMessageWarppers; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 阅读系统消息 |
| | | * @param uid |
| | | * @param ids |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void readSystems(Integer uid, String ids) throws Exception { |
| | | String[] split = ids.split(","); |
| | | List<SystemMessage> systemMessages = this.selectList(new EntityWrapper<SystemMessage>().eq("userType", 2).eq("userId", uid).in("id", split)); |
| | | for (SystemMessage systemMessage : systemMessages) { |
| | | systemMessage.setIsRead(1); |
| | | } |
| | | this.updateBatchById(systemMessages); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.GaoDe; |
| | | |
| | | /** |
| | | * 高德地图配置 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:52 |
| | | */ |
| | | public interface MapConfig { |
| | | |
| | | /** |
| | | * 高德key |
| | | */ |
| | | String key = ""; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.GaoDe; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 地图工具类 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:48 |
| | | */ |
| | | public class MapUtil { |
| | | |
| | | public static Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取两点的距离 |
| | | * @param origins 起点坐标 |
| | | * @param destination 终点坐标 |
| | | * @param type 计算类型:0:直线距离 1:驾车导航距离(仅支持国内坐标)。 |
| | | * @return |
| | | */ |
| | | public static Map<String, String> getDistance(String origins, String destination, Integer type){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/distance?key=" + MapConfig.key + "&origins=" + origins + "&destination=" + destination + |
| | | "&type=" + type; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | logger.debug(httpResult.getData()); |
| | | return null; |
| | | } |
| | | String data = httpResult.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | String status = jsonObject.getString("status"); |
| | | if(status.equals("1")){ |
| | | JSONArray results = jsonObject.getJSONArray("results"); |
| | | JSONObject jsonObject1 = results.getJSONObject(0); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("distance", jsonObject1.getString("distance"));//距离(米) |
| | | map.put("duration", jsonObject1.getString("duration"));//预计时间(秒) |
| | | return map; |
| | | }else{ |
| | | logger.debug(data); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | @Component |
| | | public class PushUtil { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private Map<String, JSONObject> pushMap = new HashMap<>();//存储需要定时推送的数据 |
| | | |
| | | private Map<String, Timer> taskMap = new HashMap<>();//存储定时推送的定时器 |
| | | |
| | | |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 余额不足提醒 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushBalance(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "BALANCE"); |
| | | msg.put("data", new Object()); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.httpClinet; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.config.RequestConfig; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContexts; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.security.KeyStore; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * http工具类 |
| | | */ |
| | | public class HttpClientUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class); |
| | | |
| | | private static PoolingHttpClientConnectionManager connectionManager; |
| | | |
| | | |
| | | { |
| | | //1.创建连接池管理器 |
| | | connectionManager = new PoolingHttpClientConnectionManager(60000, |
| | | TimeUnit.MILLISECONDS); |
| | | connectionManager.setMaxTotal(1000); |
| | | connectionManager.setDefaultMaxPerRoute(50); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个httpClient对象 |
| | | */ |
| | | private static CloseableHttpClient getHttpCline(){ |
| | | return HttpClients.custom() |
| | | .setConnectionManager(connectionManager) |
| | | .disableAutomaticRetries() |
| | | .build(); |
| | | } |
| | | |
| | | private static RequestConfig getRequestConfig(){ |
| | | RequestConfig.Builder builder = RequestConfig.custom(); |
| | | builder.setSocketTimeout(60000)//3.1设置客户端等待服务端返回数据的超时时间 |
| | | .setConnectTimeout(30000)//3.2设置客户端发起TCP连接请求的超时时间 |
| | | .setExpectContinueEnabled(true) |
| | | .setConnectionRequestTimeout(30000);//3.3设置客户端从连接池获取链接的超时时间 |
| | | return builder.build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 创建一个POST请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | List<NameValuePair> list = new ArrayList<>(); |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | list.add(new BasicNameValuePair(key, null == params.get(key) ? null : params.get(key).toString())); |
| | | } |
| | | } |
| | | switch (contentType){ |
| | | case "form": |
| | | httpPost.setEntity(new UrlEncodedFormEntity(list, "UTF-8")); |
| | | break; |
| | | case "json": |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | String s =objectMapper.writeValueAsString(params); |
| | | httpPost.setEntity(new StringEntity(s, ContentType.create(ContentType.APPLICATION_JSON.getMimeType(), Charset.forName("UTF-8")))); |
| | | break; |
| | | } |
| | | return getHttpCline().execute(httpPost); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取get请求实例 |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | */ |
| | | private static CloseableHttpResponse setGetHttpRequset(String url, Map<String, Object> params, Map<String, String> header) throws Exception{ |
| | | StringBuffer sb = new StringBuffer(); |
| | | String p = ""; |
| | | if(null != params){ |
| | | Set<String> keys = params.keySet(); |
| | | for(String key : keys){ |
| | | sb.append(key + "=" + params.get(key) + "&"); |
| | | } |
| | | p = "?" + sb.substring(0, sb.length() - 1); |
| | | } |
| | | HttpGet httpGet = new HttpGet(url + p); |
| | | httpGet.setConfig(getRequestConfig()); |
| | | if(null != header){ |
| | | for(String key : header.keySet()){ |
| | | httpGet.setHeader(key, header.get(key)); |
| | | } |
| | | } |
| | | return getHttpCline().execute(httpGet); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送http请求 |
| | | * @param mothed "GET、POST、PUT、HEAD、DELETE、HEAD、OPTIONS" |
| | | * @param url 请求地址 |
| | | * @param params 请求参数 |
| | | * @param header 请求头 |
| | | * @param contentType 参数请求方式form/json |
| | | * @return |
| | | */ |
| | | public static HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | | httpResponse = setGetHttpRequset(url, params, header); |
| | | break; |
| | | case "POST": |
| | | httpResponse = setPostHttpRequset(url, params, header, contentType); |
| | | break; |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | logger.info(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送XML请求 |
| | | * @param url 请求地址 |
| | | * @param xml XML数据 |
| | | * @param header 自定义请求头 |
| | | * @return |
| | | */ |
| | | public HttpResult pushHttpRequsetXml(String url, String xml, Map<String, String> header) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | httpPost.setConfig(getRequestConfig()); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpResponse httpResponse = getHttpCline().execute(httpPost); |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | this.close(httpResponse); |
| | | return httpResult; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 请求https发送XML请求 |
| | | * @param url 接口路径 |
| | | * @param xml 内容 |
| | | * @param header 请求头 |
| | | * @param certPassword 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ |
| | | HttpPost httpPost = new HttpPost(url); |
| | | for(String key : header.keySet()){ |
| | | httpPost.setHeader(key, header.get(key)); |
| | | } |
| | | httpPost.setHeader("Content-Type", "application/xml"); |
| | | httpPost.setEntity(new StringEntity(xml, "UTF-8")); |
| | | CloseableHttpClient httpCline = this.initCert(certPassword, certPath, certType); |
| | | CloseableHttpResponse httpResponse = httpCline.execute(httpPost); |
| | | String content = null; |
| | | if(httpResponse.getStatusLine().getStatusCode() == 200){ |
| | | content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | }else{ |
| | | content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); |
| | | } |
| | | this.close(httpResponse); |
| | | httpCline.close(); |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化https对象(带证书) |
| | | * @param key 证书密码 |
| | | * @param certPath 证书路径 |
| | | * @param certType 证书类型 |
| | | * @throws Exception |
| | | */ |
| | | private CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { |
| | | KeyStore keyStore = KeyStore.getInstance(certType); |
| | | InputStream inputStream = new FileInputStream(new File(certPath)); |
| | | try { |
| | | keyStore.load(inputStream, key.toCharArray()); |
| | | } finally { |
| | | inputStream.close(); |
| | | } |
| | | SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, key.toCharArray()).build(); |
| | | SSLConnectionSocketFactory sslsf = |
| | | new SSLConnectionSocketFactory(sslcontext, new String[] {"TLSv1"}, null, |
| | | SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
| | | return HttpClients.custom().setSSLSocketFactory(sslsf).build(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭资源 |
| | | */ |
| | | private static void close(CloseableHttpResponse httpResponse){ |
| | | try { |
| | | if(null != httpResponse){ |
| | | EntityUtils.consume(httpResponse.getEntity());//此处高能,通过源码分析,由EntityUtils是否回收HttpEntity |
| | | httpResponse.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | try { |
| | | if(null != httpResponse){ |
| | | httpResponse.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.httpClinet; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * http请求返回封装 |
| | | */ |
| | | @Data |
| | | public class HttpResult { |
| | | /** |
| | | * 返回状态码 |
| | | */ |
| | | private Integer code; |
| | | /** |
| | | * 返回结果 |
| | | */ |
| | | private String data; |
| | | |
| | | /** |
| | | * 返回封装结果 |
| | | * @param code |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public static HttpResult getHttpResult(Integer code, String data){ |
| | | HttpResult httpResult = new HttpResult(); |
| | | httpResult.setCode(code); |
| | | httpResult.setData(data); |
| | | return httpResult; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.mongodb; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.mongodb.BasicDBObject; |
| | | import com.mongodb.client.AggregateIterable; |
| | | import com.mongodb.client.MongoCursor; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.LocationQuery; |
| | | import org.bson.Document; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Supplier; |
| | | |
| | | |
| | | @Component |
| | | public class MongoUtils<T> { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | /** |
| | | * lambda |
| | | * @param data 添加数据 |
| | | * @param collectionName 表名 |
| | | */ |
| | | public void insert(Supplier<T> data,String collectionName){ |
| | | mongoTemplate.insert(data.get(),collectionName); |
| | | } |
| | | |
| | | public void insert(Object data, String collectionName){ |
| | | mongoTemplate.insert(data,collectionName); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param sp 查询条件lambda |
| | | * @param sets 更新的字段 |
| | | * @param collectionName 表名 |
| | | */ |
| | | public void update(Supplier<Criteria> sp, Supplier<Map<String,Object>> sets, String collectionName){ |
| | | Query query = Query.query(sp.get()); |
| | | Update update = new Update(); |
| | | |
| | | sets.get().forEach((key,value) ->{ |
| | | //System.out.println(key); |
| | | //System.out.println(value); |
| | | update.set(key,value); |
| | | }); |
| | | mongoTemplate.updateFirst(query, update, collectionName); |
| | | } |
| | | |
| | | public void update(Criteria sp, Supplier<Map<String,Object>> sets, String collectionName){ |
| | | Query query = Query.query(sp); |
| | | Update update = new Update(); |
| | | |
| | | sets.get().forEach((key,value) ->{ |
| | | //System.out.println(key); |
| | | //System.out.println(value); |
| | | update.set(key,value); |
| | | }); |
| | | mongoTemplate.updateFirst(query, update, collectionName); |
| | | } |
| | | |
| | | /**lambda |
| | | * @param sp 查询条件lambda |
| | | * @param collectionName 表名 |
| | | * @return |
| | | */ |
| | | public List<T> query(Supplier<Criteria> sp, String collectionName, Class entityClass){ |
| | | Query query = Query.query(sp.get()); |
| | | List<T> ts = mongoTemplate.find(query,entityClass,collectionName); |
| | | |
| | | return ts; |
| | | } |
| | | |
| | | public List<T> query(Criteria sp, String collectionName, Class entityClass){ |
| | | Query query = Query.query(sp); |
| | | List<T> ts = mongoTemplate.find(query,entityClass,collectionName); |
| | | |
| | | return ts; |
| | | } |
| | | |
| | | /** |
| | | * @param sp 查询条件lambda |
| | | * @param collectionName 表名 |
| | | * @return |
| | | */ |
| | | public void delete(Supplier<Criteria> sp, String collectionName){ |
| | | Query query = Query.query(sp.get()); |
| | | mongoTemplate.remove(query, collectionName); |
| | | } |
| | | |
| | | public void delete(Criteria sp, String collectionName){ |
| | | Query query = Query.query(sp); |
| | | mongoTemplate.remove(query, collectionName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询符合条件总条数 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public long findLogCount(HashMap<String,Object> paras,Class entityClass,String collectionName) throws Exception { |
| | | Query query = new Query(); |
| | | Criteria criteria = new Criteria(); |
| | | if (null != paras ) { |
| | | Iterator<Entry<String, Object>> iterator = paras.entrySet().iterator(); |
| | | while(iterator.hasNext()) { |
| | | Entry<String, Object> entry = iterator.next(); |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | criteria.and(key).is(value); |
| | | |
| | | } |
| | | query.addCriteria(criteria); |
| | | } |
| | | long count = mongoTemplate.count(query, entityClass,collectionName); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 查询附近的对象 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | public List<Location> geoNear(LocationQuery model){ |
| | | List<Location> resultList = new ArrayList<>(); |
| | | try{ |
| | | List<BasicDBObject> pipeLine = new ArrayList<>(); |
| | | BasicDBObject aggregate = new BasicDBObject("$geoNear", |
| | | new BasicDBObject("near" |
| | | , new BasicDBObject("type", "Point") |
| | | .append("coordinates", model.getCoordinates())) |
| | | .append("distanceField", "distance") |
| | | .append("maxDistance", model.getDistance()) |
| | | .append("spherical", true) |
| | | |
| | | ); |
| | | |
| | | pipeLine.add(aggregate); |
| | | AggregateIterable<Document> location = mongoTemplate.getCollection("location").aggregate(pipeLine); |
| | | MongoCursor<Document> cursor = location.iterator(); |
| | | |
| | | //将查询的结果,封装成对象返回出去 |
| | | while (cursor.hasNext()) { |
| | | org.bson.Document document = cursor.next(); |
| | | Location node = JSONObject.parseObject(JSONObject.toJSONString(document),Location.class); |
| | | resultList.add(node); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GeoJson { |
| | | private String type; |
| | | private Double[] coordinates; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.index.CompoundIndex; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Document(collection = "driver_location") |
| | | @CompoundIndex(name = "location_index", def = "{'location': '2dsphere'}") |
| | | public class Location implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 4508868382007529970L; |
| | | |
| | | @Id |
| | | private String id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | private Integer driverId; |
| | | /** |
| | | * x:经度 y:纬度 |
| | | */ |
| | | private GeoJsonPoint location; |
| | | /** |
| | | * 位置名称 |
| | | **/ |
| | | private String name; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Long created; |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Long updated; |
| | | /** |
| | | * 上次更新时间 |
| | | */ |
| | | private Long lastUpdated; |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class LocationQuery { |
| | | /** |
| | | * 当前经纬度[xxx,xxx] |
| | | **/ |
| | | private Double[] coordinates; |
| | | /** |
| | | * 距离,如:200,500,1,3,5,10,20 |
| | | **/ |
| | | private Double distance; |
| | | /** |
| | | * 距离单位,如:m,km |
| | | **/ |
| | | private String unit; |
| | | /** |
| | | * 位置类型:1-景点,2-加油站,3-酒店 |
| | | **/ |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class AddOrderWarpper { |
| | | @ApiModelProperty(value = "用户电话", required = true, dataType = "string") |
| | | private String phone; |
| | | @ApiModelProperty(value = "用户姓名", required = false, dataType = "string") |
| | | private String userName; |
| | | @ApiModelProperty(value = "起点地址", required = true, dataType = "string") |
| | | private String startAddress; |
| | | @ApiModelProperty(value = "起点经度", required = true, dataType = "string") |
| | | private String startLng; |
| | | @ApiModelProperty(value = "起点纬度", required = true, dataType = "string") |
| | | private String startLat; |
| | | @ApiModelProperty(value = "终点地址", required = true, dataType = "string") |
| | | private String endAddress; |
| | | @ApiModelProperty(value = "终点经度", required = true, dataType = "string") |
| | | private String endLng; |
| | | @ApiModelProperty(value = "终点纬度", required = true, dataType = "string") |
| | | private String endLat; |
| | | } |
| | |
| | | @ApiModel |
| | | public class BaseWarpper { |
| | | @ApiModelProperty("id") |
| | | private Integer id; |
| | | private Long id; |
| | | @ApiModelProperty(value = "编号", required = true, dataType = "string") |
| | | private String code; |
| | | @ApiModelProperty(value = "名称", required = true, dataType = "stirng") |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class DriverPositionWarpper { |
| | | /** |
| | | * 司机id |
| | | */ |
| | | private Integer driverId; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private Double lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private Double lat; |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | private Integer orderType; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | private Integer orderId; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 订单坐标信息表 |
| | | */ |
| | | @Data |
| | | public class OrderPositionWarpper { |
| | | /** |
| | | * 订单类型 |
| | | */ |
| | | private Integer orderType; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | private Integer orderId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | private Integer driverId; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String lat; |
| | | /** |
| | | * 方向角 |
| | | */ |
| | | private String directionAngle; |
| | | /** |
| | | * 海拔 |
| | | */ |
| | | private String altitude; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统公告详情 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:44 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SystemBulletinInfo { |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | @ApiModelProperty("H5") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统公告列表 |
| | | * @author pzb |
| | | * @Date 2023/2/13 11:23 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SystemBulletinListWarpper { |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | @ApiModelProperty("介绍") |
| | | private String introduce; |
| | | @ApiModelProperty("图片") |
| | | private String img; |
| | | @ApiModelProperty("阅读状态(0=否,1=是)") |
| | | private Integer isRead; |
| | | @ApiModelProperty("时间") |
| | | private Long createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统消息 |
| | | * @author pzb |
| | | * @Date 2023/2/10 15:28 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SystemMessageWarpper { |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | @ApiModelProperty("阅读状态(0=否,1=是)") |
| | | private Integer isRead; |
| | | @ApiModelProperty("消息日期") |
| | | private Long createTime; |
| | | } |
| | |
| | | #callbackPath: http://47.108.254.217:80/user |
| | | |
| | | |
| | | --- |
| | | --- |
| | | |
| | | spring: |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://admin:123456@127.0.0.1:27017/admin |