[Bug修复](master): 修复了2个bug

#bug1 判断点击回传的是短链
#bug2 修复入库存原始Url的逻辑
master
土豆兄弟 3 years ago
parent e078723021
commit 7f4a5f567d

@ -0,0 +1,9 @@
package com.by.constants;
public class SymbolConstant {
/**
*
*/
public static final String SPLIT_VERTICAL = "|";
}

@ -11,4 +11,6 @@ public class SystemConstant {
*/
public static final String DEFAULT_IP = "0.0.0.0";
}

@ -16,8 +16,8 @@ public class ShortChainPointJsonDTO {
/**
*
*/
@JSONField(name = "originUrl")
private String originUrl;
@JSONField(name = "shortUrl")
private String shortUrl;
/**
* 0- 1-

@ -5,6 +5,7 @@ import com.by.api.common.CommonResponse;
import com.by.api.convert.ShortChainVOToDTOConvert;
import com.by.api.vo.ShortChainRequestVO;
import com.by.api.vo.ShortChainResponseVO;
import com.by.constants.SymbolConstant;
import com.by.constants.SystemConstant;
import com.by.dto.ShortChainDTO;
import com.by.entity.ShortUrl;
@ -82,7 +83,7 @@ public class ShortServerOpenApiController {
if (!Objects.isNull(shortUrl)){
// 异步进行更新数据库中的点击记录及推送给之前的调用方(可以走消息)
shortChainTask.doRunTask(shortUrl);
originUrl = shortUrl.getOriginUrl();
originUrl = StringUtils.substringBefore(shortUrl.getOriginUrl(), SymbolConstant.SPLIT_VERTICAL);
}
return new ModelAndView("redirect:" + originUrl);

@ -2,6 +2,7 @@ package com.by.api.convert;
import cn.hutool.core.collection.CollectionUtil;
import com.by.api.vo.ShortChainRequestVO;
import com.by.constants.SymbolConstant;
import com.by.dto.ShortChainDTO;
import org.apache.commons.lang3.StringUtils;
@ -11,6 +12,7 @@ import java.util.Set;
/**
* VO -> DTO
* @author q
*/
public class ShortChainVOToDTOConvert {
@ -31,7 +33,7 @@ public class ShortChainVOToDTOConvert {
String baseUrlAddr = shortChainRequestVO.getBaseUrlAddr();
shortChainRequestVO.getVariableList().forEach(
each -> {
originsUrlSet.add(checkUrlAllowed(baseUrlAddr) + each);
originsUrlSet.add(checkUrlAllowed(baseUrlAddr) + SymbolConstant.SPLIT_VERTICAL + each);
}
);

@ -63,7 +63,7 @@ public class ShortChainTask {
// 转成json字符串
ShortChainPointJsonDTO shortChainPointJsonDTO =
new ShortChainPointJsonDTO(shortUrl.getOriginUrl(), DBDefaultConstant.ONE_NUM_TAG);
new ShortChainPointJsonDTO(shortUrl.getShortUrl(), DBDefaultConstant.ONE_NUM_TAG);
String jsonSendContent = JSON.toJSONString(shortChainPointJsonDTO);
// 失败重发请求3次

Loading…
Cancel
Save