package com.yeshi.fanli.service.impl.user;
|
|
import java.util.Date;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.stereotype.Service;
|
|
import com.yeshi.fanli.dao.mybatis.user.UserInfoModifyRecordMapper;
|
import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord;
|
import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum;
|
import com.yeshi.fanli.log.LogHelper;
|
import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService;
|
import com.yeshi.fanli.util.StringUtil;
|
|
@Service
|
public class UserInfoModifyRecordServiceImpl implements UserInfoModifyRecordService {
|
|
@Resource
|
private UserInfoModifyRecordMapper userInfoModifyRecordMapper;
|
|
@Resource
|
private IntegralGetService integralGetService;
|
|
@Async()
|
@Override
|
public void addModifyRecord(Long uid, ModifyTypeEnum type, String value) {
|
try {
|
if (uid == null || StringUtil.isNullOrEmpty(value))
|
return;
|
|
long count = countByUid(uid, type.name());
|
if (count == 0) {
|
if (type == ModifyTypeEnum.bindPhone) {
|
integralGetService.addBindPhone(uid);
|
} else if (type == ModifyTypeEnum.bindAlipay) {
|
integralGetService.addBindAlipay(uid);
|
} else if (type == ModifyTypeEnum.bindTaoBao) {
|
integralGetService.addBindTaoBao(uid);
|
} else if (type == ModifyTypeEnum.bindWeiXin) {
|
integralGetService.addBindWeiXin(uid);
|
} else if (type == ModifyTypeEnum.gender) {
|
integralGetService.addSetGender(uid);
|
} else if (type == ModifyTypeEnum.nickName) {
|
integralGetService.addSetNickname(uid);
|
} else if (type == ModifyTypeEnum.portrait) {
|
integralGetService.addSetPortrait(uid);
|
} else if (type == ModifyTypeEnum.setWeiXinNum) {
|
integralGetService.addSetWeiXinNum(uid);
|
}
|
}
|
|
UserInfoModifyRecord record = new UserInfoModifyRecord();
|
record.setUid(uid);
|
record.setType(type);
|
record.setValue(value);
|
record.setCreateTime(new Date());
|
userInfoModifyRecordMapper.insertSelective(record);
|
} catch (Exception e) {
|
LogHelper.errorDetailInfo(e);
|
}
|
}
|
|
@Override
|
public long countByUid(Long uid, String type) {
|
return userInfoModifyRecordMapper.countByUid(uid, type);
|
}
|
}
|