| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverBank; |
| | |
| | | import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.juhe.OCRUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | try { |
| | | ResultUtil resultUtil = driverService.driverRegister(driverRegisterWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/orcPhoto") |
| | | // @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister") |
| | | @ApiOperation(value = "图片识别--获取驾龄", tags = {"司机端-图片识别"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper orcPhoto(MultipartFile file){ |
| | | try { |
| | | JSONObject certificate = OCRUtil.certificate(5, file); |
| | | return ResponseWarpper.success(certificate); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | |
| | | @ApiOperation(value = "获取5公里范围内的司机", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | |
| | | }) |
| | | public ResponseWarpper<List<String>> queryDriverPosition(){ |
| | | public ResponseWarpper< HashMap<String, Object> > queryDriverPosition(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil<List<String>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | ResultUtil<HashMap<String, Object>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | |
| | | |
| | | return ResponseWarpper.success(listResultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverOrderNum") |
| | | // @ServiceLog(name = "获取5公里范围内的司机", url = "/api/driver/queryDriverPosition") |
| | | @ApiOperation(value = "司机个人信息 接单量", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "时间 2022-11-11 - 2222-00-00", name = "time", required = false, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper< HashMap<String, Object> > queryDriverOrderNum(String time){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil<HashMap<String, Object>> listResultUtil = driverService.queryDriverOrderNum(time,uid); |
| | | |
| | | |
| | | return ResponseWarpper.success(listResultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "原因", name = "cause", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "phone", name = "phone", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper transferOrder(Long orderId, String cause){ |
| | | public ResponseWarpper transferOrder(Long orderId, String cause,String phone){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause); |
| | | ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause,phone); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/config/getIndexTimeConfig") |
| | | // @ServiceLog(name = "获取转单提醒时间配置", url = "/base/config/queryTransferOrderConfig") |
| | | @ApiOperation(value = "获取首页有效时间配置", tags = {"司机端-服务中"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<String> getIndexTimeConfig(){ |
| | | try { |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | String num1 = jsonObject.getString("num1"); |
| | | String num2 = jsonObject.getString("num2"); |
| | | return ResponseWarpper.success(num1+"-"+num2); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface DriverMapper extends BaseMapper<Driver> { |
| | | int getTime(@Param("sTime") String sTime, @Param("eTime") String eTime, @Param("uid") Integer uid); |
| | | |
| | | } |
| | |
| | | <result column="merchantPhone" property="merchantPhone"/> |
| | | <result column="merchantIDCode" property="merchantIDCode"/> |
| | | </resultMap> |
| | | <select id="getTime" resultType="java.lang.Integer"> |
| | | select sum(onlineTime) from t_driver_online_time where driverId =#{uid} |
| | | <if test="sTime !=null"> |
| | | and day between #{sTime} and #{eTime} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="queryTotalAmount" resultType="double"> |
| | | select sum(amount) as amount from t_revenue where userType = 2 and userId = #{driverId} |
| | | select sum(amount) as amount from t_revenue where userType = 2 and userId = #{driverId} and type in (1,2) |
| | | </select> |
| | | |
| | | |
| | |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 驾龄 |
| | | */ |
| | | @TableField("carAge") |
| | | private Integer carAge; |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil<List<String>> queryDriverPosition(Integer uid) throws Exception; |
| | | ResultUtil<HashMap<String, Object>> queryDriverPosition(Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil microenterprise(Integer uid, String name, String number, String phone) throws Exception; |
| | | |
| | | ResultUtil<HashMap<String, Object>> queryDriverOrderNum(String time,Integer uid); |
| | | |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil transferOrder(Integer uid, Long orderId, String cause) throws Exception; |
| | | ResultUtil transferOrder(Integer uid, Long orderId, String cause,String phone) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | * 主动完成线下收款 |
| | | */ |
| | | void completeCollection(); |
| | | |
| | | } |
| | |
| | | driver.setApprovalUserId(null); |
| | | driver.setStatus(1); |
| | | driver.setSource(driverRegisterWarpper.getSource()); |
| | | driver.setName(driverRegisterWarpper.getName()); |
| | | driver.setIdcard(driverRegisterWarpper.getIdcard()); |
| | | driver.setCarAge(driverRegisterWarpper.getCarAge()); |
| | | return driver; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil<List<String>> queryDriverPosition(Integer uid) throws Exception { |
| | | public ResultUtil< HashMap<String, Object> > queryDriverPosition(Integer uid) throws Exception { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("请先上班"); |
| | |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | locations.forEach(s -> { |
| | | int i=0; |
| | | Driver driver = this.baseMapper.selectById(s.getDriverId()); |
| | | i = driver.getServerStatus(); |
| | | if(driver.getServerStatus()==2){ |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("driverId", s.getDriverId()).eq("state", 102)); |
| | | if(orders.size()>0){ |
| | | i = 3; |
| | | } |
| | | } |
| | | String value1 = redisUtil.getValue("DRIVER" + s.getDriverId()); |
| | | if(s.getDriverId().compareTo(uid) != 0 && ToolUtil.isNotEmpty(value1)){ |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()+","+i); |
| | | } |
| | | }); |
| | | } |
| | | return ResultUtil.success(list); |
| | | |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("hallOrder",1).eq("state",101)); |
| | | |
| | | map.put("driver",list); |
| | | ArrayList<String> blue = new ArrayList<>(); |
| | | orders.forEach(e-> blue.add(e.getStartLng()+","+e.getStartLat())); |
| | | |
| | | map.put("orderList",blue); |
| | | List<Order> ordersOne = orderService.selectList(new EntityWrapper<Order>().eq("state",301)); |
| | | |
| | | ArrayList<String> red = new ArrayList<>(); |
| | | ordersOne.forEach(e-> red.add(e.getStartLng()+","+e.getStartLat())); |
| | | |
| | | map.put("cancelOrder",red); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | |
| | |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil<HashMap<String, Object>> queryDriverOrderNum(String time,Integer uid) { |
| | | String sTime = null; |
| | | String eTime =null; |
| | | EntityWrapper<Order> wrapper = new EntityWrapper<>(); |
| | | EntityWrapper<AppUser> wrapperOne = new EntityWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | sTime = time.split(" - ")[0]+" 00:00:00"; |
| | | eTime = time.split(" - ")[1]+" 23:59:59"; |
| | | wrapper.between("orderTakingTime",sTime,eTime); |
| | | wrapperOne.between("createTime",sTime,eTime); |
| | | } |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(101); |
| | | objects.add(201); |
| | | objects.add(301); |
| | | objects.add(401); |
| | | wrapper.eq("driverId",uid); |
| | | wrapper.notIn("state",objects); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | int orderNum = orderService.selectCount(wrapper); |
| | | map.put("orderNum",orderNum); |
| | | // 有效时长 |
| | | int okTime = this.baseMapper.getTime(sTime,eTime,uid); |
| | | map.put("okTime",okTime); |
| | | wrapperOne.eq("inviterType",2); |
| | | wrapperOne.eq("inviterId",uid); |
| | | int userNum = appUserService.selectCount(wrapperOne); |
| | | |
| | | |
| | | map.put("userNum",userNum); |
| | | |
| | | |
| | | return ResultUtil.success(map); |
| | | } |
| | | } |
| | |
| | | } |
| | | if(type == 3){//收入 |
| | | performanceRankingWarppers = revenueService.queryDriverRank(1, time, dayType); |
| | | |
| | | // 通过司机id 去差订单的优惠金额 |
| | | for (PerformanceRankingWarpper performanceRankingWarpper : performanceRankingWarppers) { |
| | | List<Order> orders = this.baseMapper.selectList(new EntityWrapper<Order>().eq("driverId", performanceRankingWarpper.getDriverId()).isNotNull("payMoney")); |
| | | double sum = orders.stream().mapToDouble(Order::getDiscountedPrice).sum(); |
| | | double sum1 = orders.stream().mapToDouble(Order::getDiscountAmount).sum(); |
| | | performanceRankingWarpper.setAmountOfData(new BigDecimal(performanceRankingWarpper.getAmountOfData()+sum+sum1).setScale(2,RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | } |
| | | for (int i = 0; i < performanceRankingWarppers.size(); i++) { |
| | | PerformanceRankingWarpper performanceRankingWarpper = performanceRankingWarppers.get(i); |
| | |
| | | public class DriverRegisterWarpper { |
| | | @ApiModelProperty(value = "注册区域code", required = true, dataType = "string") |
| | | private String code; |
| | | @ApiModelProperty(value = "头像", required = true, dataType = "string") |
| | | @ApiModelProperty(value = "头像", required = false, dataType = "string") |
| | | private String avatar; |
| | | @ApiModelProperty(value = "手机号码", required = true, dataType = "string") |
| | | private String phone; |
| | | @ApiModelProperty(value = "紧急联系人", required = true, dataType = "string") |
| | | @ApiModelProperty(value = "紧急联系人", required = false, dataType = "string") |
| | | private String emergencyContact; |
| | | @ApiModelProperty(value = "紧急联系人电话", required = true, dataType = "string") |
| | | @ApiModelProperty(value = "紧急联系人电话", required = false, dataType = "string") |
| | | private String emergencyPhone; |
| | | @ApiModelProperty(value = "身份证正面照", required = true, dataType = "string") |
| | | private String idcardFront; |
| | |
| | | private Integer inviterId; |
| | | @ApiModelProperty(value = "注册来源(1=司机端注册,2=其他端注册)", required = true, dataType = "int") |
| | | private Integer source; |
| | | @ApiModelProperty(value = "姓名", required = true, dataType = "String") |
| | | private String name; |
| | | @ApiModelProperty(value = "身份证号码", required = true, dataType = "String") |
| | | private String idcard; |
| | | @ApiModelProperty(value = "驾龄", required = true, dataType = "int") |
| | | private Integer carAge; |
| | | } |
| | |
| | | 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.Driver; |
| | | import com.supersavedriving.user.modular.system.model.Order; |
| | | import com.supersavedriving.user.modular.system.model.Revenue; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | 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.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.Receive; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.ReceiveUser; |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IBranchOfficeService branchOfficeService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryServerPrice") |
| | | // @ServiceLog(name = "获取正在进行中的订单id", url = "/api/order/queryServerOrder") |
| | | @ApiOperation(value = "根据定位获取恶劣天气+节假日信息", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "String"), |
| | | }) |
| | | public ResponseWarpper<Integer> queryServerPrice(String lat,String lon){ |
| | | try { |
| | | Integer i =0; // 0为不能接单 1为恶劣天气 2为节假日 3为恶劣+节假日 |
| | | District geocode = MapUtil.geocode(lon, lat); |
| | | String districtCode = geocode.getDistrictCode(); |
| | | List<BranchOffice> districtCode1 = branchOfficeService.selectList(new EntityWrapper<BranchOffice>().eq("districtCode", districtCode)); |
| | | if(districtCode1.size()>0){ |
| | | BranchOffice branchOffice = districtCode1.get(0); |
| | | Integer id = branchOffice.getId(); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId", id)); |
| | | SystemConfig systemConfig9 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 9).eq("companyId", id)); |
| | | if(systemConfig!=null && systemConfig9!=null){ |
| | | String content = systemConfig.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | String num1 = jsonObject.get("num1").toString(); |
| | | String content9 = systemConfig9.getContent(); |
| | | JSONObject jsonObject9 = JSONObject.parseObject(content9); |
| | | String num9 = jsonObject9.get("num1").toString(); |
| | | if("1".equals(num1)){ |
| | | i=1; |
| | | } |
| | | if("1".equals(num9)){ |
| | | i=2; |
| | | } |
| | | if("1".equals(num1)&&"1".equals(num9)){ |
| | | i=3; |
| | | } |
| | | } |
| | | } |
| | | return ResponseWarpper.success(i); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/getEstimatedCosts") |
| | | // @ServiceLog(name = "获取预估费用", url = "/api/order/getEstimatedCosts") |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | |
| | | public interface BranchOfficeMapper extends BaseMapper<BranchOffice> { |
| | | } |
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.BranchOfficeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.BranchOffice"> |
| | | <id column="id" property="id"/> |
| | | <result column="agentId" property="agentId"/> |
| | | <result column="principal" property="principal"/> |
| | | <result column="principalPhone" property="principalPhone"/> |
| | | <result column="email" property="email"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="provinceName" property="provinceName"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="cityName" property="cityName"/> |
| | | <result column="districtCode" property="districtCode"/> |
| | | <result column="districtName" property="districtName"/> |
| | | <result column="status" property="status"/> |
| | | <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 pzb |
| | | * @Date 2023/2/3 14:13 |
| | | */ |
| | | @Data |
| | | @TableName("t_branch_office") |
| | | public class BranchOffice { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 负责人姓名 |
| | | */ |
| | | @TableField("principal") |
| | | private String principal; |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @TableField("principalPhone") |
| | | private String principalPhone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | private String email; |
| | | /** |
| | | * 代理区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 代理区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 代理区域区编号 |
| | | */ |
| | | @TableField("districtCode") |
| | | private String districtCode; |
| | | /** |
| | | * 代理区域区名称 |
| | | */ |
| | | @TableField("districtName") |
| | | private String districtName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 节假日费 |
| | | */ |
| | | @TableField("holidayPrice") |
| | | private Double holidayPrice; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 分公司接口逻辑类 |
| | | * @author pzb |
| | | * @Date 2023/2/3 14:49 |
| | | */ |
| | | public interface IBranchOfficeService extends IService<BranchOffice> { |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.BranchOfficeMapper; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | import com.supersavedriving.user.modular.system.service.IBranchOfficeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 分公司逻辑类 |
| | | * @author pzb |
| | | * @Date 2023/2/3 14:48 |
| | | */ |
| | | @Service |
| | | public class BranchOfficeServiceImpl extends ServiceImpl<BranchOfficeMapper, BranchOffice> implements IBranchOfficeService { |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | */ |
| | | 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)); |
| | | Integer driverId = order.getDriverId(); |
| | | Driver driver = driverService.selectById(driverId); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5).eq("companyId",driver.getBranchOfficeId())); |
| | | if(null == systemConfig){ |
| | | if(type == 1){//预估金额 |
| | | order.setEstimatedPrice(0D); |
| | |
| | | Double num7 = extraCost.getDouble("num7");//恶劣天气超出公里 |
| | | Double num8 = extraCost.getDouble("num8");//恶劣天气超出公里单价 X/公里 |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | Double num10 = extraCost.getDouble("num10");//节假日收费 |
| | | // Double num11 = extraCost.getDouble("num11");//恶劣天气最高收取金额 |
| | | // Double num12 = extraCost.getDouble("num12");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | |
| | | } |
| | | |
| | | //恶劣天气 |
| | | systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); |
| | | systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId",driver.getBranchOfficeId())); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 |
| | | if(1 == num11){ |
| | | boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | if(badWeather){ |
| | | // boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | // if(badWeather){ |
| | | order.setBadWeatherDistance(num5);//恶劣天气公里 |
| | | order.setBadWeatherPrice(num6);//恶劣天气费 |
| | | if(distance.compareTo(num7) > 0){ |
| | |
| | | order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //节假日 |
| | | systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 9).eq("companyId",driver.getBranchOfficeId())); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 |
| | | if(1 == num11){ |
| | | BigDecimal bigDecimal = new BigDecimal(num10); |
| | | order.setHolidayPrice(bigDecimal.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); |
| | | order.getWaitTimePrice() + order.getOutWaitTimePrice() + order.getBadWeatherPrice() + order.getOverBadWeatherPrice()+order.getHolidayPrice() - order.getDiscountAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | |
| | | if(type == 1){//预估价 |
| | | order.setEstimatedPrice(bigDecimal.doubleValue()); |
| | |
| | | order.setCouponId(null);//优惠券 |
| | | order.setDiscountAmount(0D);//折扣优惠金额 |
| | | order.setDiscount(0D);//折扣 |
| | | order.setHolidayPrice(0D); |
| | | return order; |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | District geocode = geocode("114.382485", "23.084109"); |
| | | } |
| | | } |