Commit 7c440438 authored by chenyuling's avatar chenyuling

"数据长度不变也进行更新数据"

parent 75dcf957
Pipeline #2292 failed with stages
......@@ -251,30 +251,29 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
if (type ==ENTER_TYPE){
if (passEntities != null) {
int size = passEntities.size();
if (size!=lastEnterSize){
/*//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
enterBeans.clear();
enterBeans.addAll(passEntities);
/*//更新进出情况
//enterBeans = passEntities; 全局变量直接赋值会出现问题
enterBeans.clear();
enterBeans.addAll(passEntities);
enterAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> enterListNo = StatSize.filterList(passEntities);
lastEnterSize = enterListNo.size();
}else{
lastEnterSize = size;
//更新分组情况(是否要根据id去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
enterBeans.clear();
enterBeans.addAll(passEntities);
lastEnterSize = size;
//更新分组情况(是否要根据id去重)
groupEnterHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
}else if (type == LEAVE_TYPE){
......@@ -282,29 +281,27 @@ public class MainActivity extends BaseActivity implements NetworkIPMonitor.OnIPC
if (passEntities != null) {
int size = passEntities.size();
//进出有变化时才更新
if (size!=lastLeaveSize){
/*leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
leaveBeans.clear();
leaveBeans.addAll(passEntities);
/*leaveBeans.clear();
leaveBeans.addAll(passEntities);
//更新进出情况
leaveAdapter.setDataList(passEntities);
//更新人员情况(是否要根据id去重)
if (NEED_NO_REPET) {
List<PersonEntity> leaveListNo = StatSize.filterList(passEntities);
lastLeaveSize = leaveListNo.size();
}else{
lastLeaveSize = size;
//更新分组情况(是否要根据id去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
lastPresentSize = lastEnterSize-lastLeaveSize;
mBinding.nvEnter.setNumber(lastEnterSize);
mBinding.nvLeave.setNumber(lastLeaveSize);
mBinding.nvPresent.setNumber(lastPresentSize);*/
leaveBeans.clear();
leaveBeans.addAll(passEntities);
lastLeaveSize = size;
//更新分组情况(是否要根据id去重)
groupLeaveHashMap = getGroupSizeHashMap(passEntities);
updatePresentSize(groupEnterHashMap,groupLeaveHashMap);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment