From a2b80d267bbe19728f86de10f7fab7afd09fd662 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Wed, 17 Jul 2024 17:03:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B5=8B=E8=AF=953?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- expand/ert/content.js | 25 +- .../controller/BusStoreInfoController.java | 20 +- ruoyi-ui/src/views/statistics/daily/index.vue | 540 ++++-------------- ruoyi-ui/src/views/statistics/shop/index.vue | 5 - 4 files changed, 141 insertions(+), 449 deletions(-) diff --git a/expand/ert/content.js b/expand/ert/content.js index 4921ceb..f55878f 100644 --- a/expand/ert/content.js +++ b/expand/ert/content.js @@ -2,12 +2,16 @@ document.addEventListener("click", function(e) { // 处理点击事件的代码 var account = document.getElementById("login") var password = document.getElementById("password") + var phone = document.getElementById("phone") if(account != null && account != 'undefined'){ localStorage.setItem('account', account.value) } if(password != null && password != 'undefined'){ localStorage.setItem('password', password.value) } + if(phone != null && phone != 'undefined'){ + localStorage.setItem('phone', phone.value) + } }); (function () { if (location.host === 'melody.shop.ele.me' || location.host === 'nr.ele.me') { @@ -50,6 +54,7 @@ document.addEventListener("click", function(e) { var userName = localStorage.getItem('sysName') var sysType = localStorage.getItem('sysType') var account = localStorage.getItem('account') + var phone = localStorage.getItem('phone') var password = localStorage.getItem('password') var wmPoiName = localStorage.getItem('wmPoiName') //console.log('ccccccccccccccccccccccccccccccc'+userName) @@ -74,8 +79,26 @@ document.addEventListener("click", function(e) { } } } - } + }else if(phone !== null && phone !== 'null' ){ + if ('1' === sysType) { + //服务器地址 + xhr.open('POST', 'https://youshi.bj.cn/prod-api/mt/cookies', true) + } else { + xhr.open('POST', 'https://www.shivers.top/prod-api/negative/store_bing', true) + } + xhr.setRequestHeader("Content-Type","application/json") + var sendData = {'bingType': 1, 'cookie': cookies, 'userName': userName, 'account': phone, 'password': null, 'wmPoiName': wmPoiName} + xhr.send(JSON.stringify(sendData)) + xhr.onreadystatechange = function () { + if (xhr.readyState === 4 && xhr.status === 200) { + if (xhr.responseText === 'true') { + alert('当前授权完成,请直接关闭当前浏览器!') + } + } + } + } localStorage.setItem('account', null) + localStorage.setItem('phone', null) localStorage.setItem('password', null) } if (location.host === 'shangoue.meituan.com') { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java index 764fd49..11c1f32 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java @@ -123,7 +123,7 @@ public class BusStoreInfoController extends BaseController { BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo(); busStoreDayInfo.setStoreId(info.getId()); List ll = busStoreDayInfoService.selectBusStoreDayInfoList(busStoreDayInfo); - int a = ll.get(0).getLastPositiveReviewsNum(); + int a = ll.get(0).getLastPositiveReviewsNum();//todo 好评-五星 int b = ll.get(0).getLastReturnVisitNum(); info.setLastOrderNum(ll.get(0).getLastOrderNum()); info.setLastReturnVisitNum(b); @@ -134,9 +134,7 @@ public class BusStoreInfoController extends BaseController { // info.setLastReturnVisitNum(llll.size()); info.setScore(ll.get(0).getScore()); if (a != 0 && b != 0) { - java.text.DecimalFormat df = new java.text.DecimalFormat("0.00"); - String formattedResult = df.format(((double) a / b)*100); - info.setLastReturnVisitRate(formattedResult); + info.setLastReturnVisitRate(getRate(a,b)); } else { info.setLastReturnVisitRate("0"); } @@ -201,18 +199,25 @@ public class BusStoreInfoController extends BaseController { for(BusTemplateAttrInfo busTemplateAttrInfo:busTemplateInfo.getAttrInfoList()){ if(content.contains(busTemplateAttrInfo.getAttrValue())){ content = content.replaceAll("#name",busStoreInfo.getStoreName()); - content = content.replaceAll("#from",busStoreInfo.getPlatformType()); + content = content.replaceAll("#from", "1".equals(busStoreInfo.getPlatformType())?"美团":"饿了么"); content = content.replaceAll("#date", LocalDate.now().minusDays(1).toString()); content = content.replaceAll("#count",busStoreDayInfo1.getLastOrderNum()+""); content = content.replaceAll("#good",busStoreDayInfo1.getLastPositiveReviewsNum()+""); content = content.replaceAll("#five",busStoreDayInfo1.getLastFiveStarReviewsNum()+""); content = content.replaceAll("#score",busStoreDayInfo1.getScore()); + int a = busStoreDayInfo1.getLastPositiveReviewsNum();//todo 好评-五星 + int b = busStoreDayInfo1.getLastReturnVisitNum(); + content = content.replaceAll("#rate", getRate(a,b)); if(content.contains("#fee")&&busStoreInfo.getPrice() == null){ throw new ServiceException("请设置单价!"); } content = content.replaceAll("#fee",busStoreInfo.getPrice().multiply(new BigDecimal(busStoreDayInfo1.getLastFiveStarReviewsNum()))+""); } } + content = content.replaceAll("(

)\\s*", "\n"); + content = content.replaceAll("(

)|(

)", ""); + // 对于连续多个换行符的情况,保留一个换行符 + content = content.replaceAll("(


)", "\n\n"); return success(content); } @@ -366,4 +371,9 @@ public class BusStoreInfoController extends BaseController { String value = s.substring(s.indexOf("=") + 1, s.indexOf(";")); return value; } + + private String getRate(int a, int b){ + java.text.DecimalFormat df = new java.text.DecimalFormat("0.00"); + return df.format(((double) a / b)*100); + } } diff --git a/ruoyi-ui/src/views/statistics/daily/index.vue b/ruoyi-ui/src/views/statistics/daily/index.vue index b54c56d..926c2d7 100644 --- a/ruoyi-ui/src/views/statistics/daily/index.vue +++ b/ruoyi-ui/src/views/statistics/daily/index.vue @@ -1,48 +1,23 @@