From e27f54aa7e10836e2741dc590559e1039fbade78 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 23 七月 2021 15:06:41 +0800
Subject: [PATCH] 1. 创建子任务时,执行用户默认为当前登录用户或执行组中的第一人 2. 修复部分企业类型问题图标错误 3. 新增场景账户自动生成功能

---
 app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java |   95 ++++++++++++++++++++++++++++-------------------
 1 files changed, 56 insertions(+), 39 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java b/app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java
index 623d75b..9eb2275 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/inspectioninfo/InspectionInfoFragment.java
@@ -31,11 +31,13 @@
 import cn.flightfeather.thirdapp.CommonApplication;
 import cn.flightfeather.thirdapp.R;
 import cn.flightfeather.thirdapp.adapter.AllRecyclerViewAdapter;
-import cn.flightfeather.thirdapp.bean.entity.Domainitem;
+import cn.flightfeather.thirdapp.bean.entity.Problemtype;
 import cn.flightfeather.thirdapp.bean.entity.Scense;
 import cn.flightfeather.thirdapp.bean.vo.ProblemCategoryVo;
 import cn.flightfeather.thirdapp.bean.vo.ProblemlistVo;
+import cn.flightfeather.thirdapp.common.net.ResultCallBack;
 import cn.flightfeather.thirdapp.httpservice.ProblemListService;
+import cn.flightfeather.thirdapp.repository.ProblemRepository;
 import cn.flightfeather.thirdapp.util.CommonUtils;
 import cn.flightfeather.thirdapp.util.Constant;
 import cn.flightfeather.thirdapp.util.DateFormatter;
@@ -51,8 +53,6 @@
  */
 public class InspectionInfoFragment extends Fragment implements Serializable{
 
-    //<editor-fold desc="鍏ㄥ眬鍙橀噺">
-
     private final static String TITLE = "闂";
     private static final long serialVersionUID = 6072583863506447855L;
 
@@ -62,9 +62,7 @@
     private String sceneType = Constant.SCENE_TYPE_SITE;
 
     private Unbinder unbinder;
-    //</editor-fold>
 
-    //<editor-fold desc="鏋勯�犲嚱鏁�">
     public InspectionInfoFragment() {
         // Required empty public constructor
     }
@@ -75,9 +73,7 @@
 //        fragment.setArguments(args);
         return fragment;
     }
-    //</editor-fold>
 
-    //<editor-fold desc="鐢熷懡鍛ㄦ湡">
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -123,9 +119,6 @@
         }
     }
 
-    //</editor-fold>
-
-    //<editor-fold desc="鏍囬鏍�">
     @BindView(R.id.action_bar)
     View action_bar;
 
@@ -142,9 +135,6 @@
         title.setGravity(Gravity.CENTER_HORIZONTAL);
     }
 
-    //</editor-fold>
-
-    //<editor-fold desc="缁熻淇℃伅鏍�">
     @BindView(R.id.text_total) TextView text_total;
     @BindView(R.id.text_changed) TextView text_changed;
     @BindView(R.id.text_unchanged) TextView text_unchanged;
@@ -156,10 +146,9 @@
         text_changed.setText(String.valueOf(changed_problems));
         text_unchanged.setText(String.valueOf(total_problems-changed_problems));
     }
-    //</editor-fold>
 
-    //<editor-fold desc="鍒濆鍖栧垪琛ㄦ暟鎹�">
     private ArrayList<ProblemCategoryVo> problemCategories = new ArrayList<>();//鍒楄〃涓睍绀虹殑鏁版嵁锛屾寜闂绫诲瀷鍒嗙被
+    private ProblemRepository problemRepository = new ProblemRepository();
     private DomainitemDao domainitemDao;
     private ScenseDao scenseDao;
 
