ソースを参照

话务趋势,数据隔离

1550076451 10 ヶ月 前
コミット
13b672a0a1

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

@@ -64,7 +64,8 @@ public class CallLogController extends BaseController {
64 64
         qw.eq(input.getCallType() != null && input.getCallType() > 0, CallLog::getCallType, input.getCallType());
65 65
         qw.ge(!StringHelper.isEmpty(input.getStartTime()) , CallLog::getCreateTime, input.getStartTime());
66 66
         qw.le(!StringHelper.isEmpty(input.getEndTime()) , CallLog::getCreateTime, input.getEndTime());
67
-
67
+        //只显示八院记录
68
+        qw.eq(CallLog::getNote,1);
68 69
 
69 70
 //        qw.le(input.getHangupTime() != null, CallLog::getCreateTime, input.getHangupTime());
70 71
 //        qw.ge(input.getAnswerTime() != null, CallLog::getCreateTime, input.getAnswerTime());
@@ -187,6 +188,8 @@ public class CallLogController extends BaseController {
187 188
         qw.eq(input.getIsAnswer() != null , CallLog::getIsAnswer, input.getIsAnswer());
188 189
         qw.eq(input.getOpType() != null , CallLog::getOpType, input.getOpType());
189 190
         qw.eq(input.getMyd() != null , CallLog::getMyd, input.getMyd());
191
+        //只显示八院记录
192
+        qw.eq(CallLog::getNote,1);
190 193
         qw.eq(!StringHelper.isEmpty(input.getWorkordercode()), CallLog::getWorkordercode, input.getWorkordercode());
191 194
         qw.orderByDesc(CallLog::getId);
192 195
         var list=calllogService.getList(qw);

+ 9 - 0
hjzx-api/src/main/java/api/controller/report/DataAnalysisController.java

@@ -79,5 +79,14 @@ public class DataAnalysisController extends BaseController {
79 79
         var obj =DataAnalysisService.select24TrafficTrends();
80 80
         return Success("成功",obj);
81 81
     }
82
+    @ApiOperation("话务趋势(周)")
83
+    @Log(title = "话务趋势(周)",businessType = BusinessType.QUERY)
84
+    @GetMapping("/selectWeekTrafficTrends")
85
+    public AjaxResult selectWeekTrafficTrends()  {
86
+        var obj =DataAnalysisService.selectWeekTrafficTrends();
87
+        return Success("成功",obj);
88
+    }
89
+
90
+
82 91
 
83 92
 }

+ 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
      */

+ 12 - 8
hjzx-mapper/src/main/resources/mapper/report/ReportMapper.xml

@@ -235,7 +235,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
235 235
 
236 236
 		FROM `rep_record` a
237 237
 		WHERE 1=1 AND `callee_agent`!='' AND `callee_agent` IS NOT NULL
238
-		AND `call_type`=1
238
+		AND `call_type`=1  AND  note='1'
239 239
 		<if test="startTime != null and startTime !=''">
240 240
 			AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
241 241
 		</if>
@@ -280,16 +280,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
280 280
 		count(call_type=1 and is_answer=0 or null  )  noAnswer
281 281
 		from rep_record
282 282
 		where  DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
283
+		AND  note='1'
283 284
 		GROUP BY DATE
284 285
 		ORDER BY DATE;
285 286
 	</select>
286 287
 	<select id="selectSatisfaction"  parameterType="Date" resultMap="SatisfactionViewResult">
287 288
 		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
289
+		count(myd=2  or null  )  basically,
290
+		count(myd=1  or null  )  satisfied,
291
+		count(myd=3  or null  )  dissatisfied
291 292
 		from rep_record
292
-		where  DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
293
+		where  1=1
294
+		AND  note='1'
293 295
 	</select>
294 296
 	<select id="selectTrafficMeasurement"  parameterType="Date" resultMap="TrafficMeasurementResult">
295 297
 		select
@@ -299,6 +301,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
299 301
 		AVG(TIMESTAMPDIFF(SECOND, answer_time, hangup_time) and is_answer=1  AND call_type=1  ) avgAnswer
300 302
 		from rep_record
301 303
 		WHERE `create_time`>=#{beginTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
304
+		AND  note='1'
302 305
 	</select>
303 306
 
304 307
 	<select id="selectConnection"  parameterType="api.entity.view.report.ScreenConnection" resultMap="SysReportHourResult">
@@ -307,7 +310,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
307 310
 		DATE_FORMAT(  `create_time`, #{grouping} ) as DATE
308 311
 		from rep_record
309 312
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
310
-		and call_type=1
313
+		and call_type=1 AND  note='1'
311 314
 		<if test="isAnswer >-1  ">
312 315
 			AND `is_answer`= #{isAnswer}
313 316
 		</if>
@@ -321,6 +324,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
321 324
 		COUNT(1) total
322 325
 		from  rep_record where
323 326
 		DATE_FORMAT(  `create_time`, '%Y-%m' )= DATE_FORMAT( #{time}, '%Y-%m' )
327
+		 AND  note='1'
324 328
 	</select>
325 329
 
326 330
 	<select id="selectVisitCount"  parameterType="String" resultType="long">
@@ -337,7 +341,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
337 341
 		count(call_type=1 and is_answer=0 or null  )  noAnswer
338 342
 		from rep_record
339 343
 		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
340
-		and call_type=1
344
+		and call_type=1 AND  note='1'
341 345
 		group by DATE
342 346
 		order by DATE
343 347
 	</select>
@@ -401,7 +405,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
401 405
 		count(myd=1 or null  )  satisfied,
402 406
 		count(myd=3  or null  )  dissatisfied
403 407
 		from rep_record
404
-		where 1=1
408
+		where 1=1 AND  note='1'
405 409
 		<if test="startTime != null and startTime !=''">
406 410
 			AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
407 411
 		</if>

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

@@ -21,6 +21,8 @@ public interface IDataAnalysisService {
21 21
     //话务趋势
22 22
     List<HashMap<String,Object>> selectTrafficTrends() ;
23 23
 
24
+    List<HashMap<String,Object>> selectWeekTrafficTrends();
25
+
24 26
     //24小时话务量趋势
25 27
     List<HourReport> select24TrafficTrends();
26 28
 

+ 72 - 1
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;
@@ -163,6 +162,11 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
163 162
                     view.put("answerRate","0%");//接听比例
164 163
                 }
165 164
             }
165
+            else
166
+            {
167
+                view.put("incoming",0L);
168
+                view.put("answerRate","0%");//接听比例
169
+            }
166 170
             Report.add(view);
167 171
 
168 172
             calendar1.add(Calendar.MONTH,1);
@@ -170,6 +174,73 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
170 174
         }
171 175
         return Report;
172 176
     }
