提交 d7095f41 authored 作者: lgd's avatar lgd

1.历史价格,产品详情页,

2.//TODO erp用户激活,忘记密码测试,产品详情数据调整,搜索具体调试,产品下单,产品两个弹窗详情,bat,mes,消息,我的,刷新token
上级 9ede3504
...@@ -281,6 +281,22 @@ ...@@ -281,6 +281,22 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Work.Base" android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.work.WorkProDetailActivity"
android:configChanges="keyboardHidden|orientation"
android:label="产品详情"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.work.WorkProPriceActivity"
android:configChanges="keyboardHidden|orientation"
android:label="产品价格"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider" android:authorities="com.wd.workoffice.fileprovider"
......
package com.wd.workoffice.bean;
import com.wd.workoffice.app.BaseBean;
import java.util.List;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class ProDetail extends BaseBean {
/**
* message : null
* data : {"productInfo":{"createdBy":1,"createdByName":null,"createdTime":"2020-02-24 15:49:48","updatedBy":680,"updatedByName":null,"updatedTime":"2020-03-20 21:09:11","id":40,"soleCode":"产品test","simpleCode":"产品test","name":"产品test","spec":"产品test","unit":"产品test","weight":1,"internalPrice":50,"processType":"外采购流程","processTypeList":null,"productTypeId":3,"ofKind":"外购贴牌","expectOutputDeptId":null,"erpId":"产品test","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":"塞棒","expectOutputDeptName":null,"isExpectOut":false,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null},"transitPartRelList":[],"outDeptRelList":[]}
* path : null
* ext : null
*/
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* productInfo : {"createdBy":1,"createdByName":null,"createdTime":"2020-02-24 15:49:48","updatedBy":680,"updatedByName":null,"updatedTime":"2020-03-20 21:09:11","id":40,"soleCode":"产品test","simpleCode":"产品test","name":"产品test","spec":"产品test","unit":"产品test","weight":1,"internalPrice":50,"processType":"外采购流程","processTypeList":null,"productTypeId":3,"ofKind":"外购贴牌","expectOutputDeptId":null,"erpId":"产品test","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":"塞棒","expectOutputDeptName":null,"isExpectOut":false,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null}
* transitPartRelList : []
* outDeptRelList : []
*/
private ProductInfoBean productInfo;
private List<?> transitPartRelList;
private List<?> outDeptRelList;
public ProductInfoBean getProductInfo() {
return productInfo;
}
public void setProductInfo(ProductInfoBean productInfo) {
this.productInfo = productInfo;
}
public List<?> getTransitPartRelList() {
return transitPartRelList;
}
public void setTransitPartRelList(List<?> transitPartRelList) {
this.transitPartRelList = transitPartRelList;
}
public List<?> getOutDeptRelList() {
return outDeptRelList;
}
public void setOutDeptRelList(List<?> outDeptRelList) {
this.outDeptRelList = outDeptRelList;
}
public static class ProductInfoBean {
/**
* createdBy : 1
* createdByName : null
* createdTime : 2020-02-24 15:49:48
* updatedBy : 680
* updatedByName : null
* updatedTime : 2020-03-20 21:09:11
* id : 40
* soleCode : 产品test
* simpleCode : 产品test
* name : 产品test
* spec : 产品test
* unit : 产品test
* weight : 1.0
* internalPrice : 50.0
* processType : 外采购流程
* processTypeList : null
* productTypeId : 3
* ofKind : 外购贴牌
* expectOutputDeptId : null
* erpId : 产品test
* status : 1
* createdUser : null
* shelfAction : null
* updatedUser : null
* outDeptId : null
* outDeptName : null
* productTypeName : 塞棒
* expectOutputDeptName : null
* isExpectOut : false
* ofKindName : null
* statusName : null
* relList : null
* outDeptCreatedBy : null
* outDeptCreatedTime : null
* transitPartId : null
* transitPartTypeCode : null
* remark : null
*/
private int createdBy;
private Object createdByName;
private String createdTime;
private int updatedBy;
private Object updatedByName;
private String updatedTime;
private int id;
private String soleCode;
private String simpleCode;
private String name;
private String spec;
private String unit;
private double weight;
private double internalPrice;
private String processType;
private Object processTypeList;
private int productTypeId;
private String ofKind;
private Object expectOutputDeptId;
private String erpId;
private String status;
private Object createdUser;
private Object shelfAction;
private Object updatedUser;
private Object outDeptId;
private Object outDeptName;
private String productTypeName;
private Object expectOutputDeptName;
private boolean isExpectOut;
private Object ofKindName;
private Object statusName;
private Object relList;
private Object outDeptCreatedBy;
private Object outDeptCreatedTime;
private Object transitPartId;
private Object transitPartTypeCode;
private Object remark;
public int getCreatedBy() {
return createdBy;
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public int getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(int updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public String getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSoleCode() {
return soleCode;
}
public void setSoleCode(String soleCode) {
this.soleCode = soleCode;
}
public String getSimpleCode() {
return simpleCode;
}
public void setSimpleCode(String simpleCode) {
this.simpleCode = simpleCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public double getInternalPrice() {
return internalPrice;
}
public void setInternalPrice(double internalPrice) {
this.internalPrice = internalPrice;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public Object getProcessTypeList() {
return processTypeList;
}
public void setProcessTypeList(Object processTypeList) {
this.processTypeList = processTypeList;
}
public int getProductTypeId() {
return productTypeId;
}
public void setProductTypeId(int productTypeId) {
this.productTypeId = productTypeId;
}
public String getOfKind() {
return ofKind;
}
public void setOfKind(String ofKind) {
this.ofKind = ofKind;
}
public Object getExpectOutputDeptId() {
return expectOutputDeptId;
}
public void setExpectOutputDeptId(Object expectOutputDeptId) {
this.expectOutputDeptId = expectOutputDeptId;
}
public String getErpId() {
return erpId;
}
public void setErpId(String erpId) {
this.erpId = erpId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Object getCreatedUser() {
return createdUser;
}
public void setCreatedUser(Object createdUser) {
this.createdUser = createdUser;
}
public Object getShelfAction() {
return shelfAction;
}
public void setShelfAction(Object shelfAction) {
this.shelfAction = shelfAction;
}
public Object getUpdatedUser() {
return updatedUser;
}
public void setUpdatedUser(Object updatedUser) {
this.updatedUser = updatedUser;
}
public Object getOutDeptId() {
return outDeptId;
}
public void setOutDeptId(Object outDeptId) {
this.outDeptId = outDeptId;
}
public Object getOutDeptName() {
return outDeptName;
}
public void setOutDeptName(Object outDeptName) {
this.outDeptName = outDeptName;
}
public String getProductTypeName() {
return productTypeName;
}
public void setProductTypeName(String productTypeName) {
this.productTypeName = productTypeName;
}
public Object getExpectOutputDeptName() {
return expectOutputDeptName;
}
public void setExpectOutputDeptName(Object expectOutputDeptName) {
this.expectOutputDeptName = expectOutputDeptName;
}
public boolean isIsExpectOut() {
return isExpectOut;
}
public void setIsExpectOut(boolean isExpectOut) {
this.isExpectOut = isExpectOut;
}
public Object getOfKindName() {
return ofKindName;
}
public void setOfKindName(Object ofKindName) {
this.ofKindName = ofKindName;
}
public Object getStatusName() {
return statusName;
}
public void setStatusName(Object statusName) {
this.statusName = statusName;
}
public Object getRelList() {
return relList;
}
public void setRelList(Object relList) {
this.relList = relList;
}
public Object getOutDeptCreatedBy() {
return outDeptCreatedBy;
}
public void setOutDeptCreatedBy(Object outDeptCreatedBy) {
this.outDeptCreatedBy = outDeptCreatedBy;
}
public Object getOutDeptCreatedTime() {
return outDeptCreatedTime;
}
public void setOutDeptCreatedTime(Object outDeptCreatedTime) {
this.outDeptCreatedTime = outDeptCreatedTime;
}
public Object getTransitPartId() {
return transitPartId;
}
public void setTransitPartId(Object transitPartId) {
this.transitPartId = transitPartId;
}
public Object getTransitPartTypeCode() {
return transitPartTypeCode;
}
public void setTransitPartTypeCode(Object transitPartTypeCode) {
this.transitPartTypeCode = transitPartTypeCode;
}
public Object getRemark() {
return remark;
}
public void setRemark(Object remark) {
this.remark = remark;
}
}
}
}
package com.wd.workoffice.bean;
import java.util.List;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class ProPriceBean {
/**
* records : [{"createdBy":680,"createdByName":"吴同得","createdTime":"2020-03-13 15:56:02","updatedBy":null,"updatedByName":null,"updatedTime":null,"id":14,"productId":40,"productName":"产品test","originalPrice":null,"newPrice":1,"remark":"His"},{"createdBy":680,"createdByName":"吴同得","createdTime":"2020-03-13 15:57:54","updatedBy":null,"updatedByName":null,"updatedTime":null,"id":15,"productId":40,"productName":"产品test","originalPrice":1,"newPrice":12,"remark":"His"},{"createdBy":680,"createdByName":"吴同得","createdTime":"2020-03-20 21:09:11","updatedBy":null,"updatedByName":null,"updatedTime":null,"id":16,"productId":40,"productName":"产品test","originalPrice":12,"newPrice":50,"remark":"50"}]
* total : 3
* size : 10
* current : 1
* orders : []
* searchCount : true
* pages : 1
*/
private int total;
private int size;
private int current;
private boolean searchCount;
private int pages;
private List<RecordsBean> records;
private List<?> orders;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
public boolean isSearchCount() {
return searchCount;
}
public void setSearchCount(boolean searchCount) {
this.searchCount = searchCount;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public List<RecordsBean> getRecords() {
return records;
}
public void setRecords(List<RecordsBean> records) {
this.records = records;
}
public List<?> getOrders() {
return orders;
}
public void setOrders(List<?> orders) {
this.orders = orders;
}
public static class RecordsBean {
/**
* createdBy : 680
* createdByName : 吴同得
* createdTime : 2020-03-13 15:56:02
* updatedBy : null
* updatedByName : null
* updatedTime : null
* id : 14
* productId : 40
* productName : 产品test
* originalPrice : null
* newPrice : 1.0
* remark : His
*/
private int createdBy;
private String createdByName;
private String createdTime;
private Object updatedBy;
private Object updatedByName;
private Object updatedTime;
private int id;
private int productId;
private String productName;
private Object originalPrice;
private double newPrice;
private String remark;
public int getCreatedBy() {
return createdBy;
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public String getCreatedByName() {
return createdByName;
}
public void setCreatedByName(String createdByName) {
this.createdByName = createdByName;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public Object getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Object updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public Object getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Object updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getProductId() {
return productId;
}
public void setProductId(int productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Object getOriginalPrice() {
return originalPrice;
}
public void setOriginalPrice(Object originalPrice) {
this.originalPrice = originalPrice;
}
public double getNewPrice() {
return newPrice;
}
public void setNewPrice(double newPrice) {
this.newPrice = newPrice;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
}
...@@ -158,12 +158,12 @@ public class ProductBean { ...@@ -158,12 +158,12 @@ public class ProductBean {
private Object expectOutputDeptName; private Object expectOutputDeptName;
private Object isExpectOut; private Object isExpectOut;
private Object ofKindName; private Object ofKindName;
private Object statusName; private String statusName;
private Object relList; private Object relList;
private Object outDeptCreatedBy; private Object outDeptCreatedBy;
private Object outDeptCreatedTime; private Object outDeptCreatedTime;
private Object transitPartId; private Object transitPartId;
private Object transitPartTypeCode; private String transitPartTypeCode;
private Object remark; private Object remark;
private String carPrice; private String carPrice;
private int carNum; private int carNum;
...@@ -424,11 +424,11 @@ public class ProductBean { ...@@ -424,11 +424,11 @@ public class ProductBean {
this.ofKindName = ofKindName; this.ofKindName = ofKindName;
} }
public Object getStatusName() { public String getStatusName() {
return statusName; return statusName;
} }
public void setStatusName(Object statusName) { public void setStatusName(String statusName) {
this.statusName = statusName; this.statusName = statusName;
} }
...@@ -464,11 +464,11 @@ public class ProductBean { ...@@ -464,11 +464,11 @@ public class ProductBean {
this.transitPartId = transitPartId; this.transitPartId = transitPartId;
} }
public Object getTransitPartTypeCode() { public String getTransitPartTypeCode() {
return transitPartTypeCode; return transitPartTypeCode;
} }
public void setTransitPartTypeCode(Object transitPartTypeCode) { public void setTransitPartTypeCode(String transitPartTypeCode) {
this.transitPartTypeCode = transitPartTypeCode; this.transitPartTypeCode = transitPartTypeCode;
} }
......
...@@ -3,6 +3,7 @@ package com.wd.workoffice.retrofit; ...@@ -3,6 +3,7 @@ package com.wd.workoffice.retrofit;
import com.wd.workoffice.app.BaseBean; import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.Config; import com.wd.workoffice.app.Config;
import com.wd.workoffice.bean.ProDetail;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -334,15 +335,45 @@ public interface ApiService { ...@@ -334,15 +335,45 @@ public interface ApiService {
/** /**
* 产品列表 * 产品列表
* <p>
* processType
* ofKind 产品种类SM:自制成品OS:外购贴牌RM:原料
* statu 冻结标记0冻结1正常
* isExpectOut 是否上架true:上架false:未上架
* searchValue 模糊搜索(图号、名称)
* *
* @param processType
* @param ofKind 产品种类SM:自制成品OS:外购贴牌RM:原料
* @param statu 冻结标记0冻结1正常
* @param isExpectOut 是否上架true:上架false:未上架
* @param searchValue 模糊搜索(图号、名称)
* @return * @return
*/ */
@GET("product/app/page/list") @GET("/product/app/page/list")
Observable<BaseBean> getPro(@QueryMap Map<String, Object> param); Observable<BaseBean> getPro(@QueryMap Map<String, Object> param);
/**
* 产品详情
* transitPartRelList 往来单位关联
* partTypeCode: SUPPLIER-供应商 CUSTOMER-客户 TRANSPORTERS-运输商
* name:往来单位名称
* address:往来单位地址
* accountName:负责人
* deptName:负责部门
* outDeptRelList 上架情况
* createdTime:上架时间
* deptName:上架部门
* outByUserName:上架操作人
*
* @return
*/
@GET("/product/app/detail/{productId}")
Observable<ProDetail> getProDetail(@Path("productId") Integer id);
/**
* 产品详情
* productId
* current
* size
*
* @return
*/
@GET("/product-price-change/page/list")
Observable<BaseBean> getProHistoryPrice(@QueryMap Map<String, Object> param);
} }
package com.wd.workoffice.ui.activity.bat.work;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.ClientBean;
import com.wd.workoffice.bean.ProDetail;
import com.wd.workoffice.bean.ProductBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* 工作台 - 产品 - 详情
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class WorkProDetailActivity extends WorkToolBarActivity {
@BindView(R.id.tv_card)
TextView tvCard;
@BindView(R.id.tv_img_card)
TextView tvImgCard;
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.tv_spec)
TextView tvSpec;
@BindView(R.id.tv_clazz)
TextView tvClazz;
@BindView(R.id.tv_kind)
TextView tvKind;
@BindView(R.id.tv_unit)
TextView tvUnit;
@BindView(R.id.tv_weight)
TextView tvWeight;
@BindView(R.id.btn_price)
Button btnPrice;
@BindView(R.id.tv_price)
TextView tvPrice;
@BindView(R.id.tv_status)
TextView tvStatus;
@BindView(R.id.tv_process)
TextView tvProcess;
@BindView(R.id.tv_dep)
TextView tvDep;
@BindView(R.id.tv_dep_name)
TextView tvDepName;
@BindView(R.id.tv_dep_type)
TextView tvDepType;
@BindView(R.id.tv_dep_address)
TextView tvDepAddress;
@BindView(R.id.tv_dep_price)
TextView tvDepPrice;
@BindView(R.id.tv_dep_person)
TextView tvDepPerson;
@BindView(R.id.tv_dep_person_phone)
TextView tvDepPersonPhone;
@BindView(R.id.tv_dep_person_dep)
TextView tvDepPersonDep;
private ProductBean.RecordsBean proBean;
@Override
protected void initView() {
ButterKnife.bind(this);
}
@Override
protected void initData() {
String pro = getIntent().getStringExtra("pro");
if (!TextUtils.isEmpty(pro)) {
proBean = JSON.parseObject(pro, ProductBean.RecordsBean.class);
getData(proBean.getId());
tvCard.setText(proBean.getSoleCode());
// tvImgCard.setText(proBean.get());
tvName.setText(proBean.getName());
tvSpec.setText(proBean.getSpec());
tvClazz.setText(proBean.getProcessType());
tvKind.setText(proBean.getTransitPartTypeCode());
tvUnit.setText(proBean.getUnit());
tvWeight.setText(String.valueOf(proBean.getWeight()));
tvPrice.setText(String.valueOf(proBean.getInternalPrice()));
tvStatus.setText(proBean.getStatusName());
}
}
private void getData(Integer id) {
RtfUtils.getRtf().getProDetail(id).compose(Transformer.schedule()).subscribe(new WorkObserver<ProDetail>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(ProDetail data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
// ProDetail.DataBean.ProductInfoBean productInfo = data.getData().getProductInfo();
// tvDep.setText(productInfo.getdep());
// tvDepName.setText(productInfo.getName());
// tvDepType.setText("类别:"+productInfo.getTransitPartTypeCode());
// tvDepType.setText("地址:"+productInfo.get;
// tvDepType.setText(""+productInfo.getName());
// tvDepName.setText(productInfo.getName());
// transitPartRelList 往来单位关联
// * partTypeCode: SUPPLIER-供应商 CUSTOMER-客户 TRANSPORTERS-运输商
// * name:往来单位名称
// * address:往来单位地址
// * accountName:负责人
// * deptName:负责部门
// * outDeptRelList 上架情况
// * createdTime:上架时间
// * deptName:上架部门
// * outByUserName:上架操作人
}
});
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_work_pro_details;
}
@OnClick(R.id.btn_price)
public void onViewClicked() {
startActivity(WorkProPriceActivity.class, "id", proBean.getId()+"");
}
}
package com.wd.workoffice.ui.activity.bat.work;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.ClientBean;
import com.wd.workoffice.bean.ProPriceBean;
import com.wd.workoffice.bean.SaleOrderBean;
import com.wd.workoffice.presenter.SaleSalePresenter;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.adapter.SaleInsideAdapter;
import com.wd.workoffice.ui.adapter.WorkProPriceAdapter;
import com.wd.workoffice.util.WorkUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class WorkProPriceActivity extends WorkToolBarActivity {
@BindView(R.id.rv_data)
RecyclerView rvData;
@BindView(R.id.srl_refresh)
SmartRefreshLayout srlRefresh;
private String state;
private SaleSalePresenter saleSalePresenter;
private Map<String, Object> param;
private List<ProPriceBean.RecordsBean> dataList;
private WorkProPriceAdapter dataAdapter;
private int page = 1;
@Override
protected void initView() {
ButterKnife.bind(this);
// saleSalePresenter = new SaleSalePresenter();
// saleSalePresenter.onAttach(this);
rvData.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
}
@Override
protected void initData() {
dataList = new ArrayList<>();
dataAdapter = new WorkProPriceAdapter(R.layout.item_pro_price, dataList);
dataAdapter.bindToRecyclerView(rvData);
param = WorkUtils.pageKey();
param.put("productId", getIntent().getStringExtra("id"));
param.put("current", page);
getData();
}
private void getData() {
RtfUtils.getRtf().getProHistoryPrice(param).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
List<ProPriceBean.RecordsBean> getList = JSON.parseObject(data.getData().toString(), ProPriceBean.class).getRecords();
if (page == 1) {
srlRefresh.finishRefresh();
dataList.clear();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
dataAdapter.loadMoreComplete();
} else {
dataAdapter.loadMoreComplete();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
}
if (getList.size() == 0) {
dataAdapter.loadMoreEnd();
} else {
page++;
}
}
});
}
@Override
protected void initEvent() {
srlRefresh.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
page = 1;
param.put("current", page);
getData();
}
});
dataAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
param.put("current", page);
getData();
}
}, rvData);
}
@Override
protected int layoutId() {
return R.layout.activity_pro_price;
}
}
package com.wd.workoffice.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.ProPriceBean;
import com.wd.workoffice.bean.SaleOrderBean;
import java.util.List;
/**
* Created by flexible on 2018/8/13.
*/
public class WorkProPriceAdapter extends BaseQuickAdapter<ProPriceBean.RecordsBean, BaseViewHolder> {
public WorkProPriceAdapter(int layoutResId, List data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, ProPriceBean.RecordsBean item) {
helper.setText(R.id.tv_price, String.valueOf(item.getNewPrice()));
helper.setText(R.id.tv_time, item.getCreatedTime());
helper.setText(R.id.tv_person, "提交人:".concat(item.getCreatedByName()));
helper.setText(R.id.tv_remark, "备注:".concat(item.getRemark()));
}
}
...@@ -2,7 +2,10 @@ package com.wd.workoffice.ui.fg; ...@@ -2,7 +2,10 @@ package com.wd.workoffice.ui.fg;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkBaseFg; import com.wd.workoffice.app.WorkBaseFg;
...@@ -11,6 +14,7 @@ import com.wd.workoffice.bean.StockBean; ...@@ -11,6 +14,7 @@ import com.wd.workoffice.bean.StockBean;
import com.wd.workoffice.bean.listener.ProFilterClickListener; import com.wd.workoffice.bean.listener.ProFilterClickListener;
import com.wd.workoffice.contract.WorkProContract; import com.wd.workoffice.contract.WorkProContract;
import com.wd.workoffice.presenter.WorkProPresenter; import com.wd.workoffice.presenter.WorkProPresenter;
import com.wd.workoffice.ui.activity.bat.work.WorkProDetailActivity;
import com.wd.workoffice.ui.adapter.WorkProductAdapter; import com.wd.workoffice.ui.adapter.WorkProductAdapter;
import com.wd.workoffice.util.ProFilterData; import com.wd.workoffice.util.ProFilterData;
import com.wd.workoffice.util.WorkUtils; import com.wd.workoffice.util.WorkUtils;
...@@ -104,7 +108,7 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View ...@@ -104,7 +108,7 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View
dataList = new ArrayList<>(); dataList = new ArrayList<>();
workProductAdapter = new WorkProductAdapter(R.layout.item_work_product, dataList); workProductAdapter = new WorkProductAdapter(R.layout.item_work_product, dataList);
workProductAdapter.bindToRecyclerView(rvData); workProductAdapter.bindToRecyclerView(rvData);
workProductAdapter.setEmptyView(R.layout.view_empty_content,rvData); workProductAdapter.setEmptyView(R.layout.view_empty_content, rvData);
workProPresenter.getPro(param); workProPresenter.getPro(param);
} }
...@@ -128,6 +132,12 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View ...@@ -128,6 +132,12 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View
param.put("current", page); param.put("current", page);
workProPresenter.getPro(param); workProPresenter.getPro(param);
}, rvData); }, rvData);
workProductAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
startActivity(WorkProDetailActivity.class, "pro", JSON.toJSONString(dataList.get(position)));
}
});
} }
@Override @Override
......
<?xml version="1.0" encoding="utf-8"?>
<com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/srl_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
\ No newline at end of file
...@@ -339,7 +339,6 @@ ...@@ -339,7 +339,6 @@
android:layout_marginLeft="20mm" android:layout_marginLeft="20mm"
android:layout_marginTop="10mm" android:layout_marginTop="10mm"
android:layout_marginBottom="10mm" android:layout_marginBottom="10mm"
android:text="上架信息"
android:textColor="@color/flexible_text_gray" android:textColor="@color/flexible_text_gray"
android:textSize="16sp" /> android:textSize="16sp" />
...@@ -360,7 +359,6 @@ ...@@ -360,7 +359,6 @@
android:layout_marginLeft="20mm" android:layout_marginLeft="20mm"
android:layout_marginTop="10mm" android:layout_marginTop="10mm"
android:layout_marginBottom="10mm" android:layout_marginBottom="10mm"
android:text="上架信息"
android:textColor="@color/flexible_text_gray" android:textColor="@color/flexible_text_gray"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/srl_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
...@@ -9,4 +10,4 @@ ...@@ -9,4 +10,4 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white"
android:orientation="vertical"
android:padding="10mm">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="zzzz" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="zzzz"
android:textColor="@color/flexible_text_sup" />
</RelativeLayout>
<TextView
android:id="@+id/tv_remark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="5mm"
android:text="zzzz"
android:textColor="@color/flexible_text_sup" />
<TextView
android:id="@+id/tv_person"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:text="zzzz"
android:textColor="@color/flexible_text_sup" />
</LinearLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论