| | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Autowired |
| | | private IAppOperationLogService appOperationLogService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | // } |
| | | // System.out.println(map); |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | appOperationLogService.addAppOperationLog(orderPrivateCar.getDriverId(), "{\"type\":\"司机抢单成功\",\"orderId\":\"" + orderPrivateCar.getId() + "\",\"orderInfo\":\"" + JSON.toJSONString(orderPrivateCar) + "\"}"); |
| | | //如果是预约单,则不修改司机为服务中 |
| | | if(orderPrivateCar.getOrderType() != 2 || (orderPrivateCar.getOrderType() == 2 && orderPrivateCar.getTravelTime().getTime() < System.currentTimeMillis() + 600000)){ |
| | | //修改司机为服务中 |
| | |
| | | /*if(state==5 && orderPrivateCar.getState()!=4){ |
| | | return ResultUtil.error("当前订单不能开始服务"); |
| | | }*/ |
| | | String stateName = ""; |
| | | switch (state){ |
| | | case 3://出发前往预约点 |
| | | // 判断是否有其他未完成的单子 |
| | |
| | | orderPrivateCar.setState(3); |
| | | orderPrivateCar.setSetOutTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderPrivateCar.getUserId()); |
| | | stateName = "出发前往预约点"; |
| | | break; |
| | | case 4://到达预约点,等待客户上车 |
| | | orderPrivateCar.setState(4); |
| | | orderPrivateCar.setArriveTime(new Date()); |
| | | systemNoticeService.addSystemNotice(1, "司机已到达您设置的预约地点,请及时上车", orderPrivateCar.getUserId()); |
| | | stateName = "到达预约点,等待客户上车"; |
| | | break; |
| | | case 5://开始服务 |
| | | orderPrivateCar.setBoardingLon(lon); |
| | |
| | | orderPrivateCar.setStartServiceTime(new Date()); |
| | | |
| | | pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位 |
| | | |
| | | stateName = "开始服务"; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | orderPrivateCar.setGetoffAddress(address); |
| | | orderPrivateCar.setGetoffTime(new Date()); |
| | | orderPrivateCar.setEndServiceTime(new Date()); |
| | | |
| | | stateName = "结束服务"; |
| | | // 结束服务时查询轨迹,计算距离 |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | double sum = 0; |
| | |
| | | break; |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | appOperationLogService.addAppOperationLog(orderPrivateCar.getDriverId(), "{\"type\":\"司机操作订单," + stateName + "\",\"orderId\":\"" + orderPrivateCar.getId() + "\",\"orderInfo\":\"" + JSON.toJSONString(orderPrivateCar) + "\"}"); |
| | | // TODO: 2020/6/5 推送状态 |
| | | OrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | | new Thread(new Runnable() { |
| | |
| | | // } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | |
| | | appOperationLogService.addAppOperationLog(orderPrivateCar.getDriverId(), "{\"type\":\"司机确认费用\",\"orderId\":\"" + orderPrivateCar.getId() + "\",\"orderInfo\":\"" + JSON.toJSONString(orderPrivateCar) + "\"}"); |
| | | pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据 |
| | | systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId()); |
| | | |
| | |
| | | orderPrivateCar.setPriceAuditState(1); |
| | | orderPrivateCar.setState(6); |
| | | this.updateById(orderPrivateCar); |
| | | appOperationLogService.addAppOperationLog(orderPrivateCar.getDriverId(), "{\"type\":\"司机修改费用\",\"orderId\":\"" + orderPrivateCar.getId() + "\",\"orderInfo\":\"" + JSON.toJSONString(orderPrivateCar) + "\"}"); |
| | | // 推送新的价格给用户 |
| | | pushUtil.pushOrderMoney(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, updatePrice, 0); |
| | | pushUtil.pushOrderMoney(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, updatePrice, 0); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.AppOperationLog; |
| | | |
| | | public interface AppOperationLogMapper extends BaseMapper<AppOperationLog> { |
| | | } |
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.stylefeng.guns.modular.system.dao.AppOperationLogMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.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 java.util.Date; |
| | | |
| | | @TableName("t_app_operation_log") |
| | | public class AppOperationLog { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户类型 |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 操作日志 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 操作时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.AppOperationLog; |
| | | |
| | | public interface IAppOperationLogService extends IService<AppOperationLog> { |
| | | |
| | | /** |
| | | * 添加日志记录 |
| | | * @param userId |
| | | * @param content |
| | | */ |
| | | void addAppOperationLog(Integer userId, String content); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.AppOperationLogMapper; |
| | | import com.stylefeng.guns.modular.system.model.AppOperationLog; |
| | | import com.stylefeng.guns.modular.system.service.IAppOperationLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class AppOperationLogServiceImpl extends ServiceImpl<AppOperationLogMapper, AppOperationLog> implements IAppOperationLogService { |
| | | |
| | | |
| | | /** |
| | | * 添加日志记录 |
| | | * @param userId |
| | | * @param content |
| | | */ |
| | | @Override |
| | | public void addAppOperationLog(Integer userId, String content) { |
| | | AppOperationLog appOperationLog = new AppOperationLog(); |
| | | appOperationLog.setUserId(userId); |
| | | appOperationLog.setUserType(2); |
| | | appOperationLog.setContent(content); |
| | | appOperationLog.setCreateTime(new Date()); |
| | | this.insert(appOperationLog); |
| | | } |
| | | } |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (geocode!=null){ |
| | | System.err.println("数据上传--经纬度转行政区划代码"); |
| | | jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码 |
| | | }else{ |
| | | jsonObject.put("Address", 530602);//发起第行政区划代码 |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (geocode!=null){ |
| | | System.err.println("数据上传--经纬度转行政区划代码"); |
| | | jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码 |
| | | }else{ |
| | | jsonObject.put("Address", 530602);//发起第行政区划代码 |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (geocode!=null){ |
| | | System.err.println("数据上传--经纬度转行政区划代码"); |
| | | jsonObject.put("OnArea", geocode.get("provinceCode"));//发起第行政区划代码 |
| | | }else{ |
| | | jsonObject.put("OnArea", 530602);//发起第行政区划代码 |
| | |
| | | Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D; |
| | | Double Speed = 0D; |
| | | if(orderPositions != null && orderPositions.size() > 1){ |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), |
| | | orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0); |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(), |
| | | orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0); |
| | | Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D; |
| | | } |
| | | Integer state = 4; |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (geocode!=null){ |
| | | System.err.println("数据上传--经纬度转行政区划代码"); |
| | | jsonObject.put("DriverRegionCode", geocode.get("provinceCode"));//发起第行政区划代码 |
| | | }else{ |
| | | jsonObject.put("DriverRegionCode", 530602);//发起第行政区划代码 |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("-----------------------------驾驶员定位信息------------------------:" + result); |
| | | } |
| | | |
| | | |
| | |
| | | Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D; |
| | | Double Speed = 0D; |
| | | if(orderPositions != null && orderPositions.size() > 1){ |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), |
| | | orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0); |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(), |
| | | orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0); |
| | | Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D; |
| | | } |
| | | Integer state = 4; |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (geocode!=null){ |
| | | System.err.println("数据上传--经纬度转行政区划代码"); |
| | | jsonObject.put("VehicleRegionCode", geocode.get("provinceCode"));//发起第行政区划代码 |
| | | }else{ |
| | | jsonObject.put("VehicleRegionCode", 530602);//发起第行政区划代码 |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("----------------------------车辆定位信息---------------------------:" + result); |
| | | } |
| | | |
| | | |
| | |
| | | public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat){ |
| | | try { |
| | | ResultUtil<BaseWarpper> baseWarpperResultUtil = orderService.queryExpectedTime(slon, slat, elon, elat); |
| | | System.err.println(baseWarpperResultUtil); |
| | | System.err.println(baseWarpperResultUtil.getData()); |
| | | return orderService.queryExpectedTime(slon, slat, elon, elat); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | Integer uid = orderPrivateCar.getUserId(); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | System.out.println("=========================订单金额====================="+orderMoney); |
| | | if(Objects.nonNull(orderPrivateCar.getPaymentAdvanceMoney()) && orderPrivateCar.getPaymentAdvanceMoney() > 0){ |
| | | double couponMoney1 = Objects.nonNull(orderPrivateCar.getCouponMoney()) ? orderPrivateCar.getCouponMoney() : 0.00; |
| | | orderMoney = orderMoney - orderPrivateCar.getPaymentAdvanceMoney() - couponMoney1; |
| | | System.out.println("=========================减去先付后金额====================="+orderMoney); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new HashMap<>()); |
| | |
| | | driver.setLat(Double.parseDouble(value.split(",")[1])); |
| | | driver.setDistance(d); |
| | | }else { |
| | | System.err.println(driver.getName() + "------没有上传经纬度------"); |
| | | iterator.remove(); |
| | | } |
| | | } |
| | |
| | | if(ToolUtil.isNotEmpty(sb.toString())){ |
| | | list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | } |
| | | System.err.println("坐标:" + sb); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | record.put("tpContent", param); |
| | | records.add(record); |
| | | SMSUtil.sendSmsTp(96596L, records); |
| | | System.out.println(sms); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | String url = "https://restapi.amap.com/v4/geofence/meta?key=" + key + "&gid=" + gid; |
| | | String s = restTemplate.patchForObject(url, formEntity, String.class); |
| | | System.out.println(s); |
| | | |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "更新电子围栏"); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | System.out.println("检测:" + forObject); |
| | | |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/status", "电子围栏监控"); |
| | | return ids; |
| | |
| | | */ |
| | | public boolean deleteElectricFenc(String gid){ |
| | | restTemplate.delete("https://restapi.amap.com/v4/geofence/meta?key={1}&gid={2}", key, gid); |
| | | System.out.println("删除:" ); |
| | | |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "删除电子围栏"); |
| | | |
| | |
| | | public Map<String, String> getDistance(String origins, String destination, Integer type){ |
| | | String url = "https://restapi.amap.com/v3/distance?key=" + key + "&origins=" + origins + "&destination=" + destination + |
| | | "&type=" + type; |
| | | System.out.println(url); |
| | | String forObject = restTemplate.getForObject(url, String.class); |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | String status = jsonObject.getString("status"); |
| | |
| | | public HttpResult pushHttpRequset(String mothed, String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ |
| | | String randome = UUID.randomUUID().toString(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:S"); |
| | | System.err.println(sdf.format(new Date()) + "----(" + randome + ")请求参数:" + JSON.toJSONString(params)); |
| | | CloseableHttpResponse httpResponse = null; |
| | | switch (mothed){ |
| | | case "GET": |
| | |
| | | } |
| | | int statusCode = httpResponse.getStatusLine().getStatusCode(); |
| | | String content = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); |
| | | System.err.println(sdf.format(new Date()) + "----(" + randome + ")返回结果:" + content); |
| | | HttpResult httpResult = HttpResult.getHttpResult(statusCode, content); |
| | | this.close(httpResponse); |
| | | return httpResult; |
| | |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | System.out.println(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(response.getBody()); |
| | | } catch (AlipayApiException e ) { |
| | | e.printStackTrace(); |
| | |
| | | */ |
| | | public String getValue(String key){ |
| | | if(ToolUtil.isNotEmpty(key)){ |
| | | System.err.println("查询缓存:" + key); |
| | | Object o = redisTemplate.opsForValue().get(key); |
| | | System.err.println(o); |
| | | return (String) o; |
| | | } |
| | | return null; |