diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java index ea2dcb4..02db61a 100644 --- a/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java @@ -80,4 +80,6 @@ public interface CouponMapper { List findCouponTitleByTemp(Map param); List> findUserSendInfo(Map param); + + Integer findUserSendInfoCount(Map param); } diff --git a/platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml b/platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml index a42dc2a..9c18ed2 100644 --- a/platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml +++ b/platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml @@ -427,5 +427,45 @@ coupon_info a, coupon_template b, coupon_type c, organization d, users e, users f where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id and a.user_id = e.id and a.create_user_id = f.id + and a.create_hospital_id in + + #{hid} + + and c.type in + + #{type} + + + and a.create_date >= #{startDate} + + + and a.create_date #{endDate} + + limit #{currentPage},#{pageSize} + + + \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java index 6a4036c..0df3ecc 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java @@ -25,6 +25,7 @@ import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; +import org.springframework.util.Assert; import scala.util.parsing.combinator.testing.Str; import javax.servlet.http.HttpServletResponse; @@ -673,6 +674,9 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService return RespBuilder.buildSuccess(new PageResult(0, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", new ArrayList<>()))); } Integer type = (Integer) param.get("type"); + + Assert.notNull(type, "type must not be null!"); + if(type == 4) { /** 使用详情统计 */ List> couponInfos = couponMapper.couponInfo(param); if(CollectionUtils.isNotEmpty(couponInfos)) { @@ -699,11 +703,34 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService return RespBuilder.buildSuccess(pageResult); } if(type == 1) { /** 发放人数统计 */ List> userSendInfo = couponMapper.findUserSendInfo(param); - System.err.println(userSendInfo); + Integer count = couponMapper.findUserSendInfoCount(param); + for (Map map : userSendInfo) { + String userId = (String) map.get("user_id"); + if(StringUtils.isNotEmpty(userId)) { + setUserSendInfo(userId, map); /** 设置居住地、户籍地、电话 */ + } + map.put("create_date", DateUtil.getyyyy_MM_dd((Date) map.get("create_date"))); + } + PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("userSendInfos", userSendInfo)); + return RespBuilder.buildSuccess(pageResult); } return RespBuilder.buildSuccess(); } + + private void setUserSendInfo(String userId, Map map) { + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId)), Patients.class); + if(patients != null) { + map.put("phone", patients.getPhone()); + + String residenceAddress = findName(patients.getProvinceRegisterId()) + findName(patients.getCityRegisterId()) + findName(patients.getAreaRegisterId()); + map.put("residenceAddress", residenceAddress.replace("null", "")); /** 居住地 */ + + String householdAddress = findName(patients.getProvinceId()) + findName(patients.getCityId()) + findName(patients.getAreaId()) + findName(patients.getStreetId()) + findName(patients.getAddress()); + map.put("householdAddress", householdAddress.replace("null", "")); /** 户籍地 */ + } + } + /** * type * 1=孕妇建档 lyms_patient