Commit 7d83dd71 by wjg

修改SKU状态

parent 927f090f
......@@ -68,4 +68,8 @@ dependencies {
// 引入极光 SDK
implementation project(':library_jiguang')
implementation 'com.umeng.umsdk:common:9.5.0'// 版本号(必选)
implementation 'com.umeng.umsdk:asms:1.6.3'// asms包依赖(必选)
implementation 'com.umeng.umsdk:apm:1.6.2'// U-APM产品包依赖(必选)
}
\ No newline at end of file
......@@ -6,6 +6,8 @@
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
......@@ -32,9 +34,9 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
<!-- <category android:name="android.intent.category.HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.MONKEY" />-->
</intent-filter>
</activity>
<activity
......
......@@ -9,6 +9,7 @@ import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.umeng.commonsdk.UMConfigure;
import cn.jpush.android.api.JPushInterface;
......@@ -26,6 +27,8 @@ public class HLApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
UMConfigure.preInit(this, "6294708905844627b598aa78", "device_order");
UMConfigure.init(this, "6294708905844627b598aa78", "device_order", 0, null);
AppConfig.MACHINE_CODE = SharedPreferencesUtils.getMachineCode(this);
......
......@@ -16,6 +16,7 @@ import com.chad.library.adapter.base.BaseViewHolder;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.data.enums.SkuState;
import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.Sku;
import com.ihaoin.hooloo.device.util.CollectionUtils;
......@@ -82,7 +83,7 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
helper.setText(R.id.txt_price, Utils.toString(sku.getPrice()));
helper.setText(R.id.txt_discount, Utils.toString(sku.getDiscount()));
if (Base.TRUE.equals(sku.getState())) {
if (SkuState.isSellin(sku.getState())) {
helper.setGone(R.id.txt_sellout, false);
helper.setGone(R.id.butn_add, true);
View butnAdd = helper.getView(R.id.butn_add);
......
......@@ -45,7 +45,7 @@ public class TrolleyGoods implements Serializable {
*/
private Integer skuId;
/**
* 状态:0-售罄,1-可售
* 状态:1-可售、2-不可售
*/
private Integer state;
/**
......
package com.ihaoin.hooloo.device.data.enums;
public enum OrderState {
WAITING(2, "待制作"),
COOKING(3, "制作中"),
COMPLETED(4, "可取餐");
WAITING(2, "已支付,待制作"),
COOKING(3, "支付制作中"),
COMPLETED(4, "制作完成未取");
private Integer code;
private String name;
......
package com.ihaoin.hooloo.device.data.enums;
public enum SkuState {
SELLIN(1, "可售"),
SELLOUT(2, "不可售");
private Integer code;
private String name;
SkuState(Integer code, String name) {
this.code = code;
this.name = name;
}
public static SkuState get(Integer code) {
for (SkuState state : SkuState.values()) {
if (state.getCode().equals(code)) {
return state;
}
}
return null;
}
public static Boolean isSellin(Integer code) {
return SELLIN.getCode().equals(code);
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.ihaoin.hooloo.device.data.vo;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.enums.SkuState;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -24,9 +24,9 @@ public class GoodsRule implements Serializable {
*/
private Integer isRecommend;
/**
* 状态,1-可售、0-不可售
* 状态,1-可售、2-不可售
*/
private Integer state = Base.TRUE;
private Integer state = SkuState.SELLIN.getCode();
/**
* 价格
*/
......
package com.ihaoin.hooloo.device.data.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
......@@ -10,7 +8,7 @@ public class Sku implements Serializable {
/** sku id */
private Integer skuId;
/** 状态:0-售罄,1-可售 */
/** 状态:1-可售、2-不可售 */
private Integer state;
/** 默认状态:0-否,1-是 */
private Integer isDefault;
......
......@@ -19,6 +19,7 @@ import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.TouchDelegateComposite;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.data.enums.SkuState;
import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.Sku;
import com.ihaoin.hooloo.device.view.ConfirmOrderDialog;
......@@ -141,11 +142,11 @@ public class Utils {
if (CollectionUtils.isEmpty(skus)) {
return null;
}
Optional<Sku> optional = skus.stream().filter(x -> Base.TRUE.equals(x.getIsDefault()) && Base.TRUE.equals(x.getState())).findAny();
Optional<Sku> optional = skus.stream().filter(x -> Base.TRUE.equals(x.getIsDefault()) && SkuState.isSellin(x.getState())).findAny();
if (optional.isPresent()) {
return optional.get();
}
optional = skus.stream().filter(x -> Base.TRUE.equals(x.getState())).findAny();
optional = skus.stream().filter(x -> SkuState.isSellin(x.getState())).findAny();
if (optional.isPresent()) {
return optional.get();
}
......
......@@ -24,6 +24,7 @@ import com.ihaoin.hooloo.device.HLApplication;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.component.IntroViewPager;
import com.ihaoin.hooloo.device.config.Base;
import com.ihaoin.hooloo.device.data.enums.SkuState;
import com.ihaoin.hooloo.device.data.vo.Goods;
import com.ihaoin.hooloo.device.data.vo.GoodsRule;
import com.ihaoin.hooloo.device.data.vo.Sku;
......@@ -293,7 +294,7 @@ public class GoodsDetailDialog extends Dialog {
if (Base.TRUE.equals(rule.getIsRecommend())) {
ruleView.findViewById(R.id.txt_recommend).setVisibility(View.VISIBLE);
}
if (!Base.TRUE.equals(rule.getState())) {
if (!SkuState.isSellin(rule.getState())) {
button.setEnabled(false);
} else {
if (Base.TRUE.equals(rule.getIsDefault())) {
......@@ -409,9 +410,9 @@ public class GoodsDetailDialog extends Dialog {
return;
}
// 售罄SKU列表
List<Sku> sellOuts = map.get(Base.FALSE);
List<Sku> sellOuts = map.get(SkuState.SELLOUT.getCode());
// 未售罄SKU列表
List<Sku> sellIns = map.get(Base.TRUE);
List<Sku> sellIns = map.get(SkuState.SELLIN.getCode());
if (CollectionUtils.isEmpty(sellIns)) {
showSelloutViews();
return;
......@@ -485,7 +486,7 @@ public class GoodsDetailDialog extends Dialog {
if (CollectionUtils.isEmpty(spec.getRules())) {
return;
}
spec.getRules().forEach(rule -> rule.setState(Base.FALSE));
spec.getRules().forEach(rule -> rule.setState(SkuState.SELLOUT.getCode()));
});
}
}
......@@ -83,7 +83,7 @@ public class SettingsActivity extends Activity {
private void showMachineCode() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("修改机器编码");
builder.setTitle("修改机器编码");
EditText editText = new EditText(getApplicationContext());
editText.setText(SharedPreferencesUtils.getMachineCode(SettingsActivity.this));
builder.setView(editText);
......
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