| | |
| | | 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 {
|
| | |
| | | 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, "未找到可解封号码");
|
| | | }
|
| | | } else {
|
| | | codeObject.setEffective(state);
|
| | | codeObject.setUpdateTime(new Date());
|
| | | forbiddenUserIdentifyCodeMapper.updateByPrimaryKeySelective(codeObject);
|
| | | }
|
| | | }
|
| | | |
| | | }
|