Browse Source

Merge branch 'bayuan' into bayuan-feat

duhongyu 11 months ago
parent
commit
9d8ecc3c7d

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

@@ -11,6 +11,7 @@ import api.service.call.ITranslateService;
11 11
 import api.service.system.IConfigService;
12 12
 import api.util.annotation.Anonymous;
13 13
 import api.util.helper.ExcelHelper;
14
+import api.util.helper.SpringHelper;
14 15
 import com.alibaba.fastjson2.JSON;
15 16
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
16 17
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -48,7 +49,8 @@ public class CallLogController extends BaseController {
48 49
     private ITranslateService translateService;
49 50
     @Autowired
50 51
     private UserMapper userMapper;
51
-
52
+    @Autowired
53
+    public  static  final String isNote= SpringHelper.getRequiredProperty("spring.isNote");;
52 54
     @ApiOperation("列表")
53 55
     @Log(title = "查询通话记录表列表",businessType = BusinessType.QUERY)
54 56
     @GetMapping
@@ -64,6 +66,10 @@ public class CallLogController extends BaseController {
64 66
         qw.eq(input.getCallType() != null && input.getCallType() > 0, CallLog::getCallType, input.getCallType());
65 67
         qw.ge(!StringHelper.isEmpty(input.getStartTime()) , CallLog::getCreateTime, input.getStartTime());
66 68
         qw.le(!StringHelper.isEmpty(input.getEndTime()) , CallLog::getCreateTime, input.getEndTime());
69
+        if (isNote.equals("1"))
70
+        {
71
+            qw.eq(CallLog::getNote, 1).or().isNull(CallLog::getNote);
72
+        }
67 73
 
68 74
 
69 75
 //        qw.le(input.getHangupTime() != null, CallLog::getCreateTime, input.getHangupTime());
@@ -187,6 +193,10 @@ public class CallLogController extends BaseController {
187 193
         qw.eq(input.getIsAnswer() != null , CallLog::getIsAnswer, input.getIsAnswer());
188 194
         qw.eq(input.getOpType() != null , CallLog::getOpType, input.getOpType());
189 195
         qw.eq(input.getMyd() != null , CallLog::getMyd, input.getMyd());
196
+        if (isNote.equals("1"))
197
+        {
198
+            qw.eq(CallLog::getNote, 1).or().isNull(CallLog::getNote);
199
+        }
190 200
         qw.eq(!StringHelper.isEmpty(input.getWorkordercode()), CallLog::getWorkordercode, input.getWorkordercode());
191 201
         qw.orderByDesc(CallLog::getId);
192 202
         var list=calllogService.getList(qw);

+ 1 - 1
hjzx-api/src/main/java/api/controller/order/WorkOrderBaseController.java

@@ -126,7 +126,7 @@ public class WorkOrderBaseController extends BaseController {
126 126
 
127 127
         qw.eq(!StringHelper.isEmpty(input.getCustomerno()), WorkOrderBase::getCustomerno, input.getCustomerno());
128 128
 
129
-
129
+        qw.eq(!StringHelper.isEmpty(input.getCreateuser()), WorkOrderBase::getCreateuser, input.getCreateuser());
130 130
         qw.eq(WorkOrderBase::getIsdelete, 0);
131 131
 
132 132
         //ge("age", 18)表示查询年龄大于等于18的记录。

+ 51 - 7
hjzx-api/src/main/java/api/controller/report/DataAnalysisController.java

@@ -1,7 +1,6 @@
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;
@@ -12,16 +11,14 @@ import io.swagger.annotations.Api;
12 11
 import io.swagger.annotations.ApiOperation;
13 12
 import lombok.var;
14 13
 import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.GetMapping;
16
-import org.springframework.web.bind.annotation.PathVariable;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RestController;
14
+import org.springframework.web.bind.annotation.*;
19 15
 
20 16
 import java.text.ParseException;
21 17
 
22 18
 @Api(value = "大屏",tags = "大屏")
23 19
 @RestController
24 20
 @RequestMapping("/DataAnalysis")
21
+@Anonymous
25 22
 public class DataAnalysisController extends BaseController {
26 23
     @Autowired
27 24
     private IReportBaseService ReportBaseService;
@@ -53,8 +50,33 @@ public class DataAnalysisController extends BaseController {
53 50
     @ApiOperation("话务分布")
54 51
     @Log(title = "话务分布",businessType = BusinessType.QUERY)
55 52
     @GetMapping("/selectRegionOrderCount/{type}")
56
-    public AjaxResult selectRegionOrderCount(@PathVariable long type  )  {
57
-        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);
64
+        return Success("成功",obj);
65
+    }
66
+    @ApiOperation("话务分布")
67
+    @Log(title = "话务分布",businessType = BusinessType.QUERY)
68
+    @GetMapping("/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);
58 80
         return Success("成功",obj);
59 81
     }
60 82
 
@@ -79,5 +101,27 @@ public class DataAnalysisController extends BaseController {
79 101
         var obj =DataAnalysisService.select24TrafficTrends();
80 102
         return Success("成功",obj);
81 103
     }
104
+    @ApiOperation("话务趋势(周)")
105
+    @Log(title = "话务趋势(周)",businessType = BusinessType.QUERY)
106
+    @GetMapping("/selectWeekTrafficTrends")
107
+    public AjaxResult selectWeekTrafficTrends()  {
108
+        var obj =DataAnalysisService.selectWeekTrafficTrends();
109
+        return Success("成功",obj);
110
+    }
111
+
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
+    }
82 126
 
83 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;

+ 34 - 42
hjzx-api/src/main/java/api/controller/system/UserController.java

@@ -46,6 +46,7 @@ public class UserController extends BaseController {
46 46
 
47 47
     @Autowired
48 48
     private IAddressBookService addressBookService;
49
+
49 50
     @ApiOperation("列表")
50 51
     @Log(title = "查询用户信息表列表", businessType = BusinessType.QUERY)
51 52
     @GetMapping
@@ -54,21 +55,19 @@ public class UserController extends BaseController {
54 55
         LambdaQueryWrapper<User> qw = new LambdaQueryWrapper();
55 56
 
56 57
         qw.eq(input.getUserId() != null && input.getUserId() > 0, User::getUserId, input.getUserId());
57
-       // qw.eq(input.getDeptId() != null && input.getDeptId() > 0, User::getDeptId, input.getDeptId());
58
-        if (input.getDeptId() != null &&input.getDeptId()>0)
59
-        {
58
+        // qw.eq(input.getDeptId() != null && input.getDeptId() > 0, User::getDeptId, input.getDeptId());
59
+        if (input.getDeptId() != null && input.getDeptId() > 0) {
60 60
             //查询下级部门所有人员
61
-            qw.and(wq->{
61
+            qw.and(wq -> {
62 62
                 wq.inSql(User::getDeptId, "select dept_id from sys_dept where  " +
63
-                        " ancestors REGEXP CONCAT((select  ancestors from sys_dept where dept_id="+input.getDeptId()+"),',',"
64
-                        +input.getDeptId()+") ") ;
65
-                wq.or().eq(User::getDeptId,input.getDeptId());
63
+                        " ancestors REGEXP CONCAT((select  ancestors from sys_dept where dept_id=" + input.getDeptId() + "),',',"
64
+                        + input.getDeptId() + ") ");
65
+                wq.or().eq(User::getDeptId, input.getDeptId());
66 66
             });
67 67
         }
68 68
         //查询角色
69
-        if (input.getRoleId()!=null&&input.getRoleId()>0)
70
-        {
71
-            qw.inSql(User::getUserId, "select user_id from sys_user_role where role_id="+input.getRoleId());
69
+        if (input.getRoleId() != null && input.getRoleId() > 0) {
70
+            qw.inSql(User::getUserId, "select user_id from sys_user_role where role_id=" + input.getRoleId());
72 71
         }
73 72
         qw.like(!StringHelper.isEmpty(input.getUserName()), User::getUserName, input.getUserName());
74 73
         qw.like(!StringHelper.isEmpty(input.getNickName()), User::getNickName, input.getNickName());
@@ -86,7 +85,6 @@ public class UserController extends BaseController {
86 85
             IPage<User> iPage = userService.selectUserDeptList(page, qw);
87 86
 
88 87
 
89
-
90 88
             return Success("成功", iPage.getRecords(), iPage.getTotal());
91 89
         } else {
92 90
             return Success("成功", userService.selectUserDeptList(qw));
@@ -131,17 +129,15 @@ public class UserController extends BaseController {
131 129
         if (result) {
132 130
 
133 131
             //根据电话,判断通讯录中是否存在,不存在新增一条记录
134
-            LambdaQueryWrapper<AddressBook> lqwaddress=new LambdaQueryWrapper<>();
135
-            lqwaddress.eq(AddressBook::getMobile,user.getPhonenumber());
132
+            LambdaQueryWrapper<AddressBook> lqwaddress = new LambdaQueryWrapper<>();
133
+            lqwaddress.eq(AddressBook::getMobile, user.getPhonenumber());
136 134
 
137
-            List<AddressBook> addressBooks= addressBookService.getList(lqwaddress);
135
+            List<AddressBook> addressBooks = addressBookService.getList(lqwaddress);
138 136
 
139
-            if(addressBooks!=null &&addressBooks.stream().count()>0)
140
-            {
137
+            if (addressBooks != null && addressBooks.stream().count() > 0) {
141 138
 
142
-            }
143
-            else {
144
-                AddressBook addressBook=new AddressBook();
139
+            } else {
140
+                AddressBook addressBook = new AddressBook();
145 141
                 addressBook.setMobile(user.getPhonenumber());
146 142
                 addressBook.setName(user.getNickName());
147 143
                 addressBook.setType(2L);
@@ -172,7 +168,7 @@ public class UserController extends BaseController {
172 168
             return Error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
173 169
         }
174 170
         User use = userService.selectUserById(user.getUserId());
175
-        if (use==null)
171
+        if (use == null)
176 172
             return Error("用户不存在");
177 173
         user.setPassword(use.getPassword());
178 174
         user.setCreateBy(CurrentUser().getUserName());
@@ -180,20 +176,18 @@ public class UserController extends BaseController {
180 176
         boolean result = userService.update(user);
181 177
         if (result) {
182 178
             //根据电话,判断通讯录中是否存在,不存在新增一条记录
183
-            LambdaQueryWrapper<AddressBook> lqwaddress=new LambdaQueryWrapper<>();
184
-            lqwaddress.eq(AddressBook::getMobile,user.getPhonenumber());
179
+            LambdaQueryWrapper<AddressBook> lqwaddress = new LambdaQueryWrapper<>();
180
+            lqwaddress.eq(AddressBook::getMobile, user.getPhonenumber());
185 181
 
186
-            List<AddressBook> addressBooks= addressBookService.getList(lqwaddress);
182
+            List<AddressBook> addressBooks = addressBookService.getList(lqwaddress);
187 183
 
188
-            if(addressBooks!=null &&addressBooks.stream().count()>0)
189
-            {
190
-                AddressBook addr= addressBooks.stream().findFirst().get();
184
+            if (addressBooks != null && addressBooks.stream().count() > 0) {
185
+                AddressBook addr = addressBooks.stream().findFirst().get();
191 186
                 addr.setName(user.getNickName());
192 187
                 addressBookService.update(addr);
193 188
 
194
-            }
195
-            else {
196
-                AddressBook addressBook=new AddressBook();
189
+            } else {
190
+                AddressBook addressBook = new AddressBook();
197 191
                 addressBook.setMobile(user.getPhonenumber());
198 192
                 addressBook.setName(user.getNickName());
199 193
                 addressBook.setType(2L);
@@ -238,7 +232,7 @@ public class UserController extends BaseController {
238 232
     public AjaxResult resetPwd(@RequestBody User user) {
239 233
         //校验用户操作
240 234
         //校验用户权限
241
-     //   userService.checkUserAllowed(user);
235
+        //   userService.checkUserAllowed(user);
242 236
         //userService.checkUserDataScope(user);
243 237
 
244 238
         LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
@@ -260,19 +254,19 @@ public class UserController extends BaseController {
260 254
         }
261 255
         return Error("修改失败!");
262 256
     }
257
+
263 258
     /**
264 259
      * 修改密码
265 260
      */
266 261
     @ApiOperation("修改密码")
267 262
     @Log(title = "修改密码", businessType = BusinessType.OTHER)
268 263
     @PutMapping("/UpdatePwd")
269
-    public AjaxResult UpdatePwd(String oldPwd ,String Pwd) {
270
-        UserView currentUser=CurrentUser();
271
-        if (!currentUser.getPassword().equals(SecretHelper.MD5(oldPwd)))
272
-        {
264
+    public AjaxResult UpdatePwd(String oldPwd, String Pwd) {
265
+        UserView currentUser = CurrentUser();
266
+        if (!currentUser.getPassword().equals(SecretHelper.MD5(oldPwd))) {
273 267
             return Error("旧密码不正确");
274 268
         }
275
-        var  entity=userService.getEntity(currentUser.getUserId());
269
+        var entity = userService.getEntity(currentUser.getUserId());
276 270
         String password = SecretHelper.MD5(Pwd);
277 271
         entity.setPassword(password);
278 272
         if (userService.update(entity)) {
@@ -287,15 +281,16 @@ public class UserController extends BaseController {
287 281
     @ApiOperation("修改图像")
288 282
     @Log(title = "修改图像", businessType = BusinessType.OTHER)
289 283
     @GetMapping("/avatar")
290
-    public AjaxResult avatar( String url) {
291
-       UserView currentUser=CurrentUser();
292
-        var  entity=userService.getEntity(currentUser.getUserId());
284
+    public AjaxResult avatar(String url) {
285
+        UserView currentUser = CurrentUser();
286
+        var entity = userService.getEntity(currentUser.getUserId());
293 287
         entity.setAvatar(url);
294 288
         if (userService.update(entity)) {
295 289
             return Success("修改成功!");
296 290
         }
297 291
         return Error("修改失败!");
298 292
     }
293
+
299 294
     /**
300 295
      * 修改状态
301 296
      *
@@ -335,7 +330,6 @@ public class UserController extends BaseController {
335 330
     }
336 331
 
337 332
 
338
-
339 333
     @GetMapping("/deptUserTree")
340 334
     @Anonymous
341 335
     public AjaxResult deptUserTree(Dept dept) {
@@ -343,11 +337,8 @@ public class UserController extends BaseController {
343 337
     }
344 338
 
345 339
 
346
-
347
-
348 340
     /**
349 341
      * 导出excel
350
-     *
351 342
      */
352 343
     @ApiOperation("导出Excel")
353 344
     @Log(title = "导出excel", businessType = BusinessType.EXPORT)
@@ -444,6 +435,7 @@ public class UserController extends BaseController {
444 435
 
445 436
     /**
446 437
      * 分配角色
438
+     *
447 439
      * @param userId
448 440
      * @return
449 441
      */

+ 4 - 2
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
 
@@ -71,4 +71,6 @@ spring:
71 71
     port: 9200
72 72
     auth: false
73 73
     username:
74
-    password:
74
+    password:
75
+
76
+  isNote: 1

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

@@ -71,4 +71,6 @@ spring:
71 71
     port: 9200
72 72
     auth: false
73 73
     username:
74
-    password:
74
+    password:
75
+
76
+  isNote: 1

+ 6 - 0
hjzx-entity/src/main/java/api/entity/view/config/GlobalConfig.java

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

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

@@ -1,13 +1,18 @@
1 1
 package api.mapper.report;
2 2
 
3 3
 import api.entity.view.report.*;
4
+import api.util.helper.SpringHelper;
5
+
4 6
 import org.apache.ibatis.annotations.Mapper;
5 7
 
8
+
6 9
 import java.util.Date;
7 10
 import java.util.List;
8 11
 
9 12
 @Mapper
10 13
 public interface ReportMapper {
14
+
15
+
11 16
     /**
12 17
      *
13 18
      *
@@ -27,36 +32,46 @@ public interface ReportMapper {
27 32
     /**工单分类报表**/
28 33
     public  List<WorkOrderTypeReport> selectWorkOrderTypeReport(ScreenReport Report);
29 34
     /**话务工作报表**/
35
+
30 36
     public  List<RecordReport> selectRecordReport(ScreenReport Report);
37
+
31 38
     /**工单分类表**/
32
-    public  List<CompleteView> selectBusinessType ( );
39
+    public  List<CompleteView> selectBusinessType (String time,Long area );
33 40
     /**工单处理趋势**/
34 41
     public  List<HourReport> selectDealingWithTrends(Date beginTime, Date endTime);
35 42
     /**话务量统计**/
43
+
36 44
     public  List<TrafficView> selectTraffic();
37 45
     /**话务量统计**/
46
+
38 47
     public SatisfactionView selectSatisfaction();
39 48
     /**话务量统计**/
49
+
40 50
     public  TrafficMeasurement selectTrafficMeasurement(Date beginTime, Date endTime);
41 51
     /**话务量统计**/
52
+
42 53
     public  List<HourReport> selectConnection(ScreenConnection Report);
43 54
     /**话务统计**/
55
+
44 56
     public RecordDateView selectRecord(String time);
45 57
     /**回访数量**/
46 58
     public  long selectVisitCount(String time);
47 59
     /**话务趋势**/
60
+
48 61
     public  List<TrafficView> selectCallTrends(ScreenConnection Report);
49 62
 
50 63
     /**智能统计**/
51 64
     public  List<CompleteView> selectAICount ( );
52 65
 
53 66
     /**智能统计**/
54
-    public  List<RegionOrder> selectRegionOrderCount (String time );
67
+    public  List<RegionOrder> selectRegionOrderCount (String time,long type,long area );
55 68
 
56 69
 
57 70
     /**话务简报**/
58 71
     public  TelephoneBriefing selectTelephoneBriefing (String startTime,  String endTime  );
59
-
60
-
72
+    /**话务数据**/
73
+    public  RecordDateView selectTelephoneData (String time  );
74
+    /**区域关键词数量**/
75
+    public  List<CompleteView> selectAreaKeywordCount (String time ,Long area  );
61 76
 
62 77
 }

+ 77 - 6
hjzx-mapper/src/main/resources/mapper/report/ReportMapper.xml

@@ -245,6 +245,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
245 245
 		<if test="usercode != null and usercode != ''">
246 246
 			AND `callee_agent`= #{usercode}
247 247
 		</if>
248
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
249
+			AND IFNULL(note,'1')='1'
250
+		</if>
251
+
248 252
 		GROUP BY `callee_agent`
249 253
 	</select>
250 254
 
@@ -256,6 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
256 260
 		where createtime >= CURDATE() - INTERVAL DAY(CURDATE()) - 1 DAY
257 261
 		AND createtime <![CDATA[<=]]> DATE_ADD(CURDATE() - DAY(CURDATE()) + 1, INTERVAL 1 MONTH)
258 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>
259 270
 		group by ancestors)  b on  CONCAT(b.ancestors,',')  LIKE CONCAT('%', a.ancestors,',' '%')
260 271
 		group by Name
261 272
 
@@ -280,16 +291,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
280 291
 		count(call_type=1 and is_answer=0 or null  )  noAnswer
281 292
 		from rep_record
282 293
 		where  DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
294
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
295
+			AND IFNULL(note,'1')='1'
296
+		</if>
283 297
 		GROUP BY DATE
284 298
 		ORDER BY DATE;
285 299
 	</select>
286 300
 	<select id="selectSatisfaction"  parameterType="Date" resultMap="SatisfactionViewResult">
287 301
 		select
288
-		count(myd=2 or null  )  basically,
289
-		count(myd=1 and is_answer=1 or null  )  satisfied,
290
-		count(myd=3 and is_answer=1 or null  )  dissatisfied
302
+		count(myd=2  or null  )  basically,
303
+		count(myd=1  or null  )  satisfied,
304
+		count(myd=3  or null  )  dissatisfied
291 305
 		from rep_record
292
-		where  DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
306
+		where  1=1
307
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
308
+			AND IFNULL(note,'1')='1'
309
+		</if>
293 310
 	</select>
294 311
 	<select id="selectTrafficMeasurement"  parameterType="Date" resultMap="TrafficMeasurementResult">
295 312
 		select
@@ -299,6 +316,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
299 316
 		AVG(TIMESTAMPDIFF(SECOND, answer_time, hangup_time) and is_answer=1  AND call_type=1  ) avgAnswer
300 317
 		from rep_record
301 318
 		WHERE `create_time`>=#{beginTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
319
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
320
+			AND IFNULL(note,'1')='1'
321
+		</if>
302 322
 	</select>
303 323
 
304 324
 	<select id="selectConnection"  parameterType="api.entity.view.report.ScreenConnection" resultMap="SysReportHourResult">
@@ -308,6 +328,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
308 328
 		from rep_record
309 329
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
310 330
 		and call_type=1
331
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
332
+			AND IFNULL(note,'1')='1'
333
+		</if>
311 334
 		<if test="isAnswer >-1  ">
312 335
 			AND `is_answer`= #{isAnswer}
313 336
 		</if>
@@ -321,6 +344,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
321 344
 		COUNT(1) total
322 345
 		from  rep_record where
323 346
 		DATE_FORMAT(  `create_time`, '%Y-%m' )= DATE_FORMAT( #{time}, '%Y-%m' )
347
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
348
+			AND IFNULL(note,'1')='1'
349
+		</if>
324 350
 	</select>
325 351
 
326 352
 	<select id="selectVisitCount"  parameterType="String" resultType="long">
@@ -338,6 +364,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
338 364
 		from rep_record
339 365
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
340 366
 		and call_type=1
367
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
368
+			AND IFNULL(note,'1')='1'
369
+		</if>
341 370
 		group by DATE
342 371
 		order by DATE
343 372
 	</select>
@@ -381,9 +410,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
381 410
 		) v2 ON v1.workordercode = v2.workordercode
382 411
 		AND v1.visit_id = v2.visit_id
383 412
 		) lv ON wo.workordercode = lv.workordercode
384
-		where  a.type=3  and a.parent_id=1743
413
+		where 1=1
414
+		 and  a.type=#{type} and a.parent_id=#{area}
385 415
 		GROUP BY a.id ;
386 416
 	</select>
417
+	<select id="selectTelephoneData"  parameterType="String" resultMap="RecordDateViewResult">
418
+		select count(1) total,
419
+		count(note=1 or null )	incoming,		count(note=2 or null )	exhalation  from rep_record
420
+		where 1=1
421
+		<if test="time != null and time !='' ">
422
+			and YEAR(create_time) = YEAR(CURRENT_DATE)
423
+			AND ${time}(create_time) = ${time}(CURRENT_DATE)
424
+		</if>
425
+	</select>
387 426
 
388 427
 
389 428
 	<select id="selectTelephoneBriefing"  parameterType="String" resultMap="TelephoneBriefingResult">
@@ -402,6 +441,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
402 441
 		count(myd=3  or null  )  dissatisfied
403 442
 		from rep_record
404 443
 		where 1=1
444
+		<if test="@api.entity.view.config.GlobalConfig@isNote == 1">
445
+			AND IFNULL(note,'1')='1'
446
+		</if>
405 447
 		<if test="startTime != null and startTime !=''">
406 448
 			AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
407 449
 		</if>
@@ -409,6 +451,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
409 451
 			AND UNIX_TIMESTAMP(`create_time`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
410 452
 		</if>
411 453
 	</select>
412
-
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>
413 484
 
414 485
 </mapper> 

+ 13 - 1
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,7 +14,10 @@ public interface IDataAnalysisService {
13 14
     HashMap<String,Object>  selectTrafficMeasurement();
14 15
 
15 16
     //话务分布
16
-    List<RegionOrder>selectRegionOrderCount(Long   type );
17
+    HashMap<String,Object>   selectRegionOrder(Long type,long level,long area);
18
+
19
+    //话务分布
20
+    List<RegionOrder>selectRegionOrderCount(Long   type,long level,long area );
17 21
 
18 22
     //智能统计
19 23
     HashMap<String,Object>  selectIntelligent();
@@ -21,9 +25,17 @@ public interface IDataAnalysisService {
21 25
     //话务趋势
22 26
     List<HashMap<String,Object>> selectTrafficTrends() ;
23 27
 
28
+    List<HashMap<String,Object>> selectWeekTrafficTrends();
29
+
24 30
     //24小时话务量趋势
25 31
     List<HourReport> select24TrafficTrends();
26 32
 
27 33
     //满意度统计
28 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);
29 41
 }

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

@@ -3,7 +3,6 @@ package api.service.report.impl;
3 3
 import api.entity.view.report.*;
4 4
 import api.mapper.report.ReportMapper;
5 5
 import api.service.report.IDataAnalysisService;
6
-import api.util.helper.StringHelper;
7 6
 import lombok.var;
8 7
 import org.springframework.beans.factory.annotation.Autowired;
9 8
 import org.springframework.stereotype.Service;
@@ -58,7 +57,7 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
58 57
     }
59 58
     //话务分布
60 59
     @Override
61
-    public List<RegionOrder>selectRegionOrderCount(Long   type )
60
+    public HashMap<String,Object>   selectRegionOrder(Long   type,long level,long area )
62 61
     {
63 62
         String time="";
64 63
         if (type!=null&&type>0)
@@ -72,10 +71,31 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
72 71
                 time="WEEK";
73 72
             }
74 73
         }
75
-       return  reportMapper.selectRegionOrderCount(time);
76
-    }
74
+        HashMap<String,Object> obj=new HashMap<>();
75
+        obj.put("traffic", reportMapper.selectTelephoneData(time));//话务数据
76
+        obj.put("order", reportMapper.selectRegionOrderCount(time,level,area));//工单数据
77 77
 
78
+       return obj;
79
+    }
78 80
 
81
+    //话务分布
82
+    @Override
83
+    public List<RegionOrder>selectRegionOrderCount(Long   type,long level,long area )
84
+    {
85
+        String time="";
86
+        if (type!=null&&type>0)
87
+        {
88
+            if (type==1)
89
+            {
90
+                time="MONTH";
91
+            }
92
+            else
93
+            {
94
+                time="WEEK";
95
+            }
96
+        }
97
+        return  reportMapper.selectRegionOrderCount(time,level,area);
98
+    }
79 99
 
80 100
     //智能统计
81 101
     @Override
@@ -163,6 +183,11 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
163 183
                     view.put("answerRate","0%");//接听比例
164 184
                 }
165 185
             }
186
+            else
187
+            {
188
+                view.put("incoming",0L);
189
+                view.put("answerRate","0%");//接听比例
190
+            }
166 191
             Report.add(view);
167 192
 
168 193
             calendar1.add(Calendar.MONTH,1);
@@ -170,6 +195,73 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
170 195
         }
171 196
         return Report;
172 197
     }
198
+
199
+    @Override
200
+    public List<HashMap<String,Object>> selectWeekTrafficTrends()  {
201
+        ScreenConnection connection =new ScreenConnection();
202
+
203
+        // 定义时间格式
204
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
205
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
206
+        SimpleDateFormat weekSdf = new SimpleDateFormat("EEEE",Locale.SIMPLIFIED_CHINESE);
207
+        Date date=new Date();
208
+        Calendar calendar2 = Calendar.getInstance();
209
+        calendar2.setTime(date);
210
+        calendar2.add(Calendar.DAY_OF_MONTH,-6);
211
+        connection.setStartTime(sdf1.format(calendar2.getTime()));//最近7天
212
+        connection.setEndTime(sdf1.format(date));//今天
213
+        // 将字符串解析为 Date 对象
214
+        Date time1 = calendar2.getTime();
215
+        connection.setGrouping("%Y-%m-%d");
216
+
217
+        List<TrafficView>  Traffic= reportMapper.selectCallTrends( connection);
218
+        List<HashMap<String,Object>> Report=new ArrayList<>();
219
+        Date temp=time1;
220
+        DecimalFormat df = new DecimalFormat("#.00");
221
+        while (temp.getTime()<=date.getTime())
222
+        {
223
+            Calendar calendar1= Calendar.getInstance();
224
+            calendar1.setTime(temp);
225
+            Date finalTemp =calendar1.getTime();
226
+            HashMap<String,Object> view=new HashMap<>();
227
+            view.put("date", weekSdf.format(finalTemp) );
228
+            if (Traffic!=null &&Traffic.size()>0)
229
+            {
230
+                if (Traffic.stream().anyMatch(x -> x.getDATE().equals(sdf.format(finalTemp)) ))
231
+                {
232
+                    var traffaic=Traffic.stream().filter(x->x.getDATE().equals(sdf.format(finalTemp))).
233
+                            findFirst().get();
234
+                    view.put("incoming",traffaic.getIncoming());//呼入量
235
+
236
+                    if  (traffaic.getIncoming()>0)
237
+                    {
238
+                        double answerRate=  (double)traffaic.getAnswer()/traffaic.getIncoming()*100;
239
+                        view.put("answerRate",df.format(answerRate)+"%");//接听比例
240
+                    }
241
+                    else
242
+                    {
243
+                        view.put("answerRate","0%");//接听比例
244
+                    }
245
+
246
+                }
247
+                else
248
+                {
249
+                    view.put("incoming",0L);
250
+                    view.put("answerRate","0%");//接听比例
251
+                }
252
+            }
253
+            else
254
+            {
255
+                view.put("incoming",0L);
256
+                view.put("answerRate","0%");//接听比例
257
+            }
258
+            Report.add(view);
259
+
260
+            calendar1.add(Calendar.DAY_OF_MONTH,1);
261
+            temp=calendar1.getTime();
262
+        }
263
+        return Report;
264
+    }
173 265
     //24小时话务量趋势
174 266
     @Override
175 267
     public List<HourReport> select24TrafficTrends()  {
@@ -243,4 +335,65 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
243 335
         }
244 336
         return obj;
245 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
+    }
246 399
 }

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

@@ -4,6 +4,7 @@ package api.service.report.impl;
4 4
 import api.entity.view.report.*;
5 5
 import api.mapper.report.ReportMapper;
6 6
 import api.service.report.IReportBaseService;
7
+import api.util.helper.SpringHelper;
7 8
 import api.util.helper.StringHelper;
8 9
 import lombok.var;
9 10
 import org.springframework.beans.factory.annotation.Autowired;
@@ -75,7 +76,7 @@ public class ReportBaseServiceImpl implements IReportBaseService {
75 76
     public List<HashMap<String,Object>>  selectBusinessType()  {
76 77
 
77 78
         List<HashMap<String,Object>> MapList = new ArrayList<HashMap<String,Object>>();
78
-        List<CompleteView>  BusinessType= reportMapper.selectBusinessType( );
79
+        List<CompleteView>  BusinessType= reportMapper.selectBusinessType("", 0L);
79 80
         if (BusinessType!=null)
80 81
         {
81 82
             long total=BusinessType.stream().filter(x->x.getNumber()!=null).mapToLong(CompleteView::getNumber).sum();

+ 4 - 1
hjzx-util/src/main/java/api/util/config/MybatisPlusConfig.java

@@ -31,6 +31,9 @@ public class MybatisPlusConfig {
31 31
     //listMaps、getMap等 方法获取数据后,下划线未转驼峰问题
32 32
     @Bean
33 33
     public ConfigurationCustomizer configurationCustomizer() {
34
-        return i -> i.setObjectWrapperFactory(new MybatisMapWrapperFactory());
34
+        return configuration -> {
35
+            // 解决 Map 下划线转驼峰问题
36
+            configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory());
37
+        };
35 38
     }
36 39
 }