Commit 7abfea962fe37b58499a3c1018ca90d537eb59b9
1 parent
d262c1a3c4
Exists in
master
and in
6 other branches
bug修复
Showing 5 changed files with 36 additions and 13 deletions
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-common/src/main/java/com/lyms/platform/common/result/RespBuilder.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SystemDataSource.java
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
7abfea9
... | ... | @@ -138,8 +138,8 @@ |
138 | 138 | select a.people_send_count, a.coupon_send_count, a.used_hospital_id, b.user_used_count, b.coupon_used_count, c.province_id, c.city_id, c.area_id, c.name |
139 | 139 | from ( |
140 | 140 | select count(distinct(a.user_id)) as people_send_count, count(1) as coupon_send_count, a.used_hospital_id |
141 | - from coupon_info a, coupon_template b, coupon_type c | |
142 | - where a.status = #{status} and a.used_hospital_id in | |
141 | + from coupon_info a, coupon_template b, coupon_type c, organization d, hospital_coupon_template_group e | |
142 | + where a.status = #{status} and a.used_hospital_id = d.id and a.used_hospital_id in | |
143 | 143 | <foreach collection="hospitalIds" open="(" close=")" separator="," item="hid"> |
144 | 144 | #{hid} |
145 | 145 | </foreach> |
... | ... | @@ -147,6 +147,25 @@ |
147 | 147 | <foreach collection="couponTypes" open="(" close=")" separator="," item="type"> |
148 | 148 | #{type} |
149 | 149 | </foreach> |
150 | + <if test="startDate != null"> | |
151 | + and a.use_date >= #{startDate} | |
152 | + </if> | |
153 | + <if test="endDate != null"> | |
154 | + #and a.use_date <![CDATA[<]]>= #{endDate} | |
155 | + </if> | |
156 | + <if test="provinceId != null and provinceId != ''"> | |
157 | + and d.province_id = #{provinceId} | |
158 | + </if> | |
159 | + <if test="cityId != null and cityId != '' "> | |
160 | + and d.city_id = #{cityId} | |
161 | + </if> | |
162 | + <if test="areaId != null and areaId != ''"> | |
163 | + and d.area_id = #{areaId} | |
164 | + </if> | |
165 | + <if test="tempId != null and tempId != ''"> | |
166 | + and e.coupon_template_group_id = #{tempId} | |
167 | + </if> | |
168 | + and a.used_hospital_id = e.hospital_id | |
150 | 169 | group by a.used_hospital_id |
151 | 170 | ) a, ( |
152 | 171 | select count(distinct(a.user_id)) as user_used_count, count(1) as coupon_used_count, a.used_hospital_id |
platform-common/src/main/java/com/lyms/platform/common/result/RespBuilder.java
View file @
7abfea9
1 | 1 | package com.lyms.platform.common.result; |
2 | 2 | |
3 | 3 | import org.apache.commons.lang3.StringUtils; |
4 | -import org.springframework.util.Assert; | |
5 | 4 | |
6 | 5 | import java.util.HashMap; |
7 | 6 | import java.util.Map; |
8 | 7 | |
... | ... | @@ -16,8 +15,11 @@ |
16 | 15 | return buildSuccess(null); |
17 | 16 | } |
18 | 17 | |
19 | - public static BaseObjectResponse buildSuccess(Object ... data) { | |
18 | + public static BaseObjectResponse buildSuccess(Object data) { | |
20 | 19 | BaseObjectResponse resp = new BaseObjectResponse(); |
20 | + resp.setData(data); | |
21 | + return resp; | |
22 | + /* BaseObjectResponse resp = new BaseObjectResponse(); | |
21 | 23 | if(data != null) { |
22 | 24 | Assert.isTrue(data.length == 1 || data.length % 2 == 0, "length必须为偶数"); |
23 | 25 | |
... | ... | @@ -27,7 +29,7 @@ |
27 | 29 | resp.setData(createMap(data)); |
28 | 30 | } |
29 | 31 | } |
30 | - return resp; | |
32 | + return resp;*/ | |
31 | 33 | } |
32 | 34 | |
33 | 35 | public static BaseObjectResponse buildErro(ResponseCode code) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
7abfea9
... | ... | @@ -206,10 +206,10 @@ |
206 | 206 | @ResponseBody |
207 | 207 | @TokenRequired |
208 | 208 | @RequestMapping(value = "/coupon", method = RequestMethod.GET) |
209 | - public BaseObjectResponse coupon(HttpServletRequest request, Integer type, Date startDate, Date endDate, | |
209 | + public BaseObjectResponse coupon(HttpServletRequest request, Date startDate, Date endDate, | |
210 | 210 | String provinceId, String cityId, String areaId, String hospitalId, String tempId, String couponType) { |
211 | - Map<String, Object> param = CollectionUtils.createMap("type", type, "userId", getUserId(request), "startDate", startDate, | |
212 | - "endDate", endDate, "hospitalType", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", | |
211 | + Map<String, Object> param = CollectionUtils.createMap("userId", getUserId(request), "startDate", startDate, | |
212 | + "endDate", endDate, "hospitalIds", hospitalId, "provinceId", provinceId, "cityId", cityId, "areaId", | |
213 | 213 | areaId, "tempId", tempId, "couponType", couponType); |
214 | 214 | return reportService.couponInfo(param); |
215 | 215 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
7abfea9
... | ... | @@ -409,7 +409,7 @@ |
409 | 409 | public BaseObjectResponse couponInfo(Map<String ,Object> param) { |
410 | 410 | List<String> hospitalIds = Arrays.asList("216", "245"); /** 模拟根据登陆人id 查询出来的医院 */ |
411 | 411 | |
412 | - param.put("hospitalIds", hospitalIds); | |
412 | + param.put("hospitalIds", CollectionUtils.asList((String) param.get("hospitalIds"))); | |
413 | 413 | param.put("status", 2); |
414 | 414 | param.put("couponTypes", CollectionUtils.asList((String) param.get("couponTypes"))); |
415 | 415 | |
416 | 416 | |
... | ... | @@ -419,12 +419,13 @@ |
419 | 419 | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(couponReport) && |
420 | 420 | org.apache.commons.collections.CollectionUtils.isNotEmpty(usedInfo)) { |
421 | 421 | if(CollectionUtils.putAll(couponReport, usedInfo, "used_hospital_id", "used_hospital_id")) { |
422 | + | |
422 | 423 | for (Map<String, Object> map : couponReport) { |
423 | 424 | map.put("province_name", findName(map.get("province_id"))); |
424 | 425 | map.put("city_name", findName(map.get("city_id"))); |
425 | 426 | map.put("area_name", findName(map.get("area_id"))); |
426 | 427 | } |
427 | - return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap); | |
428 | +// return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", couponReportMap); | |
428 | 429 | } else{ |
429 | 430 | return RespBuilder.buildErro(ResponseCode.DATA_ERROR); |
430 | 431 | } |
... | ... | @@ -436,8 +437,9 @@ |
436 | 437 | public BaseObjectResponse couponInit(Map<String, Object> param) { |
437 | 438 | List<String> hospitalIds = Arrays.asList("216", "245"); /** 模拟根据登陆人id 查询出来的医院 */ |
438 | 439 | param.put("hospitalIds", hospitalIds); |
439 | - return RespBuilder.buildSuccess("coupons", EnumUtil.toJson(CouponEnums.class, "code", "name"), | |
440 | - "hTemp", couponMapper.findHospitals(param)); | |
440 | + /* return RespBuilder.buildSuccess("coupons", EnumUtil.toJson(CouponEnums.class, "code", "name"), | |
441 | + "hTemp", couponMapper.findHospitals(param));*/ | |
442 | + return RespBuilder.buildSuccess(); | |
441 | 443 | } |
442 | 444 | |
443 | 445 | public static void main(String[] args) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SystemDataSource.java
View file @
7abfea9