duhongyu 9 月之前
父节点
当前提交
b9ada04a75

+ 2 - 2
hjzx-api/src/main/java/api/controller/call/CallLogController.java

@@ -68,7 +68,7 @@ public class CallLogController extends BaseController {
68 68
         qw.le(!StringHelper.isEmpty(input.getEndTime()) , CallLog::getCreateTime, input.getEndTime());
69 69
         if (isNote.equals("1"))
70 70
         {
71
-            qw.eq(CallLog::getNote,"1");
71
+            qw.eq(CallLog::getNote, 1).or().isNull(CallLog::getNote);
72 72
         }
73 73
 
74 74
 
@@ -195,7 +195,7 @@ public class CallLogController extends BaseController {
195 195
         qw.eq(input.getMyd() != null , CallLog::getMyd, input.getMyd());
196 196
         if (isNote.equals("1"))
197 197
         {
198
-            qw.eq(CallLog::getNote,"1");
198
+            qw.eq(CallLog::getNote, 1).or().isNull(CallLog::getNote);
199 199
         }
200 200
         qw.eq(!StringHelper.isEmpty(input.getWorkordercode()), CallLog::getWorkordercode, input.getWorkordercode());
201 201
         qw.orderByDesc(CallLog::getId);

+ 38 - 11
hjzx-api/src/main/java/api/controller/report/DataAnalysisController.java

@@ -1,28 +1,24 @@
1 1
 package api.controller.report;
2 2
 
3 3
 import api.controller.BaseController;
4
-import api.entity.view.report.ScreenConnection;
5 4
 import api.model.AjaxResult;
6 5
 import api.service.report.IDataAnalysisService;
7 6
 import api.service.report.IReportBaseService;
8 7
 import api.util.annotation.Anonymous;
9 8
 import api.util.annotation.Log;
10 9
 import api.util.enums.BusinessType;
11
-import api.util.helper.SpringHelper;
12 10
 import io.swagger.annotations.Api;
13 11
 import io.swagger.annotations.ApiOperation;
14 12
 import lombok.var;
15 13
 import org.springframework.beans.factory.annotation.Autowired;
16
-import org.springframework.web.bind.annotation.GetMapping;
17
-import org.springframework.web.bind.annotation.PathVariable;
18
-import org.springframework.web.bind.annotation.RequestMapping;
19
-import org.springframework.web.bind.annotation.RestController;
14
+import org.springframework.web.bind.annotation.*;
20 15
 
21 16
 import java.text.ParseException;
22 17
 
23 18
 @Api(value = "大屏",tags = "大屏")
24 19
 @RestController
25 20
 @RequestMapping("/DataAnalysis")
21
+@Anonymous
26 22
 public class DataAnalysisController extends BaseController {
27 23
     @Autowired
28 24
     private IReportBaseService ReportBaseService;
@@ -54,15 +50,33 @@ public class DataAnalysisController extends BaseController {
54 50
     @ApiOperation("话务分布")
55 51
     @Log(title = "话务分布",businessType = BusinessType.QUERY)
56 52
     @GetMapping("/selectRegionOrderCount/{type}")
57
-    public AjaxResult selectRegionOrderCount(@PathVariable long type  )  {
58
-        var obj =DataAnalysisService.selectRegionOrderCount(type);
53
+    public AjaxResult selectRegionOrderCount(@PathVariable long type, Long area )  {
54
+        long level=3;
55
+        if (area==null)
56
+        {
57
+            area=1743L;
58
+        }
59
+        if (area!=1743L)
60
+        {
61
+            level=4;
62
+        }
63
+        var obj =DataAnalysisService.selectRegionOrderCount(type,level,area);
59 64
         return Success("成功",obj);
60 65
     }
61 66
     @ApiOperation("话务分布")
62 67
     @Log(title = "话务分布",businessType = BusinessType.QUERY)
63 68
     @GetMapping("/selectRegionOrder/{type}")
64
-    public AjaxResult selectRegionOrder(@PathVariable long type  )  {
65
-        var obj =DataAnalysisService.selectRegionOrder(type);
69
+    public AjaxResult selectRegionOrder(@PathVariable long type, Long area  )  {
70
+        long level=3;
71
+        if (area==null)
72
+        {
73
+            area=1743L;
74
+        }
75
+        if (area!=1743L)
76
+        {
77
+            level=4;
78
+        }
79
+        var obj =DataAnalysisService.selectRegionOrder(type,level,area);
66 80
         return Success("成功",obj);
67 81
     }
68 82
 
@@ -95,6 +109,19 @@ public class DataAnalysisController extends BaseController {
95 109
         return Success("成功",obj);
96 110
     }
97 111
 
98
-
112
+    @ApiOperation("区域业务类型")
113
+    @Log(title = "区域业务类型",businessType = BusinessType.QUERY)
114
+    @GetMapping("/selectBusinessType/{type}")
115
+    public AjaxResult selectBusinessAreaType(@PathVariable long type, Long area  )  {
116
+        var obj =DataAnalysisService.selectBusinessType(type,area);
117
+        return Success("成功",obj);
118
+    }
119
+    @ApiOperation("区域关键词数量")
120
+    @Log(title = "区域关键词数量",businessType = BusinessType.QUERY)
121
+    @GetMapping("/selectAreaKeywordCount/{type}")
122
+    public AjaxResult selectAreaKeywordCount(@PathVariable long type, Long area )  {
123
+        var obj =DataAnalysisService.selectAreaKeywordCount(type,area);
124
+        return Success("成功",obj);
125
+    }
99 126
 
100 127
 }

+ 1 - 0
hjzx-api/src/main/java/api/controller/report/WorkReportController.java

@@ -28,6 +28,7 @@ import java.util.List;
28 28
 @Api(value = "报表",tags = "报表")
29 29
 @RestController
30 30
 @RequestMapping("/WorkReport")
31
+@Anonymous
31 32
 public class WorkReportController extends BaseController {
32 33
     @Autowired
33 34
     private IReportBaseService ReportBaseService;

+ 1 - 1
hjzx-api/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
6 6
   datasource:
7 7
     type: com.alibaba.druid.pool.DruidDataSource
8 8
     driver-class-name: com.mysql.cj.jdbc.Driver
9
-    url: jdbc:mysql://192.168.1.200:3306/hjzx?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
9
+    url: jdbc:mysql://192.168.1.8:3306/hjzx?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
10 10
     username: root
11 11
     password: 800100
12 12
 

+ 1 - 10
hjzx-entity/src/main/java/api/entity/view/config/GlobalConfig.java

@@ -1,15 +1,6 @@
1 1
 package api.entity.view.config;
2
-
3 2
 import api.util.helper.SpringHelper;
4
-
5
-
6
-
7
-
8
-
9
-
10 3
 public class GlobalConfig {
4
+    /**八院过滤参数**/
11 5
     public  static  final String isNote= SpringHelper.getRequiredProperty("spring.isNote");;
12
-
13
-
14
-
15 6
 }

+ 4 - 3
hjzx-mapper/src/main/java/api/mapper/report/ReportMapper.java

@@ -36,7 +36,7 @@ public interface ReportMapper {
36 36
     public  List<RecordReport> selectRecordReport(ScreenReport Report);
37 37
 
38 38
     /**工单分类表**/
39
-    public  List<CompleteView> selectBusinessType ( );
39
+    public  List<CompleteView> selectBusinessType (String time,Long area );
40 40
     /**工单处理趋势**/
41 41
     public  List<HourReport> selectDealingWithTrends(Date beginTime, Date endTime);
42 42
     /**话务量统计**/
@@ -64,13 +64,14 @@ public interface ReportMapper {
64 64
     public  List<CompleteView> selectAICount ( );
65 65
 
66 66
     /**智能统计**/
67
-    public  List<RegionOrder> selectRegionOrderCount (String time );
67
+    public  List<RegionOrder> selectRegionOrderCount (String time,long type,long area );
68 68
 
69 69
 
70 70
     /**话务简报**/
71 71
     public  TelephoneBriefing selectTelephoneBriefing (String startTime,  String endTime  );
72 72
     /**话务数据**/
73 73
     public  RecordDateView selectTelephoneData (String time  );
74
-
74
+    /**区域关键词数量**/
75
+    public  List<CompleteView> selectAreaKeywordCount (String time ,Long area  );
75 76
 
76 77
 }

+ 47 - 10
hjzx-mapper/src/main/resources/mapper/report/ReportMapper.xml

@@ -246,7 +246,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
246 246
 			AND `callee_agent`= #{usercode}
247 247
 		</if>
248 248
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
249
-			AND note = '1'
249
+			AND IFNULL(note,'1')='1'
250 250
 		</if>
251 251
 
252 252
 		GROUP BY `callee_agent`
@@ -260,6 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
260 260
 		where createtime >= CURDATE() - INTERVAL DAY(CURDATE()) - 1 DAY
261 261
 		AND createtime <![CDATA[<=]]> DATE_ADD(CURDATE() - DAY(CURDATE()) + 1, INTERVAL 1 MONTH)
262 262
 		and isdelete=0
263
+		<if test="time != null and time !='' ">
264
+			and YEAR(create_time) = YEAR(CURRENT_DATE)
265
+			AND ${time}(create_time) = ${time}(CURRENT_DATE)
266
+		</if>
267
+		<if test="area >0  ">
268
+			AND `area`= #{area}
269
+		</if>
263 270
 		group by ancestors)  b on  CONCAT(b.ancestors,',')  LIKE CONCAT('%', a.ancestors,',' '%')
264 271
 		group by Name
265 272
 
@@ -285,7 +292,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
285 292
 		from rep_record
286 293
 		where  DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
287 294
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
288
-			AND note = '1'
295
+			AND IFNULL(note,'1')='1'
289 296
 		</if>
290 297
 		GROUP BY DATE
291 298
 		ORDER BY DATE;
@@ -298,7 +305,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
298 305
 		from rep_record
299 306
 		where  1=1
300 307
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
301
-			AND note = '1'
308
+			AND IFNULL(note,'1')='1'
302 309
 		</if>
303 310
 	</select>
304 311
 	<select id="selectTrafficMeasurement"  parameterType="Date" resultMap="TrafficMeasurementResult">
@@ -310,7 +317,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
310 317
 		from rep_record
311 318
 		WHERE `create_time`>=#{beginTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
312 319
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
313
-			AND note = '1'
320
+			AND IFNULL(note,'1')='1'
314 321
 		</if>
315 322
 	</select>
316 323
 
@@ -322,7 +329,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
322 329
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
323 330
 		and call_type=1
324 331
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
325
-			AND note = '1'
332
+			AND IFNULL(note,'1')='1'
326 333
 		</if>
327 334
 		<if test="isAnswer >-1  ">
328 335
 			AND `is_answer`= #{isAnswer}
@@ -338,7 +345,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
338 345
 		from  rep_record where
339 346
 		DATE_FORMAT(  `create_time`, '%Y-%m' )= DATE_FORMAT( #{time}, '%Y-%m' )
340 347
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
341
-			AND note = '1'
348
+			AND IFNULL(note,'1')='1'
342 349
 		</if>
343 350
 	</select>
344 351
 
@@ -358,7 +365,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
358 365
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
359 366
 		and call_type=1
360 367
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
361
-			AND note = '1'
368
+			AND IFNULL(note,'1')='1'
362 369
 		</if>
363 370
 		group by DATE
364 371
 		order by DATE
@@ -403,7 +410,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
403 410
 		) v2 ON v1.workordercode = v2.workordercode
404 411
 		AND v1.visit_id = v2.visit_id
405 412
 		) lv ON wo.workordercode = lv.workordercode
406
-		where  a.type=3  and a.parent_id=1743
413
+		where 1=1
414
+		 and  a.type=#{type} and a.parent_id=#{area}
407 415
 		GROUP BY a.id ;
408 416
 	</select>
409 417
 	<select id="selectTelephoneData"  parameterType="String" resultMap="RecordDateViewResult">
@@ -434,7 +442,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
434 442
 		from rep_record
435 443
 		where 1=1
436 444
 		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
437
-			AND note = '1'
445
+			AND IFNULL(note,'1')='1'
438 446
 		</if>
439 447
 		<if test="startTime != null and startTime !=''">
440 448
 			AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
@@ -443,6 +451,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
443 451
 			AND UNIX_TIMESTAMP(`create_time`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
444 452
 		</if>
445 453
 	</select>
446
-
454
+	<select id="selectAreaKeywordCount"  parameterType="Long" resultMap="CompleteView">
455
+		SELECT
456
+		keyword_text AS `Name`,
457
+		SUM(keyword_count) AS `number`
458
+		FROM
459
+		wo_workorderbase o
460
+		JOIN
461
+		rep_translate k ON o.call_id = k.callid
462
+		JOIN
463
+		JSON_TABLE(
464
+		k.translate_json,
465
+		'$[*]' COLUMNS (
466
+		keyword_text VARCHAR(255) PATH '$.text',
467
+		keyword_count INT PATH '$.count'
468
+		)
469
+		) AS jt
470
+		WHERE
471
+		<if test="area >0   ">
472
+			o.area = #{area}
473
+		</if>
474
+		<if test="time != null and time !='' ">
475
+			and YEAR(create_time) = YEAR(CURRENT_DATE)
476
+			AND ${time}(create_time) = ${time}(CURRENT_DATE)
477
+		</if>
478
+		GROUP BY
479
+		keyword_text
480
+		ORDER BY
481
+		SUM(keyword_count) DESC
482
+		LIMIT 10;
483
+	</select>
447 484
 
448 485
 </mapper> 

+ 9 - 2
hjzx-service/src/main/java/api/service/report/IDataAnalysisService.java

@@ -1,5 +1,6 @@
1 1
 package api.service.report;
2 2
 
3
+import api.entity.view.report.CompleteView;
3 4
 import api.entity.view.report.HourReport;
4 5
 import api.entity.view.report.RegionOrder;
5 6
 
@@ -13,10 +14,10 @@ public interface IDataAnalysisService {
13 14
     HashMap<String,Object>  selectTrafficMeasurement();
14 15
 
15 16
     //话务分布
16
-    HashMap<String,Object>   selectRegionOrder(Long type);
17
+    HashMap<String,Object>   selectRegionOrder(Long type,long level,long area);
17 18
 
18 19
     //话务分布
19
-    List<RegionOrder>selectRegionOrderCount(Long   type );
20
+    List<RegionOrder>selectRegionOrderCount(Long   type,long level,long area );
20 21
 
21 22
     //智能统计
22 23
     HashMap<String,Object>  selectIntelligent();
@@ -31,4 +32,10 @@ public interface IDataAnalysisService {
31 32
 
32 33
     //满意度统计
33 34
     HashMap<String,Object> selectSatisfaction();
35
+
36
+    //区域业务类型
37
+     List<HashMap<String,Object>>  selectBusinessType(Long type,long area);
38
+
39
+    //区域关键词数量
40
+    List<CompleteView>   selectAreaKeywordCount(Long type, long area);
34 41
 }

+ 65 - 4
hjzx-service/src/main/java/api/service/report/impl/DataAnalysisServiceImpl.java

@@ -57,7 +57,7 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
57 57
     }
58 58
     //话务分布
59 59
     @Override
60
-    public HashMap<String,Object>   selectRegionOrder(Long   type )
60
+    public HashMap<String,Object>   selectRegionOrder(Long   type,long level,long area )
61 61
     {
62 62
         String time="";
63 63
         if (type!=null&&type>0)
@@ -73,14 +73,14 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
73 73
         }
74 74
         HashMap<String,Object> obj=new HashMap<>();
75 75
         obj.put("traffic", reportMapper.selectTelephoneData(time));//话务数据
76
-        obj.put("order", reportMapper.selectRegionOrderCount(time));//工单数据
76
+        obj.put("order", reportMapper.selectRegionOrderCount(time,level,area));//工单数据
77 77
 
78 78
        return obj;
79 79
     }
80 80
 
81 81
     //话务分布
82 82
     @Override
83
-    public List<RegionOrder>selectRegionOrderCount(Long   type )
83
+    public List<RegionOrder>selectRegionOrderCount(Long   type,long level,long area )
84 84
     {
85 85
         String time="";
86 86
         if (type!=null&&type>0)
@@ -94,7 +94,7 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
94 94
                 time="WEEK";
95 95
             }
96 96
         }
97
-        return  reportMapper.selectRegionOrderCount(time);
97
+        return  reportMapper.selectRegionOrderCount(time,level,area);
98 98
     }
99 99
 
100 100
     //智能统计
@@ -335,4 +335,65 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
335 335
         }
336 336
         return obj;
337 337
     }
338
+    //区域业务类型
339
+    @Override
340
+    public List<HashMap<String,Object>>  selectBusinessType(Long types,long area)  {
341
+        String time="";
342
+        if (types!=null&&types>0)
343
+        {
344
+            if (types==1)
345
+            {
346
+                time="MONTH";
347
+            }
348
+            else
349
+            {
350
+                time="WEEK";
351
+            }
352
+        }
353
+        List<HashMap<String,Object>> MapList = new ArrayList<HashMap<String,Object>>();
354
+        List<CompleteView>  BusinessType= reportMapper.selectBusinessType( time,area);
355
+        if (BusinessType!=null)
356
+        {
357
+            long total=BusinessType.stream().filter(x->x.getNumber()!=null).mapToLong(CompleteView::getNumber).sum();
358
+            for (var type : BusinessType) {
359
+                HashMap<String,Object> obj=new LinkedHashMap<>();
360
+                obj.put("name",type.getName());
361
+                if (type.getNumber()==null)
362
+                {
363
+                    type.setNumber(0L);
364
+                }
365
+                obj.put("number",type.getNumber());
366
+                if (total>0)
367
+                {
368
+                    double rate = ( (double)type.getNumber() / total);
369
+                    obj.put("rate",String.format("%.2f",rate*100)+"%");
370
+                }
371
+                else
372
+                {
373
+                    obj.put("rate","0%");
374
+                }
375
+                MapList.add(obj);
376
+            }
377
+        }
378
+        return MapList;
379
+    }
380
+    //区域关键词数量
381
+    @Override
382
+    public  List<CompleteView>   selectAreaKeywordCount(Long type, long area)
383
+    {
384
+        String time="";
385
+        if (type!=null&&type>0)
386
+        {
387
+            if (type==1)
388
+            {
389
+                time="MONTH";
390
+            }
391
+            else
392
+            {
393
+                time="WEEK";
394
+            }
395
+        }
396
+
397
+        return reportMapper.selectAreaKeywordCount(time,area);
398
+    }
338 399
 }

+ 1 - 1
hjzx-service/src/main/java/api/service/report/impl/ReportBaseServiceImpl.java

@@ -76,7 +76,7 @@ public class ReportBaseServiceImpl implements IReportBaseService {
76 76
     public List<HashMap<String,Object>>  selectBusinessType()  {
77 77
 
78 78
         List<HashMap<String,Object>> MapList = new ArrayList<HashMap<String,Object>>();
79
-        List<CompleteView>  BusinessType= reportMapper.selectBusinessType( );
79
+        List<CompleteView>  BusinessType= reportMapper.selectBusinessType("", 0L);
80 80
         if (BusinessType!=null)
81 81
         {
82 82
             long total=BusinessType.stream().filter(x->x.getNumber()!=null).mapToLong(CompleteView::getNumber).sum();