Selaa lähdekoodia

话务量统计

1550076451 10 kuukautta sitten
vanhempi
commit
8509307151

+ 10 - 5
hjzx-api/src/main/java/api/controller/report/WorkReportController.java

@@ -1,10 +1,7 @@
1 1
 package api.controller.report;
2 2
 
3 3
 import api.controller.BaseController;
4
-import api.entity.view.report.OnlineServiceReport;
5
-import api.entity.view.report.RecordReport;
6
-import api.entity.view.report.ScreenReport;
7
-import api.entity.view.report.WorkOrderTypeReport;
4
+import api.entity.view.report.*;
8 5
 import api.model.AjaxResult;
9 6
 import api.service.report.IReportBaseService;
10 7
 import api.util.annotation.Anonymous;
@@ -18,6 +15,8 @@ import lombok.var;
18 15
 import org.springframework.beans.factory.annotation.Autowired;
19 16
 import org.springframework.web.bind.annotation.*;
20 17
 
18
+import java.text.ParseException;
19
+
21 20
 @Api(value = "报表",tags = "报表")
22 21
 @RestController
23 22
 @RequestMapping("/WorkReport")
@@ -173,6 +172,12 @@ public class WorkReportController extends BaseController {
173 172
         var obj =ReportBaseService.selectTrafficMeasurement();
174 173
         return Success("成功",obj);
175 174
     }
176
-
175
+    @ApiOperation("话务量统计")
176
+    @Log(title = "话务统计",businessType = BusinessType.QUERY)
177
+    @GetMapping("/selectConnection")
178
+    public AjaxResult selectConnection(ScreenConnection connection) throws ParseException {
179
+        var obj =ReportBaseService.selectConnection(connection);
180
+        return Success("成功",obj);
181
+    }
177 182
 
178 183
 }

+ 29 - 0
hjzx-entity/src/main/java/api/entity/view/report/ScreenConnection.java

@@ -0,0 +1,29 @@
1
+package api.entity.view.report;
2
+
3
+import io.swagger.annotations.ApiModel;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+@ApiModel(value = "ScreenConnection", description = "筛选项")
8
+@Data
9
+public class ScreenConnection {
10
+    /**开始时间**/
11
+
12
+    @ApiModelProperty("开始时间")
13
+    private String startTime;
14
+
15
+
16
+    /**结束时间**/
17
+
18
+    @ApiModelProperty("结束时间")
19
+    private String endTime;
20
+    /**开始时间**/
21
+
22
+    @ApiModelProperty("分组方式")
23
+    private String grouping;
24
+
25
+    /**工号**/
26
+    @ApiModelProperty("是否接通")
27
+    private long isAnswer=-1  ;
28
+
29
+}

BIN
hjzx-entity/target/classes/api/entity/view/report/ScreenConnection.class


+ 2 - 0
hjzx-mapper/src/main/java/api/mapper/report/ReportMapper.java

@@ -38,5 +38,7 @@ public interface ReportMapper {
38 38
     public SatisfactionView selectSatisfaction();
39 39
     /**话务量统计**/
40 40
     public  TrafficMeasurement selectTrafficMeasurement(Date beginTime, Date endTime);
41
+    /**话务量统计**/
42
+    public  List<HourReport> selectConnection(ScreenConnection Report);
41 43
 
42 44
 }

+ 14 - 2
hjzx-mapper/src/main/resources/mapper/report/ReportMapper.xml

@@ -208,7 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
208 208
 
209 209
 		FROM `rep_record` a
210 210
 		WHERE 1=1 AND `callee_agent`!='' AND `callee_agent` IS NOT NULL
211
-		AND `call_type`=0
211
+		AND `call_type`=1
212 212
 		<if test="startTime != null and startTime !=''">
213 213
 			AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
214 214
 		</if>
@@ -274,5 +274,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
274 274
 		WHERE `create_time`>=#{beginTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
275 275
 	</select>
276 276
 
