魏熙美 преди 5 години
родител
ревизия
9fc14e775f

+ 6
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java Целия файл

293
      */
293
      */
294
     public static final String AUTHORIZATION_PHONE = "authorization_phone";
294
     public static final String AUTHORIZATION_PHONE = "authorization_phone";
295
 
295
 
296
-
297
     // ------   转化率 end ---------
296
     // ------   转化率 end ---------
298
 
297
 
299
 
298
 
302
     public static final String REGISTERED_TYPE = "registered";
301
     public static final String REGISTERED_TYPE = "registered";
303
 
302
 
304
     // ------- 用户来源 查询条件 end ----------
303
     // ------- 用户来源 查询条件 end ----------
304
+
305
+    // ------- 性别 start -------
306
+    // 据说 1 男 2 女
307
+    public static final Integer SEX_MALE = 1;
308
+    public static final Integer SEX_FEMALE = 2;
309
+    // ------- 性别 start -------
305
 }
310
 }

+ 6
- 3
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java Целия файл

107
 
107
 
108
     /**
108
     /**
109
      * 性别比例
109
      * 性别比例
110
+     *
111
+     *  据说 1 男  2 女
112
+     *
110
      * @param personType
113
      * @param personType
111
      * @return
114
      * @return
112
      */
115
      */
113
-    @Select("select sex, count(1) as sex_count from ta_person where ifnull(person_type, '') != #{personType} GROUP BY sex")
114
-    List<Map<String, Object>> selectSexUser(@Param("personType") String personType);
116
+    @Select("select count(1) as sex_count from ta_person where ifnull(person_type, '') != #{personType} and sex = #{sex}")
117
+    Integer selectSexUser(@Param("personType") String personType, @Param("sex") Integer sex);
115
 
118
 
116
 
119
 
117
     /**
120
     /**
120
      * @return
123
      * @return
121
      */
124
      */
122
     @ResultType(Map.class)
125
     @ResultType(Map.class)
123
-    @Select("select city, count(1) as city_count  from ta_person where ifnull(person_type, '') != #{personType} GROUP BY city")
126
+    @Select("select city, count(1) as city_count  from ta_person where ifnull(person_type, '') != #{personType} and city is not null GROUP BY city")
124
     List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
127
     List<Map<String, Object>> selectCityUser(@Param("personType") String personType);
125
 
128
 
126
 
129
 

+ 13
- 5
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java Целия файл

15
 
15
 
16
 import java.time.LocalDate;
16
 import java.time.LocalDate;
17
 import java.time.LocalDateTime;
17
 import java.time.LocalDateTime;
18
-import java.util.Date;
19
-import java.util.HashMap;
20
-import java.util.List;
21
-import java.util.Map;
18
+import java.util.*;
22
 
19
 
23
 /**
20
 /**
24
  * 数据统计
21
  * 数据统计
70
         List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
67
         List<Map<String, Object>> selectNewsUserCount = taPersonMapper.selectNewsUserCount(CommConstant.PERSON_REALTY_CONSULTANT, null, null);
71
 
68
 
72
         // 性别比例
69
         // 性别比例
73
-        List<Map<String, Object>> selectSexUser = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT);
70
+        // 1 男 2 女
71
+        Integer selectSexMale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_MALE);
72
+        Integer selectSexFemale = taPersonMapper.selectSexUser(CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.SEX_FEMALE);
73
+        Map<String, Object> selectSexMaleMap = new HashMap<>();
74
+        selectSexMaleMap.put("name", "男");
75
+        selectSexMaleMap.put("value", selectSexMale);
76
+        Map<String, Object> selectSexFemaleMap = new HashMap<>();
77
+        selectSexFemaleMap.put("name", "女");
78
+        selectSexFemaleMap.put("value", selectSexFemale);
79
+        List<Map<String, Object>> selectSexUser = new ArrayList<>();
80
+        selectSexUser.add(selectSexMaleMap);
81
+        selectSexUser.add(selectSexFemaleMap);
74
 
82
 
75
         // 城市比例
83
         // 城市比例
76
         List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);
84
         List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);