diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6d517f6..97a2919 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -50,4 +50,5 @@ dependencies { + } \ No newline at end of file diff --git a/app/src/main/java/com/example/myapplication/Api.java b/app/src/main/java/com/example/myapplication/Api.java index b5a6c74..143dafc 100644 --- a/app/src/main/java/com/example/myapplication/Api.java +++ b/app/src/main/java/com/example/myapplication/Api.java @@ -1,9 +1,11 @@ package com.example.myapplication; +import com.example.myapplication.dao.GoodsinformationResult; import com.example.myapplication.dao.LoginResult; import com.example.myapplication.dao.ShouyeshuiguoResult; import com.example.myapplication.dao.UserInformationResult; import com.example.myapplication.dao.UserInformationResult2; +import com.example.myapplication.dao.TwodimensionResult; import java.util.Map; @@ -25,4 +27,10 @@ public interface Api { @GET("system/user/profile") Call getUserInformation2(@Header("Authorization") String token); + @GET("system/twodimension/list") + Call getTwodimension(@Header("Authorization") String token); + + @GET("system/goodsinformation/list") + Call getGoodsinformation(@Header("Authorization") String token); + } diff --git a/app/src/main/java/com/example/myapplication/dao/GoodsinformationResult.java b/app/src/main/java/com/example/myapplication/dao/GoodsinformationResult.java new file mode 100644 index 0000000..31134c2 --- /dev/null +++ b/app/src/main/java/com/example/myapplication/dao/GoodsinformationResult.java @@ -0,0 +1,57 @@ +package com.example.myapplication.dao; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Data +public class GoodsinformationResult { + + @SerializedName("total") + public Integer total; + @SerializedName("rows") + public List rows; + @SerializedName("code") + public Integer code; + @SerializedName("msg") + public String msg; + + @NoArgsConstructor + @Data + public static class RowsBean { + @SerializedName("createBy") + public Object createBy; + @SerializedName("createTime") + public Object createTime; + @SerializedName("updateBy") + public Object updateBy; + @SerializedName("updateTime") + public Object updateTime; + @SerializedName("remark") + public Object remark; + @SerializedName("goodsinformationid") + public Integer goodsinformationid; + @SerializedName("supplier") + public String supplier; + @SerializedName("standard") + public String standard; + @SerializedName("locality") + public String locality; + @SerializedName("qualityguaranteeperiod") + public String qualityguaranteeperiod; + @SerializedName("particular") + public String particular; + @SerializedName("picture1") + public String picture1; + @SerializedName("picture2") + public String picture2; + @SerializedName("picture3") + public String picture3; + @SerializedName("goodsid") + public Integer goodsid; + } +} diff --git a/app/src/main/java/com/example/myapplication/dao/TwodimensionResult.java b/app/src/main/java/com/example/myapplication/dao/TwodimensionResult.java new file mode 100644 index 0000000..ec87366 --- /dev/null +++ b/app/src/main/java/com/example/myapplication/dao/TwodimensionResult.java @@ -0,0 +1,52 @@ +package com.example.myapplication.dao; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@lombok.NoArgsConstructor +@lombok.Data +public class TwodimensionResult { + + @SerializedName("total") + public Integer total; + @SerializedName("rows") + public List rows; + @SerializedName("code") + public Integer code; + @SerializedName("msg") + public String msg; + + @lombok.NoArgsConstructor + @lombok.Data + public static class RowsBean { + @SerializedName("createBy") + public Object createBy; + @SerializedName("createTime") + public Object createTime; + @SerializedName("updateBy") + public Object updateBy; + @SerializedName("updateTime") + public Object updateTime; + @SerializedName("remark") + public Object remark; + @SerializedName("id") + public Integer id; + @SerializedName("twodimension1") + public String twodimension1; + @SerializedName("twodimension2") + public String twodimension2; + @SerializedName("twodimension3") + public String twodimension3; + @SerializedName("customerid") + public Integer customerid; + + + public String getTwodimension1() { + return twodimension1; + } + } +} diff --git a/app/src/main/java/com/example/myapplication/tihuomaActivity.java b/app/src/main/java/com/example/myapplication/tihuomaActivity.java index e433ad6..4080811 100644 --- a/app/src/main/java/com/example/myapplication/tihuomaActivity.java +++ b/app/src/main/java/com/example/myapplication/tihuomaActivity.java @@ -1,13 +1,26 @@ package com.example.myapplication; +import static android.app.PendingIntent.getActivity; + import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.TextView; +import com.bumptech.glide.Glide; +import com.example.myapplication.Utils.RetrofitUtils; +import com.example.myapplication.dao.TwodimensionResult; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + public class tihuomaActivity extends AppCompatActivity { @Override @@ -33,5 +46,49 @@ public class tihuomaActivity extends AppCompatActivity { textView78.setText(phoneNumber); } + ImageView imageView = findViewById(R.id.imageView6); + + SharedPreferences sharedPreferences = getSharedPreferences("data", MODE_PRIVATE); + String token = sharedPreferences.getString("token", ""); + Call twodimensionResultCall = + RetrofitUtils.getRetrofit("http://192.168.56.115:8080/").create(Api.class).getTwodimension("Bearer " + token); + twodimensionResultCall.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + TwodimensionResult twodimensionResult = response.body(); + if (twodimensionResult!= null) { + if (twodimensionResult.code == 200) { + // 清空原有数据 + + // 使用 Glide 加载二维码图片 + if (twodimensionResult.rows != null && !twodimensionResult.rows.isEmpty()) { + String qrCodeUrl = twodimensionResult.rows.get(0).getTwodimension1(); + if (qrCodeUrl != null && !qrCodeUrl.isEmpty()) { + Glide.with(tihuomaActivity.this) + .load(qrCodeUrl) + .into(imageView); + } + } + } else if (twodimensionResult.code == 401) { + // 处理未授权的情况,例如提示用户重新登录 + Log.e("MineFragment", "Unauthorized access"); + } else { + // 处理其他错误情况 + Log.e("MineFragment", "Error code: " + twodimensionResult.code); + } + } else { + // 处理响应为空的情况 + Log.e("MineFragment", "Response body is null"); + } + } + @Override + public void onFailure(Call call, Throwable t) { + // 处理网络错误或其他异常 + t.printStackTrace(); + Log.e("HomeFragment", "Network error: " + t.getMessage()); + } + }); + + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/fenxiang.png b/app/src/main/res/drawable/fenxiang.png new file mode 100644 index 0000000..aefe332 Binary files /dev/null and b/app/src/main/res/drawable/fenxiang.png differ diff --git a/app/src/main/res/drawable/jiarugouwuche.png b/app/src/main/res/drawable/jiarugouwuche.png new file mode 100644 index 0000000..c18a7c9 Binary files /dev/null and b/app/src/main/res/drawable/jiarugouwuche.png differ diff --git a/app/src/main/res/drawable/shouye3.png b/app/src/main/res/drawable/shouye3.png new file mode 100644 index 0000000..152b593 Binary files /dev/null and b/app/src/main/res/drawable/shouye3.png differ diff --git a/app/src/main/res/drawable/zixunkefu2.png b/app/src/main/res/drawable/zixunkefu2.png new file mode 100644 index 0000000..ff84438 Binary files /dev/null and b/app/src/main/res/drawable/zixunkefu2.png differ diff --git a/app/src/main/res/layout/activity_shuiguoxiangqing.xml b/app/src/main/res/layout/activity_shuiguoxiangqing.xml index 0470b5e..8007ac8 100644 --- a/app/src/main/res/layout/activity_shuiguoxiangqing.xml +++ b/app/src/main/res/layout/activity_shuiguoxiangqing.xml @@ -15,6 +15,7 @@ app:layout_constraintTop_toTopOf="parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file