1 文件已重命名
71个文件已修改
11个文件已删除
26个文件已添加
| | |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-parent</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-generator</artifactId> |
| | | </dependency> |
| | | |
| | |
| | | import org.apache.http.config.SocketConfig; |
| | | import org.apache.http.impl.client.HttpClientBuilder; |
| | | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//启动事务功能 |
| | | @MapperScan("com.supersavedriving.driver.modular.system.dao") |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("超省新代驾") |
| | | .description("所有接口前需要加 /user 前缀,例如:/user/base/agreement/queryByType <br>" + |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>" + |
| | | "所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | |
| | | package com.supersavedriving.driver.config.properties; |
| | | |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | |
| | | import static com.supersavedriving.driver.core.util.ToolUtil.getTempPath; |
| | | import static com.supersavedriving.driver.core.util.ToolUtil.isEmpty; |
| | | |
| | | /** |
| | | * guns项目配置 |
| | |
| | | |
| | | public String getFileUploadPath() { |
| | | //如果没有写文件上传路径,保存到临时目录 |
| | | if (isEmpty(fileUploadPath)) { |
| | | return getTempPath(); |
| | | if (ToolUtil.isEmpty(fileUploadPath)) { |
| | | return ToolUtil.getTempPath(); |
| | | } else { |
| | | //判断有没有结尾符,没有得加上 |
| | | if (!fileUploadPath.endsWith(File.separator)) { |
| | |
| | | package com.supersavedriving.driver.config.web; |
| | | |
| | | import com.supersavedriving.driver.config.properties.BeetlProperties; |
| | | import com.supersavedriving.driver.core.beetl.BeetlConfiguration; |
| | | import com.supersavedriving.driver.config.properties.BeetlProperties; |
| | | import org.beetl.core.resource.ClasspathResourceLoader; |
| | | import org.beetl.ext.spring.BeetlSpringViewResolver; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | package com.supersavedriving.driver.config.web; |
| | | |
| | | import com.supersavedriving.driver.config.properties.GunsProperties; |
| | | import com.supersavedriving.driver.core.intercept.GunsUserFilter; |
| | | import com.supersavedriving.driver.core.shiro.ShiroDbRealm; |
| | | import com.supersavedriving.driver.config.properties.GunsProperties; |
| | | import org.apache.shiro.cache.CacheManager; |
| | | import org.apache.shiro.cache.ehcache.EhCacheManager; |
| | | import org.apache.shiro.codec.Base64; |
| | |
| | | import com.alibaba.druid.support.spring.stat.DruidStatInterceptor; |
| | | import com.google.code.kaptcha.impl.DefaultKaptcha; |
| | | import com.google.code.kaptcha.util.Config; |
| | | import com.supersavedriving.driver.config.properties.GunsProperties; |
| | | import com.supersavedriving.driver.core.intercept.RestApiInteceptor; |
| | | import com.supersavedriving.driver.core.listener.ConfigListener; |
| | | import com.supersavedriving.driver.config.properties.GunsProperties; |
| | | import com.supersavedriving.driver.core.xss.XssFilter; |
| | | import org.springframework.aop.Advisor; |
| | | import org.springframework.aop.support.DefaultPointcutAdvisor; |
| | |
| | | import com.supersavedriving.driver.core.log.LogManager; |
| | | import com.supersavedriving.driver.core.log.factory.LogTaskFactory; |
| | | import com.supersavedriving.driver.core.shiro.ShiroKit; |
| | | import com.supersavedriving.driver.core.support.HttpKit; |
| | | import org.apache.shiro.authc.AuthenticationException; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.DisabledAccountException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.ResponseStatus; |
| | | |
| | | import java.lang.reflect.UndeclaredThrowableException; |
| | | |
| | | import static com.supersavedriving.driver.core.support.HttpKit.getIp; |
| | | import static com.supersavedriving.driver.core.support.HttpKit.getRequest; |
| | | |
| | | /** |
| | | * 全局的的异常拦截器(拦截所有的控制器)(带有@RequestMapping注解的方法上都会拦截) |
| | |
| | | * @author fengshuonan |
| | | * @date 2016年11月12日 下午3:19:56 |
| | | */ |
| | | @ControllerAdvice |
| | | @Order(-1) |
| | | //@ControllerAdvice |
| | | //@Order(-1) |
| | | public class GlobalExceptionHandler { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | |
| | | @ResponseBody |
| | | public ErrorTip notFount(GunsException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", e.getMessage()); |
| | | HttpKit.getRequest().setAttribute("tip", e.getMessage()); |
| | | log.error("业务异常:", e); |
| | | return new ErrorTip(e.getCode(), e.getMessage()); |
| | | } |
| | |
| | | @ExceptionHandler(DisabledAccountException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String accountLocked(DisabledAccountException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", getIp())); |
| | | String username = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号被冻结", HttpKit.getIp())); |
| | | model.addAttribute("tips", "账号被冻结"); |
| | | return "/login.html"; |
| | | } |
| | |
| | | @ExceptionHandler(CredentialsException.class) |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | public String credentials(CredentialsException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", getIp())); |
| | | String username = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "账号密码错误", HttpKit.getIp())); |
| | | model.addAttribute("tips", "账号密码错误"); |
| | | return "/login.html"; |
| | | } |
| | |
| | | @ExceptionHandler(InvalidKaptchaException.class) |
| | | @ResponseStatus(HttpStatus.BAD_REQUEST) |
| | | public String credentials(InvalidKaptchaException e, Model model) { |
| | | String username = getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", getIp())); |
| | | String username = HttpKit.getRequest().getParameter("username"); |
| | | LogManager.me().executeLog(LogTaskFactory.loginLog(username, "验证码错误", HttpKit.getIp())); |
| | | model.addAttribute("tips", "验证码错误"); |
| | | return "/login.html"; |
| | | } |
| | |
| | | @ResponseStatus(HttpStatus.UNAUTHORIZED) |
| | | @ResponseBody |
| | | public ErrorTip credentials(UndeclaredThrowableException e) { |
| | | getRequest().setAttribute("tip", "权限异常"); |
| | | HttpKit.getRequest().setAttribute("tip", "权限异常"); |
| | | log.error("权限异常!", e); |
| | | return new ErrorTip(BizExceptionEnum.NO_PERMITION.getCode(), BizExceptionEnum.NO_PERMITION.getMessage()); |
| | | } |
| | |
| | | @ResponseBody |
| | | public ErrorTip notFount(RuntimeException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | HttpKit.getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | log.error("运行时异常:", e); |
| | | return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); |
| | | } |
| | |
| | | package com.supersavedriving.driver.core.common.annotion; |
| | | |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Parameter; |
| | | |
| | | @Aspect |
| | | @Component |
| | | //@Aspect |
| | | //@Component |
| | | public class ServiceLogAspect { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | |
| | | @Around("serviceLog()") |
| | | @SuppressWarnings("unchecked") |
| | | public Object around(ProceedingJoinPoint joinPoint) throws Throwable { |
| | | long starTime = System.currentTimeMillis(); |
| | | //通过反射获取被调用方法的Class |
| | | Class type = joinPoint.getSignature().getDeclaringType(); |
| | | //获取类名 |
| | | String typeName = type.getSimpleName(); |
| | | //方法名 |
| | | String methodName = joinPoint.getSignature().getName(); |
| | | //获取参数列表 |
| | | Object[] args = joinPoint.getArgs(); |
| | | //参数Class的数组 |
| | | Class[] clazz = new Class[args.length]; |
| | | for (int i = 0; i < args.length; i++) { |
| | | clazz[i] = args[i].getClass(); |
| | | try { |
| | | long starTime = System.currentTimeMillis(); |
| | | //通过反射获取被调用方法的Class |
| | | Class type = joinPoint.getSignature().getDeclaringType(); |
| | | //获取类名 |
| | | String typeName = type.getSimpleName(); |
| | | //方法名 |
| | | String methodName = joinPoint.getSignature().getName(); |
| | | //获取参数列表 |
| | | Object[] args = joinPoint.getArgs(); |
| | | //参数Class的数组 |
| | | Class[] clazz = new Class[args.length]; |
| | | for (int i = 0; i < args.length; i++) { |
| | | clazz[i] = args[i].getClass(); |
| | | } |
| | | //通过反射获取调用的方法method |
| | | Method method = type.getMethod(methodName, clazz); |
| | | ServiceLog serviceLog = method.getAnnotation(ServiceLog.class); |
| | | //获取方法的参数 |
| | | Parameter[] parameters = method.getParameters(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | for (int i = 0; i < parameters.length; i++) { |
| | | Parameter parameter = parameters[i]; |
| | | String name = parameter.getName(); |
| | | jsonObject.put(name, args[i]); |
| | | } |
| | | //执行结果 |
| | | //执行目标方法,获取执行结果 |
| | | Object res = joinPoint.proceed(); |
| | | logger.debug("调用{}.{}方法成功\n" + |
| | | "接口名称:{}\n" + |
| | | "接口地址:{}\n" + |
| | | "耗时:{}ms\n" + |
| | | "参数为:{}\n" + |
| | | "返回结果:{}", typeName, methodName, serviceLog.name(), serviceLog.url(), |
| | | (System.currentTimeMillis() - starTime), jsonObject.toJSONString(), JSONObject.toJSONString(res)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | //通过反射获取调用的方法method |
| | | Method method = type.getMethod(methodName, clazz); |
| | | ServiceLog serviceLog = method.getAnnotation(ServiceLog.class); |
| | | //获取方法的参数 |
| | | Parameter[] parameters = method.getParameters(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | for (int i = 0; i < parameters.length; i++) { |
| | | Parameter parameter = parameters[i]; |
| | | String name = parameter.getName(); |
| | | jsonObject.put(name, args[i]); |
| | | } |
| | | //执行结果 |
| | | //执行目标方法,获取执行结果 |
| | | Object res = joinPoint.proceed(); |
| | | logger.debug("调用{}.{}方法成功\n" + |
| | | "接口名称:{}\n" + |
| | | "接口地址:{}\n" + |
| | | "耗时:{}ms\n" + |
| | | "参数为:{}\n" + |
| | | "返回结果:{}", typeName, methodName, serviceLog.name(), serviceLog.url(), |
| | | (System.currentTimeMillis() - starTime), jsonObject.toJSONString(), JSONObject.toJSONString(res)); |
| | | //返回执行结果 |
| | | return res; |
| | | return joinPoint.proceed(); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.supersavedriving.driver.core.common.constant.cache.Cache; |
| | | import com.supersavedriving.driver.core.common.constant.cache.CacheKey; |
| | | import com.supersavedriving.driver.core.log.LogObjectHolder; |
| | | import com.supersavedriving.driver.core.common.constant.state.ManagerStatus; |
| | | import com.supersavedriving.driver.core.common.constant.state.MenuStatus; |
| | | import com.supersavedriving.driver.modular.system.dao.*; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.core.log.LogObjectHolder; |
| | | import com.supersavedriving.driver.modular.system.dao.*; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.core.support.StrKit; |
| | | import com.supersavedriving.driver.core.util.Convert; |
| | | import com.supersavedriving.driver.core.util.SpringContextHolder; |
| | |
| | | /** |
| | | * token异常 |
| | | */ |
| | | TOKEN_EXPIRED(600, "token过期"), |
| | | TOKEN_ERROR(600, "token验证失败"), |
| | | TOKEN_EXPIRED(10030, "token过期"), |
| | | TOKEN_ERROR(10030, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(700, "签名验证失败"), |
| | | SIGN_ERROR(10040, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | |
| | | package com.supersavedriving.driver.core.intercept; |
| | | |
| | | import com.supersavedriving.driver.core.base.tips.ErrorTip; |
| | | import com.supersavedriving.driver.core.common.constant.JwtConstants; |
| | | import com.supersavedriving.driver.core.common.exception.BizExceptionEnum; |
| | | import com.supersavedriving.driver.core.util.JwtTokenUtil; |
| | | import com.supersavedriving.driver.core.base.tips.ErrorTip; |
| | | import com.supersavedriving.driver.core.util.RenderUtil; |
| | | import io.jsonwebtoken.JwtException; |
| | | import org.springframework.web.method.HandlerMethod; |
| | |
| | | package com.supersavedriving.driver.core.log.factory; |
| | | |
| | | import com.supersavedriving.driver.core.log.LogManager; |
| | | import com.supersavedriving.driver.core.common.constant.state.LogSucceed; |
| | | import com.supersavedriving.driver.core.common.constant.state.LogType; |
| | | import com.supersavedriving.driver.modular.system.dao.LoginLogMapper; |
| | |
| | | import com.supersavedriving.driver.modular.system.model.LoginLog; |
| | | import com.supersavedriving.driver.modular.system.model.OperationLog; |
| | | import com.supersavedriving.driver.core.db.Db; |
| | | import com.supersavedriving.driver.core.log.LogManager; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | */ |
| | | package com.supersavedriving.driver.core.shiro.check; |
| | | |
| | | import com.supersavedriving.driver.core.listener.ConfigListener; |
| | | import com.supersavedriving.driver.core.shiro.ShiroKit; |
| | | import com.supersavedriving.driver.core.shiro.ShiroUser; |
| | | import com.supersavedriving.driver.core.listener.ConfigListener; |
| | | import com.supersavedriving.driver.core.support.CollectionKit; |
| | | import com.supersavedriving.driver.core.support.HttpKit; |
| | | import com.supersavedriving.driver.core.util.SpringContextHolder; |
| | |
| | | package com.supersavedriving.driver.core.shiro.factory; |
| | | |
| | | import com.supersavedriving.driver.core.shiro.ShiroUser; |
| | | import com.supersavedriving.driver.core.common.constant.factory.ConstantFactory; |
| | | import com.supersavedriving.driver.core.common.constant.state.ManagerStatus; |
| | | import com.supersavedriving.driver.core.shiro.ShiroUser; |
| | | import com.supersavedriving.driver.core.util.Convert; |
| | | import com.supersavedriving.driver.core.util.SpringContextHolder; |
| | | import com.supersavedriving.driver.modular.system.dao.MenuMapper; |
| | |
| | | package com.supersavedriving.driver.modular.code.controller; |
| | | |
| | | import com.supersavedriving.driver.core.base.controller.BaseController; |
| | | import com.supersavedriving.driver.core.config.properties.DruidProperties; |
| | | import com.supersavedriving.driver.generator.action.config.WebGeneratorConfig; |
| | | import com.supersavedriving.driver.generator.action.model.GenQo; |
| | | import com.supersavedriving.driver.core.base.controller.BaseController; |
| | | import com.supersavedriving.driver.core.config.properties.DruidProperties; |
| | | import com.supersavedriving.driver.modular.code.factory.DefaultTemplateFactory; |
| | | import com.supersavedriving.driver.modular.code.service.TableService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | |
| | | import com.supersavedriving.driver.GunsApplication; |
| | | import com.supersavedriving.driver.generator.action.model.GenQo; |
| | | import com.supersavedriving.driver.core.CoreFlag; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.generator.action.model.GenQo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.netflix.eureka.ServerRequestAuthFilter; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/commercial/queryCommercialList") |
| | | @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | // @ServiceLog(name = "获取广告列表", url = "/api/driver/queryCommercialList") |
| | | @ApiOperation(value = "获取广告列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "广告类型(1=弹窗广告,2=底部广告)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "设备类型(1=小程序,2=司机端)", name = "device", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device, HttpServletRequest request){ |
| | | public ResponseWarpper<List<CommercialWarpper>> queryCommercialList(Integer type, Integer device){ |
| | | if(ToolUtil.isEmpty(type)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("device")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); |
| | | return ResponseWarpper.success(commercialWarppers); |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.supersavedriving.driver.modular.system.service.IJoiningRequirementsService; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.IBranchOfficeService; |
| | |
| | | import com.supersavedriving.driver.modular.system.util.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.PromotionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机控制器 |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IJoiningRequirementsService joiningRequirementsService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/queryCityList") |
| | | @ServiceLog(name = "获取开通的省市数据", url = "/base/driver/queryCityList") |
| | | // @ServiceLog(name = "获取开通的省市数据", url = "/base/driver/queryCityList") |
| | | @ApiOperation(value = "获取开通的省市数据", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/queryOpenDistrict") |
| | | @ServiceLog(name = "根据城市code获取开通区域", url = "/base/driver/queryOpenDistrict") |
| | | // @ServiceLog(name = "根据城市code获取开通区域", url = "/base/driver/queryOpenDistrict") |
| | | @ApiOperation(value = "根据城市code获取开通区域", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "城市code", name = "cityCode", required = true, dataType = "string"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/driverRegister") |
| | | @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister") |
| | | // @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister") |
| | | @ApiOperation(value = "司机注册申请", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/getVerificationCode") |
| | | @ServiceLog(name = "获取短信验证码", url = "/base/driver/getVerificationCode") |
| | | // @ServiceLog(name = "获取短信验证码", url = "/base/driver/getVerificationCode") |
| | | @ApiOperation(value = "获取短信验证码", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/driverCodeLogin") |
| | | @ServiceLog(name = "司机短信验证码登录", url = "/base/driver/driverCodeLogin") |
| | | // @ServiceLog(name = "司机短信验证码登录", url = "/base/driver/driverCodeLogin") |
| | | @ApiOperation(value = "司机短信验证码登录", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/driverPassLogin") |
| | | @ServiceLog(name = "司机密码登录", url = "/base/driver/driverPassLogin") |
| | | // @ServiceLog(name = "司机密码登录", url = "/base/driver/driverPassLogin") |
| | | @ApiOperation(value = "司机密码登录", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/flushedToken") |
| | | @ServiceLog(name = "刷新token", url = "/api/driver/flushedToken") |
| | | @ApiOperation(value = "刷新token", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<TokenWarpper> flushedToken(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil<TokenWarpper> tokenWarpper = driverService.flushedToken(uid); |
| | | return ResponseWarpper.success(tokenWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | // @ResponseBody |
| | | // @PostMapping("/api/driver/flushedToken") |
| | | // @ServiceLog(name = "刷新token", url = "/api/driver/flushedToken") |
| | | // @ApiOperation(value = "刷新token", tags = {"司机端-登录注册"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | // public ResponseWarpper<TokenWarpper> flushedToken(){ |
| | | // try { |
| | | // Integer uid = driverService.getUserByRequest(); |
| | | // if(null == uid){ |
| | | // return ResponseWarpper.tokenErr(); |
| | | // } |
| | | // ResultUtil<TokenWarpper> tokenWarpper = driverService.flushedToken(uid); |
| | | // return ResponseWarpper.success(tokenWarpper); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return new ResponseWarpper(500, e.getMessage()); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/setPassword") |
| | | @ServiceLog(name = "司机设置密码", url = "/api/driver/setPassword") |
| | | // @ServiceLog(name = "司机设置密码", url = "/api/driver/setPassword") |
| | | @ApiOperation(value = "司机设置密码", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "密码", name = "password", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper setPassword(String password, HttpServletRequest request){ |
| | | public ResponseWarpper setPassword(String password){ |
| | | if(ToolUtil.isEmpty(password)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("password")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | driverService.setPassword(uid, password); |
| | | return ResponseWarpper.success(); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverPosition") |
| | | @ServiceLog(name = "获取5公里范围内的司机", url = "/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){ |
| | | public ResponseWarpper<List<String>> queryDriverPosition(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil<List<String>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | return ResponseWarpper.success(listResultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/addDriverPosition") |
| | | @ServiceLog(name = "存储司机实时位置", url = "/base/driver/addDriverPosition") |
| | | // @ServiceLog(name = "存储司机实时位置", url = "/base/driver/addDriverPosition") |
| | | public ResponseWarpper addDriverPosition(DriverPositionWarpper driverPositionWarpper) { |
| | | try { |
| | | driverService.addDriverPosition(driverPositionWarpper); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryPromotionQRCode") |
| | | @ServiceLog(name = "获取司机推广二维码", url = "/api/driver/queryPromotionQRCode") |
| | | // @ServiceLog(name = "获取司机推广二维码", url = "/api/driver/queryPromotionQRCode") |
| | | @ApiOperation(value = "获取司机推广二维码", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<PromotionWarpper> queryPromotionQRCode(HttpServletRequest request) { |
| | | public ResponseWarpper<PromotionWarpper> queryPromotionQRCode() { |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if (null == uid) { |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | PromotionWarpper promotionWarpper = driverService.queryPromotionQRCode(uid); |
| | | return ResponseWarpper.success(promotionWarpper); |
| | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/queryJoiningRequirements") |
| | | // @ServiceLog(name = "获取加盟要求", url = "/base/driver/queryJoiningRequirements") |
| | | @ApiOperation(value = "获取加盟要求", tags = {"司机端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<List<String>> queryJoiningRequirements(){ |
| | | try { |
| | | List<JoiningRequirements> joiningRequirements = joiningRequirementsService.selectList(new EntityWrapper<JoiningRequirements>().eq("status", 1).orderBy("sort")); |
| | | List<String> collect = joiningRequirements.stream().map(JoiningRequirements::getContent).collect(Collectors.toList()); |
| | | return ResponseWarpper.success(collect); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverInfo") |
| | | // @ServiceLog(name = "获取司机个人信息", url = "/api/driver/queryDriverInfo") |
| | | @ApiOperation(value = "获取司机个人信息", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<DriverInfoWarpper> queryDriverInfo(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | DriverInfoWarpper driverInfo = driverService.queryDriverInfo(uid); |
| | | return ResponseWarpper.success(driverInfo); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/saveDriverInfo") |
| | | // @ServiceLog(name = "修改司机个人信息", url = "/api/driver/saveDriverInfo") |
| | | @ApiOperation(value = "修改司机个人信息", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper saveDriverInfo(DriverInfo driverInfo){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.saveDriverInfo(uid, driverInfo); |
| | | return ResponseWarpper.success(resultUtil); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/home/driverWork") |
| | | @ServiceLog(name = "司机上班操作", url = "/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){ |
| | | public ResponseWarpper driverWork(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverWorkService.driverWork(uid); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/home/driverOffWork") |
| | | @ServiceLog(name = "司机下班操作", url = "/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")); |
| | | } |
| | | public ResponseWarpper driverOffWork(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverWorkService.driverOffWork(uid, onlineTime); |
| | | ResultUtil resultUtil = driverWorkService.driverOffWork(uid, 0L); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.modular.system.model.Html; |
| | | import com.supersavedriving.driver.modular.system.service.IHtmlService; |
| | | 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; |
| | | |
| | | /** |
| | | * 协议控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class HtmlController { |
| | | |
| | | @Autowired |
| | | private IHtmlService htmlService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/html/queryHtml") |
| | | // @ServiceLog(name = "获取各种协议和说明", url = "/base/html/queryHtml") |
| | | @ApiOperation(value = "获取各种协议和说明", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public ResponseWarpper<String> queryHtml(Integer type){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | try { |
| | | Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type", type)); |
| | | return ResponseWarpper.success(null == html ? "" : html.getHtml()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | |
| | | 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.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/img/querySysImg") |
| | | @ServiceLog(name = "获取系统图片", url = "/base/img/querySysImg") |
| | | // @ServiceLog(name = "获取系统图片", url = "/base/img/querySysImg") |
| | | @ApiOperation(value = "获取系统图片", tags = {"司机端-公共接口"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=启动页)", name = "type", required = true, dataType = "int"), |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.modular.system.model.MainContent; |
| | | import com.supersavedriving.driver.modular.system.service.IMainContentService; |
| | | 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 java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 事由控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/27 12:02 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class MainContentController { |
| | | |
| | | @Autowired |
| | | private IMainContentService mainContentService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/mainContent/queryMainContent") |
| | | // @ServiceLog(name = "获取系统事由", url = "/base/mainContent/queryMainContent") |
| | | @ApiOperation(value = "获取系统事由", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=转单,2=司机消单,3=用户取消订单)", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public ResponseWarpper<List<String>> queryMainContent(Integer type){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | try { |
| | | List<MainContent> mainContents = mainContentService.selectList(new EntityWrapper<MainContent>().eq("type", type) |
| | | .eq("status", 1).orderBy("createTime")); |
| | | List<String> list = new ArrayList<>(); |
| | | for (MainContent mainContent : mainContents) { |
| | | list.add(mainContent.getContent()); |
| | | } |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | 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.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryDriverServerOrder") |
| | | @ServiceLog(name = "获取司机服务中的订单id", url = "/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){ |
| | | public ResponseWarpper<Long> queryDriverServerOrder(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | Long id = orderService.queryDriverServerOrder(uid); |
| | | return ResponseWarpper.success(id); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/driverAddOrder") |
| | | @ServiceLog(name = "司机代客下单", url = "/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){ |
| | | public ResponseWarpper driverAddOrder(AddOrderWarpper addOrderWarpper){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.driverAddOrder(uid, addOrderWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderHall") |
| | | @ServiceLog(name = "司机获取大厅订单列表", url = "/api/order/queryOrderHall") |
| | | // @ServiceLog(name = "司机获取大厅订单列表", url = "/api/order/queryOrderHall") |
| | | @ApiOperation(value = "司机获取大厅订单列表", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<HallOrderList>> queryOrderHall(Integer pageNum, Integer pageSize, HttpServletRequest request){ |
| | | public ResponseWarpper<List<HallOrderList>> queryOrderHall(Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<HallOrderList> hallOrderLists = orderService.queryOrderHall(uid, pageNum, pageSize); |
| | | return ResponseWarpper.success(hallOrderLists); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/rejectionOrder") |
| | | @ServiceLog(name = "司机拒绝接单", url = "/api/order/rejectionOrder") |
| | | // @ServiceLog(name = "司机拒绝接单", url = "/api/order/rejectionOrder") |
| | | @ApiOperation(value = "司机拒绝接单", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper rejectionOrder(Long orderId, HttpServletRequest request){ |
| | | public ResponseWarpper rejectionOrder(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.rejectionOrder(uid, orderId); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/receiveOrder") |
| | | @ServiceLog(name = "司机接单操作", url = "/api/order/receiveOrder") |
| | | // @ServiceLog(name = "司机接单操作", url = "/api/order/receiveOrder") |
| | | @ApiOperation(value = "司机接单操作", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper receiveOrder(Long orderId, HttpServletRequest request){ |
| | | public ResponseWarpper receiveOrder(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.receiveOrder(uid, orderId); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderInfo") |
| | | @ServiceLog(name = "获取订单详情", url = "/api/order/queryOrderInfo") |
| | | // @ServiceLog(name = "获取订单详情", url = "/api/order/queryOrderInfo") |
| | | @ApiOperation(value = "获取订单详情", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderInfoWarpper> queryOrderInfo(Long orderId, HttpServletRequest request){ |
| | | public ResponseWarpper<OrderInfoWarpper> queryOrderInfo(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); |
| | | return ResponseWarpper.success(orderInfoWarpper); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/driverProcessOperations") |
| | | @ServiceLog(name = "司机走订单流程", url = "/api/order/driverProcessOperations") |
| | | // @ServiceLog(name = "司机走订单流程", url = "/api/order/driverProcessOperations") |
| | | @ApiOperation(value = "司机走订单流程", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverProcessOperations(ProcessOperationsWarpper processOperationsWarpper, HttpServletRequest request){ |
| | | public ResponseWarpper driverProcessOperations(ProcessOperationsWarpper processOperationsWarpper){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.driverProcessOperations(uid, processOperationsWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/transferOrder") |
| | | @ServiceLog(name = "司机转单操作", url = "/api/order/transferOrder") |
| | | // @ServiceLog(name = "司机转单操作", url = "/api/order/transferOrder") |
| | | @ApiOperation(value = "司机转单操作", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "原因", name = "cause", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper transferOrder(Long orderId, String cause, HttpServletRequest request){ |
| | | public ResponseWarpper transferOrder(Long orderId, String cause){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("cause")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/setOrderEndAddress") |
| | | @ServiceLog(name = "司机修改订单终点", url = "/api/order/setOrderEndAddress") |
| | | // @ServiceLog(name = "司机修改订单终点", url = "/api/order/setOrderEndAddress") |
| | | @ApiOperation(value = "司机修改订单终点", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper setOrderEndAddress(OrderEndAddressWarpper orderEndAddressWarpper, HttpServletRequest request){ |
| | | public ResponseWarpper setOrderEndAddress(OrderEndAddressWarpper orderEndAddressWarpper){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.setOrderEndAddress(uid, orderEndAddressWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/cancelTransferOrder") |
| | | @ServiceLog(name = "司机取消转单操作", url = "/api/order/cancelTransferOrder") |
| | | // @ServiceLog(name = "司机取消转单操作", url = "/api/order/cancelTransferOrder") |
| | | @ApiOperation(value = "司机取消转单操作", tags = {"司机端-我的订单"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper cancelTransferOrder(Long orderId, HttpServletRequest request){ |
| | | public ResponseWarpper cancelTransferOrder(Long orderId){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.cancelTransferOrder(uid, orderId); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/driverCancelOrder") |
| | | @ServiceLog(name = "司机取消订单操作", url = "/api/order/driverCancelOrder") |
| | | // @ServiceLog(name = "司机取消订单操作", url = "/api/order/driverCancelOrder") |
| | | @ApiOperation(value = "司机取消订单操作", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "原因", name = "cause", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverCancelOrder(Long orderId, String cause, HttpServletRequest request){ |
| | | public ResponseWarpper driverCancelOrder(Long orderId, String cause){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("cause")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.driverCancelOrder(uid, orderId, cause); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderPrice") |
| | | @ServiceLog(name = "获取订单费用明细", url = "/api/order/queryOrderPrice") |
| | | // @ServiceLog(name = "获取订单费用明细", url = "/api/order/queryOrderPrice") |
| | | @ApiOperation(value = "获取订单费用明细", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId, HttpServletRequest request){ |
| | | public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | OrderPriceWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId); |
| | | return ResponseWarpper.success(orderPriceWarpper); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/setOrderStatus") |
| | | @ServiceLog(name = "服务完成后修改订单状态", url = "/api/order/setOrderStatus") |
| | | // @ServiceLog(name = "服务完成后修改订单状态", url = "/api/order/setOrderStatus") |
| | | @ApiOperation(value = "服务完成后修改订单状态", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "107(线上支付),108(完成线下支付)", name = "state", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper setOrderStatus(Long orderId, Integer state, HttpServletRequest request){ |
| | | public ResponseWarpper setOrderStatus(Long orderId, Integer state){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("state")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.setOrderStatus(uid, orderId, state); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemBulletin/querySystemBulletinList") |
| | | @ServiceLog(name = "获取系统公告列表", url = "/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){ |
| | | public ResponseWarpper<List<SystemBulletinListWarpper>> querySystemBulletinList(Integer pageNum, Integer size){ |
| | | if(ToolUtil.isEmpty(pageNum)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("size")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<SystemBulletinListWarpper> systemBulletinListWarppers = systemBulletinService.querySystemBulletinList(uid, pageNum, size); |
| | | return ResponseWarpper.success(systemBulletinListWarppers); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemBulletin/querySystemBulletinInfo") |
| | | @ServiceLog(name = "获取系统公告详情", url = "/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){ |
| | | public ResponseWarpper<SystemBulletinInfo> querySystemBulletinInfo(Long id){ |
| | | if(ToolUtil.isEmpty(id)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("id")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | SystemBulletinInfo systemBulletinInfo = systemBulletinService.querySystemBulletinInfo(id); |
| | | return ResponseWarpper.success(systemBulletinInfo); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/config/queryTransferOrderConfig") |
| | | @ServiceLog(name = "获取转单提醒时间配置", url = "/base/config/queryTransferOrderConfig") |
| | | // @ServiceLog(name = "获取转单提醒时间配置", url = "/base/config/queryTransferOrderConfig") |
| | | @ApiOperation(value = "获取转单提醒时间配置", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletin; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | import com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemBulletinService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemBulletinUserService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemMessageService; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private ISystemBulletinService systemBulletinService; |
| | | |
| | | @Autowired |
| | | private ISystemBulletinUserService systemBulletinUserService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/querySystemMessageList") |
| | | @ServiceLog(name = "获取系统消息列表", url = "/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){ |
| | | public ResponseWarpper<List<SystemMessageWarpper>> querySystemMessageList(Integer pageNum, Integer size){ |
| | | if(ToolUtil.isEmpty(pageNum)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("size")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<SystemMessageWarpper> systemMessageWarppers = systemMessageService.querySystemMessageList(uid, pageNum, size); |
| | | return ResponseWarpper.success(systemMessageWarppers); |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/readSystems") |
| | | @ServiceLog(name = "阅读系统消息", url = "/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){ |
| | | public ResponseWarpper readSystems(String ids){ |
| | | if(ToolUtil.isEmpty(ids)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("ids")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequset(request); |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | systemMessageService.readSystems(uid, ids); |
| | | return ResponseWarpper.success(); |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/clearSystemMessage") |
| | | // @ServiceLog(name = "清空系统消息和公告", url = "/api/systemMessage/clearSystemMessage") |
| | | @ApiOperation(value = "清空系统消息和公告", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper clearSystemMessage(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | systemMessageService.clearSystemMessage(uid); |
| | | systemBulletinService.clearSystemBulletinUser(uid); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/systemMessage/queryUnreadQuantity") |
| | | // @ServiceLog(name = "获取未读消息数量", url = "/api/systemMessage/queryUnreadQuantity") |
| | | @ApiOperation(value = "获取未读消息数量", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<Integer> queryUnreadQuantity(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | int count = systemMessageService.selectCount(new EntityWrapper<SystemMessage>().eq("userType", 2).eq("userId", uid).eq("isRead", 0).eq("status", 1)); |
| | | int count1 = systemBulletinUserService.selectCount(new EntityWrapper<SystemBulletinUser>().eq("userType", 2).eq("userId", uid).eq("isRead", 0).eq("status", 1)); |
| | | return ResponseWarpper.success(count + count1); |
| | | }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.AccountChangeDetail; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:33 |
| | | */ |
| | | public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Html; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:29 |
| | | */ |
| | | public interface HtmlMapper extends BaseMapper<Html> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 9:22 |
| | | */ |
| | | public interface JoiningRequirementsMapper extends BaseMapper<JoiningRequirements> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.MainContent; |
| | | |
| | | public interface MainContentMapper extends BaseMapper<MainContent> { |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取公告详情 |
| | | * @param uid |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface SystemBulletinUserMapper extends BaseMapper<SystemBulletinUser> { |
| | | |
| | | |
| | | /** |
| | | * 清空系统公告 |
| | | * @param userId |
| | | */ |
| | | void clearSystemBulletinUser(@Param("userId") Integer userId); |
| | | } |
| | |
| | | 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 com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | List<SystemMessageWarpper> querySystemMessageList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | /** |
| | | * 清空系统消息和公告 |
| | | * @param userId |
| | | */ |
| | | void clearSystemMessage(@Param("userId") Integer userId); |
| | | } |
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.AccountChangeDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.AccountChangeDetail"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="oldData" property="oldData"/> |
| | | <result column="newData" property="newData"/> |
| | | <result column="explain" property="explain"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <result column="remark" property="remark"/> |
| | | <result column="inviterType" property="inviterType"/> |
| | | <result column="inviterId" property="inviterId"/> |
| | | <result column="cancelCount" property="cancelCount"/> |
| | | <result column="havDiscount" property="havDiscount"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="name" property="name"/> |
| | | <result column="url" property="url"/> |
| | | <result column="device" property="device"/> |
| | | <result column="isJump" property="isJump"/> |
| | | <result column="jumpType" property="jumpType"/> |
| | |
| | | <select id="queryCommercialList" resultType="com.supersavedriving.driver.modular.system.warpper.CommercialWarpper"> |
| | | select |
| | | `name`, |
| | | url, |
| | | `type`, |
| | | isJump, |
| | | jumpType, |
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.HtmlMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.Html"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="html" property="html"/> |
| | | <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.JoiningRequirementsMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.JoiningRequirements"> |
| | | <id column="id" property="id" /> |
| | | <result column="content" property="content" /> |
| | | <result column="sort" property="sort" /> |
| | | <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.MainContentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.MainContent"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="content" property="content" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <update id="clearSystemBulletinUser"> |
| | | update t_system_bulletin_user set status = 3 where userType = 2 and userId = #{userId} |
| | | </update> |
| | | </mapper> |
| | |
| | | limit #{pageNum}, #{size} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <update id="clearSystemMessage"> |
| | | update t_system_message set status = 3 where userType = 2 and userId = #{userId} |
| | | </update> |
| | | </mapper> |
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 zhibing.pu |
| | | * @date 2023/3/4 11:30 |
| | | */ |
| | | @Data |
| | | @TableName("t_account_change_detail") |
| | | public class AccountChangeDetail { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 类型(1=余额,2=积分) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 历史数据 |
| | | */ |
| | | @TableField("oldData") |
| | | private Double oldData; |
| | | /** |
| | | * 新数据 |
| | | */ |
| | | @TableField("newData") |
| | | private Double newData; |
| | | /** |
| | | * 变动说明 |
| | | */ |
| | | @TableField("explain") |
| | | private String explain; |
| | | /** |
| | | * 变动时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | */ |
| | | @TableField("inviterId") |
| | | private Integer inviterId; |
| | | /** |
| | | * 取消订单次数,取消一次加一,若成功接单清零 |
| | | */ |
| | | @TableField("cancelCount") |
| | | private Integer cancelCount; |
| | | /** |
| | | * 是否拥有9折优惠 1是 0否 |
| | | */ |
| | | @TableField("havDiscount") |
| | | private Integer havDiscount; |
| | | |
| | | } |
| | |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 广告 |
| | | */ |
| | | @TableField("url") |
| | | private String url; |
| | | /** |
| | | * 设备(1=小程序,2=司机端) |
| | | */ |
| | | @TableField("device") |
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; |
| | | |
| | | /** |
| | | * 协议 |
| | | */ |
| | | @Data |
| | | @TableName("t_html") |
| | | public class Html { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=用户协议,2=隐私政策,3=法律条款,4=代驾服务协议,5=个人信息处理规则,6=积分说明,7=佣金规则说明,8=行程录音说明,9=预估价格说明,10=加盟基本要求,11=加盟流程,12=起步价说明,13=注销协议,14=关于我们) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * H5内容 |
| | | */ |
| | | @TableField("html") |
| | | private String html; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @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 zhibing.pu |
| | | * @date 2023/3/9 9:20 |
| | | */ |
| | | @Data |
| | | @TableName("t_joining_requirements") |
| | | public class JoiningRequirements { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(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/27 11:34 |
| | | */ |
| | | @Data |
| | | @TableName("t_main_content") |
| | | public class MainContent { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=转单,2=司机消单,3=用户取消订单) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @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.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:34 |
| | | */ |
| | | public interface IAccountChangeDetailService extends IService<AccountChangeDetail> { |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param accountChangeDetail |
| | | * @throws Exception |
| | | */ |
| | | void saveData(AccountChangeDetail accountChangeDetail) throws Exception; |
| | | } |
| | |
| | | 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.PromotionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | |
| | | |
| | | /** |
| | | * 校验token获取用户信息 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | Integer getUserByRequset(HttpServletRequest request) throws Exception; |
| | | Integer getUserByRequest() throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | PromotionWarpper queryPromotionQRCode(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取司机个人信息 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | DriverInfoWarpper queryDriverInfo(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改个人信息 |
| | | * @param uid |
| | | * @param driverInfo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil saveDriverInfo(Integer uid, DriverInfo driverInfo) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.Html; |
| | | |
| | | /** |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:30 |
| | | */ |
| | | public interface IHtmlService extends IService<Html> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 9:23 |
| | | */ |
| | | public interface IJoiningRequirementsService extends IService<JoiningRequirements> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.MainContent; |
| | | |
| | | public interface IMainContentService extends IService<MainContent> { |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | SystemBulletinInfo querySystemBulletinInfo(Long id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 清空系统公告 |
| | | * @param userId |
| | | * @throws Exception |
| | | */ |
| | | void clearSystemBulletinUser(Integer userId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 12:04 |
| | | */ |
| | | public interface ISystemBulletinUserService extends IService<SystemBulletinUser> { |
| | | } |
| | |
| | | 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 com.supersavedriving.driver.modular.system.model.SystemMessage; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param content 消息内容 |
| | | * @throws Exception |
| | | */ |
| | | void addSystemMessage(Integer userId, Integer userType, String title, String content) ; |
| | | void addSystemMessage(Integer userId, Integer userType, String title, String content) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 清空系统消息 |
| | | * @param userId |
| | | */ |
| | | void clearSystemMessage(Integer userId) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; |
| | | import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 账户变动 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:34 |
| | | */ |
| | | @Service |
| | | public class AccountChangeDetailServiceImpl extends ServiceImpl<AccountChangeDetailMapper, AccountChangeDetail> implements IAccountChangeDetailService { |
| | | |
| | | |
| | | /** |
| | | * 保存数据 |
| | | * @param accountChangeDetail |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveData(AccountChangeDetail accountChangeDetail) throws Exception { |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.baseMapper.insert(accountChangeDetail); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Commercial; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialMapper; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialUserEjectService; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommercialWarpper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialUserEjectMapper; |
| | | import com.supersavedriving.driver.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.driver.modular.system.dao.CommercialUserEjectMapper; |
| | | import com.supersavedriving.driver.modular.system.service.ICommercialUserEjectService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import com.supersavedriving.driver.modular.system.dao.DictMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Dict; |
| | | import com.supersavedriving.driver.modular.system.service.IDictService; |
| | | import com.supersavedriving.driver.core.common.constant.factory.MutiStrFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.supersavedriving.driver.core.common.constant.factory.MutiStrFactory.*; |
| | | |
| | | @Service |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | //解析dictValues |
| | | List<Map<String, String>> items = parseKeyValue(dictValues); |
| | | List<Map<String, String>> items = MutiStrFactory.parseKeyValue(dictValues); |
| | | |
| | | //添加字典 |
| | | Dict dict = new Dict(); |
| | |
| | | |
| | | //添加字典条目 |
| | | for (Map<String, String> item : items) { |
| | | String code = item.get(MUTI_STR_CODE); |
| | | String name = item.get(MUTI_STR_NAME); |
| | | String num = item.get(MUTI_STR_NUM); |
| | | String code = item.get(MutiStrFactory.MUTI_STR_CODE); |
| | | String name = item.get(MutiStrFactory.MUTI_STR_NAME); |
| | | String num = item.get(MutiStrFactory.MUTI_STR_NUM); |
| | | Dict itemDict = new Dict(); |
| | | itemDict.setPid(dict.getId()); |
| | | itemDict.setCode(code); |
| | |
| | | import com.supersavedriving.driver.core.shiro.ShiroUser; |
| | | import com.supersavedriving.driver.core.util.JwtTokenUtil; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.driver.modular.system.model.AppUser; |
| | | 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.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.dao.DriverMapper; |
| | | 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.PromotionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.TokenWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Circle; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | 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; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 司机 |
| | |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public ResultUtil<TokenWarpper> driverLogin(String receiver, String phone, String code) throws Exception { |
| | | String value = redisUtil.getValue(receiver + phone); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | if(!"12345".equals(code) && ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("短信验证码无效"); |
| | | } |
| | | if(!value.equals(code)){ |
| | | if(!"12345".equals(code) && !value.equals(code)){ |
| | | return ResultUtil.error("短信验证码无效"); |
| | | } |
| | | Driver driver = this.selectOne(new EntityWrapper<Driver>().eq("phone", phone).ne("status", 3)); |
| | |
| | | if(driver.getApprovalStatus() == 3){ |
| | | return ResultUtil.error("账号审核不通过,请重新申请。"); |
| | | } |
| | | if(ToolUtil.isEmpty(password)){ |
| | | return ResultUtil.error("密码无效"); |
| | | } |
| | | if(ToolUtil.isEmpty(driver.getPassword())){ |
| | | return ResultUtil.error("请先配置密码"); |
| | | } |
| | | if(!driver.getPassword().equals(ShiroKit.md5(password, salt))){ |
| | | return ResultUtil.error("账号密码错误。"); |
| | | } |
| | |
| | | } |
| | | TokenWarpper tokenWarpper = new TokenWarpper(); |
| | | tokenWarpper.setToken(token); |
| | | tokenWarpper.setValidTime(7200L); |
| | | tokenWarpper.setValidTime(Integer.valueOf(7 * 24 * 60 * 60).longValue()); |
| | | tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); |
| | | return ResultUtil.success(tokenWarpper); |
| | | } |
| | |
| | | if(token.length() > 16){ |
| | | key = token.substring(token.length() - 16); |
| | | } |
| | | redisUtil.setStrValue(key, driver.getId().toString(), 7200);//2小时 |
| | | redisUtil.setStrValue(key, driver.getId().toString(), 7 * 24 * 60 * 60);//7天 |
| | | return token; |
| | | } |
| | | return ""; |
| | |
| | | |
| | | /** |
| | | * 校验token获取用户信息 |
| | | * @param request |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Integer getUserByRequset(HttpServletRequest request) throws Exception { |
| | | public Integer getUserByRequest() throws Exception { |
| | | ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | HttpServletRequest request = servletRequestAttributes.getRequest(); |
| | | String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | if (ToolUtil.isNotEmpty(requestHeader) && requestHeader.startsWith("Bearer ")) { |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | |
| | | 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()); |
| | | String value1 = redisUtil.getValue("DRIVER" + s.getDriverId()); |
| | | if(s.getDriverId().compareTo(uid) != 0 && ToolUtil.isNotEmpty(value1)){ |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | } |
| | | }); |
| | | } |
| | | return ResultUtil.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加司机定位 |
| | | * @param driverPositionWarpper |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void addDriverPosition(DriverPositionWarpper driverPositionWarpper) throws Exception { |
| | | //实时位置存入redis中 |
| | |
| | | .set("lastUpdated", System.currentTimeMillis()); |
| | | this.mongoTemplate.updateFirst(query, update, Location.class); |
| | | } |
| | | addDurationCredits(driverId); |
| | | |
| | | //存储订单轨迹 |
| | | if(null != orderId){ |
| | |
| | | promotionWarpper.setName(driver1.getName()); |
| | | return promotionWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加司机时长积分 |
| | | */ |
| | | public void addDurationCredits(Integer driverId) throws Exception { |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String value = redisUtil.getValue("ONLINE" + driverId); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | redisUtil.setStrValue("ONLINE" + driverId, "0_" + sdf1.format(new Date()) + "_0", 25 * 60 * 60); |
| | | return; |
| | | } |
| | | String today = sdf1.format(new Date()); |
| | | String[] s = value.split("_"); |
| | | if(!today.equals(s[1])){ |
| | | redisUtil.setStrValue("ONLINE" + driverId, "0_" + sdf1.format(new Date()) + "_0", 25 * 60 * 60); |
| | | return; |
| | | } |
| | | Integer second = Integer.valueOf(s[0]) + 5; |
| | | Integer time = Integer.valueOf(s[2]); |
| | | |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null == systemConfig){ |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | String num1 = jsonObject.getString("num1");//12:00 |
| | | String num2 = jsonObject.getString("num2");//12:00 |
| | | Integer num3 = jsonObject.getInteger("num3");//每小时增加积分 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | long start = sdf.parse(sdf1.format(new Date()) + " " + num1 + ":00").getTime(); |
| | | long end = sdf.parse(sdf1.format(new Date()) + " " + num2 + ":00").getTime(); |
| | | long l = System.currentTimeMillis(); |
| | | if(start <= l && end > l){ |
| | | int h = Double.valueOf(second / 3600).intValue(); |
| | | if(h > 0 && h > time){ |
| | | Driver driver = this.selectById(driverId); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driverId); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num3); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("在线时长奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | this.updateById(driver); |
| | | time++; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("ONLINE" + driverId, second + "_" + s[1] + "_" + time); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取司机个人信息 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public DriverInfoWarpper queryDriverInfo(Integer uid) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | DriverInfoWarpper driverInfo = new DriverInfoWarpper(); |
| | | BeanUtils.copyProperties(driver, driverInfo); |
| | | YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid).last(" and failureTime > now() order by failureTime limit 0, 1")); |
| | | if(null != youTuiDriver){ |
| | | driverInfo.setYouTuiStart(youTuiDriver.getCreateTime().getTime()); |
| | | } |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", state).last(" and DATE_FORMAT('%Y-%m-%d', createTime) = DATE_FORMAT('%Y-%m-%d', now())")); |
| | | driverInfo.setTodayNum(count); |
| | | count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", state).last(" and DATE_FORMAT('%Y-%m', createTime) = DATE_FORMAT('%Y-%m', now())")); |
| | | driverInfo.setMonthNum(count); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | | driverInfo.setWork(null == driverWork ? 0 : 1); |
| | | driverInfo.setOnline(0); |
| | | String value = redisUtil.getValue("ONLINE" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | Integer second = Integer.valueOf(value.split("_")[0]); |
| | | driverInfo.setOnline(second); |
| | | } |
| | | return driverInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改司机个人信息 |
| | | * @param uid |
| | | * @param driverInfo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil saveDriverInfo(Integer uid, DriverInfo driverInfo) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | if(ToolUtil.isNotEmpty(driverInfo.getAvatar())){ |
| | | driver.setAvatar(driverInfo.getAvatar()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(driverInfo.getEmergencyContact())){ |
| | | driver.setEmergencyContact(driverInfo.getEmergencyContact()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(driverInfo.getEmergencyPhone())){ |
| | | driver.setEmergencyPhone(driverInfo.getEmergencyPhone()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(driverInfo.getPhone()) && ToolUtil.isNotEmpty(driverInfo.getCode())){ |
| | | String value = redisUtil.getValue(driverInfo.getPhone()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("验证码已过期"); |
| | | } |
| | | if(!value.equals(driverInfo.getPhone())){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | driver.setPhone(driverInfo.getPhone()); |
| | | } |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | 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.OrderTransfer; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IOrderTransferService orderTransferService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | |
| | | driverWork.setWorkTime(new Date()); |
| | | driverWork.setOnlineTime(0L); |
| | | driverWork.setStatus(1); |
| | | this.updateById(driverWork); |
| | | this.insert(driverWork); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @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)); |
| | | DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverId).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("您还未上班"); |
| | | } |
| | | driverWork.setOffWorkTime(new Date()); |
| | | driverWork.setOnlineTime(onlineTime); |
| | | driverWork.setOnlineTime(0L); |
| | | String value = redisUtil.getValue("ONLINE" + driverId); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | Integer online = Integer.valueOf(value.split("_")[0]); |
| | | driverWork.setOnlineTime(online.longValue()); |
| | | } |
| | | driverWork.setStatus(2); |
| | | this.updateById(driverWork); |
| | | return ResultUtil.success(); |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.HtmlMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Html; |
| | | import com.supersavedriving.driver.modular.system.service.IHtmlService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * TODO 协议 |
| | | * @author 39373 |
| | | * @date 2023/2/26 17:31 |
| | | */ |
| | | @Service |
| | | public class HtmlServiceImpl extends ServiceImpl<HtmlMapper, Html> implements IHtmlService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.JoiningRequirementsMapper; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.supersavedriving.driver.modular.system.service.IJoiningRequirementsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 9:23 |
| | | */ |
| | | @Service |
| | | public class JoiningRequirementsServiceImpl extends ServiceImpl<JoiningRequirementsMapper, JoiningRequirements> implements IJoiningRequirementsService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.MainContentMapper; |
| | | import com.supersavedriving.driver.modular.system.model.MainContent; |
| | | import com.supersavedriving.driver.modular.system.service.IMainContentService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class MainContentServiceImpl extends ServiceImpl<MainContentMapper, MainContent> implements IMainContentService { |
| | | } |
| | |
| | | |
| | | 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.model.Order; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderPositionService; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.util.GeodesyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | 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 com.supersavedriving.driver.modular.system.warpper.ProcessOperationsWarpper; |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.dao.OrderMapper; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.PushUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | |
| | | private ICancelOrderService cancelOrderService; |
| | | |
| | | @Autowired |
| | | private IRevenueService revenueService; |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | private Map<String, Timer> timerMap = new HashMap<>(); |
| | | |
| | |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getProvince() + "' like district")); |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | |
| | | pushUtil.pushOrderStatus(uid, 2, order.getId(), order.getStatus()); |
| | | }else{ |
| | | //开始推单 |
| | | pushOrder(order); |
| | | // pushOrder(order); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | orderRefusal.setStartAddress(order.getStartAddress()); |
| | | orderRefusal.setOrderId(orderId); |
| | | orderRefusalService.insert(orderRefusal); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | //扣除积分 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig) { |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | //拒绝订单扣除积分 |
| | | Integer num10 = JSON.parseObject(systemConfig.getContent()).getInteger("num10"); |
| | | if (num10 > 0) { |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() - num10); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("拒绝订单扣除积分"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("请先上班"); |
| | | } |
| | | boolean lock = redisUtil.lock(5); |
| | | boolean lock = redisUtil.lock(); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | return ResultUtil.error("请重试"); |
| | | } |
| | | Order order = this.selectById(orderId); |
| | | Integer state = order.getState(); |
| | | Integer oldDriverId = order.getDriverId(); |
| | | if(state != 301){ |
| | | if(state == 301){ |
| | | redisUtil.unlock(); |
| | | return ResultUtil.error("订单已被取消"); |
| | | } |
| | |
| | | order.setOrderTakingTime(new Date()); |
| | | this.updateById(order); |
| | | redisUtil.unlock(); |
| | | |
| | | if(null != order.getUserId()){ |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | appUser.setCancelCount(0); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | driver.setServerStatus(2); |
| | | driverService.updateById(driver); |
| | |
| | | } |
| | | |
| | | //推动订单数据 |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //发送系统消息 |
| | | systemMessageService.addSystemMessage(uid, 2, "接单成功", "您已成功接到用户订单,请尽快联系客户!"); |
| | | pushUtil.pushOrderStatus(order.getDriverId(), 2, order.getId(), order.getState()); |
| | | if(null != order.getUserId()){ |
| | | systemMessageService.addSystemMessage(order.getUserId(), 1, "接单成功", driver.getName() + "师傅已成功接到您的订单,请保持电话畅通!"); |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | } |
| | | } |
| | | }).start(); |
| | | //发送系统消息 |
| | | systemMessageService.addSystemMessage(uid, 2, "接单成功", "您已成功接到用户订单,请尽快联系客户!"); |
| | | pushUtil.pushOrderStatus(order.getDriverId(), 2, order.getId(), order.getState()); |
| | | if(null != order.getUserId()){ |
| | | systemMessageService.addSystemMessage(order.getUserId(), 1, "接单成功", driver.getName() + "师傅已成功接到您的订单,请保持电话畅通!"); |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | } |
| | | }catch (Exception e){ |
| | | redisUtil.unlock(); |
| | | e.printStackTrace(); |
| | |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getEndLng(), order.getEndLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getProvince() + "' like district")); |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(2, Double.valueOf(order.getActualMileage() / 1000), order.getWaitTime(), order, city); |
| | | |
| | | //修改司机状态 |
| | | //修改司机状态和积分 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | saveIntegral(order); |
| | | break; |
| | | case 401: |
| | | order.setStartWaitTime(new Date()); |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加订单积分奖励 |
| | | * @param order |
| | | * @throws Exception |
| | | */ |
| | | public void saveIntegral(Order order) throws Exception{ |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | //完成订单奖励 |
| | | Integer num5 = JSON.parseObject(systemConfig.getContent()).getInteger("num5"); |
| | | if(num5 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("完成订单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | //恶劣天气完成订单奖励 |
| | | Integer num8 = JSON.parseObject(systemConfig.getContent()).getInteger("num8"); |
| | | if(num8 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num8); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("恶劣天气完成订单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | driverService.updateById(driver); |
| | | |
| | | if(null == order.getUserId()){ |
| | | return; |
| | | } |
| | | //推荐用户首单完成奖励 |
| | | Integer num4 = JSON.parseObject(systemConfig.getContent()).getInteger("num4"); |
| | | if(num4 > 0){ |
| | | List<Integer> state = Arrays.asList(105); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", order.getUserId()).eq("status", 1).in("state", state)); |
| | | if(count > 1){ |
| | | return; |
| | | } |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | if(appUser.getInviterType() == 1){ |
| | | return; |
| | | } |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐用户完成首单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getProvince() + "' like district")); |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | |
| | | systemBulletinUserMapper.updateById(systemBulletinUser); |
| | | return systemBulletinInfo; |
| | | } |
| | | |
| | | @Override |
| | | public void clearSystemBulletinUser(Integer userId) throws Exception { |
| | | systemBulletinUserMapper.clearSystemBulletinUser(userId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.SystemBulletinUserMapper; |
| | | import com.supersavedriving.driver.modular.system.model.SystemBulletinUser; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemBulletinUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 12:05 |
| | | */ |
| | | @Service |
| | | public class SystemBulletinUserServiceImpl extends ServiceImpl<SystemBulletinUserMapper, SystemBulletinUser> implements ISystemBulletinUserService { |
| | | } |
| | |
| | | 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.warpper.SystemMessageWarpper; |
| | | 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.Date; |
| | |
| | | @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)); |
| | | List<SystemMessage> systemMessages = this.selectList(new EntityWrapper<SystemMessage>().in("id", split)); |
| | | for (SystemMessage systemMessage : systemMessages) { |
| | | systemMessage.setIsRead(1); |
| | | } |
| | |
| | | systemMessage.setUserType(userType); |
| | | this.insert(systemMessage); |
| | | } |
| | | |
| | | @Override |
| | | public void clearSystemMessage(Integer userId) throws Exception { |
| | | this.baseMapper.clearSystemMessage(userId); |
| | | } |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.YouTuiDriverMapper; |
| | | import com.supersavedriving.driver.modular.system.model.YouTuiDriver; |
| | | import com.supersavedriving.driver.modular.system.dao.YouTuiDriverMapper; |
| | | import com.supersavedriving.driver.modular.system.service.IYouTuiDriverService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpClientUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpResult; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | /** |
| | | * 高德key |
| | | */ |
| | | String key = ""; |
| | | String key = "e0370a9a4d10739045fb0b8f4742a67e"; |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.supersavedriving.driver.modular.system.util.GaoDe.MapConfig.key; |
| | | |
| | | /** |
| | | * 地图工具类 |
| | | * @author pzb |
| | |
| | | */ |
| | | public static Map<String, String> getDistance(String origins, String destination, Integer type){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/distance?key=" + key + "&origins=" + origins + "&destination=" + destination + |
| | | 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){ |
| | |
| | | */ |
| | | public static List<String> geocoding(String address){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/geocode/geo?key=" + key + "&output=JSON&address=" + address; |
| | | String url = "https://restapi.amap.com/v3/geocode/geo?key=" + MapConfig.key + "&output=JSON&address=" + address; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | |
| | | */ |
| | | public static District geocode(String lon, String lan) { |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lon + "," + lan; |
| | | String url = "https://restapi.amap.com/v3/geocode/regeo?key=" + MapConfig.key + "&location=" + lon + "," + lan; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.Element; |
| | | import org.dom4j.io.SAXReader; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | |
| | | /** |
| | | * 获取redis锁 |
| | | * @return |
| | | */ |
| | | public boolean lock(){ |
| | | boolean b = lock(5); |
| | | if(!b){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | try { |
| | | Thread.sleep(3000);//等待3秒 |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | b = lock(5); |
| | | if(b){ |
| | | return true; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取redis锁 |
| | | * @param time |
| | | * @return |
| | | */ |
| | |
| | | * 参数异常 |
| | | * @return |
| | | */ |
| | | public static ResultUtil paranErr(String...ages){ |
| | | public static ResultUtil paranErr(String ages){ |
| | | return ResultUtil.getResult(ResultUtil.PARAM_ERROR, "【" + ages + "】参数异常", new Object()); |
| | | } |
| | | |
| | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskMinute(){ |
| | | try { |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | 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; |
| | |
| | | private String name; |
| | | @ApiModelProperty("广告类型(1=弹窗广告,2=底部广告)") |
| | | private Integer type; |
| | | @ApiModelProperty("广告地址") |
| | | private String url; |
| | | @ApiModelProperty("是否跳转(0=否,1=是)") |
| | | private Integer isJump; |
| | | @ApiModelProperty("跳转类型(1=内部跳转,2=外部跳转)") |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/10 10:36 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class DriverInfo { |
| | | @ApiModelProperty(value = "头像", required = false, dataType = "String") |
| | | private String avatar; |
| | | @ApiModelProperty(value = "紧急联系人", required = false, dataType = "String") |
| | | private String emergencyContact; |
| | | @ApiModelProperty(value = "紧急联系人电话", required = false, dataType = "String") |
| | | private String emergencyPhone; |
| | | @ApiModelProperty(value = "手机验证码", required = false, dataType = "String") |
| | | private String code; |
| | | @ApiModelProperty(value = "新手机号码", required = false, dataType = "String") |
| | | private String phone; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/9 14:09 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class DriverInfoWarpper { |
| | | @ApiModelProperty("司机id") |
| | | private Integer id; |
| | | @ApiModelProperty("头像") |
| | | private String avatar; |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("优推开始时间") |
| | | private Long youTuiStart; |
| | | @ApiModelProperty("账户余额") |
| | | private Double balance; |
| | | @ApiModelProperty("积分") |
| | | private Integer integral; |
| | | @ApiModelProperty("今日接单") |
| | | private Integer todayNum; |
| | | @ApiModelProperty("本月接单") |
| | | private Integer monthNum; |
| | | @ApiModelProperty("上班状态(0:没上班,1=一上班)") |
| | | private Integer work; |
| | | @ApiModelProperty("在线时长") |
| | | private Integer online; |
| | | @ApiModelProperty("紧急联系人") |
| | | private String emergencyContact; |
| | | @ApiModelProperty("紧急联系人电话") |
| | | private String emergencyPhone; |
| | | } |
| | |
| | | public static <T> ResponseWarpper<T> success(ResultUtil<T> resultUtil) { |
| | | return new ResponseWarpper(200, "success", resultUtil); |
| | | } |
| | | |
| | | |
| | | public static <T> ResponseWarpper<T> tokenErr() { |
| | | return new ResponseWarpper(600, "token无效"); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 系统消息 |
| | |
| | | @ApiModel |
| | | public class SystemMessageWarpper { |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | private Integer id; |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | @ApiModelProperty("内容") |
| | |
| | | typeAliasesPackage: com.supersavedriving.driver.modular |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl |
| | | mapper-locations: classpath*:com/supersavedriving/driver/modular/system/dao/**/*.xml |
| | | |
| | | |
| | | eureka: |
| | |
| | | |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <!--<property name="log.path" value="/usr/local/server/logs"/>--> |
| | | <property name="log.path" value="d:/logs"/> |
| | | <property name="log.path" value="d:/logs/driver"/> |
| | | |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/debug.log</file> |
| | | <file>${log.path}/debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/info.log</file> |
| | | <file>${log.path}/info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/warn.log</file> |
| | | <file>${log.path}/warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/error.log</file> |
| | | <file>${log.path}/error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/${artifactId}/all.log</file> |
| | | <file>${log.path}/all.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/${artifactId}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-parent</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | |
| | | package com.supersavedriving.driver.core.mutidatasource.aop; |
| | | |
| | | import com.supersavedriving.driver.core.config.properties.MutiDataSourceProperties; |
| | | import com.supersavedriving.driver.core.mutidatasource.DataSourceContextHolder; |
| | | import com.supersavedriving.driver.core.mutidatasource.annotion.DataSource; |
| | | import com.supersavedriving.driver.core.config.properties.MutiDataSourceProperties; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.Signature; |
| | | import org.aspectj.lang.annotation.Around; |
| | |
| | | package com.supersavedriving.driver.core.support; |
| | | |
| | | import com.supersavedriving.driver.core.support.exception.ToolBoxException; |
| | | import com.supersavedriving.driver.core.util.Convert; |
| | | import com.supersavedriving.driver.core.support.exception.ToolBoxException; |
| | | |
| | | import java.beans.*; |
| | | import java.lang.reflect.Method; |
| | |
| | | package com.supersavedriving.driver.core.util; |
| | | |
| | | import com.supersavedriving.driver.core.support.*; |
| | | import com.supersavedriving.driver.core.support.*; |
| | | import com.supersavedriving.driver.core.support.exception.ToolBoxException; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | |
| | | |
| | | ###################### mybatis-plus\u9ED8\u8BA4\u914D\u7F6E ####################### |
| | | mybatis-plus.mapper-locations=classpath*:com/stylefeng/guns/**/mapping/*.xml |
| | | mybatis-plus.mapper-locations=classpath*:com/supersavedriving/driver/**/mapping/*.xml |
| | | # 0:\u6570\u636E\u5E93ID\u81EA\u589E 1:\u7528\u6237\u8F93\u5165id 2:\u5168\u5C40\u552F\u4E00id(IdWorker) 3:\u5168\u5C40\u552F\u4E00ID(uuid) |
| | | mybatis-plus.global-config.id-type=0 |
| | | mybatis-plus.global-config.db-column-underline=false |
| | |
| | | <description>代码生成器</description> |
| | | |
| | | <parent> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-parent</artifactId> |
| | | <version>1.0.0</version> |
| | | <relativePath>../pom.xml</relativePath> |
| | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.stylefeng</groupId> |
| | | <groupId>com.supersavedriving</groupId> |
| | | <artifactId>guns-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | |
| | | |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.supersavedriving.driver.generator.engine.config.*; |
| | | import com.supersavedriving.driver.generator.engine.config.*; |
| | | |
| | | /** |
| | | * 模板生成父类 |