Преглед на файлове

手机版添加登录接口

授权码生成工具
liup преди 1 месец
родител
ревизия
c234d7bbf0
променени са 14 файла, в които са добавени 219 реда и са изтрити 57 реда
  1. +13
    -0
      .idea/easycode.ignore
  2. +3
    -3
      app/release/output-metadata.json
  3. +8
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  4. +2
    -2
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  5. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/db/mode/ModeBase.java
  6. +30
    -0
      app/src/main/java/com/bonait/bnframework/common/model/LoginBean.java
  7. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java
  8. +135
    -27
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
  9. +3
    -0
      app/src/main/java/com/bonait/bnframework/ui/fragment/HomeFoodsFragment.java
  10. +16
    -16
      app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java
  11. +1
    -0
      app/src/main/java/com/bonait/bnframework/ui/widget/WaitProcessUtil.java
  12. +1
    -1
      app/src/main/res/drawable/bg_btn_login_selected.xml
  13. +4
    -4
      app/src/main/res/layout/activity_login.xml
  14. +1
    -1
      app/src/main/res/layout/item/layout/dialog_progress_waite.xml

+ 13
- 0
.idea/easycode.ignore Целия файл

@@ -0,0 +1,13 @@
node_modules/
dist/
vendor/
cache/
.*/
*.min.*
*.test.*
*.spec.*
*.bundle.*
*.bundle-min.*
*.*.js
*.*.ts
*.log

+ 3
- 3
app/release/output-metadata.json Целия файл

@@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 106,
"versionName": "1.0.6",
"outputFile": "boluo-xiaochao-v106-202409192051-release.apk"
"versionCode": 107,
"versionName": "1.0.7",
"outputFile": "boluo-xiaochao-v107-202409212323-release.apk"
}
],
"elementType": "File"

+ 8
- 1
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java Целия файл

