diff --git a/src/main/java/com/ycwl/basic/controller/mobile/manage/AppStatisticsController.java b/src/main/java/com/ycwl/basic/controller/mobile/manage/AppStatisticsController.java index 6860faa..e2ceadb 100644 --- a/src/main/java/com/ycwl/basic/controller/mobile/manage/AppStatisticsController.java +++ b/src/main/java/com/ycwl/basic/controller/mobile/manage/AppStatisticsController.java @@ -33,10 +33,6 @@ public class AppStatisticsController { @ApiOperation("支付订单金额、预览_支付转化率、扫码_付费用户转化率") @PostMapping("/one") public ApiResponse<AppSta1VO> oneStatistics(@RequestBody CommonQueryReq query) { - JwtInfo worker = JwtTokenUtil.getWorker(); - log.info("oneStatistics 当前用户信息:{}", worker); - Long scenicId = worker.getScenicId(); - query.setScenicId(scenicId); return statisticsService.oneStatistics(query); } diff --git a/src/main/java/com/ycwl/basic/controller/viid/ViidController.java b/src/main/java/com/ycwl/basic/controller/viid/ViidController.java index 68280f1..96b005f 100644 --- a/src/main/java/com/ycwl/basic/controller/viid/ViidController.java +++ b/src/main/java/com/ycwl/basic/controller/viid/ViidController.java @@ -193,7 +193,6 @@ public class ViidController { */ @RequestMapping(value = "/Faces", method = RequestMethod.POST) @IgnoreLogReq - @RequestToFile public VIIDBaseResp faces(@RequestBody FaceUploadReq req) { FaceListObject faceListObject = req.getFaceListObject(); List<FaceObject> faceObject = faceListObject.getFaceObject(); diff --git a/src/main/java/com/ycwl/basic/service/impl/mobile/AppStatisticsServiceImpl.java b/src/main/java/com/ycwl/basic/service/impl/mobile/AppStatisticsServiceImpl.java index 7ee6c45..a6ae382 100644 --- a/src/main/java/com/ycwl/basic/service/impl/mobile/AppStatisticsServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/impl/mobile/AppStatisticsServiceImpl.java @@ -245,7 +245,7 @@ public class AppStatisticsServiceImpl implements AppStatisticsService { private String calculateConversionRate(Integer num1,Integer num2){ //转化率格式 DecimalFormat df = new DecimalFormat("0.00"); - if(num2==0){ + if(num2 == null || num2==0){ return "0.00"; }else { BigDecimal result = new BigDecimal(num1).divide(new BigDecimal(num2), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); @@ -342,12 +342,15 @@ public class AppStatisticsServiceImpl implements AppStatisticsService { //当前周期的支付订单金额 vo.setNowOrderAmount(orderAmountDf.format(orderAmount)); //当前周期预览_支付转化率、扫码_付费用户转化率 - if(pay==0){ + if(preview==0){ vo.setNowPreviewPay("0.00"); + }else { + BigDecimal previewPay = new BigDecimal(pay).divide(new BigDecimal(preview), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); + vo.setNowPreviewPay(df.format(previewPay)); + } + if(scanCode==0){ vo.setNowScanCodePay("0.00"); }else { - BigDecimal previewPay = new BigDecimal(payCount).divide(new BigDecimal(preview), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); - vo.setNowPreviewPay(df.format(previewPay)); BigDecimal scanCodePay = new BigDecimal(pay).divide(new BigDecimal(scanCode), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); vo.setNowScanCodePay(df.format(scanCodePay)); } diff --git a/src/main/resources/mapper/StatisticsMapper.xml b/src/main/resources/mapper/StatisticsMapper.xml index 113fee9..9a81633 100644 --- a/src/main/resources/mapper/StatisticsMapper.xml +++ b/src/main/resources/mapper/StatisticsMapper.xml @@ -20,7 +20,7 @@ </select> <select id="countPreviewVideoOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( select count(1) as count from statistics @@ -36,7 +36,7 @@ </select> <select id="countScanCodeOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( select count(1) as count from statistics @@ -52,51 +52,46 @@ </select> <select id="countClickPayOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( - select count(1) as count - from statistics - where type=9 and scenic_id = #{scenicId} - <if test="startTime!= null"> - and create_time >= #{startTime} - </if> - <if test="endTime!= null"> - and create_time <= #{endTime} - </if> - group by member_id + select count(1) as count + from `order` + where scenic_id = #{scenicId} + <if test="startTime!= null"> + and create_at >= #{startTime} + </if> + <if test="endTime!= null"> + and create_at <= #{endTime} + </if> + group by member_id )a </select> <select id="countPayOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( select count(1) as count - from statistics - where type in(3,4) and scenic_id = #{scenicId} - <if test="startTime!= null"> - and create_time >= #{startTime} - </if> - <if test="endTime!= null"> - and create_time <= #{endTime} - </if> - group by member_id + from `order` + where scenic_id = #{scenicId} and pay_at is not null + <if test="startTime!= null"> + and create_at >= #{startTime} + </if> + <if test="endTime!= null"> + and create_at <= #{endTime} + </if> + group by member_id )a </select> <select id="countSceneOrderNum" resultType="java.lang.Integer"> - SELECT - IFNULL(SUM(count), 0) AS count - FROM ( select count(1) as count - from statistics - where type=3 and scenic_id = #{scenicId} - <if test="startTime!= null"> - and create_time >= #{startTime} - </if> - <if test="endTime!= null"> - and create_time <= #{endTime} - </if> - group by morph_id - )a + from `order` + where scenic_id = #{scenicId} and pay_at is not null + <if test="startTime!= null"> + and create_at >= #{startTime} + </if> + <if test="endTime!= null"> + and create_at <= #{endTime} + </if> </select> <select id="countPushOrderNum" resultType="java.lang.Integer"> SELECT @@ -116,7 +111,7 @@ </select> <select id="countPushOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( select count(1) as count from statistics @@ -147,10 +142,8 @@ select count(1) as count from face where scenic_id = #{scenicId} - <if test="startTime!= null">and create_at >= #{startTime} - </if><if test=" - endTime!= null">and create_at <= #{endTime} - </if> + <if test="startTime!= null">and create_at >= #{startTime}</if> + <if test="endTime!= null">and create_at <= #{endTime}</if> group by member_id ) a </select> @@ -172,7 +165,7 @@ </select> <select id="countTotalVisitorOfMember" resultType="java.lang.Integer"> SELECT - IFNULL(count(count), 0) AS count + IFNULL(count(1), 0) AS count FROM ( select count(1) as count from statistics @@ -214,37 +207,34 @@ )a </select> <select id="countPayOfOrder" resultType="java.lang.Integer"> - SELECT - IFNULL(SUM(count), 0) AS count - FROM ( select count(1) as count - from statistics - where type in(3,4) and scenic_id = #{scenicId} + from `order` + where + pay_at is not null and scenic_id = #{scenicId} <if test="startTime!= null"> - and create_time >= #{startTime} + and create_at >= #{startTime} </if> <if test="endTime!= null"> - and create_time <= #{endTime} + and create_at <= #{endTime} </if> - group by morph_id - )a </select> <select id="countRefundOfOrder" resultType="java.lang.Integer"> select count(1) as count - from statistics - where type =5 and scenic_id = #{scenicId} + from `order` + where + refund_status = 1 and scenic_id = #{scenicId} <if test="startTime!= null"> - and create_time >= #{startTime} + and create_at >= #{startTime} </if> <if test="endTime!= null"> - and create_time <= #{endTime} + and create_at <= #{endTime} </if> </select> <select id="countRefundAmount" resultType="java.math.BigDecimal"> select ifnull(sum(pay_price),0) as payPrice from `order` where - status = 2 and scenic_id = #{scenicId} + refund_status = 1 and scenic_id = #{scenicId} <if test="startTime!= null"> and create_at >= #{startTime} </if>