Commit 64a590daaef9f3e5e49e5a7a2a479f43b93381dc

Authored by litao
1 parent 217e679dc3

加入优惠券是否发放记录

Showing 7 changed files with 37 additions and 4 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java View file @ 64a590d
... ... @@ -12,7 +12,7 @@
12 12 * @Version: V1.0
13 13 */
14 14 public interface CouponService{
15   - BaseObjectResponse create(String userId, String hospitalId, Integer createUserId);
  15 + BaseObjectResponse create(String userId, String hospitalId, Integer createUserId, String patientId);
16 16  
17 17 BaseObjectResponse validate(String code, Integer type, String hospitalId);
18 18  
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java View file @ 64a590d
... ... @@ -25,6 +25,7 @@
25 25 import org.springframework.data.mongodb.core.MongoTemplate;
26 26 import org.springframework.data.mongodb.core.query.Criteria;
27 27 import org.springframework.data.mongodb.core.query.Query;
  28 +import org.springframework.data.mongodb.core.query.Update;
28 29 import org.springframework.stereotype.Service;
29 30  
30 31 import java.util.*;
... ... @@ -94,7 +95,7 @@
94 95 };
95 96  
96 97 @Override
97   - public BaseObjectResponse create(String userId, String hospitalId, Integer createUserId) {
  98 + public BaseObjectResponse create(String userId, String hospitalId, Integer createUserId, String patientId) {
98 99 if(isCreated(userId, hospitalId)) {
99 100 return RespBuilder.buildErro(ResponseCode.COUPON_IS_CREATED);
100 101 }
... ... @@ -124,6 +125,10 @@
124 125 }
125 126  
126 127 sendCoupon(temps, hospitalId, createUserId, userId, person.getType(), areaCode);
  128 +
  129 + /** 记录为已经发放过优惠券 */
  130 + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(patientId)), Update.update("isSendCoupon", true), Patients.class);
  131 +
127 132 return RespBuilder.buildSuccess();
128 133 }
129 134  
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ 64a590d
... ... @@ -247,6 +247,9 @@
247 247  
248 248 private Integer isAutoFm;
249 249  
  250 + // 是否发放过优惠券
  251 + private boolean isSendCoupon;
  252 +
250 253 public Integer getIsAutoFm() {
251 254 return isAutoFm;
252 255 }
... ... @@ -1053,6 +1056,14 @@
1053 1056  
1054 1057 public void setStreetRegisterId(String streetRegisterId) {
1055 1058 this.streetRegisterId = streetRegisterId;
  1059 + }
  1060 +
  1061 + public boolean isSendCoupon() {
  1062 + return isSendCoupon;
  1063 + }
  1064 +
  1065 + public void setSendCoupon(boolean sendCoupon) {
  1066 + isSendCoupon = sendCoupon;
1056 1067 }
1057 1068  
1058 1069 @Override
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CouponController.java View file @ 64a590d
... ... @@ -57,9 +57,9 @@
57 57 @RequestMapping(method = RequestMethod.POST)
58 58 @ResponseBody
59 59 @TokenRequired
60   - public BaseObjectResponse create(String userId, String hospitalId, HttpServletRequest request) {
  60 + public BaseObjectResponse create(String userId, String hospitalId, String patientId, HttpServletRequest request) {
61 61 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
62   - return couponService.create(userId, hospitalId, loginState.getId());
  62 + return couponService.create(userId, hospitalId, loginState.getId(), patientId);
63 63 }
64 64  
65 65 /**
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 64a590d
... ... @@ -1075,6 +1075,10 @@
1075 1075  
1076 1076 private PregnantInfoResult getResult(Patients p) {
1077 1077 PregnantInfoResult result = new PregnantInfoResult();
  1078 +
  1079 + /** 是否发放过优惠券 */
  1080 + result.setSendCoupon(p.isSendCoupon());
  1081 +
1078 1082 result.setId(p.getId());
1079 1083 /**********孕妇基本信息***************/
1080 1084 result.setPregnantName(p.getUsername());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java View file @ 64a590d
... ... @@ -103,6 +103,9 @@
103 103  
104 104  
105 105 Map<String, Object> map = new HashMap<>();
  106 +
  107 + map.put("isSendCoupon", data.isSendCoupon());
  108 +
106 109 map.put("id", data.getId());
107 110 /* 孕妇基础数据 */
108 111 map.put("username", data.getUsername());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PregnantInfoResult.java View file @ 64a590d
... ... @@ -6,6 +6,9 @@
6 6 * Created by Administrator on 2016/6/15.
7 7 */
8 8 public class PregnantInfoResult {
  9 +
  10 + private boolean isSendCoupon;
  11 +
9 12 /***********孕妇基本信息***********/
10 13  
11 14 //建档Id
... ... @@ -135,6 +138,13 @@
135 138 //分娩状态 0未终止妊娠 1终止妊娠
136 139 private Integer dueStatus;
137 140  
  141 + public boolean isSendCoupon() {
  142 + return isSendCoupon;
  143 + }
  144 +
  145 + public void setSendCoupon(boolean sendCoupon) {
  146 + isSendCoupon = sendCoupon;
  147 + }
138 148  
139 149 public Integer getDueStatus() {
140 150 return dueStatus;