@@ -177,31 +166,64 @@
                 .limit(1).list();
         if (scenses != null && !scenses.isEmpty()) {
             this.sceneType = String.valueOf(scenses.get(0).getTypeid());
+            Scense s = scenses.get(0);
+
+            //鏌ヨ褰撳墠鍦烘櫙绫诲瀷涓嬬殑闂绫诲瀷鍊煎煙
+            byte b = 1;
+            problemRepository.getProblemType(b, s.getCitycode(), s.getDistrictcode(), s.getTypeid(), new ResultCallBack<ArrayList<Problemtype>>() {
+                @Override
+                public void onCacheSuccess(@Nullable ArrayList<Problemtype> result) {
+
+                }
+
+                @Override
+                public void onSuccess(@Nullable ArrayList<Problemtype> result) {
+                    if (result != null) {
+                        List<String> types = new ArrayList<>();
+                        for (int i = 0; i < result.size(); i++) {
+                            Problemtype d = result.get(i);
+                            if (!types.contains(d.getTypeid().toString())) {
+                                types.add(d.getTypeid().toString());
+                                ProblemCategoryVo p = new ProblemCategoryVo();
+                                p.setProblemTypeId(d.getTypeid().toString());
+                                p.setProblemTypeName(d.getTypename());
+                                problemCategories.add(p);
+                            }
+                        }
+                    }
+                }
+
+                @Override
+                public void onPage(int current, int total) {
+
+                }
+
+                @Override
+                public void onFailure() {
+
+                }
+            });
         }
         //endregion
 
-        //region 鏌ヨ褰撳墠鍦烘櫙绫诲瀷涓嬬殑闂绫诲瀷鍊煎煙
-        this.domainitemDao = this.application.getDaoSession().getDomainitemDao();
-        List<Domainitem> domainitems = domainitemDao.queryBuilder()
-                .where(
-                        DomainitemDao.Properties.Dcguid.eq(
-                                CommonUtils.getProblemTypeGUID(this.sceneType)
-                        )
-                )
-                .orderAsc(DomainitemDao.Properties.Index).list();
-        for (Domainitem d :
-                domainitems) {
-            ProblemCategoryVo p = new ProblemCategoryVo();
-            p.setProblemTypeId(d.getValue());
-            p.setProblemTypeName(d.getText());
-            this.problemCategories.add(p);
-        }
-        //endregion
+//        this.domainitemDao = this.application.getDaoSession().getDomainitemDao();
+//        List<Domainitem> domainitems = domainitemDao.queryBuilder()
+//                .where(
+//                        DomainitemDao.Properties.Dcguid.eq(
+//                                CommonUtils.getProblemTypeGUID(this.sceneType)
+//                        )
+//                )
+//                .orderAsc(DomainitemDao.Properties.Index).list();
+//        for (Domainitem d :
+//                domainitems) {
+//            ProblemCategoryVo p = new ProblemCategoryVo();
+//            p.setProblemTypeId(d.getValue());
+//            p.setProblemTypeName(d.getText());
+//            this.problemCategories.add(p);
+//        }
 
     }
-    //</editor-fold>
 
-    //<editor-fold desc="initView">
     //闂鎸夊垎绫昏繘琛屼釜鏁扮粺璁�
     @BindView(R.id.rv_problem_type) RecyclerView rv_problem_type;
     AllRecyclerViewAdapter<ProblemCategoryVo> adapter;
@@ -233,9 +255,7 @@
         rv_problem_type.setLayoutManager(gl);
         rv_problem_type.setAdapter(adapter);
     }
-    //</editor-fold>
 
-    //<editor-fold desc="鑱旂綉鍒锋柊">
     private void refresh(String sceneId, String date) {
         Call<List<ProblemlistVo>> getProblemByScene = this.application.getRetrofit().create(ProblemListService.class).getProblemByScene(sceneId, date);
         getProblemByScene.enqueue(new Callback<List<ProblemlistVo>>() {
@@ -304,14 +324,11 @@
             }
         }
     }
-    //</editor-fold>
 
-    //<editor-fold desc="鐢ㄦ埛鎻愪氦鏁存敼鍥剧墖瀹屾垚鍚庯紝鍦ㄥ唴瀛樹腑鏇存柊鏁版嵁">
     public void updateData() {
         Date now = new Date();
         String date = DateFormatter.dateTimeFormat3.format(now);
         refresh(application.getCurrentUser().getDguid(), date);//瀵逛簬瀹㈡埛鏉ヨ锛孌_GUID灏辨槸鍦烘櫙id
     }
-    //</editor-fold>
 
 }

--
Gitblit v1.9.3