Commit 31d0897e96f2ba23ea0097d63eaaadb39eb055ef

Authored by litao@lymsh.com
1 parent 14785666e7

优惠券统计的时间改为使用时间

Showing 3 changed files with 62 additions and 2 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 31d0897
... ... @@ -142,5 +142,9 @@
142 142 List<Map<String,Object>> findUsedInfo2(Map<String, Object> param);
143 143  
144 144 List<Map<String,Object>> findMulitPatienInfoWithSend(Map<String, Object> param);
  145 +
  146 + List<Map<String,Object>> couponInfo2(Map<String, Object> param);
  147 +
  148 + int findCouponInfoCount2(Map<String, Object> param);
145 149 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 31d0897
... ... @@ -488,6 +488,34 @@
488 488 </if>
489 489 </select>
490 490  
  491 + <select id="couponInfo2" parameterType="map" resultType="map">
  492 + select a.used_hospital_id, c.type, b.coupon_order, a.sequence_id, d.name as send_hospital, a.use_date, a.used_id, a.operator_use_id
  493 + from coupon_info a, coupon_template b, coupon_type c, organization d
  494 + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id
  495 + and a.status = 2
  496 + and a.used_hospital_id in
  497 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  498 + #{hid}
  499 + </foreach>
  500 + and c.type in
  501 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  502 + #{type}
  503 + </foreach>
  504 + <if test="coupon_order != null">
  505 + and b.coupon_order = #{coupon_order}
  506 + </if>
  507 + <if test="startDate != null">
  508 + and a.use_date >= #{startDate}
  509 + </if>
  510 + <if test="endDate != null">
  511 + and a.use_date <![CDATA[ < ]]> #{endDate}
  512 + </if>
  513 + order by a.user_id, a.use_date desc
  514 + <if test="needPage == true">
  515 + limit #{currentPage},#{pageSize}
  516 + </if>
  517 + </select>
  518 +
491 519 <select id="findCouponInfoCount" parameterType="map" resultType="integer">
492 520 select count(1) from (
493 521 select a.used_hospital_id, c.type, b.coupon_order, a.sequence_id, d.name as send_hospital, a.use_date, a.used_id, a.operator_use_id
... ... @@ -511,6 +539,32 @@
511 539 <if test="endDate != null">
512 540 and a.create_date <![CDATA[ < ]]> #{endDate}
513 541 </if>
  542 + ) a
  543 + </select>
  544 +
  545 + <select id="findCouponInfoCount2" parameterType="map" resultType="integer">
  546 + select count(1) from (
  547 + select a.used_hospital_id, c.type, b.coupon_order, a.sequence_id, d.name as send_hospital, a.use_date, a.used_id, a.operator_use_id
  548 + from coupon_info a, coupon_template b, coupon_type c, organization d
  549 + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id
  550 + and a.status = 2
  551 + and a.used_hospital_id in
  552 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  553 + #{hid}
  554 + </foreach>
  555 + and c.type in
  556 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  557 + #{type}
  558 + </foreach>
  559 + <if test="coupon_order != null">
  560 + and b.coupon_order = #{coupon_order}
  561 + </if>
  562 + <if test="startDate != null">
  563 + and a.use_date >= #{startDate}
  564 + </if>
  565 + <if test="endDate != null">
  566 + and a.use_date <![CDATA[ < ]]> #{endDate}
  567 + </if>
514 568 ) a
515 569 </select>
516 570  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 31d0897
... ... @@ -2605,7 +2605,8 @@
2605 2605 Assert.notNull(type, "type must not be null!");
2606 2606  
2607 2607 if(type == 4) { /** 使用详情统计 */
2608   - List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param);
  2608 +// List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param);
  2609 + List<Map<String, Object>> couponInfos = couponMapper.couponInfo2(param);
2609 2610 String subTitle = null;
2610 2611 Set<String> subTitleTempSet = new HashSet<>();
2611 2612  
... ... @@ -2635,7 +2636,8 @@
2635 2636 );
2636 2637 }
2637 2638 }
2638   - int count = couponMapper.findCouponInfoCount(param);
  2639 +// int count = couponMapper.findCouponInfoCount(param);
  2640 + int count = couponMapper.findCouponInfoCount2(param);
2639 2641 PageResult pageResult = new PageResult(count, currentPage,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos, "subTitle", subTitle));
2640 2642 return RespBuilder.buildSuccess(pageResult);
2641 2643 } if(type == 1) { /** 发放人数统计 */