提交 | 用户 | age
|
78d1e8
|
1 |
package com.hx.phip.tool.order; |
C |
2 |
|
|
3 |
import com.hx.common.service.CommonService; |
|
4 |
import com.hx.mybatisTool.SqlSentence; |
f87850
|
5 |
import com.hx.phiappt.common.OrderTotalConstants; |
78d1e8
|
6 |
import com.hx.phiappt.model.consume.ConsumePayItem; |
d3fb23
|
7 |
import com.hx.phiappt.model.order.OrdersTotal; |
C |
8 |
import com.hx.phiappt.model.userMoney.UserMoneyUnclaimed; |
78d1e8
|
9 |
import com.hx.phip.dao.mapper.ConsumePayItemMapper; |
d3fb23
|
10 |
import com.hx.phip.dao.mapper.UserMoneyUnclaimedMapper; |
f87850
|
11 |
import com.hx.util.StringUtils; |
78d1e8
|
12 |
|
C |
13 |
import java.util.HashMap; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
|
d3fb23
|
17 |
/**订单工具类 |
C |
18 |
* @author CJH*/ |
78d1e8
|
19 |
public class OrderTool { |
C |
20 |
|
|
21 |
/**获取一级子单的支付方式 |
|
22 |
* @param orderOneId 子单标识 |
|
23 |
* @param commonService 医生 |
|
24 |
* @return 支付方式集合 |
|
25 |
*/ |
|
26 |
public static List<ConsumePayItem> getOrderOnePay(String orderOneId, CommonService commonService){ |
|
27 |
SqlSentence sqlSentence = new SqlSentence(); |
|
28 |
Map<String,Object> values = new HashMap<>(); |
|
29 |
|
|
30 |
values.put("typeId",orderOneId); |
|
31 |
sqlSentence.sqlSentence("SELECT * FROM consume_pay_item WHERE isDel = 0 AND typeId = #{m.typeId}",values); |
|
32 |
return commonService.selectList(ConsumePayItemMapper.class,sqlSentence); |
|
33 |
} |
|
34 |
|
d3fb23
|
35 |
/**获取活动赠送资金奖励记录*/ |
C |
36 |
public static UserMoneyUnclaimed getActivityGive(OrdersTotal ordersTotal, CommonService commonService){ |
|
37 |
//查找领取记录释放存在 |
|
38 |
//领取记录是否已领取 |
|
39 |
SqlSentence sqlSentence = new SqlSentence(); |
|
40 |
Map<String,Object> values = new HashMap<>(); |
|
41 |
|
|
42 |
values.put("orderId",ordersTotal.getId()); |
|
43 |
values.put("commonId",ordersTotal.getActivityPageCode()); |
|
44 |
sqlSentence.sqlSentence("SELECT * FROM user_money_unclaimed WHERE isDel = 0 AND orderId = #{m.orderId} AND commonId = #{m.commonId}",values); |
|
45 |
return commonService.selectOne(UserMoneyUnclaimedMapper.class,sqlSentence); |
|
46 |
} |
|
47 |
|
cfedbf
|
48 |
/**获取用户活动赠送资金奖励记录-有效*/ |
f87850
|
49 |
public static List<UserMoneyUnclaimed> getActivityGive(String userId,String commonId,Integer isValid, CommonService commonService){ |
cfedbf
|
50 |
//查找领取记录释放存在 |
C |
51 |
//领取记录是否已领取 |
|
52 |
SqlSentence sqlSentence = new SqlSentence(); |
|
53 |
Map<String,Object> values = new HashMap<>(); |
f87850
|
54 |
StringBuilder sql = new StringBuilder(); |
cfedbf
|
55 |
|
f87850
|
56 |
sql.append("SELECT * FROM user_money_unclaimed WHERE isDel = 0"); |
C |
57 |
if(isValid != null){ |
|
58 |
values.put("isValid",isValid); |
|
59 |
sql.append(" AND isValid = #{m.isValid}"); |
|
60 |
} |
|
61 |
if(StringUtils.noNull(userId)){ |
|
62 |
values.put("userId",userId); |
|
63 |
sql.append(" AND userId = #{m.userId}"); |
|
64 |
} |
|
65 |
if(StringUtils.noNull(commonId)){ |
|
66 |
values.put("commonId",commonId); |
|
67 |
sql.append(" AND commonId = #{m.commonId}"); |
|
68 |
} |
|
69 |
sqlSentence.sqlSentence(sql.toString(),values); |
cfedbf
|
70 |
return commonService.selectList(UserMoneyUnclaimedMapper.class,sqlSentence); |
C |
71 |
} |
|
72 |
|
f87850
|
73 |
/**获取用户活动赠送资金奖励记录-获取一条*/ |
C |
74 |
public static UserMoneyUnclaimed getActivityGiveByOrder(OrdersTotal ordersTotal,Integer isValid, CommonService commonService){ |
|
75 |
//根据当前用户,获取到所有的记录 |
|
76 |
//领取记录是否已领取 |
|
77 |
SqlSentence sqlSentence = new SqlSentence(); |
|
78 |
Map<String,Object> values = new HashMap<>(); |
|
79 |
StringBuilder sql = new StringBuilder(); |
|
80 |
|
|
81 |
values.put("commonId",ordersTotal.getActivityPageCode()); |
|
82 |
values.put("userId",ordersTotal.getUserId()); |
|
83 |
values.put("payStatus", OrderTotalConstants.PAY_STATUS_SUC); |
|
84 |
values.put("activityPageType", ordersTotal.getActivityPageType()); |
|
85 |
values.put("activityPageCode", ordersTotal.getActivityPageCode()); |
|
86 |
sql.append("SELECT umu.* FROM orders_total ot "); |
|
87 |
sql.append(" JOIN user_money_unclaimed umu ON umu.orderId = ot.id AND umu.isDel = 0 AND umu.commonId = #{m.commonId}"); |
|
88 |
if(isValid != null){ |
|
89 |
values.put("isValid",isValid); |
|
90 |
sql.append(" AND umu.isValid = #{m.isValid}"); |
|
91 |
} |
|
92 |
sql.append(" WHERE ot.isDel = 0 AND ot.activityPageType = #{m.activityPageType} AND ot.activityPageCode = #{m.activityPageCode}" + |
|
93 |
" AND ot.userId = #{m.userId} AND ot.payStatus = #{m.payStatus} ORDER BY umu.createTime ASC LIMIT 1"); |
|
94 |
|
|
95 |
sqlSentence.sqlSentence(sql.toString(),values); |
|
96 |
return commonService.selectOne(UserMoneyUnclaimedMapper.class,sqlSentence); |
|
97 |
} |
|
98 |
|
78d1e8
|
99 |
|
C |
100 |
} |