|
@@ -13,6 +13,7 @@ import com.tofly.latte_core.utils.NetworkUtil;
|
|
|
import com.tofly.yxpc.BuildConfig;
|
|
|
import com.tofly.yxpc.base.MyApp;
|
|
|
import com.tofly.yxpc.databinding.FragmentIndexBinding;
|
|
|
+import com.tofly.yxpc.entity.OperationWaterEntity;
|
|
|
import com.tofly.yxpc.entity.SmBhTaskBean;
|
|
|
import com.tofly.yxpc.entity.TwdhEntity;
|
|
|
import com.tofly.yxpc.entity.WaterMeterEntity;
|
|
@@ -48,6 +49,8 @@ public class IndexFragment extends LatteDelegate {
|
|
|
private OnClickListener listener = null;
|
|
|
private String smbh = null;
|
|
|
private boolean isScanStart = false;
|
|
|
+ private List<OperationWaterEntity> operationWaterEntityList = null;
|
|
|
+ private int page = 0;
|
|
|
|
|
|
|
|
|
public IndexFragment(OnClickListener listener) {
|
|
@@ -143,6 +146,19 @@ public class IndexFragment extends LatteDelegate {
|
|
|
taskAdapter.setNewData(list);
|
|
|
});
|
|
|
}).start();
|
|
|
+
|
|
|
+ operationWaterEntityList = DaoUtilsStore.getInstance().getOperationEntityDbUtils().queryAll();
|
|
|
+ if (!operationWaterEntityList.isEmpty()) {
|
|
|
+ page = 0;
|
|
|
+ updateOperation();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateOperation() {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("inspectId", operationWaterEntityList.get(page).getId());
|
|
|
+ map.put("commitType", operationWaterEntityList.get(page).getCommitType());
|
|
|
+ mPresenter.getResultFive(requireContext(), map);
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
@@ -264,7 +280,22 @@ public class IndexFragment extends LatteDelegate {
|
|
|
if (!waterMeterEntities.isEmpty() && waterMeterEntities.get(0) != null) {
|
|
|
if (!TextUtils.isEmpty(binding.etSearch.getText())) {
|
|
|
waterMeterEntities.get(0).setCheckUser(AccountManager.getUserRealName());
|
|
|
- DialogUtils.YhInfoDialog(requireContext(), false, waterMeterEntities.get(0), yhbh -> {
|
|
|
+ String type;
|
|
|
+ switch (waterMeterEntities.get(0).getState()) {
|
|
|
+ case 0:
|
|
|
+ type = "未稽查";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ type = "草稿";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ type = "本地保存";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ type = "已提交";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ DialogUtils.YhInfoDialog(requireContext(), false, waterMeterEntities.get(0), type, yhbh -> {
|
|
|
Intent intent = new Intent(requireContext(), TaskDetailActivity.class);
|
|
|
intent.putExtra("Id", waterMeterEntities.get(0).getId());
|
|
|
intent.putExtra("type", waterMeterEntities.get(0).getTaskState());
|
|
@@ -402,29 +433,17 @@ public class IndexFragment extends LatteDelegate {
|
|
|
}
|
|
|
});
|
|
|
} else if ("31002".equals(baseResponse.getCode())) {
|
|
|
- if (!TextUtils.isEmpty(binding.etSearch.getText())) {
|
|
|
- DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, yhbh -> {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表未下发核查任务,是否添加到您的临时任务中?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- });
|
|
|
- } else {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表未下发核查任务,是否添加到您的临时任务中?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- }
|
|
|
+ DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, smBhTaskBean == null ? "" : smBhTaskBean.getCommitType(), yhbh ->
|
|
|
+ DialogUtils.showDialog(requireContext(), "提示", "该水表未下发核查任务,是否添加到您的临时任务中?", false, (dialog, which) ->
|
|
|
+ download(baseResponse.getCode())));
|
|
|
} else if ("31003".equals(baseResponse.getCode())) {
|
|
|
- if (!TextUtils.isEmpty(binding.etSearch.getText())) {
|
|
|
- DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, yhbh -> {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表已下发给" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "核查,是否要转派到您的临时任务中?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- });
|
|
|
- } else {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表已下发给" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "核查,是否要转派到您的临时任务中?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- }
|
|
|
+ DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, smBhTaskBean == null ? "" : smBhTaskBean.getCommitType(), yhbh ->
|
|
|
+ DialogUtils.showDialog(requireContext(), "提示", "该水表已下发给" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "核查,是否要转派到您的临时任务中?", false, (dialog, which) ->
|
|
|
+ download(baseResponse.getCode())));
|
|
|
} else if ("31004".equals(baseResponse.getCode())) {
|
|
|
- if (!TextUtils.isEmpty(binding.etSearch.getText())) {
|
|
|
- DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, yhbh -> {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "已核查完毕,是否要继续核查?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- });
|
|
|
- } else {
|
|
|
- DialogUtils.showDialog(requireContext(), "提示", "该水表" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "已核查完毕,是否要继续核查?", false, (dialog, which) -> download(baseResponse.getCode()));
|
|
|
- }
|
|
|
+ DialogUtils.YhInfoDialog(requireContext(), false, waterMeter, smBhTaskBean == null ? "" : smBhTaskBean.getCommitType(), yhbh ->
|
|
|
+ DialogUtils.showDialog(requireContext(), "提示", "该水表" + (smBhTaskBean == null ? "" : smBhTaskBean.getInspect_user_name()) + "已核查完毕,是否要继续核查?", false, (dialog, which) ->
|
|
|
+ download(baseResponse.getCode())));
|
|
|
} else {
|
|
|
onMessage(baseResponse.getMessage());
|
|
|
}
|
|
@@ -442,4 +461,16 @@ public class IndexFragment extends LatteDelegate {
|
|
|
mPresenter.getResultOne(requireContext(), map);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public <T> void getResultFive(T response) {
|
|
|
+ super.getResultFive(response);
|
|
|
+ if (response != null) {
|
|
|
+ DaoUtilsStore.getInstance().getOperationEntityDbUtils().delete(operationWaterEntityList.get(page));
|
|
|
+ }
|
|
|
+ if (page < operationWaterEntityList.size()) {
|
|
|
+ page++;
|
|
|
+ updateOperation();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|