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/user/UserConvertLinkTemplateServiceImpl.java |  286 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 143 insertions(+), 143 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserConvertLinkTemplateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserConvertLinkTemplateServiceImpl.java
index e12bd57..d225a9a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserConvertLinkTemplateServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserConvertLinkTemplateServiceImpl.java
@@ -1,143 +1,143 @@
-package com.yeshi.fanli.service.impl.user;
-
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.springframework.data.mongodb.core.query.Criteria;
-import org.springframework.data.mongodb.core.query.Query;
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dao.user.UserConvertLinkTemplateDao;
-import com.yeshi.fanli.entity.bus.user.UserConvertLinkTemplate;
-import com.yeshi.fanli.service.inter.user.UserConvertLinkTemplateService;
-import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
-import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
-import com.yeshi.fanli.util.StringUtil;
-
-@Service
-public class UserConvertLinkTemplateServiceImpl implements UserConvertLinkTemplateService {
-
-	@Resource
-	private UserConvertLinkTemplateDao userConvertLinkTemplateDao;
-
-	@Resource
-	private UserVIPInfoService userVIPInfoService;
-
-	@Resource
-	private UserInfoExtraService userInfoExtraService;
-
-	/**
-	 * 
-	 * @Title: countByUid
-	 * @Description: 鏍规嵁鐢ㄦ埛ID缁熻鏁伴噺
-	 * @param uid
-	 * @return 
-	 * long 杩斿洖绫诲瀷
-	 * @throws
-	 */
-	private long countByUid(Long uid) {
-		Query query = new Query();
-		query.addCriteria(Criteria.where("uid").is(uid));
-		return userConvertLinkTemplateDao.count(query);
-	}
-
-	/**
-	 * 
-	 * @Title: verifyTemplate
-	 * @Description: 楠岃瘉妯℃澘鍐呭鏄惁姝g‘
-	 * @param template
-	 * @param uid
-	 * @throws Exception 
-	 * void 杩斿洖绫诲瀷
-	 * @throws
-	 */
-	private void verifyTemplate(String template, Long uid) throws Exception {
-		if (StringUtil.isNullOrEmpty(template))
-			throw new Exception("妯℃澘鍐呭涓嶈兘涓虹┖");
-		if (template.length() > 140) {
-			throw new Exception("鏈�闀夸负140涓瓧");
-		}
-
-		if (template.contains("[閭�璇风爜]")) {
-			String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
-			if (StringUtil.isNullOrEmpty(inviteCode)) {
-				throw new Exception("鐢ㄦ埛鏈縺娲伙紝妯℃澘鏈笉鑳藉嚭鐜癧閭�璇风爜]");
-			}
-		}
-
-	}
-
-	@Override
-	public List<UserConvertLinkTemplate> listByUid(Long uid) {
-		Query query = new Query();
-		query.addCriteria(Criteria.where("uid").is(uid).and("createTime").lte(new Date(System.currentTimeMillis()+1000*60*60*24L)));
-		List<UserConvertLinkTemplate> templateList = userConvertLinkTemplateDao.findList(query);
-		if (templateList != null) {
-			String inviteCode = null;
-			for (UserConvertLinkTemplate userConvertLinkTemplate : templateList) {
-				// 鏇挎崲閭�璇风爜
-				if (userConvertLinkTemplate.getTemplate().contains("[閭�璇风爜]")) {
-					if (inviteCode == null)
-						inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
-					userConvertLinkTemplate
-							.setContent(userConvertLinkTemplate.getTemplate().replace("[閭�璇风爜]", inviteCode));
-				}
-			}
-		}
-		return templateList;
-	}
-
-	@Override
-	public void updateTemplate(UserConvertLinkTemplate template) throws Exception {
-
-		if (template.getId() == null || StringUtil.isNullOrEmpty(template.getTemplate()))
-			throw new Exception("鍙傛暟涓嶅畬鏁�");
-
-		UserConvertLinkTemplate oldTemplate = userConvertLinkTemplateDao.get(template.getId());
-		if (oldTemplate == null)
-			throw new Exception("妯℃澘涓嶅瓨鍦�");
-
-		verifyTemplate(template.getTemplate(), oldTemplate.getUid());
-
-		oldTemplate.setTemplate(template.getTemplate());
-		oldTemplate.setUpdateTime(new Date());
-		userConvertLinkTemplateDao.save(oldTemplate);
-	}
-
-	@Override
-	public void deleteConvertLinkTemplate(String id, Long uid) throws Exception {
-		UserConvertLinkTemplate template = userConvertLinkTemplateDao.get(id);
-		if (template != null && template.getUid().longValue() != uid)
-			throw new Exception("鍙兘鍒犻櫎灞炰簬鑷繁鐨�");
-		userConvertLinkTemplateDao.delete(id);
-	}
-
-	@Override
-	public void addConvertLinkTemplate(UserConvertLinkTemplate template) throws Exception {
-		if (template.getUid() == null || StringUtil.isNullOrEmpty(template.getTemplate()))
-			throw new Exception("鍙傛暟涓嶅畬鏁�");
-
-		int maxCount = 5;
-
-		// 鍒ゆ柇鏁伴噺
-		long count = countByUid(template.getUid());
-		if (count >= maxCount) {
-			throw new Exception("鏁伴噺瓒呴檺");
-		}
-
-		verifyTemplate(template.getTemplate(), template.getUid());
-
-		// 娣诲姞妯℃澘
-		if (template.getCreateTime() == null)
-			template.setCreateTime(new Date());
-
-		template.setId(template.getUid() + "-"
-				+ StringUtil.Md5(UUID.randomUUID().toString() + "#" + System.currentTimeMillis()));
-
-		userConvertLinkTemplateDao.save(template);
-	}
-
-}
+package com.yeshi.fanli.service.impl.user;
+
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dao.user.UserConvertLinkTemplateDao;
+import com.yeshi.fanli.entity.bus.user.UserConvertLinkTemplate;
+import com.yeshi.fanli.service.inter.user.UserConvertLinkTemplateService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
+import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
+import com.yeshi.fanli.util.StringUtil;
+
+@Service
+public class UserConvertLinkTemplateServiceImpl implements UserConvertLinkTemplateService {
+
+	@Resource
+	private UserConvertLinkTemplateDao userConvertLinkTemplateDao;
+
+	@Resource
+	private UserVIPInfoService userVIPInfoService;
+
+	@Resource
+	private UserInfoExtraService userInfoExtraService;
+
+	/**
+	 * 
+	 * @Title: countByUid
+	 * @Description: 鏍规嵁鐢ㄦ埛ID缁熻鏁伴噺
+	 * @param uid
+	 * @return 
+	 * long 杩斿洖绫诲瀷
+	 * @throws
+	 */
+	private long countByUid(Long uid) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("uid").is(uid));
+		return userConvertLinkTemplateDao.count(query);
+	}
+
+	/**
+	 * 
+	 * @Title: verifyTemplate
+	 * @Description: 楠岃瘉妯℃澘鍐呭鏄惁姝g‘
+	 * @param template
+	 * @param uid
+	 * @throws Exception 
+	 * void 杩斿洖绫诲瀷
+	 * @throws
+	 */
+	private void verifyTemplate(String template, Long uid) throws Exception {
+		if (StringUtil.isNullOrEmpty(template))
+			throw new Exception("妯℃澘鍐呭涓嶈兘涓虹┖");
+		if (template.length() > 140) {
+			throw new Exception("鏈�闀夸负140涓瓧");
+		}
+
+		if (template.contains("[閭�璇风爜]")) {
+			String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+			if (StringUtil.isNullOrEmpty(inviteCode)) {
+				throw new Exception("鐢ㄦ埛鏈縺娲伙紝妯℃澘鏈笉鑳藉嚭鐜癧閭�璇风爜]");
+			}
+		}
+
+	}
+
+	@Override
+	public List<UserConvertLinkTemplate> listByUid(Long uid) {
+		Query query = new Query();
+		query.addCriteria(Criteria.where("uid").is(uid).and("createTime").lte(new Date(System.currentTimeMillis()+1000*60*60*24L)));
+		List<UserConvertLinkTemplate> templateList = userConvertLinkTemplateDao.findList(query);
+		if (templateList != null) {
+			String inviteCode = null;
+			for (UserConvertLinkTemplate userConvertLinkTemplate : templateList) {
+				// 鏇挎崲閭�璇风爜
+				if (userConvertLinkTemplate.getTemplate().contains("[閭�璇风爜]")) {
+					if (inviteCode == null)
+						inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+					userConvertLinkTemplate
+							.setContent(userConvertLinkTemplate.getTemplate().replace("[閭�璇风爜]", inviteCode));
+				}
+			}
+		}
+		return templateList;
+	}
+
+	@Override
+	public void updateTemplate(UserConvertLinkTemplate template) throws Exception {
+
+		if (template.getId() == null || StringUtil.isNullOrEmpty(template.getTemplate()))
+			throw new Exception("鍙傛暟涓嶅畬鏁�");
+
+		UserConvertLinkTemplate oldTemplate = userConvertLinkTemplateDao.get(template.getId());
+		if (oldTemplate == null)
+			throw new Exception("妯℃澘涓嶅瓨鍦�");
+
+		verifyTemplate(template.getTemplate(), oldTemplate.getUid());
+
+		oldTemplate.setTemplate(template.getTemplate());
+		oldTemplate.setUpdateTime(new Date());
+		userConvertLinkTemplateDao.save(oldTemplate);
+	}
+
+	@Override
+	public void deleteConvertLinkTemplate(String id, Long uid) throws Exception {
+		UserConvertLinkTemplate template = userConvertLinkTemplateDao.get(id);
+		if (template != null && template.getUid().longValue() != uid)
+			throw new Exception("鍙兘鍒犻櫎灞炰簬鑷繁鐨�");
+		userConvertLinkTemplateDao.delete(id);
+	}
+
+	@Override
+	public void addConvertLinkTemplate(UserConvertLinkTemplate template) throws Exception {
+		if (template.getUid() == null || StringUtil.isNullOrEmpty(template.getTemplate()))
+			throw new Exception("鍙傛暟涓嶅畬鏁�");
+
+		int maxCount = 5;
+
+		// 鍒ゆ柇鏁伴噺
+		long count = countByUid(template.getUid());
+		if (count >= maxCount) {
+			throw new Exception("鏁伴噺瓒呴檺");
+		}
+
+		verifyTemplate(template.getTemplate(), template.getUid());
+
+		// 娣诲姞妯℃澘
+		if (template.getCreateTime() == null)
+			template.setCreateTime(new Date());
+
+		template.setId(template.getUid() + "-"
+				+ StringUtil.Md5(UUID.randomUUID().toString() + "#" + System.currentTimeMillis()));
+
+		userConvertLinkTemplateDao.save(template);
+	}
+
+}

--
Gitblit v1.8.0