Commit 84cf2a5c02f83612654b329a8bf5bd6773da64d4

Authored by litao
1 parent 13df586198

sql更改

Showing 4 changed files with 23 additions and 9 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/CouponService.java View file @ 84cf2a5
... ... @@ -8,7 +8,7 @@
8 8 * @Version: V1.0
9 9 */
10 10 public interface CouponService{
11   - BaseObjectResponse create(String userId, String hospitalId, Integer createUserId);
  11 + BaseObjectResponse create(String userId, String hospitalId, String type, Integer createUserId);
12 12  
13 13 BaseObjectResponse validate(String userId, String code);
14 14  
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/CouponServiceImpl.java View file @ 84cf2a5
... ... @@ -10,10 +10,12 @@
10 10 import com.lyms.platform.permission.service.CouponService;
11 11 import com.lyms.platform.pojo.Patients;
12 12 import org.apache.commons.collections.CollectionUtils;
  13 +import org.apache.commons.lang3.StringUtils;
13 14 import org.apache.commons.lang3.time.DateUtils;
14 15 import org.slf4j.Logger;
15 16 import org.slf4j.LoggerFactory;
16 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.beans.factory.annotation.Value;
17 19 import org.springframework.data.domain.Sort;
18 20 import org.springframework.data.mongodb.core.MongoTemplate;
19 21 import org.springframework.data.mongodb.core.query.Criteria;
... ... @@ -35,6 +37,9 @@
35 37  
36 38 private Logger logger = LoggerFactory.getLogger(CouponServiceImpl.class);
37 39  
  40 + @Value("${or.code.url}")
  41 + private String url;
  42 +
38 43 @Autowired
39 44 private CouponMapper couponMapper;
40 45  
41 46  
42 47  
... ... @@ -45,13 +50,17 @@
45 50 private MongoTemplate mongoTemplate;
46 51  
47 52 @Override
48   - public BaseObjectResponse create(String userId, String hospitalId, Integer createUserId) {
49   - Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId)), Patients.class);
50   - if(patients == null || patients.getType() == null) return RespBuilder.buildErro(ResponseCode.PATIENTS_NOT_FOUND);
51   -
  53 + public BaseObjectResponse create(String userId, String hospitalId, String userType, Integer createUserId) {
52 54 Map<String, Object> param = new HashMap<>();
  55 + if(StringUtils.isNoneBlank(userType)) {
  56 + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(userId)), Patients.class);
  57 + if(patients == null || patients.getType() == null) return RespBuilder.buildErro(ResponseCode.PATIENTS_NOT_FOUND);
  58 + param.put("type", patients.getType());
  59 + } else {
  60 + param.put("type", userType);
  61 + }
  62 +
53 63 param.put("hospitalId", hospitalId);
54   - param.put("type", patients.getType());
55 64 List<Map<String,Object>> temps = couponMapper.findTemp(param);
56 65  
57 66 if(CollectionUtils.isEmpty(temps)) return RespBuilder.buildErro(ResponseCode.COUPON_TEMP_NOT_FOUND);
... ... @@ -173,6 +182,7 @@
173 182 Map<String, Object> restMap = new HashMap<>();
174 183 restMap.put("topName", couponMapper.findTopName(hospitalId));
175 184 restMap.put("couponInfos", couponMapper.findInfo(param));
  185 + restMap.put("url", url);
176 186  
177 187 return RespBuilder.buildSuccess(restMap);
178 188 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CouponController.java View file @ 84cf2a5
... ... @@ -30,14 +30,15 @@
30 30 * 创建用户优惠券
31 31 * @param userId
32 32 * @param hospitalId
  33 + * @param type 1=孕妇 2=产妇 3=儿童
33 34 * @return
34 35 */
35 36 @RequestMapping(method = RequestMethod.POST)
36 37 @ResponseBody
37 38 @TokenRequired
38   - public BaseObjectResponse create(String userId, String hospitalId, HttpServletRequest request) {
  39 + public BaseObjectResponse create(String userId, String hospitalId, String type, HttpServletRequest request) {
39 40 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
40   - return couponService.create(userId, hospitalId, loginState.getId());
  41 + return couponService.create(userId, hospitalId, type, loginState.getId());
41 42 // return couponService.create(userId, hospitalId, 200);
42 43 }
43 44  
platform-operate-api/src/main/resources/database.properties View file @ 84cf2a5
... ... @@ -83,4 +83,7 @@
83 83 sequence.index=200000000000
84 84 sequence.min.size=300
85 85 sequence.schedule.expression=0 */1 * * * ?
  86 +
  87 +# 二维码地址
  88 +or.code.url=http://api.meishengbb.com/scan