1;自配送转为自动营销

2;短信调整
This commit is contained in:
wangshuai 2024-07-24 13:53:42 +08:00
parent af978f560f
commit 421a7225c0
5 changed files with 22 additions and 13 deletions

View File

@ -3,6 +3,8 @@ package com.ruoyi.business.controller;
import com.ruoyi.business.service.IAiService; import com.ruoyi.business.service.IAiService;
import com.ruoyi.business.service.IBusFifteenInfoService; import com.ruoyi.business.service.IBusFifteenInfoService;
import com.ruoyi.business.service.IBusOrderInfoService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
/** /**
* 采集美团接口 * 采集美团接口
*/ */
@Api(tags = "短信测试")
@RestController @RestController
@RequestMapping("/ai") @RequestMapping("/ai")
public class AiController { public class AiController {
@ -23,6 +26,7 @@ public class AiController {
@Autowired @Autowired
private IBusFifteenInfoService fifteenInfoService; private IBusFifteenInfoService fifteenInfoService;
@ApiOperation("测试配合数据库信息")
@GetMapping("/sendAi") @GetMapping("/sendAi")
public void sendAi(){ public void sendAi(){

View File

@ -21,17 +21,13 @@ public class BusTencentProperties {
private String appId; private String appId;
@Value("${tencent.bus.appKey}") @Value("${tencent.bus.appKey}")
private String 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){ public JSONObject smsCredential(String phone, String content){
//使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true);
Credential credential = new Credential(enterpriseId, appId, appKey, true); Credential credential = new Credential(enterpriseId, appId, appKey, true);
SmsSend s = new SmsSend(); SmsSend s = new SmsSend();
s.setPhoneNumberSet(new String[] {phone}); s.setPhoneNumberSet(new String[] {phone});
s.setSignName("【优势管家】"); // s.setSignName("【优势管家】");
s.setSessionContext(content); s.setSessionContext(content);
try { try {
return s.NormalSend(credential,s); return s.NormalSend(credential,s);
@ -41,6 +37,8 @@ public class BusTencentProperties {
} }
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
//// //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); //// //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true);

View File

@ -376,7 +376,7 @@ public class AiServiceImpl implements IAiService {
}else if("sms".equals(busStoreInfo.getMarketingChannels())){ }else if("sms".equals(busStoreInfo.getMarketingChannels())){
sendSmsTask(content,busOrderInfo); sendSmsTask(content,busOrderInfo);
}else{ }else{
sendAiTask(content,busOrderInfo); System.out.println("未配置营销渠道=====================");
} }
}else { }else {
BusAgentInfo busAgentInfo = agentInfoL.get(0); BusAgentInfo busAgentInfo = agentInfoL.get(0);
@ -408,7 +408,7 @@ public class AiServiceImpl implements IAiService {
@Override @Override
@Transactional @Transactional
public void sms() { public void sms() {
String content = "#分机号#测试"; String content = sysDictDataMapper.selectDictLabel("bus_default_sms_script","default_script");
BusOrderInfo busOrderInfo = orderInfoService.selectBusOrderInfoById(1L); BusOrderInfo busOrderInfo = orderInfoService.selectBusOrderInfoById(1L);
sendSmsTask(content,busOrderInfo); sendSmsTask(content,busOrderInfo);
} }
@ -416,7 +416,7 @@ public class AiServiceImpl implements IAiService {
private synchronized void sendSmsTask(String content, BusOrderInfo busOrderInfo) { private synchronized void sendSmsTask(String content, BusOrderInfo busOrderInfo) {
try { try {
String phoneNo = busOrderInfo.getPrivcyPhone().split(",")[0];//#分机号# 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\":\"\"}"; // 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 = com.alibaba.fastjson.JSON.parseObject(ss);
com.alibaba.fastjson.JSONObject jsonObject = busTencentProperties.smsCredential(phoneNo, content); com.alibaba.fastjson.JSONObject jsonObject = busTencentProperties.smsCredential(phoneNo, content);
@ -428,6 +428,7 @@ public class AiServiceImpl implements IAiService {
fifteenInfo.setLastVisitTime(LocalDateTime.now().toString()); fifteenInfo.setLastVisitTime(LocalDateTime.now().toString());
fifteenInfoService.insertBusFifteenInfo(fifteenInfo); fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
} }
System.out.println("建立sendSmsTask成功 ");
} catch (Exception e) { } catch (Exception e) {
System.out.println("建立sendSmsTask错误 " + busOrderInfo.toString()); System.out.println("建立sendSmsTask错误 " + busOrderInfo.toString());
e.printStackTrace(); e.printStackTrace();

View File

@ -210,6 +210,12 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>配置</el-button> >配置</el-button>
<el-button v-if="userAccount !='admin' && scope.row.selfDeliveryStatus == '2' "
size="mini"
type="text"
icon="el-icon-bicycle"
@click="handleSelfDelivery(scope.row)"
>退出自配送</el-button>
<el-button v-if="userAccount !='admin' && scope.row.returnVisitStatus !== '1'" <el-button v-if="userAccount !='admin' && scope.row.returnVisitStatus !== '1'"
size="mini" size="mini"
type="text" type="text"
@ -676,11 +682,11 @@ export default {
}, },
/** 自配送按钮操作 */ /** 自配送按钮操作 */
handleSelfDelivery(row) { handleSelfDelivery(row) {
this.$modal.confirm('是否确认将营销源 "' + row.storeCode + '" 转为自配送?确认后该营销源会变为自配送营销。').then(function() { this.$modal.confirm('是否确认将营销源 "' + row.storeCode + '" 退出自配送?确认后该营销源会变为定时营销。').then(function() {
return changeSelfDeliveryStatus(row.id, 2); return changeSelfDeliveryStatus(row.id, 1);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("更改成功");
}).catch(function() { }).catch(function() {
}); });

View File

@ -791,7 +791,7 @@ export default {
return changeSelfDeliveryStatus(row.id, 2); return changeSelfDeliveryStatus(row.id, 2);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("更改成功");
}).catch(function() { }).catch(function() {
}); });