|
@@ -5,6 +5,7 @@ import com.caimei365.order.feign.CommodityFeign;
|
|
|
import com.caimei365.order.feign.ToolsFeign;
|
|
|
import com.caimei365.order.feign.UserFeign;
|
|
|
import com.caimei365.order.mapper.MessagePushMapper;
|
|
|
+import com.caimei365.order.model.vo.PushMessageUserVo;
|
|
|
import com.caimei365.order.service.RemoteCallService;
|
|
|
import com.caimei365.order.utils.CodeUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -12,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -85,8 +87,8 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
// 调用 ToolsFeign 发送短信
|
|
|
String jsonStr = toolsFeign.getSendSms(mobile, content);
|
|
|
JSONObject parseObject = JSONObject.parseObject(jsonStr);
|
|
|
- if (0 == parseObject.getInteger("code")){
|
|
|
- if (markId > 0 ) {
|
|
|
+ if (0 == parseObject.getInteger("code")) {
|
|
|
+ if (markId > 0) {
|
|
|
// 保存短信发送条数+count
|
|
|
messagePushMapper.updateSmsSendCount(markId, 1);
|
|
|
}
|
|
@@ -118,7 +120,7 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
// 调用 UserFeign 获取物流
|
|
|
String jsonStr = userFeign.appletsAuthorization(code, encryptedData, iv, referer);
|
|
|
JSONObject parseObject = JSONObject.parseObject(jsonStr);
|
|
|
- if (0 == parseObject.getInteger("code") || -4 == parseObject.getInteger("code")){
|
|
|
+ if (0 == parseObject.getInteger("code") || -4 == parseObject.getInteger("code")) {
|
|
|
// 授权登录成功(游客-4)
|
|
|
resultData.set(parseObject.getString("data"));
|
|
|
}
|
|
@@ -141,9 +143,9 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
try {
|
|
|
// 调用 ToolsFeign 获取物流
|
|
|
String jsonStr = toolsFeign.getLogisticsByNumber(number, companyCode, mobile);
|
|
|
- log.info("智能获取物流信息:"+jsonStr);
|
|
|
+ log.info("智能获取物流信息:" + jsonStr);
|
|
|
JSONObject parseObject = JSONObject.parseObject(jsonStr);
|
|
|
- if (0 == parseObject.getInteger("code")){
|
|
|
+ if (0 == parseObject.getInteger("code")) {
|
|
|
// 获取物流信息成功
|
|
|
resultData.set(parseObject.getString("data"));
|
|
|
} else {
|
|
@@ -170,11 +172,40 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
try {
|
|
|
// 调用 ToolsFeign 获取物流
|
|
|
String jsonStr = commodityFeign.productSaleUpdate(productInfo);
|
|
|
- log.info("更新商品销量:"+productInfo);
|
|
|
+ log.info("更新商品销量:" + productInfo);
|
|
|
resultData.set(jsonStr);
|
|
|
} catch (Exception e) {
|
|
|
log.error("更新商品销量失败:", e);
|
|
|
}
|
|
|
return resultData.get();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void getOldUser() {
|
|
|
+ //17年之前的所有用户
|
|
|
+ List<PushMessageUserVo> pushUsers = messagePushMapper.findOldUser();
|
|
|
+ //https://www.caimei365.com/product/hot.html指向新品橱窗
|
|
|
+ String url = "https://www.caimei365.com/product/hot.html";
|
|
|
+
|
|
|
+ pushUsers.forEach(p -> {
|
|
|
+ p.setJumpLink(url);
|
|
|
+ String link = getLink();
|
|
|
+ p.setShortLink(link);
|
|
|
+ p.setMarkId(23);
|
|
|
+ messagePushMapper.insertNewLink(p);
|
|
|
+ String content = "亲,好久没登陆采美了,近期在找新项目吗?采美新品橱窗有多款院线产品和仪器,现在登陆采美https://www.caimei365.com/t/" +
|
|
|
+ link + ",可获一张包邮券!退订回TD";
|
|
|
+ getSendSms(23, p.getMobile(), content);
|
|
|
+ log.info("userId-------------------->" + p.getUserId() + "发送手机号------------------------>" + p.getMobile() + "短信-------------->" + content);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getLink() {
|
|
|
+ String shortLink = CodeUtil.generateShortLink(9);
|
|
|
+ Integer id = messagePushMapper.findIdByShortLink(shortLink);
|
|
|
+ if (id != null && id > 0) {
|
|
|
+ getLink();
|
|
|
+ }
|
|
|
+ return shortLink;
|
|
|
+ }
|
|
|
}
|