riku
2025-10-17 fbae5f3ea74727ccadc48314a864a1ea0099a945
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
//package cn.flightfeather.thirdapp.module.inspectioninfo;
//
//import android.content.Context;
//import android.content.Intent;
//import android.os.Build;
//import android.os.Bundle;
//import android.support.annotation.Nullable;
//import android.support.annotation.RequiresApi;
//import android.support.v4.app.Fragment;
//import android.support.v7.widget.GridLayoutManager;
//import android.support.v7.widget.LinearLayoutManager;
//import android.support.v7.widget.RecyclerView;
//import android.view.Gravity;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.TextView;
//
//import com.ping.greendao.gen.DomainitemDao;
//import com.ping.greendao.gen.ScenseDao;
//
//import java.io.Serializable;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Objects;
//
//import butterknife.BindView;
//import butterknife.ButterKnife;
//import butterknife.Unbinder;
//import cn.flightfeather.thirdapp.CommonApplication;
//import cn.flightfeather.thirdapp.R;
//import cn.flightfeather.thirdapp.adapter.AllRecyclerViewAdapter;
//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;
//import cn.flightfeather.thirdapp.util.Domain;
//import retrofit2.Call;
//import retrofit2.Callback;
//import retrofit2.Response;
//
///**
// * 2019.1.22
// * @author riku
// *  监管情况界面,展示用户(工地、码头等)本月的问题分布情况
// */
//public class InspectionInfoFragment_B extends Fragment implements Serializable{
//
//    private final static String TITLE = "问题";
//    private static final long serialVersionUID = 6072583863506447855L;
//
//    private CommonApplication application;
//
//    //场景类型
//    private String sceneType = Constant.SCENE_TYPE_SITE;
//
//    private Unbinder unbinder;
//
//    public InspectionInfoFragment_B() {
//        // Required empty public constructor
//    }
//
//    public static InspectionInfoFragment_B newInstance() {
//        InspectionInfoFragment_B fragment = new InspectionInfoFragment_B();
////        Bundle args = new Bundle();
////        fragment.setArguments(args);
//        return fragment;
//    }
//
//    @Override
//    public void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//    }
//
//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                             Bundle savedInstanceState) {
//        // Inflate the layout for this fragment
//        View view = inflater.inflate(R.layout.fragment_inspection_info, container, false);
//        this.unbinder = ButterKnife.bind(this, view);
//        return view;
//    }
//
//    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
//    @Override
//    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//        super.onViewCreated(view, savedInstanceState);
//        this.application = (CommonApplication) getActivity().getApplication();
//        initToolBar();
//        initData();
//        initView(this.sceneType);
//        Date now = new Date();
//        String date = DateFormatter.dateTimeFormat3.format(now);
//        refresh(application.getCurrentUser().getDguid(), date);//对于客户来说,D_GUID就是场景id
//    }
//
//    @Override
//    public void onAttach(Context context) {
//        super.onAttach(context);
//    }
//
//    @Override
//    public void onDetach() {
//        super.onDetach();
//    }
//
//    @Override
//    public void onDestroy() {
//        super.onDestroy();
//        if (this.unbinder != null) {
//            this.unbinder.unbind();
//        }
//    }
//
//    @BindView(R.id.action_bar)
//    View action_bar;
//
//    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
//    private void initToolBar() {
////        action_bar.setElevation(0);
////        action_bar.setBackgroundColor(Color.alpha(0));
//        action_bar.findViewById(R.id.spinner_topclass_task).setVisibility(View.GONE);
//        action_bar.findViewById(R.id.img_left).setVisibility(View.GONE);
//        action_bar.findViewById(R.id.img_right).setVisibility(View.INVISIBLE);
//        action_bar.findViewById(R.id.ll_menu_text).setVisibility(View.GONE);
//        TextView title = action_bar.findViewById(R.id.actionbar_title);
//        title.setText(TITLE);
//        title.setGravity(Gravity.CENTER_HORIZONTAL);
//    }
//
//    @BindView(R.id.text_total) TextView text_total;
//    @BindView(R.id.text_changed) TextView text_changed;
//    @BindView(R.id.text_unchanged) TextView text_unchanged;
//    private int total_problems;//总问题数
//    private int changed_problems;//已整改问题数
//
//    private void refreshStatisticBar() {
//        text_total.setText(String.valueOf(total_problems));
//        text_changed.setText(String.valueOf(changed_problems));
//        text_unchanged.setText(String.valueOf(total_problems-changed_problems));
//    }
//
//    private ArrayList<ProblemCategoryVo> problemCategories = new ArrayList<>();//列表中展示的数据,按问题类型分类
//    private ProblemRepository problemRepository = new ProblemRepository();
//    private DomainitemDao domainitemDao;
//    private ScenseDao scenseDao;
//
//    private void initData() {
//
//        //region 查询当前“企业”用户的场景类型
//        String sceneGuid = this.application.getCurrentUser().getDguid();//登录用户为“企业”时,该变量表示场景guid
//        this.scenseDao = this.application.getDaoSession().getScenseDao();
//        List<Scense> scenses = scenseDao.queryBuilder()
//                .where(
//                        ScenseDao.Properties.Guid.eq(
//                                sceneGuid
//                        )
//                )
//                .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
//
////        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);
////        }
//
//    }
//
//    //问题按分类进行个数统计
//    @BindView(R.id.rv_problem_type) RecyclerView rv_problem_type;
//    AllRecyclerViewAdapter<ProblemCategoryVo> adapter;
//
//    private void initView(final String sceneType) {
//        adapter = new AllRecyclerViewAdapter<ProblemCategoryVo>(this.problemCategories, R.layout.item_problem_category, getActivity()) {
//            @Override
//            public void bindView(MyViewHolder holder, final ProblemCategoryVo obj, boolean isSelected, int position) {
//                holder.setImageResource(R.id.image_problem_category, CommonUtils.getIconByProblemType(sceneType, obj.getProblemTypeId()))
//                        .setText(R.id.text_problem_category, obj.getProblemTypeName())
//                        .setText(R.id.text_rectified_problem, String.valueOf(obj.getIsRectifiedCount()))
//                        .setText(R.id.text_total_problem, String.valueOf(obj.getTotalCount()));
//                if (obj.getTotalCount() > 0) {
//                    holder.setItemSelected(true)
//                            .setOnItemClickListener(new View.OnClickListener() {
//                                @Override
//                                public void onClick(View v) {
//                                    Intent intent = new Intent(getActivity(), ProblemChangeActivity.class);
//                                    intent.putExtra(ProblemChangeActivity.ARG_PROBLEM, obj.getProblemlistVos());
//                                    intent.putExtra(ProblemChangeActivity.ARG_TOTAL_PROBLEM, problemCategories);
//                                    startActivity(intent);
//                                }
//                            });
//                }
//            }
//        };
//        GridLayoutManager gl = new GridLayoutManager(getActivity(), 3);
//        gl.setOrientation(LinearLayoutManager.VERTICAL);
//        rv_problem_type.setLayoutManager(gl);
//        rv_problem_type.setAdapter(adapter);
//    }
//
//    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>>() {
//            @Override
//            public void onResponse(Call<List<ProblemlistVo>> call, Response<List<ProblemlistVo>> response) {
//                if (response.body() != null) {
//                    updateData(response.body());
//                    adapter.notifyDataSetChanged();
//                    refreshStatisticBar();
//                }
//            }
//
//            @Override
//            public void onFailure(Call<List<ProblemlistVo>> call, Throwable t) {
//
//            }
//        });
//    }
//
//    private void updateData(List<ProblemlistVo> problemlistVos) {
//        this.total_problems = 0;
//        this.changed_problems = 0;
//        for (ProblemCategoryVo p : this.problemCategories) {
//            p.setTotalCount(0);
//            p.setIsRectifiedCount(0);
//            p.getProblemlistVos().clear();
//            for (int i = 0; i < problemlistVos.size(); i++) {
//                ProblemlistVo problemlistVo = problemlistVos.get(i);
//                if (problemlistVo.getTypeid()!=null && p.getProblemTypeId().equals(problemlistVo.getTypeid().toString())) {
//                    p.getProblemlistVos().add(problemlistVo);
//                    //总问题数累加
//                    p.setTotalCount(p.getTotalCount() + 1 );
//                    this.total_problems++;
//                    //已整改问题数累加
//                    if (problemlistVo.getIschanged() && Objects.equals(problemlistVo.getExtension3(), Domain.CHANGE_CHECK_PASS)) {
//                        p.setIsRectifiedCount(p.getIsRectifiedCount() + 1);
//                        this.changed_problems++;
//                    }
//
//                    problemlistVos.remove(i);
//                    i--;
//                }
//            }
//        }
//        //问题列表不为空则表示有异常的问题(可能问题类型不存在或为空), 都归类为"其他"类型
//        if (!problemlistVos.isEmpty()) {
//            ProblemCategoryVo problemCategoryVo = this.problemCategories.get(this.problemCategories.size() - 1);//得到“其他”这个问题类型(查询时已排序)
//            problemCategoryVo.getProblemlistVos().addAll(problemlistVos);
//            //总问题数累加
//            problemCategoryVo.setTotalCount(problemCategoryVo.getTotalCount() + problemlistVos.size());
//            this.total_problems += problemlistVos.size();
//
//            for (ProblemlistVo p : problemlistVos) {
//                //补充问题类型id和类型名称为"其他"类型
//                try {
//                    p.setTypeid(Byte.valueOf(problemCategoryVo.getProblemTypeId()));
//                } catch (NumberFormatException e) {
//                    e.printStackTrace();
//                }
//                p.setTypename(problemCategoryVo.getProblemTypeName());
//                if (p.getIschanged()) {
//                    //已整改问题数累加
//                    problemCategoryVo.setIsRectifiedCount(problemCategoryVo.getIsRectifiedCount() + 1);
//                    this.changed_problems++;
//                }
//            }
//        }
//    }
//
//    public void updateData() {
//        Date now = new Date();
//        String date = DateFormatter.dateTimeFormat3.format(now);
//        refresh(application.getCurrentUser().getDguid(), date);//对于客户来说,D_GUID就是场景id
//    }
//
//}