调整数据接口
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.util.UiUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ApplyFragment extends Fragment {
|
||||
private FragmentApplyBinding binding;
|
||||
private ApplyViewModel viewModel;
|
||||
public List<ApplyDept> applyDept;
|
||||
public List<ApplyPerson> applyPeople;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -52,6 +54,8 @@ public class ApplyFragment extends Fragment {
|
|||
public void onStart() {
|
||||
super.onStart();
|
||||
viewModel.getApplyType();
|
||||
viewModel.getApplyDept();
|
||||
viewModel.getApplyPerson();
|
||||
}
|
||||
|
||||
public void setPopupWindow(List<ApplyType> applyTypes) {
|
||||
|
@ -92,19 +96,21 @@ public class ApplyFragment extends Fragment {
|
|||
popupWindow.showAsDropDown(binding.typeGroup);
|
||||
});
|
||||
binding.includeApply.tvQueryName.setOnClickListener(view -> {
|
||||
|
||||
setPopupWindow2(applyDept);
|
||||
});
|
||||
binding.includeApply.tvQueryOrg.setOnClickListener(view -> {
|
||||
|
||||
setPopupWindow3(applyPeople);
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
List<String> names = applyPeople.stream().map(ApplyPerson::getUserName).collect(Collectors.toList());
|
||||
showDialog(names);
|
||||
}
|
||||
|
||||
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;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
DialogSelectorBinding selectorBinding = DialogSelectorBinding.inflate(getLayoutInflater());
|
||||
View dialogView = selectorBinding.getRoot();
|
||||
RecyclerView recyclerView = selectorBinding.rcv;
|
||||
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) {
|
||||
@Override
|
||||
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.model.ApplyDept;
|
||||
import com.police.policedatasystem.apply.model.ApplyPerson;
|
||||
import com.police.policedatasystem.apply.model.ApplyType;
|
||||
import com.police.policedatasystem.http.CustomCallBack;
|
||||
import com.police.policedatasystem.indexActivity;
|
||||
|
@ -53,14 +54,15 @@ public class ApplyViewModel {
|
|||
@Override
|
||||
public void onSuccess(List<ApplyDept> value) {
|
||||
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
||||
fragment.setPopupWindow2(value);
|
||||
fragment.applyDept = value;
|
||||
fragment.loadingNone();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getApplyPerson() {
|
||||
fragment.loadingShow();
|
||||
activity.requestClient.getApplyDept(new CustomCallBack<List<ApplyDept>>() {
|
||||
activity.requestClient.getApplyPerson(new CustomCallBack<List<ApplyPerson>>() {
|
||||
@Override
|
||||
public void onError(@NonNull Call call, @NonNull Exception e) {
|
||||
UiUtils.toast(e.getMessage());
|
||||
|
@ -68,9 +70,9 @@ public class ApplyViewModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ApplyDept> value) {
|
||||
public void onSuccess(List<ApplyPerson> value) {
|
||||
// value.sort(Comparator.comparing(ApplyDept::getDictSort));
|
||||
fragment.setPopupWindow2(value);
|
||||
fragment.applyPeople = value;
|
||||
fragment.loadingNone();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -189,30 +189,33 @@ public class BaseRequestClient {
|
|||
return;
|
||||
}
|
||||
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)){
|
||||
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" +
|
||||
"}";
|
||||
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\":\"吉林省长春市公安局经济技术开发区分局花园路派出所\"}]";
|
||||
}
|
||||
ResponseParams responseParams = new Gson().fromJson(responseBody, ResponseParams.class);
|
||||
if (!"200".equals(responseParams.getCode())) {
|
||||
|
|
Loading…
Reference in New Issue