@@ -282,6 +282,7 @@ public class ExecuteTheRecipe {
int val = (int) Math.round((Double.parseDouble(wl[1])));
//int val = Integer.parseInt(wl[1]);
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name);
ExecuteTheRecipe.showlog(name+"物料:"+val);
if (bpa_silos.size() > 0 && val > 0) {
BPA_SILOS silos = bpa_silos.get(0);
if (val >= 32767) {
@@ -291,11 +292,13 @@ public class ExecuteTheRecipe {
formulation.put(silos, val);

Object jz_z = ReadPLC("料仓" + silos.num + "校准值");
ExecuteTheRecipe.showlog("料仓" + silos.num + "校准值:"+jz_z);
if (jz_z != null) {
int jzzz = Integer.parseInt(String.valueOf(jz_z));
int jzzz_1 = jzzz == 0 ? 500 : jzzz;
int ztime = (int) (val / (jzzz_1 / 5.0));
MaxValue = ztime > MaxValue ? ztime : MaxValue;
ExecuteTheRecipe.showlog("料仓" + silos.num + " MaxValue:"+MaxValue);
}
}
}
@@ -2232,8 +2235,12 @@ public class ExecuteTheRecipe {
if (sb != null) {
IsComplete[0] = (boolean) (sb);
if (IsComplete[0]) {
ExecuteTheRecipe.showlog(name + ",接收到信号!");
ExecuteTheRecipe.showlog(name + ",接收到信号true!");
}else {
ExecuteTheRecipe.showlog(name + ",接收到信号false!");
}
}else {
ExecuteTheRecipe.showlog(name + ",接收异常!");
}
}
try {


+ 2
- 2
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java Целия файл

@@ -134,12 +134,12 @@ public class ConfigName {
/**
* 店铺设备号
*/
public String DeviceAutoKey = "262";
public String DeviceAutoKey = "266";

/**
* 平台授权码
*/
public String Key = "d4f04e18-dfe7-4fdc-9c5b-eb4a611681ff";
public String Key = "cb3d774a-b93d-41d6-85b6-667df9ec9a3b";

/**
* 是否自动初始化设备


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/db/mode/ModeBase.java Целия файл

@@ -19,7 +19,7 @@ public class ModeBase {
//设备ID
public String deviceID;
//用户id
public String userID;
public String userID="";
//是否删除:0:未删除 1 删除
public int isDelete;
//备注


+ 30
- 0
app/src/main/java/com/bonait/bnframework/common/model/LoginBean.java Целия файл

@@ -0,0 +1,30 @@
package com.bonait.bnframework.common.model;

import java.io.Serializable;

/**
* @author: liup
* @description:
* @date: 2024/9/21 22:06.
*/
public class LoginBean implements Serializable {

private String userID;
private String token;

public String getToken() {
return token;
}

public void setToken(String token) {
this.token = token;
}

public String getUserID() {
return userID;
}

public void setUserID(String userID) {
this.userID = userID;
}
}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home4Fragment.java Целия файл

@@ -157,7 +157,7 @@ public class Home4Fragment extends BaseFragment {
* 初始化显示数据
*/
private void initData() {
if (ConfigName.getInstance().user.userID.equals("研发用户")) {
if (ConfigName.getInstance().user.userID!=null&&ConfigName.getInstance().user.userID.equals("研发用户")) {
yauser_gn.setVisibility(View.VISIBLE);
} else {
yauser_gn.setVisibility(View.GONE);


+ 135
- 27
app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java Целия файл

@@ -1,10 +1,15 @@
package com.bonait.bnframework.modules.welcome.activity;

import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;

import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import androidx.core.widget.NestedScrollView;

import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
@@ -22,8 +27,13 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.alibaba.fastjson.TypeReference;
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.API.APIHelper;
import com.bonait.bnframework.common.API.APIResultT;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.bg.SnowView;
import com.bonait.bnframework.common.constant.ConfigName;
@@ -32,6 +42,11 @@ import com.bonait.bnframework.common.constant.SPConstants;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.helper.ActiveMax;
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback;
import com.bonait.bnframework.common.model.GoodsData;
import com.bonait.bnframework.common.model.LoginBean;
import com.bonait.bnframework.common.model.mode.BaseCodeJson;
import com.bonait.bnframework.common.thread.ThreadManager;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.AnimationToolUtils;
import com.bonait.bnframework.common.utils.AppUtils;
@@ -44,8 +59,12 @@ import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity;
import com.bonait.bnframework.modules.home.activity.BottomNavigationNewActivity;
import com.bonait.bnframework.modules.welcome.model.AppLoginPo;
import com.bonait.bnframework.test.TestActivity;
import com.bonait.bnframework.ui.viewmodel.UpdateDataService;
import com.bonait.bnframework.ui.widget.WaitProcessUtil;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.mobsandgeeks.saripaar.ValidationError;
import com.mobsandgeeks.saripaar.Validator;
import com.mobsandgeeks.saripaar.annotation.NotEmpty;
@@ -55,11 +74,14 @@ import com.qmuiteam.qmui.util.QMUIStatusBarHelper;

import org.litepal.LitePal;

import java.util.HashMap;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class LoginActivity extends BaseActivity implements Validator.ValidationListener {

@@ -100,6 +122,10 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL

private Validator validator;

private Handler handler = new Handler(Looper.getMainLooper()){

};

@Override
protected void onCreate(Bundle savedInstanceState) {

@@ -203,39 +229,121 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL
* 登录表单验证成功后,请求后台验证账号密码
* */
private void attemptLogin() {
String url = Constants.SERVICE_IP + "/appLogin.do";
// String url = Constants.SERVICE_IP + "/appLogin.do";

final String userAccount = mEtAccount.getText().toString();
final String password = mEtPassword.getText().toString();
//密码加密
String newPassword = AppUtils.encryptSha256(password);

BPA_USER user= QueryDB.UserLogin(userAccount,password);
if(user!=null)
{
ConfigName.getInstance().user=user;
ConfigData.getInstance().SavePZ();
//跳转到主页
skipToMainActivity();
}else
{
ToastUtils.warning(getString(R.string.text_Login_Fass));
}
if(!ConfigName.getInstance().isPhoneVersion){
//密码加密
String newPassword = AppUtils.encryptSha256(password);

BPA_USER user= QueryDB.UserLogin(userAccount,password);
if(user!=null)
{
ConfigName.getInstance().user=user;
ConfigData.getInstance().SavePZ();
//跳转到主页
skipToMainActivity();
}else
{
ToastUtils.warning(getString(R.string.text_Login_Fass));
}
}else {
WaitProcessUtil.getInstance().show(this,"登录","正在验证...");
ConfigName.getInstance().DeviceAutoKey = "266";
ConfigName.getInstance().DeviceId = "266";
UpdateDataService.key = "cb3d774a-b93d-41d6-85b6-667df9ec9a3b";

BPA_USER user= QueryDB.UserLogin(userAccount,password);
if(user!=null)
{
ToastUtils.info("验证成功,正在登录");
ConfigName.getInstance().user=user;
ConfigData.getInstance().SavePZ();
WaitProcessUtil.getInstance().dismiss();
// 隐藏软键盘
KeyboardToolUtils.hideSoftInput(LoginActivity.this);
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return;
}

// OkGo.<BaseCodeJson<AppLoginPo>>post(url)
// .tag(this)
// .params("username",userAccount)
// .params("password",newPassword)
// .execute(new JsonDialogCallback<BaseCodeJson<AppLoginPo>>(this) {
// @Override
// public void onSuccess(Response<BaseCodeJson<AppLoginPo>> response) {
// BaseCodeJson<AppLoginPo> loginJson = response.body();
// if (loginJson != null) {
// whichDepartment(userAccount,password,loginJson.getResult());
// }
// }
// });
HashMap<String,String> params = new HashMap<>();
params.put("Account",userAccount);
params.put("Password",password);
String body = new Gson().toJson(params);
OkGo.<APIResultT<LoginBean>>post("https://cfv.black-pa.com/saasbase/api/auth/login")
.tag(this)
.upRequestBody(
RequestBody.create(MediaType.parse("application/json; charset=utf-8"),
body))
.execute(new JsonDialogCallback<APIResultT<LoginBean>>(this) {
@Override
public void onSuccess(Response<APIResultT<LoginBean>> response) {
LogUtils.d("GetGoodsInfo s.code="+response.code());
LogUtils.d("GetGoodsInfo s.code="+response.body());
try{
if (response.body()!=null){
if(response.body().statusCode==200){
ToastUtils.info("验证成功,正在登录");
BPA_USER user2 = new BPA_USER();
user2.name = "研发用户";
user2.account = userAccount;
user2.pass = password;
user2.deviceID = "266";
user2.userID = "研发用户";
user2.exp = "研发用户";
QueryDB.AddUser(user2);

ConfigName.getInstance().user.account = userAccount;
ConfigName.getInstance().user.pass = password;
ConfigData.getInstance().SavePZ();

ConfigName.getInstance().user=user2;
LogUtils.d("GetGoodsInfo s.code=200");

WaitProcessUtil.getInstance().dismiss();
// 隐藏软键盘
KeyboardToolUtils.hideSoftInput(LoginActivity.this);
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
// 结束所有Activity
ActivityLifecycleManager.get().finishAllActivity();
LogUtils.d("GetGoodsInfo startActivity");
}else {
ToastUtils.warning("登录失败,"+response.body().errors);
}
}
}catch (Exception e){
ToastUtils.warning("接口数据解析异常");
}
}

@Override
public void onError(Response<APIResultT<LoginBean>> response) {
super.onError(response);
WaitProcessUtil.getInstance().dismiss();
}

@Override
public void onFinish() {
super.onFinish();

}
});
}
}

@Override
protected void onDestroy() {
super.onDestroy();
if(handler!=null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
}

/**


+ 3
- 0
app/src/main/java/com/bonait/bnframework/ui/fragment/HomeFoodsFragment.java Целия файл

@@ -88,6 +88,9 @@ public class HomeFoodsFragment extends BaseFragment {
DisplayManager.scaleViewGroup(viewBinding.getRoot());
initTopBar();
SelectTab(1);
if(ConfigName.getInstance().isPhoneVersion){
requestData();
}
}

/**


+ 16
- 16
app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java Целия файл

@@ -99,8 +99,10 @@ public class LocalGoodsFragment extends BaseFragment {
switch (msg.what){
case MSG_FRESH_GOODS:
goodsList.clear();
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id));
goodsAdapter.notifyDataSetChanged();
if(!goodClassifyList.isEmpty()){
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id));
goodsAdapter.notifyDataSetChanged();
}
break;
}
}
@@ -240,21 +242,19 @@ public class LocalGoodsFragment extends BaseFragment {
try {
AuthorizeHelper.AuthorizeNotify((AppCompatActivity)getActivity());
if(!ConfigName.getInstance().IsAuthorize&&ConfigName.getInstance().versionSelectionEnum.equals("800炒锅带投料"))return;
if(!ConfigName.getInstance().user.name.equals("一般用户")){
if(editGoodsDialog == null){
editGoodsDialog = new EditGoodsDialog();
}else {
editGoodsDialog.dismiss();
}
Bundle bundle = new Bundle();
bundle.putString("goodId",mData.get(position).id);
bundle.putBoolean("isEdit",isEdit);
editGoodsDialog.setArguments(bundle);
if(getActivity()!=null){
editGoodsDialog.show(getActivity().getSupportFragmentManager(),"editGoods");
}
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]菜品");
if(editGoodsDialog == null){
editGoodsDialog = new EditGoodsDialog();
}else {
editGoodsDialog.dismiss();
}
Bundle bundle = new Bundle();
bundle.putString("goodId",mData.get(position).id);
bundle.putBoolean("isEdit",isEdit);
editGoodsDialog.setArguments(bundle);
if(getActivity()!=null){
editGoodsDialog.show(getActivity().getSupportFragmentManager(),"editGoods");
}
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]菜品");
}catch (Exception e){
e.printStackTrace();
}


+ 1
- 0
app/src/main/java/com/bonait/bnframework/ui/widget/WaitProcessUtil.java Целия файл

@@ -109,6 +109,7 @@ public class WaitProcessUtil {
public void Dismiss(){
MainApplication.handler.post(() -> {
if(progressDialog1!=null){
Log.i("WaitShow", "Dismiss");
progressDialog1.dismiss();
progressDialog1 = null;
}


+ 1
- 1
app/src/main/res/drawable/bg_btn_login_selected.xml Целия файл

@@ -5,7 +5,7 @@

<item android:state_pressed="true">
<shape>
<solid android:color="#c000A8E1" />
<solid android:color="#FF9800" />
<corners android:radius="6dp" />
</shape>
</item>


+ 4
- 4
app/src/main/res/layout/activity_login.xml Целия файл

@@ -14,10 +14,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.bonait.bnframework.common.bg.SnowView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent" />
<!-- <com.bonait.bnframework.common.bg.SnowView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/transparent" />-->

<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"


+ 1
- 1
app/src/main/res/layout/item/layout/dialog_progress_waite.xml Целия файл

@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#7f000000">
android:background="@color/transparent">

<LinearLayout
android:layout_width="@dimen/dp_600"


Зареждане…
Отказ
Запис