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/ForbiddenUserIdentifyCodeServiceImpl.java | 236 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 118 insertions(+), 118 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 44ffd34..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,118 +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; - -@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); - } - } - -} +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