Commit d58cbe4d by 张建升

代码同步

parent 098f219a
...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.contract; ...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean; import com.gingersoft.supply_chain.mvp.bean.BuyIngredientsBean;
import com.gingersoft.supply_chain.mvp.bean.DishesResultBean; import com.gingersoft.supply_chain.mvp.bean.DishesResultBean;
import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishesGroupNode;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -19,7 +20,7 @@ public interface DishesContract { ...@@ -19,7 +20,7 @@ public interface DishesContract {
/** /**
* 加載菜品組數據 * 加載菜品組數據
*/ */
void loadDishGroupInfo(DishesResultBean dishGroup); void loadDishGroupInfo( List<DishesGroupNode> dishGroup);
void loadDishesInfo(DishesResultBean dishes); void loadDishesInfo(DishesResultBean dishes);
......
...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.chad.library.adapter.base.entity.node.BaseNode;
import com.gingersoft.gsa.cloud.common.constans.AppConstant; import com.gingersoft.gsa.cloud.common.constans.AppConstant;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.DishesBean; import com.gingersoft.supply_chain.mvp.bean.DishesBean;
...@@ -82,6 +83,7 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -82,6 +83,7 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
//將分類食品的list容量設置為一級分類的數量,這樣就不用擔心之後加載不同position的分類數據時,計算位置了 //將分類食品的list容量設置為一級分類的數量,這樣就不用擔心之後加載不同position的分類數據時,計算位置了
LogUtils.warnInfo(" zjs ="+data.getCount()); LogUtils.warnInfo(" zjs ="+data.getCount());
List<BaseNode> myData=new ArrayList<>();
List<DishesBean> list= data.getList(); List<DishesBean> list= data.getList();
List<DishesBean> plist= new ArrayList<>(); List<DishesBean> plist= new ArrayList<>();
List<DishesBean> clist= new ArrayList<>(); List<DishesBean> clist= new ArrayList<>();
...@@ -101,6 +103,7 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -101,6 +103,7 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
plist.add(dishesBean);//父菜单 plist.add(dishesBean);//父菜单
DishesGroupNode groupNode=new DishesGroupNode(dishesBean); DishesGroupNode groupNode=new DishesGroupNode(dishesBean);
pNodes.add(groupNode); pNodes.add(groupNode);
myData.add(groupNode);
} }
LogUtils.warnInfo(" zjs =" + list.get(i).toString()); LogUtils.warnInfo(" zjs =" + list.get(i).toString());
} }
...@@ -108,17 +111,21 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC ...@@ -108,17 +111,21 @@ public class DishesPresenter extends BasePresenter<DishesContract.Model, DishesC
for (int i = 0; i < pNodes.size(); i++) { for (int i = 0; i < pNodes.size(); i++) {
DishesGroupNode groupNode= pNodes.get(i); DishesGroupNode groupNode= pNodes.get(i);
List<DishNode> subNode= new ArrayList<>(); List<DishNode> subNode= new ArrayList<>();
// List<BaseNode> bNodeList= new ArrayList<>();
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
DishesBean dishesBean =clist.get(i); DishesBean dishesBean =clist.get(i);
if (groupNode.getId() == dishesBean.getParentId()) { if (groupNode.getId() == dishesBean.getParentId()) {
DishNode cNode=new DishNode(dishesBean); DishNode cNode=new DishNode(dishesBean);
subNode.add(cNode); subNode.add(cNode);
groupNode.addChildNode(cNode);
LogUtils.warnInfo(" zjs"," groupNode 组"+groupNode.getFoodName() +" 彩民"+cNode.getFoodName());
} }
} }
LogUtils.warnInfo(" zjs"," groupNode "+groupNode.getFoodName() +" 数量"+subNode.size());
groupNode.setDishNodes(subNode); groupNode.setDishNodes(subNode);
} }
mRootView.loadDishGroupInfo(pNodes);
LogUtils.warnInfo(" zjs end="+(System.currentTimeMillis()-start)); LogUtils.warnInfo(" zjs end="+(System.currentTimeMillis()-start));
} }
......
...@@ -6,6 +6,7 @@ import com.chad.library.adapter.base.entity.node.BaseExpandNode; ...@@ -6,6 +6,7 @@ import com.chad.library.adapter.base.entity.node.BaseExpandNode;
import com.chad.library.adapter.base.entity.node.BaseNode; import com.chad.library.adapter.base.entity.node.BaseNode;
import com.gingersoft.supply_chain.mvp.bean.DishesBean; import com.gingersoft.supply_chain.mvp.bean.DishesBean;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DishNode extends BaseExpandNode { public class DishNode extends BaseExpandNode {
...@@ -26,7 +27,15 @@ public class DishNode extends BaseExpandNode { ...@@ -26,7 +27,15 @@ public class DishNode extends BaseExpandNode {
this.seqNo = dishesBean.getSeqNo(); this.seqNo = dishesBean.getSeqNo();
this.foodName = dishesBean.getFoodName(); this.foodName = dishesBean.getFoodName();
} }
public void addChildNode(BaseNode baseNode) {
if (baseNode == null) {
return;
}
if (childNode == null) {
childNode = new ArrayList<>();
}
childNode.add(baseNode);
}
public int getId() { public int getId() {
return id; return id;
} }
......
...@@ -6,6 +6,7 @@ import com.gingersoft.supply_chain.mvp.bean.DishesBean; ...@@ -6,6 +6,7 @@ import com.gingersoft.supply_chain.mvp.bean.DishesBean;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DishesGroupNode extends BaseExpandNode{ public class DishesGroupNode extends BaseExpandNode{
...@@ -102,6 +103,15 @@ public class DishesGroupNode extends BaseExpandNode{ ...@@ -102,6 +103,15 @@ public class DishesGroupNode extends BaseExpandNode{
this.childNode = childNode; this.childNode = childNode;
setExpanded(false); setExpanded(false);
} }
public void addChildNode(BaseNode baseNode) {
if (baseNode == null) {
return;
}
if (childNode == null) {
childNode = new ArrayList<>();
}
childNode.add(baseNode);
}
public String getTitle() { public String getTitle() {
return foodName; return foodName;
......
...@@ -73,9 +73,9 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -73,9 +73,9 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
mPresenter.getDishesData(); mPresenter.getDishesData();
} }
private void initDishes(){ private void initDishes( List<DishesGroupNode> dishesGroupNodes){
DishesTreeAdapter dishesTreeAdapter = new DishesTreeAdapter(); DishesTreeAdapter dishesTreeAdapter = new DishesTreeAdapter();
dishesTreeAdapter.setList(getEntity()); dishesTreeAdapter.setList(dishesGroupNodes);
rvDishes.setLayoutManager(new CenterLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)); rvDishes.setLayoutManager(new CenterLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
rvDishes.setAdapter(dishesTreeAdapter); rvDishes.setAdapter(dishesTreeAdapter);
} }
...@@ -102,8 +102,8 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -102,8 +102,8 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
@Override @Override
public void loadDishGroupInfo(DishesResultBean dishGroup) { public void loadDishGroupInfo( List<DishesGroupNode> dishGroup) {
initDishes(dishGroup);
} }
@Override @Override
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<ImageView <ImageView
android:id="@+id/iv_dishes_group_icon" android:id="@+id/iv_dishes_group_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:visibility="gone"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
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