Showing
24 changed files
with
686 additions
and
18 deletions
1 | +package com.cjs.site.action.user.fund; | ||
2 | + | ||
3 | +import com.cjs.site.biz.user.pick.PickPayBiz; | ||
4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
5 | +import org.springframework.stereotype.Controller; | ||
6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
9 | + | ||
10 | +import javax.servlet.http.HttpServletRequest; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by bruce on 2019-05-14 13:41 | ||
14 | + */ | ||
15 | +@Controller | ||
16 | +@RequestMapping("/pick/pay") | ||
17 | +public class PickPayAction { | ||
18 | + | ||
19 | + @Autowired | ||
20 | + private PickPayBiz pickPayBiz; | ||
21 | + | ||
22 | + //创建订单 | ||
23 | + @RequestMapping(value = "/createOrder", method = RequestMethod.GET) | ||
24 | + @ResponseBody | ||
25 | + public Object createOrder() { | ||
26 | + return pickPayBiz.createOrder(); | ||
27 | + } | ||
28 | + | ||
29 | + //支付通知 | ||
30 | + @RequestMapping(value = "notify", method = RequestMethod.POST) | ||
31 | + public String notify(HttpServletRequest request) { | ||
32 | + pickPayBiz.isValidNotify(request); | ||
33 | + return "/jsp/payResult.jsp"; | ||
34 | + } | ||
35 | + | ||
36 | +} |
... | @@ -92,7 +92,7 @@ public class PickAction { | ... | @@ -92,7 +92,7 @@ public class PickAction { |
92 | } | 92 | } |
93 | 93 | ||
94 | /**自提*/ | 94 | /**自提*/ |
95 | - @RequestMapping("self") | 95 | + @RequestMapping("self")//todo 自提方式重定向页面应跳转到待支付页面 |
96 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, | 96 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, |
97 | RedirectAttributes attributes) { | 97 | RedirectAttributes attributes) { |
98 | ResultInfo resultInfo = pickBiz.selfPick(pickInfo); | 98 | ResultInfo resultInfo = pickBiz.selfPick(pickInfo); |
... | @@ -101,7 +101,7 @@ public class PickAction { | ... | @@ -101,7 +101,7 @@ public class PickAction { |
101 | if (resultInfo.getCode() == 0) { | 101 | if (resultInfo.getCode() == 0) { |
102 | return "user/pick/self.jsp"; | 102 | return "user/pick/self.jsp"; |
103 | } | 103 | } |
104 | - return "redirect:/user/pick/success?pickType=self"; | 104 | + return "redirect:/user/pick/payInfo?pickType=2"; |
105 | } | 105 | } |
106 | 106 | ||
107 | /**网点自提*/ | 107 | /**网点自提*/ |
... | @@ -115,7 +115,7 @@ public class PickAction { | ... | @@ -115,7 +115,7 @@ public class PickAction { |
115 | } | 115 | } |
116 | attributes.addFlashAttribute("warehouse", | 116 | attributes.addFlashAttribute("warehouse", |
117 | warehouseDao.queryByCode(pickInfo.getWarehouseCode())); | 117 | warehouseDao.queryByCode(pickInfo.getWarehouseCode())); |
118 | - return "redirect:/user/pick/success?pickType=self"; | 118 | + return "redirect:/user/pick/payInfo?pickType=2"; |
119 | } | 119 | } |
120 | 120 | ||
121 | /**顺丰到付*/ | 121 | /**顺丰到付*/ |
... | @@ -134,7 +134,7 @@ public class PickAction { | ... | @@ -134,7 +134,7 @@ public class PickAction { |
134 | } | 134 | } |
135 | 135 | ||
136 | /**转赵涌在线拍卖*/ | 136 | /**转赵涌在线拍卖*/ |
137 | - @RequestMapping("zhaoonline") | 137 | + @RequestMapping("zhaoonline")//todo `转赵涌在线拍卖跳转 |
138 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, | 138 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, |
139 | RedirectAttributes attributes) { | 139 | RedirectAttributes attributes) { |
140 | ResultInfo resultInfo = pickBiz.zhaoonlinePick(pickInfo); | 140 | ResultInfo resultInfo = pickBiz.zhaoonlinePick(pickInfo); |
... | @@ -180,7 +180,7 @@ public class PickAction { | ... | @@ -180,7 +180,7 @@ public class PickAction { |
180 | pickTotal += apply.getOccurAmount(); | 180 | pickTotal += apply.getOccurAmount(); |
181 | } | 181 | } |
182 | Double totoalAmount = 0.01D * DateUtil.getTrustCycle() * pickTotal; | 182 | Double totoalAmount = 0.01D * DateUtil.getTrustCycle() * pickTotal; |
183 | - model.addAttribute("pickType",pickType); | 183 | + model.addAttribute("pickType", pickType); |
184 | model.addAttribute("applyList", applyList); | 184 | model.addAttribute("applyList", applyList); |
185 | model.addAttribute("warehousingCharges", totoalAmount); | 185 | model.addAttribute("warehousingCharges", totoalAmount); |
186 | model.addAttribute("totalAmount", totoalAmount + 6D); | 186 | model.addAttribute("totalAmount", totoalAmount + 6D); | ... | ... |
... | @@ -529,7 +529,7 @@ public class PickBiz { | ... | @@ -529,7 +529,7 @@ public class PickBiz { |
529 | } | 529 | } |
530 | 530 | ||
531 | /**生成订单号*/ | 531 | /**生成订单号*/ |
532 | - private String createPickNo() { | 532 | + public String createPickNo() { |
533 | String pickNo = DateUtil.getNow(DateEnum.UNSIGNED_DATE); | 533 | String pickNo = DateUtil.getNow(DateEnum.UNSIGNED_DATE); |
534 | String sequence = jedisTemplate.incr(pickNo).toString(); | 534 | String sequence = jedisTemplate.incr(pickNo).toString(); |
535 | sequence = StringUtils.leftPad(sequence, 4, "0"); | 535 | sequence = StringUtils.leftPad(sequence, 4, "0"); | ... | ... |
1 | +package com.cjs.site.biz.user.pick; | ||
2 | + | ||
3 | +import com.cjs.site.dao.user.pick.OutpropApplyPayDao; | ||
4 | +import com.cjs.site.dao.user.pick.PickPackDao; | ||
5 | +import com.cjs.site.model.union.CreateQrCode; | ||
6 | +import com.cjs.site.model.union.UnionResponse; | ||
7 | +import com.cjs.site.model.user.pick.OutpropApplyPayInfo; | ||
8 | +import com.cjs.site.model.user.pick.PickPackInfo; | ||
9 | +import com.cjs.site.util.lang.DateEnum; | ||
10 | +import com.cjs.site.util.lang.DateUtil; | ||
11 | +import com.cjs.site.util.lang.JsonUtil; | ||
12 | +import com.cjs.site.util.union.UnionConstants; | ||
13 | +import com.cjs.site.util.union.UnionPayUtil; | ||
14 | +import com.cjs.site.util.web.ActionUtil; | ||
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
16 | +import org.springframework.beans.factory.annotation.Qualifier; | ||
17 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
18 | +import org.springframework.stereotype.Service; | ||
19 | +import org.springframework.transaction.TransactionDefinition; | ||
20 | +import org.springframework.transaction.TransactionStatus; | ||
21 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
22 | + | ||
23 | +import javax.servlet.http.HttpServletRequest; | ||
24 | +import java.util.HashMap; | ||
25 | +import java.util.List; | ||
26 | +import java.util.Map; | ||
27 | + | ||
28 | +/** | ||
29 | + * Created by bruce on 2019-05-06 17:22 | ||
30 | + */ | ||
31 | +@Service | ||
32 | +public class PickPayBiz { | ||
33 | + | ||
34 | + @Autowired | ||
35 | + private OutpropApplyPayDao outpropApplyPayDao; | ||
36 | + @Autowired | ||
37 | + private PickPackDao pickPackDao; | ||
38 | + @Autowired | ||
39 | + private PickBiz pickBiz; | ||
40 | + @Autowired | ||
41 | + @Qualifier("transactionManagerOracle") | ||
42 | + private DataSourceTransactionManager transactionManager; | ||
43 | + | ||
44 | + public Map<String, Object> createOrder() { | ||
45 | + Map<String, Object> result = new HashMap<String, Object>(); | ||
46 | + result.put("code", true); | ||
47 | + | ||
48 | + String userId = ActionUtil.getUser().getUserId(); | ||
49 | + List<PickPackInfo> applyList = pickPackDao.queryUserPosition(userId); | ||
50 | + int pickTotal = 0; | ||
51 | + for (PickPackInfo apply : applyList) { | ||
52 | + pickTotal += apply.getCurrentAmount(); | ||
53 | + } | ||
54 | + Double totalAmount = (0.01D * DateUtil.getTrustCycle() * pickTotal) + 6D; | ||
55 | + result.put("totalAmount", totalAmount); | ||
56 | + String pickNo = pickBiz.createPickNo(); | ||
57 | + try { | ||
58 | + CreateQrCode createQrCode = new CreateQrCode(); | ||
59 | + createQrCode.setBillNo(UnionPayUtil.getOrderNo()); | ||
60 | + createQrCode.setTotalAmount(totalAmount.toString()); | ||
61 | + createQrCode.setRequestTimestamp(DateUtil.getNow()); | ||
62 | + createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | ||
63 | + createQrCode.setSrcReserve(pickNo); | ||
64 | + @SuppressWarnings("unchecked") | ||
65 | + Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | ||
66 | + String json = UnionPayUtil.sendPost(UnionConstants.CREATE_ORDER, mapTypes); | ||
67 | + UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | ||
68 | + if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { | ||
69 | + result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getBillNo())); | ||
70 | + insertPickPay(userId, createQrCode.getBillNo(), pickNo); | ||
71 | + } else { | ||
72 | + result.put("code", false); | ||
73 | + result.put("msg", response.getErrMsg()); | ||
74 | + } | ||
75 | + } catch (Exception e) { | ||
76 | + result.put("code", false); | ||
77 | + result.put("msg", e.getMessage()); | ||
78 | + } | ||
79 | + return result; | ||
80 | + } | ||
81 | + | ||
82 | + public Boolean isValidNotify(HttpServletRequest request) { | ||
83 | + Map<String, String> result = UnionPayUtil.getRequestParams(request); | ||
84 | + if (UnionPayUtil.checkSign(result)) { | ||
85 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
86 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
87 | + TransactionStatus status = transactionManager.getTransaction(def); | ||
88 | + try { | ||
89 | + OutpropApplyPayInfo info = outpropApplyPayDao.selectByTradeNo(result.get("billNo")); | ||
90 | + if (!info.getStatus().equals("2")) { | ||
91 | + OutpropApplyPayInfo update = new OutpropApplyPayInfo(); | ||
92 | + update.setTradeNo(result.get("srcReserve")); | ||
93 | + update.setStatus("2"); | ||
94 | + outpropApplyPayDao.update(update); | ||
95 | + | ||
96 | + //todo 更新库存,生成提货单<包含提货类型,提货人,提货日期,保价费> | ||
97 | + } | ||
98 | + transactionManager.commit(status); | ||
99 | + return true; | ||
100 | + } catch (Exception e) { | ||
101 | + transactionManager.rollback(status); | ||
102 | + } | ||
103 | + } | ||
104 | + return false; | ||
105 | + } | ||
106 | + | ||
107 | + private void insertPickPay(String clientId, String tradeNo, String applyNo) { | ||
108 | + OutpropApplyPayInfo insert = new OutpropApplyPayInfo(); | ||
109 | + insert.setCreatedAt(DateUtil.getNow()); | ||
110 | + insert.setClientId(clientId); | ||
111 | + insert.setStatus("1"); | ||
112 | + insert.setTradeNo(tradeNo); | ||
113 | + insert.setApplyNo(applyNo); | ||
114 | + outpropApplyPayDao.insert(insert); | ||
115 | + } | ||
116 | + | ||
117 | +} |
1 | +package com.cjs.site.dao.user.pick; | ||
2 | + | ||
3 | +import com.cjs.site.model.user.pick.OutpropApplyPayInfo; | ||
4 | +import org.springframework.stereotype.Repository; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by bruce on 2019-05-06 16:22 | ||
8 | + */ | ||
9 | +@Repository | ||
10 | +public interface OutpropApplyPayDao { | ||
11 | + | ||
12 | + void insert(OutpropApplyPayInfo entity); | ||
13 | + | ||
14 | + void update(OutpropApplyPayInfo entity); | ||
15 | + | ||
16 | + OutpropApplyPayInfo selectByTradeNo(String tradeNo); | ||
17 | + | ||
18 | +} |
1 | +package com.cjs.site.model.union; | ||
2 | + | ||
3 | +import com.cjs.site.util.union.UnionConstants; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | + | ||
7 | +/** | ||
8 | + * Created by bruce on 2019-05-14 11:00 | ||
9 | + */ | ||
10 | +public class CreateQrCode implements Serializable { | ||
11 | + | ||
12 | + private static final long serialVersionUID = 4945657951041450816L; | ||
13 | + | ||
14 | + private String msgSrc = "赵涌牛"; | ||
15 | + private String msgType = "bills.getQRCode"; | ||
16 | + private String requestTimestamp; | ||
17 | + private String srcReserve; | ||
18 | + private String mid = UnionConstants.MID; | ||
19 | + private String tid = UnionConstants.TID; | ||
20 | + private String instMid = "QRPAYDEFAULT"; | ||
21 | + private String billNo; | ||
22 | + private String billDate; | ||
23 | + private String totalAmount; | ||
24 | + | ||
25 | + public String getMsgSrc() { | ||
26 | + return msgSrc; | ||
27 | + } | ||
28 | + | ||
29 | + public void setMsgSrc(String msgSrc) { | ||
30 | + this.msgSrc = msgSrc; | ||
31 | + } | ||
32 | + | ||
33 | + public String getMsgType() { | ||
34 | + return msgType; | ||
35 | + } | ||
36 | + | ||
37 | + public void setMsgType(String msgType) { | ||
38 | + this.msgType = msgType; | ||
39 | + } | ||
40 | + | ||
41 | + public String getRequestTimestamp() { | ||
42 | + return requestTimestamp; | ||
43 | + } | ||
44 | + | ||
45 | + public void setRequestTimestamp(String requestTimestamp) { | ||
46 | + this.requestTimestamp = requestTimestamp; | ||
47 | + } | ||
48 | + | ||
49 | + public String getSrcReserve() { | ||
50 | + return srcReserve; | ||
51 | + } | ||
52 | + | ||
53 | + public void setSrcReserve(String srcReserve) { | ||
54 | + this.srcReserve = srcReserve; | ||
55 | + } | ||
56 | + | ||
57 | + public String getMid() { | ||
58 | + return mid; | ||
59 | + } | ||
60 | + | ||
61 | + public void setMid(String mid) { | ||
62 | + this.mid = mid; | ||
63 | + } | ||
64 | + | ||
65 | + public String getTid() { | ||
66 | + return tid; | ||
67 | + } | ||
68 | + | ||
69 | + public void setTid(String tid) { | ||
70 | + this.tid = tid; | ||
71 | + } | ||
72 | + | ||
73 | + public String getInstMid() { | ||
74 | + return instMid; | ||
75 | + } | ||
76 | + | ||
77 | + public void setInstMid(String instMid) { | ||
78 | + this.instMid = instMid; | ||
79 | + } | ||
80 | + | ||
81 | + public String getBillNo() { | ||
82 | + return billNo; | ||
83 | + } | ||
84 | + | ||
85 | + public void setBillNo(String billNo) { | ||
86 | + this.billNo = billNo; | ||
87 | + } | ||
88 | + | ||
89 | + public String getBillDate() { | ||
90 | + return billDate; | ||
91 | + } | ||
92 | + | ||
93 | + public void setBillDate(String billDate) { | ||
94 | + this.billDate = billDate; | ||
95 | + } | ||
96 | + | ||
97 | + public String getTotalAmount() { | ||
98 | + return totalAmount; | ||
99 | + } | ||
100 | + | ||
101 | + public void setTotalAmount(String totalAmount) { | ||
102 | + this.totalAmount = totalAmount; | ||
103 | + } | ||
104 | +} |
1 | +package com.cjs.site.model.union; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by bruce on 2019-05-14 10:59 | ||
7 | + */ | ||
8 | +public class UnionResponse implements Serializable { | ||
9 | + | ||
10 | + private static final long serialVersionUID = 890856890563059584L; | ||
11 | + | ||
12 | + private String errCode; | ||
13 | + private String errMsg; | ||
14 | + private String msgSrc; | ||
15 | + private String responseTimestamp; | ||
16 | + private String srcReserve; | ||
17 | + private String sign; | ||
18 | + | ||
19 | + public String getErrCode() { | ||
20 | + return errCode; | ||
21 | + } | ||
22 | + | ||
23 | + public void setErrCode(String errCode) { | ||
24 | + this.errCode = errCode; | ||
25 | + } | ||
26 | + | ||
27 | + public String getErrMsg() { | ||
28 | + return errMsg; | ||
29 | + } | ||
30 | + | ||
31 | + public void setErrMsg(String errMsg) { | ||
32 | + this.errMsg = errMsg; | ||
33 | + } | ||
34 | + | ||
35 | + public String getMsgSrc() { | ||
36 | + return msgSrc; | ||
37 | + } | ||
38 | + | ||
39 | + public void setMsgSrc(String msgSrc) { | ||
40 | + this.msgSrc = msgSrc; | ||
41 | + } | ||
42 | + | ||
43 | + public String getResponseTimestamp() { | ||
44 | + return responseTimestamp; | ||
45 | + } | ||
46 | + | ||
47 | + public void setResponseTimestamp(String responseTimestamp) { | ||
48 | + this.responseTimestamp = responseTimestamp; | ||
49 | + } | ||
50 | + | ||
51 | + public String getSrcReserve() { | ||
52 | + return srcReserve; | ||
53 | + } | ||
54 | + | ||
55 | + public void setSrcReserve(String srcReserve) { | ||
56 | + this.srcReserve = srcReserve; | ||
57 | + } | ||
58 | + | ||
59 | + public String getSign() { | ||
60 | + return sign; | ||
61 | + } | ||
62 | + | ||
63 | + public void setSign(String sign) { | ||
64 | + this.sign = sign; | ||
65 | + } | ||
66 | +} |
1 | +package com.cjs.site.model.user.pick; | ||
2 | + | ||
3 | +import com.cjs.site.model.BaseInfo; | ||
4 | + | ||
5 | +/** | ||
6 | + * Created by bruce on 2019-05-06 16:25 | ||
7 | + */ | ||
8 | +public class OutpropApplyPayInfo extends BaseInfo { | ||
9 | + | ||
10 | + private static final long serialVersionUID = 6737890770319470632L; | ||
11 | + | ||
12 | + private String tradeNo; | ||
13 | + private String clientId; | ||
14 | + private String applyNo; | ||
15 | + private String status;//1待支付;2已支付;3支付失败 | ||
16 | + private String payAt; | ||
17 | + private String createdAt; | ||
18 | + private String updatedAt; | ||
19 | + | ||
20 | + public String getTradeNo() { | ||
21 | + return tradeNo; | ||
22 | + } | ||
23 | + | ||
24 | + public void setTradeNo(String tradeNo) { | ||
25 | + this.tradeNo = tradeNo; | ||
26 | + } | ||
27 | + | ||
28 | + public String getClientId() { | ||
29 | + return clientId; | ||
30 | + } | ||
31 | + | ||
32 | + public void setClientId(String clientId) { | ||
33 | + this.clientId = clientId; | ||
34 | + } | ||
35 | + | ||
36 | + public String getApplyNo() { | ||
37 | + return applyNo; | ||
38 | + } | ||
39 | + | ||
40 | + public void setApplyNo(String applyNo) { | ||
41 | + this.applyNo = applyNo; | ||
42 | + } | ||
43 | + | ||
44 | + public String getStatus() { | ||
45 | + return status; | ||
46 | + } | ||
47 | + | ||
48 | + public void setStatus(String status) { | ||
49 | + this.status = status; | ||
50 | + } | ||
51 | + | ||
52 | + public String getPayAt() { | ||
53 | + return payAt; | ||
54 | + } | ||
55 | + | ||
56 | + public void setPayAt(String payAt) { | ||
57 | + this.payAt = payAt; | ||
58 | + } | ||
59 | + | ||
60 | + public String getCreatedAt() { | ||
61 | + return createdAt; | ||
62 | + } | ||
63 | + | ||
64 | + public void setCreatedAt(String createdAt) { | ||
65 | + this.createdAt = createdAt; | ||
66 | + } | ||
67 | + | ||
68 | + public String getUpdatedAt() { | ||
69 | + return updatedAt; | ||
70 | + } | ||
71 | + | ||
72 | + public void setUpdatedAt(String updatedAt) { | ||
73 | + this.updatedAt = updatedAt; | ||
74 | + } | ||
75 | +} |
... | @@ -30,8 +30,10 @@ public enum DateEnum { | ... | @@ -30,8 +30,10 @@ public enum DateEnum { |
30 | DATETIME("yyyy-MM-dd HH:mm:ss"), | 30 | DATETIME("yyyy-MM-dd HH:mm:ss"), |
31 | 31 | ||
32 | /** yyyy-MM-dd HH:mm */ | 32 | /** yyyy-MM-dd HH:mm */ |
33 | - DATETIME2("yyyy-MM-dd HH:mm"); | 33 | + DATETIME2("yyyy-MM-dd HH:mm"), |
34 | 34 | ||
35 | + //yyyyMMddmmHHssSSS | ||
36 | + UNSIGNED_DATE_TIME_MILLS("yyyyMMddmmHHssSSS"); | ||
35 | private String value; | 37 | private String value; |
36 | 38 | ||
37 | private DateEnum(String value) { | 39 | private DateEnum(String value) { | ... | ... |
... | @@ -86,7 +86,7 @@ public final class DateUtil { | ... | @@ -86,7 +86,7 @@ public final class DateUtil { |
86 | Date targetDate; | 86 | Date targetDate; |
87 | Date currentDate; | 87 | Date currentDate; |
88 | try { | 88 | try { |
89 | - targetDate = sdf.parse("2019-04-18"); | 89 | + targetDate = sdf.parse("2019-05-01"); |
90 | currentDate = new Date(); | 90 | currentDate = new Date(); |
91 | result =(int)((currentDate.getTime()-targetDate.getTime())/(24*60*60*1000)); | 91 | result =(int)((currentDate.getTime()-targetDate.getTime())/(24*60*60*1000)); |
92 | } catch (ParseException e) { | 92 | } catch (ParseException e) { | ... | ... |
... | @@ -95,7 +95,6 @@ public class SandPayUtil { | ... | @@ -95,7 +95,6 @@ public class SandPayUtil { |
95 | e.printStackTrace(); | 95 | e.printStackTrace(); |
96 | return "转码出错"; | 96 | return "转码出错"; |
97 | } | 97 | } |
98 | - | ||
99 | } | 98 | } |
100 | 99 | ||
101 | private static String getReqTime() { | 100 | private static String getReqTime() { |
... | @@ -136,7 +135,7 @@ public class SandPayUtil { | ... | @@ -136,7 +135,7 @@ public class SandPayUtil { |
136 | return result; | 135 | return result; |
137 | } | 136 | } |
138 | 137 | ||
139 | - private static String map2String(Map<String, String> params) { | 138 | + public static String map2String(Map<String, String> params) { |
140 | List<String> keys = new ArrayList<String>(params.keySet()); | 139 | List<String> keys = new ArrayList<String>(params.keySet()); |
141 | Collections.sort(keys); | 140 | Collections.sort(keys); |
142 | StringBuilder prestr = new StringBuilder(); | 141 | StringBuilder prestr = new StringBuilder(); | ... | ... |
1 | +package com.cjs.site.util.union; | ||
2 | + | ||
3 | +/** | ||
4 | + * Created by bruce on 2019-05-14 10:11 | ||
5 | + */ | ||
6 | +public class UnionConstants { | ||
7 | + | ||
8 | + /** | ||
9 | + * 银联商务支付网关 | ||
10 | + */ | ||
11 | + private static final String BASE_URL = "https://qr-test2.chinaums.com"; | ||
12 | + /** | ||
13 | + * 银联商务发起订单请求url | ||
14 | + */ | ||
15 | + public static final String CREATE_ORDER = BASE_URL + "/netpay-route-server/api/"; | ||
16 | + /** | ||
17 | + * 银联商务生成二维码的url | ||
18 | + */ | ||
19 | + public static final String QRCODE_URL = BASE_URL + "/bills/qrCode.do?id="; | ||
20 | + /** | ||
21 | + * 银联商务分配的来源编号 | ||
22 | + */ | ||
23 | + public static final String MSG_ID = "0001"; | ||
24 | + /** | ||
25 | + * 银联商务分配的商户号 | ||
26 | + */ | ||
27 | + public static final String MID = "98632165101"; | ||
28 | + /** | ||
29 | + * 终端号,默认赋值 | ||
30 | + */ | ||
31 | + public static final String TID = "A00000001"; | ||
32 | + /** | ||
33 | + * 银联商务分配的密钥 | ||
34 | + */ | ||
35 | + public static final String MD5_KEY = "SFASDGSDDFERQRSADFAYTJRGJGFH"; | ||
36 | + /** | ||
37 | + * 银联商务response返回正确的状态码 | ||
38 | + */ | ||
39 | + public static final String SUCCESS_CODE = "BAD_REQUEST"; | ||
40 | + | ||
41 | +} |
1 | +package com.cjs.site.util.union; | ||
2 | + | ||
3 | +import com.cjs.site.model.union.CreateQrCode; | ||
4 | +import com.cjs.site.model.union.UnionResponse; | ||
5 | +import com.cjs.site.util.lang.DateEnum; | ||
6 | +import com.cjs.site.util.lang.DateUtil; | ||
7 | +import com.cjs.site.util.lang.JsonUtil; | ||
8 | +import com.cjs.site.util.sand.SandPayUtil; | ||
9 | +import org.apache.commons.codec.digest.DigestUtils; | ||
10 | +import org.apache.commons.lang3.RandomStringUtils; | ||
11 | +import org.apache.commons.lang3.StringUtils; | ||
12 | + | ||
13 | +import javax.servlet.http.HttpServletRequest; | ||
14 | +import java.io.*; | ||
15 | +import java.net.URL; | ||
16 | +import java.net.URLConnection; | ||
17 | +import java.net.URLDecoder; | ||
18 | +import java.util.Date; | ||
19 | +import java.util.HashMap; | ||
20 | +import java.util.Map; | ||
21 | + | ||
22 | +/** | ||
23 | + * Created by bruce on 2019-05-14 10:07 | ||
24 | + */ | ||
25 | +public class UnionPayUtil { | ||
26 | + | ||
27 | + public static String createQrCode(String qrCodeId) { | ||
28 | + return UnionConstants.QRCODE_URL + qrCodeId; | ||
29 | + } | ||
30 | + | ||
31 | + private static String makeSign(Map<String, String> params) { | ||
32 | + String preStr = SandPayUtil.map2String(params); | ||
33 | + String text = preStr + UnionConstants.MD5_KEY; | ||
34 | + return DigestUtils.md5Hex(getContentBytes(text)).toUpperCase(); | ||
35 | + } | ||
36 | + | ||
37 | + public static Boolean checkSign(Map<String, String> params) { | ||
38 | + String sign = params.get("sign"); | ||
39 | + if (StringUtils.isBlank(sign)) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + String signV = makeSign(params); | ||
43 | + return StringUtils.equalsIgnoreCase(sign, signV); | ||
44 | + } | ||
45 | + | ||
46 | + public static String getOrderNo() { | ||
47 | + String date = DateUtil.parseDate(new Date(), DateEnum.UNSIGNED_DATE_TIME_MILLS); | ||
48 | + String rand = RandomStringUtils.randomNumeric(7); | ||
49 | + return UnionConstants.MSG_ID + date + rand; | ||
50 | + } | ||
51 | + | ||
52 | + private static byte[] getContentBytes(String content) { | ||
53 | + try { | ||
54 | + return content.getBytes("UTF-8"); | ||
55 | + } catch (UnsupportedEncodingException e) { | ||
56 | + throw new RuntimeException("签名过程中出现错误"); | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + public static Map<String, String> getRequestParams(HttpServletRequest request) { | ||
61 | + Map<String, String[]> params = request.getParameterMap(); | ||
62 | + Map<String, String> params2 = new HashMap<String, String>(); | ||
63 | + for (String key : params.keySet()) { | ||
64 | + String[] values = params.get(key); | ||
65 | + if (values.length > 0) { | ||
66 | + params2.put(key, values[0]); | ||
67 | + } | ||
68 | + } | ||
69 | + return params2; | ||
70 | + } | ||
71 | + | ||
72 | + @SuppressWarnings("unchecked") | ||
73 | + public static void main(String[] args) { | ||
74 | + CreateQrCode createQrCode = new CreateQrCode(); | ||
75 | + createQrCode.setBillNo(getOrderNo()); | ||
76 | + createQrCode.setTotalAmount("1D"); | ||
77 | + createQrCode.setRequestTimestamp(DateUtil.getNow()); | ||
78 | + createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | ||
79 | + createQrCode.setSrcReserve("201905140001"); | ||
80 | + Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | ||
81 | + String json = sendPost(UnionConstants.CREATE_ORDER, mapTypes); | ||
82 | + UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | ||
83 | + System.out.println(JsonUtil.toJson(response)); | ||
84 | + } | ||
85 | + | ||
86 | + public static String sendPost(String url, Map<String, String> data) { | ||
87 | + PrintWriter out = null; | ||
88 | + BufferedReader in = null; | ||
89 | + StringBuilder result = new StringBuilder(); | ||
90 | + | ||
91 | + Map<String, String> params = new HashMap<String, String>(); | ||
92 | + params.put("sign", makeSign(data)); | ||
93 | + | ||
94 | + try { | ||
95 | + URL realUrl = new URL(url); | ||
96 | + URLConnection conn = realUrl.openConnection(); | ||
97 | + conn.setRequestProperty("accept", "*/*"); | ||
98 | + conn.setRequestProperty("connection", "Keep-Alive"); | ||
99 | + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | ||
100 | + conn.setDoOutput(true); | ||
101 | + conn.setDoInput(true); | ||
102 | + out = new PrintWriter(conn.getOutputStream()); | ||
103 | + out.print(SandPayUtil.map2String(params)); | ||
104 | + out.flush(); | ||
105 | + in = new BufferedReader(new InputStreamReader(conn.getInputStream())); | ||
106 | + String line; | ||
107 | + while ((line = in.readLine()) != null) { | ||
108 | + result.append(line); | ||
109 | + } | ||
110 | + } catch (Exception e) { | ||
111 | + e.printStackTrace(); | ||
112 | + result.append(e.getMessage()); | ||
113 | + } finally { | ||
114 | + try { | ||
115 | + if (out != null) { | ||
116 | + out.close(); | ||
117 | + } | ||
118 | + if (in != null) { | ||
119 | + in.close(); | ||
120 | + } | ||
121 | + } catch (IOException ex) { | ||
122 | + ex.printStackTrace(); | ||
123 | + } | ||
124 | + } | ||
125 | + try { | ||
126 | + return URLDecoder.decode(result.toString(), "utf-8"); | ||
127 | + } catch (UnsupportedEncodingException e) { | ||
128 | + e.printStackTrace(); | ||
129 | + return "转码出错"; | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | +} |
src/main/webapp/resource/js/layer/layer.js
0 → 100644
This diff is collapsed. Click to expand it.
1 | +/** layui-v2.2.5 MIT License By https://www.layui.com */ | ||
2 | + ;!function(e){"use strict";var t=document,n={modules:{},status:{},timeout:10,event:{}},o=function(){this.v="2.2.5"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,n=t.scripts,o=n.length-1,r=o;r>0;r--)if("interactive"===n[r].readyState){e=n[r].src;break}return e||n[o].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),a=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},i="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules-2.2.5/layer",laydate:"modules-2.2.5/laydate",laypage:"modules-2.2.5/laypage",laytpl:"modules-2.2.5/laytpl",layim:"modules-2.2.5/layim",layedit:"modules-2.2.5/layedit",form:"modules-2.2.5/form",upload:"modules-2.2.5/upload",tree:"modules-2.2.5/tree",table:"modules-2.2.5/table",element:"modules-2.2.5/element",util:"modules-2.2.5/util",flow:"modules-2.2.5/flow",carousel:"modules-2.2.5/carousel",code:"modules-2.2.5/code",jquery:"modules-2.2.5/jquery",mobile:"modules-2.2.5/mobile","layui.all":"../layui.all"};o.prototype.cache=n,o.prototype.define=function(e,t){var o=this,r="function"==typeof e,a=function(){var e=function(e,t){layui[e]=t,n.status[e]=!0};return"function"==typeof t&&t(function(o,r){e(o,r),n.callback[o]=function(){t(e)}}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?a.call(o):(o.use(e,a),o)},o.prototype.use=function(e,o,l){function s(e,t){var o="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||o.test((e.currentTarget||e.srcElement).readyState))&&(n.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void(n.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?y.use(e.slice(1),o,l):"function"==typeof o&&o.apply(layui,l)}var y=this,p=n.dir=n.dir?n.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(y.each(e,function(t,n){"jquery"===n&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],n.host=n.host||(p.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),y;if(n.modules[f])!function g(){return++m>1e3*n.timeout/4?a(f+" is not a valid module"):void("string"==typeof n.modules[f]&&n.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?p+"layui/":/^\{\/\}/.test(y.modules[f])?"":n.base||"")+(y.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=n.version===!0?n.v||(new Date).getTime():n.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||i?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),n.modules[f]=h}return y},o.prototype.getStyle=function(t,n){var o=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return o[o.getPropertyValue?"getPropertyValue":"getAttribute"](n)},o.prototype.link=function(e,o,r){var i=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof o&&(r=o);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,y=0;return u.rel="stylesheet",u.href=e+(n.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof o?i:(function p(){return++y>1e3*n.timeout/100?a(e+" timeout"):void(1989===parseInt(i.getStyle(t.getElementById(c),"width"))?function(){o()}():setTimeout(p,100))}(),i)},n.callback={},o.prototype.factory=function(e){if(layui[e])return"function"==typeof n.callback[e]?n.callback[e]:null},o.prototype.addcss=function(e,t,o){return layui.link("http://m.ytgrading.com/lib/css/layui/modules-2.2.5/"+e.substring(8),t,o)},o.prototype.img=function(e,t,n){var o=new Image;return o.src=e,o.complete?t(o):(o.onload=function(){o.onload=null,t(o)},void(o.onerror=function(e){o.onerror=null,n(e)}))},o.prototype.config=function(e){e=e||{};for(var t in e)n[t]=e[t];return this},o.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),o.prototype.extend=function(e){var t=this;e=e||{};for(var n in e)t[n]||t.modules[n]?a("模块名 "+n+" 已被占用"):t.modules[n]=e[n];return t},o.prototype.router=function(e){var t=this,e=e||location.hash,n={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(n.href=e=e.replace(/^#\//,""),e=e.replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),n.search[t[0]]=t[1]}():n.path.push(t)}),n):n},o.prototype.data=function(t,n,o){if(t=t||"layui",o=o||localStorage,e.JSON&&e.JSON.parse){if(null===n)return delete o[t];n="object"==typeof n?n:{key:n};try{var r=JSON.parse(o[t])}catch(a){var r={}}return"value"in n&&(r[n.key]=n.value),n.remove&&delete r[n.key],o[t]=JSON.stringify(r),n.key?r[n.key]:r}},o.prototype.sessionData=function(e,t){return this.data(e,t,sessionStorage)},o.prototype.device=function(t){var n=navigator.userAgent.toLowerCase(),o=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(n.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:o("micromessenger")};return t&&!r[t]&&(r[t]=o(t)),r.android=/android/.test(n),r.ios="ios"===r.os,r},o.prototype.hint=function(){return{error:a}},o.prototype.each=function(e,t){var n,o=this;if("function"!=typeof t)return o;if(e=e||[],e.constructor===Object){for(n in e)if(t.call(e[n],n,e[n]))break}else for(n=0;n<e.length&&!t.call(e[n],n,e[n]);n++);return o},o.prototype.sort=function(e,t,n){var o=JSON.parse(JSON.stringify(e||[]));return t?(o.sort(function(e,n){var o=/^-?\d+$/,r=e[t],a=n[t];return o.test(r)&&(r=parseFloat(r)),o.test(a)&&(a=parseFloat(a)),r&&!a?1:!r&&a?-1:r>a?1:r<a?-1:0}),n&&o.reverse(),o):o},o.prototype.stope=function(t){t=t||e.event;try{t.stopPropagation()}catch(n){t.cancelBubble=!0}},o.prototype.onevent=function(e,t,n){return"string"!=typeof e||"function"!=typeof n?this:o.event(e,t,null,n)},o.prototype.event=o.event=function(e,t,o,r){var a=this,i=null,u=t.match(/\((.*)\)$/)||[],l=(e+"."+t).replace(u[0],""),s=u[1]||"",c=function(e,t){var n=t&&t.call(a,o);n===!1&&null===i&&(i=!1)};return r?(n.event[l]=n.event[l]||{},n.event[l][s]=[r],this):(layui.each(n.event[l],function(e,t){return"{*}"===s?void layui.each(t,c):(""===e&&layui.each(t,c),void(e===s&&layui.each(t,c)))}),i)},e.layui=new o}(window); |
1 | +/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ | ||
2 | + ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |

5.77 KB

11.2 KB
This diff is collapsed. Click to expand it.

5.66 KB

701 Bytes

1.75 KB
... | @@ -13,15 +13,74 @@ | ... | @@ -13,15 +13,74 @@ |
13 | <link href="${ctx }/resource/css/jquery-date/latoja.datepicker.css" rel="stylesheet" /> | 13 | <link href="${ctx }/resource/css/jquery-date/latoja.datepicker.css" rel="stylesheet" /> |
14 | <link href="${ctx }/resource/css/detail.css" rel="stylesheet" type="text/css" /> | 14 | <link href="${ctx }/resource/css/detail.css" rel="stylesheet" type="text/css" /> |
15 | <link href="${ctx }/resource/css/home.css" rel="stylesheet" type="text/css" /> | 15 | <link href="${ctx }/resource/css/home.css" rel="stylesheet" type="text/css" /> |
16 | - <script type="text/javascript" src="${ctx }/resource/js/utils/jquery/jquery-ui-1.10.1.min.js"></script> | 16 | + <script type="text/javascript" src="${ctx }/resource/js/layer/jquery.min.js"></script> |
17 | - <script type="text/javascript" src="${ctx }/resource/js/utils/jquery/jquery.ui.datepicker-zh-cn.js"></script> | 17 | + <script type="text/javascript" src="${ctx }/resource/js/layer/layer.js"></script> |
18 | - <script type="text/javascript" src="${ctx }/resource/js/user/pick/pick.js"></script> | 18 | + <script type="text/javascript" src="${ctx }/resource/js/layer/layui-2.2.5.js"></script> |
19 | - <script type="text/javascript" src="${ctx }/resource/js/user/pick/self.js"></script> | 19 | + <%--<script type="text/javascript" src="${ctx }/resource/js/layer/qrcode.js"></script>--%> |
20 | + <script type="text/javascript" src="//cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> | ||
21 | + <script type="text/javascript" src="//static.runoob.com/assets/qrcode/qrcode.min.js"></script> | ||
22 | + | ||
20 | <script type="text/javascript"> | 23 | <script type="text/javascript"> |
21 | - var errorMessage = '${ resultInfo.message }'; | 24 | + $(function() { |
22 | - //最小提货日期(0:普通自提;1:封装自提) | 25 | + var Pay = { |
23 | - var minDate = '${sessionScope.pack}' == '1' ? '+7' : '+0'; | 26 | + init: function() { |
27 | + this.bind(); | ||
28 | + this.render(); | ||
29 | + }, | ||
30 | + bind: function() { | ||
31 | + $(document).on('click', '#payBtn', this.showPayDialog); | ||
32 | + }, | ||
33 | + render: function() { | ||
34 | + }, | ||
35 | + showPayDialog: function(){ | ||
36 | + $.ajax({ | ||
37 | + type: "get", | ||
38 | + url: "/pick/pay/createOrder", | ||
39 | + success : function(data){ | ||
40 | + if(data.code){ | ||
41 | + var laytpl = layui.laytpl; | ||
42 | + layer.open({ | ||
43 | + type: 1, | ||
44 | + title: '付款码', | ||
45 | + closeBtn: 1, | ||
46 | + area: ['800px;', '500px'], | ||
47 | + shade: 0.8, | ||
48 | + id: 'payDialogContent', | ||
49 | + skin: 'payDialogContent', | ||
50 | + btnAlign: 'c', | ||
51 | + moveType: 1, | ||
52 | + content: '' | ||
53 | + }); | ||
54 | + var htmlStr = ''; | ||
55 | + htmlStr += '<div style="width:100%;height:50px;font-size:16px;text-align:center;padding-top:30px;">' | ||
56 | + htmlStr += '请打开微信或支付宝app扫码进行支付' | ||
57 | + htmlStr += '</div>' | ||
58 | + htmlStr += '<div style="width:100%;height:60px;font-size:22px;text-align:center;color:#f20000;font-weight:bold;">' | ||
59 | + htmlStr += data.totalAmount + '元' | ||
60 | + htmlStr += '</div>' | ||
61 | + htmlStr += '<div style="width: 200px;height: 200px;margin: 0 auto;">' | ||
62 | + htmlStr += '<div style="width:100%;height:100%;" id="qrcode"></div>' | ||
63 | + htmlStr += '</div>' | ||
64 | + htmlStr += '<div style="width:100%;height:30px;font-size:16px;text-align:center;padding-top:30px;">' | ||
65 | + htmlStr += '付款码每2分钟刷新一次,请在规定时间内完成付款' | ||
66 | + htmlStr += '</div>' | ||
67 | + $('#payDialogContent').html(htmlStr); | ||
68 | + var qrcode = new QRCode(document.getElementById("qrcode")); | ||
69 | + qrcode.makeCode(data.qrCode); | ||
70 | + }else{ | ||
71 | + layer.msg(data.msg, {icon: '2'}); | ||
72 | + } | ||
73 | + } | ||
74 | + }); | ||
75 | + } | ||
76 | + }; | ||
77 | + window.Pay = Pay; | ||
78 | + Pay.init(); | ||
79 | + }); | ||
24 | </script> | 80 | </script> |
81 | + <style> | ||
82 | + #qrcode img { width: 100%; } | ||
83 | + </style> | ||
25 | </head> | 84 | </head> |
26 | <body> | 85 | <body> |
27 | <jsp:include page="${ctx }/view/common/header.jsp" /> | 86 | <jsp:include page="${ctx }/view/common/header.jsp" /> |
... | @@ -151,7 +210,7 @@ | ... | @@ -151,7 +210,7 @@ |
151 | <span id="spPickType"></span> | 210 | <span id="spPickType"></span> |
152 | <span id="spDelegateName"></span> | 211 | <span id="spDelegateName"></span> |
153 | <span id="spDelegateId" class="bold"></span> | 212 | <span id="spDelegateId" class="bold"></span> |
154 | - <a style="text-align: center;" class="red-btn">确认支付</a> | 213 | + <a id="payBtn" style="text-align: center;" class="red-btn">确认支付</a> |
155 | </p> | 214 | </p> |
156 | </div> | 215 | </div> |
157 | </div> | 216 | </div> |
... | @@ -159,6 +218,19 @@ | ... | @@ -159,6 +218,19 @@ |
159 | </div> | 218 | </div> |
160 | </div> | 219 | </div> |
161 | <div class="clear"></div> | 220 | <div class="clear"></div> |
221 | +<script type="text/html" id="payDialog"> | ||
222 | + <div style="width: 600px;height: 500px;"> | ||
223 | + <div style="width: 100%;height: 30px;line-height: 30px;text-align: center;font-size: 18px;font-weight: bold;"> | ||
224 | + 付款码 | ||
225 | + </div> | ||
226 | + <div> | ||
227 | + 请打开微信或支付宝app扫码进行支付 | ||
228 | + </div> | ||
229 | + <div> | ||
230 | + 付款码每2分钟刷新一次,请在规定时间内完成付款 | ||
231 | + </div> | ||
232 | + </div> | ||
233 | +</script> | ||
162 | <jsp:include page="${ctx }/view/common/bottom.jsp" /> | 234 | <jsp:include page="${ctx }/view/common/bottom.jsp" /> |
163 | </body> | 235 | </body> |
164 | </html> | 236 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment