| | |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | 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.service.*; |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserActivityDiscount1Mapper userActivityDiscount1Mapper; |
| | | @Autowired |
| | | private IPaymentRecordService paymentRecordService; |
| | | |
| | |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | | Integer i = this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId", uid).eq("isDelete", 1)); |
| | | Map<String, Double> map = price.getData(); |
| | | Map<String, Object> map = price.getData(); |
| | | map.put("first", i.doubleValue()); |
| | | return price; |
| | | } |
| | |
| | | String[] split = endLonLat.split(","); |
| | | Double lng = Double.valueOf(split[0]); |
| | | Double lat = Double.valueOf(split[1]); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, startLonLat.split(",")[0], startLonLat.split(",")[1], lng.toString(), lat.toString(), language); |
| | | if(price.getCode() == 200 && type == 5){ |
| | | Map<String, Double> data = price.getData(); |
| | | data.put("ordinary", data.get("ordinary") * number); |
| | | data.put("precious", data.get("precious") * number); |
| | | Map<String, Object> data = price.getData(); |
| | | Double ordinary = Double.valueOf(data.get("ordinary").toString()); |
| | | Double precious = Double.valueOf(data.get("precious").toString()); |
| | | Double discount = Double.valueOf(data.get("discount").toString()); |
| | | Double discountMoney = Double.valueOf(data.get("discountMoney").toString()); |
| | | Integer activityId = Integer.valueOf(data.get("activityId").toString()); |
| | | data.put("ordinary", ordinary * number); |
| | | data.put("precious", precious * number); |
| | | } |
| | | if(price.getCode() == 200){ |
| | | Map<String, Object> data = price.getData(); |
| | | Double ordinary = Double.valueOf(data.get("ordinary").toString()); |
| | | Double precious = Double.valueOf(data.get("precious").toString()); |
| | | Double discount = Double.valueOf(data.get("discount").toString()); |
| | | Double discountMoney = Double.valueOf(data.get("discountMoney").toString()); |
| | | Integer activityId = Integer.valueOf(data.get("activityId").toString()); |
| | | data.put("ordinary", ordinary - discountMoney); |
| | | data.put("precious", precious - discountMoney); |
| | | } |
| | | return price; |
| | | } |
| | |
| | | orderLogistics.setMileage(0D); |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setReassignNotice(0); |
| | | ResultUtil<Map<String, Double>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language); |
| | | ResultUtil<Map<String, Object>> price = this.getPrice1(type, String.valueOf(startLon), String.valueOf(startLat), lng.toString(), lat.toString(), language); |
| | | if(price.getCode() != 200){ |
| | | return price; |
| | | } |
| | | Map<String, Double> data = price.getData(); |
| | | orderLogistics.setOrderMoney((cargoType == 1 ? data.get("ordinary") : data.get("precious")) + tipMoney); |
| | | orderLogistics.setTravelMoney(cargoType == 1 ? data.get("ordinary") : data.get("precious")); |
| | | Map<String, Object> data = price.getData(); |
| | | Double ordinary = Double.valueOf(data.get("ordinary").toString()); |
| | | Double precious = Double.valueOf(data.get("precious").toString()); |
| | | Double discount = Double.valueOf(data.get("discount").toString()); |
| | | Double discountMoney = Double.valueOf(data.get("discountMoney").toString()); |
| | | Integer activityId = Integer.valueOf(data.get("activityId").toString()); |
| | | orderLogistics.setOrderMoney((cargoType == 1 ? ordinary : precious) + tipMoney); |
| | | orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious)); |
| | | if(type == 5){ |
| | | orderLogistics.setOrderMoney(((cargoType == 1 ? data.get("ordinary") : data.get("precious")) * cargoNumber) + tipMoney); |
| | | orderLogistics.setTravelMoney((cargoType == 1 ? data.get("ordinary") : data.get("precious")) * cargoNumber); |
| | | orderLogistics.setOrderMoney(((cargoType == 1 ? ordinary : precious) * cargoNumber) + tipMoney); |
| | | orderLogistics.setTravelMoney((cargoType == 1 ? ordinary : precious) * cargoNumber); |
| | | } |
| | | orderLogistics.setDiscount(discount); |
| | | orderLogistics.setDiscountMoney(discountMoney); |
| | | orderLogistics.setActivityId(activityId); |
| | | orderLogistics.setTipMoney(tipMoney); |
| | | orderLogistics.setState(7);//待支付 |
| | | orderLogistics.setInsertTime(new Date()); |
| | |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您的市内包裹订单已下单成功,我们正在为您指派司机,请稍后!" : |
| | | language == 2 ? "You've placed the package order successfully, we are assigning you a driver, please wait." |
| | | : "Vous avez passé la commande de colis avec succès, nous vous attribuons un chauffeur, veuillez patienter.", orderLogistics.getUserId(), 1); |
| | | language == 2 ? "You've placed the delivery order successfully, we are assigning you a driver, please wait." |
| | | : "Vous avez passé la commande de livraison avec succès, nous vous attribuons un chauffeur, veuillez patienter.", orderLogistics.getUserId(), 1); |
| | | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setId(orderLogistics.getId()); |
| | |
| | | |
| | | |
| | | |
| | | public ResultUtil<Map<String, Double>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{ |
| | | public ResultUtil<Map<String, Object>> getPrice1(Integer type, String startLon, String startLat, String endLon, String endLat, Integer language) throws Exception{ |
| | | Company query = companyCityService.query1(startLon, startLat); |
| | | if(null == query){ |
| | | return ResultUtil.error(language == 1 ? "预约取货点暂无企业服务" : language == 2 ? |
| | |
| | | } |
| | | Double price1 = 0D; |
| | | Double price2 = 0D; |
| | | Double discount = null; |
| | | Double discountMoney = 0D; |
| | | Integer activityId = null; |
| | | if(type == 4){//同城 |
| | | Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(Double.valueOf(startLat), Double.valueOf(startLon), Double.valueOf(endLat), Double.valueOf(endLon)); |
| | |
| | | price1 = jsonObject.getDouble("num1"); |
| | | price2 = jsonObject.getDouble("num2"); |
| | | } |
| | | Map<String, Double> map = new HashMap<>(); |
| | | |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(query.getId()); |
| | | if(null != query2){ |
| | | activityId = query2.getId(); |
| | | discount = query2.getLogistics(); |
| | | if(null != discount){ |
| | | discountMoney = new BigDecimal(price1).multiply(new BigDecimal(discount / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ordinary", price1);//普通 |
| | | map.put("precious", price2);//贵重 |
| | | map.put("discount", discount);//折扣 |
| | | map.put("discountMoney", discountMoney);//折扣金额 |
| | | map.put("activityId", activityId);//折扣活动id |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId, Integer type, Integer language) throws Exception { |
| | | public ResultUtil payLogisticsOrder(Integer payType, Integer bankCardId, Integer orderId,Integer couponId, Integer type, Integer language) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 7){ |
| | | return ResultUtil.error(language == 1 ? "订单已完成支付,不允许重复支付" : language == 2 ? "The order has been paid, recurring payments is not allowed." : "La commande a été payée, les paiements récurrents ne sont pas autorisés.", ""); |
| | |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | orderLogistics.setCouponMoney(0D);//初始化历史数据 |
| | | orderLogistics.setCouponId(null); |
| | | //计算优惠券 |
| | | UserCouponRecord userCouponRecord = null; |
| | | if(null != couponId){ |
| | | userCouponRecord = userCouponRecordService.selectById(couponId); |
| | | if(userCouponRecord.getCompanyId() != orderLogistics.getCompanyId()){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | | } |
| | | if(userCouponRecord.getState() == 2){ |
| | | return ResultUtil.error(language == 1 ? "优惠券已使用" : language == 2 ? "Coupon has been used." : "Le coupon a été utilisé.", ""); |
| | | } |
| | | if(userCouponRecord.getState() == 3){ |
| | | return ResultUtil.error(language == 1 ? "优惠券已过期" : language == 2 ? "Coupon is expired." : "Le coupon a expiré.", ""); |
| | | } |
| | | if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 4){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | | } |
| | | if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ |
| | | return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); |
| | | } |
| | | orderMoney = orderMoney - userCouponRecord.getMoney(); |
| | | orderLogistics.setCouponMoney(userCouponRecord.getMoney()); |
| | | orderLogistics.setCouponId(couponId); |
| | | } |
| | | //折扣 |
| | | if(null != orderLogistics.getActivityId()){ |
| | | orderMoney = orderMoney - orderLogistics.getDiscount(); |
| | | } |
| | | orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | if(payType == 1) {//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //处理优惠券 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | | userInfoService.updateById(userInfo); |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the package order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de colis avec succès, merci d’utiliser I-GO", uid, 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | | |
| | | if(payType == 4){//现金支付 |
| | | SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != userCouponRecord){ |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "包裹下单支付", orderMoney, 2, 1, 1, 4, orderId); |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the package order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de colis avec succès, merci d’utiliser I-GO", uid, 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | } |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the difference of package order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de colis avec succès, merci d’utiliser I-GO", uid, 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | } |
| | | |
| | | if(payType == 4){//现金支付 |
| | |
| | | orderLogisticsSpreadService.updateById(orderLogisticsSpread); |
| | | |
| | | //添加已收入明细 |
| | | Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney(); |
| | | BigDecimal d = null; |
| | | BigDecimal c = null; |
| | | if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | d = new BigDecimal(speMoney); |
| | | c = new BigDecimal(orderMoney).subtract(d); |
| | | } |
| | | if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | } |
| | | |
| | | Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | income.setMoney(income.getMoney() + d.doubleValue()); |
| | | incomeService.updateById(income); |
| | | income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | income.setMoney(income.getMoney() + c.doubleValue()); |
| | | incomeService.updateById(income); |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | // Company company = companyService.selectById(orderLogistics.getCompanyId()); |
| | | // Double speMoney = orderLogistics.getType() == 4 ? company.getSameLogisticsMoney() : company.getCrossLogisticsMoney(); |
| | | // BigDecimal d = BigDecimal.ZERO; |
| | | // BigDecimal c = BigDecimal.ZERO; |
| | | // if(company.getIsSpeFixedOrProportional() == 2){//固定 |
| | | // d = new BigDecimal(speMoney); |
| | | // c = new BigDecimal(orderMoney).subtract(d); |
| | | // } |
| | | // if(company.getIsSpeFixedOrProportional() == 1){//比例 |
| | | // d = new BigDecimal(orderMoney).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))); |
| | | // c = new BigDecimal(orderMoney).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | // } |
| | | // |
| | | // Income income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 1).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | // income.setMoney(income.getMoney() + d.doubleValue()); |
| | | // incomeService.updateById(income); |
| | | // income = incomeService.selectOne(new EntityWrapper<Income>().eq("userType", 2).eq("objectId", orderLogistics.getCompanyId()).eq("type", 2).eq("incomeId", orderLogistics.getId()).eq("orderType", orderLogistics.getType())); |
| | | // System.out.println("小件物流补差价income======"+income); |
| | | // income.setMoney(income.getMoney() + c.doubleValue()); |
| | | // incomeService.updateById(income); |
| | | // Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | // driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | // driverService.updateById(driver); |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the difference of package order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de colis avec succès, merci d’utiliser I-GO", uid, 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", uid, 1); |
| | | } |
| | | |
| | | |
| | |
| | | userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分 |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //处理优惠券和红包 |
| | | if(null != orderLogistics.getCouponId()){ |
| | | UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderLogistics.getCouponId()); |
| | | userCouponRecord.setState(2); |
| | | userCouponRecord.setEndTime(new Date()); |
| | | userCouponRecordService.updateById(userCouponRecord); |
| | | } |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | |
| | | |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the package order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de colis avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | ? "You've paid for the delivery order successfully, thank you for using I-GO" : |
| | | "Vous avez payé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | |
| | | this.pushOrder(orderLogistics);//推单 |
| | | }else{ |
| | |
| | | }).start(); |
| | | |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功完成包裹订单差价支付,谢谢使用!" : language == 2 |
| | | ? "You've paid for the difference of package order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de colis avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | ? "You've paid for the difference of delivery order successfully, thank you for using I-GO" |
| | | : "Vous avez payé la différence de commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |
| | |
| | | }else{ |
| | | map.put("receipt", ""); |
| | | } |
| | | if(state == 7){ |
| | | Double discountMoney = Double.valueOf(map.get("discountMoney").toString()); |
| | | Double orderMoney = Double.valueOf(map.get("orderMoney").toString()); |
| | | map.put("orderMoney", orderMoney - discountMoney); |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | |
| | | endTime = dateUtil.getStartOrEndDate(endTime, "end"); |
| | | List<Map<String, Object>> list = orderLogisticsMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid, orderType); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("orderName", language == 1 ? "包裹订单" : language == 2 ? "Delivery" : "Livraison"); |
| | | if(null != map.get("time")){ |
| | | String time = map.get("time").toString(); |
| | | map.put("time", DateUtil.conversionFormat(language, time)); |
| | |
| | | this.updateById(orderLogistics); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | //调用回退接口 |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 1, 2); |
| | | PaymentRecord query = paymentRecordService.query(1, orderLogistics.getUserId(), 1, orderLogistics.getId(), orderLogistics.getType(), 2, 2); |
| | | if(null == query){ |
| | | return ResultUtil.error("支付数据异常,无法完成退款"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String payerTransactionID = sdf.format(new Date()) + orderCancel.getId(); |
| | |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | } |
| | | |
| | | |
| | | if(null != orderLogistics.getPayType() && orderLogistics.getPayType() == 4){//现金 |
| | | // UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId()); |
| | | // userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney()); |
| | | // userInfoService.updateById(userInfo); |
| | | OrderCancel orderCancel = new OrderCancel(); |
| | | orderCancel.setOrderId(id); |
| | | orderCancel.setOrderType(orderLogistics.getType()); |
| | | orderCancel.setReason(reason); |
| | | orderCancel.setRemark(remark); |
| | | orderCancel.setState(2); |
| | | orderCancel.setInsertTime(new Date()); |
| | | orderCancel.setUserType(1); |
| | | orderCancelService.insert(orderCancel); |
| | | |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | integer = orderCancel.getId(); |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹取消退款", orderLogistics.getPayMoney(), 1, 1, 1, 4, orderLogistics.getId()); |
| | | } |
| | | |
| | | if(null != orderLogistics.getDriverId()){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the package order successfully, thank you for using I-GO " |
| | | : "Vous avez annulé la commande de colis avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO " |
| | | : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", integer); |
| | | return ResultUtil.success(map); |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | map.put("balance", userInfo.getBalance()); |
| | | map.put("coupon", 0); |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | double v = orderLogistics.getOrderMoney(); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | orderLogistics.setDiscount(special); |
| | | Double orderMoney = orderLogistics.getOrderMoney(); |
| | | v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | } |
| | | } |
| | | int i = userCouponRecordService.queryAvailable(uid, orderLogistics.getCompanyId(), 1, 4, v); |
| | | i = i + userCouponRecordService.queryAvailable(uid, orderLogistics.getCompanyId(), 1, 0, v); |
| | | map.put("coupon", i); |
| | | return map; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer language, Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 4, orderLogistics.getOrderMoney() - orderLogistics.getDiscountMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(language, uid, orderLogistics.getCompanyId(), 1, 0, orderLogistics.getOrderMoney() - orderLogistics.getDiscountMoney(), pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |