| | |
| | | }) |
| | | public ResponseWarpper<String> uploadImg(MultipartFile file){ |
| | | try { |
| | | if(null == file){ |
| | | return ResponseWarpper.success(ResultUtil.error("请上传有效的图片")); |
| | | } |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name = file.getOriginalFilename(); |
| | | name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); |
| | |
| | | String appid = req.getParameter("appid"); |
| | | String sign = req.getParameter("sign"); |
| | | ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); |
| | | if (resultUtil.getCode() != 200) { |
| | | if (resultUtil.getCode() != 10000) { |
| | | res.setStatus(HttpStatus.OK.value()); |
| | | res.setHeader("Content-type", "text/html;charset=UTF-8"); |
| | | res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") |
| | |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String outDetailNo = sdf.format(new Date()) + cashWithdrawal.getId(); |
| | | String s = payMoneyUtil.weixinTransferMoney(outDetailNo, money, driver.getOpenid(), driver.getName(), "【芳华代驾】提现付款!"); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | return ResultUtil.error("提现异常,请联系管理员"); |
| | | } |
| | | cashWithdrawal.setState(2); |
| | | cashWithdrawal.setOrderNumber(s); |
| | | this.updateById(cashWithdrawal); |
| | | // TODO: 2023/6/5 暂未开通 |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | // String outDetailNo = sdf.format(new Date()) + cashWithdrawal.getId(); |
| | | // String s = payMoneyUtil.weixinTransferMoney(outDetailNo, money, driver.getOpenid(), driver.getName(), "【芳华代驾】提现付款!"); |
| | | // if(ToolUtil.isEmpty(s)){ |
| | | // return ResultUtil.error("提现异常,请联系管理员"); |
| | | // } |
| | | // cashWithdrawal.setState(2); |
| | | // cashWithdrawal.setOrderNumber(s); |
| | | // this.updateById(cashWithdrawal); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | if(null != driver && driver.getApprovalStatus() == 2){ |
| | | return ResultUtil.error("该手机账号已审核通过,请直接登录。"); |
| | | } |
| | | // String idcardFront = driverRegisterWarpper.getIdcardFront(); |
| | | // MultipartFile file = MultipartFileUtil.fileToMultipartFile(new File(idcardFront)); |
| | | // JSONObject certificate = OCRUtil.certificate(2, file); |
| | | // if(null == certificate){ |
| | | // return ResultUtil.error("身份证识别失败"); |
| | | // } |
| | | // String idcode = certificate.getString("公民身份号码"); |
| | | // driver.setIdcard(idcode); |
| | | // |
| | | // |
| | | // String driverLicense = driverRegisterWarpper.getDriverLicense(); |
| | | // file = MultipartFileUtil.fileToMultipartFile(new File(driverLicense)); |
| | | // certificate = OCRUtil.certificate(5, file); |
| | | // if(null == certificate){ |
| | | // return ResultUtil.error("驾驶证识别失败"); |
| | | // } |
| | | // System.err.println("驾驶证:" + certificate.toString()); |
| | | // String driverLicenseNumber = certificate.getString("驾驶证号码"); |
| | | // driver.setDriverLicenseNumber(driverLicenseNumber); |
| | | // driver.setFirstCertificateTime(null); |
| | | |
| | | |
| | | //账号审核拒绝后的处理 |
| | | if(null != driver && driver.getApprovalStatus() == 3){ |
| | |
| | | } |
| | | driver.setCreateTime(new Date()); |
| | | this.insert(driver); |
| | | |
| | | //司机邀请注册奖励 |
| | | if(null != driver.getInviterId()){ |
| | | Driver driver1 = this.selectById(driver.getInviterId()); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | if(num7 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请司机注册奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | this.updateById(driver1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | |
| | | if(type == 1){ |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/driver/balanceRechargeCallback", "APP"); |
| | | if(weixinpay.getCode() != 200){ |
| | | if(weixinpay.getCode() != 10000){ |
| | | return weixinpay; |
| | | } |
| | | new Thread(new Runnable() { |
| | |
| | | } |
| | | if(type == 2){ |
| | | ResultUtil<String> alipay = payMoneyUtil.alipay("余额充值", "余额充值", out_trade_no, amount.toString(), "/base/driver/balanceRechargeCallbackAli"); |
| | | if(alipay.getCode() != 200){ |
| | | if(alipay.getCode() != 10000){ |
| | | return alipay; |
| | | } |
| | | new Thread(new Runnable() { |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order.setCreateTime(new Date()); |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | | order.setState(null == order.getDriverId() ? 101 : 102); |
| | | order.setStatus(1); |
| | | order.setCreateTime(new Date()); |
| | | this.insert(order); |
| | | driverService.updateById(driver); |
| | | //推送状态 |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | Date date = order.getCreateTime(); |
| | | |
| | | boolean b = true; |
| | | for (int i = 1; i < chargeStandard.size(); i++) {//各种时间段 |
| | |
| | | Double num8 = jsonObject1.getDouble("num8");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split[0]); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | b = false; |
| | |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num5) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num8)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num5) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num8)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", youTuiDriver.getDriverId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | |
| | | Double score = null; |
| | | Double d = null; |
| | | for (Driver driver1 : drivers) { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | //恶劣天气完成订单奖励 |
| | | Integer num8 = JSON.parseObject(systemConfig.getContent()).getInteger("num8"); |
| | | if(num8 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num8); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("恶劣天气完成订单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | if(badWeather){ |
| | | Integer num8 = JSON.parseObject(systemConfig.getContent()).getInteger("num8"); |
| | | if(num8 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num8); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("恶劣天气完成订单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | } |
| | | |
| | | driverService.updateById(driver); |
| | | |
| | | if(null == order.getUserId()){ |
| | | return; |
| | | } |
| | | //推荐用户首单完成奖励 |
| | | Integer num4 = JSON.parseObject(systemConfig.getContent()).getInteger("num4"); |
| | | if(num4 > 0){ |
| | | List<Integer> state = Arrays.asList(105); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", order.getUserId()).eq("status", 1).in("state", state)); |
| | | if(count > 1){ |
| | | return; |
| | | } |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | if(null != appUser && null != appUser.getInviterType()){ |
| | | if(appUser.getInviterType() == 1){ |
| | | return; |
| | | } |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐用户完成首单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | this.updateById(order); |
| | | |
| | | if(state == 108){//计算抽成 |
| | | if(payType == 2 && state == 108){//计算抽成 |
| | | saveRevenue(order); |
| | | } |
| | | |
| | |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", order.getUserId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | //首单积分奖励 |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig1.getContent()); |
| | | Integer num4 = jsonObject2.getInteger("num4"); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户首单积分奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | |
| | | Double payMoney = order.getPayMoney(); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | Double n = 0D; |
| | |
| | | } |
| | | //司机余额扣减抽佣金额 |
| | | if(n > 0){ |
| | | driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | MyAchievementWarpper myAchievementWarpper = new MyAchievementWarpper(); |
| | | myAchievementWarpper.setType("订单"); |
| | |
| | | } |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | myAchievementWarpper = new MyAchievementWarpper(); |
| | |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | myAchievementWarpper = new MyAchievementWarpper(); |
| | | myAchievementWarpper.setType("佣金"); |
| | |
| | | */ |
| | | @Override |
| | | public void completeCollection() { |
| | | List<Order> orders = this.selectList(new EntityWrapper<Order>().eq("state", 107).eq("status", 1).eq("payType", 3)); |
| | | List<Order> orders = this.selectList(new EntityWrapper<Order>().eq("state", 107).eq("status", 1) |
| | | .eq("payType", 3).last(" and UNIX_TIMESTAMP(getoffTime) + 120 <= UNIX_TIMESTAMP(now())")); |
| | | for (Order order : orders) { |
| | | order.setState(108); |
| | | order.setPayTime(new Date()); |
| | |
| | | return ResultUtil.success(response.getBody()); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.error("调起支付异常", ""); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | 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("attach", map.get("attach"));//存储订单id |
| | | map1.put("out_trade_no", map.get("out_trade_no")); |
| | | map1.put("attach", map.get("attach")); |
| | | map1.put("total_fee", map.get("total_fee")); |
| | | map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | | String result = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>"; |
| | |
| | | port: 8007 |
| | | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | | swagger-open: false #是否开启swagger (true/false) |
| | | kaptcha-open: false #是否开启登录时验证码 (true/false) |
| | | # file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) |
| | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | #callbackPath: https://okyueche.com:443/user |
| | | callbackPath: https://fanghuatongxing.cn:443/driver |
| | | #测试环境 |
| | | callbackPath: http://139.9.238.199:80/driver |
| | | #callbackPath: http://139.9.238.199:80/driver |
| | | |
| | | |
| | | --- |
| | |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | //import java.text.SimpleDateFormat; |
| | | //import java.util.Calendar; |
| | | //import java.util.Date; |
| | | // |
| | | // |
| | | //@RunWith(SpringRunner.class) |
| | | //@SpringBootTest |
| | |
| | | // |
| | | // @Test |
| | | // public void test() throws Exception { |
| | | // PerformanceSummaryWarpper performanceSummaryWarpper = orderService.queryPerformanceSummary(1, 1, "2023年", 3); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // Integer hour1 = 11; |
| | | // Calendar s = Calendar.getInstance(); |
| | | // s.setTime(new Date()); |
| | | // s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | // System.err.println(sdf.format(s.getTime())); |
| | | // |
| | | // Integer hour2 = 16; |
| | | // Calendar e = Calendar.getInstance(); |
| | | // e.setTime(new Date()); |
| | | // e.set(Calendar.HOUR_OF_DAY, hour1 <= hour2 ? hour2 : hour2 + 24); |
| | | // System.err.println(sdf.format(e.getTime())); |
| | | // } |
| | | //} |
| | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.model.TOrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.ITCancelOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | private ITAppUserService tAppUserService; |
| | | @Autowired |
| | | private ITCancelOrderService tCancelOrderService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getOrderTrack") |
| | | @ResponseBody |
| | | public ResultUtil getOrderTrack(Integer orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + ".json"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | } |
| | |
| | | if(f==5){ |
| | | model.addAttribute("number", "5"); |
| | | } |
| | | model.addAttribute("message","账号或密码错误!"); |
| | | model.addAttribute("tips","账号或密码错误!"); |
| | | return "/login.html"; |
| | | } |
| | | } |
| | |
| | | user.setCreatetime(new Date()); |
| | | |
| | | User objectUser = UserFactory.createUser(user); |
| | | //查找平台所属公司 |
| | | TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).orderBy("id", true).last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(company)){ |
| | | objectUser.setObjectId(company.getId()); |
| | | } |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | objectUser.setObjectId(objectId); |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | this.userService.insert(objectUser); |
| | | |
| | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | /** |
| | | * 冻结用户 |
| | |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode()); |
| | | |
| | | User user = userService.selectById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 |
| | | TCompany company = itCompanyService.selectById(user.getObjectId()); |
| | | company.setState(1); |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | // itDriverService.updateCompanyDriverState(3,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | TCompany franchisee = itCompanyService.selectById(user.getObjectId()); |
| | | franchisee.setState(1); |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | // itDriverService.updateFranchiseeDriverState(3,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.OK.getCode()); |
| | | |
| | | User user = userService.selectById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 |
| | | TCompany company = itCompanyService.selectById(user.getObjectId()); |
| | | company.setState(0); |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | // itDriverService.updateCompanyDriverState(2,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | TCompany franchisee = itCompanyService.selectById(user.getObjectId()); |
| | | franchisee.setState(0); |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | // itDriverService.updateFranchiseeDriverState(2,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | * 上传文件 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/upload") |
| | | @RequestMapping("/image") |
| | | public class UploadUtil extends BaseController { |
| | | private final static Logger log = LoggerFactory.getLogger(UploadUtil.class); |
| | | |
| | |
| | | @ApiModelProperty(value = "邀请人电话") |
| | | private String inviterPhone; |
| | | |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户姓名 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 商户电话 |
| | | */ |
| | | @TableField("merchantPhone") |
| | | private String merchantPhone; |
| | | /** |
| | | * 商户身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 是否打开下单二维码 |
| | | */ |
| | | @TableField("openOrderQRCode") |
| | | private Integer openOrderQRCode; |
| | | |
| | | public String getInviterName() { |
| | | return inviterName; |
| | |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getMerchantNumber() { |
| | | return merchantNumber; |
| | | } |
| | | |
| | | public void setMerchantNumber(String merchantNumber) { |
| | | this.merchantNumber = merchantNumber; |
| | | } |
| | | |
| | | public String getMerchantName() { |
| | | return merchantName; |
| | | } |
| | | |
| | | public void setMerchantName(String merchantName) { |
| | | this.merchantName = merchantName; |
| | | } |
| | | |
| | | public String getMerchantPhone() { |
| | | return merchantPhone; |
| | | } |
| | | |
| | | public void setMerchantPhone(String merchantPhone) { |
| | | this.merchantPhone = merchantPhone; |
| | | } |
| | | |
| | | public String getMerchantIDCode() { |
| | | return merchantIDCode; |
| | | } |
| | | |
| | | public void setMerchantIDCode(String merchantIDCode) { |
| | | this.merchantIDCode = merchantIDCode; |
| | | } |
| | | |
| | | public Integer getOpenOrderQRCode() { |
| | | return openOrderQRCode; |
| | | } |
| | | |
| | | public void setOpenOrderQRCode(Integer openOrderQRCode) { |
| | | this.openOrderQRCode = openOrderQRCode; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @Autowired |
| | | private ITDriverWorkService driverWorkService; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | public void orderDetail(Integer orderId, Model model) { |
| | | // 订单信息 |
| | | TOrder tOrder = tOrderMapper.selectById(orderId); |
| | | model.addAttribute("id",orderId); |
| | | model.addAttribute("createTime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tOrder.getCreateTime()));//下单时间 |
| | | model.addAttribute("code",tOrder.getCode());//订单编号 |
| | | model.addAttribute("source",tOrder.getSource());//订单来源 |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | tOrder.setCreateTime(new Date()); |
| | | tOrder = getOrderPrice(1, d, 0, tOrder, city); |
| | | tOrder.setState(101); |
| | | tOrder.setStatus(1); |
| | | tOrder.setCreateTime(new Date()); |
| | | this.insert(tOrder); |
| | | //推送状态 |
| | | pushOrder(tOrder); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | Date date = order.getCreateTime(); |
| | | |
| | | boolean b = true; |
| | | for (int i = 1; i < chargeStandard.size(); i++) {//各种时间段 |
| | |
| | | Double num8 = jsonObject1.getDouble("num8");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split[0]); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | b = false; |
| | |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | TDriver driver1 = driverService.selectById(youTuiDriver.getDriverId()); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | continue; |
| | | } |
| | | TDriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<TDriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | |
| | | |
| | | driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() > 0){ |
| | | List<TDriver> drivers = tDriverMapper.selectList(new EntityWrapper<TDriver>().eq("approvalStatus", 2).eq("serverStatus", 1).eq("status", 1).in("id", driverIds)); |
| | | List<TDriver> drivers = driverService.selectList(new EntityWrapper<TDriver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | continue; |
| | | } |
| | |
| | | Double score = null; |
| | | Double d = null; |
| | | for (TDriver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | TDriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<TDriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | 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){ |
| | | if(d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | |
| | | userToCoupon.setExpireCount(validCount); |
| | | userToCoupon.setValidCount(0); |
| | | } |
| | | userToCouponService.updateBatchById(collect2); |
| | | if(collect2.size() > 0){ |
| | | userToCouponService.updateBatchById(collect2); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | |
| | | <input hidden id="id" value="${id}"> |
| | | <input hidden id="startLng" value="${startLng}"> |
| | | <input hidden id="startLat" value="${startLat}"> |
| | | <input hidden id="endLng" value="${endLng}"> |
| | |
| | | </div> |
| | | @} |
| | | |
| | | @if(startLng != null){ |
| | | <hr/> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div style="background-color: gray;height: 35px;line-height: 35px"> |
| | | <label style="color: #0C0C0C">行程轨迹</label> |
| | | <div class="row" style="margin-top: 30px;"> |
| | | <div class="col-sm-4"> |
| | | <h2 class="h3Class" style="font-weight: 700;">线路轨迹</h2> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-10"> |
| | | <div class="form-horizontal" id="container" style="margin-left: 50px;width: 100%; height: 500px;"></div> |
| | | <div class="input-card" style="margin-left: 50px;"> |
| | | <h4>轨迹回放控制</h4> |
| | | <div class="input-item"> |
| | | <input type="button" class="btn" value="开始动画" id="start" onclick="startAnimation()"/> |
| | | <input type="button" class="btn" value="暂停动画" id="pause" onclick="pauseAnimation()"/> |
| | | <input type="button" class="btn" value="继续动画" id="resume" onclick="resumeAnimation()"/> |
| | | <input type="button" class="btn" value="停止动画" id="stop" onclick="stopAnimation()"/> |
| | | </div> |
| | | <div class="input-item"> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <hr/> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div id="container" ></div> |
| | | <div id="panel" ></div> |
| | | </div> |
| | | @} |
| | | </div> |
| | | |
| | | <hr/> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tOrder/tOrder.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tOrder/tOrder_info.js"></script> |
| | | |
| | | <!--<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=1d43098bcd98ab124623e7e4bcc9595e&plugin=AMap.Driving"></script>--> |
| | | <!--<script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>--> |
| | | <!--<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>--> |
| | | <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script> |
| | | <script src="https://webapi.amap.com/maps?v=1.4.15&key=86fcccf007b64ae97b01c3c982c0ef0f"></script> |
| | | <script src="https://cache.amap.com/lbs/static/addToolbar.js"></script> |
| | | <script src="https://webapi.amap.com/loader.js"></script> |
| | | |
| | | <style type="text/css"> |
| | |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | if(null != $('#startLng').val() && '' != $('#startLng').val()){ |
| | | AMapLoader.reset() // 需要把这个reset一下 |
| | | AMapLoader.load({ |
| | | "key": "1d43098bcd98ab124623e7e4bcc9595e", // 申请好的Web端开发者Key,首次调用 load 时必填 |
| | | "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 |
| | | "plugins": ['AMap.Driving'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等 |
| | | "AMapUI": { // 是否加载 AMapUI,缺省不加载 |
| | | "version": '1.1', // AMapUI 版本 |
| | | "plugins":['overlay/SimpleMarker'], // 需要加载的 AMapUI ui插件 |
| | | |
| | | var map = new AMap.Map("container", { |
| | | resizeEnable: true, |
| | | zoom: 14 |
| | | }); |
| | | |
| | | $(function() { |
| | | getTrajectory(); |
| | | }); |
| | | function getTrajectory() { |
| | | $.ajax({ |
| | | url: Feng.ctxPath + '/tOrder/getOrderTrack', |
| | | type: 'POST', |
| | | data:{ |
| | | orderDetailId: $("#id").val() |
| | | }, |
| | | "Loca":{ // 是否加载 Loca, 缺省不加载 |
| | | "version": '2.0' // Loca 版本 |
| | | }, |
| | | }).then((AMap)=>{ |
| | | //初始化地图对象,加载地图 |
| | | var map = new AMap.Map('container', { |
| | | viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', |
| | | zoom:13, //初始化地图层级 |
| | | center: [$('#startLng').val(), $('#startLat').val()] //初始化地图中心点 |
| | | }); |
| | | //构造路线导航类 |
| | | var driving = new AMap.Driving({ |
| | | map: map, |
| | | }); |
| | | // 根据起终点经纬度规划驾车导航路线 |
| | | driving.search(new AMap.LngLat($('#startLng').val(), $('#startLat').val()), new AMap.LngLat($('#endLng').val(), $('#endLat').val()), function(status, result) { |
| | | // result 即是对应的驾车导航信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult |
| | | if (status === 'complete') { |
| | | Feng.success('绘制订单路线完成') |
| | | } else { |
| | | Feng.error('获取驾车数据失败:' + result) |
| | | success: function (res) { |
| | | if(res.status == 200){ |
| | | var data = res.data; |
| | | if(data.length > 0){ |
| | | orderTrack(data); |
| | | }/*else{ |
| | | Feng.error("当前订单没有轨迹"); |
| | | }*/ |
| | | }else{ |
| | | Feng.error(res.msg); |
| | | } |
| | | }); |
| | | }).catch((e)=>{ |
| | | console.error(e); //加载错误提示 |
| | | } |
| | | }); |
| | | }else { |
| | | Feng.info('该订单未完成,无地图路线显示!') |
| | | } |
| | | |
| | | var marker, lineArr = []; |
| | | |
| | | function orderTrack(data) { |
| | | for(var i in data){ |
| | | var waypoints = []; |
| | | var lon = parseFloat(data[i].lon); |
| | | var lat = parseFloat(data[i].lat); |
| | | waypoints.push(lon); |
| | | waypoints.push(lat); |
| | | lineArr.push(waypoints); |
| | | } |
| | | |
| | | marker = new AMap.Marker({ |
| | | map: map, |
| | | position: lineArr[0], |
| | | icon: "https://webapi.amap.com/images/car.png", |
| | | offset: new AMap.Pixel(-26, -13), |
| | | autoRotation: true, |
| | | angle:-90, |
| | | }); |
| | | |
| | | // 绘制轨迹 |
| | | var polyline = new AMap.Polyline({ |
| | | map: map, |
| | | path: lineArr, |
| | | showDir:true, |
| | | strokeColor: "#28F", //线颜色 |
| | | // strokeOpacity: 1, //线透明度 |
| | | strokeWeight: 6, //线宽 |
| | | // strokeStyle: "solid" //线样式 |
| | | }); |
| | | |
| | | var passedPolyline = new AMap.Polyline({ |
| | | map: map, |
| | | // path: lineArr, |
| | | strokeColor: "#AF5", //线颜色 |
| | | // strokeOpacity: 1, //线透明度 |
| | | strokeWeight: 6, //线宽 |
| | | // strokeStyle: "solid" //线样式 |
| | | }); |
| | | |
| | | |
| | | marker.on('moving', function (e) { |
| | | passedPolyline.setPath(e.passedPath); |
| | | }); |
| | | |
| | | map.setFitView(); |
| | | } |
| | | |
| | | |
| | | function startAnimation () { |
| | | marker.moveAlong(lineArr, 200); |
| | | } |
| | | |
| | | function pauseAnimation () { |
| | | marker.pauseMove(); |
| | | } |
| | | |
| | | function resumeAnimation () { |
| | | marker.resumeMove(); |
| | | } |
| | | |
| | | function stopAnimation () { |
| | | marker.stopMove(); |
| | | } |
| | | |
| | | </script> |
| | | @} |
| | |
| | | String appid = req.getParameter("appid"); |
| | | String sign = req.getParameter("sign"); |
| | | ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); |
| | | if (resultUtil.getCode() != 200) { |
| | | if (resultUtil.getCode() != 10000) { |
| | | res.setStatus(HttpStatus.OK.value()); |
| | | res.setHeader("Content-type", "text/html;charset=UTF-8"); |
| | | res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") |
| | |
| | | */ |
| | | List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception; |
| | | |
| | | |
| | | Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city); |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order = getOrderPrice(1, d, 0, new Order(), city); |
| | | Order order1 = new Order(); |
| | | order1.setCreateTime(new Date()); |
| | | Order order = getOrderPrice(1, d, 0, order1, city); |
| | | Double estimatedPrice = order.getEstimatedPrice(); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); |
| | | if(null != coupon){ |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | Date date = order.getCreateTime(); |
| | | |
| | | boolean b = true; |
| | | for (int i = 1; i < chargeStandard.size(); i++) {//各种时间段 |
| | |
| | | Double num8 = jsonObject1.getDouble("num8");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | String[] split1 = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split1[0]); |
| | | |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | 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.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | b = false; |
| | |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num5) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num8)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num5) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num5)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num7), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num8)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | |
| | | } |
| | | return order; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Integer hour1 = 22; |
| | | Integer hour2 = 06; |
| | | |
| | | Date date = null; |
| | | try { |
| | | date = sdf.parse("2023-06-12 23:26:50"); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, 0); |
| | | s.set(Calendar.SECOND, 0); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, 0); |
| | | e.set(Calendar.SECOND, 0); |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | |
| | | } |
| | | |
| | | System.err.println("开始时间:" + sdf.format(s.getTime())); |
| | | System.err.println("结束时间:" + sdf.format(e.getTime())); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | |
| | | 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"); |
| | | Integer num6 = jsonObject.getInteger("num6"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setExplain("代驾5星好评"); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | driver.setIntegral(driver.getIntegral() + num6); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | |
| | | */ |
| | | public void saveCommission(Order order) throws Exception{ |
| | | //司机收入和代理商抽成(先分佣,后抽成) |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | |
| | | //首单积分奖励 |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig1.getContent()); |
| | | Integer num4 = jsonObject2.getInteger("num4"); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户首单积分奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | |
| | | Double payMoney = order.getPayMoney(); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | if(null != systemConfig){ |
| | |
| | | } |
| | | } |
| | | //司机订单收入 |
| | | driver = driverService.selectById(order.getDriverId()); |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(2); |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waitTime", num1 + "分钟/" + num2 + "元"); |
| | | map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟"); |
| | | map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元"); |
| | | map.put("badWeather", ""); |
| | | systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 |
| | | if(1 == num11){ |
| | | map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元"); |
| | | } |
| | | priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map)); |
| | | } |
| | | return priceRulesWarpper; |
| | |
| | | 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"));//存储的订单code |
| | | map1.put("out_trade_no", map.get("out_trade_no")); |
| | | map1.put("attach", map.get("attach"));//存储订单id |
| | | map1.put("total_fee", map.get("total_fee")); |
| | | map1.put("transaction_id", map.get("transaction_id"));//微信支付订单号 |
| | |
| | | port: 8006 |
| | | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | | swagger-open: false #是否开启swagger (true/false) |
| | | kaptcha-open: false #是否开启登录时验证码 (true/false) |
| | | # file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) |
| | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | #callbackPath: http://121.37.15.157:80/user |
| | | callbackPath: https://fanghuatongxing.cn:443/user |
| | | #正式测试环境 |
| | | callbackPath: http://139.9.238.199:80/user |
| | | #callbackPath: http://139.9.238.199:80/user |
| | | |
| | | --- |
| | | |
New file |
| | |
| | | //package com.agentdriving.user; |
| | | // |
| | | //import com.agentdriving.user.modular.system.model.Order; |
| | | //import com.agentdriving.user.modular.system.service.IOrderService; |
| | | //import org.junit.Test; |
| | | //import org.junit.runner.RunWith; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | ///** |
| | | // * @author zhibing.pu |
| | | // * @date 2023/6/8 14:36 |
| | | // */ |
| | | //@RunWith(SpringRunner.class) |
| | | //@SpringBootTest |
| | | //public class GunsApplicationTest { |
| | | // |
| | | // @Autowired |
| | | // private IOrderService orderService; |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // Order order1 = orderService.selectById(2067); |
| | | // Order order = orderService.getOrderPrice(1, 11.793, 0, order1, null); |
| | | // System.err.println(order); |
| | | // } |
| | | //} |