重点青少年事件

This commit is contained in:
高健 2021-10-30 18:17:10 +08:00
parent 59daa85049
commit 59c9ad0b17
23 changed files with 2255 additions and 7 deletions

View File

@ -160,7 +160,7 @@ public class PathConfig {
public static final String USER_TYPE_N = "bc405346-8714-4ded-89ac-9cc4d755f66a";
public static final String USER_TYPE_X = "25affe67-134c-4a32-ba41-64b0cfedc782";
// public static final String APP_VERSION_ID = "f311fd32-cd36-45a1-9652-599d5f2c2d4f";/*正式App下载码*/
public static final String APP_VERSION_ID = "4f75940c-930f-4576-ae0b-b8f699aa5bdc";/*测试App下载码*/
public static final String APP_VERSION_ID = "444a0289-65fc-4cbb-9972-c9569c24f42b";/*测试App下载码*/
public static final String NEWS_ID = "f497904b-7727-4832-891c-604c36ae4167";//文化动态ID
public static final String NEWS_SHOW_ID = "f1d5d313-f728-4dda-9843-1116d97e17b0";//展览展示ID
@ -400,6 +400,11 @@ public class PathConfig {
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_LIST = "/modulegrid/activity/censusYoungList";//重点青少年列表
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_ADD = "/modulegrid/activity/censusYoungAdd";//重点青少年列表添加
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_DETAIL = "/modulegrid/activity/censusYoungDetail";//重点青少年列表详情
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_LIST = "/modulegrid/activity/youngCaseList";//重点青少年事件列表
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_ADD = "/modulegrid/activity/youngCaseAdd";//重点青少年事件添加
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_EDIT = "/modulegrid/activity/youngCaseEdit";//重点青少年事件编辑
public static final String PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_DETAIL = "/modulegrid/activity/youngCaseDetail";//重点青少年事件详情
public static final String PATH_MODULE_GRID_ACTIVITY_TASK_MANAGE = "/modulegrid/activity/taskManage";//任务管理
public static final String PATH_MODULE_GRID_FRAGMENT_TASK = "/modulegrid/fragment/taskList";//任务列表

View File

@ -10,16 +10,16 @@ import com.tenlionsoft.baselib.constant.PathConfig;
public class BaseUrlApi {
// public static final String IP = "http://192.168.0.109:8080/";/* 正式IP */
public static final String IP = "http://192.168.0.120:8080/";/* 正式IP */
public static final String IP = "http://192.168.0.109:8080/";/* 正式IP */
public static final String SYS_USERCENTER = "usercenter/";
public static final String SYS_POPULATION = "population/";/*人口系统*/
public static final String SYS_CASE = "case/";/*事件部件*/
public static final String SYS_HOUSE = "systemhouse/";/*房屋系统*/
public static final String SYS_SECURITY = "systembase/";/*社会治安*/
public static final String SYS_TASK = "systemtask/";/*任务系统*/
public static final String TEMP_IP = "http://192.168.0.120:8080/";
public static final String TEMP_IP = "http://192.168.0.109:8080/";
public static final String BASE_MAIN_IP = IP + SYS_CASE;
public static final String BASE_MAIN_IP = IP + SYS_POPULATION;
public static final String BASE_CASE_IP = IP + SYS_CASE;
public static final String BASE_SECURITY_IP = IP + SYS_SECURITY;
public static final String BASE_HOUSE_IP = IP + SYS_HOUSE;

View File

@ -0,0 +1,135 @@
package com.tenlionsoft.baselib.core.widget.views;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.Selection;
import android.text.TextUtils;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import com.hjq.toast.ToastUtils;
import com.tenlionsoft.baselib.R;
import com.tenlionsoft.baselib.utils.RegexUtils;
import androidx.appcompat.widget.SwitchCompat;
/**
* 作者 : Adam on 2018/7/23.
* 邮箱 : itgaojian@163.com
* 描述 : 添加人员
*/
public class AddPersonDialog extends Dialog {
private View view;
private Context context;
private EditText mEtName;
private EditText mEtIdCard;
private OnChangeListener mChangeListener;
private SwitchCompat mSwIsKey;
private int mIsKey = 0;
private AddPersonDialog(Context context) {
super(context, R.style.dialog_center_alpha);
this.context = context;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
view = LayoutInflater.from(context).inflate(R.layout.dialog_add_person, null);
setContentView(view);
setCancelable(false);
setCanceledOnTouchOutside(false);
mEtName = view.findViewById(R.id.et_name);
mEtIdCard = view.findViewById(R.id.et_id_card);
mSwIsKey = view.findViewById(R.id.sw_is_key);
mSwIsKey.setOnCheckedChangeListener((buttonView, isChecked) -> mIsKey = isChecked ? 1 : 0);
view.findViewById(R.id.tv_cancel).setOnClickListener(v -> this.dismiss());
view.findViewById(R.id.tv_confirm).setOnClickListener(v -> doConfirm());
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
Window window = this.getWindow();
window.setGravity(Gravity.CENTER);
window.setWindowAnimations(R.style.dialog_center_alpha);
WindowManager.LayoutParams params = window.getAttributes();
params.width = (int) (displayMetrics.widthPixels * 0.9);
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
window.setBackgroundDrawable(new ColorDrawable());
}
private void doConfirm() {
if (checkParams()) {
if (mChangeListener != null) {
String name = mEtName.getText().toString().trim();
String idcard = mEtIdCard.getText().toString().trim();
mChangeListener.doChange(name, idcard, mIsKey + "");
}
}
}
public void HideSoftKeyBoardDialog(Activity activity) {
try {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
} catch (Exception ex) {
}
}
public void addOnChangeListener(OnChangeListener listener) {
this.mChangeListener = listener;
}
public interface OnChangeListener {
void doChange(String org, String nPwd, String nCPwd);
}
/**
* 校验参数
*/
private boolean checkParams() {
String originPwd = mEtName.getText().toString().trim();
if (TextUtils.isEmpty(originPwd)) {
ToastUtils.show("请输入姓名");
return false;
}
String idcard = mEtIdCard.getText().toString().trim();
if (TextUtils.isEmpty(idcard) || !RegexUtils.isIDNumber(idcard)) {
ToastUtils.show("请输入正确的身份证号码");
return false;
}
return true;
}
public static class DialogBuilder {
private Context mContext;
public DialogBuilder(Context context) {
this.mContext = context;
}
public AddPersonDialog build() {
return new AddPersonDialog(mContext);
}
}
}

View File

@ -58,7 +58,7 @@ public class ChangePwdDialog extends Dialog {
private OnChangeListener mChangeListener;
private ChangePwdDialog(Context context) {
super(context, R.style.Dialog_ChoseFile);
super(context, R.style.dialog_center_alpha);
this.context = context;
}
@ -126,7 +126,7 @@ public class ChangePwdDialog extends Dialog {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
Window window = this.getWindow();
window.setGravity(Gravity.CENTER);
window.setWindowAnimations(R.style.Dialog_ChoseFile);
window.setWindowAnimations(R.style.dialog_center_alpha);
WindowManager.LayoutParams params = window.getAttributes();
params.width = (int) (displayMetrics.widthPixels * 0.9);
params.height = WindowManager.LayoutParams.WRAP_CONTENT;

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@drawable/shp_rectangle_white_5"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="相关人员添加"
android:textColor="@color/black"
android:textSize="18sp" />
<LinearLayout
style="@style/item_gray"
android:layout_marginTop="10dp">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<TextView
style="@style/item_title"
android:text="姓名" />
<View style="@style/vertical_line" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<EditText
android:id="@+id/et_name"
style="@style/item_content"
android:gravity="left"
android:hint="请输入姓名"
android:inputType="text" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/item_gray"
android:layout_marginTop="10dp">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<TextView
style="@style/item_title"
android:text="身份证号" />
<View style="@style/vertical_line" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<EditText
android:id="@+id/et_id_card"
style="@style/item_content"
android:digits="@string/limit_id_card"
android:gravity="left"
android:hint="请输入身份证号码"
android:inputType="text" />
</LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/item_gray"
android:layout_marginTop="10dp">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<TextView
style="@style/item_title"
android:layout_weight="0.6"
android:text="是否未重点青少年" />
<View style="@style/vertical_line" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/sw_is_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/switch_ios_track_selector"
android:switchMinWidth="40dp"
android:switchPadding="0dp"
android:textOff=""
android:textOn=""
app:showText="false"
app:splitTrack="false"
app:theme="@style/scstyle"
app:thumbTint="#00000000"
app:trackTint="#00000000" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="right"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:clickable="true"
android:focusable="true"
android:padding="10dp"
android:text="取消"
android:textColor="@color/gray_text" />
<TextView
android:id="@+id/tv_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:padding="10dp"
android:text="确定"
android:textColor="@color/text_blue" />
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,43 @@
package com.tengshisoft.commonmodule.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.tengshisoft.commonmodule.R;
import com.tengshisoft.commonmodule.beans.HouseListBean;
import com.tengshisoft.commonmodule.beans.YoungCaseListBean;
import com.tengshisoft.commonmodule.holders.HouseListHolder;
import com.tengshisoft.commonmodule.holders.YoungCaseHolder;
import com.tenlionsoft.baselib.core.widget.base.BaseRecyclerAdapter;
import java.util.List;
/**
* 作者: adam
* 日期: 2021年10月30日16:28:52
* 邮箱: itgaojian@163.com
* 描述:
*/
public class YoungCaseListAdapter extends BaseRecyclerAdapter<YoungCaseListBean.RowsBean, YoungCaseHolder> {
public YoungCaseListAdapter(Context ctx, List<YoungCaseListBean.RowsBean> list) {
super(ctx, list);
}
@Override
public YoungCaseHolder createHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_young_case_list, parent, false);
return new YoungCaseHolder(itemView);
}
@Override
public void bindHolder(YoungCaseHolder holder, int i) {
YoungCaseListBean.RowsBean rowsBean = mData.get(i);
holder.mTvName.setText("事件名称:" + rowsBean.getEventTitle());
holder.mTvDesc.setText("事件描述:" + rowsBean.getEventDescribe());
holder.mTvTime.setText("事发日期:" + rowsBean.getEventDate());
}
}

View File

@ -0,0 +1,63 @@
package com.tengshisoft.commonmodule.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.tengshisoft.commonmodule.R;
import com.tengshisoft.commonmodule.beans.ExpressListBean;
import com.tengshisoft.commonmodule.beans.YoungCasePersonBean;
import com.tengshisoft.commonmodule.holders.ExpressHolder;
import com.tengshisoft.commonmodule.holders.YoungCasePersonHolder;
import com.tenlionsoft.baselib.core.widget.base.BaseRecyclerAdapter;
import com.tenlionsoft.baselib.utils.IDCard;
import java.util.List;
/**
* 作者: adam
* 日期: 2021/9/26 - 3:01 下午
* 邮箱: itgaojian@163.com
* 描述: 重点青少年事件相关人员
*/
public class YoungCasePersonAdapter extends BaseRecyclerAdapter<YoungCasePersonBean, YoungCasePersonHolder> {
private int mType = 1;
public YoungCasePersonAdapter(Context ctx, List<YoungCasePersonBean> list, int type) {
super(ctx, list);
mType = type;
}
@Override
public YoungCasePersonHolder createHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_young_case_person, parent, false);
return new YoungCasePersonHolder(itemView);
}
@Override
public void bindHolder(YoungCasePersonHolder holder, int i) {
YoungCasePersonBean bean = mData.get(i);
holder.mTvName.setText(bean.getFullName());
holder.mTvIdCard.setText("身份证号:" + IDCard.idMask(bean.getIdCardnumber(), 10, 4));
holder.mTvType.setText("是否为重点青少年:" + ("1".equals(bean.getUserCategory()) ? "" : ""));
if (mType == 1) {
holder.mBtnDel.setVisibility(View.VISIBLE);
} else {
holder.mBtnDel.setVisibility(View.GONE);
}
holder.mBtnDel.setOnClickListener(v -> mPatrolListener.onDel(bean, i));
}
private OnDelPersonListener mPatrolListener;
public void addOnDelPersonListen(OnDelPersonListener listener) {
this.mPatrolListener = listener;
}
public interface OnDelPersonListener {
void onDel(YoungCasePersonBean bean, int pos);
}
}

View File

@ -0,0 +1,111 @@
package com.tengshisoft.commonmodule.beans;
import java.util.List;
/**
* 作者: adam
* 日期: 2021/10/30 - 5:25 下午
* 邮箱: itgaojian@163.com
* 描述:
*/
public class SaveYoungCaseBean {
private String eventId;
private String eventTitle;
private String eventDate;
private String eventNormalType;
private String eventNormalTypeDict;
private String eventSpecialType;
private String eventSpecialTypeDict;
private String eventDescribe;
private String solveDate;
private String solveResult;
private List<YoungCasePersonBean> eventUserList;
public String getEventId() {
return eventId;
}
public void setEventId(String eventId) {
this.eventId = eventId;
}
public String getEventTitle() {
return eventTitle;
}
public void setEventTitle(String eventTitle) {
this.eventTitle = eventTitle;
}
public String getEventDate() {
return eventDate;
}
public void setEventDate(String eventDate) {
this.eventDate = eventDate;
}
public String getEventNormalType() {
return eventNormalType;
}
public void setEventNormalType(String eventNormalType) {
this.eventNormalType = eventNormalType;
}
public String getEventNormalTypeDict() {
return eventNormalTypeDict;
}
public void setEventNormalTypeDict(String eventNormalTypeDict) {
this.eventNormalTypeDict = eventNormalTypeDict;
}
public String getEventSpecialType() {
return eventSpecialType;
}
public void setEventSpecialType(String eventSpecialType) {
this.eventSpecialType = eventSpecialType;
}
public String getEventSpecialTypeDict() {
return eventSpecialTypeDict;
}
public void setEventSpecialTypeDict(String eventSpecialTypeDict) {
this.eventSpecialTypeDict = eventSpecialTypeDict;
}
public String getEventDescribe() {
return eventDescribe;
}
public void setEventDescribe(String eventDescribe) {
this.eventDescribe = eventDescribe;
}
public String getSolveDate() {
return solveDate;
}
public void setSolveDate(String solveDate) {
this.solveDate = solveDate;
}
public String getSolveResult() {
return solveResult;
}
public void setSolveResult(String solveResult) {
this.solveResult = solveResult;
}
public List<YoungCasePersonBean> getEventUserList() {
return eventUserList;
}
public void setEventUserList(List<YoungCasePersonBean> eventUserList) {
this.eventUserList = eventUserList;
}
}

View File

@ -0,0 +1,145 @@
package com.tengshisoft.commonmodule.beans;
import java.util.List;
/**
* 作者: adam
* 日期: 2021/10/30 - 4:19 下午
* 邮箱: itgaojian@163.com
* 描述:
*/
public class YoungCaseListBean {
private int page;
private int total;
private List<RowsBean> rows;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<RowsBean> getRows() {
return rows;
}
public void setRows(List<RowsBean> rows) {
this.rows = rows;
}
public static class RowsBean {
private String eventDate;
private String eventDescribe;
private String eventId;
private String eventNormalType;
private String eventNormalTypeDict;
private String eventSpecialType;
private String eventSpecialTypeDict;
private String eventTitle;
private String solveDate;
private String solveResult;
private List<EventUserListBean> eventUserList;
public String getEventDate() {
return eventDate;
}
public void setEventDate(String eventDate) {
this.eventDate = eventDate;
}
public String getEventDescribe() {
return eventDescribe;
}
public void setEventDescribe(String eventDescribe) {
this.eventDescribe = eventDescribe;
}
public String getEventId() {
return eventId;
}
public void setEventId(String eventId) {
this.eventId = eventId;
}
public String getEventNormalType() {
return eventNormalType;
}
public void setEventNormalType(String eventNormalType) {
this.eventNormalType = eventNormalType;
}
public String getEventNormalTypeDict() {
return eventNormalTypeDict;
}
public void setEventNormalTypeDict(String eventNormalTypeDict) {
this.eventNormalTypeDict = eventNormalTypeDict;
}
public String getEventSpecialType() {
return eventSpecialType;
}
public void setEventSpecialType(String eventSpecialType) {
this.eventSpecialType = eventSpecialType;
}
public String getEventSpecialTypeDict() {
return eventSpecialTypeDict;
}
public void setEventSpecialTypeDict(String eventSpecialTypeDict) {
this.eventSpecialTypeDict = eventSpecialTypeDict;
}
public String getEventTitle() {
return eventTitle;
}
public void setEventTitle(String eventTitle) {
this.eventTitle = eventTitle;
}
public String getSolveDate() {
return solveDate;
}
public void setSolveDate(String solveDate) {
this.solveDate = solveDate;
}
public String getSolveResult() {
return solveResult;
}
public void setSolveResult(String solveResult) {
this.solveResult = solveResult;
}
public List<EventUserListBean> getEventUserList() {
return eventUserList;
}
public void setEventUserList(List<EventUserListBean> eventUserList) {
this.eventUserList = eventUserList;
}
public static class EventUserListBean {
}
}
}

View File

@ -0,0 +1,37 @@
package com.tengshisoft.commonmodule.beans;
/**
* 作者: adam
* 日期: 2021/10/30 - 5:09 下午
* 邮箱: itgaojian@163.com
* 描述:
*/
public class YoungCasePersonBean {
private String fullName;
private String idCardnumber;
private String userCategory;
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getIdCardnumber() {
return idCardnumber;
}
public void setIdCardnumber(String idCardnumber) {
this.idCardnumber = idCardnumber;
}
public String getUserCategory() {
return userCategory;
}
public void setUserCategory(String userCategory) {
this.userCategory = userCategory;
}
}

View File

@ -0,0 +1,30 @@
package com.tengshisoft.commonmodule.holders;
import android.view.View;
import android.widget.TextView;
import com.tengshisoft.commonmodule.R;
import org.jetbrains.annotations.NotNull;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* 作者: adam
* 日期: 2021/10/30 - 4:25 下午
* 邮箱: itgaojian@163.com
* 描述:
*/
public class YoungCaseHolder extends RecyclerView.ViewHolder {
public TextView mTvName;
public TextView mTvDesc;
public TextView mTvTime;
public YoungCaseHolder(@NonNull @NotNull View itemView) {
super(itemView);
mTvName = itemView.findViewById(R.id.tv_name);
mTvDesc = itemView.findViewById(R.id.tv_desc);
mTvTime = itemView.findViewById(R.id.tv_time);
}
}

View File

@ -0,0 +1,33 @@
package com.tengshisoft.commonmodule.holders;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.tengshisoft.commonmodule.R;
import org.jetbrains.annotations.NotNull;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/**
* 作者: adam
* 日期: 2021/10/30 - 5:12 下午
* 邮箱: itgaojian@163.com
* 描述:
*/
public class YoungCasePersonHolder extends RecyclerView.ViewHolder {
public TextView mTvName;
public TextView mTvIdCard;
public Button mBtnDel;
public TextView mTvType;
public YoungCasePersonHolder(@NonNull @NotNull View itemView) {
super(itemView);
mTvName = itemView.findViewById(R.id.tv_name);
mTvIdCard = itemView.findViewById(R.id.tv_id_card);
mBtnDel = itemView.findViewById(R.id.btn_del);
mTvType = itemView.findViewById(R.id.tv_type);
}
}

View File

@ -62,6 +62,7 @@ import com.tengshisoft.commonmodule.beans.PenalListBean;
import com.tengshisoft.commonmodule.beans.PenalSuspicionDetailBean;
import com.tengshisoft.commonmodule.beans.PenalSuspicionListBean;
import com.tengshisoft.commonmodule.beans.RearListBean;
import com.tengshisoft.commonmodule.beans.SaveYoungCaseBean;
import com.tengshisoft.commonmodule.beans.SchoolCaseDetailBean;
import com.tengshisoft.commonmodule.beans.SchoolCaseListBean;
import com.tengshisoft.commonmodule.beans.SchoolDetailBean;
@ -77,6 +78,7 @@ import com.tengshisoft.commonmodule.beans.TaskReportRecordDetailBean;
import com.tengshisoft.commonmodule.beans.TroubleDetailBean;
import com.tengshisoft.commonmodule.beans.VictimDetailBean;
import com.tengshisoft.commonmodule.beans.VictimListBean;
import com.tengshisoft.commonmodule.beans.YoungCaseListBean;
import com.tenlionsoft.baselib.core.beans.AreaBean;
import com.tenlionsoft.baselib.core.beans.DeptDatabaseBean;
import com.tenlionsoft.baselib.core.beans.DicBean;
@ -955,6 +957,41 @@ public interface Apis {
Observable<CensusYoungDetailBean> getCensusYoungDetailByIdCard(@Path("idCardNumber") String idCard, @Header("token") String token);
/**
* 获取重点青少年事件列表
*/
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
@GET("app/teenagers-event/list-page-teenagers-event")
Observable<YoungCaseListBean> getYoungCaseList(@Query("page") String page, @Query("keywords") String keywords, @Header("token") String token);
/**
* 获取重点青少年事件详情
*/
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
@GET("app/teenagers-event/get-teenagers-event")
Observable<SaveYoungCaseBean> getYoungCaseDetailById(@Query("eventId") String id, @Header("token") String token);
/**
* 保存重点青少年事件
*/
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
@POST("app/teenagers-event/save-teenagers-event")
Observable<SuccessBean> doSaveYoungCase(@Body RequestBody body, @Header("token") String token);
/**
* 删除重点青少年事件
*/
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
@DELETE("app/teenagers-event/remove-teenagers-event/{ids}")
Observable<SuccessBean> doDelYoungCase(@Path("ids") String id, @Header("token") String token);
/**
* 编辑重点青少年事件
*/
@Headers({"base_url_name:person", "Content-Type: application/json", "Accept: application/json"})
@PUT("app/teenagers-event/update-teenagers-event/{eventId}")
Observable<SuccessBean> doEditYoungCase(@Path("eventId") String id, @Body RequestBody body, @Header("token") String token);
/*===========================事件、部件==================================*/
/**

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/shape_rectangle_white"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ff353535"
android:textSize="18sp"
tools:text="事件名称" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/black"
android:textSize="12sp"
tools:text="事件描述" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="@drawable/shp_line_dotted"
android:layerType="software" />
<TextView
android:id="@+id/tv_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawableLeft="@drawable/ic_type_icon"
android:drawablePadding="5dp"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#ff1189ff"
android:textSize="12sp"
tools:text="事件日期:2022-20-12" />
</LinearLayout>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/shape_rectangle_white"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ff353535"
android:textSize="18sp"
tools:text="姓名" />
<TextView
android:id="@+id/tv_id_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textSize="12sp"
tools:text="身份证号码" />
</LinearLayout>
<Button
android:id="@+id/btn_del"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="@drawable/sel_btn_submit"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="删除"
android:textColor="@color/white" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:background="@drawable/shp_line_dotted"
android:layerType="software" />
<TextView
android:id="@+id/tv_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawableLeft="@drawable/ic_type_icon"
android:drawablePadding="5dp"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#ff1189ff"
android:textSize="12sp"
tools:text="是否是重点青少年" />
</LinearLayout>

View File

@ -4,7 +4,10 @@
package="com.tengshisoft.gridmodule">
<application>
<activity android:name=".incident.activitys.locus.WorkLocusActivity"></activity>
<activity android:name=".incident.activitys.populace.YoungCaseDetailActivity"></activity>
<activity android:name=".incident.activitys.populace.YoungCaseAddActivity" />
<activity android:name=".incident.activitys.populace.YoungCaseListActivity" />
<activity android:name=".incident.activitys.locus.WorkLocusActivity" />
<activity android:name=".incident.activitys.tasks.TaskReportRecordEditActivity" />
<activity android:name=".incident.activitys.tasks.TaskReportRecordDetailActivity" />
<activity android:name=".incident.activitys.schools.SchoolCaseDetailActivity" />

View File

@ -0,0 +1,358 @@
package com.tengshisoft.gridmodule.incident.activitys.populace;
import android.app.ProgressDialog;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.view.TimePickerView;
import com.google.gson.Gson;
import com.hjq.toast.ToastUtils;
import com.tengshisoft.commonmodule.adapters.YoungCasePersonAdapter;
import com.tengshisoft.commonmodule.beans.SaveYoungCaseBean;
import com.tengshisoft.commonmodule.beans.SuccessBean;
import com.tengshisoft.commonmodule.beans.YoungCasePersonBean;
import com.tengshisoft.commonmodule.nets.Apis;
import com.tengshisoft.gridmodule.R;
import com.tengshisoft.gridmodule.R2;
import com.tengshisoft.gridmodule.incident.activitys.orgmanage.SocialOrgEditActivity;
import com.tenlionsoft.baselib.constant.PathConfig;
import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager;
import com.tenlionsoft.baselib.core.widget.base.BaseActivity;
import com.tenlionsoft.baselib.core.widget.views.AddPersonDialog;
import com.tenlionsoft.baselib.utils.ExceptionHandler;
import com.tenlionsoft.baselib.utils.TimeUtils;
import com.tenlionsoft.baselib.utils.UIUtil;
import com.tenlionsoft.baselib.utils.UserLgUtils;
import java.util.ArrayList;
import java.util.List;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 作者: Adam
* 日期: 2021年10月30日16:39:54
* 邮箱: itgaojian@163.com
* 描述: 重点青少年事件录入
*/
@Route(path = PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_ADD)
public class YoungCaseAddActivity extends BaseActivity {
@BindView(R2.id.et_name)
EditText mEtName;
@BindView(R2.id.tv_date)
TextView mTvDate;
@BindView(R2.id.et_desc)
EditText mEtDesc;
@BindView(R2.id.tv_handle_date)
TextView mTvHandleDate;
@BindView(R2.id.et_handle_desc)
EditText mEtHandleDesc;
@BindView(R2.id.btn_add)
Button mBtnAdd;
@BindView(R2.id.rlv_persons)
RecyclerView mRlvPersons;
@BindView(R2.id.btn_submit)
Button mBtnSubmit;
@BindView(R2.id.nsv_content)
NestedScrollView mNsvContent;
@BindView(R2.id.tv_hint)
TextView mTvHint;
private Unbinder mBind;
private String mId;
private YoungCasePersonAdapter mAdapter;
private List<YoungCasePersonBean> mDatas;
@Override
protected int setLayoutId() {
return R.layout.activity_young_case_add;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("重点青少年事件录入");
mId = getIntent().getStringExtra("id");
initViews();
if (TextUtils.isEmpty(mId)) {
//新增
refreshView(STATE_LOAD_SUCCESS);
} else {
//编辑
getDetailData();
}
}
private void getDetailData() {
RetrofitManager.getInstance()
.create(Apis.class)
.getYoungCaseDetailById(mId, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SaveYoungCaseBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull SaveYoungCaseBean saveYoungCaseBean) {
setDataToView(saveYoungCaseBean);
}
@Override
public void onError(@NonNull Throwable e) {
refreshView(STATE_LOAD_ERROR);
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
}
/**
* 回显数据
*/
private void setDataToView(SaveYoungCaseBean bean) {
refreshView(STATE_LOAD_SUCCESS);
mEtName.setText(bean.getEventTitle());
mTvDate.setText(bean.getEventDate());
mEtDesc.setText(bean.getEventDescribe());
mTvHandleDate.setText(bean.getSolveDate());
mEtHandleDesc.setText(bean.getSolveResult());
mDatas = bean.getEventUserList();
mTvHint.setVisibility(View.GONE);
mAdapter.setData(mDatas);
}
/**
* 初始化视图
*/
private void initViews() {
mTvDate.setOnClickListener(v -> onShowDate(1));
mTvHandleDate.setOnClickListener(v -> onShowDate(2));
mBtnAdd.setOnClickListener(v -> showAddPersonDialog());
mDatas = new ArrayList<>();
mAdapter = new YoungCasePersonAdapter(mActivity, mDatas, 1);
mRlvPersons.setLayoutManager(new LinearLayoutManager(mActivity));
mRlvPersons.setAdapter(mAdapter);
//删除相关人员
mAdapter.addOnDelPersonListen((bean, pos) -> {
mDatas.remove(pos);
mAdapter.notifyDataSetChanged();
if (mDatas.size() == 0) {
mTvHint.setVisibility(View.VISIBLE);
}
});
mBtnSubmit.setOnClickListener(v -> doConfirm());
}
/**
* 提交
*/
private void doConfirm() {
if (TextUtils.isEmpty(mId)) {
doSave();
} else {
doEdit();
}
}
/**
* 编辑
*/
private void doEdit() {
if (checkParams()) {
RequestBody body = buildParams();
ProgressDialog dialog = UIUtil.initDialog(mActivity, "修改中...");
dialog.show();
RetrofitManager.getInstance()
.create(Apis.class)
.doEditYoungCase(mId, body, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SuccessBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull SuccessBean successBean) {
dialog.dismiss();
ToastUtils.show("修改成功");
setResult(13);
finish();
}
@Override
public void onError(@NonNull Throwable e) {
dialog.dismiss();
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
}
}
/**
* 提交
*/
private void doSave() {
if (checkParams()) {
RequestBody body = buildParams();
ProgressDialog dialog = UIUtil.initDialog(mActivity, "保存中...");
dialog.show();
RetrofitManager.getInstance()
.create(Apis.class)
.doSaveYoungCase(body, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SuccessBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull SuccessBean successBean) {
dialog.dismiss();
ToastUtils.show("保存成功");
setResult(13);
finish();
}
@Override
public void onError(@NonNull Throwable e) {
dialog.dismiss();
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
}
}
/**
* 校验参数
*/
private boolean checkParams() {
String title = mEtName.getText().toString().trim();
if (TextUtils.isEmpty(title)) {
ToastUtils.show("请输入事件名称");
return false;
}
String date = mTvDate.getText().toString().trim();
if (TextUtils.isEmpty(date)) {
ToastUtils.show("请选择事发日期");
return false;
}
String desc = mEtDesc.getText().toString().trim();
if (TextUtils.isEmpty(desc)) {
ToastUtils.show("请输入事件描述");
return false;
}
if (mDatas.size() <= 0) {
ToastUtils.show("请添加相关人员");
return false;
}
return true;
}
private RequestBody buildParams() {
SaveYoungCaseBean bean = new SaveYoungCaseBean();
String title = mEtName.getText().toString().trim();
String desc = mEtDesc.getText().toString().trim();
String date = mTvDate.getText().toString().trim();
bean.setEventTitle(title);
bean.setEventDate(date);
bean.setEventDescribe(desc);
bean.setEventUserList(mDatas);
String handleDesc = mEtHandleDesc.getText().toString().trim();
String handleDate = mTvHandleDate.getText().toString().trim();
if (!TextUtils.isEmpty(handleDesc)) {
bean.setSolveResult(handleDesc);
}
if (!TextUtils.isEmpty(handleDate)) {
bean.setSolveDate(handleDate);
}
Gson gson = new Gson();
String obj = gson.toJson(bean);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
return requestBody;
}
/**
* 显示添加人员dialog
*/
private void showAddPersonDialog() {
AddPersonDialog dialog = new AddPersonDialog.DialogBuilder(mActivity).build();
dialog.addOnChangeListener((name, idCard, isKey) -> {
dialog.HideSoftKeyBoardDialog(mActivity);
dialog.dismiss();
YoungCasePersonBean bean = new YoungCasePersonBean();
bean.setFullName(name);
bean.setIdCardnumber(idCard);
bean.setUserCategory(isKey);
mDatas.add(bean);
mAdapter.setData(mDatas);
ToastUtils.show("添加成功");
mTvHint.setVisibility(View.GONE);
});
dialog.show();
}
/**
* 日期选择
*/
private void onShowDate(int i) {
hideSoftKeyboard();
TimePickerView mTimePickerView = new TimePickerBuilder(mActivity, (date, v) -> {
if (i == 1) {
//事发时间
mTvDate.setText(TimeUtils.dateToString(date));
} else {
//处理时间
mTvHandleDate.setText(TimeUtils.dateToString(date));
}
})
.setTitleText("请选日期")
.setCancelColor(Color.parseColor("#1189FF"))
.setSubmitColor(Color.parseColor("#1189FF"))
.setType(new boolean[]{true, true, true, false, false, false})
.setTitleColor(Color.parseColor("#1189FF"))
.build();
mTimePickerView.show();
}
}

View File

@ -0,0 +1,188 @@
package com.tengshisoft.gridmodule.incident.activitys.populace;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.widget.Button;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.hjq.toast.ToastUtils;
import com.tengshisoft.commonmodule.adapters.YoungCasePersonAdapter;
import com.tengshisoft.commonmodule.beans.SaveYoungCaseBean;
import com.tengshisoft.commonmodule.beans.SuccessBean;
import com.tengshisoft.commonmodule.nets.Apis;
import com.tengshisoft.gridmodule.R;
import com.tengshisoft.gridmodule.R2;
import com.tenlionsoft.baselib.constant.PathConfig;
import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager;
import com.tenlionsoft.baselib.core.widget.base.BaseActivity;
import com.tenlionsoft.baselib.utils.ExceptionHandler;
import com.tenlionsoft.baselib.utils.UIUtil;
import com.tenlionsoft.baselib.utils.UserLgUtils;
import androidx.annotation.Nullable;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
/**
* 作者: Adam
* 日期: 2021年10月30日17:45:10
* 邮箱: itgaojian@163.com
* 描述: 重点青少年事件详情
*/
@Route(path = PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_DETAIL)
public class YoungCaseDetailActivity extends BaseActivity {
@BindView(R2.id.tv_date)
TextView mTvDate;
@BindView(R2.id.tv_desc)
TextView mTvDesc;
@BindView(R2.id.tv_handle_date)
TextView mTvHandleDate;
@BindView(R2.id.tv_handle_desc)
TextView mTvHandleDesc;
@BindView(R2.id.rlv_persons)
RecyclerView mRlvPersons;
@BindView(R2.id.nsv_content)
NestedScrollView mNsvContent;
@BindView(R2.id.tv_name)
TextView mTvName;
@BindView(R2.id.btn_edit)
Button mBtnEdit;
@BindView(R2.id.btn_del)
Button mBtnDel;
private Unbinder mBind;
private String mId;
@Override
protected int setLayoutId() {
return R.layout.activity_young_case_detail;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mId = getIntent().getStringExtra("id");
mTvBaseTitle.setText("重点青少年事件详情");
mBtnEdit.setOnClickListener(v -> ARouter.getInstance()
.build(PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_ADD)
.withString("id", mId)
.navigation(mActivity, 12));
mBtnDel.setOnClickListener(v -> doDel());
getDetailData();
}
/**
* 删除
*/
private void doDel() {
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setTitle("提示")
.setMessage("确定要删除该事件吗?")
.setPositiveButton("确定", (dialog, which) -> {
dialog.dismiss();
ProgressDialog dialog1 = UIUtil.initDialog(mActivity, "删除中...");
dialog1.show();
RetrofitManager.getInstance()
.create(Apis.class)
.doDelYoungCase(mId, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SuccessBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull SuccessBean successBean) {
dialog1.dismiss();
ToastUtils.show("删除成功");
setResult(13);
finish();
}
@Override
public void onError(@NonNull Throwable e) {
dialog1.dismiss();
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
})
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
.create()
.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 12) {
if (resultCode == 13) {
refreshView(STATE_LOAD_LOADING);
getDetailData();
}
}
}
private void getDetailData() {
RetrofitManager.getInstance()
.create(Apis.class)
.getYoungCaseDetailById(mId, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<SaveYoungCaseBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull SaveYoungCaseBean saveYoungCaseBean) {
setDataToView(saveYoungCaseBean);
}
@Override
public void onError(@NonNull Throwable e) {
refreshView(STATE_LOAD_ERROR);
ExceptionHandler.handleException(e);
}
@Override
public void onComplete() {
}
});
}
/**
* 回显数据
*/
private void setDataToView(SaveYoungCaseBean bean) {
refreshView(STATE_LOAD_SUCCESS);
mTvName.setText(bean.getEventTitle());
mTvDate.setText(bean.getEventDate());
mTvDesc.setText(bean.getEventDescribe());
mTvHandleDate.setText(bean.getSolveDate());
mTvHandleDesc.setText(bean.getSolveResult());
YoungCasePersonAdapter adapter = new YoungCasePersonAdapter(mActivity, bean.getEventUserList(), 2);
mRlvPersons.setLayoutManager(new LinearLayoutManager(mActivity));
mRlvPersons.setAdapter(adapter);
}
}

View File

@ -0,0 +1,270 @@
package com.tengshisoft.gridmodule.incident.activitys.populace;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.core.Observer;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.hjq.toast.ToastUtils;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.tengshisoft.commonmodule.R2;
import com.tengshisoft.commonmodule.adapters.IncidentListAdapter;
import com.tengshisoft.commonmodule.adapters.YoungCaseListAdapter;
import com.tengshisoft.commonmodule.beans.IncidentListBean;
import com.tengshisoft.commonmodule.beans.YoungCaseListBean;
import com.tengshisoft.commonmodule.nets.Apis;
import com.tengshisoft.gridmodule.R;
import com.tenlionsoft.baselib.constant.PathConfig;
import com.tenlionsoft.baselib.core.retrofit_net.RetrofitManager;
import com.tenlionsoft.baselib.core.widget.base.BaseActivity;
import com.tenlionsoft.baselib.utils.ExceptionHandler;
import com.tenlionsoft.baselib.utils.UserLgUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 作者: Adam
* 日期: 2021年10月30日16:22:28
* 邮箱: itgaojian@163.com
* 描述: 重点青少年事件
*/
@Route(path = PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_LIST)
public class YoungCaseListActivity extends BaseActivity {
@BindView(R2.id.et_base_search_content)
EditText mEtBaseSearchContent;
@BindView(R2.id.iv_base_clear)
ImageView mIvBaseClear;
@BindView(R2.id.btn_base_search)
Button mBtnBaseSearch;
@BindView(R2.id.ll_base_search_content)
LinearLayout mLlBaseSearchContent;
@BindView(R2.id.rlv_components)
RecyclerView mRlvComponents;
@BindView(R2.id.srl_content)
SmartRefreshLayout mSrlContent;
@BindView(R2.id.pb_loading)
ProgressBar mPbLoading;
@BindView(R2.id.iv_empty_data)
ImageView mIvEmptyData;
@BindView(R2.id.tv_error_hint)
TextView mTvErrorHint;
private Unbinder mBind;
private List<YoungCaseListBean.RowsBean> mDatas;
private YoungCaseListAdapter mAdapter;
private int mCurrentPage = 1;
private String mKeywords = "";
@Override
protected int setLayoutId() {
return R.layout.activity_young_case_list;
}
@Override
public void initData() {
mBind = ButterKnife.bind(this);
mTvBaseTitle.setText("重点青少年事件");
mEtBaseSearchContent.setHint("请输入要查询的内容");
refreshView(STATE_LOAD_SUCCESS);
mTvPublish.setVisibility(View.VISIBLE);
mTvPublish.setText("录入");
mTvPublish.setOnClickListener(v -> ARouter.getInstance()
.build(PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_ADD)
.navigation(mActivity, 12));
mDatas = new ArrayList<>();
mAdapter = new YoungCaseListAdapter(mActivity, mDatas);
mRlvComponents.setLayoutManager(new LinearLayoutManager(mActivity));
mRlvComponents.setAdapter(mAdapter);
mSrlContent.setOnRefreshListener(v -> doRefresh());
mSrlContent.setOnLoadMoreListener(v -> doLoadMore());
setStateView(13);
getIncidentList(mCurrentPage);
mBtnBaseSearch.setOnClickListener(v -> doSearch());
mIvBaseClear.setOnClickListener(v -> {
mKeywords = "";
mEtBaseSearchContent.setText("");
doRefresh();
});
mAdapter.addOnItemClickListener(v -> ARouter.getInstance()
.build(PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_DETAIL)
.withString("id", v.getEventId())
.navigation(mActivity, 12));
}
/**
* 获取重点青少年事件列表
*/
private void getIncidentList(int currentPage) {
mCurrentPage = currentPage;
RetrofitManager.getInstance()
.create(Apis.class)
.getYoungCaseList(mCurrentPage + "", mKeywords, UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<YoungCaseListBean>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
}
@Override
public void onNext(@NonNull YoungCaseListBean communityListBean) {
if (communityListBean.getRows() != null && communityListBean.getRows().size() > 0) {
++mCurrentPage;
if (currentPage == 1) {
mDatas.clear();
mDatas.addAll(communityListBean.getRows());
} else {
mDatas.addAll(communityListBean.getRows());
}
setStateView(14);
mAdapter.notifyDataSetChanged();
mSrlContent.finishRefresh();
if (mDatas.size() >= communityListBean.getTotal()) {
mSrlContent.finishLoadMore();
mSrlContent.setNoMoreData(true);
} else {
mSrlContent.finishLoadMore();
mSrlContent.setNoMoreData(false);
}
} else {
if (currentPage > 1) {
mSrlContent.finishLoadMore();
mSrlContent.setNoMoreData(true);
setStateView(14);
} else {
if (TextUtils.isEmpty(mKeywords)) {
//无数据
setStateView(15);
} else {
setStateView(15);
ToastUtils.show("未查询到相关内容");
}
}
}
}
@Override
public void onError(@NonNull Throwable e) {
mSrlContent.finishLoadMore();
mSrlContent.finishRefresh();
ExceptionHandler.handleException(e);
setStateView(16);
}
@Override
public void onComplete() {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 12) {
if (resultCode == 13) {
doRefresh();
}
}
}
//加载更多
private void doLoadMore() {
getIncidentList(mCurrentPage);
}
//刷新
private void doRefresh() {
mDatas.clear();
mAdapter.setData(mDatas);
getIncidentList(1);
}
/**
*
*/
private void doSearch() {
String searchContent = mEtBaseSearchContent.getText().toString().trim();
if (!TextUtils.isEmpty(searchContent)) {
hideSoftKeyboard();
setStateView(13);
mKeywords = searchContent;
mCurrentPage = 1;
getIncidentList(mCurrentPage);
} else {
ToastUtils.show("请输入要查询的内容");
}
}
/**
* 根据状态显示
* 12 默认
* 13 搜索中
* 14 搜索完成有数据
* 15 搜索完成没有数据
* 16 搜索失败
*
* @param state
*/
private void setStateView(int state) {
switch (state) {
case 12://默认
case 15:
mPbLoading.setVisibility(View.GONE);
mSrlContent.setVisibility(View.GONE);
mIvEmptyData.setVisibility(View.VISIBLE);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("暂无数据");
break;
case 13://搜索中
mPbLoading.setVisibility(View.VISIBLE);
mSrlContent.setVisibility(View.GONE);
mIvEmptyData.setVisibility(View.GONE);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("加载中...");
break;
case 14://搜索完成有数据
mPbLoading.setVisibility(View.GONE);
mSrlContent.setVisibility(View.VISIBLE);
mIvEmptyData.setVisibility(View.GONE);
mTvErrorHint.setVisibility(View.GONE);
break;
case 16://搜索失败
mPbLoading.setVisibility(View.GONE);
mSrlContent.setVisibility(View.GONE);
mIvEmptyData.setVisibility(View.VISIBLE);
mTvErrorHint.setVisibility(View.VISIBLE);
mTvErrorHint.setText("加载失败,请稍后重试");
break;
}
}
}

View File

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:id="@+id/nsv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="5dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/issue_report_title"
android:padding="8dp"
android:text="基本信息"
android:textStyle="bold" />
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<TextView
style="@style/item_title"
android:text="事件名称" />
<View style="@style/vertical_line" />
<EditText
android:id="@+id/et_name"
style="@style/item_content"
android:layout_gravity="center_vertical"
android:hint="请输入事件名称"
android:inputType="text" />
</LinearLayout>
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<TextView
style="@style/item_title"
android:text="事发时间" />
<View style="@style/vertical_line" />
<TextView
android:id="@+id/tv_date"
style="@style/sel_text_arrow"
android:hint="请选择事发日期" />
</LinearLayout>
<LinearLayout style="@style/item_gray_vertical">
<TextView
style="@style/item_title_vertical"
android:drawableLeft="@drawable/ic_start_hint"
android:text="事件描述" />
<EditText
android:id="@+id/et_desc"
style="@style/item_content_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入事件描述"
android:minLines="3" />
</LinearLayout>
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="invisible" />
<TextView
style="@style/item_title"
android:text="处理时间" />
<View style="@style/vertical_line" />
<TextView
android:id="@+id/tv_handle_date"
style="@style/sel_text_arrow"
android:hint="请选择处理时间" />
</LinearLayout>
<LinearLayout style="@style/item_gray_vertical">
<TextView
style="@style/item_title_vertical"
android:text="处理结果" />
<EditText
android:id="@+id/et_handle_desc"
style="@style/item_content_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入事件处理结果"
android:minLines="3" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardCornerRadius="10dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/issue_report_title"
android:padding="8dp"
android:text="相关人员"
android:textStyle="bold" />
<Button
android:id="@+id/btn_add"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="@drawable/sel_btn_blue_gray_re_5"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="录入"
android:textColor="@color/white" />
</RelativeLayout>
<LinearLayout style="@style/item_gray_vertical">
<ImageView
style="@style/style_hint_star"
android:visibility="visible" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_persons"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="20dp"
android:text="录入相关人员"
android:textColor="@color/black" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<Button
android:id="@+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/sel_btn_submit"
android:text="保存"
android:textColor="@color/white"
android:textSize="18sp" />
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:id="@+id/nsv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardCornerRadius="5dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/issue_report_title"
android:padding="8dp"
android:text="基本信息"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:orientation="horizontal">
<Button
android:id="@+id/btn_edit"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@drawable/sel_btn_blue_gray_re_5"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="编辑"
android:textColor="@color/white" />
<Button
android:id="@+id/btn_del"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@drawable/sel_btn_activity_sign_up"
android:minWidth="0dp"
android:minHeight="0dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="删除"
android:textColor="@color/white" />
</LinearLayout>
</RelativeLayout>
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="gone" />
<TextView
style="@style/item_title"
android:text="事件名称" />
<View style="@style/vertical_line" />
<TextView
android:id="@+id/tv_name"
style="@style/item_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="gone" />
<TextView
style="@style/item_title"
android:text="事发时间" />
<View style="@style/vertical_line" />
<TextView
android:id="@+id/tv_date"
style="@style/item_content" />
</LinearLayout>
<LinearLayout style="@style/item_gray_vertical">
<TextView
style="@style/item_title_vertical"
android:text="事件描述" />
<TextView
android:id="@+id/tv_desc"
style="@style/item_content_ver"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3" />
</LinearLayout>
<LinearLayout style="@style/item_gray">
<ImageView
style="@style/style_hint_star"
android:visibility="gone" />
<TextView
style="@style/item_title"
android:text="处理时间" />
<View style="@style/vertical_line" />
<TextView
android:id="@+id/tv_handle_date"
style="@style/item_content" />
</LinearLayout>
<LinearLayout style="@style/item_gray_vertical">
<TextView
style="@style/item_title_vertical"
android:text="处理结果" />
<TextView
android:id="@+id/tv_handle_desc"
style="@style/item_content_ver"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="3" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardCornerRadius="10dp"
app:cardElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
style="@style/issue_report_title"
android:padding="8dp"
android:text="相关人员"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout style="@style/item_gray_vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_persons"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_bg"
android:orientation="vertical">
<include layout="@layout/item_base_search" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/srl_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_components"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/anim_loading" />
<ImageView
android:id="@+id/iv_empty_data"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:background="@drawable/ic_empty_data" />
<TextView
android:id="@+id/tv_error_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:clickable="true"
android:textColor="@color/black"
tools:text="加载数据失败" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View File

@ -16,6 +16,7 @@ import com.tenlionsoft.baselib.core.widget.base.FunctionNumAdapter;
import com.tenlionsoft.baselib.core.widget.views.CenterFuncDialogView;
import com.tenlionsoft.baselib.core.widget.views.ChooseFuncDialogView;
import org.aspectj.lang.annotation.Around;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONObject;
@ -70,6 +71,7 @@ public class GridMainFragment extends BaseFragment {
"任务管理",
"两新组织",
"邮寄物流地",
"重点青少年事件",
"命案防控",
"重点区域"};
private int[] mBtnIds = new int[]{
@ -87,6 +89,7 @@ public class GridMainFragment extends BaseFragment {
R.drawable.ic_notify_ad,
R.drawable.ic_notify_ad,
R.drawable.ic_notify_ad,
R.drawable.ic_case_dispose,
R.drawable.ic_notify_ad,
R.drawable.ic_notify_ad,
R.drawable.ic_notify_ad};
@ -151,6 +154,11 @@ public class GridMainFragment extends BaseFragment {
*/
private void choosePage(String text) {
switch (text) {
case "重点青少年事件":
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_GRID_ACTIVITY_POPULACE_YOUNG_CASE_LIST)
.navigation();
break;
case "工作轨迹":
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_GRID_ACTIVITY_WORK_LOCUS)