From 821fc2f632f8b974a2c0fc37630e13c5fbe6086c Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 26 九月 2025 17:26:16 +0800 Subject: [PATCH] 修改bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 64 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java | 2 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TIntegralOrderController.java | 16 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java | 4 DriverIGOTravel/guns-admin/src/main/resources/application-produce.yml | 19 UserIGOTravel/guns-admin/src/main/resources/application-dev.yml | 2 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java | 19 DriverIGOTravel/guns-admin/src/main/resources/application-dev.yml | 15 ZuulIGOTravel/src/main/resources/application.yml | 4 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 4 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserActivityController.java | 30 ManagementIGOTravel/guns-admin/src/main/resources/application-produce.yml | 19 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java | 275 ++-- ZuulIGOTravel/src/main/java/com/sinata/zuul/controller/NettyController.java | 6 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java | 10 UserIGOTravel/guns-admin/src/main/resources/application-produce.yml | 20 ManagementIGOTravel/guns-admin/src/main/resources/application-test.yml | 2 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java | 4 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java | 4 ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/userActivity/userActivity.js | 8 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java | 23 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java | 2 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml | 2913 +++++++++++++++++++++--------------------- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java | 9 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java | 12 ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml | 2 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java | 1 ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/couponStatistics.html | 2 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 48 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java | 19 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 2 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java | 4 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java | 45 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java | 4 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java | 18 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TReportLossController.java | 22 ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/driverActivity/driverActivity.js | 10 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 2 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DriverActivityController.java | 15 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java | 224 +- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java | 19 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java | 19 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java | 13 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java | 4 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java | 1 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/TextToSpeechUtil.java | 2 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityMapper.xml | 5 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java | 19 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 4 49 files changed, 2,004 insertions(+), 1,986 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java index 2833609..75e6e58 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/GunsApplication.java @@ -38,7 +38,6 @@ public static void main(String[] args) { SpringApplication.run(GunsApplication.class, args); //启动定时任务调度器 -// QuartzUtil.start(GunsApplication.class.getClassLoader().getResourceAsStream("quartz.properties")); logger.info("GunsApplication is success!"); } 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 fb2cd10..574f879 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 @@ -1819,7 +1819,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName + ".mp3"); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName + ".mp3"); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 1972a3c..cdf8419 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -707,11 +707,11 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "取件码邮件" : language == 2 ? "Pickup code" : "Code de ramassage", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/code_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/code_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index 2c52b37..d2c8139 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -675,7 +675,9 @@ if(orderPrivateCar.getArriveTime()==null){ orderPrivateCar.setArriveTime(orderPrivateCar.getStartServiceTime()); } - + if(null == orderPrivateCar.getEndServiceTime()){ + orderPrivateCar.setEndServiceTime(new Date()); + } //使用原始里程计算费用 orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用 Double mileage = orderPrivateCar.getMileage(); diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java index 999d760..6821759 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverOnlineServiceImpl.java @@ -157,6 +157,13 @@ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<DriverActivityHistory> driverActivityHistories = driverActivityHistoryMapper.selectList(new EntityWrapper<DriverActivityHistory>().eq("driverId", driverId) .eq("type", 3).eq("carryOut", 1).last(" and day = '" + sdf.format(new Date()) + "' and driverActivityId in (select id from t_driver_activity where status = 3 and now() between startTime and endTime)")); + if(!driverActivityHistories.isEmpty()){ + //如果一直属于上班中,则需要从任务开始时间计算时间 + Date insertTime = driverActivityHistories.get(0).getInsertTime(); + if(driverWork.getStartTime().getTime() < insertTime.getTime()){ + driverWork.setStartTime(insertTime); + } + } //生成每个活动从开始上班到当前时间的时长记录 for (DriverActivityHistory driverActivityHistory : driverActivityHistories) { String value = redisUtil.getValue("driverActivity_" + driverId + "_" + driverActivityHistory.getId()); @@ -210,7 +217,6 @@ continue; } Integer driverId = driverOnline.getDriverId(); - Driver driver1 = driverService.selectById(driverId); long m = Double.valueOf(driverActivityOnline.getOfflineTime() * 3600000L).longValue(); //找出最后一次接单的时间 @@ -259,7 +265,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -306,13 +312,13 @@ //在线时长累计 Long time = jsonObject.getLong("time") / 60000; int count1 = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("driverId", driverActivityHistory.getDriverId()) - .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime) / 1000)); + .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime / 1000))); int count2 = orderLogisticsService.selectCount(new EntityWrapper<OrderLogistics>().eq("driverId", driverActivityHistory.getDriverId()) - .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime) / 1000)); + .eq("isDelete", 1).ne("state", 10).last(" and UNIX_TIMESTAMP(snatchOrderTime) > " + (startTime / 1000))); Driver driver = driverService.selectById(driverWork.getDriverId()); //阶段时间累计时长超过设定时长且没有接单,不计入累计总时长(司机服务中不下班) - if(m <= time && count1 + count2 == 0 && driver.getState() != 3){ + if(m <= time && (count1 + count2) == 0){ //司机下班,清空当前阶段的累计时长 driverWork.setState(2); driverWork.setEndTime(new Date()); @@ -343,7 +349,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -359,9 +365,8 @@ } } }, 30000); - } - //阶段时间累计有新的订单,计入累计总时长,重置新的开始统计时间戳 - if(m <= time && count1 + count2 > 0){ + } else if(m <= time && (count1 + count2) > 0){ + //阶段时间累计有新的订单,计入累计总时长,重置新的开始统计时间戳 DriverOnline driverOnline = this.selectOne(new EntityWrapper<DriverOnline>().eq("DATE_FORMAT(date, '%Y-%m-%d')", sdf.format(new Date())) .eq("driverId", driverActivityHistory.getDriverId())); if(null == driverOnline){ diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java index 39f00d7..1d0f494 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/DriverServiceImpl.java @@ -409,11 +409,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/invitation_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/invitation_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -606,11 +606,11 @@ EmailUtil.send(finalDriver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/invitation_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/invitation_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -867,11 +867,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "成功注册" : language == 2 ? "Registered successfully" : "Enregistré avec succès", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/registration_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/registration_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -981,11 +981,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "密码重置" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/reset_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/reset_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1653,11 +1653,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "密码重置" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/reset_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/reset_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2098,11 +2098,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "邀请司机奖励(活动)" : language == 2 ? "Invite drivers and earn" : "Invitez des chauffeurs et gagnez de l’argent", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/activity_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/activity_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2221,11 +2221,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "邀请用户奖励(活动)" : language == 2 ? "Invite users and earn" : "Invitez des utilisateurs et gagnez de l’argent", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/activity_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/activity_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2345,11 +2345,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "在线时长奖励(活动)" : language == 2 ? "Online-duration reward activity" : "Activité de récompense en ligne", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/activity_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/activity_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2469,11 +2469,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "累计接单奖励(活动)" : language == 2 ? "Cumulative order activity" : "Activité cumulée des commandes", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/activity_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/activity_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2525,6 +2525,7 @@ if(null == dao){ continue; } + //秒 Long duration = Double.valueOf(dao.getOnline() * 3600).longValue(); List<DriverOnline> driverOnlines = driverOnlineMapper.queryList(sdf.format(new Date()), null, dah.getDriverId(), duration); if(driverOnlines.size() > 0){ @@ -2615,11 +2616,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/rewards_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/rewards_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2745,11 +2746,11 @@ EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); String randomString = ToolUtil.getRandomString(10); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/rewards_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/rewards_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java index c2c8625..b02e52a 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java @@ -309,7 +309,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -656,7 +656,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java index 5999dfd..a3eb125 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TaskUtil.java @@ -59,14 +59,14 @@ @Scheduled(fixedRate = 1000 * 60) public void taskMinute(){ try { + //处理司机连续不接单的情况 + driverOnlineService.deductionDuration1(); //修改满足活动条件的数据(在线时长,订单量) driverService.taskMinute(); //处于预约单 orderService.reservationOrder(); // //处理结束订单后30分钟解绑小号功能 // orderService.taskMidAxbUnBindSend(); - //处理司机连续不接单的情况 - driverOnlineService.deductionDuration1(); //处理google订单状态 orderService.overGoogleOrder(); } catch (Exception e) { diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java index 97857c2..328c227 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java @@ -1,8 +1,12 @@ package com.stylefeng.guns.modular.system.util; +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.texttospeech.v1.*; import com.google.protobuf.ByteString; +import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; @@ -22,8 +26,13 @@ * @throws Exception */ public static String create(String languageCode, String text, String fileName) throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { + GoogleCredentials googleCredentials = GoogleCredentials + .fromStream(new FileInputStream("/home/igotechgh/i-go-gcp-f83e2d02152a.json")) + .createScoped("https://www.googleapis.com/auth/cloud-platform"); + + FixedCredentialsProvider provider = FixedCredentialsProvider.create(googleCredentials); + TextToSpeechSettings textToSpeechSettings = TextToSpeechSettings.newBuilder().setCredentialsProvider(provider).build(); + try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create(textToSpeechSettings)) { // Set the text input to be synthesized SynthesisInput input = SynthesisInput.newBuilder().setText(text).build(); @@ -48,7 +57,11 @@ ByteString audioContents = response.getAudioContent(); // Write the response to the output file. - try (OutputStream out = new FileOutputStream("/home/igotechgh/nginx/html/files/audio/" + fileName)) { + File file = new File("/data/nginx/html/files/audio/" + fileName); + if (!file.exists()) { + file.createNewFile(); + } + try (OutputStream out = new FileOutputStream("/data/nginx/html/files/audio/" + fileName)) { out.write(audioContents.toByteArray()); return "https://igo.i-go.group/files/audio/" + fileName; }catch (Exception e){ diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java index 7d458ea..4cdda24 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java @@ -178,7 +178,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/DriverIGOTravel/guns-admin/src/main/resources/application-dev.yml b/DriverIGOTravel/guns-admin/src/main/resources/application-dev.yml index 88f3f88..25346bf 100644 --- a/DriverIGOTravel/guns-admin/src/main/resources/application-dev.yml +++ b/DriverIGOTravel/guns-admin/src/main/resources/application-dev.yml @@ -54,19 +54,6 @@ filters: wall,mergeStat -#多数据源情况的配置 -guns: - muti-datasource: - open: false - url: jdbc:mysql://127.0.0.1:3306/guns_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai - username: root - password: root - dataSourceNames: - - dataSourceGuns - - dataSourceBiz - - - wx: grantType: authorization_code #填authorization_code appid: wx97c33c052b2222f7 #应用唯一标识,在微信开放平台提交应用审核通过后获得 @@ -124,7 +111,7 @@ socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 debug: true from: i-gotech@i-go.group # 发送方邮件,配在yml中可方便更改 - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- diff --git a/DriverIGOTravel/guns-admin/src/main/resources/application-produce.yml b/DriverIGOTravel/guns-admin/src/main/resources/application-produce.yml index 1516245..46b786c 100644 --- a/DriverIGOTravel/guns-admin/src/main/resources/application-produce.yml +++ b/DriverIGOTravel/guns-admin/src/main/resources/application-produce.yml @@ -30,8 +30,8 @@ file-size-threshold: 100MB redis: database: 0 - host: 127.0.0.1 - port: 16379 + host: 172.17.0.3 + port: 6379 password: mPMHThYzlT8DWgl8HLqwPEyPOiHDPPB5 mybatis-plus: @@ -54,19 +54,6 @@ password: _6)S]<vpfvj?N#t2 db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat - - - -#多数据源情况的配置 -guns: - muti-datasource: - open: false - url: jdbc:mysql://127.0.0.1:3306/guns_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai - username: root - password: root - dataSourceNames: - - dataSourceGuns - - dataSourceBiz @@ -116,7 +103,7 @@ spring: mail: - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TReportLossController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TReportLossController.java index 2f71674..de8c8df 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TReportLossController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/TReportLossController.java @@ -1,38 +1,32 @@ package com.stylefeng.guns.modular.system.controller; -import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; -import com.stylefeng.guns.core.common.constant.factory.PageFactory; +import com.stylefeng.guns.core.log.LogObjectHolder; import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.model.TEmail; +import com.stylefeng.guns.modular.system.model.TReportLoss; import com.stylefeng.guns.modular.system.model.TUser; +import com.stylefeng.guns.modular.system.service.ITReportLossService; import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.service.TEmailService; import com.stylefeng.guns.modular.system.util.EmailUtil; -import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.beans.factory.annotation.Autowired; -import com.stylefeng.guns.core.log.LogObjectHolder; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.stylefeng.guns.modular.system.model.TReportLoss; -import com.stylefeng.guns.modular.system.service.ITReportLossService; +import org.springframework.web.bind.annotation.ResponseBody; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.util.Date; -import java.util.Map; /** * 控制器 @@ -196,12 +190,12 @@ } //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/reportLossResult_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/reportLossResult_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DriverActivityController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DriverActivityController.java index 8ad9843..d306128 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DriverActivityController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/DriverActivityController.java @@ -11,6 +11,7 @@ import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; +import com.stylefeng.guns.modular.system.util.ResultUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -225,8 +226,14 @@ beginTime = timeArray[0]; endTime = timeArray[1]; } + Integer companyType = null; + Integer companyId = null; + if(1 != user.getRoleType()){ + companyType = user.getRoleType(); + companyId = user.getObjectId(); + } Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); - page.setRecords(driverActivityService.getList(page,beginTime,endTime,name,user.getRoleType(),user.getObjectId())); + page.setRecords(driverActivityService.getList(page,beginTime,endTime,name,companyType,companyId)); return super.packForBT(page); } @@ -305,8 +312,12 @@ @RequestMapping(value = "/updateStatus") @ResponseBody public Object updateStatus(DriverActivity driverActivity) { + DriverActivity driverActivity1 = driverActivityService.selectById(driverActivity.getId()); + if(System.currentTimeMillis() >= driverActivity1.getEndTime().getTime()){ + return ResultUtil.error("活动已结束,修改状态失败"); + } driverActivityService.updateById(driverActivity); - return SUCCESS_TIP; + return ResultUtil.success(); } @RequestMapping("/driverActivity_detail/{driverActivityId}") diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java index a8d2b92..e482596 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysCouponActivityController.java @@ -2,40 +2,36 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.core.common.constant.factory.PageFactory; +import com.stylefeng.guns.core.log.LogObjectHolder; import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.shiro.ShiroUser; import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.model.*; +import com.stylefeng.guns.modular.system.service.ISysCouponActivityService; import com.stylefeng.guns.modular.system.service.ISysCouponRecordService; import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.service.TEmailService; import com.stylefeng.guns.modular.system.util.EmailUtil; -import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.beans.factory.annotation.Autowired; -import com.stylefeng.guns.core.log.LogObjectHolder; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.stylefeng.guns.modular.system.service.ISysCouponActivityService; +import org.springframework.web.bind.annotation.ResponseBody; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.text.SimpleDateFormat; import java.util.*; @@ -197,6 +193,135 @@ } return SUCCESS_TIP; } + + public void sendEmail(TUser userInfo1, Integer num, String startTime, String endTime, Double fullMoney){ + try { + if(ToolUtil.isNotEmpty(userInfo1.getEmail())){ + Integer language = userInfo1.getLanguage(); + String path1 = templatePath + "user/coupon.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); + if(1 == language){ + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("优惠券到账"); + Element chinese_user = document1.getElementById("chinese_user"); + chinese_user.text("您好 " + userInfo1.getNickName() + ","); + Element chinese_number = document1.getElementById("chinese_number"); + chinese_number.text("您有" + num + "张优惠券到账"); + Element chinese_date = document1.getElementById("chinese_date"); + chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); + Element chinese_remark = document1.getElementById("chinese_remark"); + chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); + EmailUtil.send(userInfo1.getEmail(), "优惠券到账", document1.html()); + } + if(2 == language){ + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementsByTag("title").get(0).text("Coupon is in"); + Element english_user = document1.getElementById("english_user"); + english_user.text("Hello " + userInfo1.getNickName() + ","); + Element english_number = document1.getElementById("english_number"); + english_number.text("You have received " + num + " coupons"); + Element english_date = document1.getElementById("english_date"); + english_date.text("You could use them from " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(2, startTime) + " to " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(2, endTime)); + Element english_remark = document1.getElementById("english_remark"); + english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); + EmailUtil.send(userInfo1.getEmail(), "Coupon is in", document1.html()); + } + if(3 == language){ + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementsByTag("title").get(0).text("Le coupon est arrivé"); + Element french_user = document1.getElementById("french_user"); + french_user.text("Cher(ère) " + userInfo1.getNickName() + ","); + Element french_number = document1.getElementById("french_number"); + french_number.text("Vous avez reçu " + num + " coupons."); + Element french_date = document1.getElementById("french_date"); + french_date.text("Vous devriez les utiliser du " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(3, startTime) + " au " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(3, endTime) + ", voir le détail sur la plate-forme I-GO."); + Element french_remark = document1.getElementById("french_remark"); + french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); + EmailUtil.send(userInfo1.getEmail(), "Le coupon est arrivé", document1.html()); + } + + //开始生成pdf收据和html收据 + File file = new File("/data/nginx/html/files/html/"); + if(!file.exists()){ + file.mkdirs(); + } + String randomString = ToolUtil.getRandomString(10); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); + if(!file.exists()){ + file.createNewFile(); + } + FileWriter fileWriter = new FileWriter(file); + fileWriter.write(document1.html()); + fileWriter.flush(); + fileWriter.close(); + + String link ="https://igo.i-go.group/files/html/coupon_" + randomString + ".html"; + TEmail tEmail = new TEmail(); + tEmail.setLink(link); + tEmail.setUserId(userInfo1.getId()); + tEmail.setType(1); + tEmail.setName(language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé"); + tEmail.setCreateTime(new Date()); + int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; + tEmail.setWeek(EmailUtil.getWeek(2,i)); + boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); + if(am){ + tEmail.setAmOrPm("AM"); + }else { + tEmail.setAmOrPm("PM"); + } + emailService.insert(tEmail); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + /** + * 删除 + */ + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete(@RequestParam Integer sysCouponActivityId) { + SysCouponActivity sysCouponActivity = new SysCouponActivity(); + sysCouponActivity.setId(sysCouponActivityId); + sysCouponActivity.setStatus(4); + sysCouponActivityService.updateById(sysCouponActivity); + return SUCCESS_TIP; + } + + /** + * 修改 + */ + @RequestMapping(value = "/update") + @ResponseBody + public Object update(SysCouponActivity sysCouponActivity,Integer activityId) { + SysCouponRecord sysCouponRecord = couponRecordService.selectById(activityId); + sysCouponActivity.setCouponType(sysCouponRecord.getCouponType()); + sysCouponActivity.setCouponUseType(sysCouponRecord.getCouponUseType()); + sysCouponActivity.setMoney(sysCouponRecord.getMoney()); + sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); + sysCouponActivity.setInsertTime(new Date()); + sysCouponActivity.setCouponId(activityId); + sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); + sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); + sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); + sysCouponActivityService.updateById(sysCouponActivity); + return SUCCESS_TIP; + } + + /** + * 详情 + */ + @RequestMapping(value = "/detail/{sysCouponActivityId}") + @ResponseBody + public Object detail(@PathVariable("sysCouponActivityId") Integer sysCouponActivityId) { + return sysCouponActivityService.selectById(sysCouponActivityId); + } + class timerTaskTest extends TimerTask { private Integer id; @@ -267,137 +392,5 @@ } } - } - - - public void sendEmail(TUser userInfo1, Integer num, String startTime, String endTime, Double fullMoney){ - try { - if(ToolUtil.isNotEmpty(userInfo1.getEmail())){ - Integer language = userInfo1.getLanguage(); - String path1 = templatePath + "user/coupon.html"; - Document document1 = Jsoup.parse(new File(path1), "UTF-8"); - if(1 == language){ - document1.getElementById("english").remove(); - document1.getElementById("french").remove(); - document1.getElementsByTag("title").get(0).text("优惠券到账"); - Element chinese_user = document1.getElementById("chinese_user"); - chinese_user.text("您好 " + userInfo1.getNickName() + ","); - Element chinese_number = document1.getElementById("chinese_number"); - chinese_number.text("您有" + num + "张优惠券到账"); - Element chinese_date = document1.getElementById("chinese_date"); - chinese_date.text("此活动有效期在" + startTime + "至" + endTime + ",详情请查看I-GO平台"); - Element chinese_remark = document1.getElementById("chinese_remark"); - chinese_remark.text("注意:满减活动,每单消费至少GHS " + fullMoney + ",才可享用。"); - EmailUtil.send(userInfo1.getEmail(), "优惠券到账", document1.html()); - } - if(2 == language){ - document1.getElementById("chinese").remove(); - document1.getElementById("french").remove(); - document1.getElementsByTag("title").get(0).text("Coupon is in"); - Element english_user = document1.getElementById("english_user"); - english_user.text("Hello " + userInfo1.getNickName() + ","); - Element english_number = document1.getElementById("english_number"); - english_number.text("You have received " + num + " coupons"); - Element english_date = document1.getElementById("english_date"); - english_date.text("You could use them from " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(2, startTime) + " to " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(2, endTime)); - Element english_remark = document1.getElementById("english_remark"); - english_remark.text("NB! Coupon is valid only for the trip fare not less than GHS " + fullMoney + " per ride."); - EmailUtil.send(userInfo1.getEmail(), "Coupon is in", document1.html()); - } - if(3 == language){ - document1.getElementById("chinese").remove(); - document1.getElementById("english").remove(); - document1.getElementsByTag("title").get(0).text("Le coupon est arrivé"); - Element french_user = document1.getElementById("french_user"); - french_user.text("Cher(ère) " + userInfo1.getNickName() + ","); - Element french_number = document1.getElementById("french_number"); - french_number.text("Vous avez reçu " + num + " coupons."); - Element french_date = document1.getElementById("french_date"); - french_date.text("Vous devriez les utiliser du " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(3, startTime) + " au " + com.stylefeng.guns.modular.system.util.DateUtil.conversionFormat(3, endTime) + ", voir le détail sur la plate-forme I-GO."); - Element french_remark = document1.getElementById("french_remark"); - french_remark.text("Remarque! Le coupon n'est valable que pour le tarif d'au moins GHS " + fullMoney + " par trajet."); - EmailUtil.send(userInfo1.getEmail(), "Le coupon est arrivé", document1.html()); - } - - //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); - if(!file.exists()){ - file.mkdirs(); - } - String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); - if(!file.exists()){ - file.createNewFile(); - } - FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document1.html()); - fileWriter.flush(); - fileWriter.close(); - - String link ="https://igo.i-go.group/files/html/coupon_" + randomString + ".html"; - TEmail tEmail = new TEmail(); - tEmail.setLink(link); - tEmail.setUserId(userInfo1.getId()); - tEmail.setType(1); - tEmail.setName(language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé"); - tEmail.setCreateTime(new Date()); - int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; - tEmail.setWeek(EmailUtil.getWeek(2,i)); - boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); - if(am){ - tEmail.setAmOrPm("AM"); - }else { - tEmail.setAmOrPm("PM"); - } - emailService.insert(tEmail); - } - }catch (Exception e){ - e.printStackTrace(); - } - } - - - - - /** - * 删除 - */ - @RequestMapping(value = "/delete") - @ResponseBody - public Object delete(@RequestParam Integer sysCouponActivityId) { - SysCouponActivity sysCouponActivity = new SysCouponActivity(); - sysCouponActivity.setId(sysCouponActivityId); - sysCouponActivity.setStatus(4); - sysCouponActivityService.updateById(sysCouponActivity); - return SUCCESS_TIP; - } - - /** - * 修改 - */ - @RequestMapping(value = "/update") - @ResponseBody - public Object update(SysCouponActivity sysCouponActivity,Integer activityId) { - SysCouponRecord sysCouponRecord = couponRecordService.selectById(activityId); - sysCouponActivity.setCouponType(sysCouponRecord.getCouponType()); - sysCouponActivity.setCouponUseType(sysCouponRecord.getCouponUseType()); - sysCouponActivity.setMoney(sysCouponRecord.getMoney()); - sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); - sysCouponActivity.setInsertTime(new Date()); - sysCouponActivity.setCouponId(activityId); - sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); - sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); - sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); - sysCouponActivityService.updateById(sysCouponActivity); - return SUCCESS_TIP; - } - - /** - * 详情 - */ - @RequestMapping(value = "/detail/{sysCouponActivityId}") - @ResponseBody - public Object detail(@PathVariable("sysCouponActivityId") Integer sysCouponActivityId) { - return sysCouponActivityService.selectById(sysCouponActivityId); } } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java index 5e7cd10..85c1742 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TComplaintController.java @@ -6,36 +6,31 @@ import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; +import com.stylefeng.guns.modular.system.model.TComplaint; import com.stylefeng.guns.modular.system.model.TEmail; import com.stylefeng.guns.modular.system.model.TSystemNotice; import com.stylefeng.guns.modular.system.model.TUser; +import com.stylefeng.guns.modular.system.service.ITComplaintService; import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.service.TEmailService; import com.stylefeng.guns.modular.system.util.EmailUtil; -import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.stylefeng.guns.modular.system.model.TComplaint; -import com.stylefeng.guns.modular.system.service.ITComplaintService; +import org.springframework.web.bind.annotation.ResponseBody; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.util.Date; import java.util.Map; - -import static org.bouncycastle.asn1.x500.style.RFC4519Style.uid; /** * 投诉列表控制器 @@ -185,12 +180,12 @@ } //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/complaintResult_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/complaintResult_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java index 13dbce5..8df18cb 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TFeedbackController.java @@ -7,31 +7,27 @@ import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.model.TEmail; +import com.stylefeng.guns.modular.system.model.TFeedback; import com.stylefeng.guns.modular.system.model.TSystemNotice; import com.stylefeng.guns.modular.system.model.TUser; +import com.stylefeng.guns.modular.system.service.ITFeedbackService; import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.service.TEmailService; import com.stylefeng.guns.modular.system.util.EmailUtil; -import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.beans.factory.annotation.Autowired; -import com.stylefeng.guns.core.log.LogObjectHolder; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.stylefeng.guns.modular.system.model.TFeedback; -import com.stylefeng.guns.modular.system.service.ITFeedbackService; +import org.springframework.web.bind.annotation.ResponseBody; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.util.Date; import java.util.Map; @@ -215,12 +211,12 @@ } //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/feedbackResult_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/feedbackResult_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserActivityController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserActivityController.java index e5d9aed..35a7f04 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserActivityController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/UserActivityController.java @@ -11,6 +11,7 @@ import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; +import com.stylefeng.guns.modular.system.util.ResultUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -165,23 +166,14 @@ if (SinataUtil.isNotEmpty(userActivityDiscount1)) { // 专车 Map<String, Object> resultMap = userCouponRecordService.getDiscountStatic(startTimes, endTimes, userActivityDiscount1.getId()); - BigDecimal bigDecimal = new BigDecimal(resultMap.get("money").toString()); - String string = resultMap.get("number").toString(); - Integer i = Integer.valueOf(string); - // 小件物流 - Map<String, Object> resultMap1 = userCouponRecordService.getDiscountStatic1(startTimes, endTimes, userActivityDiscount1.getId()); - if (null != resultMap1) { - BigDecimal bigDecimal1 = new BigDecimal(resultMap1.get("money").toString()); - String string1 = resultMap1.get("number").toString(); - Integer i1 = Integer.valueOf(string1); - BigDecimal add = bigDecimal.add(bigDecimal1); - i += i1; - map.put("userActivityDiscount1Money", add); - map.put("userActivityDiscount1Number", i); - } else { - map.put("userActivityDiscount1Money", 0); - map.put("userActivityDiscount1Number", 0); + BigDecimal bigDecimal = BigDecimal.ZERO; + String string = ""; + if(null != resultMap){ + bigDecimal = new BigDecimal(resultMap.get("money").toString()); + string = resultMap.get("number").toString(); } + map.put("userActivityDiscount1Money", bigDecimal); + map.put("userActivityDiscount1Number", string); } else { map.put("userActivityDiscount1Money", 0); map.put("userActivityDiscount1Number", 0); @@ -430,8 +422,12 @@ @RequestMapping(value = "/updateStatus") @ResponseBody public Object updateStatus(UserActivity driverActivity) { + UserActivity userActivity = userActivityService.selectById(driverActivity.getId()); + if(System.currentTimeMillis() >= userActivity.getEndTime().getTime()){ + return ResultUtil.error("活动已结束,修改状态失败"); + } userActivityService.updateById(driverActivity); - return SUCCESS_TIP; + return ResultUtil.success(); } /** diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TIntegralOrderController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TIntegralOrderController.java index 9cb7328..dd9e0ce 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TIntegralOrderController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TIntegralOrderController.java @@ -6,21 +6,23 @@ import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; -import com.stylefeng.guns.modular.system.model.*; +import com.stylefeng.guns.modular.system.model.TEmail; +import com.stylefeng.guns.modular.system.model.TIntegralGoods; +import com.stylefeng.guns.modular.system.model.TIntegralOrder; +import com.stylefeng.guns.modular.system.model.TUser; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.EmailUtil; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.beans.factory.annotation.Autowired; -import com.stylefeng.guns.core.log.LogObjectHolder; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.io.File; @@ -168,12 +170,12 @@ EmailUtil.send(email, language == 1 ? "积分兑换已通过审核" : language == 2 ? "Points redemption approved" : "Approbation de l’échange de points", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/complaint_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/complaint_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java index 2cd6487..f4d3d87 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TReassignController.java @@ -670,7 +670,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -1095,7 +1095,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + finalFileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + finalFileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/TextToSpeechUtil.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/TextToSpeechUtil.java index 803c2d8..3846f4f 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/TextToSpeechUtil.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/TextToSpeechUtil.java @@ -50,7 +50,7 @@ ByteString audioContents = response.getAudioContent(); // Write the response to the output file. - try (OutputStream out = new FileOutputStream("/home/igotechgh/nginx/html/files/audio/" + fileName)) { + try (OutputStream out = new FileOutputStream("/data/nginx/html/files/audio/" + fileName)) { out.write(audioContents.toByteArray()); return "https://igo.i-go.group/files/audio/" + fileName; }catch (Exception e){ diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java index 2b5e52b..e0b2634 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/util/UploadUtil.java @@ -89,6 +89,7 @@ // String pictureName = ObsUploadUtil.obsUpload(super.getHttpServletRequest(), picture); return pictureName; } catch (Exception e1) { + e1.printStackTrace(); return null; } } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityMapper.xml index afbd627..bb57330 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityMapper.xml +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserActivityMapper.xml @@ -47,7 +47,10 @@ (select count(id) from t_order_cross_city where state in (6,8,9) and activityId = a.id) ) as number from t_user_activity a - where a.companyId = #{companyId} + where 1 = 1 + <if test="null != companyId"> + and a.companyId = #{companyId} + </if> <if test="null != start and null != end"> and a.insertTime between #{start} and #{end} </if> diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml index f4b413c..ca07752 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml @@ -1,1457 +1,1464 @@ <?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.UserCouponRecordMapper"> - - <!-- 通用查询映射结果 --> - <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.UserCouponRecord"> - <id column="id" property="id"/> - <result column="money" property="money"/> - <result column="fullMoney" property="fullMoney"/> - <result column="expirationTime" property="expirationTime"/> - <result column="insertTime" property="insertTime"/> - <result column="companyId" property="companyId"/> - <result column="state" property="state"/> - <result column="endTime" property="endTime"/> - <result column="couponUseType" property="couponUseType"/> - <result column="couponType" property="couponType"/> - <result column="userId" property="userId"/> - <result column="couponId" property="couponId"/> - <result column="couponActivityId" property="couponActivityId"/> - <result column="activityType" property="activityType"/> - </resultMap> - - <!-- 通用查询结果列 --> - <sql id="Base_Column_List"> - id - , money, fullMoney, expirationTime, insertTime, companyId, state, couponUseType, couponType, userId, couponId, couponActivityId, activityType - </sql> - - <select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> - SELECT - c.id, - c.money, - c.fullMoney, - c.expirationTime, - c.insertTime, - c.companyId, - c.state, - c.couponUseType, - c.couponType, - c.userId, - c.couponId, - c.couponActivityId, - c.activityType, - u.nickName, - u.phone, - if(a.id is null, if(b.id is null, if(d.id is null, if(e.id is null, '', e.endServiceTime), d.endServiceTime), - b.endServiceTime), a.endServiceTime) as useTime - FROM - t_user_coupon_record c - LEFT JOIN t_user u ON c.userId = u.id - left join t_order_private_car a on (a.couponId = c.id) - left join t_order_taxi b on (b.couponId = c.id) - left join t_order_cross_city d on (d.couponId = c.id) - left join t_order_logistics e on (e.couponId = c.id) - WHERE 1=1 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (c.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="userName != null and userName !=''"> - and u.nickName like CONCAT('%',#{userName},'%') - </if> - <if test="activityType != null and activityType !=''"> - and c.activityType=#{activityType} - </if> - <if test="userPhone != null and userPhone !=''"> - and u.phone like CONCAT('%',#{userPhone},'%') - </if> - <if test="couponActivityId != null"> - and c.couponActivityId=#{couponActivityId} - </if> - <if test="state != null and state !=''"> - and c.state=#{state} - </if> - </select> - <select id="getRedList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> - SELECT - c.id, - c.money, - c.endTime as expirationTime, - c.insertTime, - c.companyId, - c.state, - c.userId, - c.redPacketActivityId, - u.nickName, - u.phone, - if(a.id is null, if(b.id is null, if(d.id is null, if(e.id is null, '', e.endServiceTime), d.endServiceTime), - b.endServiceTime), a.endServiceTime) as useTime - FROM - t_user_red_packet_record c - LEFT JOIN t_user u ON c.userId = u.id - left join t_order_private_car a on (a.redPacketId = c.id) - left join t_order_taxi b on (b.redPacketId = c.id) - left join t_order_cross_city d on (d.redPacketId = c.id) - left join t_order_logistics e on (e.redPacketId = c.id) - WHERE 1=1 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (c.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - <if test="userName != null and userName !=''"> - and u.nickName like CONCAT('%',#{userName},'%') - </if> - <if test="userPhone != null and userPhone !=''"> - and u.phone like CONCAT('%',#{userPhone},'%') - </if> - <if test="couponActivityId != null and couponActivityId !=''"> - and c.redPacketActivityId=#{couponActivityId} - </if> - <if test="state != null and state !=''"> - and c.state=#{state} - </if> - </select> - <select id="getCouponStatic" resultType="map"> - select - IFNULL(SUM(aa.money), 0) money, - IFNULL(SUM(aa.useMoney), 0) useMoney, - COUNT(aa.userId) as number - from ( - SELECT - IFNULL(SUM(money), 0) money, - IFNULL(SUM(CASE WHEN state = 2 THEN money ELSE 0 END), 0) useMoney, - userId - FROM t_user_coupon_record WHERE activityType = #{activityType} AND couponActivityId = #{activityId} - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - group by userId - ) as aa - </select> - <select id="getRedStatic" resultType="map"> - SELECT - IFNULL(SUM(aa.money), 0) money, - IFNULL(SUM(aa.useMoney), 0) useMoney, - COUNT(aa.userId) number - FROM - ( - SELECT - IFNULL(SUM(money), 0) money, - IFNULL(SUM(CASE WHEN state = 2 THEN money ELSE 0 END ), 0) useMoney, - userId - FROM - t_user_red_packet_record - WHERE redPacketActivityId = #{activityId} - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - group by userId - ) as aa group by aa.userId - </select> - <select id="getDiscountStatic" resultType="map"> - SELECT IFNULL(SUM(aa.money), 0) money, COUNT(aa.userId) number - FROM (select IFNULL(SUM(discountMoney), 0) money, userId - from t_order_private_car - WHERE activityId = #{activityId} - group by userId) as aa - </select> - <select id="getDiscountStatic1" resultType="map"> - SELECT IFNULL(SUM(aa.money), 0) money, COUNT(aa.userId) number - FROM (select IFNULL(SUM(discountMoney), 0) money, userId - from t_order_logistics - WHERE activityId = #{activityId} - group by userId) as aa - </select> - <select id="getRegStatic" resultType="map"> - SELECT - IFNULL(SUM(r.money), 0) money, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - r.money - ELSE - 0 - END - ), - 0 - ) useMoney, - COUNT(r.id) number - FROM - t_user_coupon_record r - LEFT JOIN t_user_activity_balance u ON u.id = r.couponActivityId - WHERE - u.userActivityId = #{activityId} and r.activityType =4 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - </select> - <select id="getBlanceList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> - SELECT - b.id, - b.money, - c1.number,c1.useMoney,c1.useNumber, - c2.number speNumber,c2.useMoney speUserMoney,c2.useNumber speUseNumber, - c3.number taxiNumber,c3.useMoney taxiUserMoney,c3.useNumber taxiUseNumber, - c4.number intercityNumber,c4.useMoney intercityUserMoney,c4.useNumber intercityUseNumber - FROM - t_user_activity_balance b - LEFT JOIN ( - SELECT - couponActivityId, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - r.money - ELSE - 0 - END - ), - 0 - ) useMoney, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - 1 - ELSE - 0 - END - ), - 0 - ) useNumber, - COUNT(r.id) number - FROM - t_user_coupon_record r - WHERE - r.activityType = 4 AND r.couponUseType=0 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - GROUP BY couponActivityId - ) c1 ON c1.couponActivityId=b.id - LEFT JOIN ( - SELECT - couponActivityId, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - r.money - ELSE - 0 - END - ), - 0 - ) useMoney, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - 1 - ELSE - 0 - END - ), - 0 - ) useNumber, - COUNT(r.id) number - FROM - t_user_coupon_record r - WHERE - r.activityType = 4 AND r.couponUseType=1 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - GROUP BY couponActivityId - ) c2 ON c2.couponActivityId=b.id - LEFT JOIN ( - SELECT - couponActivityId, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - r.money - ELSE - 0 - END - ), - 0 - ) useMoney, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - 1 - ELSE - 0 - END - ), - 0 - ) useNumber, - COUNT(r.id) number - FROM - t_user_coupon_record r - WHERE - r.activityType = 4 AND r.couponUseType=2 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - GROUP BY couponActivityId - ) c3 ON c3.couponActivityId=b.id - LEFT JOIN ( - SELECT - couponActivityId, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - r.money - ELSE - 0 - END - ), - 0 - ) useMoney, - IFNULL( - SUM( - CASE - WHEN r.state = 2 THEN - 1 - ELSE - 0 - END - ), - 0 - ) useNumber, - COUNT(r.id) number - FROM - t_user_coupon_record r - WHERE - r.activityType = 4 AND r.couponUseType=4 - <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> - and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) - </if> - GROUP BY couponActivityId - ) c4 ON c4.couponActivityId=b.id - WHERE - b.userActivityId = #{activityId} - </select> - - - <select id="queryCouponRegister" resultType="map"> - select - da.time, - sum(da.receivePeople) as receivePeople, - sum(da.giving) as giving, - (sum(da.receivePeople) + sum(da.giving)) as receive, - sum(da.receiveMoney) as receiveMoney, - sum(da.usePeople) as usePeople, - sum(da.`use`) as `use`, - sum(da.useMoney) as useMoney - from ( - select - aa.time, - count(aa.userId) as receivePeople, - 0 as giving, - sum(aa.receiveMoney) as receiveMoney, - 0 as usePeople, - 0 as `use`, - 0 as useMoney - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="4 == type"> - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - where a.activityType = #{type} - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - union all - - select - aa.time, - 0, - 0, - 0, - count(aa.userId) as usePeople, - sum(aa.receive) as `use`, - sum(aa.receiveMoney) as useMoney - from ( - select - DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="4 == type"> - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - where a.activityType = #{type} and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - <if test="2 == type"> - union all - - select - aa.time, - 0, - count(aa.userId) as giving, - sum(aa.receiveMoney) as receiveMoney, - 0 as usePeople, - 0 as `use`, - 0 as useMoney - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) - where a.activityType = 1 - <if test="null != name and '' != name"> - and b.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and b.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - union all - - select - aa.time, - 0, - 0, - 0, - count(aa.userId) as usePeople, - sum(aa.receive) as `use`, - sum(aa.receiveMoney) as useMoney - from ( - select - DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) - where a.activityType = 1 and a.state = 2 - <if test="null != name and '' != name"> - and b.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and b.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - </if> - ) as da GROUP BY da.time order by da.time desc - <if test="null != offset and null != limit"> - limit #{offset}, #{limit} - </if> - </select> - - - <select id="queryCouponRegisterCount" resultType="int"> - select count(time) from ( - select - count(da.time) as time - from ( - select - aa.time, - count(aa.userId) as receivePeople, - 0 as giving, - sum(aa.receiveMoney) as receiveMoney, - 0 as usePeople, - 0 as `use`, - 0 as useMoney - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="4 == type"> - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - where activityType = #{type} - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - union all - - select - aa.time, - 0, - 0, - 0, - count(aa.userId) as usePeople, - sum(aa.receive) as `use`, - sum(aa.receiveMoney) as useMoney - from ( - select - DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="4 == type"> - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - where a.activityType = #{type} and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(endTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - <if test="2 == type"> - union all - - select - aa.time, - 0, - count(aa.userId) as giving, - sum(aa.receiveMoney) as receiveMoney, - 0 as usePeople, - 0 as `use`, - 0 as useMoney - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) - where a.activityType = 1 - <if test="null != name and '' != name"> - and b.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and b.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - - union all - - select - aa.time, - 0, - 0, - 0, - count(aa.userId) as usePeople, - sum(aa.receive) as `use`, - sum(aa.receiveMoney) as useMoney - from ( - select - DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, - a.userId, - count(a.id) as receive, - sum(a.money) as receiveMoney - from t_user_coupon_record a - left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) - where a.activityType = 1 and a.state = 2 - <if test="null != name and '' != name"> - and b.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and b.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId - ) as aa GROUP BY aa.time - </if> - ) as da GROUP BY da.time - ) as w - </select> - - - <select id="queryCouponRegisterInfo" resultType="map"> - select - a.id as id, - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - d.nickName as userName, - d.phone as phone, - a.money as money, - DATE_FORMAT(a.expirationTime, '%Y-%m-%d %H:%i:%s') as expirationTime, - if(a.couponType = 1, '抵扣券', '满减券') as couponType, - if(a.state = 1, '未使用', if(a.state = 2, '已使用', '已过期')) as state, - DATE_FORMAT(a.endTime, '%Y-%m-%d %H:%i:%s') as endTime - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - left join t_user d on (a.userId = d.id) - where a.activityType = #{type} - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - order by a.insertTime desc - <if test="null != offset and null != limit"> - limit #{offset}, #{limit} - </if> - </select> - - - <select id="queryCouponRegisterInfoCount" resultType="int"> - select - count(a.id) - from t_user_coupon_record a - <if test="2 == type"> - left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - <if test="3 == type"> - left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) - left join t_user_activity c on (b.userActivityId = c.id) - </if> - left join t_user d on (a.userId = d.id) - where a.activityType = #{type} - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - </select> - - - <select id="queryCouponRegisterInfo1" resultType="map"> - select - aa.time, - aa.userId, - any_value(aa.userName) as userName, - any_value(aa.phone) as phone, - sum(aa.amount) as amount, - sum(aa.tyNum) as tyNum, - sum(aa.tyUseNum) as tyUseNum, - sum(aa.tyUseMoney) as tyUseMoney, - sum(aa.zcNum) as zcNum, - sum(aa.zcUseNum) as zcUseNum, - sum(aa.zcUseMoney) as zcUseMoney, - sum(aa.czcNum) as czcNum, - sum(aa.czcUseNum) as czcUseNum, - sum(aa.czcUseMoney) as czcUseMoney, - sum(aa.kcNum) as kcNum, - sum(aa.kcUseNum) as kcUseNum, - sum(aa.kcUseMoney) as kcUseMoney, - sum(aa.xjNum) as xjNum, - sum(aa.xjUseNum) as xjUseNum, - sum(aa.xjUseMoney) as xjUseMoney - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - sum(e.amount) as amount, - count(a.id) as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 0 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - count(a.id) as tyUseNum, - sum(a.money) as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 0 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - count(a.id) as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 1 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - count(a.id) as zcUseNum, - sum(a.money) as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 1 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - count(a.id) as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - count(a.id) as czcUseNum, - sum(a.money) as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 2 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - count(a.id) as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 3 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - count(a.id) as kcUseNum, - sum(a.money) as kcUseMoney, - 0 as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 3 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - count(a.id) as xjNum, - 0 as xjUseNum, - 0 as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 4 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney, - 0 as xjNum, - count(a.id) as xjUseNum, - sum(a.money) as xjUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 4 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - ) as aa GROUP BY aa.time,aa.userId order by aa.time desc - <if test="null != offset and null != limit"> - limit #{offset}, #{limit} - </if> - </select> - - - <select id="queryCouponRegisterInfo1Count" resultType="int"> - select - count(w.time) - from ( - select - aa.time as time - from ( - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - sum(e.amount) as amount, - count(a.id) as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 0 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - count(a.id) as tyUseNum, - sum(a.money) as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 0 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - count(a.id) as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 1 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - count(a.id) as zcUseNum, - sum(a.money) as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 1 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - count(a.id) as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - count(a.id) as czcUseNum, - sum(a.money) as czcUseMoney, - 0 as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 2 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - count(a.id) as kcNum, - 0 as kcUseNum, - 0 as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 3 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - - union all - - select - DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, - a.userId as userId, - d.nickName as userName, - d.phone as phone, - 0 as amount, - 0 as tyNum, - 0 as tyUseNum, - 0 as tyUseMoney, - 0 as zcNum, - 0 as zcUseNum, - 0 as zcUseMoney, - 0 as czcNum, - 0 as czcUseNum, - 0 as czcUseMoney, - 0 as kcNum, - count(a.id) as kcUseNum, - sum(a.money) as kcUseMoney - from t_user_coupon_record a - left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) - left join t_user_activity c on (b.userActivityId = c.id) - left join t_user d on (a.userId = d.id) - left join t_payment_record e on (a.paymentRecordId = e.id) - where a.activityType = 4 and a.couponUseType = 3 and a.state = 2 - <if test="null != name and '' != name"> - and c.`name` like CONCAT('%', #{name}, '%') - </if> - <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} - </if> - <if test="null != companyId"> - and c.companyId = #{companyId} - </if> - GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId - ) as aa GROUP BY aa.time,aa.userId - ) w - </select> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.UserCouponRecord"> + <id column="id" property="id"/> + <result column="money" property="money"/> + <result column="fullMoney" property="fullMoney"/> + <result column="expirationTime" property="expirationTime"/> + <result column="insertTime" property="insertTime"/> + <result column="companyId" property="companyId"/> + <result column="state" property="state"/> + <result column="endTime" property="endTime"/> + <result column="couponUseType" property="couponUseType"/> + <result column="couponType" property="couponType"/> + <result column="userId" property="userId"/> + <result column="couponId" property="couponId"/> + <result column="couponActivityId" property="couponActivityId"/> + <result column="activityType" property="activityType"/> + </resultMap> + + <!-- 通用查询结果列 --> + <sql id="Base_Column_List"> + id + , money, fullMoney, expirationTime, insertTime, companyId, state, couponUseType, couponType, userId, couponId, + couponActivityId, activityType + </sql> + + <select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> + SELECT + c.id, + c.money, + c.fullMoney, + c.expirationTime, + c.insertTime, + c.companyId, + c.state, + c.couponUseType, + c.couponType, + c.userId, + c.couponId, + c.couponActivityId, + c.activityType, + u.nickName, + u.phone, + if(a.id is null, if(b.id is null, if(d.id is null, if(e.id is null, '', e.endServiceTime), d.endServiceTime), + b.endServiceTime), a.endServiceTime) as useTime + FROM + t_user_coupon_record c + LEFT JOIN t_user u ON c.userId = u.id + left join t_order_private_car a on (a.couponId = c.id) + left join t_order_taxi b on (b.couponId = c.id) + left join t_order_cross_city d on (d.couponId = c.id) + left join t_order_logistics e on (e.couponId = c.id) + WHERE 1=1 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (c.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + <if test="userName != null and userName !=''"> + and u.nickName like CONCAT('%',#{userName},'%') + </if> + <if test="activityType != null and activityType !=''"> + and c.activityType=#{activityType} + </if> + <if test="userPhone != null and userPhone !=''"> + and u.phone like CONCAT('%',#{userPhone},'%') + </if> + <if test="couponActivityId != null"> + and c.couponActivityId=#{couponActivityId} + </if> + <if test="state != null and state !=''"> + and c.state=#{state} + </if> + </select> + <select id="getRedList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> + SELECT + c.id, + c.money, + c.endTime as expirationTime, + c.insertTime, + c.companyId, + c.state, + c.userId, + c.redPacketActivityId, + u.nickName, + u.phone, + if(a.id is null, if(b.id is null, if(d.id is null, if(e.id is null, '', e.endServiceTime), d.endServiceTime), + b.endServiceTime), a.endServiceTime) as useTime + FROM + t_user_red_packet_record c + LEFT JOIN t_user u ON c.userId = u.id + left join t_order_private_car a on (a.redPacketId = c.id) + left join t_order_taxi b on (b.redPacketId = c.id) + left join t_order_cross_city d on (d.redPacketId = c.id) + left join t_order_logistics e on (e.redPacketId = c.id) + WHERE 1=1 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (c.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + <if test="userName != null and userName !=''"> + and u.nickName like CONCAT('%',#{userName},'%') + </if> + <if test="userPhone != null and userPhone !=''"> + and u.phone like CONCAT('%',#{userPhone},'%') + </if> + <if test="couponActivityId != null and couponActivityId !=''"> + and c.redPacketActivityId=#{couponActivityId} + </if> + <if test="state != null and state !=''"> + and c.state=#{state} + </if> + </select> + <select id="getCouponStatic" resultType="map"> + select + IFNULL(SUM(aa.money), 0) money, + IFNULL(SUM(aa.useMoney), 0) useMoney, + COUNT(aa.userId) as number + from ( + SELECT + IFNULL(SUM(money), 0) money, + IFNULL(SUM(CASE WHEN state = 2 THEN money ELSE 0 END), 0) useMoney, + userId + FROM t_user_coupon_record WHERE activityType = #{activityType} AND couponActivityId = #{activityId} + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + group by userId + ) as aa + </select> + <select id="getRedStatic" resultType="map"> + SELECT + IFNULL(SUM(aa.money), 0) money, + IFNULL(SUM(aa.useMoney), 0) useMoney, + COUNT(aa.userId) number + FROM + ( + SELECT + IFNULL(SUM(money), 0) money, + IFNULL(SUM(CASE WHEN state = 2 THEN money ELSE 0 END ), 0) useMoney, + userId + FROM + t_user_red_packet_record + WHERE redPacketActivityId = #{activityId} + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + group by userId + ) as aa group by aa.userId + </select> + <select id="getDiscountStatic" resultType="map"> + select count(aa.userId) as number, IFNULL(SUM(aa.money), 0) money from ( + select + a.userId, IFNULL(SUM(a.discountMoney), 0) money + from ( + select userId, discountMoney + from t_order_private_car WHERE activityId = #{activityId} + union all + select userId, discountMoney + from t_order_logistics WHERE activityId = #{activityId} + ) as a group by a.userId + ) as aa + </select> + <select id="getDiscountStatic1" resultType="map"> + SELECT IFNULL(SUM(aa.money), 0) money, COUNT(aa.userId) number + FROM (select IFNULL(SUM(discountMoney), 0) money, userId + from t_order_logistics + WHERE activityId = #{activityId} + group by userId) as aa + </select> + <select id="getRegStatic" resultType="map"> + SELECT + IFNULL(SUM(r.money), 0) money, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + r.money + ELSE + 0 + END + ), + 0 + ) useMoney, + COUNT(r.id) number + FROM + t_user_coupon_record r + LEFT JOIN t_user_activity_balance u ON u.id = r.couponActivityId + WHERE + u.userActivityId = #{activityId} and r.activityType =4 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + </select> + <select id="getBlanceList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> + SELECT + b.id, + b.money, + c1.number,c1.useMoney,c1.useNumber, + c2.number speNumber,c2.useMoney speUserMoney,c2.useNumber speUseNumber, + c3.number taxiNumber,c3.useMoney taxiUserMoney,c3.useNumber taxiUseNumber, + c4.number intercityNumber,c4.useMoney intercityUserMoney,c4.useNumber intercityUseNumber + FROM + t_user_activity_balance b + LEFT JOIN ( + SELECT + couponActivityId, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + r.money + ELSE + 0 + END + ), + 0 + ) useMoney, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + 1 + ELSE + 0 + END + ), + 0 + ) useNumber, + COUNT(r.id) number + FROM + t_user_coupon_record r + WHERE + r.activityType = 4 AND r.couponUseType=0 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + GROUP BY couponActivityId + ) c1 ON c1.couponActivityId=b.id + LEFT JOIN ( + SELECT + couponActivityId, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + r.money + ELSE + 0 + END + ), + 0 + ) useMoney, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + 1 + ELSE + 0 + END + ), + 0 + ) useNumber, + COUNT(r.id) number + FROM + t_user_coupon_record r + WHERE + r.activityType = 4 AND r.couponUseType=1 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + GROUP BY couponActivityId + ) c2 ON c2.couponActivityId=b.id + LEFT JOIN ( + SELECT + couponActivityId, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + r.money + ELSE + 0 + END + ), + 0 + ) useMoney, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + 1 + ELSE + 0 + END + ), + 0 + ) useNumber, + COUNT(r.id) number + FROM + t_user_coupon_record r + WHERE + r.activityType = 4 AND r.couponUseType=2 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + GROUP BY couponActivityId + ) c3 ON c3.couponActivityId=b.id + LEFT JOIN ( + SELECT + couponActivityId, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + r.money + ELSE + 0 + END + ), + 0 + ) useMoney, + IFNULL( + SUM( + CASE + WHEN r.state = 2 THEN + 1 + ELSE + 0 + END + ), + 0 + ) useNumber, + COUNT(r.id) number + FROM + t_user_coupon_record r + WHERE + r.activityType = 4 AND r.couponUseType=4 + <if test="beginTime != null and beginTime !='' and endTime != null and endTime != ''"> + and (r.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) + </if> + GROUP BY couponActivityId + ) c4 ON c4.couponActivityId=b.id + WHERE + b.userActivityId = #{activityId} + </select> + + + <select id="queryCouponRegister" resultType="map"> + select + da.time, + sum(da.receivePeople) as receivePeople, + sum(da.giving) as giving, + (sum(da.receivePeople) + sum(da.giving)) as receive, + sum(da.receiveMoney) as receiveMoney, + sum(da.usePeople) as usePeople, + sum(da.`use`) as `use`, + sum(da.useMoney) as useMoney + from ( + select + aa.time, + count(aa.userId) as receivePeople, + 0 as giving, + sum(aa.receiveMoney) as receiveMoney, + 0 as usePeople, + 0 as `use`, + 0 as useMoney + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="4 == type"> + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + where a.activityType = #{type} + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="4 == type"> + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + where a.activityType = #{type} and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + <if test="2 == type"> + union all + + select + aa.time, + 0, + count(aa.userId) as giving, + sum(aa.receiveMoney) as receiveMoney, + 0 as usePeople, + 0 as `use`, + 0 as useMoney + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + </if> + ) as da GROUP BY da.time order by da.time desc + <if test="null != offset and null != limit"> + limit #{offset}, #{limit} + </if> + </select> + + + <select id="queryCouponRegisterCount" resultType="int"> + select count(time) from ( + select + count(da.time) as time + from ( + select + aa.time, + count(aa.userId) as receivePeople, + 0 as giving, + sum(aa.receiveMoney) as receiveMoney, + 0 as usePeople, + 0 as `use`, + 0 as useMoney + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="4 == type"> + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + where activityType = #{type} + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="4 == type"> + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + where a.activityType = #{type} and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(endTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + <if test="2 == type"> + union all + + select + aa.time, + 0, + count(aa.userId) as giving, + sum(aa.receiveMoney) as receiveMoney, + 0 as usePeople, + 0 as `use`, + 0 as useMoney + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + </if> + ) as da GROUP BY da.time + ) as w + </select> + + + <select id="queryCouponRegisterInfo" resultType="map"> + select + a.id as id, + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + d.nickName as userName, + d.phone as phone, + a.money as money, + DATE_FORMAT(a.expirationTime, '%Y-%m-%d %H:%i:%s') as expirationTime, + if(a.couponType = 1, '抵扣券', '满减券') as couponType, + if(a.state = 1, '未使用', if(a.state = 2, '已使用', '已过期')) as state, + DATE_FORMAT(a.endTime, '%Y-%m-%d %H:%i:%s') as endTime + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + left join t_user d on (a.userId = d.id) + where a.activityType = #{type} + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + order by a.insertTime desc + <if test="null != offset and null != limit"> + limit #{offset}, #{limit} + </if> + </select> + + + <select id="queryCouponRegisterInfoCount" resultType="int"> + select + count(a.id) + from t_user_coupon_record a + <if test="2 == type"> + left join t_user_activity_registered b on (a.couponActivityId = b.id and a.activityType = 2) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + <if test="3 == type"> + left join t_user_activity_invite b on (a.couponActivityId = b.id and a.activityType = 3) + left join t_user_activity c on (b.userActivityId = c.id) + </if> + left join t_user d on (a.userId = d.id) + where a.activityType = #{type} + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + </select> + + + <select id="queryCouponRegisterInfo1" resultType="map"> + select + aa.time, + aa.userId, + any_value(aa.userName) as userName, + any_value(aa.phone) as phone, + sum(aa.amount) as amount, + sum(aa.tyNum) as tyNum, + sum(aa.tyUseNum) as tyUseNum, + sum(aa.tyUseMoney) as tyUseMoney, + sum(aa.zcNum) as zcNum, + sum(aa.zcUseNum) as zcUseNum, + sum(aa.zcUseMoney) as zcUseMoney, + sum(aa.czcNum) as czcNum, + sum(aa.czcUseNum) as czcUseNum, + sum(aa.czcUseMoney) as czcUseMoney, + sum(aa.kcNum) as kcNum, + sum(aa.kcUseNum) as kcUseNum, + sum(aa.kcUseMoney) as kcUseMoney, + sum(aa.xjNum) as xjNum, + sum(aa.xjUseNum) as xjUseNum, + sum(aa.xjUseMoney) as xjUseMoney + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + sum(e.amount) as amount, + count(a.id) as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 0 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + count(a.id) as tyUseNum, + sum(a.money) as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 0 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + count(a.id) as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 1 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + count(a.id) as zcUseNum, + sum(a.money) as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + count(a.id) as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + count(a.id) as czcUseNum, + sum(a.money) as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 2 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + count(a.id) as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 3 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + count(a.id) as kcUseNum, + sum(a.money) as kcUseMoney, + 0 as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 3 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + count(a.id) as xjNum, + 0 as xjUseNum, + 0 as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 4 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney, + 0 as xjNum, + count(a.id) as xjUseNum, + sum(a.money) as xjUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 4 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + ) as aa GROUP BY aa.time,aa.userId order by aa.time desc + <if test="null != offset and null != limit"> + limit #{offset}, #{limit} + </if> + </select> + + + <select id="queryCouponRegisterInfo1Count" resultType="int"> + select + count(w.time) + from ( + select + aa.time as time + from ( + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + sum(e.amount) as amount, + count(a.id) as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 0 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + count(a.id) as tyUseNum, + sum(a.money) as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 0 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + count(a.id) as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 1 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + count(a.id) as zcUseNum, + sum(a.money) as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + count(a.id) as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + count(a.id) as czcUseNum, + sum(a.money) as czcUseMoney, + 0 as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 2 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + count(a.id) as kcNum, + 0 as kcUseNum, + 0 as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 3 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + + union all + + select + DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as time, + a.userId as userId, + d.nickName as userName, + d.phone as phone, + 0 as amount, + 0 as tyNum, + 0 as tyUseNum, + 0 as tyUseMoney, + 0 as zcNum, + 0 as zcUseNum, + 0 as zcUseMoney, + 0 as czcNum, + 0 as czcUseNum, + 0 as czcUseMoney, + 0 as kcNum, + count(a.id) as kcUseNum, + sum(a.money) as kcUseMoney + from t_user_coupon_record a + left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) + left join t_user_activity c on (b.userActivityId = c.id) + left join t_user d on (a.userId = d.id) + left join t_payment_record e on (a.paymentRecordId = e.id) + where a.activityType = 4 and a.couponUseType = 3 and a.state = 2 + <if test="null != name and '' != name"> + and c.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and c.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s'),a.userId + ) as aa GROUP BY aa.time,aa.userId + ) w + </select> </mapper> diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java index 936a699..084b822 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityDiscount1ServiceImpl.java @@ -1,19 +1,17 @@ package com.stylefeng.guns.modular.system.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.core.util.ToolUtil; +import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; import com.stylefeng.guns.modular.system.model.TEmail; import com.stylefeng.guns.modular.system.model.TUser; -import com.stylefeng.guns.modular.system.model.User; import com.stylefeng.guns.modular.system.model.UserActivityDiscount1; -import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; import com.stylefeng.guns.modular.system.service.ITCompanyService; import com.stylefeng.guns.modular.system.service.ITUserService; import com.stylefeng.guns.modular.system.service.IUserActivityDiscount1Service; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.modular.system.service.TEmailService; import com.stylefeng.guns.modular.system.util.EmailUtil; -import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.HorizontalAlignment; @@ -27,12 +25,9 @@ import javax.annotation.Resource; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.FileWriter; import java.math.BigDecimal; import java.math.RoundingMode; -import java.text.SimpleDateFormat; import java.util.*; /** @@ -387,12 +382,12 @@ EmailUtil.send(user.getEmail(), "Activités à rabais", document1.html()); } //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/discount_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/discount_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java index 0cd525e..279ce39 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserActivityServiceImpl.java @@ -308,9 +308,12 @@ @Override public Map<String, Object> queryUserActivityList(Integer uid, Date start, Date end, String name, Integer status, Integer offset, Integer limit) { Map<String, Object> map = new HashMap<>(); - Integer objectId = userService.selectById(uid).getObjectId(); - List<Map<String, Object>> list = userActivityMapper.queryUserActivityList(objectId, start, end, name, status, offset, limit); - int i = userActivityMapper.queryUserActivityListCount(objectId, start, end, name, status); + Integer companyId = null; + if(1 != ShiroKit.getUser().getRoleType()){ + companyId = ShiroKit.getUser().getObjectId(); + } + List<Map<String, Object>> list = userActivityMapper.queryUserActivityList(companyId, start, end, name, status, offset, limit); + int i = userActivityMapper.queryUserActivityListCount(companyId, start, end, name, status); map.put("rows", list); map.put("total", i); return map; diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java index 57d8338..6b5e89d 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/GoogleCloudStorageUtil.java @@ -1,5 +1,6 @@ package com.stylefeng.guns.modular.system.util; +import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.WriteChannel; import com.google.cloud.storage.*; import org.springframework.web.multipart.MultipartFile; @@ -19,6 +20,10 @@ public static String upload(MultipartFile file){ + + + + // The ID of your GCP project // String projectId = "your-project-id"; @@ -33,7 +38,19 @@ String fileName = file.getOriginalFilename(); String projectId = "i-go-gcp"; String bucketName = "i-go"; - Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService(); + GoogleCredentials defaultCredentials = null; + try { + defaultCredentials = GoogleCredentials.getApplicationDefault(); + } catch (IOException e) { + throw new RuntimeException(e); + } + defaultCredentials.createScoped("https://www.googleapis.com/auth/cloud-platform"); + Storage storage = StorageOptions + .newBuilder() + .setProjectId(projectId) + .setCredentials(defaultCredentials) + .build() + .getService(); BlobId blobId = BlobId.of(bucketName, fileName); BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java index 97857c2..328c227 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java @@ -1,8 +1,12 @@ package com.stylefeng.guns.modular.system.util; +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.texttospeech.v1.*; import com.google.protobuf.ByteString; +import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; @@ -22,8 +26,13 @@ * @throws Exception */ public static String create(String languageCode, String text, String fileName) throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { + GoogleCredentials googleCredentials = GoogleCredentials + .fromStream(new FileInputStream("/home/igotechgh/i-go-gcp-f83e2d02152a.json")) + .createScoped("https://www.googleapis.com/auth/cloud-platform"); + + FixedCredentialsProvider provider = FixedCredentialsProvider.create(googleCredentials); + TextToSpeechSettings textToSpeechSettings = TextToSpeechSettings.newBuilder().setCredentialsProvider(provider).build(); + try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create(textToSpeechSettings)) { // Set the text input to be synthesized SynthesisInput input = SynthesisInput.newBuilder().setText(text).build(); @@ -48,7 +57,11 @@ ByteString audioContents = response.getAudioContent(); // Write the response to the output file. - try (OutputStream out = new FileOutputStream("/home/igotechgh/nginx/html/files/audio/" + fileName)) { + File file = new File("/data/nginx/html/files/audio/" + fileName); + if (!file.exists()) { + file.createNewFile(); + } + try (OutputStream out = new FileOutputStream("/data/nginx/html/files/audio/" + fileName)) { out.write(audioContents.toByteArray()); return "https://igo.i-go.group/files/audio/" + fileName; }catch (Exception e){ diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java index 1905e9d..233d298 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/quartz/jobs/OrderTimeOutJob.java @@ -53,6 +53,10 @@ @Resource private QuartzUtil quartzUtil; + @Override + public void execute(JobExecutionContext jobExecutionContext){ + run(jobExecutionContext); + } /** * 执行的业务逻辑 @@ -180,7 +184,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -225,12 +229,6 @@ System.err.println(jsonObject1.getString("msg")); } - } - - - @Override - public void execute(JobExecutionContext jobExecutionContext){ - run(jobExecutionContext); } diff --git a/ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml b/ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml index 81f9224..b482c1c 100644 --- a/ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml +++ b/ManagementIGOTravel/guns-admin/src/main/resources/application-dev.yml @@ -110,7 +110,7 @@ socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 debug: true from: i-gotech@i-go.group # 发送方邮件,配在yml中可方便更改 - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- #支付回调地址 diff --git a/ManagementIGOTravel/guns-admin/src/main/resources/application-produce.yml b/ManagementIGOTravel/guns-admin/src/main/resources/application-produce.yml index f4c7b2b..7d26b3c 100644 --- a/ManagementIGOTravel/guns-admin/src/main/resources/application-produce.yml +++ b/ManagementIGOTravel/guns-admin/src/main/resources/application-produce.yml @@ -31,8 +31,8 @@ max-file-size: 100MB redis: database: 0 - host: 127.0.0.1 - port: 16379 + host: 172.17.0.3 + port: 6379 password: mPMHThYzlT8DWgl8HLqwPEyPOiHDPPB5 mybatis-plus: @@ -53,19 +53,6 @@ password: _6)S]<vpfvj?N#t2 db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat - - -#多数据源情况的配置 -guns: - muti-datasource: - open: false - url: jdbc:mysql://120.24.34.190:3306/mask?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 - username: root - password: Root2020! - dataSourceNames: - - dataSourceGuns - - dataSourceBiz - --- @@ -109,7 +96,7 @@ socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 debug: true from: i-gotech@i-go.group # 发送方邮件,配在yml中可方便更改 - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- #支付回调地址 diff --git a/ManagementIGOTravel/guns-admin/src/main/resources/application-test.yml b/ManagementIGOTravel/guns-admin/src/main/resources/application-test.yml index 5da98f5..0650cee 100644 --- a/ManagementIGOTravel/guns-admin/src/main/resources/application-test.yml +++ b/ManagementIGOTravel/guns-admin/src/main/resources/application-test.yml @@ -103,7 +103,7 @@ socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 debug: true from: i-gotech@i-go.group # 发送方邮件,配在yml中可方便更改 - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- #支付回调地址 diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/couponStatistics.html b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/couponStatistics.html index 1742b48..7029478 100644 --- a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/couponStatistics.html +++ b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/report/couponStatistics.html @@ -3,7 +3,7 @@ <div class="col-sm-12"> <div class="ibox float-e-margins"> <div class="ibox-title"> - <h5>优惠券管理</h5> + <h5>用户端补贴领用情况</h5> </div> <div class="ibox-content"> <div class="row row-lg"> diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/driverActivity/driverActivity.js b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/driverActivity/driverActivity.js index ffebea4..986e293 100644 --- a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/driverActivity/driverActivity.js +++ b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/driverActivity/driverActivity.js @@ -143,10 +143,14 @@ DriverActivity.updateStatus = function () { if (this.check(3)) { var ajax = new $ax(Feng.ctxPath + "/driverActivity/updateStatus", function (data) { - Feng.success("启动/暂停成功!"); - DriverActivity.table.refresh(); + if(200 == data.code){ + Feng.success("启动/暂停成功!"); + DriverActivity.table.refresh(); + }else{ + Feng.error(data.msg); + } }, function (data) { - Feng.error("动/暂停失败!" + data.responseJSON.message + "!"); + Feng.error("启动/暂停失败!" + data.responseJSON.message + "!"); }); ajax.set("id",this.seItem.id); ajax.set("status",this.seItem.status==3?4:3); diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/userActivity/userActivity.js b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/userActivity/userActivity.js index e147f72..bd3acf5 100644 --- a/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/userActivity/userActivity.js +++ b/ManagementIGOTravel/guns-admin/src/main/webapp/static/modular/system/userActivity/userActivity.js @@ -150,8 +150,12 @@ UserActivity.updateStatus = function () { if (this.check(3)) { var ajax = new $ax(Feng.ctxPath + "/userActivity/updateStatus", function (data) { - Feng.success("启动/暂停成功!"); - UserActivity.table.refresh(); + if(200 == data.code){ + Feng.success("启动/暂停成功!"); + UserActivity.table.refresh(); + }else{ + Feng.error(data.msg); + } }, function (data) { Feng.error("动/暂停失败!" + data.responseJSON.message + "!"); }); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index 8af12cd..1e5ae5f 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -136,6 +136,4 @@ return ResultUtil.runErr(); } } - - } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java index b668c36..4e745f5 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/UserInfoController.java @@ -300,12 +300,12 @@ EmailUtil.send(email, language == 1 ? "邮箱验证" : language == 2 ? "Verification code" : "Code de validation", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/mainbox_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/mainbox_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1343,10 +1343,10 @@ ServletOutputStream outputStream = null; try { if(orderType == 1){ - fileInputStream = new FileInputStream(new File("/home/igotechgh/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf")); + fileInputStream = new FileInputStream(new File("/data/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf")); } if(orderType == 4){ - fileInputStream = new FileInputStream(new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf")); + fileInputStream = new FileInputStream(new File("/data/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf")); } BufferedInputStream bf = new BufferedInputStream(fileInputStream); outputStream = response.getOutputStream(); @@ -1411,7 +1411,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName + ".mp3"); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName + ".mp3"); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java index a717a23..f082ed2 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/controller/OrderLogisticsController.java @@ -428,7 +428,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index 188670a..daf0d7a 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -606,7 +606,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -883,7 +883,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -1016,7 +1016,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -1448,7 +1448,7 @@ // Element track_chinese = document.getElementById("track_chinese"); // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_chinese = document.getElementById("pay_time_chinese"); - pay_time_chinese.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_chinese.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_chinese = document.getElementsByClass("driver_chinese"); for (int i = 0; i < driver_chinese.size(); i++) { Element element = driver_chinese.get(i); @@ -1558,7 +1558,7 @@ // Element track_english = document.getElementById("track_english"); // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_english = document.getElementById("pay_time_english"); - pay_time_english.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_english.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_english = document.getElementsByClass("driver_english"); for (int i = 0; i < driver_english.size(); i++) { Element element = driver_english.get(i); @@ -1668,7 +1668,7 @@ // Element track_french = document.getElementById("track_french"); // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_french = document.getElementById("pay_time_french"); - pay_time_french.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_french.text(DateUtil.conversionFormat(finalLanguage1, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_french = document.getElementsByClass("driver_french"); for (int i = 0; i < driver_french.size(); i++) { Element element = driver_french.get(i); @@ -1692,11 +1692,11 @@ EmailUtil.send(userInfo.getEmail(), finalLanguage1 == 1 ? "包裹收据" : finalLanguage1 == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1705,17 +1705,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try{ FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); @@ -1961,7 +1961,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -2093,7 +2093,7 @@ // Element track_chinese = document.getElementById("track_chinese"); // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_chinese = document.getElementById("pay_time_chinese"); - pay_time_chinese.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_chinese.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_chinese = document.getElementsByClass("driver_chinese"); for (int i = 0; i < driver_chinese.size(); i++) { Element element = driver_chinese.get(i); @@ -2203,7 +2203,7 @@ // Element track_english = document.getElementById("track_english"); // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_english = document.getElementById("pay_time_english"); - pay_time_english.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_english.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_english = document.getElementsByClass("driver_english"); for (int i = 0; i < driver_english.size(); i++) { Element element = driver_english.get(i); @@ -2313,7 +2313,7 @@ // Element track_french = document.getElementById("track_french"); // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_french = document.getElementById("pay_time_french"); - pay_time_french.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_french.text(DateUtil.conversionFormat(finalLanguage, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_french = document.getElementsByClass("driver_french"); for (int i = 0; i < driver_french.size(); i++) { Element element = driver_french.get(i); @@ -2337,11 +2337,11 @@ EmailUtil.send(userInfo.getEmail(), finalLanguage == 1 ? "包裹收据" : finalLanguage == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/parcel_receipt_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2350,17 +2350,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/parcel_receipt_" + orderId + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try{ FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/parcel_receipt_" + orderId + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); @@ -2749,7 +2749,7 @@ // Element track_chinese = document.getElementById("track_chinese"); // track_chinese.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_chinese = document.getElementById("pay_time_chinese"); - pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_chinese.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_chinese = document.getElementsByClass("driver_chinese"); for (int i = 0; i < driver_chinese.size(); i++) { Element element = driver_chinese.get(i); @@ -2859,7 +2859,7 @@ // Element track_english = document.getElementById("track_english"); // track_english.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_english = document.getElementById("pay_time_english"); - pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_english.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_english = document.getElementsByClass("driver_english"); for (int i = 0; i < driver_english.size(); i++) { Element element = driver_english.get(i); @@ -2969,7 +2969,7 @@ // Element track_french = document.getElementById("track_french"); // track_french.attr("href", "https://igo.i-go.group/mailbox/user/location.html"); Element pay_time_french = document.getElementById("pay_time_french"); - pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getTravelTime()))); + pay_time_french.text(DateUtil.conversionFormat(language, sdf1.format(orderLogistics.getEndServiceTime()))); Elements driver_french = document.getElementsByClass("driver_french"); for (int i = 0; i < driver_french.size(); i++) { Element element = driver_french.get(i); @@ -2993,11 +2993,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "包裹收据" : language == 2 ? "Delivery receipt" : "Reçu de livraison", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + id + ".html"); + file = new File("/data/nginx/html/files/html/parcel_receipt_" + id + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -3006,17 +3006,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/parcel_receipt_" + id + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/parcel_receipt_" + id + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try{ FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/parcel_receipt_" + id + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/parcel_receipt_" + id + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); @@ -3249,7 +3249,9 @@ } } } - + if(null == lon || null == lat){ + return ResultUtil.error(language == 1 ? "无效的经纬度" : language == 2 ? "Invalid longitude and latitude" : "Longitude et latitude non valides"); + } language = userInfoService.queryLanguage(uid, language); OrderLogistics orderLogistics = this.selectById(id); Integer integer = null; @@ -3961,11 +3963,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/redpacket_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/redpacket_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index 5cd66b3..185eefa 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -482,7 +482,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -615,7 +615,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -819,7 +819,9 @@ } } } - + if(null == lon || null == lat){ + return ResultUtil.error(language == 1 ? "无效的经纬度" : language == 2 ? "Invalid longitude and latitude" : "Longitude et latitude non valides"); + } language = userInfoService.queryLanguage(uid, language); OrderPrivateCar orderPrivateCar = this.selectById(id); Integer integer = null; @@ -1171,7 +1173,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -1307,7 +1309,7 @@ if(null != query2){ Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()) .eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); - if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ + if(query2.getDistance() * 1000 > orderPrivateCar.getMileage() && query2.getOrderNum().compareTo(orderNum) > 0){ Double special = query2.getSpecial(); if(null != special){ orderPrivateCar.setDiscount(special); @@ -1853,11 +1855,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "打车收据" : language == 2 ? "Ride receipt" : "Reçu de course", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/ride_receipt_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/ride_receipt_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1866,17 +1868,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try { FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/ride_receipt_" + orderId + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/ride_receipt_" + orderId + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); @@ -2446,11 +2448,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "打车收据" : language == 2 ? "Ride receipt" : "Reçu de course", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/ride_receipt_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/ride_receipt_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2459,17 +2461,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/ride_receipt_" + orderId + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try { FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/ride_receipt_" + orderId + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/ride_receipt_" + orderId + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); @@ -2535,7 +2537,7 @@ public void run() { try { // 使用Runtime执行命令 - Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName); + Process process = Runtime.getRuntime().exec("sudo rm -rf /data/nginx/html/files/audio/" + fileName); // 读取命令的输出 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; @@ -2672,11 +2674,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/redpacket_" + orderId + ".html"); + file = new File("/data/nginx/html/files/html/redpacket_" + orderId + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -3178,11 +3180,11 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "打车收据" : language == 2 ? "Ride receipt" : "Reçu de course", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } - file = new File("/home/igotechgh/nginx/html/files/html/ride_receipt_" + id + ".html"); + file = new File("/data/nginx/html/files/html/ride_receipt_" + id + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -3191,17 +3193,17 @@ fileWriter.flush(); fileWriter.close(); - File file1 = new File("/home/igotechgh/nginx/html/files/pdf/"); + File file1 = new File("/data/nginx/html/files/pdf/"); if(!file1.exists()){ file1.mkdirs(); } - file1 = new File("/home/igotechgh/nginx/html/files/pdf/ride_receipt_" + id + ".pdf"); + file1 = new File("/data/nginx/html/files/pdf/ride_receipt_" + id + ".pdf"); if(!file1.exists()){ file1.createNewFile(); } try { FileOutputStream fileOutputStream = new FileOutputStream(file1); - HtmlToPdfUtils.convertToPdf("/home/igotechgh/nginx/html/files/html/ride_receipt_" + id + ".html", "I-GO", fileOutputStream); + HtmlToPdfUtils.convertToPdf("/data/nginx/html/files/html/ride_receipt_" + id + ".html", "I-GO", fileOutputStream); }catch (Exception e){ e.printStackTrace(); System.out.println("html转pdf异常"); diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java index fa0a672..e20b9fc 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ComplaintServiceImpl.java @@ -105,12 +105,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "投诉司机" : language == 2 ? "Complain against driver" : "Porter plainte contre le chauffeur", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/complain_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/complain_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java index 055d0c8..a74b238 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/FeedbackServiceImpl.java @@ -112,12 +112,12 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "反馈意见" : language == 2 ? "Feedback" : "Avis", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/feedback_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/feedback_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java index 6bb89cf..2d00b69 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReportLossServiceImpl.java @@ -125,12 +125,12 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "物品报失" : language == 2 ? "Report items lost" : "Signaler l'objet perdu", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/reportLoss_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/reportLoss_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java index 2e753be..211bd79 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/UserInfoServiceImpl.java @@ -272,12 +272,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Registered successfully" : "Enregistré avec succès", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/registration_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/registration_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -320,94 +320,96 @@ driverActivityHistoryMapper.updateById(driverActivityHistory); } - driver.setActivityMoney(bigDecimal.add(new BigDecimal(driver.getActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - driver.setLaveActivityMoney(bigDecimal.add(new BigDecimal(driver.getLaveActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - driver.setBalance(bigDecimal.add(new BigDecimal(driver.getBalance())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - driverMapper.updateById(driver); - - if(ToolUtil.isNotEmpty(driver.getEmail())){ - String path1 = templatePath + "driver/index.html"; - Document document1 = Jsoup.parse(new File(path1), "UTF-8"); - if(1 == language){ - document1.getElementById("english").remove(); - document1.getElementById("french").remove(); - document1.getElementById("invite").remove(); - document1.getElementById("settle").remove(); - document1.getElementById("pass").remove(); - document1.getElementById("bill").remove(); - document1.getElementById("reward").remove(); - document1.getElementById("rewardToday").remove(); - - document1.getElementsByTag("title").get(0).text("司机奖励通知"); - Element user_user = document1.getElementById("user_user"); - user_user.text("您好 " + driver.getFirstName() + " " + driver.getLastName() + ","); - Element user_content = document1.getElementById("user_content"); - user_content.text("您已成功邀请一位用户注册I-GO,获得奖励GHS " + bigDecimal.doubleValue() + ",请查收"); + if(bigDecimal.compareTo(BigDecimal.ZERO) > 0){ + driver.setActivityMoney(bigDecimal.add(new BigDecimal(driver.getActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + driver.setLaveActivityMoney(bigDecimal.add(new BigDecimal(driver.getLaveActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + driver.setBalance(bigDecimal.add(new BigDecimal(driver.getBalance())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + driverMapper.updateById(driver); + + if(ToolUtil.isNotEmpty(driver.getEmail())){ + String path1 = templatePath + "driver/index.html"; + Document document1 = Jsoup.parse(new File(path1), "UTF-8"); + if(1 == language){ + document1.getElementById("english").remove(); + document1.getElementById("french").remove(); + document1.getElementById("invite").remove(); + document1.getElementById("settle").remove(); + document1.getElementById("pass").remove(); + document1.getElementById("bill").remove(); + document1.getElementById("reward").remove(); + document1.getElementById("rewardToday").remove(); + + document1.getElementsByTag("title").get(0).text("司机奖励通知"); + Element user_user = document1.getElementById("user_user"); + user_user.text("您好 " + driver.getFirstName() + " " + driver.getLastName() + ","); + Element user_content = document1.getElementById("user_content"); + user_content.text("您已成功邀请一位用户注册I-GO,获得奖励GHS " + bigDecimal.doubleValue() + ",请查收"); + } + if(2 == language){ + document1.getElementById("chinese").remove(); + document1.getElementById("french").remove(); + document1.getElementById("invite1").remove(); + document1.getElementById("settle1").remove(); + document1.getElementById("pass1").remove(); + document1.getElementById("bill1").remove(); + document1.getElementById("reward1").remove(); + document1.getElementById("rewardToday1").remove(); + + document1.getElementsByTag("title").get(0).text("Reward-driver notice"); + Element user1_user = document1.getElementById("user1_user"); + user1_user.text("Hello " + driver.getFirstName() + " " + driver.getLastName() + ","); + Element user1_content = document1.getElementById("user1_content"); + user1_content.text("You have succeeded to invite a rider to register with I-GO, so you received a GHS " + bigDecimal.doubleValue() + " bonus, please check your balance."); + } + if(3 == language){ + document1.getElementById("chinese").remove(); + document1.getElementById("english").remove(); + document1.getElementById("invite1").remove(); + document1.getElementById("settle1").remove(); + document1.getElementById("pass1").remove(); + document1.getElementById("bill1").remove(); + document1.getElementById("reward1").remove(); + document1.getElementById("rewardToday1").remove(); + + document1.getElementsByTag("title").get(0).text("Avis de chauffeur de récompense"); + Element user2_user = document1.getElementById("user2_user"); + user2_user.text("Bonjour " + driver.getFirstName() + " " + driver.getLastName() + ","); + Element user2_content = document1.getElementById("user2_content"); + user2_content.text("Vous avez invité avec succès un utilisateur à s’inscrire à i-go pour recevoir une récompense GHS " + bigDecimal.doubleValue() + ". Veuillez vérifier"); + } + EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); + //开始生成pdf收据和html收据 + File file = new File("/data/nginx/html/files/html/"); + if(!file.exists()){ + file.mkdirs(); + } + String randomString = ToolUtil.getRandomString(10); + file = new File("/data/nginx/html/files/html/invitation_" + randomString + ".html"); + if(!file.exists()){ + file.createNewFile(); + } + FileWriter fileWriter = new FileWriter(file); + fileWriter.write(document1.html()); + fileWriter.flush(); + fileWriter.close(); + + String link ="https://igo.i-go.group/files/html/invitation_" + randomString + ".html"; + TEmail tEmail = new TEmail(); + tEmail.setLink(link); + tEmail.setUserId(driver.getId()); + tEmail.setType(2); + tEmail.setName(language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense"); + tEmail.setCreateTime(new Date()); + int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; + tEmail.setWeek(EmailUtil.getWeek(language,i)); + boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); + if(am){ + tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); + }else { + tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); + } + emailService.insert(tEmail); } - if(2 == language){ - document1.getElementById("chinese").remove(); - document1.getElementById("french").remove(); - document1.getElementById("invite1").remove(); - document1.getElementById("settle1").remove(); - document1.getElementById("pass1").remove(); - document1.getElementById("bill1").remove(); - document1.getElementById("reward1").remove(); - document1.getElementById("rewardToday1").remove(); - - document1.getElementsByTag("title").get(0).text("Reward-driver notice"); - Element user1_user = document1.getElementById("user1_user"); - user1_user.text("Hello " + driver.getFirstName() + " " + driver.getLastName() + ","); - Element user1_content = document1.getElementById("user1_content"); - user1_content.text("You have succeeded to invite a rider to register with I-GO, so you received a GHS " + bigDecimal.doubleValue() + " bonus, please check your balance."); - } - if(3 == language){ - document1.getElementById("chinese").remove(); - document1.getElementById("english").remove(); - document1.getElementById("invite1").remove(); - document1.getElementById("settle1").remove(); - document1.getElementById("pass1").remove(); - document1.getElementById("bill1").remove(); - document1.getElementById("reward1").remove(); - document1.getElementById("rewardToday1").remove(); - - document1.getElementsByTag("title").get(0).text("Avis de chauffeur de récompense"); - Element user2_user = document1.getElementById("user2_user"); - user2_user.text("Bonjour " + driver.getFirstName() + " " + driver.getLastName() + ","); - Element user2_content = document1.getElementById("user2_content"); - user2_content.text("Vous avez invité avec succès un utilisateur à s’inscrire à i-go pour recevoir une récompense GHS " + bigDecimal.doubleValue() + ". Veuillez vérifier"); - } - EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); - //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); - if(!file.exists()){ - file.mkdirs(); - } - String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/invitation_" + randomString + ".html"); - if(!file.exists()){ - file.createNewFile(); - } - FileWriter fileWriter = new FileWriter(file); - fileWriter.write(document1.html()); - fileWriter.flush(); - fileWriter.close(); - - String link ="https://igo.i-go.group/files/html/invitation_" + randomString + ".html"; - TEmail tEmail = new TEmail(); - tEmail.setLink(link); - tEmail.setUserId(driver.getId()); - tEmail.setType(2); - tEmail.setName(language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense"); - tEmail.setCreateTime(new Date()); - int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1; - tEmail.setWeek(EmailUtil.getWeek(language,i)); - boolean am = cn.hutool.core.date.DateUtil.isAM(new Date()); - if(am){ - tEmail.setAmOrPm(language==1?"上午":language==2?"morning":"matin"); - }else { - tEmail.setAmOrPm(language==1?"下午":language==2?"afternoon":"après-midi"); - } - emailService.insert(tEmail); } } @@ -506,12 +508,12 @@ } EmailUtil.send(userInfo1.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -626,12 +628,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Registered successfully" : "Enregistré avec succès", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/registration_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/registration_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -737,12 +739,12 @@ } EmailUtil.send(driver.getEmail(), language == 1 ? "司机奖励通知" : language == 2 ? "Reward-driver notice" : "Avis de chauffeur de récompense", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/invitation_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/invitation_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -879,12 +881,12 @@ } EmailUtil.send(userInfo1.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1090,12 +1092,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Registered successfully" : "Enregistré avec succès", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/registration_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/registration_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1238,12 +1240,12 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1388,12 +1390,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "注册成功" : language == 2 ? "Registered successfully" : "Enregistré avec succès", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/registration_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/registration_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1533,12 +1535,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -1893,12 +1895,12 @@ EmailUtil.send(userInfo.getEmail(), language == 1 ? "重置密码" : language == 2 ? "Reset password" : "Réinitialiser le mot de passe", document.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/password_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/password_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2207,12 +2209,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } @@ -2374,12 +2376,12 @@ } EmailUtil.send(userInfo.getEmail(), language == 1 ? "优惠券到账" : language == 2 ? "Coupon is in" : "Le coupon est arrivé sur le compte", document1.html()); //开始生成pdf收据和html收据 - File file = new File("/home/igotechgh/nginx/html/files/html/"); + File file = new File("/data/nginx/html/files/html/"); if(!file.exists()){ file.mkdirs(); } String randomString = ToolUtil.getRandomString(10); - file = new File("/home/igotechgh/nginx/html/files/html/coupon_" + randomString + ".html"); + file = new File("/data/nginx/html/files/html/coupon_" + randomString + ".html"); if(!file.exists()){ file.createNewFile(); } diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java index 97857c2..328c227 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/TextToSpeechUtil.java @@ -1,8 +1,12 @@ package com.stylefeng.guns.modular.system.util; +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.texttospeech.v1.*; import com.google.protobuf.ByteString; +import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; @@ -22,8 +26,13 @@ * @throws Exception */ public static String create(String languageCode, String text, String fileName) throws Exception { - // Instantiates a client - try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) { + GoogleCredentials googleCredentials = GoogleCredentials + .fromStream(new FileInputStream("/home/igotechgh/i-go-gcp-f83e2d02152a.json")) + .createScoped("https://www.googleapis.com/auth/cloud-platform"); + + FixedCredentialsProvider provider = FixedCredentialsProvider.create(googleCredentials); + TextToSpeechSettings textToSpeechSettings = TextToSpeechSettings.newBuilder().setCredentialsProvider(provider).build(); + try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create(textToSpeechSettings)) { // Set the text input to be synthesized SynthesisInput input = SynthesisInput.newBuilder().setText(text).build(); @@ -48,7 +57,11 @@ ByteString audioContents = response.getAudioContent(); // Write the response to the output file. - try (OutputStream out = new FileOutputStream("/home/igotechgh/nginx/html/files/audio/" + fileName)) { + File file = new File("/data/nginx/html/files/audio/" + fileName); + if (!file.exists()) { + file.createNewFile(); + } + try (OutputStream out = new FileOutputStream("/data/nginx/html/files/audio/" + fileName)) { out.write(audioContents.toByteArray()); return "https://igo.i-go.group/files/audio/" + fileName; }catch (Exception e){ diff --git a/UserIGOTravel/guns-admin/src/main/resources/application-dev.yml b/UserIGOTravel/guns-admin/src/main/resources/application-dev.yml index 0ef0beb..9c9d08a 100644 --- a/UserIGOTravel/guns-admin/src/main/resources/application-dev.yml +++ b/UserIGOTravel/guns-admin/src/main/resources/application-dev.yml @@ -136,6 +136,6 @@ socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 debug: true from: i-gotech@i-go.group # 发送方邮件,配在yml中可方便更改 - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- diff --git a/UserIGOTravel/guns-admin/src/main/resources/application-produce.yml b/UserIGOTravel/guns-admin/src/main/resources/application-produce.yml index f9767c2..9b7cf1b 100644 --- a/UserIGOTravel/guns-admin/src/main/resources/application-produce.yml +++ b/UserIGOTravel/guns-admin/src/main/resources/application-produce.yml @@ -29,8 +29,8 @@ max-file-size: 100MB redis: database: 0 - host: 127.0.0.1 - port: 16379 + host: 172.17.0.3 + port: 6379 password: mPMHThYzlT8DWgl8HLqwPEyPOiHDPPB5 @@ -62,18 +62,6 @@ db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat - - -#多数据源情况的配置 -guns: - muti-datasource: - open: false - url: jdbc:mysql://127.0.0.1:3306/guns_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai - username: root - password: root - dataSourceNames: - - dataSourceGuns - - dataSourceBiz --- @@ -124,8 +112,8 @@ spring: mail: - template-path: /home/igotechgh/nginx/html/mailbox/ + template-path: /data/nginx/html/mailbox/ --- -audioPath: /home/igotechgh/nginx/html/files/audio +audioPath: /data/nginx/html/files/audio diff --git a/ZuulIGOTravel/src/main/java/com/sinata/zuul/controller/NettyController.java b/ZuulIGOTravel/src/main/java/com/sinata/zuul/controller/NettyController.java index b34e425..30686f6 100644 --- a/ZuulIGOTravel/src/main/java/com/sinata/zuul/controller/NettyController.java +++ b/ZuulIGOTravel/src/main/java/com/sinata/zuul/controller/NettyController.java @@ -24,8 +24,8 @@ */ @ResponseBody @PostMapping("/sendMsgToClient") - public String sendMsgToClient(Integer id, Integer type, String msg){ - if(type == 1){//用户端 + public String sendMsgToClient(String id, String type, String msg){ + if("1".equals(type)){//用户端 ChannelHandlerContext channel = NettyChannelMap.getData("Applets" + id);//小程序 if(null != channel){ NettyWebSocketController.sendMsgToClient(channel, msg); @@ -40,7 +40,7 @@ } - if(type == 2){//司机端 + if("2".equals(type)){//司机端 ChannelHandlerContext channel = NettyChannelMap.getData("DRIVER" + id); if(null != channel){ NettyServerController.sendMsgToClient(channel, msg); diff --git a/ZuulIGOTravel/src/main/resources/application.yml b/ZuulIGOTravel/src/main/resources/application.yml index e9825f3..d394fbd 100644 --- a/ZuulIGOTravel/src/main/resources/application.yml +++ b/ZuulIGOTravel/src/main/resources/application.yml @@ -12,8 +12,8 @@ file-size-threshold: 100MB redis: database: 0 - host: 127.0.0.1 - port: 16379 + host: 172.17.0.3 + port: 6379 password: mPMHThYzlT8DWgl8HLqwPEyPOiHDPPB5 eureka: -- Gitblit v1.7.1