Commit 04cc8dd76d0f18c683ae638ee1aec88d749bc2ea
1 parent
160752f4ab
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 136 additions and 9 deletions
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
04cc8dd
... | ... | @@ -553,7 +553,7 @@ |
553 | 553 | #{type} |
554 | 554 | </foreach> |
555 | 555 | <if test="keys.size()>0"> |
556 | - and a.used_id in | |
556 | + and a.user_id in | |
557 | 557 | <foreach collection="keys" open="(" close=")" separator="," item="key"> |
558 | 558 | #{key} |
559 | 559 | </foreach> |
... | ... | @@ -622,7 +622,7 @@ |
622 | 622 | </foreach> |
623 | 623 | |
624 | 624 | <if test="keys.size()>0"> |
625 | - and a.used_id in | |
625 | + and a.user_id in | |
626 | 626 | <foreach collection="keys" open="(" close=")" separator="," item="key"> |
627 | 627 | #{key} |
628 | 628 | </foreach> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/OrgCouponService.java
View file @
04cc8dd
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/OrgCouponServiceImpl.java
View file @
04cc8dd
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | import org.springframework.data.mongodb.core.query.Criteria; |
21 | 21 | import org.springframework.data.mongodb.core.query.Query; |
22 | 22 | import org.springframework.stereotype.Service; |
23 | +import org.springframework.util.Assert; | |
23 | 24 | |
24 | 25 | import java.util.*; |
25 | 26 | |
26 | 27 | |
... | ... | @@ -38,12 +39,107 @@ |
38 | 39 | @Autowired |
39 | 40 | private ApplyOrderService applyOrderService; |
40 | 41 | |
42 | + /** | |
43 | + * 优惠券统计报表key(type + "_" + coupon_order)所对应的header名称 | |
44 | + */ | |
45 | + private static final Map<String, Object> couponReportMap = new HashMap<>(); | |
46 | + | |
47 | + /** | |
48 | + * 优惠券类型描述map | |
49 | + */ | |
50 | + private static final Map<Integer, String> couponDescMap = new HashMap<>(); | |
51 | + | |
52 | + private static final Map<String, String> colorMap = new HashMap<>(); | |
53 | + | |
54 | + private static final Map<Integer, List<Integer>> personCouponMap = new HashMap<>(); | |
55 | + | |
56 | + static { | |
57 | + colorMap.put("绿色预警", "#50e39f"); | |
58 | + colorMap.put("黄色预警", "#ffd84d"); | |
59 | + colorMap.put("橙色预警", "#f17d02"); | |
60 | + colorMap.put("红色预警", "#ff6767"); | |
61 | + colorMap.put("紫色预警", "#be75ff"); | |
62 | + | |
63 | + personCouponMap.put(1, Arrays.asList(1, 2)); | |
64 | + personCouponMap.put(2, Arrays.asList(7, 8)); | |
65 | + personCouponMap.put(3, Arrays.asList(3, 4, 5, 6)); | |
66 | + | |
67 | + /** 孕妇 */ | |
68 | + couponReportMap.put("1_1", "孕期建档券使用人次"); | |
69 | + couponReportMap.put("2_1", "首次产检券使用人次"); | |
70 | + couponReportMap.put("2_2", "产检券(二)券使用人次"); | |
71 | + couponReportMap.put("2_3", "产检券(三)券使用人次"); | |
72 | + couponReportMap.put("2_4", "产检券(四)券使用人次"); | |
73 | + couponReportMap.put("2_5", "产检券(五)券使用人次"); | |
74 | + couponReportMap.put("2_6", "产检券(六)券使用人次"); | |
75 | + couponReportMap.put("2_7", "产检券(七)券使用人次"); | |
76 | + couponReportMap.put("2_8", "产检券(八)券使用人次"); | |
77 | + couponReportMap.put("2_9", "产检券(九)券使用人次"); | |
78 | + couponReportMap.put("2_10", "产检券(十)券使用人次"); | |
79 | + couponReportMap.put("2_11", "产检券(十一)券使用人次"); | |
80 | + couponReportMap.put("2_12", "产检券(十二)券使用人次"); | |
81 | + /** 儿童 */ | |
82 | + couponReportMap.put("7_1", "儿童建档券使用人次"); | |
83 | + couponReportMap.put("8_1", "<div class='ag-double-line'>儿童保健券(一)<div>使用人次</div></div>"); | |
84 | + couponReportMap.put("8_2", "<div class='ag-double-line'>儿童保健券(二)<div>使用人次</div></div>"); | |
85 | + couponReportMap.put("8_3", "<div class='ag-double-line'>儿童保健券(三)<div><div>使用人次</div></div>"); | |
86 | + couponReportMap.put("8_4", "<div class='ag-double-line'>儿童保健券(四)<div>使用人次</div></div>"); | |
87 | + couponReportMap.put("8_5", "<div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div>"); | |
88 | + couponReportMap.put("8_6", "<div class='ag-double-line'>儿童保健券(六)<div>使用人次</div></div>"); | |
89 | + couponReportMap.put("8_7", "<div class='ag-double-line'>儿童保健券(七)<div>使用人次</div></div>"); | |
90 | + couponReportMap.put("8_8", "<div class='ag-double-line'>儿童保健券(八)<div>使用人次</div></div>"); | |
91 | + couponReportMap.put("8_9", "<div class='ag-double-line'>儿童保健券(九)<div>使用人次</div></div>"); | |
92 | + couponReportMap.put("8_10", "<div class='ag-double-line'>儿童保健券(十)<div>使用人次</div></div>"); | |
93 | + couponReportMap.put("8_11", "<div class='ag-double-line'>儿童保健券(十一)<div>使用人次</div></div>"); | |
94 | + couponReportMap.put("8_12", "<div class='ag-double-line'>儿童保健券(十二)<div>使用人次</div></div>"); | |
95 | + couponReportMap.put("9_1", "<div class='ag-double-line'>新生儿访视券(一)<div>使用人次</div></div>"); | |
96 | + couponReportMap.put("9_2", "<div class='ag-double-line'>新生儿访视券(二)<div>使用人次</div></div>"); | |
97 | + couponReportMap.put("9_3", "<div class='ag-double-line'>新生儿访视券(三)<div>使用人次</div></div>"); | |
98 | + couponReportMap.put("9_4", "<div class='ag-double-line'>新生儿访视券(四)<div>使用人次</div></div>"); | |
99 | + couponReportMap.put("9_5", "<div class='ag-double-line'>新生儿访视券(五)<div>使用人次</div></div>"); | |
100 | + couponReportMap.put("9_6", "<div class='ag-double-line'>新生儿访视券(六)<div>使用人次</div></div>"); | |
101 | + couponReportMap.put("9_7", "<div class='ag-double-line'>新生儿访视券(七)<div>使用人次</div></div>"); | |
102 | + couponReportMap.put("9_8", "<div class='ag-double-line'>新生儿访视券(八)<div>使用人次</div></div>"); | |
103 | + couponReportMap.put("9_9", "<div class='ag-double-line'>新生儿访视券(九)<div>使用人次</div></div>"); | |
104 | + couponReportMap.put("10_1", "<div class='ag-double-line'>血红蛋白检查券(一)<div>使用人次</div></div>"); | |
105 | + couponReportMap.put("10_2", "<div class='ag-double-line'>血红蛋白检查券(二)<div>使用人次</div></div>"); | |
106 | + couponReportMap.put("10_3", "<div class='ag-double-line'>血红蛋白检查券(三)<div>使用人次</div></div>"); | |
107 | + couponReportMap.put("10_4", "<div class='ag-double-line'>血红蛋白检查券(四)<div>使用人次</div></div>"); | |
108 | + couponReportMap.put("10_5", "<div class='ag-double-line'>血红蛋白检查券(五)<div>使用人次</div></div>"); | |
109 | + couponReportMap.put("10_6", "<div class='ag-double-line'>血红蛋白检查券(六)<div>使用人次</div></div>"); | |
110 | + couponReportMap.put("10_7", "<div class='ag-double-line'>血红蛋白检查券(七)<div>使用人次</div></div>"); | |
111 | + couponReportMap.put("10_8", "<div class='ag-double-line'>血红蛋白检查券(八)<div>使用人次</div></div>"); | |
112 | + couponReportMap.put("10_9", "<div class='ag-double-line'>血红蛋白检查券(九)<div>使用人次</div></div>"); | |
113 | + couponReportMap.put("10_10", "<div class='ag-double-line'>血红蛋白检查券(十)<div>使用人次</div></div>"); | |
114 | + | |
115 | + couponReportMap.put("11_1", "<div class='ag-double-line'>产筛券<div>使用人次</div></div>"); | |
116 | + /** 产后 */ | |
117 | + couponReportMap.put("3_1", "<div class='ag-double-line'>产后建档券<div>使用人次</div></div>"); | |
118 | + couponReportMap.put("4_1", "<div class='ag-double-line'>分娩券<div>使用人次</div></div>"); | |
119 | + couponReportMap.put("5_1", "<div class='ag-double-line'>出院小结券<div>使用人次</div></div>"); | |
120 | + couponReportMap.put("6_1", "<div class='ag-double-line'>42天访视券<div>使用人次</div></div>"); | |
121 | + couponReportMap.put("6_2", "<div class='ag-double-line'>产后复查券(一)<div>使用人次</div></div>"); | |
122 | + couponReportMap.put("6_3", "<div class='ag-double-line'>产后复查券(二)<div>使用人次</div></div>"); | |
123 | + couponReportMap.put("6_4", "<div class='ag-double-line'>产后复查券(三)<div>使用人次</div></div>"); | |
124 | + couponReportMap.put("6_5", "<div class='ag-double-line'>产后复查券(四)<div>使用人次</div></div>"); | |
125 | + couponReportMap.put("6_6", "<div class='ag-double-line'>产后复查券(五)<div>使用人次</div></div>"); | |
126 | + | |
127 | + /** 1=孕妇建档 2=孕妇产检 3=产妇建档 4=产妇分娩 5=产妇出院小结 6=产妇产后复查 7=儿童建档 8=儿童保健 */ | |
128 | + couponDescMap.put(1, "孕妇建档券"); | |
129 | + couponDescMap.put(2, "孕妇产检券"); | |
130 | + couponDescMap.put(3, "产妇建档券"); | |
131 | + couponDescMap.put(4, "产妇分娩券"); | |
132 | + couponDescMap.put(5, "产妇出院小结券"); | |
133 | + couponDescMap.put(6, "产妇产后复查券"); | |
134 | + couponDescMap.put(7, "儿童建档券"); | |
135 | + couponDescMap.put(8, "儿童保健券"); | |
136 | + } | |
137 | + | |
41 | 138 | @Override |
42 | 139 | public BaseObjectResponse orgCouponInfo(Map<String, Object> param) { |
43 | 140 | Integer currentPage = (Integer) param.get("currentPage"); |
44 | 141 | PageUtil.setPageInfo(param); |
45 | 142 | String key = (String) param.get("key"); |
46 | - System.out.println(key); | |
47 | 143 | List<String> keys = new ArrayList(); |
48 | 144 | if (StringUtils.isNotEmpty(key)) { |
49 | 145 | Criteria criteria = new Criteria(); |
50 | 146 | |
51 | 147 | |
52 | 148 | |
53 | 149 | |
... | ... | @@ -54,16 +150,47 @@ |
54 | 150 | } |
55 | 151 | } |
56 | 152 | param.put("keys", keys); |
57 | - for (String ke : keys) { | |
58 | - System.out.println(ke); | |
153 | + Integer type = 4; | |
154 | + String coupon = (String) param.get("couponType"); /** 选中单个优惠券类型查询时 前端传的是 type_order 目前传入这种的只有使用统计 */ | |
155 | + if (StringUtils.isNotEmpty(coupon)) { | |
156 | + if (coupon.contains("_")) { | |
157 | + String[] split = (coupon + "").split("_"); /** type_order */ | |
158 | + List<String> couponType = CollectionUtils.asList(split[0]); | |
159 | + String order = split[1]; | |
160 | + param.put("couponType", couponType); | |
161 | + param.put("coupon_order", order); | |
162 | + type = 4; | |
163 | + } else { | |
164 | + param.put("couponType", CollectionUtils.asList(coupon)); | |
165 | + } | |
59 | 166 | } |
60 | - String coupon = (String) param.get("couponType"); | |
61 | - param.put("couponType", CollectionUtils.asList(coupon)); | |
167 | + | |
168 | + Assert.notNull(type, "type must not be null!"); | |
169 | + | |
62 | 170 | /** 使用详情统计 */ |
171 | +// List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param); | |
63 | 172 | List<Map<String, Object>> couponInfos = couponMapper.couponInfo2(param); |
64 | 173 | String subTitle = null; |
174 | + Set<String> subTitleTempSet = new HashSet<>(); | |
175 | + | |
65 | 176 | if (CollectionUtils.isNotEmpty(couponInfos)) { |
66 | 177 | for (Map<String, Object> couponInfo : couponInfos) { |
178 | + String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order")); | |
179 | + if (StringUtils.isNotBlank(desc)) { | |
180 | + /** <div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div> */ | |
181 | + String s = desc.replace("使用人次", "") | |
182 | + .replace("<div class='ag-double-line'>", "") | |
183 | + .replace("<div>", "") | |
184 | + .replace("</div>", ""); | |
185 | + if (subTitleTempSet.add(s)) { | |
186 | + if (StringUtils.isEmpty(subTitle)) { | |
187 | + subTitle = s; | |
188 | + } else { | |
189 | + subTitle += "/" + s; | |
190 | + } | |
191 | + } | |
192 | + couponInfo.put("type_desc", s); | |
193 | + } | |
67 | 194 | Date useDate = (Date) couponInfo.get("use_date"); |
68 | 195 | couponInfo.put("use_date", DateUtil.getyyyy_MM_dd(useDate)); |
69 | 196 | /** 设置产检日期、姓名、产检孕周、产检第次、产检机构、产检医生、联系电话 */ |
... | ... | @@ -77,7 +204,8 @@ |
77 | 204 | return RespBuilder.buildSuccess(pageResult); |
78 | 205 | } |
79 | 206 | |
80 | - private void setUsedInfo(Integer type, String usedId, String sequence_id, Date useDate, String operatorUserId, Map<String, Object> map) { | |
207 | + private void setUsedInfo(Integer type, String usedId, String sequence_id, Date useDate, String | |
208 | + operatorUserId, Map<String, Object> map) { | |
81 | 209 | Date checkDate = null; /** 产检日期 */ |
82 | 210 | String username = null; /** 姓名 */ |
83 | 211 | String week = null; /** 产检孕周 = 产检时间 - 末次月经 */ |