| | |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.vo.UnPayOrderVO; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.CouponsListVo; |
| | | import com.stylefeng.guns.modular.system.warpper.DriverInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.PreferentialDataVo; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | | if(type == 4){//同城 |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null); |
| | | if(null == query1){ |
| | | return ResultUtil.error("请先完善价格设定"); |
| | | } |
| | |
| | | price1 = jsonObject.getDouble("num2"); |
| | | price2 = jsonObject.getDouble("num13"); |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null); |
| | | if(null == query1){ |
| | | return ResultUtil.error("请先完善价格设定"); |
| | | } |
| | |
| | | // TODO: 2023/11/4 无法修改 |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLon + "," + startLat, location, 1); |
| | | double distance1 = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null); |
| | | if(null != query1){ |
| | | if(type == 4){ |
| | | JSONObject jsonObject = JSON.parseObject(query1.get("content").toString()); |
| | |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | | if(type == 4){//同城 |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null); |
| | | // TODO: 2023/11/4 已优化 |
| | | if(null == dist){ |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLon + "," + startLat, endLon + "," + endLat, 1); |
| | |
| | | price2 = jsonObject.getDouble("num22"); |
| | | } |
| | | }else{ |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null); |
| | | String content = String.valueOf(query1.get("content")); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | price1 = jsonObject.getDouble("num1"); |
| | |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//用专车的推单配置 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, openCity.getId());//用专车的推单配置 |
| | | for(int i = 1; i <= querys.size() + 5; i++){ |
| | | // OrderLogistics orderLogistics = orderLogisticsMapper.selectById(id); |
| | | // if (null == orderLogistics || orderLogistics.getState() > 1) { |
| | | // break; |
| | | // } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | |
| | | orderIds.remove(orderLogistics.getId()); |
| | | return; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | if (i == querys.size() + 5 && state == 1) { |
| | | orderIds.remove(orderLogistics.getId()); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | |
| | | // } |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | |
| | | this.updateById(orderLogistics); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | |
| | |
| | | orderLogisticsSpreadService.updateById(orderLogisticsSpread); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | |
| | |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | |
| | | OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //添加交易明细 |
| | |
| | | driverService.updateById(driver); |
| | | systemNoticeService.addSystemNotice(1, "您已使用" + (payType == 1 ? "微信" : (payType==2?"支付宝":"云闪付")) + "成功完成感谢费支付,谢谢使用!", userInfo.getId(), 1); |
| | | } |
| | | |
| | | @Override |
| | | public List<UnPayOrderVO> getUnpayLogisticsOrders(Integer uid) { |
| | | EntityWrapper<OrderLogistics> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("userId", uid); |
| | | wrapper.eq("state", 7); |
| | | List<OrderLogistics> orderLogisticsList = this.selectList(wrapper); |
| | | List<UnPayOrderVO> unPayOrderVOList = new ArrayList<>(); |
| | | for (OrderLogistics orderLogistics:orderLogisticsList) { |
| | | |
| | | UnPayOrderVO unPayOrderVO = new UnPayOrderVO(); |
| | | //添加司机信息 |
| | | DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper(); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | BeanUtils.copyProperties(driver, driverInfoWarpper); unPayOrderVO.setDriverInfoWarpper(driverInfoWarpper); |
| | | //其余信息 |
| | | BeanUtils.copyProperties(orderLogistics, unPayOrderVO); |
| | | unPayOrderVOList.add(unPayOrderVO); |
| | | |
| | | } |
| | | return unPayOrderVOList; |
| | | |
| | | } |
| | | } |