魏熙美 5 vuotta sitten
vanhempi
commit
9fc14e775f

+ 6
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java Näytä tiedosto

@@ -293,7 +293,6 @@ public class CommConstant {
293 293
      */
294 294
     public static final String AUTHORIZATION_PHONE = "authorization_phone";
295 295
 
296
-
297 296
     // ------   转化率 end ---------
298 297
 
299 298
 
@@ -302,4 +301,10 @@ public class CommConstant {
302 301
     public static final String REGISTERED_TYPE = "registered";
303 302
 
304 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 Näytä tiedosto

@@ -107,11 +107,14 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
107 107
 
108 108
     /**
109 109
      * 性别比例
110
+     *
111
+     *  据说 1 男  2 女
112
+     *
110 113
      * @param personType
111 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,7 +123,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
120 123
      * @return
121 124
      */
122 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 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 Näytä tiedosto

@@ -15,10 +15,7 @@ import org.springframework.stereotype.Service;
15 15
 
16 16
 import java.time.LocalDate;
17 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,7 +67,18 @@ public class StatisticalServiceImpl implements IStatisticalService {
70 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 84
         List<Map<String, Object>> selectCityUser = taPersonMapper.selectCityUser(CommConstant.PERSON_REALTY_CONSULTANT);