From 421a7225c0fed2d34558eff7868d84c2cae19880 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Wed, 24 Jul 2024 13:53:42 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=9B=E8=87=AA=E9=85=8D=E9=80=81=E8=BD=AC?= =?UTF-8?q?=E4=B8=BA=E8=87=AA=E5=8A=A8=E8=90=A5=E9=94=80=202=EF=BC=9B?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/business/controller/AiController.java | 4 ++++ .../ruoyi/common/config/BusTencentProperties.java | 8 +++----- .../ruoyi/business/service/impl/AiServiceImpl.java | 9 +++++---- ruoyi-ui/src/views/market/self/index.vue | 12 +++++++++--- ruoyi-ui/src/views/market/whole/index.vue | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/AiController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/AiController.java index ee285c4..157d199 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/AiController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/AiController.java @@ -3,6 +3,8 @@ package com.ruoyi.business.controller; import com.ruoyi.business.service.IAiService; import com.ruoyi.business.service.IBusFifteenInfoService; import com.ruoyi.business.service.IBusOrderInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController; /** * 采集美团接口 */ +@Api(tags = "短信测试") @RestController @RequestMapping("/ai") public class AiController { @@ -23,6 +26,7 @@ public class AiController { @Autowired private IBusFifteenInfoService fifteenInfoService; + @ApiOperation("测试配合数据库信息") @GetMapping("/sendAi") public void sendAi(){ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/BusTencentProperties.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/BusTencentProperties.java index a50f0a6..47ea0d7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/BusTencentProperties.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/BusTencentProperties.java @@ -21,17 +21,13 @@ public class BusTencentProperties { private String appId; @Value("${tencent.bus.appKey}") private String appKey; -// -// private static String MchId = "1049039"; -// private static String AppId = "10011721121033115"; -// private static String AppKey = "c167746e38d64143a874cec3d5de014e"; public JSONObject smsCredential(String phone, String content){ //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); Credential credential = new Credential(enterpriseId, appId, appKey, true); SmsSend s = new SmsSend(); s.setPhoneNumberSet(new String[] {phone}); - s.setSignName("【优势管家】"); +// s.setSignName("【优势管家】"); s.setSessionContext(content); try { return s.NormalSend(credential,s); @@ -41,6 +37,8 @@ public class BusTencentProperties { } } + + public static void main(String[] args) throws Exception { //// //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java index 65aead1..122166b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/AiServiceImpl.java @@ -376,7 +376,7 @@ public class AiServiceImpl implements IAiService { }else if("sms".equals(busStoreInfo.getMarketingChannels())){ sendSmsTask(content,busOrderInfo); }else{ - sendAiTask(content,busOrderInfo); + System.out.println("未配置营销渠道====================="); } }else { BusAgentInfo busAgentInfo = agentInfoL.get(0); @@ -408,7 +408,7 @@ public class AiServiceImpl implements IAiService { @Override @Transactional public void sms() { - String content = "#分机号#测试"; + String content = sysDictDataMapper.selectDictLabel("bus_default_sms_script","default_script"); BusOrderInfo busOrderInfo = orderInfoService.selectBusOrderInfoById(1L); sendSmsTask(content,busOrderInfo); } @@ -416,10 +416,10 @@ public class AiServiceImpl implements IAiService { private synchronized void sendSmsTask(String content, BusOrderInfo busOrderInfo) { try { String phoneNo = busOrderInfo.getPrivcyPhone().split(",")[0];//#分机号# - content = content.replaceAll("#分机号#",busOrderInfo.getPrivcyPhone().split(",")[1]); + content = content.replaceAll("分机号",busOrderInfo.getPrivcyPhone().split(",")[1]); // String ss = "{\"taskId\":\"202203170025799000001\",\"message\":\"success\",\"timestamp\":1647481716818,\"status\":\"00\",\"tag\":\"\"}"; // com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(ss); - com.alibaba.fastjson.JSONObject jsonObject = busTencentProperties.smsCredential(phoneNo,content); + com.alibaba.fastjson.JSONObject jsonObject = busTencentProperties.smsCredential(phoneNo, content); System.out.println(jsonObject); if("00".equals(jsonObject.getString("status"))){ //定时任务15天之前的删除记录 todo @@ -428,6 +428,7 @@ public class AiServiceImpl implements IAiService { fifteenInfo.setLastVisitTime(LocalDateTime.now().toString()); fifteenInfoService.insertBusFifteenInfo(fifteenInfo); } + System.out.println("建立sendSmsTask成功: "); } catch (Exception e) { System.out.println("建立sendSmsTask错误: " + busOrderInfo.toString()); e.printStackTrace(); diff --git a/ruoyi-ui/src/views/market/self/index.vue b/ruoyi-ui/src/views/market/self/index.vue index 2474fef..5110fc5 100644 --- a/ruoyi-ui/src/views/market/self/index.vue +++ b/ruoyi-ui/src/views/market/self/index.vue @@ -210,6 +210,12 @@ icon="el-icon-edit" @click="handleUpdate(scope.row)" >配置 + 退出自配送 { this.getList(); - this.$modal.msgSuccess("删除成功"); + this.$modal.msgSuccess("更改成功"); }).catch(function() { }); diff --git a/ruoyi-ui/src/views/market/whole/index.vue b/ruoyi-ui/src/views/market/whole/index.vue index f35ce25..696a2a2 100644 --- a/ruoyi-ui/src/views/market/whole/index.vue +++ b/ruoyi-ui/src/views/market/whole/index.vue @@ -791,7 +791,7 @@ export default { return changeSelfDeliveryStatus(row.id, 2); }).then(() => { this.getList(); - this.$modal.msgSuccess("删除成功"); + this.$modal.msgSuccess("更改成功"); }).catch(function() { });