277
-
277
+	<select id="selectConnection"  parameterType="api.entity.view.report.ScreenConnection" resultMap="SysReportHourResult">
278
+		select
279
+		count(1) number,
280
+		DATE_FORMAT(  `create_time`, #{grouping} ) as DATE
281
+		from rep_record
282
+		WHERE `create_time`>=#{startTime}  AND `create_time`<![CDATA[<=]]> #{endTime}
283
+		and call_type=1
284
+		<if test="isAnswer >-1  ">
285
+			AND `is_answer`= #{isAnswer}
286
+		</if>
287
+		group by DATE
288
+		order by DATE
289
+	</select>
278 290
 </mapper> 

+ 4 - 0
hjzx-service/src/main/java/api/service/report/IReportBaseService.java

@@ -2,6 +2,7 @@ package api.service.report;
2 2
 
3 3
 import api.entity.view.report.*;
4 4
 
5
+import java.text.ParseException;
5 6
 import java.util.Date;
6 7
 import java.util.HashMap;
7 8
 import java.util.List;
@@ -26,6 +27,9 @@ public interface IReportBaseService {
26 27
     List<HourReport>   selectDealingWithTrends(int Date);
27 28
 
28 29
     //话务量统计
30
+    List<HourReport>   selectConnection(ScreenConnection connection) throws ParseException;
31
+
32
+    //话务量统计
29 33
     List<TrafficView>   selectTraffic();
30 34
 
31 35
     //满意度统计

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

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
9 9
 import org.springframework.stereotype.Service;
10 10
 import org.springframework.transaction.annotation.Transactional;
11 11
 
12
+import java.text.ParseException;
12 13
 import java.text.SimpleDateFormat;
13 14
 import java.util.*;
14 15
 
@@ -145,6 +146,79 @@ public class ReportBaseServiceImpl implements IReportBaseService {
145 146
         }
146 147
         return Report;
147 148
     }
149
+
150
+    //话务量统计
151
+    @Override
152
+    public List<HourReport>   selectConnection(ScreenConnection connection) throws ParseException {
153
+        // 定义时间格式
154
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
155
+        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
156
+        // 将字符串解析为 Date 对象
157
+        Date time1 = sdf.parse(connection.getStartTime());
158
+        Date time2 = sdf.parse(connection.getEndTime());
159
+        // 计算时间差(单位:毫秒)
160
+        long difference =time2.getTime()- time1.getTime() ;
161
+        // 将毫秒转换为小时
162
+        long hours = difference / (1000 * 60 * 60);
163
+        String Format="HH";int field=11;
164
+        if (hours>24)
165
+        {
166
+            long day=hours/24;
167
+            if (day>31)
168
+            {
169
+                Format="yyyy-MM";field=2;
170
+                connection.setGrouping("%Y-%m");
171
+            }
172
+            else
173
+            {
174
+                Format="yyyy-MM-dd";field=6;
175
+                connection.setGrouping("%Y-%m-%d");
176
+            }
177
+        }
178
+        else
179
+        {
180
+            connection.setGrouping("%H");
181
+        }
182
+        Date date=new Date();
183
+        if (!sdf.format(time2).equals(sdf.format(date)))
184
+        {
185
+            Calendar calendar3 = Calendar.getInstance();
186
+            calendar3.setTime(time2);
187
+            calendar3.set(Calendar.HOUR_OF_DAY, 23);
188
+            calendar3.set(Calendar.MINUTE, 59);
189
+            calendar3.set(Calendar.SECOND, 59);
190
+            date=calendar3.getTime();
191
+        }
192
+        connection.setEndTime(sdf1.format(date));
193
+
194
+
195
+        List<HourReport>  Traffic= reportMapper.selectConnection( connection);
196
+        List<HourReport> Report=new ArrayList<>();
197
+        Date temp=time1;
198
+        SimpleDateFormat formatter = new SimpleDateFormat(Format);
199
+        while (temp.getTime()<=date.getTime())
200
+        {
201
+            Calendar calendar2 = Calendar.getInstance();
202
+            calendar2.setTime(temp);
203
+            Date finalTemp =calendar2.getTime();
204
+            HourReport view=new HourReport();
205
+            view.setDATE(formatter.format(finalTemp));
206
+            if (Traffic!=null &&Traffic.size()>0)
207
+            {
208
+                if (Traffic.stream().anyMatch(x -> x.getDATE().equals(formatter.format(finalTemp)) ))
209
+                {
210
+                    var traffaic=Traffic.stream().filter(x->x.getDATE().equals(formatter.format(finalTemp))).
211
+                            findFirst().get();
212
+                    view.setNumber(traffaic.getNumber());
213
+                }
214
+            }
215
+            Report.add(view);
216
+
217
+            calendar2.add(field,1);
218
+            temp=calendar2.getTime();
219
+        }
220
+        return Report;
221
+    }
148 222
     //话务量统计
149 223
     @Override
150 224
     public List<TrafficView>   selectTraffic()  {
@@ -179,7 +253,7 @@ public class ReportBaseServiceImpl implements IReportBaseService {
179 253
                 }
180 254
             }
181 255
             Report.add(view);
182
-            calendar2.add(Calendar.HOUR_OF_DAY,1);
256
+            calendar2.add(Calendar.MONTH,1);
183 257
             temp=calendar2.getTime();
184 258
         }
185 259
         return Report;