From 88a597dc4300bad81004af2ba37c22da8d75f078 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 12 十一月 2019 12:24:19 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java | 144 +++++++++++++++++++++++-------------------------
1 files changed, 69 insertions(+), 75 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java
index cee31c5..53c45e1 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserCustomSettingsServiceImpl.java
@@ -20,43 +20,40 @@
@Resource
private UserCustomSettingsMapper userCustomSettingsMapper;
-
+
@Override
- public void saveModuleState(Long uid, Integer type, Integer state) throws UserCustomSettingsException{
+ 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, "浼犻�掑弬鏁颁笉姝g‘");
}
-
- String typeNum = null;
- UserSettingTypeEnum mineTypeNum = null;
-
- switch(type) {
- case 1:
- typeNum = UserSettingTypeEnum.cancelNotice.name();
- mineTypeNum = UserSettingTypeEnum.cancelNotice;
- break;
- case 2:
- typeNum = UserSettingTypeEnum.noNewsRedDot.name();
- mineTypeNum = UserSettingTypeEnum.noNewsRedDot;
- break;
- case 3:
- typeNum = UserSettingTypeEnum.noBonusCount.name();
- mineTypeNum = UserSettingTypeEnum.noBonusCount;
- break;
- case 4:
- typeNum = UserSettingTypeEnum.noShareRecordAndStorage.name();
- mineTypeNum = UserSettingTypeEnum.noShareRecordAndStorage;
- break;
- case 5:
- typeNum = UserSettingTypeEnum.noInvitationBonus.name();
- mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
- break;
- default:
- throw new UserCustomSettingsException(1, "鍙傛暟绫诲瀷涓嶅尮閰�");
+
+ UserSettingTypeEnum mineTypeNum = null;
+ if (type.equals(UserSettingTypeEnum.cancelNotice.name())) {
+ mineTypeNum = UserSettingTypeEnum.cancelNotice;
+ } else if (type.equals(UserSettingTypeEnum.noNewsRedDot.name())) {
+ mineTypeNum = UserSettingTypeEnum.noNewsRedDot;
+ } else if (type.equals(UserSettingTypeEnum.noBonusCount.name())) {
+ mineTypeNum = UserSettingTypeEnum.noBonusCount;
+ } else if (type.equals(UserSettingTypeEnum.noShareRecordAndStorage.name())) {
+ mineTypeNum = UserSettingTypeEnum.noShareRecordAndStorage;
+ } else if (type.equals(UserSettingTypeEnum.noInvitationBonus.name())) {
+ mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
+ } else if (type.equals(UserSettingTypeEnum.openSpreadHongBao.name())) {
+ mineTypeNum = UserSettingTypeEnum.openSpreadHongBao;
+ } else {
+ throw new UserCustomSettingsException(1, "鍙傛暟绫诲瀷涓嶅尮閰�");
}
-
- UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid, typeNum);
- if (settings == null) { // 鎻掑叆
+
+ UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid, type);
+ if (settings != null) {
+ // 鏇存柊
+ UserCustomSettings record = new UserCustomSettings();
+ record.setId(settings.getId());
+ record.setState(state);
+ record.setUpdateTime(new Date());
+ userCustomSettingsMapper.updateByPrimaryKeySelective(record);
+ } else {
+ // 鎻掑叆
settings = new UserCustomSettings();
settings.setState(state);
settings.setType(mineTypeNum);
@@ -64,91 +61,88 @@
settings.setUpdateTime(new Date());
settings.setCreateTime(new Date());
userCustomSettingsMapper.insertSelective(settings);
- } else { // 鏇存柊
- UserCustomSettings record = new UserCustomSettings();
- record.setId(settings.getId());
- record.setState(state);
- record.setType(mineTypeNum);
- record.setUpdateTime(new Date());
- userCustomSettingsMapper.updateByPrimaryKeySelective(record);
}
-
+
}
@Override
- public List<UserCustomSettings> getSettingsByUid(Long uid) throws UserCustomSettingsException{
+ public List<UserCustomSettings> getSettingsByUid(Long uid) throws UserCustomSettingsException {
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 ) {
+ public UserCustomSettings getSettingsByUidAndType(Long uid, String type) throws UserCustomSettingsException {
+
+ if (uid == null || type == null || type.trim().length() == 0) {
throw new UserCustomSettingsException(1, "浼犻�掔殑鍙傛暟涓嶈兘涓虹┖");
}
-
+
return userCustomSettingsMapper.getSettingsByUidAndType(uid, type);
}
-
-
+
@Override
- public UserSettingsVO getMySettings(Long uid) throws UserCustomSettingsException{
-
+ public UserSettingsVO getMySettings(Long uid) throws UserCustomSettingsException {
+
UserSettingsVO userSettingsVO = new UserSettingsVO();
-
+
List<UserCustomSettings> list = getSettingsByUid(uid);
-
+
if (list != null && list.size() > 0) {
-
- for (UserCustomSettings userCustomSettings: list) {
-
+
+ for (UserCustomSettings userCustomSettings : list) {
+
Integer state = userCustomSettings.getState();
if (state == null) {
continue;
}
-
+
UserSettingTypeEnum typeEnum = userCustomSettings.getType();
-
- if (typeEnum.equals(UserSettingTypeEnum.cancelNotice) ) {
+
+ if (typeEnum.equals(UserSettingTypeEnum.cancelNotice)) {
userSettingsVO.setCancelNotice(state);
- } else if (typeEnum.equals(UserSettingTypeEnum.noNewsRedDot)){
+ } else if (typeEnum.equals(UserSettingTypeEnum.noNewsRedDot)) {
userSettingsVO.setNoNewsRedDot(state);
- } else if (typeEnum.equals(UserSettingTypeEnum.noBonusCount)){
+ } else if (typeEnum.equals(UserSettingTypeEnum.noBonusCount)) {
userSettingsVO.setNoBonusCount(state);
- } else if (typeEnum.equals(UserSettingTypeEnum.noShareRecordAndStorage)){
+ } else if (typeEnum.equals(UserSettingTypeEnum.noShareRecordAndStorage)) {
userSettingsVO.setNoShareRecordAndStorage(state);
- } else if (typeEnum.equals(UserSettingTypeEnum.noInvitationBonus)){
+ } else if (typeEnum.equals(UserSettingTypeEnum.noInvitationBonus)) {
userSettingsVO.setNoInvitationBonus(state);
- }
-
+ } else if (typeEnum.equals(UserSettingTypeEnum.openSpreadHongBao)) {
+ userSettingsVO.setOpenSpreadHongBao(state);
+ }
+
}
}
-
+
return userSettingsVO;
}
-
-
+
@Override
- public List<Long> getCancelNoticeUsers(){
+ public List<Long> getCancelNoticeUsers() {
return userCustomSettingsMapper.getUserID(UserSettingTypeEnum.cancelNotice.name());
}
-
-
+
@Override
- public boolean validateCancelNoticeByUid(Long uid){
+ public boolean validateCancelNoticeByUid(Long uid) {
boolean ispush = true;
-
+
UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid,
UserSettingTypeEnum.cancelNotice.name());
-
+
if (settings != null && settings.getState() != null && settings.getState() == 1) {
ispush = false;
}
-
+
return ispush;
}
+
+ @Override
+ public List<UserCustomSettings> listByUidListAndTypeAndState(List<Long> uidList, String type, Integer state) {
+ return userCustomSettingsMapper.listByUidListAndTypeAndState(uidList, type, state);
+ }
}
--
Gitblit v1.8.0