发货时间逻辑优化,首页添加默认以及优化可选项

This commit is contained in:
lijia 2024-08-13 17:37:19 +08:00
parent fa479bd0ec
commit 66cc63d791
11 changed files with 574 additions and 233 deletions

View File

@ -34,8 +34,8 @@ android {
applicationId "com.oneclouds.cargo"
minSdkVersion 23
targetSdkVersion 30
versionCode 29
versionName "3.0.9"
versionCode 30
versionName "3.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@ -0,0 +1,88 @@
package com.oneclouds.cargo.bean;
import java.util.List;
/**
* @author hlh
* @version 1.0.0
* @date 2021/9/15 15:41
* @description:
*/
public class CarShortTypeBean {
private int res;
private int code;
private boolean success;
private String msg;
private List<DataDTO> data;
public int getRes() {
return res;
}
public void setRes(int res) {
this.res = res;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<DataDTO> getData() {
return data;
}
public void setData(List<DataDTO> data) {
this.data = data;
}
public static class DataDTO {
private int value;
private String alctName;
private String label;
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getAlctName() {
return alctName;
}
public void setAlctName(String alctName) {
this.alctName = alctName;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}
}

View File

@ -0,0 +1,108 @@
package com.oneclouds.cargo.bean;
import java.util.List;
/**
* @author hlh
* @version 1.0.0
* @date 2021/9/15 15:41
* @description:
*/
public class GoodsTypeBean {
private int res;
private int code;
private boolean success;
private String msg;
private List<DataDTO> data;
public int getRes() {
return res;
}
public void setRes(int res) {
this.res = res;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<DataDTO> getData() {
return data;
}
public void setData(List<DataDTO> data) {
this.data = data;
}
public static class DataDTO {
private String cateName;
private int alctGoodsTypeId;
private int id;
private String shipperId;
private String remarks;
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
public int getAlctGoodsTypeId() {
return alctGoodsTypeId;
}
public void setAlctGoodsTypeId(int alctGoodsTypeId) {
this.alctGoodsTypeId = alctGoodsTypeId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getShipperId() {
return shipperId;
}
public void setShipperId(String shipperId) {
this.shipperId = shipperId;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
}
}

View File

@ -43,6 +43,8 @@ public class OrderRequest {
//车型车长
public static final String ORDER_CAR_TYPE_AND_CAR_LONG="order_CarTypeAndCarLong";
public static final String ORDER_CAR_TYPE_AND_CAR="order_CarTypeAndCar";
public static final String ORDER_CAR_TYPE_AND_GOODS_TYPE="ORDER_CAR_TYPE_AND_GOODS_TYPE";
//业务类型
public static final String ORDER_BUSINESS_TYPE_LIST="order_businessTypeList";
@ -64,6 +66,25 @@ public class OrderRequest {
//货源保存/提交
public static final String ORDER_PULIST_ORDER="publishOrder";
//车辆类型
public static String CAR_TYPE ="/common/dic/carTypeSimpleList";
//货物大类
public static String GOODS_TYPE ="/shipperWeb/goodsCate/nplist";
//货物大类-汇总版
public void goodType(){
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getGoodType(), "post",""),getToken(con),con);
RequestTest.test(1,ORDER_CAR_TYPE_AND_GOODS_TYPE,re,con,hd);
}
//车型车长-汇总版
public void carType(){
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getCarType(), "post",""),getToken(con),con);
RequestTest.test(1,ORDER_CAR_TYPE_AND_CAR,re,con,hd);
}
//车型车长
public void carTypeLongList(){
Request re = OkHttpUtil.posts(new OkDate(UrlManager.getOrderCarTypeAndCarLong(), "post",""),getToken(con),con);

View File

@ -1,5 +1,8 @@
package com.oneclouds.cargo.request.manager;
import static com.oneclouds.cargo.request.OrderRequest.CAR_TYPE;
import static com.oneclouds.cargo.request.OrderRequest.GOODS_TYPE;
/**
* @author hlh
* @version 1.0.0
@ -231,6 +234,14 @@ public class UrlManager {
return BASE_URL;
}
public static String getCarType() {
return BASE_URL + CAR_TYPE;
}
public static String getGoodType() {
return BASE_URL + GOODS_TYPE;
}
public static String getCateAdd() {
return BASE_URL + CATE_ADD;
}
@ -258,6 +269,7 @@ public class UrlManager {
public static String getCateNplistAl() {
return BASE_URL + CATE_NPLIST_AL;
}
public static String getCarList() {
return BASE_URL + CATE_CAR_LIST;
}
@ -515,10 +527,17 @@ public class UrlManager {
return BASE_URL + FORGETPWD;
}
public static String getLOGIN() { return BASE_URL+LOGIN; }
public static String getLOGIN2() { return BASE_URL+LOGIN2; }
public static String getLOGIN() {
return BASE_URL + LOGIN;
}
public static String getUserInfo() { return BASE_URL+USER_INFO; }
public static String getLOGIN2() {
return BASE_URL + LOGIN2;
}
public static String getUserInfo() {
return BASE_URL + USER_INFO;
}
public static String getBankCardList() {
return BASE_URL + BANK_CARD_LIST;

View File

@ -26,6 +26,8 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.dahe.mylibrary.utils.TimeConstants;
import com.dahe.mylibrary.utils.TimeUtil;
import com.github.gzuliyujiang.wheelpicker.DatimePicker;
import com.github.gzuliyujiang.wheelpicker.OptionPicker;
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode;
@ -45,7 +47,9 @@ import com.oneclouds.cargo.bean.AlGoodsTypeListBean;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.BusinssTypeBean;
import com.oneclouds.cargo.bean.CarBean;
import com.oneclouds.cargo.bean.CarShortTypeBean;
import com.oneclouds.cargo.bean.CarTypeLongBean;
import com.oneclouds.cargo.bean.GoodsTypeBean;
import com.oneclouds.cargo.bean.NpListBean;
import com.oneclouds.cargo.bean.OptionBaseBean;
import com.oneclouds.cargo.bean.UpAppBean;
@ -77,9 +81,11 @@ import com.oneclouds.cargo.util.view.BaseRecyclerView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
@ -107,6 +113,7 @@ public class HomeFragment extends BaseFragment {
private String url = "";
private TextView etCar;
private EditText requirement;
private TextView effectiveTime;
@Override
public void msgMethod(Message m) {
@ -114,6 +121,8 @@ public class HomeFragment extends BaseFragment {
switch (m.what) {
case 200:
insData(OrderRequest.ORDER_CAR_TYPE_AND_CAR_LONG);
insData(OrderRequest.ORDER_CAR_TYPE_AND_CAR);
insData(OrderRequest.ORDER_CAR_TYPE_AND_GOODS_TYPE);
insData(OrderRequest.ORDER_BUSINESS_TYPE_LIST);
insData(OrderRequest.ORDER_BUSINESS_TYPE_LIST_JTT);
insData(OrderRequest.ORDER_BUSINESS_TYPE_LIST_AL);
@ -175,7 +184,6 @@ public class HomeFragment extends BaseFragment {
}
break;
}
}
@ -225,6 +233,8 @@ public class HomeFragment extends BaseFragment {
pr.getUserInfo();
or.carTypeLongList();
or.businssTypeList();
or.carType();
or.goodType();
or.packNameList();
cr.cateNPList();
cr.cateNPListAl();
@ -358,7 +368,7 @@ public class HomeFragment extends BaseFragment {
TextView businessType = v.findViewById(R.id.businessType);
//订单有效期
RelativeLayout r5 = v.findViewById(R.id.r5);
TextView effectiveTime = v.findViewById(R.id.effectiveTime);
effectiveTime = v.findViewById(R.id.effectiveTime);
//货物大类 交通厅
RelativeLayout r7 = v.findViewById(R.id.r7);
@ -373,12 +383,17 @@ public class HomeFragment extends BaseFragment {
//备注
requirement = v.findViewById(R.id.requirement);
//业务类型-默认值
businessType.setText("干线普货运输");
oib.getFormData().setBusinessType(1002996);
r7.setOnClickListener(v14 -> {
if (isLogin()) {
NpListBean al = TypeParts.getNpType(con);
GoodsTypeBean ctb = TypeParts.getGoodsTypeShort(con);
List<OptionBaseBean> data = new ArrayList<>();
for (NpListBean.DataDTO datum : al.getData()) {
data.add(new OptionBaseBean(datum.getId(), datum.getCateName()));
for (GoodsTypeBean.DataDTO typeDTO : ctb.getData()) {
data.add(new OptionBaseBean(typeDTO.getId(), typeDTO.getCateName()));
}
OptionPicker picker = new OptionPicker(act);
picker.setBodyWidth(140);
@ -390,6 +405,23 @@ public class HomeFragment extends BaseFragment {
picker.setData(data);
picker.setDefaultPosition(2);
picker.show();
// NpListBean al = TypeParts.getNpType(con);
// List<OptionBaseBean> data = new ArrayList<>();
// for (NpListBean.DataDTO datum : al.getData()) {
// data.add(new OptionBaseBean(datum.getId(), datum.getCateName()));
// }
// OptionPicker picker = new OptionPicker(act);
// picker.setBodyWidth(140);
// picker.setOnOptionPickedListener((position, item) -> {
// OptionBaseBean obb = (OptionBaseBean) item;
// tvHwdlJt.setText(obb.getName());
// oib.getFormData().setGoodsBigCate(obb.getId());
// });
// picker.setData(data);
// picker.setDefaultPosition(2);
// picker.show();
}
});
@ -472,10 +504,10 @@ public class HomeFragment extends BaseFragment {
});
r3.setOnClickListener(v1 -> {
if (isLogin()) {
CarTypeLongBean ctb = TypeParts.getCarTypeLong(con);
CarShortTypeBean ctb = TypeParts.getCarTypeShort(con);
List<OptionBaseBean> data = new ArrayList<>();
for (CarTypeLongBean.DataDTO.TypeDTO typeDTO : ctb.getData().getType()) {
data.add(new OptionBaseBean(typeDTO.getValue(), typeDTO.getName()));
for (CarShortTypeBean.DataDTO typeDTO : ctb.getData()) {
data.add(new OptionBaseBean(typeDTO.getValue(), typeDTO.getLabel()));
}
OptionPicker picker = new OptionPicker(act);
picker.setBodyWidth(140);
@ -563,7 +595,6 @@ public class HomeFragment extends BaseFragment {
&& 0 != oib.getFormData().getVehicleLength()
&& 0 != oib.getFormData().getBusinessType()
&& 0 != oib.getFormData().getGoodsBigCate()
&&0!=oib.getFormData().getAlctGoodsType()
&& !TextUtils.isEmpty(oib.getFormData().getEffectiveTime())
) {
new XPopup.Builder(act)
@ -749,6 +780,12 @@ public class HomeFragment extends BaseFragment {
oib.getPutTableData().set(data_index, op);
brv_discharge.updateItemV(data_index, op);
// }
//订单有效期根据装货截止时间延长15天
String loadingDeadline = os.getLoadingDeadline();
String text = TimeUtil.getString(loadingDeadline, new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()), 21600, TimeConstants.MIN);
effectiveTime.setText(text);
oib.getFormData().setEffectiveTime(text);
}
@Subscribe

View File

@ -18,10 +18,16 @@ import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.dahe.mylibrary.utils.TimeConstants;
import com.dahe.mylibrary.utils.TimeUtil;
import com.dahe.mylibrary.utils.ToastUtils;
import com.github.gzuliyujiang.wheelpicker.DatePicker;
import com.github.gzuliyujiang.wheelpicker.DatimePicker;
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode;
import com.github.gzuliyujiang.wheelpicker.annotation.TimeMode;
import com.github.gzuliyujiang.wheelpicker.entity.DateEntity;
import com.github.gzuliyujiang.wheelpicker.entity.DatimeEntity;
import com.github.gzuliyujiang.wheelpicker.widget.DateWheelLayout;
import com.github.gzuliyujiang.wheelpicker.widget.DatimeWheelLayout;
import com.google.gson.Gson;
import com.lxj.xpopup.XPopup;
@ -52,8 +58,10 @@ import com.umeng.vt.diff.V;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
/**
* @ClassName NodeInfoActivity
@ -208,6 +216,7 @@ public class NodeInfoActivity extends BaseActivity {
ryDis.notifyDatas(op.getGoods());
} else {
op.setGoods(new ArrayList<>());
// tvEndTimeDis.setText(this.op.getLoadingDeadline());
}
rlTopDis.setOnClickListener(v12 -> {
@ -228,20 +237,21 @@ public class NodeInfoActivity extends BaseActivity {
});
tvEndTimeDis.setOnClickListener(V -> {
DatimePicker ap = new DatimePicker(act);
final DatimeWheelLayout wheelLayout = ap.getWheelLayout();
ap.setOnDatimePickedListener((year, month, day, hour, minute, second) -> {
String text = year + "-" + getRead(month) + "-" + getRead(day) + " " + getRead(hour) + ":" + getRead(minute);
this.op.setLoadingDeadline(text);
tvEndTimeDis.setText(text);
timeKey = true;
});
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY);
wheelLayout.setTimeMode(TimeMode.HOUR_24_NO_SECOND);
wheelLayout.setRange(DatimeEntity.now(), DatimeEntity.yearOnFuture(10));
wheelLayout.setDateLabel("", "", "");
wheelLayout.setTimeLabel("", "", "");
ap.show();
ToastUtils.showToast(con,"选择装货时间自动计算");
// DatimePicker ap = new DatimePicker(act);
// final DatimeWheelLayout wheelLayout = ap.getWheelLayout();
// ap.setOnDatimePickedListener((year, month, day, hour, minute, second) -> {
// String text = year + "-" + getRead(month) + "-" + getRead(day) + " " + getRead(hour) + ":" + getRead(minute);
// this.op.setLoadingDeadline(text);
// tvEndTimeDis.setText(text);
// timeKey = true;
// });
// wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY);
// wheelLayout.setTimeMode(TimeMode.HOUR_24_NO_SECOND);
// wheelLayout.setRange(DatimeEntity.now(), DatimeEntity.yearOnFuture(10));
// wheelLayout.setDateLabel("", "", "");
// wheelLayout.setTimeLabel("", "", "");
// ap.show();
});
@ -273,6 +283,17 @@ public class NodeInfoActivity extends BaseActivity {
etMoney.setText(os.getTotalPrice() + "");
} else {
os.setGoods(new ArrayList<>());
String nowString = TimeUtil.getNowString("yyyy-MM-dd")+ " " + getRead(23) + ":" + getRead(59);
this.os.setLoadingDeadline(nowString);
tvStartTime.setText(nowString);
timeKey = true;
String endDate = TimeUtil.getString(nowString, new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()),14400, TimeConstants.MIN);
this.op.setLoadingDeadline(endDate);
// tvEndTimeDis.setText(endDate);
// timeKey = true;
}
@ -288,19 +309,22 @@ public class NodeInfoActivity extends BaseActivity {
});
tvStartTime.setOnClickListener(V -> {
DatimePicker ap = new DatimePicker(act);
final DatimeWheelLayout wheelLayout = ap.getWheelLayout();
ap.setOnDatimePickedListener((year, month, day, hour, minute, second) -> {
String text = year + "-" + getRead(month) + "-" + getRead(day) + " " + getRead(hour) + ":" + getRead(minute);
DatePicker ap = new DatePicker(act);
final DateWheelLayout wheelLayout = ap.getWheelLayout();
ap.setOnDatePickedListener((year, month, day) -> {
String text = year + "-" + getRead(month) + "-" + getRead(day) + " " + getRead(23) + ":" + getRead(59);
this.os.setLoadingDeadline(text);
tvStartTime.setText(text);
timeKey = true;
String endDate = TimeUtil.getString(text, new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()),14400, TimeConstants.MIN);
this.op.setLoadingDeadline(endDate);
tvEndTimeDis.setText(endDate);
timeKey = true;
});
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY);
wheelLayout.setTimeMode(TimeMode.HOUR_24_NO_SECOND);
wheelLayout.setRange(DatimeEntity.now(), DatimeEntity.yearOnFuture(10));
wheelLayout.setRange(DateEntity.today(), DateEntity.yearOnFuture(10));
wheelLayout.setDateLabel("", "", "");
wheelLayout.setTimeLabel("", "", "");
ap.show();
});
ryPretend.addItemDecoration(new RecyclerViewDecoration(con, RecyclerViewDecoration.VERTICAL_LIST));
@ -441,8 +465,7 @@ public class NodeInfoActivity extends BaseActivity {
String startTim = tvStartTime.getText().toString();
String endTimeDis = tvEndTimeDis.getText().toString();
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(nameDis) ||
TextUtils.isEmpty(money) || TextUtils.isEmpty(startTim) ||
TextUtils.isEmpty(endTimeDis)) {
TextUtils.isEmpty(money) || TextUtils.isEmpty(startTim)) {
ToastUtil.show(con, "请完善装卸货信息");
return;
}

View File

@ -5,7 +5,9 @@ import android.content.Context;
import com.google.gson.Gson;
import com.oneclouds.cargo.bean.AlGoodsTypeListBean;
import com.oneclouds.cargo.bean.BusinssTypeBean;
import com.oneclouds.cargo.bean.CarShortTypeBean;
import com.oneclouds.cargo.bean.CarTypeLongBean;
import com.oneclouds.cargo.bean.GoodsTypeBean;
import com.oneclouds.cargo.bean.NpListBean;
import com.oneclouds.cargo.bean.PackNameBean;
import com.oneclouds.cargo.constant.SPConstant;
@ -62,6 +64,35 @@ public class TypeParts {
}
return null;
}
//车型车长
public static CarShortTypeBean getCarTypeShort(Context con){
String str=SPUtil.getSP(con,"chacheData", OrderRequest.ORDER_CAR_TYPE_AND_CAR);
if(!str.equals("")){
CarShortTypeBean ctlb=gson.fromJson(str, CarShortTypeBean.class);
if(ctlb.getCode()==200){
return ctlb;
}else{
return null;
}
}
return null;
}
//货物大类-汇总交通厅安联
public static GoodsTypeBean getGoodsTypeShort(Context con){
String str=SPUtil.getSP(con,"chacheData", OrderRequest.ORDER_CAR_TYPE_AND_GOODS_TYPE);
if(!str.equals("")){
GoodsTypeBean ctlb=gson.fromJson(str, GoodsTypeBean.class);
if(ctlb.getCode()==200){
return ctlb;
}else{
return null;
}
}
return null;
}
//业务类型
public static BusinssTypeBean getBusType(Context con){
String str=SPUtil.getSP(con,"chacheData", OrderRequest.ORDER_BUSINESS_TYPE_LIST);

View File

@ -274,6 +274,14 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_2"
android:background="#F6F6F9"/>
<TextView
android:layout_marginTop="@dimen/dp_20"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ICP备案号:豫ICP备09025418号-25A"
/>
</LinearLayout>
<Button

View File

@ -10,7 +10,7 @@
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_9"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_370"
android:layout_height="@dimen/dp_300"
android:orientation="vertical"
android:background="@mipmap/icon_huoyuan_bottom"
android:paddingLeft="@dimen/dp_12"
@ -260,7 +260,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_24"
android:text="货物大类(交通厅)"
android:text="货物大类"
android:textColor="#ff999999"
android:textSize="@dimen/sp_14" />
<LinearLayout
@ -287,11 +287,13 @@
</RelativeLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#8AA5E1"
android:alpha="0.5"/>
<RelativeLayout
android:visibility="gone"
android:id="@+id/r8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -334,11 +336,13 @@
</RelativeLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#8AA5E1"
android:alpha="0.5"/>
<RelativeLayout
android:visibility="gone"
android:id="@+id/r5"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -79,6 +79,7 @@
android:background="@color/def_text" />
<LinearLayout
android:visibility="gone"
android:layout_marginTop="@dimen/dp_14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -114,6 +115,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginTop="@dimen/dp_16"