| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserCustomSettingsMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
|
| | |
| | | private UserCustomSettingsMapper userCustomSettingsMapper;
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void saveModuleState(Long uid, String type, Integer state) throws UserCustomSettingsException {
|
| | | if (uid == null || type == null || state == null || state > 1 || state < 0) {
|
| | | throw new UserCustomSettingsException(1, "传递参数不正确");
|
| | |
| | | mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
|
| | | } else if (type.equals(UserSettingTypeEnum.openSpreadHongBao.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.openSpreadHongBao;
|
| | | } else if (type.equals(UserSettingTypeEnum.noDisplayPhoneNum.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.noDisplayPhoneNum;
|
| | | } else {
|
| | | throw new UserCustomSettingsException(1, "参数类型不匹配");
|
| | | }
|
| | |
| | | settings.setCreateTime(new Date());
|
| | | userCustomSettingsMapper.insertSelective(settings);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | if (uid == null) {
|
| | | throw new UserCustomSettingsException(1, "uid不能为空");
|
| | | }
|
| | |
|
| | | return userCustomSettingsMapper.getSettingsByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserCustomSettings getSettingsByUidAndType(Long uid, String type) throws UserCustomSettingsException {
|
| | |
|
| | | if (uid == null || type == null || type.trim().length() == 0) {
|
| | | throw new UserCustomSettingsException(1, "传递的参数不能为空");
|
| | | }
|
| | |
| | | userSettingsVO.setNoInvitationBonus(state);
|
| | | } else if (typeEnum.equals(UserSettingTypeEnum.openSpreadHongBao)) {
|
| | | userSettingsVO.setOpenSpreadHongBao(state);
|
| | | } else if (typeEnum.equals(UserSettingTypeEnum.noDisplayPhoneNum)) {
|
| | | userSettingsVO.setNoDisplayPhoneNum(state);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | public List<UserCustomSettings> listByUidListAndTypeAndState(List<Long> uidList, String type, Integer state) {
|
| | | return userCustomSettingsMapper.listByUidListAndTypeAndState(uidList, type, state);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public boolean validateDisplayPhoneByUid(Long uid) {
|
| | | UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid,
|
| | | UserSettingTypeEnum.noDisplayPhoneNum.name());
|
| | | if (settings != null && settings.getState() != null && settings.getState() == 1) {
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | }
|