177
+
178
+    @Override
179
+    public List<HashMap<String,Object>> selectWeekTrafficTrends()  {
180
+        ScreenConnection connection =new ScreenConnection();
181
+
182
+        // 定义时间格式
183
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
184
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
185
+        SimpleDateFormat weekSdf = new SimpleDateFormat("EEEE",Locale.SIMPLIFIED_CHINESE);
186
+        Date date=new Date();
187
+        Calendar calendar2 = Calendar.getInstance();
188
+        calendar2.setTime(date);
189
+        calendar2.add(Calendar.DAY_OF_MONTH,-6);
190
+        connection.setStartTime(sdf1.format(calendar2.getTime()));//最近7天
191
+        connection.setEndTime(sdf1.format(date));//今天
192
+        // 将字符串解析为 Date 对象
193
+        Date time1 = calendar2.getTime();
194
+        connection.setGrouping("%Y-%m-%d");
195
+
196
+        List<TrafficView>  Traffic= reportMapper.selectCallTrends( connection);
197
+        List<HashMap<String,Object>> Report=new ArrayList<>();
198
+        Date temp=time1;
199
+        DecimalFormat df = new DecimalFormat("#.00");
200
+        while (temp.getTime()<=date.getTime())
201
+        {
202
+            Calendar calendar1= Calendar.getInstance();
203
+            calendar1.setTime(temp);
204
+            Date finalTemp =calendar1.getTime();
205
+            HashMap<String,Object> view=new HashMap<>();
206
+            view.put("date", weekSdf.format(finalTemp) );
207
+            if (Traffic!=null &&Traffic.size()>0)
208
+            {
209
+                if (Traffic.stream().anyMatch(x -> x.getDATE().equals(sdf.format(finalTemp)) ))
210
+                {
211
+                    var traffaic=Traffic.stream().filter(x->x.getDATE().equals(sdf.format(finalTemp))).
212
+                            findFirst().get();
213
+                    view.put("incoming",traffaic.getIncoming());//呼入量
214
+
215
+                    if  (traffaic.getIncoming()>0)
216
+                    {
217
+                        double answerRate=  (double)traffaic.getAnswer()/traffaic.getIncoming()*100;
218
+                        view.put("answerRate",df.format(answerRate)+"%");//接听比例
219
+                    }
220
+                    else
221
+                    {
222
+                        view.put("answerRate","0%");//接听比例
223
+                    }
224
+
225
+                }
226
+                else
227
+                {
228
+                    view.put("incoming",0L);
229
+                    view.put("answerRate","0%");//接听比例
230
+                }
231
+            }
232
+            else
233
+            {
234
+                view.put("incoming",0L);
235
+                view.put("answerRate","0%");//接听比例
236
+            }
237
+            Report.add(view);
238
+
239
+            calendar1.add(Calendar.DAY_OF_MONTH,1);
240
+            temp=calendar1.getTime();
241
+        }
242
+        return Report;
243
+    }
173 244
     //24小时话务量趋势
174 245
     @Override
175 246
     public List<HourReport> select24TrafficTrends()  {