优化汇总(20170513)补充
This commit is contained in:
@ -606,6 +606,65 @@ public class LibaoUtils {
|
||||
}
|
||||
|
||||
|
||||
// 合并List<LibaoStatusEntity> 和 List<LibaoEntity> 并检查重复领取的礼包
|
||||
public static void initLiBaoEntity(LibaoDao libaoDao, List<LibaoStatusEntity> statusList
|
||||
, List<LibaoEntity> mLibaoList, Context mContext) {
|
||||
|
||||
for (LibaoInfo libaoInfo : libaoDao.getAll()) {
|
||||
for (LibaoStatusEntity libaoStatusEntity : statusList) {
|
||||
if (TextUtils.isEmpty(libaoInfo.getLibaoId()) || TextUtils.isEmpty(libaoStatusEntity.getId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(libaoStatusEntity.getBeforeStatus())) {
|
||||
libaoStatusEntity.setBeforeStatus(libaoStatusEntity.getStatus());
|
||||
}
|
||||
|
||||
if (libaoInfo.getLibaoId().equals(libaoStatusEntity.getId())) {
|
||||
if ("ling".equals(libaoInfo.getStatus()) || "linged".equals(libaoInfo.getStatus())) {
|
||||
libaoStatusEntity.setStatus("linged");
|
||||
} else {
|
||||
libaoStatusEntity.setStatus("taoed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (LibaoEntity libaoEntity : mLibaoList) {
|
||||
for (LibaoStatusEntity libaoStatusEntity : statusList) {
|
||||
if (libaoEntity.getId().equals(libaoStatusEntity.getId())) {
|
||||
libaoEntity.setAvailable(libaoStatusEntity.getAvailable());
|
||||
libaoEntity.setTotal(libaoStatusEntity.getTotal());
|
||||
|
||||
String beforeStatus = libaoStatusEntity.getBeforeStatus();
|
||||
int repeat = libaoEntity.getRepeat();
|
||||
if (repeat > 0
|
||||
&& libaoDao.isCanLing(libaoEntity.getId(), mContext)
|
||||
&& ("ling".equals(beforeStatus) || "tao".equals(beforeStatus))) { // 判断是否可以重复领取
|
||||
if ("ling".equals(beforeStatus)) {
|
||||
if (libaoDao.repeatedLingedCount(libaoStatusEntity.getId()) >= repeat) {
|
||||
libaoEntity.setStatus(libaoStatusEntity.getStatus());
|
||||
} else {
|
||||
libaoEntity.setStatus(beforeStatus);
|
||||
}
|
||||
} else {
|
||||
if (libaoDao.repeatedTaoedCount(libaoStatusEntity.getId()) >= repeat) {
|
||||
libaoEntity.setStatus(libaoStatusEntity.getStatus());
|
||||
} else {
|
||||
libaoEntity.setStatus(beforeStatus);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
libaoEntity.setStatus(libaoStatusEntity.getStatus());
|
||||
}
|
||||
libaoEntity.setBeforeStatus(beforeStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface PostLibaoListener {
|
||||
void postSucced(Object response);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user