19个文件已修改
6个文件已删除
103个文件已添加
| | |
| | | <artifactId>commons-codec</artifactId> |
| | | <version>1.13</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | package com.supersavedriving.user; |
| | | |
| | | import com.supersavedriving.user.modular.system.util.GDFalconUtil; |
| | | import org.apache.http.client.HttpClient; |
| | | 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.user.modular.system.dao") |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | logger.info("GunsApplication is success!"); |
| | | |
| | | GDFalconUtil gdFalconUtil = new GDFalconUtil(); |
| | | gdFalconUtil.init();//初始化猎鹰服务 |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("OK出行 Doc") |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | .title("超省新代驾") |
| | | .description("所有接口前需要加 /user 前缀,例如:/user/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | | .version("1.0") |
| | |
| | | @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(); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * token异常 |
| | | */ |
| | | TOKEN_EXPIRED(600, "token过期"), |
| | | TOKEN_ERROR(600, "token验证失败"), |
| | | TOKEN_EXPIRED(10030, "token过期"), |
| | | TOKEN_ERROR(10030, "token验证失败"), |
| | | |
| | | /** |
| | | * 签名异常 |
| | | */ |
| | | SIGN_ERROR(700, "签名验证失败"), |
| | | SIGN_ERROR(10040, "签名验证失败"), |
| | | |
| | | /** |
| | | * 其他 |
| | |
| | | |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.service.IAppUserService; |
| | | import com.supersavedriving.user.modular.system.service.IDriverService; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.ResponseWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.SignInToRegister; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/appUserLogin") |
| | | @ServiceLog(name = "微信登录", url = "/base/appUser/appUserLogin") |
| | | // @ServiceLog(name = "微信登录", url = "/base/appUser/appUserLogin") |
| | | @ApiOperation(value = "微信登录", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "微信jscode", name = "jscode", required = true, dataType = "string"), |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/signInToRegister") |
| | | @ServiceLog(name = "微信手机授权登录", url = "/base/appUser/signInToRegister") |
| | | // @ServiceLog(name = "微信手机授权登录", url = "/base/appUser/signInToRegister") |
| | | @ApiOperation(value = "微信手机授权登录", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper signInToRegister(SignInToRegister signInToRegister){ |
| | | public ResponseWarpper<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister){ |
| | | try { |
| | | ResultUtil resultUtil = appUserService.signInToRegister(signInToRegister); |
| | | ResultUtil<SignInToRegisterWarpper> resultUtil = appUserService.signInToRegister(signInToRegister); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryNearbyDrivers") |
| | | // @ServiceLog(name = "获取附近的司机", url = "/base/appUser/queryNearbyDrivers") |
| | | @ApiOperation(value = "获取附近的司机", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper<List<NearbyDriverWarpper>> queryNearbyDrivers(String lon, String lat){ |
| | | if(ToolUtil.isEmpty(lat)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("lat")); |
| | | } |
| | | if(ToolUtil.isEmpty(lon)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("lon")); |
| | | } |
| | | try { |
| | | List<NearbyDriverWarpper> list = driverService.queryDriverPosition(lon, lat, 5D); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/setEmergencyContact") |
| | | // @ServiceLog(name = "设置紧急联系人", url = "/base/appUser/queryNearbyDrivers") |
| | | @ApiOperation(value = "设置紧急联系人", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "电话", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper setEmergencyContact(String name, String phone){ |
| | | if(ToolUtil.isEmpty(name)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("name")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setEmergencyContact(name); |
| | | appUser.setEmergencyPhone(phone); |
| | | appUserService.updateById(appUser); |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryUserInfo") |
| | | // @ServiceLog(name = "获取个人信息", url = "/api/appUser/queryUserInfo") |
| | | @ApiOperation(value = "获取个人信息", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<UserInfoWarpper> queryUserInfo(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | UserInfoWarpper userInfoWarpper = new UserInfoWarpper(); |
| | | BeanUtils.copyProperties(appUser, userInfoWarpper); |
| | | return ResponseWarpper.success(userInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.modular.system.model.Broadcast; |
| | | import com.supersavedriving.user.modular.system.service.IBroadcastService; |
| | | import com.supersavedriving.user.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 17:12 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class BroadcastController { |
| | | |
| | | @Autowired |
| | | private IBroadcastService broadcastService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/broadcast/queryBroadcast") |
| | | // @ServiceLog(name = "获取广播", url = "/base/broadcast/queryBroadcast") |
| | | @ApiOperation(value = "获取广播", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<List<String>> queryBroadcast(){ |
| | | try { |
| | | List<Broadcast> broadcasts = broadcastService.selectList(new EntityWrapper<Broadcast>().eq("status", 1).orderBy("sort desc limit 0, 5")); |
| | | List<String> list = new ArrayList<>(); |
| | | for (Broadcast broadcast : broadcasts) { |
| | | list.add(broadcast.getContent()); |
| | | } |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.service.IAppUserService; |
| | | import com.supersavedriving.user.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.CommercialWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.ResponseWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping() |
| | | public class CommercialController { |
| | | |
| | | @Autowired |
| | | private ICommercialService commercialService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/commercial/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){ |
| | | if(ToolUtil.isEmpty(type)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | if(ToolUtil.isEmpty(device)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("device")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = commercialService.queryCommercialList(uid, type, device); |
| | | return ResponseWarpper.success(commercialWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.modular.system.model.Html; |
| | | import com.supersavedriving.user.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.user.modular.system.service.IHtmlService; |
| | | import com.supersavedriving.user.modular.system.service.ISystemConfigService; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.ResponseWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.StartPriceWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 协议控制器 |
| | |
| | | @Autowired |
| | | private IHtmlService htmlService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/html/queryHtml") |
| | | @ServiceLog(name = "获取各种协议和说明", url = "/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=注销协议,14=关于我们,15=司机消单说明)", name = "type", required = true, dataType = "int"), |
| | | @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 new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/html/queryStartPrice") |
| | | // @ServiceLog(name = "获取起步价和起步价说明", url = "/base/html/queryStartPrice") |
| | | @ApiOperation(value = "获取起步价和起步价说明", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper<StartPriceWarpper> queryStartPrice(){ |
| | | try { |
| | | Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type",10)); |
| | | StartPriceWarpper startPriceWarpper = new StartPriceWarpper(); |
| | | //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1},"description":"这是一段说明文本"} |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HHmm"); |
| | | Integer integer = Integer.valueOf(sdf.format(new Date())); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | num1 = num1.replaceAll(":", ""); |
| | | num2 = num2.replaceAll(":", ""); |
| | | |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | if(integer >= Integer.valueOf(num1) && integer < Integer.valueOf(num2)){ |
| | | startPriceWarpper.setStartPrice(num4); |
| | | startPriceWarpper.setStartDistance(num3); |
| | | startPriceWarpper.setExcessMileageUnitPrice(num6); |
| | | startPriceWarpper.setOvermileage(num5); |
| | | break; |
| | | } |
| | | } |
| | | startPriceWarpper.setDescription(null == html ? "" : html.getHtml()); |
| | | return ResponseWarpper.success(startPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.modular.system.model.MainContent; |
| | | import com.supersavedriving.user.modular.system.service.IMainContentService; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.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()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.model.Order; |
| | | import com.supersavedriving.user.modular.system.service.IAppUserService; |
| | | import com.supersavedriving.user.modular.system.service.IOrderService; |
| | | import com.supersavedriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 订单控制器 |
| | | * @author pzb |
| | | * @Date 2023/2/28 11:24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryServerOrder") |
| | | // @ServiceLog(name = "获取正在进行中的订单id", url = "/api/order/queryServerOrder") |
| | | @ApiOperation(value = "获取正在进行中的订单id", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<Long>> queryServerOrder(){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | List<Integer> list = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", list)); |
| | | List<Long> collect = orders.stream().map(Order::getId).collect(Collectors.toList()); |
| | | return ResponseWarpper.success(collect); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/getEstimatedCosts") |
| | | // @ServiceLog(name = "获取预估费用", url = "/api/order/getEstimatedCosts") |
| | | @ApiOperation(value = "获取预估费用", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<EstimatedCostsWarpper> getEstimatedCosts(EstimatedCosts estimatedCosts){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil<EstimatedCostsWarpper> estimatedCosts1 = orderService.getEstimatedCosts(uid, estimatedCosts); |
| | | return ResponseWarpper.success(estimatedCosts1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/travelOrder") |
| | | // @ServiceLog(name = "用户下单/扫码下单", url = "/api/order/travelOrder") |
| | | @ApiOperation(value = "用户下单/扫码下单", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper travelOrder(TravelOrder travelOrder){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.travelOrder(uid, travelOrder); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/cancelOrder") |
| | | // @ServiceLog(name = "用户取消订单", url = "/api/order/cancelOrder") |
| | | @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 cancelOrder(Long orderId, String cause){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | if(ToolUtil.isEmpty(cause)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("cause")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.cancelOrder(uid, orderId, cause); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/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){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); |
| | | return ResponseWarpper.success(orderInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/editOrderEndAddress") |
| | | // @ServiceLog(name = "修改终点", url = "/api/order/editOrderEndAddress") |
| | | @ApiOperation(value = "修改终点", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper editOrderEndAddress(EditOrderEndAddress editOrderEndAddress){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.editOrderEndAddress(uid, editOrderEndAddress); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryOrderPrice") |
| | | // @ServiceLog(name = "获取订单费用明细", url = "/api/order/queryOrderPrice") |
| | | @ApiOperation(value = "获取订单费用明细", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "是否余额抵扣(0=否,1=是)", name = "payType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId, Integer payType){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | if(null == payType){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("payType")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderPriceWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId, payType); |
| | | return ResponseWarpper.success(orderPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryPayCouponList") |
| | | // @ServiceLog(name = "获取支付页面优惠券选择列表", url = "/api/order/queryPayCouponList") |
| | | @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<List<CouponWarpper>> queryPayCouponList(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | List<CouponWarpper> list = orderService.queryPayCouponList(uid, orderId); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/orderPayment") |
| | | // @ServiceLog(name = "订单完成后的支付操作", url = "/api/order/orderPayment") |
| | | @ApiOperation(value = "订单完成后的支付操作", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper orderPayment(OrderPayment orderPayment){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.orderPayment(uid, orderPayment); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单微信支付回调处理 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/orderPayCallback") |
| | | public void orderPayCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | String orderId = out_trade_no.substring(17); |
| | | ResultUtil resultUtil = orderService.orderPayCallback(orderId, transaction_id); |
| | | if(resultUtil.getCode() == 10000){ |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/orderAppraise") |
| | | // @ServiceLog(name = "订单评价操作", url = "/api/order/orderAppraise") |
| | | @ApiOperation(value = "订单评价操作", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "评分", name = "score", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "评价内容", name = "content", required = true, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper orderAppraise(Long orderId, Integer score, String content){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = orderService.orderAppraise(uid, orderId, score, content); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.AccountChangeDetail; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:33 |
| | | */ |
| | | public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Broadcast; |
| | | |
| | | public interface BroadcastMapper extends BaseMapper<Broadcast> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.CancelOrder; |
| | | |
| | | public interface CancelOrderMapper extends BaseMapper<CancelOrder> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Commercial; |
| | | import com.supersavedriving.user.modular.system.warpper.CommercialWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CommercialMapper extends BaseMapper<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(@Param("type") Integer type, @Param("device") Integer device); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.CommercialUserEject; |
| | | |
| | | public interface CommercialUserEjectMapper extends BaseMapper<CommercialUserEject> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | |
| | | public interface CouponMapper extends BaseMapper<Coupon> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | |
| | | public interface DriverMapper extends BaseMapper<Driver> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.DriverWork; |
| | | |
| | | public interface DriverWorkMapper extends BaseMapper<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Evaluate; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 16:58 |
| | | */ |
| | | public interface EvaluateMapper extends BaseMapper<Evaluate> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.MainContent; |
| | | |
| | | public interface MainContentMapper extends BaseMapper<MainContent> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Order; |
| | | import com.supersavedriving.user.modular.system.warpper.OrderInfoWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface OrderMapper extends BaseMapper<Order> { |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(@Param("uid") Integer uid, @Param("orderId") Long orderId); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.SystemConfig; |
| | | |
| | | public interface SystemConfigMapper extends BaseMapper<SystemConfig> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | import com.supersavedriving.user.modular.system.model.UserToCoupon; |
| | | import com.supersavedriving.user.modular.system.warpper.CouponWarpper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户优惠券 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 11:44 |
| | | */ |
| | | public interface UserToCouponMapper extends BaseMapper<UserToCoupon> { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | */ |
| | | Coupon queryCoupon(@Param("uid") Integer uid, @Param("price") Double price); |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(@Param("uid") Integer uid, @Param("price") Double price); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.WeatherCity; |
| | | |
| | | public interface WeatherCityMapper extends BaseMapper<WeatherCity> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.YouTuiDriver; |
| | | |
| | | public interface YouTuiDriverMapper extends BaseMapper<YouTuiDriver> { |
| | | } |
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.user.modular.system.dao.AccountChangeDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type=" com.supersavedriving.user.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> |
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.user.modular.system.dao.BroadcastMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Broadcast"> |
| | | <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.user.modular.system.dao.CancelOrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.CancelOrder"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="cause" property="cause"/> |
| | | <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.user.modular.system.dao.CommercialMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Commercial"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="name" property="name"/> |
| | | <result column="device" property="device"/> |
| | | <result column="isJump" property="isJump"/> |
| | | <result column="jumpType" property="jumpType"/> |
| | | <result column="jumpUrl" property="jumpUrl"/> |
| | | <result column="html" property="html"/> |
| | | <result column="sort" property="sort"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createUserId" property="createUserId"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="updateUserId" property="updateUserId"/> |
| | | <result column="updateTime" property="updateTime"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryCommercialList" resultType="com.supersavedriving.user.modular.system.warpper.CommercialWarpper"> |
| | | select |
| | | `name`, |
| | | url, |
| | | `type`, |
| | | isJump, |
| | | jumpType, |
| | | jumpUrl, |
| | | html |
| | | from t_commercial where status = 1 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | <if test="null != device"> |
| | | and device = #{device} |
| | | </if> |
| | | order by sort limit 0, 3 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.user.modular.system.dao.CommercialUserEjectMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.CommercialUserEject"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="lastDate" property="lastDate"/> |
| | | </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.user.modular.system.dao.CouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Coupon"> |
| | | <id column="id" property="id"/> |
| | | <result column="agent_id" property="agentId"/> |
| | | <result column="branch_office_id" property="branchOfficeId"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="coupon_name" property="couponName"/> |
| | | <result column="coupon_type" property="couponType"/> |
| | | <result column="coupon_code" property="couponCode"/> |
| | | <result column="coupon_service_type" property="couponServiceType"/> |
| | | <result column="coupon_conditional_amount" property="couponConditionalAmount"/> |
| | | <result column="coupon_preferential_amount" property="couponPreferentialAmount"/> |
| | | <result column="coupon_validity" property="couponValidity"/> |
| | | <result column="coupon_send_quantity" property="couponSendQuantity"/> |
| | | <result column="coupon_state" property="couponState"/> |
| | | <result column="coupon_count" property="couponCount"/> |
| | | <result column="remaining_quantity" property="remainingQuantity"/> |
| | | </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.user.modular.system.dao.DriverMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Driver"> |
| | | <id column="id" property="id"/> |
| | | <result column="code" property="code"/> |
| | | <result column="name" property="name"/> |
| | | <result column="avatar" property="avatar"/> |
| | | <result column="phone" property="phone"/> |
| | | <result column="password" property="password"/> |
| | | <result column="sex" property="sex"/> |
| | | <result column="source" property="source"/> |
| | | <result column="emergencyContact" property="emergencyContact"/> |
| | | <result column="emergencyPhone" property="emergencyPhone"/> |
| | | <result column="driverLicenseNumber" property="driverLicenseNumber"/> |
| | | <result column="driverLicense" property="driverLicense"/> |
| | | <result column="firstCertificateTime" property="firstCertificateTime"/> |
| | | <result column="idcard" property="idcard"/> |
| | | <result column="idcardFront" property="idcardFront"/> |
| | | <result column="idcardBack" property="idcardBack"/> |
| | | <result column="inviterType" property="inviterType"/> |
| | | <result column="inviterId" property="inviterId"/> |
| | | <result column="agentId" property="agentId"/> |
| | | <result column="branchOfficeId" property="branchOfficeId"/> |
| | | <result column="balance" property="balance"/> |
| | | <result column="backgroundBalance" property="backgroundBalance"/> |
| | | <result column="approvalStatus" property="approvalStatus"/> |
| | | <result column="approvalNotes" property="approvalNotes"/> |
| | | <result column="approvalUserId" property="approvalUserId"/> |
| | | <result column="approvalTime" property="approvalTime"/> |
| | | <result column="serverStatus" property="serverStatus"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="score" property="score"/> |
| | | <result column="status" property="status"/> |
| | | <result column="remark" property="remark"/> |
| | | <result column="isException" property="isException"/> |
| | | <result column="createTime" property="createTime"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="provinceName" property="provinceName"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="cityName" property="cityName"/> |
| | | <result column="areaCode" property="areaCode"/> |
| | | <result column="areaName" property="areaName"/> |
| | | <result column="commission" property="commission"/> |
| | | <result column="wxCollectionCode" property="wxCollectionCode"/> |
| | | <result column="zfbCollectionCode" property="zfbCollectionCode"/> |
| | | </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.user.modular.system.dao.DriverWorkMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.DriverWork"> |
| | | <id column="id" property="id"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="workTime" property="workTime"/> |
| | | <result column="offWorkTime" property="offWorkTime"/> |
| | | <result column="onlineTime" property="onlineTime"/> |
| | | <result column="status" property="status"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.user.modular.system.dao.EvaluateMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Evaluate"> |
| | | <id column="id" property="id"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="score" property="score"/> |
| | | <result column="evaluate" property="evaluate"/> |
| | | <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.user.modular.system.dao.MainContentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.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> |
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.user.modular.system.dao.OrderMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Order"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="userPhone" property="userPhone" /> |
| | | <result column="userName" property="userName" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="source" property="source" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="branchOfficeId" property="branchOfficeId" /> |
| | | <result column="orderTakingTime" property="orderTakingTime"/> |
| | | <result column="goToAppointmentPointTime" property="goToAppointmentPointTime"/> |
| | | <result column="arrivalTimeAtTheAppointmentPoint" property="arrivalTimeAtTheAppointmentPoint"/> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="startAddress" property="startAddress" /> |
| | | <result column="startLat" property="startLat" /> |
| | | <result column="startLng" property="startLng" /> |
| | | <result column="endAddress" property="endAddress" /> |
| | | <result column="endLat" property="endLat" /> |
| | | <result column="endLng" property="endLng" /> |
| | | <result column="boardingTime" property="boardingTime" /> |
| | | <result column="getoffTime" property="getoffTime" /> |
| | | <result column="startDistance" property="startDistance" /> |
| | | <result column="startPrice" property="startPrice" /> |
| | | <result column="overDriveDistance" property="overDriveDistance" /> |
| | | <result column="overDrivePrice" property="overDrivePrice" /> |
| | | <result column="longDistance" property="longDistance" /> |
| | | <result column="longDistancePrice" property="longDistancePrice" /> |
| | | <result column="overLongDistance" property="overLongDistance" /> |
| | | <result column="overLongDistancePrice" property="overLongDistancePrice" /> |
| | | <result column="waitTime" property="waitTime" /> |
| | | <result column="waitTimePrice" property="waitTimePrice" /> |
| | | <result column="outWaitTime" property="outWaitTime" /> |
| | | <result column="outWaitTimePrice" property="outWaitTimePrice" /> |
| | | <result column="badWeatherDistance" property="badWeatherDistance" /> |
| | | <result column="badWeatherPrice" property="badWeatherPrice" /> |
| | | <result column="overBadWeatherDistance" property="overBadWeatherDistance" /> |
| | | <result column="overBadWeatherPrice" property="overBadWeatherPrice" /> |
| | | <result column="weather" property="weather"/> |
| | | <result column="estimatedPrice" property="estimatedPrice" /> |
| | | <result column="estimatedMileage" property="estimatedMileage"/> |
| | | <result column="orderMoney" property="orderMoney" /> |
| | | <result column="actualMileage" property="actualMileage"/> |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="discountedPrice" property="discountedPrice" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="discountAmount" property="discountAmount"/> |
| | | <result column="discount" property="discount"/> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="orderNo" property="orderNo"/> |
| | | <result column="hallOrder" property="hallOrder"/> |
| | | <result column="startWaitTime" property="startWaitTime"/> |
| | | <result column="state" property="state" /> |
| | | <result column="oldState" property="oldState"/> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="queryOrderInfo" resultType="com.supersavedriving.user.modular.system.warpper.OrderInfoWarpper"> |
| | | select |
| | | a.id as orderId, |
| | | a.`code`, |
| | | a.startAddress, |
| | | a.startLat, |
| | | a.startLng, |
| | | a.endAddress, |
| | | a.endLat, |
| | | a.endLng, |
| | | b.avatar as driverAvatar, |
| | | b.`name` as driverName, |
| | | b.phone as driverPhone, |
| | | b.`code` as driverCode, |
| | | (DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y')) as driverAge, |
| | | (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber, |
| | | b.score as driverScore, |
| | | a.state |
| | | from t_order a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | where a.id = #{orderId} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.user.modular.system.dao.SystemConfigMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.SystemConfig"> |
| | | <id column="id" property="id"/> |
| | | <result column="type" property="type"/> |
| | | <result column="content" property="content"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.user.modular.system.dao.UserToCouponMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.UserToCoupon"> |
| | | <id column="id" property="id" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="couponId" property="couponId" /> |
| | | <result column="couponTotal" property="couponTotal" /> |
| | | <result column="validCount" property="validCount" /> |
| | | <result column="expireCount" property="expireCount" /> |
| | | <result column="expireTime" property="expireTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="status" property="status" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryCoupon" resultType="com.supersavedriving.user.modular.system.model.Coupon"> |
| | | select |
| | | a.* |
| | | from t_coupon a |
| | | left join t_user_to_coupon b on (a.id = b.couponId) |
| | | where b.status = 1 and b.expireTime > now() and b.validCount > 0 |
| | | and b.userId = #{uid} and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} |
| | | order by a.coupon_preferential_amount desc limit 0, 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="queryPayCouponList" resultType="com.supersavedriving.user.modular.system.warpper.CouponWarpper"> |
| | | select |
| | | b.id, |
| | | a.coupon_conditional_amount as couponConditionalAmount, |
| | | a.coupon_preferential_amount as couponPreferentialAmount, |
| | | a.coupon_name as couponName, |
| | | UNIX_TIMESTAMP(b.expireTime) * 1000 as expirationDate, |
| | | b.validCount as number |
| | | from t_coupon a |
| | | left join t_user_to_coupon b on (a.id = b.couponId) |
| | | where b.userId = #{uid} and b.validCount > 0 and b.expireTime > now() and |
| | | a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by b.createTime |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.supersavedriving.user.modular.system.dao.WeatherCityMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.WeatherCity"> |
| | | <id column="id" property="id" /> |
| | | <result column="province" property="province" /> |
| | | <result column="city" property="city" /> |
| | | <result column="district" property="district" /> |
| | | </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.user.modular.system.dao.YouTuiDriverMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.YouTuiDriver"> |
| | | <id column="id" property="id" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="youTuiId" property="youTuiId" /> |
| | | <result column="integral" property="integral" /> |
| | | <result column="failureTime" property="failureTime" /> |
| | | <result column="createTime" property="createTime" /> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | package com.supersavedriving.user.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; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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 17:05 |
| | | */ |
| | | @Data |
| | | @TableName("t_broadcast") |
| | | public class Broadcast { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @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.user.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/25 14:37 |
| | | */ |
| | | @Data |
| | | @TableName("t_cancel_order") |
| | | public class CancelOrder { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 取消原因 |
| | | */ |
| | | @TableField("cause") |
| | | private String cause; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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_commercial") |
| | | public class Commercial { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=弹窗广告,2=底部广告) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 广告名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 设备(1=小程序,2=司机端) |
| | | */ |
| | | @TableField("device") |
| | | private Integer device; |
| | | /** |
| | | * 是否跳转(0=否,1=是) |
| | | */ |
| | | @TableField("isJump") |
| | | private Integer isJump; |
| | | /** |
| | | * 跳转类型(1=内部跳转,2=外部跳转) |
| | | */ |
| | | @TableField("jumpType") |
| | | private Integer jumpType; |
| | | /** |
| | | * 跳转链接 |
| | | */ |
| | | @TableField("jumpUrl") |
| | | private String jumpUrl; |
| | | /** |
| | | * 富文本内容 |
| | | */ |
| | | @TableField("html") |
| | | private String html; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加人员id |
| | | */ |
| | | @TableField("createUserId") |
| | | private Integer createUserId; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 修改人员id |
| | | */ |
| | | @TableField("updateUserId") |
| | | private Integer updateUserId; |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField("updateTime") |
| | | private Date updateTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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_commercial_user_eject") |
| | | public class CommercialUserEject { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 最后弹出日期 |
| | | */ |
| | | @TableField("lastDate") |
| | | private Date lastDate; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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/28 11:57 |
| | | */ |
| | | @Data |
| | | @TableName("t_coupon") |
| | | public class Coupon { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agent_id") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branch_office_id") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @TableField("coupon_name") |
| | | private String couponName; |
| | | /** |
| | | * 优惠券类型 1活动券 2新人券 |
| | | */ |
| | | @TableField("coupon_type") |
| | | private Integer couponType; |
| | | /** |
| | | * 优惠券码 |
| | | */ |
| | | @TableField("coupon_code") |
| | | private String couponCode; |
| | | /** |
| | | * 服务类型 1通用券 |
| | | */ |
| | | @TableField("coupon_service_type") |
| | | private Integer couponServiceType; |
| | | /** |
| | | * 条件金额 |
| | | */ |
| | | @TableField("coupon_conditional_amount") |
| | | private Double couponConditionalAmount; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | @TableField("coupon_preferential_amount") |
| | | private Double couponPreferentialAmount; |
| | | /** |
| | | * 有效期 |
| | | */ |
| | | @TableField("coupon_validity") |
| | | private Integer couponValidity; |
| | | /** |
| | | * 赠送数量 |
| | | */ |
| | | @TableField("coupon_send_quantity") |
| | | private Integer couponSendQuantity; |
| | | /** |
| | | * 是否冻结 1正常 2冻结 |
| | | */ |
| | | @TableField("coupon_state") |
| | | private Integer couponState; |
| | | /** |
| | | * 优惠券数量 |
| | | */ |
| | | @TableField("coupon_count") |
| | | private Integer couponCount; |
| | | /** |
| | | * 剩余数量 |
| | | */ |
| | | @TableField("remaining_quantity") |
| | | private Integer remainingQuantity; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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/8 18:33 |
| | | */ |
| | | @Data |
| | | @TableName("t_driver") |
| | | public class Driver { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @TableField("avatar") |
| | | private String avatar; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | @TableField("password") |
| | | private String password; |
| | | /** |
| | | * 性别(1=男,2=女) |
| | | */ |
| | | @TableField("sex") |
| | | private Integer sex; |
| | | /** |
| | | * 来源 |
| | | */ |
| | | @TableField("source") |
| | | private Integer source; |
| | | /** |
| | | * 紧急联系人 |
| | | */ |
| | | @TableField("emergencyContact") |
| | | private String emergencyContact; |
| | | /** |
| | | * 紧急联系电话 |
| | | */ |
| | | @TableField("emergencyPhone") |
| | | private String emergencyPhone; |
| | | /** |
| | | * 驾驶证号码 |
| | | */ |
| | | @TableField("driverLicenseNumber") |
| | | private String driverLicenseNumber; |
| | | /** |
| | | * 驾驶证照片 |
| | | */ |
| | | @TableField("driverLicense") |
| | | private String driverLicense; |
| | | /** |
| | | * 驾驶证初次领证时间 |
| | | */ |
| | | @TableField("firstCertificateTime") |
| | | private Date firstCertificateTime; |
| | | /** |
| | | * 身份证号码 |
| | | */ |
| | | @TableField("idcard") |
| | | private String idcard; |
| | | /** |
| | | * 身份证正面照 |
| | | */ |
| | | @TableField("idcardFront") |
| | | private String idcardFront; |
| | | /** |
| | | * 身份证背面照 |
| | | */ |
| | | @TableField("idcardBack") |
| | | private String idcardBack; |
| | | /** |
| | | * 邀约人类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("inviterType") |
| | | private Integer inviterType; |
| | | /** |
| | | * 邀约人id |
| | | */ |
| | | @TableField("inviterId") |
| | | private Integer inviterId; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 账户余额 |
| | | */ |
| | | @TableField("balance") |
| | | private Double balance; |
| | | /** |
| | | * 后台充值余额 |
| | | */ |
| | | @TableField("backgroundBalance") |
| | | private Double backgroundBalance; |
| | | /** |
| | | * 审核状态(1=待审核,2=已同意,3=已拒绝) |
| | | */ |
| | | @TableField("approvalStatus") |
| | | private Integer approvalStatus; |
| | | /** |
| | | * 审核注释 |
| | | */ |
| | | @TableField("approvalNotes") |
| | | private String approvalNotes; |
| | | /** |
| | | * 审核用户id |
| | | */ |
| | | @TableField("approvalUserId") |
| | | private Integer approvalUserId; |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | @TableField("approvalTime") |
| | | private Date approvalTime; |
| | | /** |
| | | * 服务状态(1=空闲中,2=服务中) |
| | | */ |
| | | @TableField("serverStatus") |
| | | private Integer serverStatus; |
| | | /** |
| | | * 剩余积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @TableField("score") |
| | | private Double score; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 启用冻结理由 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 加盟区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 加盟区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 加盟区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 加盟区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 加盟区域区编号 |
| | | */ |
| | | @TableField("areaCode") |
| | | private String areaCode; |
| | | /** |
| | | * 加盟区域区名称 |
| | | */ |
| | | @TableField("areaName") |
| | | private String areaName; |
| | | /** |
| | | * 佣金 |
| | | */ |
| | | @TableField("commission") |
| | | private Double commission; |
| | | /** |
| | | * 微信收款码 |
| | | */ |
| | | @TableField("wxCollectionCode") |
| | | private String wxCollectionCode; |
| | | /** |
| | | * 支付宝收款码 |
| | | */ |
| | | @TableField("zfbCollectionCode") |
| | | private String zfbCollectionCode; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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_driver_work") |
| | | public class DriverWork { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 上班时间 |
| | | */ |
| | | @TableField("workTime") |
| | | private Date workTime; |
| | | /** |
| | | * 下班时间 |
| | | */ |
| | | @TableField("offWorkTime") |
| | | private Date offWorkTime; |
| | | /** |
| | | * 在线时长(秒) |
| | | */ |
| | | @TableField("onlineTime") |
| | | private Long onlineTime; |
| | | /** |
| | | * 状态(1=上班,2=下班) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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/11 16:51 |
| | | */ |
| | | @Data |
| | | @TableName("t_evaluate") |
| | | public class Evaluate { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @TableField("score") |
| | | private Integer score; |
| | | /** |
| | | * 评价内容 |
| | | */ |
| | | @TableField("evaluate") |
| | | private String evaluate; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=用户协议,2=隐私政策,3=法律条款,4=代驾服务协议,5=个人信息处理规则,6=积分说明,7=佣金规则说明,8=行程录音说明,9=预估价格说明,10=加盟基本要求,11=加盟流程,12=起步价说明,13=注销协议,14=关于我们) |
| | | * 类型(1=代驾服务协议与隐私政策保护,2=法律条款,3=个人信息处理规则,4=积分说明,5=佣金规则说明,6=行程录音说明,7=预估价格说明,8=加盟基本要求,9=加盟流程,10=起步价说明,11=注销协议,12=关于我们,13=司机消单说明) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
New file |
| | |
| | | package com.supersavedriving.user.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.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:59 |
| | | */ |
| | | @Data |
| | | @TableName("t_order") |
| | | public class Order { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Long id; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 乘车人电话 |
| | | */ |
| | | @TableField("userPhone") |
| | | private String userPhone; |
| | | /** |
| | | * 乘车人姓名 |
| | | */ |
| | | @TableField("userName") |
| | | private String userName; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 订单来源(1=小程序,2=APP) |
| | | */ |
| | | @TableField("source") |
| | | private Integer source; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 分公司id |
| | | */ |
| | | @TableField("branchOfficeId") |
| | | private Integer branchOfficeId; |
| | | /** |
| | | * 接单时间 |
| | | */ |
| | | @TableField("orderTakingTime") |
| | | private Date orderTakingTime; |
| | | /** |
| | | * 前往预约点时间 |
| | | */ |
| | | @TableField("goToAppointmentPointTime") |
| | | private Date goToAppointmentPointTime; |
| | | /** |
| | | * 到达预约点时间 |
| | | */ |
| | | @TableField("arrivalTimeAtTheAppointmentPoint") |
| | | private Date arrivalTimeAtTheAppointmentPoint; |
| | | /** |
| | | * 开始服务时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 起点地址 |
| | | */ |
| | | @TableField("startAddress") |
| | | private String startAddress; |
| | | /** |
| | | * 起点纬度 |
| | | */ |
| | | @TableField("startLat") |
| | | private String startLat; |
| | | /** |
| | | * 起点经度 |
| | | */ |
| | | @TableField("startLng") |
| | | private String startLng; |
| | | /** |
| | | * 终点地址 |
| | | */ |
| | | @TableField("endAddress") |
| | | private String endAddress; |
| | | /** |
| | | * 终点纬度 |
| | | */ |
| | | @TableField("endLat") |
| | | private String endLat; |
| | | /** |
| | | * 终点经度 |
| | | */ |
| | | @TableField("endLng") |
| | | private String endLng; |
| | | /** |
| | | * 上车时间 |
| | | */ |
| | | @TableField("boardingTime") |
| | | private Date boardingTime; |
| | | /** |
| | | * 下车时间 |
| | | */ |
| | | @TableField("getoffTime") |
| | | private Date getoffTime; |
| | | /** |
| | | * 起步里程 |
| | | */ |
| | | @TableField("startDistance") |
| | | private Double startDistance; |
| | | /** |
| | | * 起步价 |
| | | */ |
| | | @TableField("startPrice") |
| | | private Double startPrice; |
| | | /** |
| | | * 超出起步里程 |
| | | */ |
| | | @TableField("overDriveDistance") |
| | | private Double overDriveDistance; |
| | | /** |
| | | * 超出起步里程费 |
| | | */ |
| | | @TableField("overDrivePrice") |
| | | private Double overDrivePrice; |
| | | /** |
| | | * 长途里程 |
| | | */ |
| | | @TableField("longDistance") |
| | | private String longDistance; |
| | | /** |
| | | * 长途里程费 |
| | | */ |
| | | @TableField("longDistancePrice") |
| | | private Double longDistancePrice; |
| | | /** |
| | | * 超出长途里程 |
| | | */ |
| | | @TableField("overLongDistance") |
| | | private Double overLongDistance; |
| | | /** |
| | | * 超出长途里程费 |
| | | */ |
| | | @TableField("overLongDistancePrice") |
| | | private Double overLongDistancePrice; |
| | | /** |
| | | * 等待时长(分钟) |
| | | */ |
| | | @TableField("waitTime") |
| | | private Integer waitTime; |
| | | /** |
| | | * 等待费 |
| | | */ |
| | | @TableField("waitTimePrice") |
| | | private Double waitTimePrice; |
| | | /** |
| | | * 超出等待时长(分钟) |
| | | */ |
| | | @TableField("outWaitTime") |
| | | private Integer outWaitTime; |
| | | /** |
| | | * 超出等待时长费 |
| | | */ |
| | | @TableField("outWaitTimePrice") |
| | | private Double outWaitTimePrice; |
| | | /** |
| | | * 恶劣天气里程 |
| | | */ |
| | | @TableField("badWeatherDistance") |
| | | private Double badWeatherDistance; |
| | | /** |
| | | * 恶劣天气里程费 |
| | | */ |
| | | @TableField("badWeatherPrice") |
| | | private Double badWeatherPrice; |
| | | /** |
| | | * 恶劣天气超出里程 |
| | | */ |
| | | @TableField("overBadWeatherDistance") |
| | | private Double overBadWeatherDistance; |
| | | /** |
| | | * 恶劣天气超出里程费 |
| | | */ |
| | | @TableField("overBadWeatherPrice") |
| | | private Double overBadWeatherPrice; |
| | | /** |
| | | * 天气 |
| | | */ |
| | | @TableField("weather") |
| | | private String weather; |
| | | /** |
| | | * 预估价 |
| | | */ |
| | | @TableField("estimatedPrice") |
| | | private Double estimatedPrice; |
| | | /** |
| | | * 预估里程 |
| | | */ |
| | | @TableField("estimatedMileage") |
| | | private Double estimatedMileage; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("orderMoney") |
| | | private Double orderMoney; |
| | | /** |
| | | * 实际里程 |
| | | */ |
| | | @TableField("actualMileage") |
| | | private Integer actualMileage; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | @TableField("payMoney") |
| | | private Double payMoney; |
| | | /** |
| | | * 优惠金额 |
| | | */ |
| | | @TableField("discountedPrice") |
| | | private Double discountedPrice; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 折扣优惠金额 |
| | | */ |
| | | @TableField("discountAmount") |
| | | private Double discountAmount; |
| | | /** |
| | | * 折扣0.01 |
| | | */ |
| | | @TableField("discount") |
| | | private Double discount; |
| | | /** |
| | | * 支付类型(1=微信支付,2=余额支付,3=线下支付) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("orderNo") |
| | | private String orderNo; |
| | | /** |
| | | * 大厅订单(0=否,1=是) |
| | | */ |
| | | @TableField("hallOrder") |
| | | private Integer hallOrder; |
| | | /** |
| | | * 订单开始进入等待状态时间 |
| | | */ |
| | | @TableField("startWaitTime") |
| | | private Date startWaitTime; |
| | | /** |
| | | * 订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 历史订单状态(用于还原之前状态) |
| | | */ |
| | | @TableField("oldState") |
| | | private Integer oldState; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:22 |
| | | */ |
| | | @Data |
| | | @TableName("t_system_config") |
| | | public class SystemConfig { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 类型(1=派单规则,2=佣金分成规则,3=抽成规则,4=积分规则,5=价格规则,6=余额规则,7=客服管理) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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/3/2 11:04 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_to_coupon") |
| | | public class UserToCoupon { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("couponId") |
| | | private Integer couponId; |
| | | /** |
| | | * 领取总数 |
| | | */ |
| | | @TableField("couponTotal") |
| | | private Integer couponTotal; |
| | | /** |
| | | * 有效数据 |
| | | */ |
| | | @TableField("validCount") |
| | | private Integer validCount; |
| | | /** |
| | | * 过期数量 |
| | | */ |
| | | @TableField("expireCount") |
| | | private Integer expireCount; |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | @TableField("expireTime") |
| | | private Date expireTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 状态 1正常 2冻结 3删除 |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 天气相关城市 |
| | | * @author pzb |
| | | * @Date 2023/2/25 10:56 |
| | | */ |
| | | @Data |
| | | @TableName("t_weather_city") |
| | | public class WeatherCity { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 区 |
| | | */ |
| | | @TableField("district") |
| | | private String district; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.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/22 14:01 |
| | | */ |
| | | @Data |
| | | @TableName("t_you_tui_driver") |
| | | public class YouTuiDriver { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 优推id |
| | | */ |
| | | @TableField("youTuiId") |
| | | private Integer youTuiId; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 失效时间 |
| | | */ |
| | | @TableField("failureTime") |
| | | private Date failureTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.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.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.SignInToRegister; |
| | | import com.supersavedriving.user.modular.system.warpper.SignInToRegisterWarpper; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | public interface IAppUserService extends IService<AppUser> { |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil signInToRegister(SignInToRegister signInToRegister) throws Exception; |
| | | ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 校验token获取用户信息 |
| | | * @return |
| | | */ |
| | | Integer getUserByRequest() throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Broadcast; |
| | | |
| | | public interface IBroadcastService extends IService<Broadcast> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.CancelOrder; |
| | | |
| | | public interface ICancelOrderService extends IService<CancelOrder> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Commercial; |
| | | import com.supersavedriving.user.modular.system.warpper.CommercialWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 广告接口 |
| | | */ |
| | | public interface ICommercialService extends IService<Commercial> { |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表数据 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.CommercialUserEject; |
| | | |
| | | public interface ICommercialUserEjectService extends IService<CommercialUserEject> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | |
| | | public interface ICouponService extends IService<Coupon> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | import com.supersavedriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 司机 |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:52 |
| | | */ |
| | | public interface IDriverService extends IService<Driver> { |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机坐标 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.DriverWork; |
| | | |
| | | public interface IDriverWorkService extends IService<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Evaluate; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 16:59 |
| | | */ |
| | | public interface IEvaluateService extends IService<Evaluate> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.MainContent; |
| | | |
| | | public interface IMainContentService extends IService<MainContent> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Order; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:47 |
| | | */ |
| | | public interface IOrderService extends IService<Order> { |
| | | |
| | | |
| | | /** |
| | | * 获取预估费用 |
| | | * @param uid |
| | | * @param estimatedCosts |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 下单操作 |
| | | * @param uid |
| | | * @param travelOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param cause |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改订单终点 |
| | | * @param uid |
| | | * @param editOrderEndAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单费用明细 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId, Integer payType) throws Exception; |
| | | |
| | | /** |
| | | * 获取支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 支付订单操作 |
| | | * @param uid |
| | | * @param orderPayment |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 订单微信支付回调 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 订单评价 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param score |
| | | * @param content |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.SystemConfig; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | public interface ISystemConfigService extends IService<SystemConfig> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | import com.supersavedriving.user.modular.system.model.UserToCoupon; |
| | | import com.supersavedriving.user.modular.system.warpper.CouponWarpper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 14:21 |
| | | */ |
| | | public interface IUserToCouponService extends IService<UserToCoupon> { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Coupon queryCoupon(Integer uid, Double price) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付页面的可用优惠券列表 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.WeatherCity; |
| | | |
| | | public interface IWeatherCityService extends IService<WeatherCity> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.YouTuiDriver; |
| | | |
| | | public interface IYouTuiDriverService extends IService<YouTuiDriver> { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.supersavedriving.user.modular.system.model.AccountChangeDetail; |
| | | import com.supersavedriving.user.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.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.common.constant.JwtConstants; |
| | | import com.supersavedriving.user.core.shiro.ShiroKit; |
| | | import com.supersavedriving.user.core.shiro.ShiroUser; |
| | | import com.supersavedriving.user.core.util.JwtTokenUtil; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.AppUserMapper; |
| | | import com.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | import com.supersavedriving.user.modular.system.model.UserToCoupon; |
| | | import com.supersavedriving.user.modular.system.service.IAppUserService; |
| | | import com.supersavedriving.user.modular.system.service.ICouponService; |
| | | import com.supersavedriving.user.modular.system.service.IUserToCouponService; |
| | | import com.supersavedriving.user.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WXCore; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.util.weChat.model.Code2Session; |
| | | import com.supersavedriving.user.modular.system.warpper.CouponWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.SignInToRegister; |
| | | import com.supersavedriving.user.modular.system.warpper.SignInToRegisterWarpper; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | private final String salt = "s5d1"; |
| | | |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<String> appUserLogin(String jscode) throws Exception { |
| | | Code2Session code2Session = weChatUtil.code2Session(jscode); |
| | | if(code2Session.getErrcode() != 0){ |
| | | if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ |
| | | return ResultUtil.error(code2Session.getErrmsg()); |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil signInToRegister(SignInToRegister signInToRegister) throws Exception { |
| | | public ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception { |
| | | SignInToRegisterWarpper warpper = new SignInToRegisterWarpper(); |
| | | if(ToolUtil.isEmpty(signInToRegister.getJscode())){ |
| | | return ResultUtil.paranErr("jscode"); |
| | | } |
| | |
| | | return ResultUtil.paranErr("ivPhone"); |
| | | } |
| | | Code2Session code2Session = weChatUtil.code2Session(signInToRegister.getJscode()); |
| | | if(code2Session.getErrcode() != 0){ |
| | | if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ |
| | | return ResultUtil.error(code2Session.getErrmsg()); |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | |
| | | appUser.setInviterId(signInToRegister.getInviterId()); |
| | | appUser.setInviterType(signInToRegister.getInviterType()); |
| | | this.insert(appUser); |
| | | //发送优惠券 |
| | | boolean lock = redisUtil.lock(); |
| | | if(lock){ |
| | | List<CouponWarpper> list = pushCoupon(appUser.getId()); |
| | | redisUtil.unlock(); |
| | | warpper.setCoupons(list); |
| | | } |
| | | } |
| | | if(appUser.getStatus() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | |
| | | if(ToolUtil.isEmpty(token)){ |
| | | return ResultUtil.error("获取身份凭证失败"); |
| | | } |
| | | return ResultUtil.success(token); |
| | | warpper.setToken(token); |
| | | return ResultUtil.success(warpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 发送优惠券 |
| | | * @param userId |
| | | */ |
| | | public List<CouponWarpper> pushCoupon(Integer userId){ |
| | | List<Coupon> coupons = couponService.selectList(new EntityWrapper<Coupon>().eq("coupon_type", 2).eq("coupon_state", 1).gt("remaining_quantity", 0)); |
| | | List<CouponWarpper> list = new ArrayList<>(); |
| | | for (Coupon coupon : coupons) { |
| | | UserToCoupon userToCoupon = new UserToCoupon(); |
| | | userToCoupon.setCouponId(coupon.getId()); |
| | | userToCoupon.setCreateTime(new Date()); |
| | | userToCoupon.setUserId(userId); |
| | | userToCoupon.setStatus(1); |
| | | userToCoupon.setCouponTotal(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? |
| | | coupon.getRemainingQuantity() : coupon.getCouponSendQuantity()); |
| | | userToCoupon.setValidCount(userToCoupon.getCouponTotal()); |
| | | userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity() * 24 * 60 * 60 * 1000))); |
| | | userToCouponService.insert(userToCoupon); |
| | | |
| | | coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 : |
| | | coupon.getRemainingQuantity() - coupon.getCouponSendQuantity()); |
| | | couponService.updateById(coupon); |
| | | |
| | | CouponWarpper couponWarpper = new CouponWarpper(); |
| | | couponWarpper.setCouponConditionalAmount(coupon.getCouponConditionalAmount()); |
| | | couponWarpper.setCouponPreferentialAmount(coupon.getCouponPreferentialAmount()); |
| | | couponWarpper.setCouponName(coupon.getCouponName()); |
| | | couponWarpper.setNumber(userToCoupon.getValidCount()); |
| | | couponWarpper.setExpirationDate(userToCoupon.getExpireTime().getTime()); |
| | | list.add(couponWarpper); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | 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); |
| | | String key = null; |
| | | int length = requestHeader.length(); |
| | | if(length > 16){ |
| | | key = requestHeader.substring(length - 16); |
| | | }else{ |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.BroadcastMapper; |
| | | import com.supersavedriving.user.modular.system.model.Broadcast; |
| | | import com.supersavedriving.user.modular.system.service.IBroadcastService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 广播 |
| | | * @author pzb |
| | | * @Date 2023/2/27 17:10 |
| | | */ |
| | | @Service |
| | | public class BroadcastServiceImpl extends ServiceImpl<BroadcastMapper, Broadcast> implements IBroadcastService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.CancelOrderMapper; |
| | | import com.supersavedriving.user.modular.system.model.CancelOrder; |
| | | import com.supersavedriving.user.modular.system.service.ICancelOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 取消订单记录 |
| | | * @author pzb |
| | | * @Date 2023/2/25 14:45 |
| | | */ |
| | | @Service |
| | | public class CancelOrderServiceImpl extends ServiceImpl<CancelOrderMapper, CancelOrder> implements ICancelOrderService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.CommercialMapper; |
| | | import com.supersavedriving.user.modular.system.model.Commercial; |
| | | import com.supersavedriving.user.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.user.modular.system.service.ICommercialService; |
| | | import com.supersavedriving.user.modular.system.service.ICommercialUserEjectService; |
| | | import com.supersavedriving.user.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.CommercialWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 广告逻辑类 |
| | | */ |
| | | @Service |
| | | public class CommercialServiceImpl extends ServiceImpl<CommercialMapper, Commercial> implements ICommercialService { |
| | | |
| | | @Autowired |
| | | private ICommercialUserEjectService commercialUserEjectService; |
| | | |
| | | |
| | | /** |
| | | * 获取广告列表 |
| | | * @param type 广告类型(1=弹窗广告) |
| | | * @param device 设备(1=小程序,2=司机端) |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception { |
| | | if(type == 1){//弹框广告 |
| | | // CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) |
| | | // .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); |
| | | // if(null != commercialUserEject){ |
| | | // return new ArrayList<>(); |
| | | // } |
| | | } |
| | | List<CommercialWarpper> commercialWarppers = this.baseMapper.queryCommercialList(type, device); |
| | | if(type == 1 && commercialWarppers.size() > 0){//记录弹窗 |
| | | CommercialUserEject commercialUserEject = new CommercialUserEject(); |
| | | commercialUserEject.setId(Long.valueOf(UUIDUtil.getNumberRandom(16))); |
| | | commercialUserEject.setLastDate(new Date()); |
| | | commercialUserEject.setUserId(uid); |
| | | commercialUserEject.setUserType(2); |
| | | commercialUserEjectService.insert(commercialUserEject); |
| | | } |
| | | return commercialWarppers; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.CommercialUserEjectMapper; |
| | | import com.supersavedriving.user.modular.system.model.CommercialUserEject; |
| | | import com.supersavedriving.user.modular.system.service.ICommercialUserEjectService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CommercialUserEjectServiceImpl extends ServiceImpl<CommercialUserEjectMapper, CommercialUserEject> implements ICommercialUserEjectService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.CouponMapper; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | import com.supersavedriving.user.modular.system.service.ICouponService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | import com.supersavedriving.user.modular.system.model.DriverWork; |
| | | import com.supersavedriving.user.modular.system.service.IDriverService; |
| | | import com.supersavedriving.user.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.user.modular.system.util.GeodesyUtil; |
| | | import com.supersavedriving.user.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机 |
| | | * @author pzb |
| | | * @Date 2023/2/8 18:52 |
| | | */ |
| | | @Service |
| | | public class DriverServiceImpl extends ServiceImpl<DriverMapper, Driver> implements IDriverService { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机 |
| | | * @param lon |
| | | * @param lat |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception { |
| | | List<NearbyDriverWarpper> list = new ArrayList<>(); |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(lon), Double.valueOf(lat)); |
| | | //构造半径 |
| | | Distance distanceR = new Distance(scope, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | List<DriverWork> driverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", collect).eq("status", 1)); |
| | | for (DriverWork driverWork : driverWorks) { |
| | | String value = redisUtil.getValue("DRIVER" + driverWork.getDriverId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | NearbyDriverWarpper nearbyDriverWarpper = new NearbyDriverWarpper(); |
| | | nearbyDriverWarpper.setLonLat(value); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, lon + "," + lat); |
| | | nearbyDriverWarpper.setDistance(distance.get("WGS84") / 1000); |
| | | nearbyDriverWarpper.setDriverId(driverWork.getDriverId()); |
| | | list.add(nearbyDriverWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.DriverWorkMapper; |
| | | import com.supersavedriving.user.modular.system.model.DriverWork; |
| | | import com.supersavedriving.user.modular.system.service.IDriverWorkService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 司机上下班操作记录 |
| | | * @author pzb |
| | | * @Date 2023/2/15 15:48 |
| | | */ |
| | | @Service |
| | | public class DriverWorkServiceImpl extends ServiceImpl<DriverWorkMapper, DriverWork> implements IDriverWorkService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.EvaluateMapper; |
| | | import com.supersavedriving.user.modular.system.model.Evaluate; |
| | | import com.supersavedriving.user.modular.system.service.IEvaluateService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/11 17:00 |
| | | */ |
| | | @Service |
| | | public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> implements IEvaluateService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.MainContentMapper; |
| | | import com.supersavedriving.user.modular.system.model.MainContent; |
| | | import com.supersavedriving.user.modular.system.service.IMainContentService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class MainContentServiceImpl extends ServiceImpl<MainContentMapper, MainContent> implements IMainContentService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.OrderMapper; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.*; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.user.modular.system.util.juhe.WeatherUtil; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 订单 |
| | | * @author pzb |
| | | * @Date 2023/2/16 15:57 |
| | | */ |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private IWeatherCityService weatherCityService; |
| | | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private ICancelOrderService cancelOrderService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private ICouponService couponService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IEvaluateService evaluateService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取预估费用 |
| | | * @param uid |
| | | * @param estimatedCosts |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<EstimatedCostsWarpper> getEstimatedCosts(Integer uid, EstimatedCosts estimatedCosts) throws Exception { |
| | | EstimatedCostsWarpper estimatedCostsWarpper = new EstimatedCostsWarpper(); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(estimatedCosts.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(estimatedCosts.getStartLng() + "," + estimatedCosts.getStartLat(), |
| | | estimatedCosts.getEndLng() + "," + estimatedCosts.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | estimatedCostsWarpper.setEstimatedMileage(d); |
| | | estimatedCostsWarpper.setTravelTime(Integer.valueOf(distance.get("duration")) / 60); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order = getOrderPrice(1, d, 0, new Order(), city); |
| | | Double estimatedPrice = order.getEstimatedPrice(); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); |
| | | if(null != coupon){ |
| | | Double couponPreferentialAmount = coupon.getCouponPreferentialAmount(); |
| | | estimatedCostsWarpper.setPrice(estimatedPrice - couponPreferentialAmount); |
| | | estimatedCostsWarpper.setDiscountAmount(couponPreferentialAmount); |
| | | }else{ |
| | | estimatedCostsWarpper.setPrice(estimatedPrice); |
| | | estimatedCostsWarpper.setDiscountAmount(0D); |
| | | } |
| | | //预估接驾时间 |
| | | int i = 0; |
| | | Double scope = 5D; |
| | | while (true){ |
| | | List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getLng().toString(), estimatedCosts.getLat().toString(), scope); |
| | | if(nearbyDriverWarppers.size() == 0){ |
| | | scope += 5; |
| | | i++; |
| | | if(i >= 10){ |
| | | estimatedCostsWarpper.setPickUpTime(60); |
| | | break; |
| | | } |
| | | continue; |
| | | } |
| | | if(nearbyDriverWarppers.size() > 0){ |
| | | NearbyDriverWarpper nearbyDriverWarpper = nearbyDriverWarppers.get(0); |
| | | Map<String, String> distance = MapUtil.getDistance(nearbyDriverWarpper.getLonLat(), estimatedCosts.getLng() + "," + estimatedCosts.getLat(), 1); |
| | | if(null != distance){ |
| | | distance.get("distance");//距离(M) |
| | | String duration = distance.get("duration");//时间(S) |
| | | estimatedCostsWarpper.setPickUpTime(Integer.valueOf(duration) / 60); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return ResultUtil.success(estimatedCostsWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取订单价格 |
| | | * @param type 计算类型(1=预估价,2=订单费) |
| | | * @param distance 行驶公里 |
| | | * @param waitTime 等待时长 |
| | | * @param order 订单数据 |
| | | * @param city 查询天气的城市 |
| | | * @return |
| | | */ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ |
| | | order = getOrderInitialPrice(order); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | if(null == systemConfig){ |
| | | if(type == 1){//预估金额 |
| | | order.setEstimatedPrice(0D); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(0D); |
| | | } |
| | | return order; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | Double num3 = jsonObject1.getDouble("num3");//起步里程 |
| | | Double num4 = jsonObject1.getDouble("num4");//起步价格 |
| | | Double num5 = jsonObject1.getDouble("num5");//超过公里 |
| | | Double num6 = jsonObject1.getDouble("num6");//超过num3每num5公里收取num6 |
| | | Double num7 = jsonObject1.getDouble("num7");//长途起始公里 |
| | | Double num8 = jsonObject1.getDouble("num8");//长途结束公里 |
| | | Double num9 = jsonObject1.getDouble("num9");//长途费 |
| | | Double num10 = jsonObject1.getDouble("num10");//超出长途里程每num10公里 |
| | | Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(num3.compareTo(distance) >= 0){//起步里程内 |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 |
| | | order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 |
| | | |
| | | //计算长途费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | order.setLongDistance(num7 + "-" + num8);//长途里程 |
| | | order.setLongDistancePrice(num9);//长途费 |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //计算额外费用 |
| | | Integer num1 = extraCost.getInteger("num1");//等待时长 |
| | | Double num2 = extraCost.getDouble("num2");//等待费 |
| | | Integer num3 = extraCost.getInteger("num3");//等待超出时长 |
| | | Double num4 = extraCost.getDouble("num4");//等到超出时长费用单价 X/分钟 |
| | | Double num5 = extraCost.getDouble("num5");//恶劣天气公里 |
| | | Double num6 = extraCost.getDouble("num6");//恶劣天气费 |
| | | Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 |
| | | Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | | order.setWaitTime(num1);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | | } |
| | | |
| | | //恶劣天气 |
| | | boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | if(badWeather){ |
| | | order.setBadWeatherDistance(num5);//恶劣天气公里 |
| | | order.setBadWeatherPrice(num6);//恶劣天气费 |
| | | if(distance.compareTo(num7) > 0){ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); |
| | | BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); |
| | | order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 |
| | | order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | |
| | | double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) |
| | | if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 |
| | | order.setBadWeatherPrice(num9);//恶劣天气费 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); |
| | | order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | } |
| | | } |
| | | |
| | | //计算总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + |
| | | order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | |
| | | if(type == 1){//预估价 |
| | | order.setEstimatedPrice(bigDecimal.doubleValue()); |
| | | } |
| | | if(type == 2){//订单金额 |
| | | order.setOrderMoney(bigDecimal.doubleValue()); |
| | | } |
| | | return order; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 初始订单费用 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | public Order getOrderInitialPrice(Order order){ |
| | | order.setStartDistance(0D);//起步里程 |
| | | order.setStartPrice(0D);//起步价 |
| | | order.setOverDriveDistance(0D);//超出起步里程 |
| | | order.setOverDrivePrice(0D);//超出起步里程费 |
| | | order.setLongDistance("");//长途里程 |
| | | order.setLongDistancePrice(0D);//长途里程费 |
| | | order.setOverLongDistance(0D);//超出长途里程 |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | | order.setBadWeatherDistance(0D);//恶劣天气里程 |
| | | order.setBadWeatherPrice(0D);//恶劣天气里程费 |
| | | order.setOverBadWeatherDistance(0D);//恶劣天气超出里程 |
| | | order.setOverBadWeatherPrice(0D);//恶劣天气超出里程费 |
| | | order.setDiscountedPrice(0D);//优惠金额 |
| | | order.setCouponId(null);//优惠券 |
| | | order.setDiscountAmount(0D);//折扣优惠金额 |
| | | order.setDiscount(0D);//折扣 |
| | | return order; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下单操作 |
| | | * @param uid |
| | | * @param travelOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil travelOrder(Integer uid, TravelOrder travelOrder) throws Exception { |
| | | List<Integer> state = Arrays.asList(101, 102, 103, 104, 105, 106, 107, 201, 401); |
| | | Order order = this.selectOne(new EntityWrapper<Order>().eq("userId", uid).eq("status", 1).in("state", state)); |
| | | if(null != order){ |
| | | return ResultUtil.error("您还有正在进行的订单"); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | order = this.selectOne(new EntityWrapper<Order>().eq("userPhone", appUser.getPhone()).eq("status", 1).in("state", state)); |
| | | if(null != order){ |
| | | return ResultUtil.error("您还有正在进行的订单"); |
| | | } |
| | | order = new Order(); |
| | | BeanUtils.copyProperties(travelOrder, order); |
| | | if(ToolUtil.isEmpty(travelOrder.getUserPhone())){ |
| | | order.setUserPhone(appUser.getPhone()); |
| | | order.setUserName(appUser.getNickname()); |
| | | } |
| | | order.setUserId(uid); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); |
| | | order.setSource(1); |
| | | order.setHallOrder(0); |
| | | order.setStatus(1); |
| | | order.setCreateTime(new Date()); |
| | | order.setState(null != travelOrder.getDriverId() ? 102 : 101); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(travelOrder.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order.setEstimatedMileage(d); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); |
| | | if(null != geocode){ |
| | | 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); |
| | | if(null != travelOrder.getDriverId()){ |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("司机还未上班"); |
| | | } |
| | | Driver driver = driverService.selectById(travelOrder.getDriverId()); |
| | | order.setAgentId(driver.getAgentId()); |
| | | order.setBranchOfficeId(driver.getBranchOfficeId()); |
| | | order.setOrderTakingTime(new Date()); |
| | | |
| | | driver.setServerStatus(2); |
| | | driverService.updateById(driver); |
| | | |
| | | appUser.setCancelCount(0); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | for (Integer i = 0; i < travelOrder.getDriverNum(); i++) { |
| | | order.setId(null); |
| | | this.insert(order); |
| | | |
| | | //推送状态 |
| | | pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState()); |
| | | if(null != travelOrder.getDriverId()){ |
| | | pushUtil.pushOrderStatus(travelOrder.getDriverId(), 2, order.getId(), order.getState()); |
| | | }else{ |
| | | //推单 |
| | | pushOrder(order); |
| | | } |
| | | } |
| | | return ResultUtil.success(order.getId()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单推送逻辑 |
| | | * @param order |
| | | */ |
| | | public void pushOrder(Order order){ |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | | * 没有1 - 》 |
| | | * 2.按照后台推送配置在范围内查找合适司机 |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num3 = jsonObject.getDouble("num3");//推单最大范围 |
| | | Integer num4 = jsonObject.getInteger("num4");//接单时间 |
| | | String startLat = order.getStartLat(); |
| | | String startLng = order.getStartLng(); |
| | | |
| | | //1 |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLat), Double.valueOf(startLng)); |
| | | Double num = num3 / 1000;//范围公里 |
| | | //构造半径 |
| | | Distance distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | Integer driver = null; |
| | | if(driverIds.size() > 0){ |
| | | List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds).last(" and now() < failureTime")); |
| | | Double d = null; |
| | | for (YouTuiDriver youTuiDriver : youTuiDrivers) { |
| | | String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | driver = youTuiDriver.getDriverId(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //开始范围查找 |
| | | if(null == driver){ |
| | | for (int i = 1; i < 4; i++) { |
| | | num = jsonObject.getDouble("num" + i) / 1000;//范围公里 |
| | | //构造半径 |
| | | distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | locations = mongoTemplate.find(query, Location.class); |
| | | |
| | | driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() > 0){ |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("serverStatus", 1).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | continue; |
| | | } |
| | | |
| | | Integer integral = null; |
| | | Double score = null; |
| | | Double d = null; |
| | | for (Driver driver1 : drivers) { |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离 |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(null != driver){ |
| | | pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); |
| | | //创建定时任务处理订单到大厅 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | } |
| | | } |
| | | }, num4 * 1000); |
| | | }else{ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param cause |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil cancelOrder(Integer uid, Long orderId, String cause) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() >= 105){ |
| | | return ResultUtil.error("不能取消订单"); |
| | | } |
| | | CancelOrder cancelOrder = new CancelOrder(); |
| | | cancelOrder.setOrderId(orderId); |
| | | cancelOrder.setUserType(1); |
| | | cancelOrder.setUserId(uid); |
| | | cancelOrder.setCause(cause); |
| | | cancelOrder.setStatus(1); |
| | | cancelOrder.setCreateTime(new Date()); |
| | | cancelOrderService.insert(cancelOrder); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setCancelCount(appUser.getCancelCount() + 1); |
| | | appUserService.updateById(appUser); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单详情 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { |
| | | return this.baseMapper.queryOrderInfo(uid, orderId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改订单终点 |
| | | * @param uid |
| | | * @param editOrderEndAddress |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception { |
| | | Order order = this.selectById(editOrderEndAddress.getOrderId()); |
| | | order.setEndAddress(editOrderEndAddress.getEndAddress()); |
| | | order.setEndLat(editOrderEndAddress.getEndLat().toString()); |
| | | order.setEndLng(editOrderEndAddress.getEndLng().toString()); |
| | | Double d = 0D; |
| | | if(ToolUtil.isNotEmpty(order.getEndAddress())){ |
| | | Map<String, String> distance = MapUtil.getDistance(order.getStartLng() + "," + order.getStartLat(), |
| | | order.getEndLng() + "," + order.getEndLat(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("获取预估距离出错"); |
| | | } |
| | | d = Double.valueOf(distance.get("distance")) / 1000; |
| | | order.setEstimatedMileage(d); |
| | | } |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order1 = new Order(); |
| | | BeanUtils.copyProperties(order, order1); |
| | | Order orderPrice = getOrderPrice(1, d, 0, order1, city); |
| | | order.setEstimatedPrice(orderPrice.getEstimatedPrice()); |
| | | this.updateById(order); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 获取费用明细 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId, Integer payType) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | Double orderMoney = order.getOrderMoney(); |
| | | //先算优惠券 |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | if(null != coupon){ |
| | | orderMoney = orderMoney - coupon.getCouponPreferentialAmount(); |
| | | } |
| | | //再算折扣(余额完全可以抵扣费用才能有折扣) |
| | | if(payType == 1 && appUser.getAccountBalance() > orderMoney){//使用余额抵扣 |
| | | orderPriceWarpper.setDiscount(appUser.getHavDiscount() == 0 ? 0 : 9D); |
| | | orderPriceWarpper.setDiscountAmount(orderMoney * 0.1); |
| | | orderPriceWarpper.setPayType(2);//余额支付 |
| | | orderMoney = orderMoney - orderPriceWarpper.getDiscountAmount(); |
| | | } |
| | | if(payType == 0){//不使用余额抵扣 |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(1);//微信支付 |
| | | } |
| | | if(payType == 1 && appUser.getAccountBalance() > 0 && appUser.getAccountBalance() < orderMoney){//使用余额抵扣部分 |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(4);//微信+余额 |
| | | orderMoney = orderMoney - appUser.getAccountBalance(); |
| | | } |
| | | orderPriceWarpper.setPayMoney(orderMoney); |
| | | return orderPriceWarpper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单支付页面优惠券列表 |
| | | * @param uid |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponWarpper> queryPayCouponList(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | return userToCouponService.queryPayCouponList(uid, order.getOrderMoney()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 支付订单操作 |
| | | * @param uid |
| | | * @param orderPayment |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderPayment(Integer uid, OrderPayment orderPayment) throws Exception { |
| | | Order order = this.selectById(orderPayment.getOrderId()); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | if(order.getState() != 107){ |
| | | return ResultUtil.error("不允许支付"); |
| | | } |
| | | if(orderPayment.getPayType() == 2){ |
| | | Double payMoney = order.getOrderMoney() * (appUser.getHavDiscount() == 1 ? 0.9 : 1); |
| | | if(appUser.getAccountBalance() < payMoney){ |
| | | return ResultUtil.error("账户余额不足"); |
| | | } |
| | | } |
| | | //开始支付操作 |
| | | if(orderPayment.getPayType() == 1){//微信支付 |
| | | return weixinPay(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | if(orderPayment.getPayType() == 2){//余额支付 |
| | | return balancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | if(orderPayment.getPayType() == 3){//线下支付(由司机端操作) |
| | | } |
| | | if(orderPayment.getPayType() == 4){//微信+余额 |
| | | return weixinAndBalancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @param couponId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | this.updateById(order); |
| | | return weixinpay; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 账户余额支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @return |
| | | */ |
| | | public ResultUtil balancePayment(Order order, AppUser appUser, Integer couponId){ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | |
| | | if(appUser.getHavDiscount() == 1){//9折 |
| | | payMoney = payMoney * 0.9; |
| | | order.setDiscount(9D); |
| | | order.setDiscountAmount(payMoney * 0.1); |
| | | } |
| | | |
| | | order.setPayType(2); |
| | | order.setPayMoney(payMoney); |
| | | order.setPayTime(new Date()); |
| | | order.setState(108); |
| | | this.updateById(order); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() - payMoney); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信+账户余额支付 |
| | | * @param order |
| | | * @param appUser |
| | | * @param couponId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinAndBalancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | |
| | | payMoney = payMoney > appUser.getAccountBalance() ? payMoney - appUser.getAccountBalance() : 0D; |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | if(0 < payMoney){//还需要调起微信支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() != 107){ |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * SUCCESS--支付成功 |
| | | * REFUND--转入退款 |
| | | * NOTPAY--未支付 |
| | | * CLOSED--已关闭 |
| | | * REVOKED--已撤销(刷卡支付) |
| | | * USERPAYING--用户支付中 |
| | | * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | * ACCEPT--已接收,等待扣款 |
| | | */ |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(out_trade_no, ""); |
| | | if(resultUtil.getCode() == 200){ |
| | | Map<String, String> map = resultUtil.getData(); |
| | | String trade_type = map.get("trade_type"); |
| | | String trade_state = map.get("trade_state"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | if("REFUND".equals(trade_state) || "NOTPAY".equals(trade_state) || "CLOSED".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){ |
| | | AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); |
| | | AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); |
| | | Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); |
| | | appUser1.setAccountBalance(appUser1.getAccountBalance() + b); |
| | | appUserService.updateById(appUser1); |
| | | |
| | | accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | return; |
| | | } |
| | | if("SUCCESS".equals(trade_state)){ |
| | | order1.setPayTime(new Date()); |
| | | order1.setState(108); |
| | | order1.setOrderNo(transaction_id); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | |
| | | //处理抽成及收入 |
| | | return; |
| | | } |
| | | if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | return weixinpay; |
| | | } |
| | | order.setPayTime(new Date()); |
| | | this.updateById(order); |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | /** |
| | | * 订单微信支付回调 |
| | | * @param orderId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderPayCallback(String orderId, String transaction_id) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() != 107){ |
| | | return ResultUtil.success(); |
| | | } |
| | | order.setState(108); |
| | | order.setPayTime(new Date()); |
| | | order.setOrderNo(transaction_id); |
| | | this.updateById(order); |
| | | //添加收入明细 |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单评价 |
| | | * @param uid |
| | | * @param orderId |
| | | * @param score |
| | | * @param content |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(order.getState() != 108){ |
| | | return ResultUtil.error("不能进行评价"); |
| | | } |
| | | order.setState(109); |
| | | this.updateById(order); |
| | | Evaluate evaluate = new Evaluate(); |
| | | evaluate.setOrderId(orderId.intValue()); |
| | | evaluate.setCreateTime(new Date()); |
| | | evaluate.setScore(score); |
| | | evaluate.setEvaluate(content); |
| | | evaluate.setStatus(1); |
| | | evaluate.setUserId(uid); |
| | | evaluateService.insert(evaluate); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setScore((driver.getScore() + score) / 2); |
| | | if(score == 5){//司机积分奖励 |
| | | 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} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num5 = jsonObject.getInteger("num5"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setExplain("代驾5星好评"); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.SystemConfigMapper; |
| | | import com.supersavedriving.user.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.user.modular.system.service.ISystemConfigService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 系统配置 |
| | | * @author pzb |
| | | * @Date 2023/2/15 16:26 |
| | | */ |
| | | @Service |
| | | public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.UserToCouponMapper; |
| | | import com.supersavedriving.user.modular.system.model.Coupon; |
| | | import com.supersavedriving.user.modular.system.model.UserToCoupon; |
| | | import com.supersavedriving.user.modular.system.service.IUserToCouponService; |
| | | import com.supersavedriving.user.modular.system.warpper.CouponWarpper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/2 14:22 |
| | | */ |
| | | @Service |
| | | public class UserToCouponServiceImpl extends ServiceImpl<UserToCouponMapper, UserToCoupon> implements IUserToCouponService { |
| | | |
| | | |
| | | /** |
| | | * 获取可用优惠券 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public Coupon queryCoupon(Integer uid, Double price) throws Exception { |
| | | return this.baseMapper.queryCoupon(uid, price); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单支付页面的优惠券列表 |
| | | * @param uid |
| | | * @param price |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception { |
| | | return this.baseMapper.queryPayCouponList(uid, price); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.WeatherCityMapper; |
| | | import com.supersavedriving.user.modular.system.model.WeatherCity; |
| | | import com.supersavedriving.user.modular.system.service.IWeatherCityService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class WeatherCityServiceImpl extends ServiceImpl<WeatherCityMapper, WeatherCity> implements IWeatherCityService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.YouTuiDriverMapper; |
| | | import com.supersavedriving.user.modular.system.model.YouTuiDriver; |
| | | import com.supersavedriving.user.modular.system.service.IYouTuiDriverService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 用户优推数据 |
| | | * @author pzb |
| | | * @Date 2023/2/22 14:06 |
| | | */ |
| | | @Service |
| | | public class YouTuiDriverServiceImpl extends ServiceImpl<YouTuiDriverMapper, YouTuiDriver> implements IYouTuiDriverService { |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.GaoDe; |
| | | |
| | | /** |
| | | * 高德地图配置 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:52 |
| | | */ |
| | | public interface MapConfig { |
| | | |
| | | /** |
| | | * 高德key |
| | | */ |
| | | String key = "e0370a9a4d10739045fb0b8f4742a67e"; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.GaoDe; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.user.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.supersavedriving.user.modular.system.util.httpClinet.HttpResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 地图工具类 |
| | | * @author pzb |
| | | * @Date 2023/2/16 18:48 |
| | | */ |
| | | public class MapUtil { |
| | | |
| | | public static Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取两点的距离 |
| | | * @param origins 起点坐标 |
| | | * @param destination 终点坐标 |
| | | * @param type 计算类型:0:直线距离 1:驾车导航距离(仅支持国内坐标)。 |
| | | * @return |
| | | */ |
| | | public static Map<String, String> getDistance(String origins, String destination, Integer type){ |
| | | try { |
| | | String url = "https://restapi.amap.com/v3/distance?key=" + MapConfig.key + "&origins=" + origins + "&destination=" + destination + |
| | | "&type=" + type; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | if(httpResult.getCode() != 200){ |
| | | logger.debug(httpResult.getData()); |
| | | return null; |
| | | } |
| | | String data = httpResult.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | String status = jsonObject.getString("status"); |
| | | if(status.equals("1")){ |
| | | JSONArray results = jsonObject.getJSONArray("results"); |
| | | JSONObject jsonObject1 = results.getJSONObject(0); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("distance", jsonObject1.getString("distance"));//距离(米) |
| | | map.put("duration", jsonObject1.getString("duration"));//预计时间(秒) |
| | | return map; |
| | | }else{ |
| | | logger.debug(data); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 地址转换经纬度 |
| | | * @param address |
| | | * @return |
| | | */ |
| | | public static List<String> geocoding(String address){ |
| | | try { |
| | | 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; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | if(status.equals("1")){ |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | | for(int i = 0; i < geocodes.size(); i++){ |
| | | String location = geocodes.getJSONObject(i).getString("location"); |
| | | list.add(location); |
| | | } |
| | | } |
| | | return list; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据经纬度获取行政区域信息 |
| | | * @param lon |
| | | * @param lan |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static District geocode(String lon, String lan) { |
| | | try { |
| | | 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; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(jsonObject.getString("status").equals("1")){ |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | | JSONObject addressComponent = regeocode.getJSONObject("addressComponent"); |
| | | String address = regeocode.getString("formatted_address"); |
| | | map.put("address", address); |
| | | String code = addressComponent.getString("adcode"); |
| | | String province = addressComponent.getString("province"); |
| | | String city = addressComponent.getString("city"); |
| | | String district = addressComponent.getString("district"); |
| | | District district1 = new District(); |
| | | district1.setProvince(province); |
| | | district1.setProvinceCode(code.substring(0, 2) + "0000"); |
| | | district1.setCity(city); |
| | | district1.setCityCode(code.substring(0, 4) + "00"); |
| | | district1.setDistrict(district); |
| | | district1.setDistrictCode(code); |
| | | return district1; |
| | | } |
| | | logger.debug(httpResult.getData()); |
| | | return null; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.GaoDe.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 行政区域 |
| | | * @author pzb |
| | | * @Date 2023/2/25 11:40 |
| | | */ |
| | | @Data |
| | | public class District { |
| | | /** |
| | | * 省名称 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 区县名称 |
| | | */ |
| | | private String district; |
| | | /** |
| | | * 区县编号 |
| | | */ |
| | | private String districtCode; |
| | | } |
| | |
| | | /** |
| | | * 计算两个金纬度坐标之间的直线距离 |
| | | */ |
| | | @Component |
| | | public class GeodesyUtil { |
| | | |
| | | |
| | |
| | | * @param toLonLat |
| | | * @return |
| | | */ |
| | | public Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | public static Map<String, Double> getDistance(String fromLonLat, String toLonLat){ |
| | | Map<String, Double> map = null; |
| | | if(ToolUtil.isNotEmpty(fromLonLat) && ToolUtil.isNotEmpty(toLonLat)){ |
| | | map = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | |
| | | private double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | private static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid){ |
| | | //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 |
| | | GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); |
| | | return geoCurve.getEllipsoidalDistance(); |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.CertAlipayRequest; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.internal.util.AlipaySignature; |
| | | import com.alipay.api.request.AlipayTradeAppPayRequest; |
| | | import com.alipay.api.request.AlipayTradePrecreateRequest; |
| | | import com.alipay.api.request.AlipayTradeQueryRequest; |
| | | import com.alipay.api.request.AlipayTradeRefundRequest; |
| | | import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | import com.alipay.api.response.AlipayTradePrecreateResponse; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.alipay.api.response.AlipayTradeRefundResponse; |
| | | import com.alipay.api.domain.AlipayTradeRefundModel; |
| | | import com.alipay.api.request.*; |
| | | import com.alipay.api.response.*; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.util.httpClinet.HttpClientUtil; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | import org.dom4j.Document; |
| | | 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; |
| | |
| | | @Value("${wx.appid}") |
| | | private String appid;//微信appid |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String appletsAppid;//微信小程序appid |
| | | |
| | | @Value("${wx.mchId}") |
| | | private String mchId;//微信商户号 |
| | | |
| | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | private String app_cert_path = "/usr/local/server/cer/zhifubao/user/app_cert_path.crt";//应用公钥证书路径 |
| | | |
| | | private String alipay_cert_path = "/usr/local/server/cer/zhifubao/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 |
| | | |
| | | private String alipay_root_cert_path = "/usr/local/server/cer/zhifubao/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 |
| | | |
| | | private Map<String, JSONObject> order = new HashMap<>();//存储支付订单用于主动查询支付结果 |
| | | |
| | |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String body, String subject, String outTradeNo, String amount, String notifyUrl){ |
| | | public ResultUtil alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl){ |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | // //设置网关地址 |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | // //设置应用Id |
| | | // certAlipayRequest.setAppId(aliAppid); |
| | | // //设置应用私钥 |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | // //设置请求格式,固定值json |
| | | // certAlipayRequest.setFormat("json"); |
| | | // //设置字符集 |
| | | // certAlipayRequest.setCharset("UTF-8"); |
| | | // //设置签名类型 |
| | | // certAlipayRequest.setSignType("RSA2"); |
| | | // //设置应用公钥证书路径 |
| | | // certAlipayRequest.setCertPath(app_cert_path); |
| | | // //设置支付宝公钥证书路径 |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | // //设置支付宝根证书路径 |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | // //构造client |
| | | // AlipayClient alipayClient = null; |
| | | // try { |
| | | // alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | // model.setBody(body); |
| | | // model.setSubject (subject); |
| | | // model.setOutTradeNo (outTradeNo); |
| | | // model.setTimeoutExpress ("30m" ); |
| | | // model.setTotalAmount (amount); |
| | | // model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel ( model ); |
| | | // request.setNotifyUrl (callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipayPublicKey, "RSA2"); |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + ","; |
| | | : valueStr + values[i] + "_"; |
| | | } |
| | | //乱码解决,这段代码在出现乱码时使用。 |
| | | //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8"); |
| | |
| | | } |
| | | //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。 |
| | | //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type) |
| | | try { |
| | | boolean flag = AlipaySignature.rsaCheckV1(params, alipayPublicKey, "UTF-8","RSA2"); |
| | | if(flag){ |
| | | Map<String, String> map = new HashMap<>(); |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | return map; |
| | | } |
| | | // try { |
| | | // boolean flag = AlipaySignature.rsaCheckV1(params, alipay_public_key, "UTF-8","RSA2"); |
| | | // if(flag){ |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // String out_trade_no = params.get("out_trade_no"); |
| | | // String subject = params.get("subject"); |
| | | // String total_amount = params.get("total_amount"); |
| | | // String trade_no = params.get("trade_no"); |
| | | // String passback_params = params.get("passback_params"); |
| | | // map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | // map.put("subject", subject); |
| | | // map.put("total_amount", total_amount); |
| | | // map.put("trade_no", trade_no);//支付宝交易号 |
| | | // map.put("passback_params", passback_params);//回传参数 |
| | | // return map; |
| | | // }else{ |
| | | // System.err.println("验签失败"); |
| | | // } |
| | | // |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | String passback_params = params.get("passback_params"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | map.put("passback_params", passback_params);//回传参数 |
| | | return map; |
| | | } |
| | | |
| | | |
| | |
| | | * @param tradeType 交易类型 |
| | | * @return |
| | | */ |
| | | public ResultUtil weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType) throws Exception{ |
| | | public ResultUtil weixinpay(String body, String attach, String out_trade_no, String total_fee, String notify_url, String tradeType, String openId) throws Exception{ |
| | | if("JSAPI".equals(tradeType) && ToolUtil.isEmpty(openId)){ |
| | | return ResultUtil.error("请先用微信登录后再进行支付"); |
| | | } |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | |
| | | } |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("appid", "APP".equals(tradeType) ? appid : appletsAppid); |
| | | map.put("mch_id", mchId); |
| | | map.put("nonce_str", nonce_str); |
| | | map.put("body", body); |
| | |
| | | map.put("spbill_create_ip", hostAddress); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | map.put("trade_type", tradeType); |
| | | if("JSAPI".equals(tradeType)){ |
| | | map.put("openid", openId); |
| | | } |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | | |
| | |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | String type = map1.get("trade_type"); |
| | | String prepay_id = map1.get("prepay_id"); |
| | | switch (type){ |
| | | case "JSAPI": |
| | | break; |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appId", map1.get("appid")); |
| | | map2.put("nonceStr", map1.get("nonce_str")); |
| | | map2.put("package", "prepay_id=" + prepay_id); |
| | | map2.put("signType", "MD5"); |
| | | map2.put("timeStamp", new Date().getTime() + ""); |
| | | String s2 = this.weixinSignature(map2); |
| | | |
| | | map2.put("prepay_id", prepay_id); |
| | | map2.put("mch_id", map1.get("mch_id")); |
| | | map2.put("trade_type", map1.get("trade_type")); |
| | | |
| | | map2.put("sign", s2); |
| | | return ResultUtil.success(map2); |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String prepay_id = map1.get("prepay_id"); |
| | | //重新进行签名后返回给前端 |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("appid", appid); |
| | | map2.put("noncestr", nonce_str); |
| | | map2.put("package", "Sign=WXPay"); |
| | | map2.put("partnerid", mchId); |
| | | map2.put("prepayid", prepay_id); |
| | | map2.put("timestamp", new Date().getTime() / 1000); |
| | | String s1 = this.weixinSignature(map2); |
| | | map2.put("sign", s1); |
| | | System.err.println(map2); |
| | | return ResultUtil.success(map2); |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("appid", appid); |
| | | map3.put("noncestr", nonce_str); |
| | | map3.put("package", "Sign=WXPay"); |
| | | map3.put("partnerid", mchId); |
| | | map3.put("prepayid", prepay_id); |
| | | map3.put("timestamp", new Date().getTime() / 1000); |
| | | String s1 = this.weixinSignature(map3); |
| | | map3.put("sign", s1); |
| | | System.err.println(map3); |
| | | return ResultUtil.success(map3); |
| | | } |
| | | return null; |
| | | }else{ |
| | |
| | | if("SUCCESS".equals(result_code)){ |
| | | Map<String, String> map1 = new HashedMap(); |
| | | map1.put("nonce_str", map.get("nonce_str")); |
| | | map1.put("out_trade_no", map.get("out_trade_no").split("_")[1]);//存储的订单code |
| | | map1.put("out_trade_no", map.get("out_trade_no"));//存储的订单code |
| | | map1.put("attach", map.get("attach"));//存储订单id |
| | | map1.put("total_fee", map.get("total_fee")); |
| | | map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | |
| | | map1.put("result", result); |
| | | return map1; |
| | | }else{ |
| | | // System.err.println(map.get("err_code_des")); |
| | | System.err.println(map.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | // System.err.println(map.get("return_msg")); |
| | | System.err.println(map.get("return_msg")); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | |
| | | * @param auth_code 授权码 扫码支付授权码,设备读取用户微信中的条码或者二维码信息(注:用户付款码条形码规则:18位纯数字,以10、11、12、13、14、15开头) |
| | | * @return |
| | | */ |
| | | public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code){ |
| | | public ResultUtil wxScanQRCodePay(String body, String attach, String nonce_str, String out_trade_no, String total_fee, String auth_code) throws Exception{ |
| | | int i = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String hostAddress = null; |
| | | try { |
| | |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | |
| | | map.put("total_fee", tf); |
| | | map.put("refund_fee", rf); |
| | | map.put("notify_url", callbackPath + notify_url); |
| | | String s = this.weixinSignature(map); |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; |
| | |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | String body1 = null; |
| | | try { |
| | | String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12"; |
| | | body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println(body1); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | map1.put("refund_id", map.get("refund_id")); |
| | | map1.put("out_refund_no", map.get("out_refund_no")); |
| | | String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | | map1.put("result", result); |
| | | return map1; |
| | | }else{ |
| | | // System.err.println(map.get("return_msg")); |
| | |
| | | * @throws AlipayApiException |
| | | */ |
| | | public Map<String, String> aliRefund(String trade_no, String refund_amount) throws AlipayApiException { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); |
| | | AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("trade_no", trade_no); |
| | | jsonObject.put("refund_amount", refund_amount); |
| | | request.setBizContent(jsonObject.toJSONString()); |
| | | AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | //构造client |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); |
| | | //设置网关地址 |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | //设置应用Id |
| | | certAlipayRequest.setAppId(aliAppid); |
| | | //设置应用私钥 |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | //设置请求格式,固定值json |
| | | certAlipayRequest.setFormat("json"); |
| | | //设置字符集 |
| | | certAlipayRequest.setCharset("UTF8"); |
| | | //设置签名类型 |
| | | certAlipayRequest.setSignType("RSA2"); |
| | | //设置应用公钥证书路径 |
| | | certAlipayRequest.setCertPath(app_cert_path); |
| | | //设置支付宝公钥证书路径 |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | //设置支付宝根证书路径 |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | //构造client |
| | | AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | //构造API请求 |
| | | AlipayTradeRefundApplyRequest request = new AlipayTradeRefundApplyRequest(); |
| | | AlipayTradeRefundModel model = new AlipayTradeRefundModel(); |
| | | model.setTradeNo(trade_no); |
| | | model.setRefundAmount(refund_amount); |
| | | request.setBizModel(model); |
| | | //发送请求 |
| | | AlipayTradeRefundApplyResponse response = alipayClient.certificateExecute(request); |
| | | |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey,"json","UTF-8", alipay_public_key,"RSA2"); |
| | | // AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("trade_no", trade_no); |
| | | // jsonObject.put("refund_amount", refund_amount); |
| | | // request.setBizContent(jsonObject.toJSONString()); |
| | | // System.err.println(jsonObject.toJSONString()); |
| | | // AlipayTradeRefundResponse response = alipayClient.execute(request); |
| | | |
| | | Map<String, String> map = new HashMap<>(); |
| | | System.err.println(response.getSubMsg()); |
| | | if(response.isSuccess()){ |
| | | System.out.println("调用成功"); |
| | | String outTradeNo = response.getOutTradeNo(); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil queryWXOrder() throws Exception{ |
| | | public ResultUtil<Map<String, String>> queryWXOrder(String out_trade_no, String transaction_id) throws Exception{ |
| | | String url = "https://api.mch.weixin.qq.com/pay/orderquery"; |
| | | String nonce_str = UUIDUtil.getRandomCode(16); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("appid", appid); |
| | | map.put("mch_id", mchId); |
| | | map.put("transaction_id", nonce_str);//微信订单号 |
| | | map.put("out_trade_no", out_trade_no);//商户订单号 |
| | | map.put("transaction_id", transaction_id);//微信订单号 |
| | | map.put("nonce_str", nonce_str);//随机字符串 |
| | | String s = this.weixinSignature(map); |
| | | map.put("sign", s); |
| | |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String body1 = httpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()); |
| | | String body1 = HttpClientUtil.pushHttpRequsetXml(url, xmlString.toString(), new HashMap<>()).getData(); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | String type = map1.get("trade_type"); |
| | | switch (type){ |
| | | case "JSAPI": |
| | | break; |
| | | case "NATIVE": |
| | | String code_url = map1.get("code_url"); |
| | | return ResultUtil.success(code_url); |
| | | case "APP": |
| | | String trade_state = map1.get("trade_state"); |
| | | String time_end = map1.get("time_end"); |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("trade_state", trade_state);//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | map2.put("time_end", time_end);//订单支付时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。 |
| | | return ResultUtil.success(map2); |
| | | } |
| | | return null; |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | map2.put("trade_type", map1.get("trade_type")); |
| | | map2.put("trade_state", map1.get("trade_state"));//订单状态SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | map2.put("transaction_id", map1.get("transaction_id")); |
| | | return ResultUtil.success(map2); |
| | | }else{ |
| | | System.err.println(map1.get("err_code_des")); |
| | | return ResultUtil.error(map1.get("err_code_des")); |
| | | } |
| | | }else{ |
| | | System.err.println(map1.get("return_msg") + appid + "----" + mchId); |
| | | return ResultUtil.error(map1.get("return_msg"), new JSONObject()); |
| | | return ResultUtil.error(map1.get("return_msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 微信转账功能(企业付款到零钱) |
| | | * @param openid 商户appid下,某用户的openid |
| | | * @param desc 企业付款备注,必填。 |
| | | * @param total_fee 企业付款金额 |
| | | * @param partner_trade_no 商户订单号,需保持唯一性 |
| | | * @return |
| | | */ |
| | | public Map<String, String> wxTransfers(String openid, String desc, String total_fee, String partner_trade_no) throws Exception{ |
| | | int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_appid", appid);//申请商户号的appid或商户号绑定的appid |
| | | map.put("mchid", mchId);//微信支付分配的商户号 |
| | | map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | map.put("openid", openid);//商户appid下,某用户的openid |
| | | map.put("check_name", "NO_CHECK");//NO_CHECK:不校验真实姓名 FORCE_CHECK:强校验真实姓名 |
| | | map.put("amount", amount);//企业付款金额,单位为分 |
| | | map.put("desc", desc);//企业付款备注,必填。 |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12";//证书地址 |
| | | String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | map2.put("return_code", result_code); |
| | | map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | map2.put("payment_time", String.valueOf(map1.get("payment_time")));//付款时间 |
| | | return map2; |
| | | }else{ |
| | | map2.put("return_code", result_code); |
| | | map2.put("err_code", map1.get("err_code")); |
| | | map2.put("err_code_des", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | }else{ |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信转账功能(企业付款到银行卡) |
| | | * @param desc 备注信息 |
| | | * @param total_fee 转账金额 |
| | | * @param partner_trade_no 订单号 |
| | | * @param enc_bank_no 银行卡号 |
| | | * @param enc_true_name 收款方用户名 |
| | | * @param bankName 银行名称 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, String> wxPayBank(String desc, String total_fee, String partner_trade_no, String enc_bank_no, String enc_true_name, String bankName) throws Exception{ |
| | | int amount = new BigDecimal(total_fee).multiply(new BigDecimal("100")).intValue(); |
| | | String nonce_str = UUIDUtil.getRandomCode(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mch_id", mchId);//微信支付分配的商户号 |
| | | map.put("nonce_str", nonce_str);//随机字符串,不长于32位 |
| | | map.put("partner_trade_no", partner_trade_no);//商户订单号,需保持唯一性 |
| | | map.put("enc_bank_no", enc_bank_no);//收款方银行卡号(采用标准RSA算法,公钥由微信侧提供) |
| | | map.put("enc_true_name", enc_true_name);//收款方用户名(采用标准RSA算法,公钥由微信侧提供) |
| | | map.put("bank_code", findBankCode(bankName));// |
| | | map.put("amount", amount);//企业付款金额,单位为分 |
| | | map.put("desc", desc);//企业付款备注,必填。 |
| | | String s = this.weixinSignature(map, key); |
| | | map.put("sign", s); |
| | | |
| | | String url = "https://api.mch.weixin.qq.com/mmpaysptrans/pay_bank"; |
| | | //设置请求头 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_XML); |
| | | StringBuffer xmlString = new StringBuffer(); |
| | | Set<String> strings = map.keySet(); |
| | | String[] keys = {}; |
| | | keys = strings.toArray(keys); |
| | | Arrays.sort(keys); |
| | | xmlString.append("<xml>"); |
| | | for(int l = 0; l < keys.length; l++){ |
| | | xmlString.append("<" + keys[l] + ">" + map.get(keys[l]) + "</" + keys[l] + ">"); |
| | | } |
| | | xmlString.append("</xml>"); |
| | | |
| | | Map<String, String> map1 = null; |
| | | String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12";//证书地址 |
| | | String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); |
| | | //将结果xml解析成map |
| | | body1 = body1.replaceAll("<!\\[CDATA\\[",""); |
| | | body1 = body1.replaceAll("]]>", ""); |
| | | try { |
| | | map1 = this.xmlToMap(body1, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String return_code = map1.get("return_code"); |
| | | Map<String, String> map2 = new HashMap<>(); |
| | | if("SUCCESS".equals(return_code)){ |
| | | String result_code = map1.get("result_code"); |
| | | if("SUCCESS".equals(result_code)){ |
| | | map2.put("return_code", result_code); |
| | | map2.put("payment_no", String.valueOf(map1.get("payment_no")));//付款订单号 |
| | | map2.put("cmms_amt", String.valueOf(map1.get("cmms_amt")));//手续费金额 RMB:分 |
| | | return map2; |
| | | }else{ |
| | | map2.put("return_code", result_code); |
| | | map2.put("err_code", map1.get("err_code")); |
| | | map2.put("err_code_des", map1.get("err_code_des")); |
| | | return map2; |
| | | } |
| | | }else{ |
| | | map2.put("return_code", return_code); |
| | | map2.put("return_msg", map1.get("return_msg")); |
| | | return map2; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 微信转账到银行卡不编号 |
| | | * @param bankName |
| | | * @return |
| | | */ |
| | | public String findBankCode(String bankName){ |
| | | String json = "{\"工商银行 \":1002,\"农业银行\":1005,\"建设银行\":1003,\"中国银行\":1026,\"交通银行 \":1020,\"招商银行 \":1001,\"邮储银行\":1066,\"民生银行 \":1006,\"平安银行 \":1010,\"中信银行\":1021,\"浦发银行 \":1004,\"兴业银行 \":1009,\"光大银行 \":1022,\"广发银行\":1027,\"华夏银行\":1025,\"宁波银行\":1056,\"北京银行\":4836,\"上海银行\":1024,\"南京银行\":1054,\"长子县融汇村镇银行\":4755,\"长沙银行\":4216,\"浙江泰隆商业银行\":4051,\"中原银行 \":4753,\"企业银行(中国)\":4761,\"顺德农商银行 \":4036,\"衡水银行\":4752,\"长治银行\":4756,\"大同银行\":4767,\"河南省农村信用社\":4115,\"宁夏黄河农村商业银行\":4150,\"山西省农村信用社\":4156,\"安徽省农村信用社\":4166,\"甘肃省农村信用社\":4157,\"天津农村商业银行\":4153,\"广西壮族自治区农村信用社\":4113,\"陕西省农村信用社\":4108,\"深圳农村商业银行\":4076,\"宁波鄞州农村商业银行\":4052,\"浙江省农村信用社联合社\":4764,\"江苏省农村信用社联合社\":4217,\"江苏紫金农村商业银行股份有限公司 \":4072,\"北京中关村银行股份有限公司 \":4769,\"星展银行( 中国) 有限公司 \":4778,\"枣庄银行股份有限公司 \":4766,\"海口联合农村商业银行股份有限公司 \":4758,\"南洋商业银行( 中国) 有限公司 \":4763}"; |
| | | JSONObject jsonObject = JSON.parseObject(json); |
| | | Set<String> strings = jsonObject.keySet(); |
| | | for(String key : strings){ |
| | | if(key.indexOf(bankName) >= 0){ |
| | | return jsonObject.getString(key); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付宝转账 |
| | | * @param out_biz_no 商家侧唯一订单号,由商家自定义。对于不同转账请求,商家需保证该订单号在自身系统唯一。 |
| | | * @param trans_amount 订单总金额,单位为元,精确到小数点后两位 |
| | | * @param order_title 转账业务的标题,用于在支付宝用户的账单里显示 |
| | | * @param identity 参与方的唯一标识(收款方支付宝账号) |
| | | * @param name 参与方真实姓名,如果非空,将校验收款支付宝账号姓名一致性。 |
| | | * @param remark 业务备注 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public Map<String, Object> aliTransfer(String out_biz_no, Double trans_amount, String order_title, String identity, String name, String remark) throws Exception{ |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); //gateway:支付宝网关(固定)https://openapi.alipay.com/gateway.do |
| | | certAlipayRequest.setAppId(aliAppid); //APPID 即创建应用后生成,详情见创建应用并获取 APPID |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); //开发者应用私钥,由开发者自己生成 |
| | | certAlipayRequest.setFormat("json"); //参数返回格式,只支持 json 格式 |
| | | certAlipayRequest.setCharset("UTF-8"); //请求和签名使用的字符编码格式,支持 GBK和 UTF-8 |
| | | certAlipayRequest.setSignType("RSA2"); //商户生成签名字符串所使用的签名算法类型,目前支持 RSA2 和 RSA,推荐商家使用 RSA2。 |
| | | certAlipayRequest.setCertPath(app_cert_path); //应用公钥证书路径(app_cert_path 文件绝对路径) |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); //支付宝公钥证书文件路径(alipay_cert_path 文件绝对路径) |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); //支付宝CA根证书文件路径(alipay_root_cert_path 文件绝对路径) |
| | | AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest(); |
| | | request.setBizContent("{" + |
| | | "\"out_biz_no\":\"" + out_biz_no + "\"," + |
| | | "\"trans_amount\":" + trans_amount + "," + |
| | | "\"product_code\":\"TRANS_ACCOUNT_NO_PWD\"," + |
| | | "\"biz_scene\":\"DIRECT_TRANSFER\"," + |
| | | "\"order_title\":\"" + order_title + "\"," + |
| | | "\"payee_info\":{" + |
| | | "\"identity\":\"" + identity + "\"," + |
| | | "\"identity_type\":\"ALIPAY_USER_ID\"," + |
| | | "\"name\":\"" + name + "\"," + |
| | | "}," + |
| | | "\"remark\":\"" + remark + "\"" + |
| | | "}"); |
| | | AlipayFundTransUniTransferResponse response = alipayClient.certificateExecute(request); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(response.isSuccess()){ |
| | | String status = response.getStatus(); |
| | | if(status.equals("SUCCESS")){//成功 |
| | | map.put("code", response.getCode()); |
| | | map.put("order_id", response.getOrderId());//支付宝订单号 |
| | | map.put("pay_fund_order_id", response.getPayFundOrderId());//支付宝流水号 |
| | | }else{ |
| | | map.put("code", response.getCode()); |
| | | map.put("sub_msg", response.getSubMsg()); |
| | | } |
| | | } else { |
| | | map.put("code", response.getSubCode()); |
| | | map.put("sub_msg", response.getSubMsg()); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * 微信下单的签名算法 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | private String weixinSignature(Map<String, Object> map, String key_){ |
| | | try { |
| | | Set<Map.Entry<String, Object>> entries = map.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).toString().compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | String key = item.getKey(); |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | | sb.append(key + "=" + val + "&"); |
| | | } |
| | | } |
| | | } |
| | | sb.append("key=" + key_); |
| | | String sign = MD5AndKL.MD5Encode(sb.toString(), "UTF-8").toUpperCase(); //注:MD5签名方式 |
| | | return sign; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信退款成功后的解密 |
| | | * @param req_info |
| | | * @return |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * socket推单处理类 |
| | | */ |
| | | @Component |
| | | public class PushUtil { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送强迫下线 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushOffline(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "OFFLINE"); |
| | | msg.put("data", new Object()); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下班提醒 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushOffWork(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "OFF_WORK"); |
| | | msg.put("data", new Object()); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送订单状态 |
| | | * @param id |
| | | * @param type |
| | | * @param orderId |
| | | * @param status |
| | | */ |
| | | public void pushOrderStatus(Integer id, Integer type, Long orderId, Integer status){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "ORDER_STATUS"); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("status", status); |
| | | |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 系统推单推送 |
| | | * @param id 接受对象id |
| | | * @param type 接受对象类型(1=用户,2=司机) |
| | | * @param orderId 订单id |
| | | * @param countdown 抢单倒计时(秒) |
| | | */ |
| | | public void pushGrabOrder(Integer id, Integer type, Long orderId, Integer countdown){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "GRAB_ORDER"); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderId", orderId); |
| | | map.put("countdown", countdown); |
| | | |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 转单成功推送 |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushTransferSuccessful(Integer id, Integer type, Long orderId){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "TRANSFER_SUCCESS"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | map.put("orderId", orderId); |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取redis锁 |
| | | * @return |
| | | */ |
| | | public boolean lock(){ |
| | | try { |
| | | 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; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | unlock(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取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()); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public synchronized static String getTimeStr(){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmssS"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | return simpleDateFormat.format(new Date()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description: 获取数字随机码 |
| | | * @Author pzb |
| | | * @Date 2021/8/11 16:52 |
| | | * @Param |
| | | * @Return |
| | | * @Exception |
| | | */ |
| | | public static String getNumberRandom(Integer num){ |
| | | if(null == num){ |
| | | num = 32; |
| | | } |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < num; i++){ |
| | | sb.append(Double.valueOf(Math.random() * 10).intValue()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.juhe; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 天气实况 |
| | | * @author pzb |
| | | * @Date 2023/2/20 11:38 |
| | | */ |
| | | @Data |
| | | public class Realtime { |
| | | /** |
| | | * 天气情况,如:晴、多云 |
| | | */ |
| | | private String info; |
| | | /** |
| | | * 天气标识id,可参考小接口2 |
| | | */ |
| | | private String wid; |
| | | /** |
| | | * 温度,可能为空 |
| | | */ |
| | | private String temperature; |
| | | /** |
| | | * 湿度,可能为空 |
| | | */ |
| | | private String humidity; |
| | | /** |
| | | * 风向,可能为空 |
| | | */ |
| | | private String direct; |
| | | /** |
| | | * 风力,可能为空 |
| | | */ |
| | | private String power; |
| | | /** |
| | | * 空气质量指数,可能为空 |
| | | */ |
| | | private String aqi; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.juhe; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 天气相关城市 |
| | | * @author pzb |
| | | * @Date 2023/2/25 10:56 |
| | | */ |
| | | @Data |
| | | @TableName("t_weather_city") |
| | | public class WeatherCityInfo { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 省 |
| | | */ |
| | | @TableField("province") |
| | | private String province; |
| | | /** |
| | | * 市 |
| | | */ |
| | | @TableField("city") |
| | | private String city; |
| | | /** |
| | | * 区 |
| | | */ |
| | | @TableField("district") |
| | | private String district; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.juhe; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.supersavedriving.user.modular.system.util.httpClinet.HttpResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 天气工具类 |
| | | * @author pzb |
| | | * @Date 2023/2/18 16:54 |
| | | */ |
| | | public class WeatherUtil { |
| | | |
| | | static Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | private final static String weather_type = "[{\"wid\":\"00\",\"weather\":\"晴\"},{\"wid\":\"01\",\"weather\":\"多云\"},{\"wid\":\"02\",\"weather\":\"阴\"},{\"wid\":\"03\",\"weather\":\"阵雨\"},{\"wid\":\"04\",\"weather\":\"雷阵雨\"},{\"wid\":\"05\",\"weather\":\"雷阵雨伴有冰雹\"},{\"wid\":\"06\",\"weather\":\"雨夹雪\"},{\"wid\":\"07\",\"weather\":\"小雨\"},{\"wid\":\"08\",\"weather\":\"中雨\"},{\"wid\":\"09\",\"weather\":\"大雨\"},{\"wid\":\"10\",\"weather\":\"暴雨\"},{\"wid\":\"11\",\"weather\":\"大暴雨\"},{\"wid\":\"12\",\"weather\":\"特大暴雨\"},{\"wid\":\"13\",\"weather\":\"阵雪\"},{\"wid\":\"14\",\"weather\":\"小雪\"},{\"wid\":\"15\",\"weather\":\"中雪\"},{\"wid\":\"16\",\"weather\":\"大雪\"},{\"wid\":\"17\",\"weather\":\"暴雪\"},{\"wid\":\"18\",\"weather\":\"雾\"},{\"wid\":\"19\",\"weather\":\"冻雨\"},{\"wid\":\"20\",\"weather\":\"沙尘暴\"},{\"wid\":\"21\",\"weather\":\"小到中雨\"},{\"wid\":\"22\",\"weather\":\"中到大雨\"},{\"wid\":\"23\",\"weather\":\"大到暴雨\"},{\"wid\":\"24\",\"weather\":\"暴雨到大暴雨\"},{\"wid\":\"25\",\"weather\":\"大暴雨到特大暴雨\"},{\"wid\":\"26\",\"weather\":\"小到中雪\"},{\"wid\":\"27\",\"weather\":\"中到大雪\"},{\"wid\":\"28\",\"weather\":\"大到暴雪\"},{\"wid\":\"29\",\"weather\":\"浮尘\"},{\"wid\":\"30\",\"weather\":\"扬沙\"},{\"wid\":\"31\",\"weather\":\"强沙尘暴\"},{\"wid\":\"53\",\"weather\":\"霾\"}]"; |
| | | |
| | | private final static String bad_weather = "[{\"wid\":\"03\",\"weather\":\"阵雨\"},{\"wid\":\"04\",\"weather\":\"雷阵雨\"},{\"wid\":\"05\",\"weather\":\"雷阵雨伴有冰雹\"},{\"wid\":\"06\",\"weather\":\"雨夹雪\"},{\"wid\":\"07\",\"weather\":\"小雨\"},{\"wid\":\"08\",\"weather\":\"中雨\"},{\"wid\":\"09\",\"weather\":\"大雨\"},{\"wid\":\"10\",\"weather\":\"暴雨\"},{\"wid\":\"11\",\"weather\":\"大暴雨\"},{\"wid\":\"12\",\"weather\":\"特大暴雨\"},{\"wid\":\"13\",\"weather\":\"阵雪\"},{\"wid\":\"14\",\"weather\":\"小雪\"},{\"wid\":\"15\",\"weather\":\"中雪\"},{\"wid\":\"16\",\"weather\":\"大雪\"},{\"wid\":\"17\",\"weather\":\"暴雪\"},{\"wid\":\"19\",\"weather\":\"冻雨\"},{\"wid\":\"20\",\"weather\":\"沙尘暴\"},{\"wid\":\"21\",\"weather\":\"小到中雨\"},{\"wid\":\"22\",\"weather\":\"中到大雨\"},{\"wid\":\"23\",\"weather\":\"大到暴雨\"},{\"wid\":\"24\",\"weather\":\"暴雨到大暴雨\"},{\"wid\":\"25\",\"weather\":\"大暴雨到特大暴雨\"},{\"wid\":\"26\",\"weather\":\"小到中雪\"},{\"wid\":\"27\",\"weather\":\"中到大雪\"},{\"wid\":\"28\",\"weather\":\"大到暴雪\"},{\"wid\":\"30\",\"weather\":\"扬沙\"},{\"wid\":\"31\",\"weather\":\"强沙尘暴\"},{\"wid\":\"53\",\"weather\":\"霾\"}]"; |
| | | |
| | | private final static String key = "aaebb3e5c18fd371257a2ab6b5670efe"; |
| | | |
| | | private static HttpClientUtil httpClientUtil = new HttpClientUtil(); |
| | | |
| | | |
| | | /** |
| | | * 获取天气实况数据 |
| | | * @param city 要查询的城市名称/id,城市名称如:温州、上海、北京,需要utf8 urlencode |
| | | * @return |
| | | */ |
| | | public static Realtime queryNowWeather(String city){ |
| | | if(ToolUtil.isEmpty(city)){ |
| | | return null; |
| | | } |
| | | String url = "http://apis.juhe.cn/simpleWeather/query?city=" + city + "&key=" + key; |
| | | HttpResult httpResult = null; |
| | | try { |
| | | httpResult = httpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(httpResult.getCode() != 200){ |
| | | logger.debug("查询天气失败:" + httpResult.getData()); |
| | | return null; |
| | | } |
| | | String data = httpResult.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if(0 != error_code){ |
| | | logger.debug("查询天气失败:" + jsonObject.getString("reason")); |
| | | return null; |
| | | } |
| | | Realtime realtime = jsonObject.getObject("realtime", Realtime.class); |
| | | return realtime; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询是否是恶劣天气 |
| | | * @param city |
| | | * @return |
| | | */ |
| | | public static boolean isBadWeather(String city){ |
| | | if(null == city){ |
| | | return false; |
| | | } |
| | | Realtime realtime = queryNowWeather(city); |
| | | if(null == realtime){ |
| | | return false; |
| | | } |
| | | String wid = realtime.getWid(); |
| | | JSONArray badWeather = JSON.parseArray(bad_weather); |
| | | for (int i = 0; i < badWeather.size(); i++) { |
| | | JSONObject jsonObject = badWeather.getJSONObject(i); |
| | | String wid1 = jsonObject.getString("wid"); |
| | | if(wid.equals(wid1)){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取支持城市列表 |
| | | * @return |
| | | */ |
| | | public static List<WeatherCityInfo> queryCityList(){ |
| | | String url = "http://apis.juhe.cn/simpleWeather/cityList?key=" + key; |
| | | HttpResult httpResult = null; |
| | | try { |
| | | httpResult = httpClientUtil.pushHttpRequset("GET", url, null, null, "json"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(httpResult.getCode() != 200){ |
| | | logger.debug("查询支持城市失败:" + httpResult.getData()); |
| | | return null; |
| | | } |
| | | String data = httpResult.getData(); |
| | | JSONObject jsonObject = JSON.parseObject(data); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if(0 != error_code){ |
| | | logger.debug("查询支持城失败:" + jsonObject.getString("reason")); |
| | | return null; |
| | | } |
| | | JSONArray result = jsonObject.getJSONArray("result"); |
| | | List<WeatherCityInfo> weatherCities = result.toJavaList(WeatherCityInfo.class); |
| | | return weatherCities; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.mongodb; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.mongodb.BasicDBObject; |
| | | import com.mongodb.client.AggregateIterable; |
| | | import com.mongodb.client.MongoCursor; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.LocationQuery; |
| | | import org.bson.Document; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Supplier; |
| | | |
| | | |
| | | @Component |
| | | public class MongoUtils<T> { |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | /** |
| | | * lambda |
| | | * @param data 添加数据 |
| | | * @param collectionName 表名 |
| | | */ |
| | | public void insert(Supplier<T> data,String collectionName){ |
| | | mongoTemplate.insert(data.get(),collectionName); |
| | | } |
| | | |
| | | public void insert(Object data, String collectionName){ |
| | | mongoTemplate.insert(data,collectionName); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param sp 查询条件lambda |
| | | * @param sets 更新的字段 |
| | | * @param collectionName 表名 |
| | | */ |
| | | public void update(Supplier<Criteria> sp, Supplier<Map<String,Object>> sets, String collectionName){ |
| | | Query query = Query.query(sp.get()); |
| | | Update update = new Update(); |
| | | |
| | | sets.get().forEach((key,value) ->{ |
| | | //System.out.println(key); |
| | | //System.out.println(value); |
| | | update.set(key,value); |
| | | }); |
| | | mongoTemplate.updateFirst(query, update, collectionName); |
| | | } |
| | | |
| | | public void update(Criteria sp, Supplier<Map<String,Object>> sets, String collectionName){ |
| | | Query query = Query.query(sp); |
| | | Update update = new Update(); |
| | | |
| | | sets.get().forEach((key,value) ->{ |
| | | //System.out.println(key); |
| | | //System.out.println(value); |
| | | update.set(key,value); |
| | | }); |
| | | mongoTemplate.updateFirst(query, update, collectionName); |
| | | } |
| | | |
| | | /**lambda |
| | | * @param sp 查询条件lambda |
| | | * @param collectionName 表名 |
| | | * @return |
| | | */ |
| | | public List<T> query(Supplier<Criteria> sp, String collectionName, Class entityClass){ |
| | | Query query = Query.query(sp.get()); |
| | | List<T> ts = mongoTemplate.find(query,entityClass,collectionName); |
| | | |
| | | return ts; |
| | | } |
| | | |
| | | public List<T> query(Criteria sp, String collectionName, Class entityClass){ |
| | | Query query = Query.query(sp); |
| | | List<T> ts = mongoTemplate.find(query,entityClass,collectionName); |
| | | |
| | | return ts; |
| | | } |
| | | |
| | | /** |
| | | * @param sp 查询条件lambda |
| | | * @param collectionName 表名 |
| | | * @return |
| | | */ |
| | | public void delete(Supplier<Criteria> sp, String collectionName){ |
| | | Query query = Query.query(sp.get()); |
| | | mongoTemplate.remove(query, collectionName); |
| | | } |
| | | |
| | | public void delete(Criteria sp, String collectionName){ |
| | | Query query = Query.query(sp); |
| | | mongoTemplate.remove(query, collectionName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询符合条件总条数 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public long findLogCount(HashMap<String,Object> paras,Class entityClass,String collectionName) throws Exception { |
| | | Query query = new Query(); |
| | | Criteria criteria = new Criteria(); |
| | | if (null != paras ) { |
| | | Iterator<Entry<String, Object>> iterator = paras.entrySet().iterator(); |
| | | while(iterator.hasNext()) { |
| | | Entry<String, Object> entry = iterator.next(); |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | criteria.and(key).is(value); |
| | | |
| | | } |
| | | query.addCriteria(criteria); |
| | | } |
| | | long count = mongoTemplate.count(query, entityClass,collectionName); |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 查询附近的对象 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | public List<Location> geoNear(LocationQuery model){ |
| | | List<Location> resultList = new ArrayList<>(); |
| | | try{ |
| | | List<BasicDBObject> pipeLine = new ArrayList<>(); |
| | | BasicDBObject aggregate = new BasicDBObject("$geoNear", |
| | | new BasicDBObject("near" |
| | | , new BasicDBObject("type", "Point") |
| | | .append("coordinates", model.getCoordinates())) |
| | | .append("distanceField", "distance") |
| | | .append("maxDistance", model.getDistance()) |
| | | .append("spherical", true) |
| | | |
| | | ); |
| | | |
| | | pipeLine.add(aggregate); |
| | | AggregateIterable<Document> location = mongoTemplate.getCollection("location").aggregate(pipeLine); |
| | | MongoCursor<Document> cursor = location.iterator(); |
| | | |
| | | //将查询的结果,封装成对象返回出去 |
| | | while (cursor.hasNext()) { |
| | | Document document = cursor.next(); |
| | | Location node = JSONObject.parseObject(JSONObject.toJSONString(document),Location.class); |
| | | resultList.add(node); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class GeoJson { |
| | | private String type; |
| | | private Double[] coordinates; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.index.CompoundIndex; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Document(collection = "driver_location") |
| | | @CompoundIndex(name = "location_index", def = "{'location': '2dsphere'}") |
| | | public class Location implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 4508868382007529970L; |
| | | |
| | | @Id |
| | | private String id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | private Integer driverId; |
| | | /** |
| | | * x:经度 y:纬度 |
| | | */ |
| | | private GeoJsonPoint location; |
| | | /** |
| | | * 位置名称 |
| | | **/ |
| | | private String name; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Long created; |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Long updated; |
| | | /** |
| | | * 上次更新时间 |
| | | */ |
| | | private Long lastUpdated; |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class LocationQuery { |
| | | /** |
| | | * 当前经纬度[xxx,xxx] |
| | | **/ |
| | | private Double[] coordinates; |
| | | /** |
| | | * 距离,如:200,500,1,3,5,10,20 |
| | | **/ |
| | | private Double distance; |
| | | /** |
| | | * 距离单位,如:m,km |
| | | **/ |
| | | private String unit; |
| | | /** |
| | | * 位置类型:1-景点,2-加油站,3-酒店 |
| | | **/ |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class CommercialWarpper { |
| | | @ApiModelProperty("广告名称") |
| | | private String name; |
| | | @ApiModelProperty("广告类型(1=弹窗广告,2=底部广告)") |
| | | private Integer type; |
| | | @ApiModelProperty("广告地址") |
| | | private String url; |
| | | @ApiModelProperty("是否跳转(0=否,1=是)") |
| | | private Integer isJump; |
| | | @ApiModelProperty("跳转类型(1=内部跳转,2=外部跳转)") |
| | | private Integer jumpType; |
| | | @ApiModelProperty("跳转链接") |
| | | private String jumpUrl; |
| | | @ApiModelProperty("H5页面") |
| | | private String html; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/3 14:26 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class CouponWarpper { |
| | | @ApiModelProperty("满金额") |
| | | private Double couponConditionalAmount; |
| | | @ApiModelProperty("优惠金额") |
| | | private Double couponPreferentialAmount; |
| | | @ApiModelProperty("优惠券名称") |
| | | private String couponName; |
| | | @ApiModelProperty("有效期") |
| | | private Long expirationDate; |
| | | @ApiModelProperty("张数") |
| | | private Integer number; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 17:13 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EditOrderEndAddress { |
| | | @ApiModelProperty(value = "订单id", required = true, dataType = "long") |
| | | private Long orderId; |
| | | @ApiModelProperty(value = "终点纬度", dataType = "double", required = true) |
| | | private Double endLat; |
| | | @ApiModelProperty(value = "终点经度", dataType = "double", required = true) |
| | | private Double endLng; |
| | | @ApiModelProperty(value = "终点地址", dataType = "string", required = true) |
| | | private String endAddress; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/3 15:07 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EstimatedCosts { |
| | | @ApiModelProperty(value = "起点纬度", dataType = "double", required = true) |
| | | private Double startLat; |
| | | @ApiModelProperty(value = "起点经度", dataType = "double", required = true) |
| | | private Double startLng; |
| | | @ApiModelProperty(value = "起点地址", dataType = "string", required = true) |
| | | private String startAddress; |
| | | @ApiModelProperty(value = "终点纬度", dataType = "double", required = true) |
| | | private Double endLat; |
| | | @ApiModelProperty(value = "终点经度", dataType = "double", required = true) |
| | | private Double endLng; |
| | | @ApiModelProperty(value = "终点地址", dataType = "string", required = true) |
| | | private String endAddress; |
| | | @ApiModelProperty(value = "当前纬度", dataType = "double", required = true) |
| | | private Double lat; |
| | | @ApiModelProperty(value = "当前经度", dataType = "double", required = true) |
| | | private Double lng; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/3 15:20 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EstimatedCostsWarpper { |
| | | @ApiModelProperty("预估里程") |
| | | private Double estimatedMileage; |
| | | @ApiModelProperty("预估费用") |
| | | private Double price; |
| | | @ApiModelProperty("优惠金额") |
| | | private Double discountAmount; |
| | | @ApiModelProperty("接驾时间") |
| | | private Integer pickUpTime; |
| | | @ApiModelProperty("行驶时间") |
| | | private Integer travelTime; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 附近司机 |
| | | * @author pzb |
| | | * @Date 2023/2/28 10:32 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class NearbyDriverWarpper { |
| | | @ApiModelProperty("经纬度") |
| | | private String lonLat; |
| | | @ApiModelProperty("距离") |
| | | private Double distance; |
| | | @ApiModelProperty("司机id") |
| | | private Integer driverId; |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("订单详情") |
| | | public class OrderInfoWarpper { |
| | | @ApiModelProperty("订单id") |
| | | private Integer orderId; |
| | | @ApiModelProperty("1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + |
| | | "小件物流订单状态(状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价))") |
| | | private Integer orderState; |
| | | @ApiModelProperty("订单名称") |
| | | private String orderName; |
| | | @ApiModelProperty("出行时间") |
| | | private String travelTime; |
| | | @ApiModelProperty("出行时间") |
| | | private String travelTime_; |
| | | @ApiModelProperty("到达预约点时间") |
| | | private String arriveTime; |
| | | @ApiModelProperty("起点") |
| | | private Long orderId; |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | @ApiModelProperty("起点地址") |
| | | private String startAddress; |
| | | @ApiModelProperty("终点") |
| | | private String endAddress; |
| | | @ApiModelProperty("红包") |
| | | private Double tipMoney; |
| | | @ApiModelProperty("司机当前位置到起点距离(公里)") |
| | | private Double startDistance; |
| | | @ApiModelProperty("全程公里数") |
| | | private Double totalDistance; |
| | | @ApiModelProperty("起点经度") |
| | | private String startLon; |
| | | @ApiModelProperty("起点纬度") |
| | | private String startLat; |
| | | @ApiModelProperty("终点经度") |
| | | private String endLon; |
| | | @ApiModelProperty("起点经度") |
| | | private String startLng; |
| | | @ApiModelProperty("终点地址") |
| | | private String endAddress; |
| | | @ApiModelProperty("终点纬度") |
| | | private String endLat; |
| | | @ApiModelProperty("乘客昵称") |
| | | private String nickName; |
| | | @ApiModelProperty("乘客电话") |
| | | private String phone; |
| | | @ApiModelProperty("乘客历史乘车次数") |
| | | private Integer historyNum; |
| | | @ApiModelProperty("订单总金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))") |
| | | private Integer payManner; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | @ApiModelProperty("差价金额") |
| | | private Double differenceMoney; |
| | | @ApiModelProperty("是否是改派单(1=否,2=是)") |
| | | private Integer isReassign; |
| | | @ApiModelProperty("高德猎鹰轨迹id(订单开始后需要上传坐标到指定轨迹中)") |
| | | private String trackId; |
| | | @ApiModelProperty("是否是预约单(1=否,2=是)") |
| | | private Integer reservation; |
| | | @ApiModelProperty("订单类型(乘客下单,调度下单,改派,预约)") |
| | | private String type; |
| | | @ApiModelProperty("报警电话") |
| | | private String emergencyCall; |
| | | @ApiModelProperty("取消原因") |
| | | private String cancelReason; |
| | | @ApiModelProperty("取消备注") |
| | | private String cancelRemark; |
| | | @ApiModelProperty("取消支付金额") |
| | | private Double cancelPayMoney; |
| | | @ApiModelProperty("取消方") |
| | | private String cancelUser; |
| | | @ApiModelProperty("能否改派(1=否,2=是)") |
| | | private Integer reassign; |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | @ApiModelProperty("乘车人数") |
| | | private Integer peopleNumber; |
| | | @ApiModelProperty("座位号") |
| | | private String seatNumber; |
| | | @ApiModelProperty("货物类型(1=普通货物,2=贵重货物)") |
| | | private Integer cargoType; |
| | | @ApiModelProperty("是否加急(1=否,2=是)") |
| | | private Integer urgent; |
| | | @ApiModelProperty("下单用户姓名") |
| | | private String userName; |
| | | @ApiModelProperty("订单来源(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单,6:道行龙城,7:智慧屏)") |
| | | private Integer orderSource; |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getOrderState() { |
| | | return orderState; |
| | | } |
| | | |
| | | public void setOrderState(Integer orderState) { |
| | | this.orderState = orderState; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getTravelTime() { |
| | | return travelTime; |
| | | } |
| | | |
| | | public void setTravelTime(String travelTime) { |
| | | this.travelTime = travelTime; |
| | | } |
| | | |
| | | public String getStartAddress() { |
| | | return startAddress; |
| | | } |
| | | |
| | | public void setStartAddress(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | public String getEndAddress() { |
| | | return endAddress; |
| | | } |
| | | |
| | | public void setEndAddress(String endAddress) { |
| | | this.endAddress = endAddress; |
| | | } |
| | | |
| | | public Double getTipMoney() { |
| | | return tipMoney; |
| | | } |
| | | |
| | | public void setTipMoney(Double tipMoney) { |
| | | this.tipMoney = tipMoney; |
| | | } |
| | | |
| | | public Double getStartDistance() { |
| | | return startDistance; |
| | | } |
| | | |
| | | public void setStartDistance(Double startDistance) { |
| | | this.startDistance = startDistance; |
| | | } |
| | | |
| | | public Double getTotalDistance() { |
| | | return totalDistance; |
| | | } |
| | | |
| | | public void setTotalDistance(Double totalDistance) { |
| | | this.totalDistance = totalDistance; |
| | | } |
| | | |
| | | public String getStartLon() { |
| | | return startLon; |
| | | } |
| | | |
| | | public void setStartLon(String startLon) { |
| | | this.startLon = startLon; |
| | | } |
| | | |
| | | public String getStartLat() { |
| | | return startLat; |
| | | } |
| | | |
| | | public void setStartLat(String startLat) { |
| | | this.startLat = startLat; |
| | | } |
| | | |
| | | public String getEndLon() { |
| | | return endLon; |
| | | } |
| | | |
| | | public void setEndLon(String endLon) { |
| | | this.endLon = endLon; |
| | | } |
| | | |
| | | public String getEndLat() { |
| | | return endLat; |
| | | } |
| | | |
| | | public void setEndLat(String endLat) { |
| | | this.endLat = endLat; |
| | | } |
| | | |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Integer getHistoryNum() { |
| | | return historyNum; |
| | | } |
| | | |
| | | public void setHistoryNum(Integer historyNum) { |
| | | this.historyNum = historyNum; |
| | | } |
| | | |
| | | public Double getOrderMoney() { |
| | | return orderMoney; |
| | | } |
| | | |
| | | public void setOrderMoney(Double orderMoney) { |
| | | this.orderMoney = orderMoney; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | |
| | | public Double getPayMoney() { |
| | | return payMoney; |
| | | } |
| | | |
| | | public void setPayMoney(Double payMoney) { |
| | | this.payMoney = payMoney; |
| | | } |
| | | |
| | | public Integer getIsReassign() { |
| | | return isReassign; |
| | | } |
| | | |
| | | public void setIsReassign(Integer isReassign) { |
| | | this.isReassign = isReassign; |
| | | } |
| | | |
| | | public String getTrackId() { |
| | | return trackId; |
| | | } |
| | | |
| | | public void setTrackId(String trackId) { |
| | | this.trackId = trackId; |
| | | } |
| | | |
| | | public String getArriveTime() { |
| | | return arriveTime; |
| | | } |
| | | |
| | | public void setArriveTime(String arriveTime) { |
| | | this.arriveTime = arriveTime; |
| | | } |
| | | |
| | | public Integer getReservation() { |
| | | return reservation; |
| | | } |
| | | |
| | | public void setReservation(Integer reservation) { |
| | | this.reservation = reservation; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getEmergencyCall() { |
| | | return emergencyCall; |
| | | } |
| | | |
| | | public void setEmergencyCall(String emergencyCall) { |
| | | this.emergencyCall = emergencyCall; |
| | | } |
| | | |
| | | public String getTravelTime_() { |
| | | return travelTime_; |
| | | } |
| | | |
| | | public void setTravelTime_(String travelTime_) { |
| | | this.travelTime_ = travelTime_; |
| | | } |
| | | |
| | | public String getCancelReason() { |
| | | return cancelReason; |
| | | } |
| | | |
| | | public void setCancelReason(String cancelReason) { |
| | | this.cancelReason = cancelReason; |
| | | } |
| | | |
| | | public String getCancelRemark() { |
| | | return cancelRemark; |
| | | } |
| | | |
| | | public void setCancelRemark(String cancelRemark) { |
| | | this.cancelRemark = cancelRemark; |
| | | } |
| | | |
| | | public Double getCancelPayMoney() { |
| | | return cancelPayMoney; |
| | | } |
| | | |
| | | public void setCancelPayMoney(Double cancelPayMoney) { |
| | | this.cancelPayMoney = cancelPayMoney; |
| | | } |
| | | |
| | | public String getCancelUser() { |
| | | return cancelUser; |
| | | } |
| | | |
| | | public void setCancelUser(String cancelUser) { |
| | | this.cancelUser = cancelUser; |
| | | } |
| | | |
| | | public Integer getReassign() { |
| | | return reassign; |
| | | } |
| | | |
| | | public void setReassign(Integer reassign) { |
| | | this.reassign = reassign; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public Integer getPeopleNumber() { |
| | | return peopleNumber; |
| | | } |
| | | |
| | | public void setPeopleNumber(Integer peopleNumber) { |
| | | this.peopleNumber = peopleNumber; |
| | | } |
| | | |
| | | public String getSeatNumber() { |
| | | return seatNumber; |
| | | } |
| | | |
| | | public void setSeatNumber(String seatNumber) { |
| | | this.seatNumber = seatNumber; |
| | | } |
| | | |
| | | public Integer getCargoType() { |
| | | return cargoType; |
| | | } |
| | | |
| | | public void setCargoType(Integer cargoType) { |
| | | this.cargoType = cargoType; |
| | | } |
| | | |
| | | public Integer getUrgent() { |
| | | return urgent; |
| | | } |
| | | |
| | | public void setUrgent(Integer urgent) { |
| | | this.urgent = urgent; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public Double getDifferenceMoney() { |
| | | return differenceMoney; |
| | | } |
| | | |
| | | public void setDifferenceMoney(Double differenceMoney) { |
| | | this.differenceMoney = differenceMoney; |
| | | } |
| | | |
| | | public Integer getOrderSource() { |
| | | return orderSource; |
| | | } |
| | | |
| | | public void setOrderSource(Integer orderSource) { |
| | | this.orderSource = orderSource; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderInfoWarpper{" + |
| | | "orderId=" + orderId + |
| | | ", orderState=" + orderState + |
| | | ", orderName='" + orderName + '\'' + |
| | | ", travelTime='" + travelTime + '\'' + |
| | | ", travelTime_='" + travelTime_ + '\'' + |
| | | ", arriveTime='" + arriveTime + '\'' + |
| | | ", startAddress='" + startAddress + '\'' + |
| | | ", endAddress='" + endAddress + '\'' + |
| | | ", tipMoney=" + tipMoney + |
| | | ", startDistance=" + startDistance + |
| | | ", totalDistance=" + totalDistance + |
| | | ", startLon='" + startLon + '\'' + |
| | | ", startLat='" + startLat + '\'' + |
| | | ", endLon='" + endLon + '\'' + |
| | | ", endLat='" + endLat + '\'' + |
| | | ", nickName='" + nickName + '\'' + |
| | | ", phone='" + phone + '\'' + |
| | | ", historyNum=" + historyNum + |
| | | ", orderMoney=" + orderMoney + |
| | | ", payManner=" + payManner + |
| | | ", payMoney=" + payMoney + |
| | | ", isReassign=" + isReassign + |
| | | ", trackId='" + trackId + '\'' + |
| | | ", reservation=" + reservation + |
| | | ", type='" + type + '\'' + |
| | | ", emergencyCall='" + emergencyCall + '\'' + |
| | | ", cancelReason='" + cancelReason + '\'' + |
| | | ", cancelRemark='" + cancelRemark + '\'' + |
| | | ", cancelPayMoney=" + cancelPayMoney + |
| | | ", cancelUser='" + cancelUser + '\'' + |
| | | ", reassign=" + reassign + |
| | | ", remark='" + remark + '\'' + |
| | | ", peopleNumber=" + peopleNumber + |
| | | ", seatNumber='" + seatNumber + '\'' + |
| | | ", cargoType=" + cargoType + |
| | | ", urgent=" + urgent + |
| | | '}'; |
| | | } |
| | | @ApiModelProperty("终点经度") |
| | | private String endLng; |
| | | @ApiModelProperty("司机头像") |
| | | private String driverAvatar; |
| | | @ApiModelProperty("司机名称") |
| | | private String driverName; |
| | | @ApiModelProperty("司机电话") |
| | | private String driverPhone; |
| | | @ApiModelProperty("司机编号") |
| | | private String driverCode; |
| | | @ApiModelProperty("司机驾龄") |
| | | private Integer driverAge; |
| | | @ApiModelProperty("代驾次数") |
| | | private Integer driverNumber; |
| | | @ApiModelProperty("司机评分") |
| | | private Double driverScore; |
| | | @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") |
| | | private Integer state; |
| | | |
| | | public static OrderInfoWarpper getOrderInfoWarpper(Map<String, Object> map){ |
| | | OrderInfoWarpper orderInfoWarpper = new OrderInfoWarpper(); |
| | | if(null != map){ |
| | | orderInfoWarpper.setOrderId(null != map.get("orderId") ? Integer.valueOf(String.valueOf(map.get("orderId"))) : 0); |
| | | orderInfoWarpper.setOrderState(null != map.get("orderState") ? Integer.valueOf(String.valueOf(map.get("orderState"))) : 0); |
| | | orderInfoWarpper.setOrderName(null != map.get("orderName") ? String.valueOf(map.get("orderName")) : ""); |
| | | orderInfoWarpper.setTravelTime(null != map.get("travelTime") ? String.valueOf(map.get("travelTime")) : ""); |
| | | orderInfoWarpper.setTravelTime_(null != map.get("travelTime_") ? String.valueOf(map.get("travelTime_")) : ""); |
| | | orderInfoWarpper.setArriveTime(null != map.get("arriveTime") ? String.valueOf(map.get("arriveTime")) : ""); |
| | | orderInfoWarpper.setStartAddress(null != map.get("startAddress") ? String.valueOf(map.get("startAddress")) : ""); |
| | | orderInfoWarpper.setEndAddress(null != map.get("endAddress") ? String.valueOf(map.get("endAddress")) : ""); |
| | | orderInfoWarpper.setTipMoney(null != map.get("tipMoney") ? Double.valueOf(String.valueOf(map.get("tipMoney"))) : 0); |
| | | orderInfoWarpper.setStartDistance(null != map.get("startDistance") ? Double.valueOf(String.valueOf(map.get("startDistance"))) : 0); |
| | | orderInfoWarpper.setTotalDistance(null != map.get("totalDistance") ? Double.valueOf(String.valueOf(map.get("totalDistance"))) : 0); |
| | | orderInfoWarpper.setStartLon(null != map.get("startLon") ? String.valueOf(map.get("startLon")) : ""); |
| | | orderInfoWarpper.setStartLat(null != map.get("startLat") ? String.valueOf(map.get("startLat")) : ""); |
| | | orderInfoWarpper.setEndLon(null != map.get("endLon") ? String.valueOf(map.get("endLon")) : ""); |
| | | orderInfoWarpper.setEndLat(null != map.get("endLat") ? String.valueOf(map.get("endLat")) : ""); |
| | | orderInfoWarpper.setNickName(null != map.get("nickName") ? String.valueOf(map.get("nickName")) : ""); |
| | | orderInfoWarpper.setPhone(null != map.get("telX") ? String.valueOf(map.get("telX")) : (null != map.get("phone") ? String.valueOf(map.get("phone")) : "")); |
| | | orderInfoWarpper.setHistoryNum(null != map.get("historyNum") ? Integer.valueOf(String.valueOf(map.get("historyNum"))) : 0); |
| | | orderInfoWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : 0); |
| | | orderInfoWarpper.setPayManner(null != map.get("payManner") ? Integer.valueOf(String.valueOf(map.get("payManner"))) : 0); |
| | | orderInfoWarpper.setPayMoney(null != map.get("payMoney") ? Double.valueOf(String.valueOf(map.get("payMoney"))) : 0); |
| | | orderInfoWarpper.setIsReassign(null != map.get("isReassign") ? Integer.valueOf(String.valueOf(map.get("isReassign"))) : 1); |
| | | orderInfoWarpper.setTrackId(null != map.get("trackId") ? String.valueOf(map.get("trackId")) : ""); |
| | | orderInfoWarpper.setReservation(null != map.get("reservation") ? Integer.valueOf(String.valueOf(map.get("reservation"))) : 0); |
| | | orderInfoWarpper.setType(null != map.get("type") ? String.valueOf(map.get("type")) : ""); |
| | | orderInfoWarpper.setEmergencyCall(null != map.get("emergencyCall") ? String.valueOf(map.get("emergencyCall")) : ""); |
| | | orderInfoWarpper.setCancelReason(null != map.get("cancelReason") ? String.valueOf(map.get("cancelReason")) : ""); |
| | | orderInfoWarpper.setCancelRemark(null != map.get("cancelRemark") ? String.valueOf(map.get("cancelRemark")) : ""); |
| | | orderInfoWarpper.setCancelPayMoney(null != map.get("cancelPayMoney") ? Double.valueOf(String.valueOf(map.get("cancelPayMoney"))) : 0); |
| | | orderInfoWarpper.setCancelUser(null != map.get("cancelUser") ? String.valueOf(map.get("cancelUser")) : ""); |
| | | orderInfoWarpper.setReassign(null != map.get("reassign") ? Integer.valueOf(String.valueOf(map.get("reassign"))) : 1); |
| | | orderInfoWarpper.setPeopleNumber(null != map.get("peopleNumber") ? Integer.valueOf(String.valueOf(map.get("peopleNumber"))) : 1); |
| | | orderInfoWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); |
| | | orderInfoWarpper.setSeatNumber(null != map.get("seatNumber") ? String.valueOf(map.get("seatNumber")) : ""); |
| | | orderInfoWarpper.setCargoType(null != map.get("cargoType") ? Integer.valueOf(map.get("cargoType").toString()) : 0); |
| | | orderInfoWarpper.setUrgent(null != map.get("urgent") ? Integer.valueOf(map.get("urgent").toString()) : 0); |
| | | orderInfoWarpper.setUserName(null != map.get("userName") ? String.valueOf(map.get("userName")) : ""); |
| | | orderInfoWarpper.setDifferenceMoney(null != map.get("differenceMoney") ? Double.valueOf(map.get("differenceMoney").toString()) : 0D); |
| | | orderInfoWarpper.setOrderSource(null != map.get("orderSource") ? Integer.valueOf(map.get("orderSource").toString()) : 0); |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/10 10:50 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class OrderPayment { |
| | | @ApiModelProperty(value = "订单id", required = true, dataType = "Long") |
| | | private Long orderId; |
| | | @ApiModelProperty(value = "支付方式(1=微信,2=余额,3=线下,4=微信+余额)", required = true, dataType = "int") |
| | | private Integer payType; |
| | | @ApiModelProperty(value = "优惠券id", required = false, dataType = "int") |
| | | private Integer couponId; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/10 9:06 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class OrderPriceWarpper { |
| | | @ApiModelProperty("订单金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("总行驶里程") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("总行驶时间") |
| | | private Integer travelTime; |
| | | @ApiModelProperty("起步里程") |
| | | private Double startDistance; |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("超过起步里程") |
| | | private Double overDriveDistance; |
| | | @ApiModelProperty("超过起步里程费") |
| | | private Double overDrivePrice; |
| | | @ApiModelProperty("长途里程") |
| | | private Double longDistance; |
| | | @ApiModelProperty("长途费") |
| | | private Double longDistancePrice; |
| | | @ApiModelProperty("超过长途里程") |
| | | private Double overLongDistance; |
| | | @ApiModelProperty("超过长途里程费") |
| | | private Double overLongDistancePrice; |
| | | @ApiModelProperty("等待时长") |
| | | private Integer waitTime; |
| | | @ApiModelProperty("等待费") |
| | | private Double waitTimePrice; |
| | | @ApiModelProperty("超出等待时长") |
| | | private Integer outWaitTime; |
| | | @ApiModelProperty("超出等待费") |
| | | private Double outWaitTimePrice; |
| | | @ApiModelProperty("恶劣天气里程") |
| | | private Double badWeatherDistance; |
| | | @ApiModelProperty("恶劣天气费") |
| | | private Double badWeatherPrice; |
| | | @ApiModelProperty("恶劣天气超出里程") |
| | | private Double overBadWeatherDistance; |
| | | @ApiModelProperty("恶劣天气超出里程费") |
| | | private Double overBadWeatherPrice; |
| | | @ApiModelProperty("折扣") |
| | | private Double discount; |
| | | @ApiModelProperty("折扣金额") |
| | | private Double discountAmount; |
| | | @ApiModelProperty("优惠券金额") |
| | | private Double discountedPrice; |
| | | @ApiModelProperty("当前余额") |
| | | private Double balance; |
| | | @ApiModelProperty("支付途径(1=微信支付,2=余额支付,3=线下付款,4=微信+余额)") |
| | | private Integer payType; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/3 14:25 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class SignInToRegisterWarpper { |
| | | @ApiModelProperty("token") |
| | | private String token; |
| | | @ApiModelProperty("优惠券列表") |
| | | private List<CouponWarpper> coupons; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel |
| | | public class StartPriceWarpper { |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("起步公里") |
| | | private Double startDistance; |
| | | @ApiModelProperty("超出起步里程单价") |
| | | private Double excessMileageUnitPrice; |
| | | @ApiModelProperty("超出起步里程计算距离") |
| | | private Double overmileage; |
| | | @ApiModelProperty("起步价说明") |
| | | private String description; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/3 14:57 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class TravelOrder { |
| | | @ApiModelProperty(value = "起点纬度", dataType = "double", required = true) |
| | | private Double startLat; |
| | | @ApiModelProperty(value = "起点经度", dataType = "double", required = true) |
| | | private Double startLng; |
| | | @ApiModelProperty(value = "起点地址", dataType = "string", required = true) |
| | | private String startAddress; |
| | | @ApiModelProperty(value = "终点纬度", dataType = "double", required = false) |
| | | private Double endLat; |
| | | @ApiModelProperty(value = "终点经度", dataType = "double", required = false) |
| | | private Double endLng; |
| | | @ApiModelProperty(value = "终点地址", dataType = "string", required = false) |
| | | private String endAddress; |
| | | @ApiModelProperty(value = "司机数量", dataType = "int", required = true) |
| | | private Integer driverNum; |
| | | @ApiModelProperty(value = "乘车人姓名", dataType = "string", required = false) |
| | | private String userName; |
| | | @ApiModelProperty(value = "乘车人电话", dataType = "string", required = false) |
| | | private String userPhone; |
| | | @ApiModelProperty(value = "司机id", dataType = "int", required = false) |
| | | private Integer driverId; |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/10 10:11 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class UserInfoWarpper { |
| | | @ApiModelProperty("用户id") |
| | | private Integer id; |
| | | @ApiModelProperty("头像") |
| | | private String avatar; |
| | | @ApiModelProperty("昵称") |
| | | private String nickname; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("账户余额") |
| | | private Double accountBalance; |
| | | @ApiModelProperty("紧急联系人") |
| | | private String emergencyContact; |
| | | @ApiModelProperty("紧急人电话") |
| | | private String emergencyPhone; |
| | | } |
| | |
| | | configuration: |
| | | configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 |
| | | mapper-locations: classpath*:com/supersavedriving/user/modular/system/dao/**/*.xml |
| | | |
| | | |
| | | |
| | |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: wx36c966d381cd5d62 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: cf4b21c7175356f41fa3c426f26c20e4 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: #小程序APPid |
| | | appletsAppSecret: # |
| | | mchId: 1593080081 #微信支付分配的商户号 |
| | | key: JnhREmZwHNKyFUQPEhijp1gdaCUzKg8P #key为商户平台设置的密钥key: |
| | | appid: 11 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 11 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: wx8ae6c610563f2fe6 #小程序APPid |
| | | appletsAppSecret: 8b2c93b0be4f017350050f1e660680fe # |
| | | officialAccountAppid: 11111 |
| | | officialAccountAppSecret: 1111 |
| | | webAppId: 111 |
| | | webAppSecret: 11 |
| | | mchId: 1636941942 #微信支付分配的商户号 |
| | | key: Eri2GR2SB3b6iIhaoD7k3KQ8X0wf1Ybh #key为商户平台设置的密钥key: |
| | | |
| | | --- |
| | | |
| | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://okyueche.com:443/driver |
| | | callbackPath: https://okyueche.com:443/user |
| | | #正式测试环境 |
| | | #callbackPath: http://39.108.148.228:80/driver |
| | | #callbackPath: http://39.108.148.228:80/user |
| | | |
| | | --- |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
| | | |
| | | spring: |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://127.0.0.1:27017/admin |
New file |
| | |
| | | /* |
| | | Navicat Premium Data Transfer |
| | | |
| | | Source Server : localhost |
| | | Source Server Type : MySQL |
| | | Source Server Version : 50719 |
| | | Source Host : localhost:3306 |
| | | Source Schema : guns |
| | | |
| | | Target Server Type : MySQL |
| | | Target Server Version : 50719 |
| | | File Encoding : 65001 |
| | | |
| | | Date: 10/07/2018 14:09:19 |
| | | */ |
| | | |
| | | DROP DATABASE IF EXISTS guns_test; |
| | | CREATE DATABASE IF NOT EXISTS guns_test DEFAULT CHARSET utf8 COLLATE utf8_general_ci; |
| | | |
| | | use guns_test; |
| | | |
| | | SET NAMES utf8mb4; |
| | | SET FOREIGN_KEY_CHECKS = 0; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for test |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `test`; |
| | | CREATE TABLE `test` ( |
| | | `aaa` int(11) NOT NULL AUTO_INCREMENT, |
| | | `bbb` varchar(255) DEFAULT NULL, |
| | | PRIMARY KEY (`aaa`) USING BTREE |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; |
| | | |
| | | SET FOREIGN_KEY_CHECKS = 1; |