From 573c491b4a1ba60e12a5678a01c1546c0077c1ee Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 30 七月 2019 09:07:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java | 90 +++++++++++++-------------------------------- 1 files changed, 26 insertions(+), 64 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..44ffd34 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 @@ -13,7 +13,6 @@ 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 { @@ -22,15 +21,16 @@ private ForbiddenUserIdentifyCodeMapper forbiddenUserIdentifyCodeMapper; @Override - public void addIdentifyCode(ForbiddenUserIdentifyCode identifyCode) throws ForbiddenUserIdentifyCodeException { + 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) - throw new ForbiddenUserIdentifyCodeException(2, "淇℃伅宸插瓨鍦�"); + if (old != null) { + identifyCode.setId(old.getId()); + } identifyCode.setCreateTime(new Date()); identifyCode.setEffective(true); @@ -65,48 +65,7 @@ @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{ + public void saveForbiddenInfo(String identifyCode, Integer type) throws ForbiddenUserIdentifyCodeException{ ForbiddenUserIdentifyCodeTypeEnum typeEnum = null; @@ -124,30 +83,33 @@ typeEnum = ForbiddenUserIdentifyCodeTypeEnum.alipayAccount; break; default: - break; + throw new ForbiddenUserIdentifyCodeException(1, "绫诲瀷涓嶅尮閰�"); } - 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皝鍙风爜"); - } + // 灏佺 + codeObject = new ForbiddenUserIdentifyCode(); + codeObject.setType(typeEnum); + codeObject.setIdentifyCode(identifyCode); + codeObject.setEffective(true); + codeObject.setCreateTime(new Date()); + codeObject.setUpdateTime(new Date()); + + forbiddenUserIdentifyCodeMapper.insertSelective(codeObject); } else { - codeObject.setEffective(state); + + 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