调整数据接口
This commit is contained in:
parent
547ee3b33b
commit
340f82c834
|
@ -29,12 +29,14 @@ import com.police.policedatasystem.databinding.FragmentApplyBinding;
|
||||||
import com.police.policedatasystem.indexActivity;
|
import com.police.policedatasystem.indexActivity;
|
||||||
import com.police.policedatasystem.util.UiUtils;
|
import com.police.policedatasystem.util.UiUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ApplyFragment extends Fragment {
|
public class ApplyFragment extends Fragment {
|
||||||
private FragmentApplyBinding binding;
|
private FragmentApplyBinding binding;
|
||||||
private ApplyViewModel viewModel;
|
private ApplyViewModel viewModel;
|
||||||
|
public List<ApplyDept> applyDept;
|
||||||
|
public List<ApplyPerson> applyPeople;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +54,8 @@ public class ApplyFragment extends Fragment {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
viewModel.getApplyType();
|
viewModel.getApplyType();
|
||||||
|
viewModel.getApplyDept();
|
||||||
|
viewModel.getApplyPerson();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPopupWindow(List<ApplyType> applyTypes) {
|
public void setPopupWindow(List<ApplyType> applyTypes) {
|
||||||
|
@ -92,19 +96,21 @@ public class ApplyFragment extends Fragment {
|
||||||
popupWindow.showAsDropDown(binding.typeGroup);
|
popupWindow.showAsDropDown(binding.typeGroup);
|
||||||
});
|
});
|
||||||
binding.includeApply.tvQueryName.setOnClickListener(view -> {
|
binding.includeApply.tvQueryName.setOnClickListener(view -> {
|
||||||
|
setPopupWindow2(applyDept);
|
||||||
});
|
});
|
||||||
binding.includeApply.tvQueryOrg.setOnClickListener(view -> {
|
binding.includeApply.tvQueryOrg.setOnClickListener(view -> {
|
||||||
|
setPopupWindow3(applyPeople);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPopupWindow2(List<ApplyDept> applyDept) {
|
public void setPopupWindow2(List<ApplyDept> applyDept) {
|
||||||
|
List<String> names = applyDept.stream().map(ApplyDept::getName).collect(Collectors.toList());
|
||||||
|
showDialog(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPopupWindow3(List<ApplyPerson> applyPeople) {
|
public void setPopupWindow3(List<ApplyPerson> applyPeople) {
|
||||||
|
List<String> names = applyPeople.stream().map(ApplyPerson::getUserName).collect(Collectors.toList());
|
||||||
|
showDialog(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadingShow() {
|
public void loadingShow() {
|
||||||
|
@ -119,14 +125,13 @@ public class ApplyFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialog() {
|
public void showDialog(List<String> items) {
|
||||||
if (getContext() == null) return;
|
if (getContext() == null) return;
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||||
DialogSelectorBinding selectorBinding = DialogSelectorBinding.inflate(getLayoutInflater());
|
DialogSelectorBinding selectorBinding = DialogSelectorBinding.inflate(getLayoutInflater());
|
||||||
View dialogView = selectorBinding.getRoot();
|
View dialogView = selectorBinding.getRoot();
|
||||||
RecyclerView recyclerView = selectorBinding.rcv;
|
RecyclerView recyclerView = selectorBinding.rcv;
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
List<String> items = Arrays.asList("Item 1", "Item 2", "Item 3", "Item 4");
|
|
||||||
BaseQuickAdapter<String, BaseViewHolder> adapter = new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_dialog_selector, items) {
|
BaseQuickAdapter<String, BaseViewHolder> adapter = new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_dialog_selector, items) {
|
||||||
@Override
|
@Override
|
||||||
protected void convert(@NonNull BaseViewHolder baseViewHolder, String s) {
|
protected void convert(@NonNull BaseViewHolder baseViewHolder, String s) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.police.policedatasystem.apply.fragment.ApplyFragment;
|
import com.police.policedatasystem.apply.fragment.ApplyFragment;
|
||||||
import com.police.policedatasystem.apply.model.ApplyDept;
|
import com.police.policedatasystem.apply.model.ApplyDept;
|
||||||
|
import com.police.policedatasystem.apply.model.ApplyPerson;
|
||||||
import com.police.policedatasystem.apply.model.ApplyType;
|
import com.police.policedatasystem.apply.model.ApplyType;
|
||||||
import com.police.policedatasystem.http.CustomCallBack;
|
import com.police.policedatasystem.http.CustomCallBack;
|
||||||
import com.police.policedatasystem.indexActivity;
|
import com.police.policedatasystem.indexActivity;
|
||||||
|
@ -53,14 +54,15 @@ public class ApplyViewModel {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ApplyDept> value) {
|
public void onSuccess(List<ApplyDept> value) {
|
||||||
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
||||||
fragment.setPopupWindow2(value);
|
fragment.applyDept = value;
|
||||||
fragment.loadingNone();
|
fragment.loadingNone();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getApplyPerson() {
|
public void getApplyPerson() {
|
||||||
fragment.loadingShow();
|
fragment.loadingShow();
|
||||||
activity.requestClient.getApplyDept(new CustomCallBack<List<ApplyDept>>() {
|
activity.requestClient.getApplyPerson(new CustomCallBack<List<ApplyPerson>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Call call, @NonNull Exception e) {
|
public void onError(@NonNull Call call, @NonNull Exception e) {
|
||||||
UiUtils.toast(e.getMessage());
|
UiUtils.toast(e.getMessage());
|
||||||
|
@ -68,9 +70,9 @@ public class ApplyViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ApplyDept> value) {
|
public void onSuccess(List<ApplyPerson> value) {
|
||||||
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
||||||
fragment.setPopupWindow2(value);
|
fragment.applyPeople = value;
|
||||||
fragment.loadingNone();
|
fragment.loadingNone();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -189,30 +189,33 @@ public class BaseRequestClient {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String responseBody = response.body().string();
|
String responseBody = response.body().string();
|
||||||
|
// if (urlKey.equals(Constants.APPLY_TYPE_ID)){
|
||||||
|
// responseBody = "{\n" +
|
||||||
|
// "\"code\":\"200\",\n" +
|
||||||
|
// "\"data\":{\n" +
|
||||||
|
// "\"dataList\":[\n" +
|
||||||
|
// "{\n" +
|
||||||
|
// "\"fieldValues\":[\n" +
|
||||||
|
// "{\n" +
|
||||||
|
// "\"field\":\"outjson\",\n" +
|
||||||
|
// "\"value\":\"[{\\\"dictLabel\\\":\\\"管控重点人\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"1\\\"},{\\\"dictLabel\\\":\\\"核验信息\\\",\\\"dictSort\\\":3,\\\"dictValue\\\":\\\"3\\\"},{\\\"dictLabel\\\":\\\"追踪逃犯\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"6\\\"},{\\\"dictLabel\\\":\\\"处置警情\\\",\\\"dictSort\\\":0,\\\"dictValue\\\":\\\"0\\\"},{\\\"dictLabel\\\":\\\"核查线索\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"2\\\"},{\\\"dictLabel\\\":\\\"其他\\\",\\\"dictSort\\\":5,\\\"dictValue\\\":\\\"5\\\"},{\\\"dictLabel\\\":\\\"处置案情\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"7\\\"}]\"\n" +
|
||||||
|
// "}\n" +
|
||||||
|
// "]\n" +
|
||||||
|
// "}\n" +
|
||||||
|
// "],\n" +
|
||||||
|
// "\"page\":{\n" +
|
||||||
|
// "\"total\":7,\n" +
|
||||||
|
// "\"pageNo\":10,\n" +
|
||||||
|
// "\"pageSize\":1\n" +
|
||||||
|
// "}\n" +
|
||||||
|
// "},\n" +
|
||||||
|
// "\"messageId\":\"788a1cc4-2009-4744-ba66-7503ca37b0f2\",\n" +
|
||||||
|
// "\"message\":\"ok\",\n" +
|
||||||
|
// "\"version\":\"1.0\"\n" +
|
||||||
|
// "}";
|
||||||
|
// }
|
||||||
if (urlKey.equals(Constants.APPLY_TYPE_ID)){
|
if (urlKey.equals(Constants.APPLY_TYPE_ID)){
|
||||||
responseBody = "{\n" +
|
responseBody="[{\"checked\":false,\"id\":\"220000000000\",\"name\":\"吉林省公安厅\",\"nocheck\":false,\"open\":false,\"pId\":\"0\",\"title\":\"吉林省公安厅\"},{\"checked\":false,\"id\":\"220100000000\",\"name\":\"吉林省长春市公安局\",\"nocheck\":false,\"open\":false,\"pId\":\"220000000000\",\"title\":\"吉林省长春市公安局\"},{\"checked\":false,\"id\":\"220197000000\",\"name\":\"吉林省长春市公安局经济技术开发区分局\",\"nocheck\":false,\"open\":false,\"pId\":\"220100000000\",\"title\":\"吉林省长春市公安局经济技术开发区分局\"},{\"checked\":false,\"id\":\"220197170000\",\"name\":\"吉林省长春市公安局经济技术开发区分局花园路派出所\",\"nocheck\":false,\"open\":false,\"pId\":\"220197000000\",\"title\":\"吉林省长春市公安局经济技术开发区分局花园路派出所\"}]";
|
||||||
"\"code\":\"200\",\n" +
|
|
||||||
"\"data\":{\n" +
|
|
||||||
"\"dataList\":[\n" +
|
|
||||||
"{\n" +
|
|
||||||
"\"fieldValues\":[\n" +
|
|
||||||
"{\n" +
|
|
||||||
"\"field\":\"outjson\",\n" +
|
|
||||||
"\"value\":\"[{\\\"dictLabel\\\":\\\"管控重点人\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"1\\\"},{\\\"dictLabel\\\":\\\"核验信息\\\",\\\"dictSort\\\":3,\\\"dictValue\\\":\\\"3\\\"},{\\\"dictLabel\\\":\\\"追踪逃犯\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"6\\\"},{\\\"dictLabel\\\":\\\"处置警情\\\",\\\"dictSort\\\":0,\\\"dictValue\\\":\\\"0\\\"},{\\\"dictLabel\\\":\\\"核查线索\\\",\\\"dictSort\\\":2,\\\"dictValue\\\":\\\"2\\\"},{\\\"dictLabel\\\":\\\"其他\\\",\\\"dictSort\\\":5,\\\"dictValue\\\":\\\"5\\\"},{\\\"dictLabel\\\":\\\"处置案情\\\",\\\"dictSort\\\":1,\\\"dictValue\\\":\\\"7\\\"}]\"\n" +
|
|
||||||
"}\n" +
|
|
||||||
"]\n" +
|
|
||||||
"}\n" +
|
|
||||||
"],\n" +
|
|
||||||
"\"page\":{\n" +
|
|
||||||
"\"total\":7,\n" +
|
|
||||||
"\"pageNo\":10,\n" +
|
|
||||||
"\"pageSize\":1\n" +
|
|
||||||
"}\n" +
|
|
||||||
"},\n" +
|
|
||||||
"\"messageId\":\"788a1cc4-2009-4744-ba66-7503ca37b0f2\",\n" +
|
|
||||||
"\"message\":\"ok\",\n" +
|
|
||||||
"\"version\":\"1.0\"\n" +
|
|
||||||
"}";
|
|
||||||
}
|
}
|
||||||
ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class);
|
ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class);
|
||||||
if (!"200".equals(responseParams.getCode())) {
|
if (!"200".equals(responseParams.getCode())) {
|
||||||
|
|
Loading…
Reference in New Issue