From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/CommonShareInfoServiceImpl.java | 141 +++++++++++++++++++++++----------------------- 1 files changed, 71 insertions(+), 70 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/CommonShareInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/CommonShareInfoServiceImpl.java index 6ce0da1..fec600b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/CommonShareInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/CommonShareInfoServiceImpl.java @@ -1,70 +1,71 @@ -package com.yeshi.fanli.service.impl.homemodule; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.mybatis.homemodule.CommonShareInfoMapper; -import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo; -import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; -import com.yeshi.fanli.exception.homemodule.SpecialException; -import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService; -import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.StringUtil; - -@Service -public class CommonShareInfoServiceImpl implements CommonShareInfoService { - - @Resource - private CommonShareInfoMapper commonShareInfoMapper; - - @Resource - private ConvertLinkManager convertLinkManager; - - @Override - public void save(CommonShareInfo record) throws SpecialException { - if (record == null || record.getPid() == null || record.getType() == null) - throw new SpecialException(1, "鍙傛暟涓嶅畬鏁�"); - - if (!StringUtil.isNullOrEmpty(record.getComment())) { - if (record.getNeedSpin() == null) - record.setNeedSpin(false); - - if (record.getNeedSpin()) { - try { - convertLinkManager.convertLinkFromText(record.getComment(), Constant.LINK_TOKEN_VERIFY_UID, true); - } catch (ConvertLinkExceptionException e) { - if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { - throw new SpecialException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); - } - } catch (Exception e) { - throw new SpecialException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); - } - } - } - - // 閲嶇疆id - record.setId(null); - - CommonShareInfo info = commonShareInfoMapper.getByPidAndType(record.getPid(), record.getType().name()); - if (info == null) { - commonShareInfoMapper.insertSelective(record); - } else { - record.setId(info.getId()); - commonShareInfoMapper.updateByPrimaryKeySelective(record); - } - } - - - @Override - public CommonShareInfo getByPidAndType(Long pid, String type) { - return commonShareInfoMapper.getByPidAndType(pid, type); - } - - - @Override - public void deleteByPidAndType(Long pid, String type) { - commonShareInfoMapper.deleteByPidAndType(pid, type); - } -} +package com.yeshi.fanli.service.impl.homemodule; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.SystemEnum; +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.mybatis.homemodule.CommonShareInfoMapper; +import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo; +import com.yeshi.fanli.exception.goods.ConvertLinkException; +import com.yeshi.fanli.exception.homemodule.SpecialException; +import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService; +import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; + +@Service +public class CommonShareInfoServiceImpl implements CommonShareInfoService { + + @Resource + private CommonShareInfoMapper commonShareInfoMapper; + + @Resource + private ConvertLinkManager convertLinkManager; + + @Override + public void save(CommonShareInfo record) throws SpecialException { + if (record == null || record.getPid() == null || record.getType() == null) + throw new SpecialException(1, "鍙傛暟涓嶅畬鏁�"); + + if (!StringUtil.isNullOrEmpty(record.getComment())) { + if (record.getNeedSpin() == null) + record.setNeedSpin(false); + + if (record.getNeedSpin()) { + try { + convertLinkManager.convertLinkFromText(SystemEnum.blks, record.getComment(), Constant.LINK_TOKEN_VERIFY_UID, true,false); + } catch (ConvertLinkException e) { + if (ConvertLinkException.CODE_NONE != e.getCode()) { + throw new SpecialException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); + } + } catch (Exception e) { + throw new SpecialException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); + } + } + } + + // 閲嶇疆id + record.setId(null); + + CommonShareInfo info = commonShareInfoMapper.getByPidAndType(record.getPid(), record.getType().name()); + if (info == null) { + commonShareInfoMapper.insertSelective(record); + } else { + record.setId(info.getId()); + commonShareInfoMapper.updateByPrimaryKeySelective(record); + } + } + + + @Override + public CommonShareInfo getByPidAndType(Long pid, String type) { + return commonShareInfoMapper.getByPidAndType(pid, type); + } + + + @Override + public void deleteByPidAndType(Long pid, String type) { + commonShareInfoMapper.deleteByPidAndType(pid, type); + } +} -- Gitblit v1.8.0