yujian
2019-12-10 c8041ec0544bf122e6819e6bf698997ccbf30aaf
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ForbiddenUserIdentifyCodeServiceImpl.java
@@ -21,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);
@@ -82,16 +83,13 @@
            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) {
         // 封禁账户
         // 封禁
         codeObject = new ForbiddenUserIdentifyCode();
         codeObject.setType(typeEnum);
         codeObject.setIdentifyCode(identifyCode);
@@ -101,7 +99,17 @@
         
         forbiddenUserIdentifyCodeMapper.insertSelective(codeObject);
      } else {
         codeObject.setEffective(false);
         Boolean effective = codeObject.getEffective();
         if (effective) {
            // 解封
            codeObject.setEffective(false);
         } else {
            // 封禁
            codeObject.setEffective(true);
         }
         codeObject.setUpdateTime(new Date());
         forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(codeObject);
      }