diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java index 013502f..1cb5247 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreDayHistoryInfoController.java @@ -59,7 +59,7 @@ public class BusStoreDayHistoryInfoController extends BaseController @GetMapping("/list") public TableDataInfo list(BusStoreExcelInfo excelInfo) { - startPage(); +// startPage(); List list = busStoreDayHistoryInfoService.selectBusStoreDayHistoryInfoList(excelInfo); return getDataTable(list); } 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 e2ca01c..a50f0a6 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 @@ -3,8 +3,12 @@ package com.ruoyi.common.config; import com.alibaba.fastjson.JSONObject; import com.lianlu.common.Credential; import com.lianlu.models.SmsSend; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import com.tencentcloudapi.sms.v20210111.SmsClient; import lombok.Data; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Data @@ -17,23 +21,35 @@ 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"; - 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.setSessionContext(content); + try { + return s.NormalSend(credential,s); + } catch (Exception e) { + System.out.println(e.getMessage()); + return null; + } + } public static void main(String[] args) throws Exception { -// //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); - Credential credential = new Credential(MchId, AppId, AppKey, true); - -// NormalSend - SmsSend s = new SmsSend(); - s.setPhoneNumberSet(new String[] {"17612400322"}); - s.setSignName("【签名内容】"); - s.setSessionContext("短信内容"); - JSONObject re = s.NormalSend(credential, s); - System.out.println(re); +//// //使用http需给Credential添加true参数new Credential(MchId, AppId, AppKey, true); +// BusTencentProperties busTencentProperties = new BusTencentProperties(); +// JSONObject ss = busTencentProperties.smsCredential("17612400322","短信内容"); +// SmsSend s = new SmsSend(); +//// NormalSend +// JSONObject re = s.NormalSend() +// System.out.println(re); // PersonalSend // SmsSend s = new SmsSend(); 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 36b21b1..3bb8b2f 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 @@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSONObject; import com.ruoyi.business.domain.*; import com.ruoyi.business.mapper.BusReturnVisitInfoMapper; import com.ruoyi.business.service.*; +import com.ruoyi.common.config.BusTencentProperties; import com.ruoyi.common.utils.HttpClientUtilT; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; @@ -48,6 +49,8 @@ public class AiServiceImpl implements IAiService { private IBusStoreConfigInfoService iBusStoreConfigInfoService; @Autowired private IBusBanOperateInfoService iBusBanOperateInfoService; + @Autowired + private BusTencentProperties busTencentProperties; private String userSn = "SYSUSER|8398f13f3feccef770ee4d465fe22fbf"; private String aiUserSn = "SYSUSER|2665bcca63a2b5c724095fa01dce0470"; @@ -363,7 +366,7 @@ public class AiServiceImpl implements IAiService { if("AI".equals(busStoreInfo.getMarketingChannels())){ sendAiTask(content,busOrderInfo); }else if("sms".equals(busStoreInfo.getMarketingChannels())){ - sendSmsTask(); + sendSmsTask(busOrderInfo); }else{ sendAiTask(content,busOrderInfo); } @@ -394,7 +397,8 @@ public class AiServiceImpl implements IAiService { } } - private void sendSmsTask() { + private void sendSmsTask(BusOrderInfo busOrderInfo) { + } private void addAiTaskTest(String apiKey, String content, BusOrderInfo busOrderInfo) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java index cb328f8..4e27e09 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/BusStoreDayHistoryInfoServiceImpl.java @@ -10,6 +10,7 @@ import com.ruoyi.business.mapper.BusStoreInfoMapper; import com.ruoyi.business.service.IBusStoreDayHistoryInfoService; import com.ruoyi.business.service.IBusStoreDayInfoService; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -62,6 +63,7 @@ public class BusStoreDayHistoryInfoServiceImpl implements IBusStoreDayHistoryInf } busStoreExcelInfo.setStoreList(sl); } + PageUtils.startPage(); return busStoreDayHistoryInfoMapper.selectBusStoreDayHistoryInfoList(busStoreExcelInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java index 1e9fdc9..5f5cf76 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/business/service/impl/MeituanServiceImpl.java @@ -380,70 +380,70 @@ public class MeituanServiceImpl implements IMeituanService { for (int i = 0; i < array.size(); i++) { BusOrderInfo orderInfo = new BusOrderInfo(); Object o = array.get(i); - JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o)); - String isPhf = oj.getString("businessType"); - JSONObject order0 = oj.getJSONObject("orderInfo"); - JSONObject commonInfo = oj.getJSONObject("commonInfo"); - JSONObject order1 = order0.getJSONObject("orderInfo"); - JSONObject foodInfo = order0.getJSONObject("foodInfo"); - if(foodInfo != null){ + try { + JSONObject oj = JSONObject.parseObject(JSON.toJSONString(o)); + String isPhf = oj.getString("businessType"); + JSONObject order0 = oj.getJSONObject("orderInfo"); + JSONObject commonInfo = oj.getJSONObject("commonInfo"); + JSONObject order1 = order0.getJSONObject("orderInfo"); + JSONObject foodInfo = order0.getJSONObject("foodInfo"); JSONObject userLabelVo = foodInfo.getJSONObject("userLabelVo"); JSONArray array1 = userLabelVo.getJSONArray("contents"); String info = array1.getJSONObject(0).getString("info"); + JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo"); + String daySeq = order1.getString("dayseq"); + String wmOrderViewId = order1.getString("wmOrderViewId"); + String orderTimeFmt = order1.getString("orderTimeFmt"); + String expectTime = expectTimeVo.getString("expectTimeFmt"); + String statusDesc = order1.getString("statusDesc"); + String userId = commonInfo.getString("wmUserId"); + String redisDaySeq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null); + if (redisDaySeq == null) { + redisTemplate.opsForValue().set(key, daySeq); + } else { + if (Integer.valueOf(daySeq) > Integer.valueOf(redisDaySeq)) { + redisTemplate.opsForValue().set(key, daySeq); + } + if (daySeq.equals(lastDayseq)) { + flag = true; + break; + } + } + String s = String.valueOf(new Random().nextLong()); + String nextId = s.substring(1,s.length()); + orderInfo.setId(Long.valueOf(nextId)); + orderInfo.setStoreCode(wmPoiId); + orderInfo.setDayseq(daySeq); + orderInfo.setOrderNo(wmOrderViewId); + + if(expectTime.contains("今日")){ + expectTime = expectTime.substring(3,expectTime.length()); + } + + BusStoreInfo storeInfo = new BusStoreInfo(); + storeInfo.setStoreCode(wmPoiId); + BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0); + + orderInfo.setStoreName(storeInfo1.getStoreName()); + orderInfo.setCompleteTime("2024-"+expectTime); + orderInfo.setOrderStatus(statusDesc); + orderInfo.setCustomId(userId); if ("门店新客".equals(info)){ orderInfo.setOrderCount("1"); } else if (info.contains("下单")){ orderInfo.setOrderCount(info.substring(info.indexOf("下单")+2,info.length()-1)); - }else{ - continue; } - } - JSONObject expectTimeVo = order1.getJSONObject("expectTimeVo"); - String daySeq = order1.getString("dayseq"); - String wmOrderViewId = order1.getString("wmOrderViewId"); - String orderTimeFmt = order1.getString("orderTimeFmt"); - String expectTime = expectTimeVo.getString("expectTimeFmt"); - String statusDesc = order1.getString("statusDesc"); - String userId = commonInfo.getString("wmUserId"); - String redisDaySeq = Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse(null); - if (redisDaySeq == null) { - redisTemplate.opsForValue().set(key, daySeq); - } else { - if (Integer.valueOf(daySeq) > Integer.valueOf(redisDaySeq)) { - redisTemplate.opsForValue().set(key, daySeq); - } - if (daySeq.equals(lastDayseq)) { - flag = true; - break; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + try { + orderInfo.setOrderTime(format.parse("2024-"+orderTimeFmt)); + } catch (ParseException e) { + throw new RuntimeException(e); } + orderInfo.setIsPhf(isPhf); + }catch (Exception e){ + System.out.println(e.getMessage()); + continue; } - String s = String.valueOf(new Random().nextLong()); - String nextId = s.substring(1,s.length()); - orderInfo.setId(Long.valueOf(nextId)); - orderInfo.setStoreCode(wmPoiId); - orderInfo.setDayseq(daySeq); - orderInfo.setOrderNo(wmOrderViewId); - - if(expectTime.contains("今日")){ - expectTime = expectTime.substring(3,expectTime.length()); - } - - BusStoreInfo storeInfo = new BusStoreInfo(); - storeInfo.setStoreCode(wmPoiId); - BusStoreInfo storeInfo1 = busStoreInfoMapper.selectBusStoreInfoList(storeInfo).get(0); - - orderInfo.setStoreName(storeInfo1.getStoreName()); - orderInfo.setCompleteTime("2024-"+expectTime); - orderInfo.setOrderStatus(statusDesc); - orderInfo.setCustomId(userId); - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - try { - orderInfo.setOrderTime(format.parse("2024-"+orderTimeFmt)); - } catch (ParseException e) { - throw new RuntimeException(e); - } - orderInfo.setIsPhf(isPhf); list.add(orderInfo); } if (list.size() > 0) { diff --git a/ruoyi-ui/src/views/market/self/index.vue b/ruoyi-ui/src/views/market/self/index.vue index 0de8874..2474fef 100644 --- a/ruoyi-ui/src/views/market/self/index.vue +++ b/ruoyi-ui/src/views/market/self/index.vue @@ -159,7 +159,11 @@ - + + +