From 021640e69b32dbd9b88a538402671c47f280df9e Mon Sep 17 00:00:00 2001 From: luo <2855143437@qq.com> Date: 星期三, 31 一月 2024 15:50:00 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/IgoTravel into dev --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 192 ++++++++++++++++++++++++++++++------------------ 1 files changed, 120 insertions(+), 72 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index 9341e41..6ae6492 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -12,6 +12,8 @@ import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.ALiSendSms; +import com.stylefeng.guns.modular.system.util.DateUtil; +import com.stylefeng.guns.modular.system.util.EmailUtil; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.warpper.*; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; @@ -20,6 +22,7 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; @@ -246,7 +249,7 @@ phoneOperator = "GH-AIRTEL-B2C"; break; } - return driverService.registeredDriver(phoneOperator, phone, code, password, uid, type, userType, language); + return driverService.registeredDriver1(phoneOperator, phone, code, password, uid, type, userType, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -374,13 +377,24 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil<?> getEmailList(HttpServletRequest request){ + public ResultUtil<List<EmailWarpper>> getEmailList(Integer language, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } - return ResultUtil.success(emailService.selectList(new EntityWrapper<TEmail>().eq("userId",uid).eq("type",2).orderBy("createTime",false))); + List<TEmail> tEmails = emailService.selectList(new EntityWrapper<TEmail>().eq("userId", uid).eq("type", 2).orderBy("createTime", false)); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List<EmailWarpper> list = new ArrayList<>(); + for (TEmail tEmail : tEmails) { + EmailWarpper warpper = new EmailWarpper(); + BeanUtils.copyProperties(tEmail, warpper); + warpper.setCreateTime(DateUtil.conversionFormat(language, sdf.format(tEmail.getCreateTime()))); + int i = cn.hutool.core.date.DateUtil.dayOfWeek(tEmail.getCreateTime())-1; + warpper.setWeek(EmailUtil.getWeek(language,i)); + list.add(warpper); + } + return ResultUtil.success(list); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -409,12 +423,17 @@ @ApiImplicitParam(value = "保险到期时间(yyyy-MM-dd)", name = "commercialInsuranceTime", required = false, dataType = "string"), @ApiImplicitParam(value = "人车合一照片", name = "peopleAndCarsPhone", required = false, dataType = "string"), @ApiImplicitParam(value = "司机id", name = "uid", required = true, dataType = "int"), - @ApiImplicitParam(value = "车辆id", name = "carId", required = false, dataType = "int") + @ApiImplicitParam(value = "车辆id", name = "carId", required = false, dataType = "int"), + @ApiImplicitParam(value = "其他品牌", name = "otherBrand", required = false, dataType = "string"), + @ApiImplicitParam(value = "其他型号", name = "otherModel", required = false, dataType = "string") }) public ResultUtil addDriverCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicenseNumber, String drivingLicensePhoto, String drivingLicenseEndTime, - String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid, Integer carId, String peopleAndCarsPhone, Integer language){ + String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid, Integer carId, String peopleAndCarsPhone, Integer language + ,String otherBrand,String otherModel){ try { - return carService.addCar(modelId, color, licensePlate, time, drivingLicenseNumber, drivingLicensePhoto, drivingLicenseEndTime, carPhoto, insurancePhoto, commercialInsuranceTime, uid,carId, peopleAndCarsPhone, language); + return carService.addCar(modelId, color, licensePlate, + time, drivingLicenseNumber, drivingLicensePhoto, + drivingLicenseEndTime, carPhoto, insurancePhoto, commercialInsuranceTime, uid,carId, peopleAndCarsPhone, language,otherBrand,otherModel); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -1101,6 +1120,27 @@ } + @ResponseBody + @PostMapping("/api/driver/getSum") + @ApiOperation(value = "获取收入明细总额", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil getSum(HttpServletRequest request) throws Exception { + Integer uid = driverService.getUserIdFormRedis(request); + if(null == uid){ + return ResultUtil.tokenErr(); + } + List<Income> objectId = incomeService.selectList(new EntityWrapper<Income>().eq("objectId", uid)); + double sum = 0; + for (Income income : objectId) { + Double money = income.getMoney(); + sum = sum+money; + } + return ResultUtil.success(sum); + } + + /** * 获取收入明细 * @param pageNum @@ -1123,78 +1163,86 @@ return ResultUtil.tokenErr(); } List<Map<String, Object>> list = driverService.queryTotalRevenue(language, uid, pageNum, size); + List<BaseWarpper> data = new ArrayList<>(); for(Map<String, Object> map : list){ + String type = map.get("type").toString(); BaseWarpper baseWarpper = new BaseWarpper(); baseWarpper.setDay(String.valueOf(null != map.get("time") ? map.get("time") : "")); baseWarpper.setAmount(Double.valueOf(String.valueOf(null != map.get("money") ? map.get("money") : 0))); - switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ - case 1: - baseWarpper.setName(language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); - break; - case 2: - baseWarpper.setName(language == 1 ? "出租车" : language == 2 ? "taxi" : "taxi"); - break; - case 3: - baseWarpper.setName(language == 1 ? "城际出行" : language == 2 ? "Intercity travel" : "Mobilité entre villes"); - break; - case 4: - baseWarpper.setName(language == 1 ? "包裹" : language == 2 ? "Package" : "Livraison"); - break; - case 5: - baseWarpper.setName(language == 1 ? "跨城小件物流" : language == 2 ? "Cross-city small parts logistics" : "Logistique des petites pièces à travers la ville"); - break; - } - Map<String, Object> map1 = new HashMap<>(); - switch (Integer.valueOf(map.get("orderType").toString())){ - case 1: - OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(map.get("incomeId").toString()); - List<Income> incomes = incomeService.queryData(1, null, 2, orderPrivateCar.getId(), 1); - map1.put("travelMoney", orderPrivateCar != null ? orderPrivateCar.getOrderMoney() : 0);//行程费 - map1.put("parkMoney", orderPrivateCar != null ? orderPrivateCar.getParkMoney() : 0);//停车费 - map1.put("tipMoney", 0);//小费 - map1.put("roadTollMoney", orderPrivateCar != null ? orderPrivateCar.getRoadTollMoney() : 0);//过路费 - map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成 - break; - case 2: - OrderTaxi orderTaxi = orderTaxiService.selectById(map.get("incomeId").toString()); - List<Income> incomes1 = incomeService.queryData(1, null, 2, orderTaxi.getId(), 2); - map1.put("travelMoney", orderTaxi != null ? orderTaxi.getTravelMoney() : 0);//行程费 - map1.put("parkMoney", orderTaxi != null ? orderTaxi.getParkMoney() : 0);//停车费 - map1.put("tipMoney", orderTaxi != null ? orderTaxi.getTipMoney() : 0);//小费 - map1.put("roadTollMoney", orderTaxi != null ? orderTaxi.getRoadTollMoney() : 0);//过路费 - map1.put("rakeMoney", incomes1.size() > 0 ? incomes1.get(0).getMoney() : 0);//抽成 - break; - case 3: - OrderCrossCity orderCrossCity = orderCrossCityService.selectById(map.get("incomeId").toString()); - List<Income> incomes2 = incomeService.queryData(1, null, 2, orderCrossCity.getId(), 3); - map1.put("travelMoney", orderCrossCity != null ? orderCrossCity.getOrderMoney() : 0);//行程费 - map1.put("parkMoney", 0);//停车费 - map1.put("tipMoney", 0);//小费 - map1.put("roadTollMoney", 0);//过路费 - map1.put("rakeMoney", incomes2.size() > 0 ? incomes2.get(0).getMoney() : 0);//抽成 - break; - case 4: - OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); - List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4); - map1.put("travelMoney", orderLogistics != null ? orderLogistics.getTravelMoney() : 0);//行程费 - map1.put("parkMoney", 0);//停车费 - map1.put("tipMoney", orderLogistics != null ? orderLogistics.getTipMoney() : 0);//小费 - map1.put("roadTollMoney", 0);//过路费 - map1.put("rakeMoney", incomes3.size() > 0 ? incomes3.get(0).getMoney() : 0);//抽成 - break; - case 5: - OrderLogistics orderLogistics1 = orderLogisticsService.selectById(map.get("incomeId").toString()); - List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5); - map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getTravelMoney() : 0);//行程费 - map1.put("parkMoney", 0);//停车费 - map1.put("tipMoney", orderLogistics1 != null ? orderLogistics1.getTipMoney() : 0);//小费 - map1.put("roadTollMoney", 0);//过路费 - map1.put("rakeMoney", incomes4.size() > 0 ? incomes4.get(0).getMoney() : 0);//抽成 - break; + if("2".equals(type)){ + switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ + case 1: + baseWarpper.setName(language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); + break; + case 2: + baseWarpper.setName(language == 1 ? "出租车" : language == 2 ? "taxi" : "taxi"); + break; + case 3: + baseWarpper.setName(language == 1 ? "城际出行" : language == 2 ? "Intercity travel" : "Mobilité entre villes"); + break; + case 4: + baseWarpper.setName(language == 1 ? "包裹" : language == 2 ? "Delivery" : "Livraison"); + break; + case 5: + baseWarpper.setName(language == 1 ? "跨城小件物流" : language == 2 ? "Cross-city small parts logistics" : "Logistique des petites pièces à travers la ville"); + break; + } + Map<String, Object> map1 = new HashMap<>(); + switch (Integer.valueOf(map.get("orderType").toString())){ + case 1: + OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(map.get("incomeId").toString()); + List<Income> incomes = incomeService.queryData(1, null, 2, orderPrivateCar.getId(), 1); + map1.put("travelMoney", orderPrivateCar != null ? orderPrivateCar.getOrderMoney() : 0);//行程费 + map1.put("parkMoney", orderPrivateCar != null ? orderPrivateCar.getParkMoney() : 0);//停车费 + map1.put("tipMoney", 0);//小费 + map1.put("roadTollMoney", orderPrivateCar != null ? orderPrivateCar.getRoadTollMoney() : 0);//过路费 + map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成 + break; + case 2: + OrderTaxi orderTaxi = orderTaxiService.selectById(map.get("incomeId").toString()); + List<Income> incomes1 = incomeService.queryData(1, null, 2, orderTaxi.getId(), 2); + map1.put("travelMoney", orderTaxi != null ? orderTaxi.getTravelMoney() : 0);//行程费 + map1.put("parkMoney", orderTaxi != null ? orderTaxi.getParkMoney() : 0);//停车费 + map1.put("tipMoney", orderTaxi != null ? orderTaxi.getTipMoney() : 0);//小费 + map1.put("roadTollMoney", orderTaxi != null ? orderTaxi.getRoadTollMoney() : 0);//过路费 + map1.put("rakeMoney", incomes1.size() > 0 ? incomes1.get(0).getMoney() : 0);//抽成 + break; + case 3: + OrderCrossCity orderCrossCity = orderCrossCityService.selectById(map.get("incomeId").toString()); + List<Income> incomes2 = incomeService.queryData(1, null, 2, orderCrossCity.getId(), 3); + map1.put("travelMoney", orderCrossCity != null ? orderCrossCity.getOrderMoney() : 0);//行程费 + map1.put("parkMoney", 0);//停车费 + map1.put("tipMoney", 0);//小费 + map1.put("roadTollMoney", 0);//过路费 + map1.put("rakeMoney", incomes2.size() > 0 ? incomes2.get(0).getMoney() : 0);//抽成 + break; + case 4: + OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString()); + List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4); + map1.put("travelMoney", orderLogistics != null ? orderLogistics.getTravelMoney() : 0);//行程费 + map1.put("parkMoney", 0);//停车费 + map1.put("tipMoney", orderLogistics != null ? orderLogistics.getTipMoney() : 0);//小费 + map1.put("roadTollMoney", 0);//过路费 + map1.put("rakeMoney", incomes3.size() > 0 ? incomes3.get(0).getMoney() : 0);//抽成 + break; + case 5: + OrderLogistics orderLogistics1 = orderLogisticsService.selectById(map.get("incomeId").toString()); + List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5); + map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getTravelMoney() : 0);//行程费 + map1.put("parkMoney", 0);//停车费 + map1.put("tipMoney", orderLogistics1 != null ? orderLogistics1.getTipMoney() : 0);//小费 + map1.put("roadTollMoney", 0);//过路费 + map1.put("rakeMoney", incomes4.size() > 0 ? incomes4.get(0).getMoney() : 0);//抽成 + break; + } + baseWarpper.setData(map1); } - baseWarpper.setData(map1); + if("3".equals(type)){ + baseWarpper.setName(language == 1 ? "取消订单费用" : language == 2 ? "Cancellation fee" : "Frais d'annulation"); + baseWarpper.setData(new Object()); + } data.add(baseWarpper); } return ResultUtil.success(data); @@ -1279,7 +1327,7 @@ if(null == uid){ return ResultUtil.tokenErr(); } - SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<ActivityWarpper> activityWarppers = driverService.queryMyActivity(uid, sdf.parse(time), language); return ResultUtil.success(activityWarppers); }catch (Exception e){ -- Gitblit v1.7.1