From 5e7b0ed4a154ad067cbcf4aa1a1c7cce32f9864c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 26 四月 2024 18:02:17 +0800
Subject: [PATCH] 唯品会链接解析升级

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java |  274 +++++++++++++++++++++++-------------------------------
 1 files changed, 118 insertions(+), 156 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java
index f838695..914c23c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java
@@ -1,156 +1,118 @@
-package com.yeshi.fanli.service.impl.user;
-
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dao.mybatis.user.ForbiddenUserIdentifyCodeMapper;
-import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
-import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
-import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
-import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
-import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.vo.user.ForbiddenUserIdentifyCodeVO;
-
-@Service
-public class ForbiddenUserIdentifyCodeServiceImpl implements ForbiddenUserIdentifyCodeService {
-
-	@Resource
-	private ForbiddenUserIdentifyCodeMapper forbiddenUserIdentifyCodeMapper;
-
-	@Override
-	public void addIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException {
-		if (identifyCode == null || identifyCode.getType() == null
-				|| StringUtil.isNullOrEmpty(identifyCode.getIdentifyCode()))
-			throw new ForbiddenUserIdentifyCodeException(1, "淇℃伅涓嶅畬鏁�");
-
-		ForbiddenUserIdentifyCode old = listByTypeAndIdentifyCode(identifyCode.getType(),
-				identifyCode.getIdentifyCode());
-		if (old != null)
-			throw new ForbiddenUserIdentifyCodeException(2, "淇℃伅宸插瓨鍦�");
-
-		identifyCode.setCreateTime(new Date());
-		identifyCode.setEffective(true);
-		forbiddenUserIdentifyCodeMapper.insertSelective(identifyCode);
-	}
-
-	@Override
-	public ForbiddenUserIdentifyCode listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum type,
-			String identifyCode) {
-		List<ForbiddenUserIdentifyCode> list = forbiddenUserIdentifyCodeMapper.listByTypeAndIdentifyCode(type,
-				identifyCode);
-		if (list != null && list.size() > 0)
-			return list.get(0);
-		else
-			return null;
-	}
-
-	@Override
-	public void update(ForbiddenUserIdentifyCode identifyCode) {
-		if (identifyCode == null)
-			return;
-		identifyCode.setUpdateTime(new Date());
-		forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(identifyCode);
-	}
-
-	@Override
-	public void delete(ForbiddenUserIdentifyCode identifyCode) {
-		if (identifyCode == null || identifyCode.getId() == null)
-			return;
-		forbiddenUserIdentifyCodeMapper.deleteByPrimaryKey(identifyCode.getId());
-	}
-
-	
-	@Override
-	public List<ForbiddenUserIdentifyCodeVO> listQuery(long start, int count, String key, Integer type) {
-		
-		List<ForbiddenUserIdentifyCodeVO> list = forbiddenUserIdentifyCodeMapper.listQuery(start, count, key, type);
-		if (list == null || list.size() == 0) {
-			return list;
-		}
-		
-		for (ForbiddenUserIdentifyCodeVO forbiddenUserIdentifyCodeVO: list) {
-			
-			String f_alipayAccount = forbiddenUserIdentifyCodeVO.getF_alipayAccount();
-			if (f_alipayAccount != null && f_alipayAccount.trim().length() > 0) {
-				forbiddenUserIdentifyCodeVO.setAlipayAccountState(1);
-			}
-			
-			String f_phone = forbiddenUserIdentifyCodeVO.getF_phone();
-			if (f_phone != null && f_phone.trim().length() > 0) {
-				forbiddenUserIdentifyCodeVO.setPhoneState(1);
-			}
-			
-			String f_taobaoUid = forbiddenUserIdentifyCodeVO.getF_taobaoUid();
-			if (f_taobaoUid != null && f_taobaoUid.trim().length() > 0) {
-				forbiddenUserIdentifyCodeVO.setTaobaoUidState(1);
-			}
-			
-			String f_wxUnionId = forbiddenUserIdentifyCodeVO.getF_wxUnionId();
-			if (f_wxUnionId != null && f_wxUnionId.trim().length() > 0) {
-				forbiddenUserIdentifyCodeVO.setWxUnionIdState(1);
-			}
-		}
-		
-		return list;
-		
-	}
-	
-	@Override
-	public long countQuery(String key,  Integer type) {
-		return forbiddenUserIdentifyCodeMapper.countQuery(key, type);
-	}
-
-	
-	@Override
-	public void saveForbiddenInfo(String identifyCode, Integer type, boolean state) throws ForbiddenUserIdentifyCodeException{
-		
-		ForbiddenUserIdentifyCodeTypeEnum typeEnum = null;
-		
-		switch(type) {
-			case 1: // 寰俊璐﹀彿
-				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.wxUnionId;
-				break;
-			case 2: // 娣樺疂璐﹀彿
-				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.taobaoUid;
-				break;
-			case 3: // 鐢佃瘽鍙风爜
-				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.phone;
-				break;
-			case 4: // 鏀粯瀹濊处鍙�
-				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.alipayAccount;
-				break;
-			default:
-				break;
-		}
-		
-		if (typeEnum == null) {
-			throw new ForbiddenUserIdentifyCodeException(1, "绫诲瀷涓嶅尮閰�");
-		}
-		
-		ForbiddenUserIdentifyCode codeObject = listByTypeAndIdentifyCode(typeEnum ,identifyCode);
-		if (codeObject == null) {
-			// 灏佺璐︽埛
-			if (state) {
-				codeObject = new ForbiddenUserIdentifyCode();
-				codeObject.setType(typeEnum);
-				codeObject.setIdentifyCode(identifyCode);
-				codeObject.setEffective(state);
-				codeObject.setCreateTime(new Date());
-				codeObject.setUpdateTime(new Date());
-				
-				forbiddenUserIdentifyCodeMapper.insertSelective(codeObject);
-			} else {
-				throw new ForbiddenUserIdentifyCodeException(1, "鏈壘鍒板彲瑙e皝鍙风爜");
-			}
-		} else {
-			codeObject.setEffective(state);
-			codeObject.setUpdateTime(new Date());
-			forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(codeObject);
-		}
-	}
-	
-}
+package com.yeshi.fanli.service.impl.user;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dao.mybatis.user.ForbiddenUserIdentifyCodeMapper;
+import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
+import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
+import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
+import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
+import com.yeshi.fanli.util.StringUtil;
+
+@Service
+public class ForbiddenUserIdentifyCodeServiceImpl implements ForbiddenUserIdentifyCodeService {
+
+	@Resource
+	private ForbiddenUserIdentifyCodeMapper forbiddenUserIdentifyCodeMapper;
+
+	@Override
+	public void forbiddenIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException {
+		if (identifyCode == null || identifyCode.getType() == null
+				|| StringUtil.isNullOrEmpty(identifyCode.getIdentifyCode()))
+			throw new ForbiddenUserIdentifyCodeException(1, "淇℃伅涓嶅畬鏁�");
+
+		ForbiddenUserIdentifyCode old = listByTypeAndIdentifyCode(identifyCode.getType(),
+				identifyCode.getIdentifyCode());
+		if (old != null) {
+			identifyCode.setId(old.getId());
+		}
+
+		identifyCode.setCreateTime(new Date());
+		identifyCode.setEffective(true);
+		forbiddenUserIdentifyCodeMapper.insertSelective(identifyCode);
+	}
+
+	@Override
+	public ForbiddenUserIdentifyCode listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum type,
+			String identifyCode) {
+		List<ForbiddenUserIdentifyCode> list = forbiddenUserIdentifyCodeMapper.listByTypeAndIdentifyCode(type,
+				identifyCode);
+		if (list != null && list.size() > 0)
+			return list.get(0);
+		else
+			return null;
+	}
+
+	@Override
+	public void update(ForbiddenUserIdentifyCode identifyCode) {
+		if (identifyCode == null)
+			return;
+		identifyCode.setUpdateTime(new Date());
+		forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(identifyCode);
+	}
+
+	@Override
+	public void delete(ForbiddenUserIdentifyCode identifyCode) {
+		if (identifyCode == null || identifyCode.getId() == null)
+			return;
+		forbiddenUserIdentifyCodeMapper.deleteByPrimaryKey(identifyCode.getId());
+	}
+
+	
+	@Override
+	public void saveForbiddenInfo(String identifyCode, Integer type) throws ForbiddenUserIdentifyCodeException{
+		
+		ForbiddenUserIdentifyCodeTypeEnum typeEnum = null;
+		
+		switch(type) {
+			case 1: // 寰俊璐﹀彿
+				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.wxUnionId;
+				break;
+			case 2: // 娣樺疂璐﹀彿
+				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.taobaoUid;
+				break;
+			case 3: // 鐢佃瘽鍙风爜
+				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.phone;
+				break;
+			case 4: // 鏀粯瀹濊处鍙�
+				typeEnum = ForbiddenUserIdentifyCodeTypeEnum.alipayAccount;
+				break;
+			default:
+				throw new ForbiddenUserIdentifyCodeException(1, "绫诲瀷涓嶅尮閰�");
+		}
+		
+		
+		ForbiddenUserIdentifyCode codeObject = listByTypeAndIdentifyCode(typeEnum ,identifyCode);
+		if (codeObject == null) {
+			// 灏佺
+			codeObject = new ForbiddenUserIdentifyCode();
+			codeObject.setType(typeEnum);
+			codeObject.setIdentifyCode(identifyCode);
+			codeObject.setEffective(true);
+			codeObject.setCreateTime(new Date());
+			codeObject.setUpdateTime(new Date());
+			
+			forbiddenUserIdentifyCodeMapper.insertSelective(codeObject);
+		} else {
+			
+			Boolean effective = codeObject.getEffective();
+			if (effective) {
+				// 瑙e皝
+				codeObject.setEffective(false);
+			} else {
+				// 灏佺
+				codeObject.setEffective(true);
+			}
+			
+			
+			codeObject.setUpdateTime(new Date());
+			forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(codeObject);
+		}
+	}
+	
+}

--
Gitblit v1.8.0