Commit 995cd95460fbd214c3ea0c70f0c6ffe3e1dbe54b
1 parent
7bb5cc7efa
Exists in
master
and in
6 other branches
update
Showing 7 changed files with 131 additions and 2 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java
View file @
995cd95
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | */ |
| 14 | 14 | public interface CouponMapper { |
| 15 | 15 | List<CouponInfo> findList(Map<String, Object> params); |
| 16 | + List<CouponInfo> findLists(Map<String, Object> params); | |
| 16 | 17 | List<Map<String,Object>> findCouponList(Map<String, Object> params); |
| 17 | 18 | |
| 18 | 19 | List<CouponInfo> findErrorData(); |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java
View file @
995cd95
| 1 | 1 | package com.lyms.platform.permission.service; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 4 | +import com.lyms.platform.permission.model.CouponInfo; | |
| 4 | 5 | |
| 5 | 6 | import java.util.Date; |
| 6 | 7 | import java.util.List; |
| ... | ... | @@ -61,5 +62,12 @@ |
| 61 | 62 | String findByType(String id, int i); |
| 62 | 63 | |
| 63 | 64 | void invalid2(String pid, Date created, String s); |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 获取用户能用的优惠劵数量 | |
| 68 | + * @param userId | |
| 69 | + * @return | |
| 70 | + */ | |
| 71 | + int getUserCouponCanUseCount(String userId); | |
| 64 | 72 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java
View file @
995cd95
| ... | ... | @@ -690,6 +690,18 @@ |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | @Override |
| 693 | + public int getUserCouponCanUseCount(String userId) { | |
| 694 | + | |
| 695 | + Map<String, Object> param = new HashMap<>(); | |
| 696 | + param.put("userId", userId); | |
| 697 | + param.put("type", 2); | |
| 698 | + param.put("status", 1); | |
| 699 | + List<CouponInfo> couponInfos = couponMapper.findLists(param); | |
| 700 | + | |
| 701 | + return couponInfos.size(); | |
| 702 | + } | |
| 703 | + | |
| 704 | + @Override | |
| 693 | 705 | public List<Map<String, Object>> queryCouponItemsByType(Map<String, Object> params) { |
| 694 | 706 | return couponMapper.queryCouponItemsByType(params); |
| 695 | 707 | } |
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
995cd95
| ... | ... | @@ -61,6 +61,28 @@ |
| 61 | 61 | </select> |
| 62 | 62 | |
| 63 | 63 | |
| 64 | + <select id="findLists" parameterType="map" resultMap="couponInfoMap"> | |
| 65 | + select id, | |
| 66 | + <include refid="columnList"/> | |
| 67 | + from coupon_info | |
| 68 | + <where> | |
| 69 | + <if test="userId != null"> | |
| 70 | + and user_id = #{userId} | |
| 71 | + </if> | |
| 72 | + <if test="code != null"> | |
| 73 | + and sequence_id = #{code} | |
| 74 | + </if> | |
| 75 | + <if test="hospitalId != null"> | |
| 76 | + and create_hospital_id = #{hospitalId} | |
| 77 | + </if> | |
| 78 | + <if test="status != null"> | |
| 79 | + and status = #{status} | |
| 80 | + </if> | |
| 81 | + </where> | |
| 82 | + </select> | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 64 | 86 | <select id="findCouponList" parameterType="map" resultType="map"> |
| 65 | 87 | select b.actual_start, b.actual_end, b.unit_type, a.create_hospital_id, c.type, c.area_type,a.status |
| 66 | 88 | from coupon_info a, coupon_template b, coupon_type c |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
995cd95
| ... | ... | @@ -376,7 +376,8 @@ |
| 376 | 376 | |
| 377 | 377 | private String lowerHairOgrId; |
| 378 | 378 | |
| 379 | - | |
| 379 | + // 是否发放过优惠券 | |
| 380 | + private Boolean isSendCoupon; | |
| 380 | 381 | //条码号 |
| 381 | 382 | private String numberCode; |
| 382 | 383 | |
| 383 | 384 | |
| ... | ... | @@ -391,7 +392,14 @@ |
| 391 | 392 | private Date firstCheckTimeStart; |
| 392 | 393 | private Date firstCheckTimeEnd; |
| 393 | 394 | |
| 395 | + public Boolean getIsSendCoupon() { | |
| 396 | + return isSendCoupon; | |
| 397 | + } | |
| 394 | 398 | |
| 399 | + public void setIsSendCoupon(Boolean isSendCoupon) { | |
| 400 | + this.isSendCoupon = isSendCoupon; | |
| 401 | + } | |
| 402 | + | |
| 395 | 403 | public String getFirstCheckId() { |
| 396 | 404 | return firstCheckId; |
| 397 | 405 | } |
| ... | ... | @@ -538,6 +546,9 @@ |
| 538 | 546 | |
| 539 | 547 | if (null != pcensusTypeId) { |
| 540 | 548 | condition = condition.and("pcensusTypeId", pcensusTypeId, MongoOper.IS); |
| 549 | + } | |
| 550 | + if (null != isSendCoupon) { | |
| 551 | + condition = condition.and("isSendCoupon", isSendCoupon, MongoOper.IS); | |
| 541 | 552 | } |
| 542 | 553 | if (null != numberCode) { |
| 543 | 554 | condition = condition.and("numberCode", numberCode, MongoOper.IS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
995cd95
| ... | ... | @@ -165,7 +165,12 @@ |
| 165 | 165 | @Autowired |
| 166 | 166 | private SieveService sieveService; |
| 167 | 167 | |
| 168 | + | |
| 169 | + | |
| 168 | 170 | @Autowired |
| 171 | + private PatientFacade patientFacade; | |
| 172 | + | |
| 173 | + @Autowired | |
| 169 | 174 | private BabySieveFacede babySieveFacede; |
| 170 | 175 | |
| 171 | 176 | @Autowired |
| ... | ... | @@ -218,6 +223,12 @@ |
| 218 | 223 | //增加产筛申请单 |
| 219 | 224 | public BaseResponse updateSieveApplyOrder() { |
| 220 | 225 | babySieveFacede.babyShortMessageQhdTimerWork(); |
| 226 | + return null; | |
| 227 | + } | |
| 228 | + @RequestMapping(method = RequestMethod.GET, value = "/noticeCouponUser") | |
| 229 | + @ResponseBody | |
| 230 | + public BaseResponse noticeCouponUser() { | |
| 231 | + patientFacade.noticeCouponUser(); | |
| 221 | 232 | return null; |
| 222 | 233 | } |
| 223 | 234 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
995cd95
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | import com.lyms.platform.permission.model.Organization; |
| 27 | 27 | import com.lyms.platform.permission.model.OrganizationQuery; |
| 28 | 28 | import com.lyms.platform.permission.model.Users; |
| 29 | +import com.lyms.platform.permission.service.CouponService; | |
| 29 | 30 | import com.lyms.platform.permission.service.OrganizationService; |
| 30 | 31 | import com.lyms.platform.permission.service.UsersService; |
| 31 | 32 | import com.lyms.platform.pojo.*; |
| ... | ... | @@ -1203,7 +1204,7 @@ |
| 1203 | 1204 | * @param list |
| 1204 | 1205 | */ |
| 1205 | 1206 | private static void ListSort(List <Patients> list) { |
| 1206 | - Collections.sort(list, new Comparator <Patients>() { | |
| 1207 | + Collections.sort(list, new Comparator<Patients>() { | |
| 1207 | 1208 | @Override |
| 1208 | 1209 | public int compare(Patients o1, Patients o2) { |
| 1209 | 1210 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| ... | ... | @@ -3142,5 +3143,68 @@ |
| 3142 | 3143 | baseResponse.setObject(result); |
| 3143 | 3144 | return baseResponse; |
| 3144 | 3145 | } |
| 3146 | + | |
| 3147 | + | |
| 3148 | + /** | |
| 3149 | + * 30孕周的孕妇 提醒孕妇还有多少优惠劵没有使用 | |
| 3150 | + */ | |
| 3151 | + public void noticeCouponUser() | |
| 3152 | + { | |
| 3153 | + | |
| 3154 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 3155 | + Date endDate = DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(30 * 7)); | |
| 3156 | + patientsQuery.setLastMensesStart(endDate); | |
| 3157 | + patientsQuery.setLastMensesEnd(endDate); | |
| 3158 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 3159 | + patientsQuery.setIsSendCoupon(true); | |
| 3160 | + List<Patients> patients = patientsService.queryPatient(patientsQuery); | |
| 3161 | + if (CollectionUtils.isNotEmpty(patients)) | |
| 3162 | + { | |
| 3163 | + | |
| 3164 | + for (Patients patient : patients) | |
| 3165 | + { | |
| 3166 | + int count = couponService.getUserCouponCanUseCount(patient.getPid()); | |
| 3167 | + if (count == 0) | |
| 3168 | + { | |
| 3169 | + continue; | |
| 3170 | + } | |
| 3171 | + | |
| 3172 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 3173 | + MsgRequest mr = new MsgRequest(); | |
| 3174 | + mr.setFirst("您还有"+count+"张优惠券未使用,去医院产检时,记得同时使用,主动把优惠券出示给医护人员!"); | |
| 3175 | + mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 3176 | + mr.setPhone(patient.getPhone()); | |
| 3177 | + | |
| 3178 | + mr.setTimeType(SmsTimeTypeEnums.NO_ONTIME.getId()); | |
| 3179 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd(new Date())+" 16:00:00"); | |
| 3180 | + | |
| 3181 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 3182 | + mr.setSubTypeId(SmsServiceEnums.FWKT.getId()); | |
| 3183 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 3184 | + mr.setHospitalId(patient.getHospitalId()); | |
| 3185 | + mr.setTempId(patient.getId()); | |
| 3186 | + mr.setPatientId(patient.getId()); | |
| 3187 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 3188 | + mr.setServiceType(2); //判断发送类型 | |
| 3189 | + | |
| 3190 | + mr.setKeyword1("优惠劵提醒"); | |
| 3191 | + mr.setKeyword2(DateUtil.getyyyy_MM_dd(new Date())); | |
| 3192 | + mr.setRemark(""); | |
| 3193 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 3194 | + | |
| 3195 | + mr.setWxTempId(WxTempleteIdEnums.YUN_FU_OPEN.getId()); | |
| 3196 | + messages.add(mr); | |
| 3197 | + ExceptionUtils.catchException("patient build msg = " + messages); | |
| 3198 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 3199 | + smsConfigFacade.saveMsg(messages, patient.getHospitalId()); | |
| 3200 | + } | |
| 3201 | + | |
| 3202 | + } | |
| 3203 | + } | |
| 3204 | + } | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + @Autowired | |
| 3208 | + private CouponService couponService; | |
| 3145 | 3209 | } |