From 840d68a3510a5d909a5b34c21bfcd507b94e6d82 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 29 Oct 2024 14:01:35 +0800 Subject: [PATCH] =?UTF-8?q?1.1.6=E7=89=88=E6=9C=AC=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 +- app/src/main/AndroidManifest.xml | 4 + .../main/java/com/rehome/dywoa/Contans.java | 28 +-- .../com/rehome/dywoa/bean/UserInfoBean.java | 18 +- .../dywoa/ui/activity/KksSearchActivity.kt | 37 +++- .../rehome/dywoa/ui/activity/LoginActivity.kt | 92 +++++++--- .../dywoa/ui/activity/sbxj/SxgzActivity.java | 52 +++++- .../sbxj/XjCheckAndUploadActivity.java | 167 ++++++++++++++++++ .../com/rehome/dywoa/utils/DataPassUtils.java | 8 +- app/src/main/res/layout/activity_login.xml | 1 + .../layout/activity_xj_check_and_upload.xml | 21 +++ app/src/main/res/layout/activity_xsgz.xml | 5 +- 12 files changed, 384 insertions(+), 53 deletions(-) create mode 100644 app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/XjCheckAndUploadActivity.java create mode 100644 app/src/main/res/layout/activity_xj_check_and_upload.xml diff --git a/app/build.gradle b/app/build.gradle index db665fb..876d0e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.rehome.dywoa" minSdk 24 targetSdk 34 - versionCode 16 - versionName "1.1.5" + versionCode 17 + versionName "1.1.6" multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" //每个应用拥有不同的authorities,防止相同的在同一个手机上无法同时安装 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 661682c..d15ae25 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -152,6 +152,10 @@ android:name=".ui.activity.sbxj.SxgzActivity" android:exported="false" android:screenOrientation="portrait" /> + () - param["txm"] = qrCodeStr + param["type"] = type + + if("nfc" == type){ + param["nfc"] = qrCodeStr + } + if("txm" == type){ + param["txm"] = qrCodeStr + } + val json = GsonUtils.GsonString(param) showLog(json) diff --git a/app/src/main/java/com/rehome/dywoa/ui/activity/LoginActivity.kt b/app/src/main/java/com/rehome/dywoa/ui/activity/LoginActivity.kt index 109ab44..e76d984 100644 --- a/app/src/main/java/com/rehome/dywoa/ui/activity/LoginActivity.kt +++ b/app/src/main/java/com/rehome/dywoa/ui/activity/LoginActivity.kt @@ -40,6 +40,7 @@ import com.rehome.dywoa.ui.activity.vpn.PrimaryAuthActivity import com.rehome.dywoa.utils.DataPassUtils import com.rehome.dywoa.utils.GsonUtils import com.rehome.dywoa.utils.HttpListener +import com.rehome.dywoa.utils.NoProgresshttpUtils import com.rehome.dywoa.utils.NohttpUtils import com.rehome.dywoa.utils.RSAUtils import com.rehome.dywoa.utils.SPUtils @@ -198,13 +199,16 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { if (isApkInDebug(context)) { //测试 - binding.etUsername.setText("371522") - binding.etPassword.setText("A000000a.") +// binding.etUsername.setText("371522") +// binding.etPassword.setText("A000000a.") //ceshi1 // binding.etUsername.setText("ceshi1") // binding.etPassword.setText("A000000a.") + binding.etUsername.setText("CY00005") + binding.etPassword.setText("A000000a.") + // binding.etUsername.setText("CY00011") // binding.etPassword.setText("A000000a") @@ -268,13 +272,19 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { //checkVpnLogin() // appLogin() //登录 }) - checkUpdateApk() + } override fun onRestart() { super.onRestart() showLog("onRestart") - checkUpdateApk() + + } + + override fun onResume() { + super.onResume() + showLog("onResume") + checkConnectServerToUpdate(); } private fun startAutoTicket() { @@ -288,10 +298,12 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { * 免密场景, 启动L3VPN隧道,需要等待onTunnelStarted返回启动隧道成功才能开始访问资源 */ SFUemSDK.getInstance().sfTunnel.startTunnel() + checkConnectServerToUpdate(); //检测服务器是否能连接到 checkConnectServer() }else{ if(checkVpnCanLogin()){ + checkConnectServerToUpdate(); checkConnectServer() }else{ goToVpnLogin() @@ -381,6 +393,7 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { Contans.SP.PASS_WORD_VPN, RSAUtils.encryptBASE64StrLocal(pwdVpn) ) + checkConnectServerToUpdate(); if(checkInput()){ checkConnectServer(); } @@ -552,6 +565,41 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { return false } + private fun checkConnectServerToUpdate() { + var param = HashMap() + param["login"] = "dywoa"; + val json = GsonUtils.GsonString(param) + val url = Contans.IP + Contans.check_server_connect + //val url = "http://192.168.2.150:8601/" + Contans.check_server_connect + showLog(url) + showLog(json) + val request = NoHttp.createStringRequest( + url, + RequestMethod.POST + ) + request.setDefineRequestBodyForJson(json) + NoProgresshttpUtils.getInstance().add(this, 0, request, object : HttpListener { + override fun onSucceed(what: Int, response: Response?) { + val result = response?.get() + if (result != null) { + showLog("-----onSucceed----") + showLog(result) + if(result == "1"){ + showLog("connect server success") + checkUpdateApk() //检查软件自动更新 + } + } + } + + override fun onFailed(what: Int, response: Response?) { + showLog("connect server onFailed") + //离线登录 + offLineLogin() + showToast("无法连接到服务器,请检查网络环境") + } + }) + } + private fun appLogin() { @@ -669,24 +717,24 @@ class LoginActivity : BaseActivityOaToolbarViewBinding() { // userInfo.manid="371520" // userInfo.usernames="王子俊" - if(DataPassUtils.checkCanLogin()){ - showLog("之前") - App.getInstance().userInfo = userInfo - val intent = Intent(context, HomeActivity::class.java) - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) - startActivity(intent) - finish() - }else{ - showLog("之后") - showToast("登录失败") - } - - -// App.getInstance().userInfo = userInfo -// val intent = Intent(context, HomeActivity::class.java) -// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) -// startActivity(intent) -// finish() +// if(DataPassUtils.checkCanLogin()){ +// showLog("之前") +// App.getInstance().userInfo = userInfo +// val intent = Intent(context, HomeActivity::class.java) +// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) +// startActivity(intent) +// finish() +// }else{ +// showLog("之后") +// showToast("登录失败") +// } + + + App.getInstance().userInfo = userInfo + val intent = Intent(context, HomeActivity::class.java) + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) + startActivity(intent) + finish() } } else { showLog(userInfo.statusMsg) diff --git a/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/SxgzActivity.java b/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/SxgzActivity.java index 66b12be..de7a28c 100644 --- a/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/SxgzActivity.java +++ b/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/SxgzActivity.java @@ -13,6 +13,7 @@ import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.AdapterView; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; @@ -64,6 +65,11 @@ public class SxgzActivity extends BaseActivity { TextView tv_uploaded; TextView tv_checkedAndNoUpload; + LinearLayout ll_no_checked; + LinearLayout ll_checked; + LinearLayout ll_uploaded; + LinearLayout ll_checkedAndNoUpload; + private CommonAdapter adapter; private List xsjjhxzDataBeanList = new ArrayList<>(); @@ -110,6 +116,11 @@ public class SxgzActivity extends BaseActivity { tv_uploaded = findViewById(R.id.tv_uploaded); tv_checkedAndNoUpload = findViewById(R.id.tv_checkedAndNoUpload); + ll_no_checked = findViewById(R.id.ll_no_checked); + ll_checked = findViewById(R.id.ll_checked); + ll_uploaded = findViewById(R.id.ll_uploaded); + ll_checkedAndNoUpload = findViewById(R.id.ll_checkedAndNoUpload); + lv.setEmptyView(tvNodata); headView = View.inflate(this, R.layout.xsgz_item, null); headView.findViewById(R.id.head).setVisibility(View.VISIBLE); @@ -131,6 +142,45 @@ public class SxgzActivity extends BaseActivity { filter.addAction(Contans.REFRESHDJSTATISTICS); LocalBroadcastManager.getInstance(this).registerReceiver(myReceiver, filter); + ll_uploaded.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(SxgzActivity.this, XjCheckAndUploadActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.putExtra("type","已检已上传"); + startActivity(intent); + } + }); + + ll_checkedAndNoUpload.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(SxgzActivity.this, XjCheckAndUploadActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.putExtra("type","已检未上传"); + startActivity(intent); + } + }); + + ll_checked.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(SxgzActivity.this, XjCheckAndUploadActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.putExtra("type","已检点数"); + startActivity(intent); + } + }); + + ll_no_checked.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(SxgzActivity.this, XjCheckAndUploadActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.putExtra("type","未检点数"); + startActivity(intent); + } + }); } public void initData() { @@ -263,7 +313,7 @@ public class SxgzActivity extends BaseActivity { showLog("-------未检点数------"); showLog(GsonUtils.GsonString(noCheckList)); } - //未检点数 + //已检点数 List checkedList = DataSupport.where("checked = ? and username = ?", "1",username).find(XSJJHDataBean.class); if(checkedList!=null&&checkedList.size()>0){ tv_checked.setText(String.valueOf(checkedList.size())); diff --git a/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/XjCheckAndUploadActivity.java b/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/XjCheckAndUploadActivity.java new file mode 100644 index 0000000..3c68382 --- /dev/null +++ b/app/src/main/java/com/rehome/dywoa/ui/activity/sbxj/XjCheckAndUploadActivity.java @@ -0,0 +1,167 @@ +package com.rehome.dywoa.ui.activity.sbxj; + + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ListView; + +import com.rehome.dywoa.App; +import com.rehome.dywoa.Contans; +import com.rehome.dywoa.DBModel.XSJJHDataBean; +import com.rehome.dywoa.DBModel.XSJJHXZDataBean; +import com.rehome.dywoa.R; +import com.rehome.dywoa.adapter.DlbAdapter; +import com.rehome.dywoa.base.BaseActivity; +import com.rehome.dywoa.bean.DlbInfo; +import com.rehome.dywoa.bean.SetxjSbModel; +import com.rehome.dywoa.utils.GsonUtils; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; +import java.util.List; + +import static org.litepal.crud.DataSupport.where; + +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + +public class XjCheckAndUploadActivity extends BaseActivity { + public static int Req = 101; + ListView lv; + + private boolean isEdit = true; + private int item; + //private ArrayList xsjjhxzDataBeanArrayList = new ArrayList<>();//工作列表 + private ArrayList xsjjhDataBeanArrayList = new ArrayList<>(); + private List infos = new ArrayList<>(); + private View headView; + private DlbAdapter adapter; + private int itemposition; + private String LX, LXResult; + + private String username; + + private String type; + + + @Override + public int getContentViewID() { + return R.layout.activity_xj_check_and_upload; + } + + @Override + public void initView() { + username = App.getInstance().getUserInfo().getManid(); + type = getIntent().getStringExtra("type"); + String title = ""; + if ("已检已上传".equals(type)) { + title = "已检已上传"; + } + if ("已检未上传".equals(type)) { + title = "已检未上传"; + } + if ("已检点数".equals(type)) { + title = "已检点数"; + } + if ("未检点数".equals(type)) { + title = "未检点数"; + } + + + lv = findViewById(R.id.lv); + initToolbar(title, "", new View.OnClickListener() { + @Override + public void onClick(View v) { + + } + }); + + headView = View.inflate(context, R.layout.dlb_item, null); + headView.findViewById(R.id.head).setVisibility(View.VISIBLE); + + } + + @Override + public void initData() { + + searchdata(); + setListAdapter(); + } + + private void searchdata() { + + if ("已检已上传".equals(type)) { + //已检已上传点数 + List uploadEdList = DataSupport.where("checked = ? and uploaded = ? and username = ?", "1","1",username).find(XSJJHDataBean.class); + if(uploadEdList!=null&&uploadEdList.size()>0){ + showLog("-------已检已上传点数------"); + showLog(GsonUtils.GsonString(uploadEdList)); + } + + xsjjhDataBeanArrayList.clear(); + //获取当前点击的工作栏对应的点检记录列表 + xsjjhDataBeanArrayList.addAll(uploadEdList); + } + if ("已检未上传".equals(type)) { + //已检未上传点数 + List checkedAndNoUploadList = DataSupport.where("checked = ? and uploaded = ? and username = ?", "1","0",username).find(XSJJHDataBean.class); + if(checkedAndNoUploadList!=null&&checkedAndNoUploadList.size()>0){ + showLog("-------已检未上传点数------"); + showLog(GsonUtils.GsonString(checkedAndNoUploadList)); + } + + xsjjhDataBeanArrayList.clear(); + //获取当前点击的工作栏对应的点检记录列表 + xsjjhDataBeanArrayList.addAll(checkedAndNoUploadList); + } + if ("已检点数".equals(type)) { + //已检点数 + List checkedList = DataSupport.where("checked = ? and username = ?", "1",username).find(XSJJHDataBean.class); + if(checkedList!=null&&checkedList.size()>0){ + showLog("-------未检点数------"); + showLog(GsonUtils.GsonString(checkedList)); + } + + xsjjhDataBeanArrayList.clear(); + //获取当前点击的工作栏对应的点检记录列表 + xsjjhDataBeanArrayList.addAll(checkedList); + } + if ("未检点数".equals(type)) { + //未检点数 + List noCheckList = DataSupport.where("checked = ? and username = ?", "0",username).find(XSJJHDataBean.class); + if(noCheckList!=null&&noCheckList.size()>0){ + showLog("-------未检点数------"); + showLog(GsonUtils.GsonString(noCheckList)); + } + + xsjjhDataBeanArrayList.clear(); + //获取当前点击的工作栏对应的点检记录列表 + xsjjhDataBeanArrayList.addAll(noCheckList); + } + } + + private void setListAdapter() { + + for (XSJJHDataBean rw : xsjjhDataBeanArrayList) { + DlbInfo info = new DlbInfo(); + info.setSbid(rw.getSbid()); + info.setCjjg(rw.getCJJG()); + //info.setDian(rw.getSb() + "--" + rw.getBJMC()); + //info.setDian(rw.getJhmc() + "--" + rw.getQymc() + "--" + rw.getSb()); + info.setDian(rw.getSb()); + info.setStatu(rw.isChecked()); + infos.add(info); + } + + adapter = new DlbAdapter(context, infos); + lv.addHeaderView(headView, null, false); + lv.setAdapter(adapter); + } +} + diff --git a/app/src/main/java/com/rehome/dywoa/utils/DataPassUtils.java b/app/src/main/java/com/rehome/dywoa/utils/DataPassUtils.java index c96604a..7691c01 100644 --- a/app/src/main/java/com/rehome/dywoa/utils/DataPassUtils.java +++ b/app/src/main/java/com/rehome/dywoa/utils/DataPassUtils.java @@ -10,7 +10,7 @@ public class DataPassUtils { try { //格式化日期的对象(转化成习惯的时间格式) SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日"); - Date date = sdFormat.parse("2024年10月20日"); + Date date = sdFormat.parse("2025年01月20日"); Calendar calendarOne = Calendar.getInstance(); calendarOne.setTime(date); if (!Calendar.getInstance().after(calendarOne)) { @@ -27,7 +27,7 @@ public class DataPassUtils { try { //格式化日期的对象(转化成习惯的时间格式) SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日"); - Date date = sdFormat.parse("2024年10月20日"); + Date date = sdFormat.parse("2025年01月20日"); Calendar calendarOne = Calendar.getInstance(); calendarOne.setTime(date); if (!Calendar.getInstance().after(calendarOne)) { @@ -43,7 +43,7 @@ public class DataPassUtils { try { //格式化日期的对象(转化成习惯的时间格式) SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日"); - Date date = sdFormat.parse("2024年10月20日"); + Date date = sdFormat.parse("2025年01月20日"); Calendar calendarOne = Calendar.getInstance(); calendarOne.setTime(date); if (!Calendar.getInstance().after(calendarOne)) { @@ -58,7 +58,7 @@ public class DataPassUtils { try { //格式化日期的对象(转化成习惯的时间格式) SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日"); - Date date = sdFormat.parse("2024年10月20日"); + Date date = sdFormat.parse("2025年01月20日"); Calendar calendarOne = Calendar.getInstance(); calendarOne.setTime(date); if (!Calendar.getInstance().after(calendarOne)) { diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index cd48f46..dea1868 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -160,6 +160,7 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="60dp" + android:visibility="invisible" android:gravity="center" android:text="承包商找回密码" android:textColor="@color/blue" diff --git a/app/src/main/res/layout/activity_xj_check_and_upload.xml b/app/src/main/res/layout/activity_xj_check_and_upload.xml new file mode 100644 index 0000000..9a09886 --- /dev/null +++ b/app/src/main/res/layout/activity_xj_check_and_upload.xml @@ -0,0 +1,21 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_xsgz.xml b/app/src/main/res/layout/activity_xsgz.xml index 957cbca..3dc4bc1 100644 --- a/app/src/main/res/layout/activity_xsgz.xml +++ b/app/src/main/res/layout/activity_xsgz.xml @@ -79,6 +79,7 @@ android:text="0"/>