Commit 4ed28a56ddea8a69cbbc1958c3926aec2bf251f8

Authored by litao@lymsh.com
1 parent 4bafbd4648

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

Showing 3 changed files with 41 additions and 2 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 4ed28a5
... ... @@ -130,5 +130,9 @@
130 130 List<String> findUsededId(List<String> usedIds);
131 131  
132 132 List<Map<String, Object>> findAllHospitals();
  133 +
  134 + Map<String,Object> findHospitalUsedInfo2(Map<String, Object> param);
  135 +
  136 + Map<String,Object> findHospitalSendInfo2(Map<String, Object> param);
133 137 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 4ed28a5
... ... @@ -306,6 +306,24 @@
306 306 </if>
307 307 </select>
308 308  
  309 + <select id="findHospitalUsedInfo2" parameterType="map" resultType="map">
  310 + select a.id, count(distinct(b.user_id)) as user_used_count, count(1) as coupon_used_count, a.area_id, a.city_id, a.province_id
  311 + from organization a, coupon_info b, coupon_template c, coupon_type d
  312 + where a.id = b.used_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
  313 + and a.id = #{hid}
  314 + and b.status = 2
  315 + and d.type in
  316 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  317 + #{type}
  318 + </foreach>
  319 + <if test="startDate != null">
  320 + and b.use_date >= #{startDate}
  321 + </if>
  322 + <if test="endDate != null">
  323 + and b.use_date <![CDATA[ < ]]> #{endDate}
  324 + </if>
  325 + </select>
  326 +
309 327 <select id="findSendUserIds" parameterType="map" resultType="string">
310 328 select distinct(b.user_id)
311 329 from organization a, coupon_info b, coupon_template c, coupon_type d
... ... @@ -337,6 +355,23 @@
337 355 </if>
338 356 <if test="endDate != null">
339 357 and b.create_date <![CDATA[ < ]]> #{endDate}
  358 + </if>
  359 + </select>
  360 +
  361 + <select id="findHospitalSendInfo2" parameterType="map" resultType="map">
  362 + select a.id, count(distinct(b.user_id)) as people_send_count, count(1) as coupon_send_count, a.area_id, a.city_id, a.province_id
  363 + from organization a, coupon_info b, coupon_template c, coupon_type d
  364 + where a.id = b.create_hospital_id and b.coupon_template_id = c.id and c.type_id = d.id
  365 + and a.id = #{hid}
  366 + and d.type in
  367 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  368 + #{type}
  369 + </foreach>
  370 + <if test="startDate != null">
  371 + and b.use_date >= #{startDate}
  372 + </if>
  373 + <if test="endDate != null">
  374 + and b.use_date <![CDATA[ < ]]> #{endDate}
340 375 </if>
341 376 </select>
342 377  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 4ed28a5
... ... @@ -2189,8 +2189,8 @@
2189 2189 hNameMap = CollectionUtils.coverListToMap(hospitalNames, "id", "name");
2190 2190 for (String hid : hospitalId) {
2191 2191 param.put("hid", hid);
2192   - Map<String, Object> usedInfo = couponMapper.findHospitalUsedInfo(param);
2193   - Map<String, Object> sendInfo = couponMapper.findHospitalSendInfo(param);
  2192 + Map<String, Object> usedInfo = couponMapper.findHospitalUsedInfo2(param);
  2193 + Map<String, Object> sendInfo = couponMapper.findHospitalSendInfo2(param);
2194 2194  
2195 2195 Map<String, Object> tempMap = packCouponMap(sendInfo, usedInfo, hNameMap, hid, xAxis, param);
2196 2196