bug修改等
This commit is contained in:
parent
b331abda11
commit
6d005c57c4
|
|
@ -157,7 +157,7 @@
|
|||
</provider>
|
||||
|
||||
<service android:name="org.eclipse.paho.android.service.MqttService" />
|
||||
|
||||
<service android:name="com.bonus.canteen.service.DeviceMonitorService" />
|
||||
<!-- 开机自启广播-->
|
||||
<receiver android:name="com.bonus.canteen.receiver.BootReceiver"
|
||||
android:enabled="true"
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ package com.bonus.canteen.activity;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
|
|
@ -20,6 +20,7 @@ import com.bonus.canteen.db.AppDatabase;
|
|||
import com.bonus.canteen.db.entity.base.DeviceInfo;
|
||||
import com.bonus.canteen.db.entity.base.LoginInfo;
|
||||
import com.bonus.canteen.db.entity.base.ParamSettingInfo;
|
||||
import com.bonus.canteen.service.DeviceMonitorService;
|
||||
import com.bonus.canteen.utils.AppUtil;
|
||||
import com.bonus.canteen.utils.OkHttpService;
|
||||
import com.bonus.canteen.utils.SM4EncryptUtils;
|
||||
|
|
@ -60,21 +61,40 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
|
|||
super.onCreate(savedInstanceState);
|
||||
setupImmersiveMode();
|
||||
initView();
|
||||
startService(new Intent(this, DeviceMonitorService.class));
|
||||
}
|
||||
|
||||
private void setupImmersiveMode() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
|
||||
// 设置初始全屏标志
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
// 隐藏导航栏
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
// 沉浸式模式
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
}
|
||||
decorView.setSystemUiVisibility(flags);
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
|
||||
// 添加监听器,当系统UI可见性变化时重新应用全屏设置
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||
// 当系统UI可见性变化时,重新设置全屏
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
});
|
||||
|
||||
// 确保Activity的主题也支持全屏
|
||||
getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setupImmersiveMode();
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
initListener();
|
||||
}
|
||||
|
|
@ -117,7 +137,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
|
|||
json.put("code", "");
|
||||
json.put("phoneUuid", "");
|
||||
json.put("uuid", "");
|
||||
json.put("loginType", "USERNAME_PASSWORD");
|
||||
json.put("loginType", "KITCHEN_PHONE_PASSWORD");
|
||||
String jsonString = json.toString();
|
||||
Log.i("getPersonMessage jsonString", jsonString);
|
||||
// 定义 JSON 的 MediaType
|
||||
|
|
@ -143,10 +163,10 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> {
|
|||
JSONObject dataJson = JSONObject.parseObject(data);
|
||||
AppDatabase.getDatabase(this).loginInfoDao().deleteAll();
|
||||
LoginInfo loginInfo = new LoginInfo();
|
||||
loginInfo.setUserName(userName);
|
||||
loginInfo.setUserName(dataJson.getString("staffName"));
|
||||
loginInfo.setUserPwd(password);
|
||||
loginInfo.setUserId("-1"); // 假设用户ID为1,实际应用中应从服务器获取
|
||||
loginInfo.setPhone("-1"); // 假设手机号为1234567890,实际应用中应从服务器获取
|
||||
loginInfo.setUserId(dataJson.getString("staffId")); // 假设用户ID为1,实际应用中应从服务器获取
|
||||
loginInfo.setPhone(dataJson.getString("mobile")); // 假设手机号为1234567890,实际应用中应从服务器获取
|
||||
loginInfo.setToken(dataJson.getString("access_token")); // 假设令牌为sample_token,实际应用中应从服务器获取
|
||||
AppDatabase.getDatabase(this).loginInfoDao().insert(loginInfo);
|
||||
//初始化基础数据和设备数据
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class OutCabinet extends BaseActivity<ActivityOutRecordBinding> {
|
|||
XUI.initTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
//设置全屏
|
||||
setFullScreen();
|
||||
setupImmersiveMode();
|
||||
serialPortManger = new SerialPortManger();
|
||||
recyclerView = findViewById(R.id.list_view);
|
||||
WidgetUtils.initRecyclerView(recyclerView);
|
||||
|
|
@ -116,13 +116,37 @@ public class OutCabinet extends BaseActivity<ActivityOutRecordBinding> {
|
|||
|
||||
}
|
||||
|
||||
private void setFullScreen() {
|
||||
private void setupImmersiveMode() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
|
||||
// 设置初始全屏标志
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
// 隐藏导航栏
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
// 沉浸式模式
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
|
||||
// 添加监听器,当系统UI可见性变化时重新应用全屏设置
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||
// 当系统UI可见性变化时,重新设置全屏
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
});
|
||||
|
||||
// 确保Activity的主题也支持全屏
|
||||
getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setupImmersiveMode();
|
||||
}
|
||||
private void initListener() {
|
||||
Button selectAllButton = findViewById(R.id.select_all);
|
||||
Button enterCabinetButton = findViewById(R.id.enter_cabinet);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class PutCabinet extends BaseActivity<ActivityPutRecordBinding> {
|
|||
XUI.initTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
//设置全屏
|
||||
setFullScreen();
|
||||
setupImmersiveMode();
|
||||
serialPortManger = new SerialPortManger();
|
||||
recyclerView = findViewById(R.id.list_view);
|
||||
WidgetUtils.initRecyclerView(recyclerView);
|
||||
|
|
@ -114,12 +114,37 @@ public class PutCabinet extends BaseActivity<ActivityPutRecordBinding> {
|
|||
initListener();
|
||||
|
||||
}
|
||||
private void setFullScreen() {
|
||||
private void setupImmersiveMode() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
|
||||
// 设置初始全屏标志
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
// 隐藏导航栏
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
// 沉浸式模式
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
|
||||
// 添加监听器,当系统UI可见性变化时重新应用全屏设置
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||
// 当系统UI可见性变化时,重新设置全屏
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
});
|
||||
|
||||
// 确保Activity的主题也支持全屏
|
||||
getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setupImmersiveMode();
|
||||
}
|
||||
private void initListener() {
|
||||
Button selectAllButton = findViewById(R.id.select_all);
|
||||
Button enterCabinetButton = findViewById(R.id.enter_cabinet);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
|
|
@ -27,12 +26,10 @@ import com.bonus.canteen.activity.SerialPortManger;
|
|||
import com.bonus.canteen.adapter.KeepSampleRecordAdapter;
|
||||
import com.bonus.canteen.constants.AppConstants;
|
||||
import com.bonus.canteen.core.BaseActivity;
|
||||
import com.bonus.canteen.db.AppDatabase;
|
||||
import com.bonus.canteen.db.entity.base.DeviceInfo;
|
||||
import com.bonus.canteen.entity.CanteenBean;
|
||||
import com.bonus.canteen.entity.KitchenSampleDishesRecord;
|
||||
import com.bonus.canteen.entity.SaveStatusBean;
|
||||
import com.bonus.canteen.entity.StallBean;
|
||||
import com.bonus.canteen.entity.SpinnerBean;
|
||||
import com.bonus.canteen.utils.DateTimeHelper;
|
||||
import com.bonus.canteen.utils.OkHttpService;
|
||||
import com.bonus.canteen.utils.StringHelper;
|
||||
import com.bonus.canteen.utils.ThreadPoolManager;
|
||||
|
|
@ -44,6 +41,7 @@ import com.xuexiang.xpage.enums.CoreAnim;
|
|||
import com.xuexiang.xui.utils.WidgetUtils;
|
||||
import com.xuexiang.xui.utils.XToastUtils;
|
||||
import com.xuexiang.xui.widget.picker.widget.TimePickerView;
|
||||
import com.xuexiang.xui.widget.picker.widget.builder.TimePickerBuilder;
|
||||
|
||||
import org.easydarwin.easypusher.R;
|
||||
import org.easydarwin.easypusher.databinding.ActivityRecordBinding;
|
||||
|
|
@ -61,12 +59,7 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
private static final String TAG = "SampleRetentionRecordActivity";
|
||||
private final OkHttpService service = new OkHttpService();
|
||||
private final List<SaveStatusBean> saveStatusBeanList = new ArrayList<>();
|
||||
private final Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
private List<KitchenSampleDishesRecord> kitchenSampleDishesRecords = new ArrayList<>();
|
||||
private List<CanteenBean> canteenList = new ArrayList<>();
|
||||
private List<StallBean> stallBeanList = new ArrayList<>();
|
||||
|
||||
private KeepSampleRecordAdapter adapter;
|
||||
private RecyclerView recyclerView;
|
||||
private SwipeRefreshLayout swipeRefreshLayout;
|
||||
|
|
@ -75,7 +68,6 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
private final int mPageSize = 10;
|
||||
private int mTotal = 0;
|
||||
SerialPortManger serialPortManger = null;
|
||||
|
||||
@Override
|
||||
protected ActivityRecordBinding viewBindingInflate(@NonNull LayoutInflater inflater) {
|
||||
return ActivityRecordBinding.inflate(inflater);
|
||||
|
|
@ -85,11 +77,12 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setFullScreen();
|
||||
setupImmersiveMode();
|
||||
initSaveStatusList();
|
||||
initTitleView();
|
||||
// initSelect();
|
||||
initSpinners();
|
||||
initListener();
|
||||
showDatePickerDialog();
|
||||
serialPortManger = new SerialPortManger();
|
||||
new Handler().postDelayed(() -> {
|
||||
double temperature = serialPortManger.getTemperature();
|
||||
|
|
@ -97,21 +90,71 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
textView.setText(temperature + "");
|
||||
}, 1000);
|
||||
}
|
||||
private void showDatePickerDialog() {
|
||||
mDatePicker = new TimePickerBuilder(this, (date, v) -> {
|
||||
String dayTime = DateTimeHelper.format(date,"yyyy-MM-dd");
|
||||
binding.macQueryTime.setText(dayTime);
|
||||
}).setTimeSelectChangeListener(date -> Log.i("pvTime", "onTimeSelectChanged")).setTitleText("日期选择")
|
||||
.setType(true, true, true, false, false, false)
|
||||
.build();
|
||||
}
|
||||
private void initSpinners() {
|
||||
//设置入库类型选择器
|
||||
List<SpinnerBean> inboundTypes = new ArrayList<>();
|
||||
inboundTypes.add(new SpinnerBean("0", "全部"));
|
||||
inboundTypes.add(new SpinnerBean("1", "未入柜"));
|
||||
inboundTypes.add(new SpinnerBean("2", "在柜"));
|
||||
inboundTypes.add(new SpinnerBean("3", "离柜"));
|
||||
inboundTypes.add(new SpinnerBean("4", "超时自动离柜"));
|
||||
binding.statusSpinner.setItems(inboundTypes);
|
||||
binding.statusSpinner.setOnItemSelectedListener((view12, position, id, item) -> {
|
||||
if (item instanceof SpinnerBean) {
|
||||
SpinnerBean selectedType = (SpinnerBean) item;
|
||||
Log.d(TAG, "Selected Inbound Type: " + selectedType.getName());
|
||||
} else {
|
||||
Log.e(TAG, "Selected item is not a SpinnerBean");
|
||||
}
|
||||
});
|
||||
binding.statusSpinner.setSelectedIndex(0);
|
||||
}
|
||||
private void setupImmersiveMode() {
|
||||
View decorView = getWindow().getDecorView();
|
||||
|
||||
private void setFullScreen() {
|
||||
// 设置初始全屏标志
|
||||
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
// 隐藏导航栏
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
// 沉浸式模式
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
|
||||
// 添加监听器,当系统UI可见性变化时重新应用全屏设置
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
|
||||
// 当系统UI可见性变化时,重新设置全屏
|
||||
decorView.setSystemUiVisibility(uiOptions);
|
||||
});
|
||||
|
||||
// 确保Activity的主题也支持全屏
|
||||
getWindow().setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
);
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setupImmersiveMode();
|
||||
}
|
||||
|
||||
private void initSaveStatusList() {
|
||||
saveStatusBeanList.clear();
|
||||
saveStatusBeanList.add(new SaveStatusBean("0", "全部"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("1", "未入柜"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("2", "在柜"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("3", "离柜"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("4", "超时自动离柜"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("1", "早餐"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("2", "中餐"));
|
||||
saveStatusBeanList.add(new SaveStatusBean("4", "晚餐"));
|
||||
}
|
||||
|
||||
protected void initTitleView() {
|
||||
|
|
@ -130,8 +173,7 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
startActivity(intent);
|
||||
finish();
|
||||
});
|
||||
// showDatePickerDialog();
|
||||
// binding.macQueryTime.setOnClickListener(v -> mDatePicker.show());
|
||||
binding.macQueryTime.setOnClickListener(v -> mDatePicker.show());
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
|
|
@ -187,87 +229,28 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
}
|
||||
}
|
||||
|
||||
private void resetAll() {
|
||||
resetQueryParams();
|
||||
kitchenSampleDishesRecords.clear();
|
||||
// binding.macQueryTime.setText("");
|
||||
// binding.canteenSpinner.setSelectedIndex(0);
|
||||
// binding.stallSpinner.setSelectedIndex(0);
|
||||
// binding.storageStatusSpinner.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
private void loadDataAsync() {
|
||||
ThreadPoolManager.getExecutor().execute(this::loadMoreData);
|
||||
}
|
||||
|
||||
protected void initSelect() {
|
||||
initCanteenTab();
|
||||
// binding.canteenSpinner.setOnItemSelectedListener((parent, view, position, id) -> {
|
||||
// CanteenBean canteenBean = canteenList.get(Math.toIntExact(position));
|
||||
// Log.e(TAG, "Selected canteen: " + canteenBean.getCanteenName());
|
||||
// initStallTab(canteenBean.getCanteenId());
|
||||
// });
|
||||
// binding.stallSpinner.setOnItemSelectedListener((parent, view, position, id) -> {
|
||||
// StallBean stallBean = stallBeanList.get(Math.toIntExact(position));
|
||||
// Log.e(TAG, "Selected stall: " + stallBean.getStallName());
|
||||
// });
|
||||
initSaveStatusSpinner();
|
||||
}
|
||||
|
||||
protected void initSaveStatusSpinner() {
|
||||
// binding.storageStatusSpinner.setItems(saveStatusBeanList);
|
||||
// binding.storageStatusSpinner.setOnItemSelectedListener((parent, view, position, id) -> {
|
||||
// SaveStatusBean saveStatusBean = saveStatusBeanList.get(Math.toIntExact(position));
|
||||
// Log.e(TAG, "Selected storage status: " + saveStatusBean.getName());
|
||||
// });
|
||||
}
|
||||
|
||||
private void initCanteenTab() {
|
||||
ThreadPoolManager.getExecutor().execute(() -> {
|
||||
canteenList = new ArrayList<>();
|
||||
DeviceInfo deviceInfo = AppDatabase.getDatabase(this).deviceInfoDao().getDeviceInfoOne();
|
||||
CanteenBean canteenBean = new CanteenBean();
|
||||
canteenBean.setCanteenName(deviceInfo.getCanteenName());
|
||||
canteenBean.setCanteenId(deviceInfo.getCanteenId());
|
||||
canteenList.add(canteenBean);
|
||||
runOnUiThread(() -> {
|
||||
// binding.canteenSpinner.setItems(canteenList);
|
||||
initStallTab(canteenList.get(0).getCanteenId());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void initStallTab(String canteenId) {
|
||||
ThreadPoolManager.getExecutor().execute(() -> {
|
||||
try {
|
||||
String url = WorkConfig.getBaseUrl() + "/basic_stall/listAll?canteenId=" + canteenId;
|
||||
String result = service.httpGet(url, this);
|
||||
Log.i(TAG, "result==" + result);
|
||||
if (!ObjectUtil.isEmpty(result)) {
|
||||
String json = JSONObject.parseObject(result).getString("rows");
|
||||
stallBeanList = new Gson().fromJson(json, new TypeToken<List<StallBean>>() {
|
||||
}.getType());
|
||||
if (stallBeanList == null) stallBeanList = new ArrayList<>();
|
||||
StallBean defaultStall = new StallBean();
|
||||
defaultStall.setStallId("0");
|
||||
defaultStall.setStallName("全部");
|
||||
stallBeanList.add(0, defaultStall);
|
||||
// runOnUiThread(() -> binding.stallSpinner.setItems(stallBeanList));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error fetching stall data: " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void loadMoreData() {
|
||||
String url = WorkConfig.getBaseUrl() + "/kitchen_sample_dishes_record/list?pageNum=" + mCurrentPage + "&pageSize=" + mPageSize;
|
||||
Log.e(TAG, "loadMoreData url: " + url);
|
||||
JSONObject json = new JSONObject();
|
||||
String date = binding.macQueryTime.getText().toString();
|
||||
String status = ((SpinnerBean) binding.statusSpinner.getSelectedItem()).getId();
|
||||
json.put("searchType", 3);
|
||||
if (!StringHelper.isEmptyAndNull(binding.etKeyword.getText().toString())) {
|
||||
json.put("searchValue", binding.etKeyword.getText().toString());
|
||||
if (!StringHelper.isEmptyAndNull(date)){
|
||||
json.put("startDateTime",date + " 00:00:00");
|
||||
json.put("endDateTime",date + " 23:59:59");
|
||||
}
|
||||
if (!status.equals("0")){
|
||||
json.put("mealtimeType",status);
|
||||
}
|
||||
// if (!StringHelper.isEmptyAndNull(binding.etKeyword.getText().toString())) {
|
||||
// json.put("searchValue", binding.etKeyword.getText().toString());
|
||||
// }
|
||||
String jsonString = json.toString();
|
||||
Log.e(TAG, "loadMoreData jsonString: " + jsonString);
|
||||
MediaType mediaType = MediaType.parse(AppConstants.MEDIA_TYPE);
|
||||
|
|
@ -300,35 +283,6 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
// private String getSelectedCanteenId() {
|
||||
// Object item = binding.canteenSpinner.getSelectedItem();
|
||||
// return (item instanceof CanteenBean && !"0".equals(((CanteenBean) item).getCanteenId()))
|
||||
// ? ((CanteenBean) item).getCanteenId() : "";
|
||||
// }
|
||||
//
|
||||
// private String getSelectedStallId() {
|
||||
// Object item = binding.stallSpinner.getSelectedItem();
|
||||
// return (item instanceof StallBean && !"0".equals(((StallBean) item).getStallId()))
|
||||
// ? ((StallBean) item).getStallId() : "";
|
||||
// }
|
||||
|
||||
// private String getSelectedSaveStatus() {
|
||||
// Object item = binding.storageStatusSpinner.getSelectedItem();
|
||||
// return (item instanceof SaveStatusBean && !"0".equals(((SaveStatusBean) item).getId()))
|
||||
// ? ((SaveStatusBean) item).getId() : "";
|
||||
// }
|
||||
//
|
||||
// private String getStartDateTime() {
|
||||
// String date = binding.macQueryTime.getText().toString();
|
||||
// return StringHelper.isEmpty(date) ? "" : date + " 00:00:00";
|
||||
// }
|
||||
//
|
||||
// private String getEndDateTime() {
|
||||
// String date = binding.macQueryTime.getText().toString();
|
||||
// return StringHelper.isEmpty(date) ? "" : date + " 23:59:59";
|
||||
// }
|
||||
|
||||
private void updateListData(List<KitchenSampleDishesRecord> moreRecords, int total) {
|
||||
try {
|
||||
if (moreRecords != null && !moreRecords.isEmpty()) {
|
||||
|
|
@ -377,14 +331,4 @@ public class SampleRetentionRecordActivity extends BaseActivity<ActivityRecordBi
|
|||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// private void showDatePickerDialog() {
|
||||
// mDatePicker = new TimePickerBuilder(this, (date, v) -> {
|
||||
// String dayTime = DateTimeHelper.format(date, "yyyy-MM-dd");
|
||||
// binding.macQueryTime.setText(dayTime);
|
||||
// }).setTimeSelectChangeListener(date -> Log.i("pvTime", "onTimeSelectChanged"))
|
||||
// .setTitleText("日期选择")
|
||||
// .setType(true, true, true, false, false, false)
|
||||
// .build();
|
||||
// }
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ public abstract class BaseActivity<Binding extends ViewBinding> extends XPageAct
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
initStatusBarStyle();
|
||||
super.onCreate(savedInstanceState);
|
||||
registerSlideBack();
|
||||
unregisterSlideBack();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2025 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bonus.canteen.entity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class SpinnerBean {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SpinnerBean(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
public SpinnerBean() {
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (C) 2025 xuexiangjys(xuexiangjys@163.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.bonus.canteen.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
// Android Service中创建TCP服务
|
||||
public class DeviceMonitorService extends Service {
|
||||
private ServerSocket serverSocket;
|
||||
private boolean isRunning = false;
|
||||
private int port = 8080; // 设置的端口号
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
startTCPServer();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void startTCPServer() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
serverSocket = new ServerSocket(port);
|
||||
isRunning = true;
|
||||
|
||||
Log.d("DeviceMonitor", "TCP服务已启动,端口: " + port);
|
||||
|
||||
while (isRunning) {
|
||||
Socket clientSocket = serverSocket.accept();
|
||||
// 处理客户端连接
|
||||
handleClientConnection(clientSocket);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e("DeviceMonitor", "启动TCP服务失败: " + e.getMessage());
|
||||
// 端口被占用,尝试其他端口
|
||||
tryAlternativePorts();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void tryAlternativePorts() {
|
||||
int[] alternativePorts = {8081, 8082, 8000, 8888, 9000};
|
||||
for (int altPort : alternativePorts) {
|
||||
try {
|
||||
this.port = altPort;
|
||||
serverSocket = new ServerSocket(altPort);
|
||||
isRunning = true;
|
||||
Log.d("DeviceMonitor", "TCP服务在备用端口启动: " + altPort);
|
||||
break;
|
||||
} catch (IOException ex) {
|
||||
Log.e("DeviceMonitor", "端口 " + altPort + " 也被占用");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleClientConnection(Socket clientSocket) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
// 读取客户端数据
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(clientSocket.getInputStream()));
|
||||
|
||||
String request = reader.readLine();
|
||||
// Log.d("DeviceMonitor", "收到请求: " + request);
|
||||
|
||||
// 返回响应
|
||||
PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
|
||||
writer.println("DEVICE_STATUS:ONLINE");
|
||||
writer.flush();
|
||||
|
||||
clientSocket.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("DeviceMonitor", "处理连接错误: " + e.getMessage());
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
isRunning = false;
|
||||
try {
|
||||
if (serverSocket != null) {
|
||||
serverSocket.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,13 +27,15 @@ public class WorkConfig {
|
|||
//本地
|
||||
// protected static String baseUrl = "http://192.168.116.253:48380/smart-canteen";
|
||||
// protected static String prefixesUrl = "http://192.168.116.253:48380";
|
||||
protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
|
||||
protected static String prefixesUrl = "http://192.168.0.244:48380";
|
||||
protected static String fileUrl = "http://192.168.0.14:9090/lnyst/";
|
||||
protected static String baseUrl = "http://192.168.20.234:48390/smart-canteen";
|
||||
protected static String prefixesUrl = "http://192.168.20.234:48390";
|
||||
// protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
|
||||
// protected static String prefixesUrl = "http://192.168.0.244:48380";
|
||||
protected static String fileUrl = "http://192.168.20.234:9000/lnyst/";
|
||||
protected static String updateUrl = "https://www.baidu.com";
|
||||
protected static String serverUri = "tcp://192.168.0.244:1883";
|
||||
protected static String MqttUserName = "admin";
|
||||
protected static String MqttPassWord = "Bonus@admin123!";
|
||||
protected static String serverUri = "tcp://192.168.20.234:1883";
|
||||
protected static String MqttUserName = "guest";
|
||||
protected static String MqttPassWord = "Bonus@Rabbitmq123!";
|
||||
protected static String APP_ID = "52XE2dQBtdmMsfDMvyKmPCCPyFsc4jvo8TKvAdaYfr28";
|
||||
protected static String APP_KEY = "9YFPa6eiuNQAFnzJUadn4LaR8w1bcw3a5ZWYZB6FB57Y";
|
||||
protected static String FACE_PASS_RATE = "0.8";
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 19 KiB |
|
|
@ -2,9 +2,8 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 设置边框颜色和宽度 -->
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="#DBDBDB" /> <!-- 边框颜色 -->
|
||||
<!-- 设置圆角(可选) -->
|
||||
<corners android:radius="8dp" /> <!-- 圆角半径 -->
|
||||
android:width="1dp"
|
||||
android:color="#fff" /> <!-- 边框颜色 -->
|
||||
<!-- 设置背景颜色(可选) -->
|
||||
<solid android:color="#fff" /> <!-- 背景颜色 -->
|
||||
</shape>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 9.3 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/white"/>
|
||||
<corners android:radius="8dp"/>
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/grey_light"/>
|
||||
<padding
|
||||
android:left="4dp"
|
||||
android:right="4dp"
|
||||
android:top="4dp"
|
||||
android:bottom="4dp"/>
|
||||
</shape>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 选中状态 -->
|
||||
<item android:state_pressed="true" android:drawable="@color/blue_light" />
|
||||
<item android:state_selected="true" android:drawable="@color/blue_light" />
|
||||
<item android:state_activated="true" android:drawable="@color/blue_light" />
|
||||
<!-- 默认状态 -->
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLength="20"
|
||||
android:text="admin"
|
||||
android:text="18158863319"
|
||||
android:hint="@string/please_enter_username"
|
||||
android:textColorHint="#999999"
|
||||
android:inputType="textPersonName"
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
android:layout_marginEnd="5dp"
|
||||
android:inputType="textPassword"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="Bonus$2031" />
|
||||
android:text="Bonus$2025" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/check_password"
|
||||
|
|
|
|||
|
|
@ -15,12 +15,34 @@
|
|||
android:layout_width="350dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:visibility="gone"
|
||||
android:maxLength="20"
|
||||
android:hint="请输入样品名称"
|
||||
android:textColorHint="#999999"
|
||||
android:inputType="textPersonName"
|
||||
android:background="@drawable/edittext_border"
|
||||
android:autofillHints="" />
|
||||
<EditText
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="40dp"
|
||||
android:editable="false"
|
||||
android:layout_marginLeft="@dimen/config_margin_10dp"
|
||||
android:layout_marginRight="@dimen/config_margin_10dp"
|
||||
android:background="@drawable/edittext_border"
|
||||
android:hint="请选择日期"
|
||||
android:textColorHint="@color/app_color_grey"
|
||||
android:id="@+id/mac_query_time"
|
||||
/>
|
||||
|
||||
<com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner
|
||||
android:id="@+id/status_spinner"
|
||||
style="@style/CustomSpinner"
|
||||
android:layout_width="200dp"
|
||||
android:hint="请选择存放状态"
|
||||
android:textSize="13sp"
|
||||
android:textColorHint="@color/app_color_grey"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
<com.xuexiang.xui.widget.layout.XUIButton
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="35dp"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<resources>
|
||||
<string name="app_name">智慧食堂</string>
|
||||
<string name="app_name">智能留样柜</string>
|
||||
<string name="app_browser_name">通用浏览器</string>
|
||||
|
||||
<string name="more">更多</string>
|
||||
|
|
|
|||
|
|
@ -85,4 +85,12 @@
|
|||
<item name="android:padding">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomSpinner" parent="Widget.AppCompat.Spinner">
|
||||
<item name="android:dropDownWidth">match_parent</item>
|
||||
<item name="android:radius">4dp</item>
|
||||
<item name="android:dropDownHorizontalOffset">0dp</item>
|
||||
<item name="android:dropDownVerticalOffset">0dp</item>
|
||||
<item name="android:dropDownSelector">?attr/selectableItemBackground</item>
|
||||
<item name="android:popupBackground">@drawable/spinner_dropdown_bg</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Reference in New Issue