Showing
6 changed files
with
30 additions
and
29 deletions
... | @@ -2,8 +2,10 @@ package com.cjs.site.action.user.fund; | ... | @@ -2,8 +2,10 @@ package com.cjs.site.action.user.fund; |
2 | 2 | ||
3 | import com.cjs.site.biz.user.pick.PickPayBiz; | 3 | import com.cjs.site.biz.user.pick.PickPayBiz; |
4 | import com.cjs.site.util.lang.JsonUtil; | 4 | import com.cjs.site.util.lang.JsonUtil; |
5 | +import com.cjs.site.util.union.UnionPayUtil; | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
6 | import org.springframework.stereotype.Controller; | 7 | import org.springframework.stereotype.Controller; |
8 | +import org.springframework.web.bind.annotation.RequestBody; | ||
7 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | import org.springframework.web.bind.annotation.RequestMethod; | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
9 | import org.springframework.web.bind.annotation.ResponseBody; | 11 | import org.springframework.web.bind.annotation.ResponseBody; |
... | @@ -31,8 +33,19 @@ public class PickPayAction { | ... | @@ -31,8 +33,19 @@ public class PickPayAction { |
31 | 33 | ||
32 | //支付通知 | 34 | //支付通知 |
33 | @RequestMapping(value = "notify", method = RequestMethod.POST) | 35 | @RequestMapping(value = "notify", method = RequestMethod.POST) |
34 | - public String notify(Map<String, String> params) { | 36 | + @ResponseBody |
35 | - System.out.println("map----params参数" + JsonUtil.toJson(params)); | 37 | + public String notify(HttpServletRequest request) { |
38 | + Map<String,String> params = UnionPayUtil.getRequestParams(request); | ||
39 | + System.out.println("银联支付推送回调参数:"+JsonUtil.toJson(params)); | ||
40 | + if (pickPayBiz.isValidNotify(params)){ | ||
41 | + return "SUCCESS"; | ||
42 | + } | ||
43 | + return "ERROR"; | ||
44 | + } | ||
45 | + | ||
46 | + @RequestMapping(value = "test", method = RequestMethod.POST) | ||
47 | + @ResponseBody | ||
48 | + public String notify(@RequestBody Map<String,String> params) { | ||
36 | if (pickPayBiz.isValidNotify(params)){ | 49 | if (pickPayBiz.isValidNotify(params)){ |
37 | return "SUCCESS"; | 50 | return "SUCCESS"; |
38 | } | 51 | } | ... | ... |
... | @@ -102,7 +102,7 @@ public class PickAction { | ... | @@ -102,7 +102,7 @@ public class PickAction { |
102 | @RequestMapping("self") | 102 | @RequestMapping("self") |
103 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, | 103 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, |
104 | RedirectAttributes attributes, HttpSession session) { | 104 | RedirectAttributes attributes, HttpSession session) { |
105 | - ResultInfo resultInfo = pickBiz.selfPickNew(pickInfo); | 105 | + ResultInfo resultInfo = pickBiz.selfPick(pickInfo); |
106 | session.setAttribute("pickInfo",pickInfo); | 106 | session.setAttribute("pickInfo",pickInfo); |
107 | this.putApplys(resultInfo, pickInfo, "2", model, attributes); | 107 | this.putApplys(resultInfo, pickInfo, "2", model, attributes); |
108 | if (resultInfo.getCode() == 0) { | 108 | if (resultInfo.getCode() == 0) { |
... | @@ -151,7 +151,7 @@ public class PickAction { | ... | @@ -151,7 +151,7 @@ public class PickAction { |
151 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, | 151 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, |
152 | RedirectAttributes attributes, HttpSession session) { | 152 | RedirectAttributes attributes, HttpSession session) { |
153 | session.setAttribute("pickInfo",pickInfo); | 153 | session.setAttribute("pickInfo",pickInfo); |
154 | - ResultInfo resultInfo = pickBiz.zhaoonlinePickNew(pickInfo); | 154 | + ResultInfo resultInfo = pickBiz.zhaoonlinePick(pickInfo); |
155 | 155 | ||
156 | this.putApplys(resultInfo, pickInfo, "1", model, attributes); | 156 | this.putApplys(resultInfo, pickInfo, "1", model, attributes); |
157 | if (resultInfo.getCode() == 0) { | 157 | if (resultInfo.getCode() == 0) { | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -51,8 +51,10 @@ public class PickPayBiz { | ... | @@ -51,8 +51,10 @@ public class PickPayBiz { |
51 | List<PickPackInfo> applyList = pickPackDao.queryUserPosition(userId); | 51 | List<PickPackInfo> applyList = pickPackDao.queryUserPosition(userId); |
52 | int pickTotal = 0; | 52 | int pickTotal = 0; |
53 | for (PickPackInfo apply : applyList) { | 53 | for (PickPackInfo apply : applyList) { |
54 | + if (apply.getCurrentAmount() > 0) { | ||
54 | pickTotal += apply.getCurrentAmount(); | 55 | pickTotal += apply.getCurrentAmount(); |
55 | } | 56 | } |
57 | + } | ||
56 | // BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(DateUtil.getTrustCycle())). | 58 | // BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(DateUtil.getTrustCycle())). |
57 | // multiply(new BigDecimal(pickTotal)).add(new BigDecimal("6")); | 59 | // multiply(new BigDecimal(pickTotal)).add(new BigDecimal("6")); |
58 | BigDecimal totalAmount = new BigDecimal("0.01");//调试接口代码写死 | 60 | BigDecimal totalAmount = new BigDecimal("0.01");//调试接口代码写死 |
... | @@ -66,6 +68,7 @@ public class PickPayBiz { | ... | @@ -66,6 +68,7 @@ public class PickPayBiz { |
66 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | 68 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); |
67 | //此处拼接提货信息 | 69 | //此处拼接提货信息 |
68 | OutpropApplyPickInfo pickInfo = (OutpropApplyPickInfo) session.getAttribute("pickInfo"); | 70 | OutpropApplyPickInfo pickInfo = (OutpropApplyPickInfo) session.getAttribute("pickInfo"); |
71 | + pickInfo.setCreateTime((String) session.getAttribute("pack"));//将提货方式放入createTime属性里 | ||
69 | createQrCode.setSrcReserve(JsonUtil.toJsonRemoveNull(pickInfo)); | 72 | createQrCode.setSrcReserve(JsonUtil.toJsonRemoveNull(pickInfo)); |
70 | @SuppressWarnings("unchecked") | 73 | @SuppressWarnings("unchecked") |
71 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | 74 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); |
... | @@ -91,20 +94,22 @@ public class PickPayBiz { | ... | @@ -91,20 +94,22 @@ public class PickPayBiz { |
91 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | 94 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); |
92 | TransactionStatus status = transactionManager.getTransaction(def); | 95 | TransactionStatus status = transactionManager.getTransaction(def); |
93 | try { | 96 | try { |
94 | - OutpropApplyPayInfo info = outpropApplyPayDao.selectByTradeNo(result.get("billNo")); | 97 | + String tradeNo = result.get("billNo"); |
98 | + OutpropApplyPayInfo info = outpropApplyPayDao.selectByTradeNo(tradeNo); | ||
95 | if (!info.getStatus().equals("2")) { | 99 | if (!info.getStatus().equals("2")) { |
96 | OutpropApplyPayInfo update = new OutpropApplyPayInfo(); | 100 | OutpropApplyPayInfo update = new OutpropApplyPayInfo(); |
97 | - update.setTradeNo(result.get("srcReserve")); | 101 | + update.setTradeNo(tradeNo); |
98 | update.setStatus("2"); | 102 | update.setStatus("2"); |
99 | outpropApplyPayDao.update(update); | 103 | outpropApplyPayDao.update(update); |
100 | 104 | ||
101 | OutpropApplyPickInfo pickInfo = JsonUtil.fromJson(result.get("srcReserve"), OutpropApplyPickInfo.class); | 105 | OutpropApplyPickInfo pickInfo = JsonUtil.fromJson(result.get("srcReserve"), OutpropApplyPickInfo.class); |
106 | + pickInfo.setClientId(info.getClientId()); | ||
102 | if ("0".equals(pickInfo.getPickType()) || "1".equals(pickInfo.getPickType())) { | 107 | if ("0".equals(pickInfo.getPickType()) || "1".equals(pickInfo.getPickType())) { |
103 | - pickBiz.selfPick(pickInfo); | 108 | + pickBiz.selfPickNew(pickInfo); |
104 | } else if ("2".equals(pickInfo.getPickType())) { | 109 | } else if ("2".equals(pickInfo.getPickType())) { |
105 | - pickBiz.expressPick(pickInfo, Integer.parseInt(pickInfo.getCreateDate())); | 110 | + pickBiz.expressPickNew(pickInfo); |
106 | } else if ("3".equals(pickInfo.getPickType())) { | 111 | } else if ("3".equals(pickInfo.getPickType())) { |
107 | - pickBiz.zhaoonlinePick(pickInfo); | 112 | + pickBiz.zhaoonlinePickNew(pickInfo); |
108 | } | 113 | } |
109 | } | 114 | } |
110 | transactionManager.commit(status); | 115 | transactionManager.commit(status); | ... | ... |
1 | package com.cjs.site.util.union; | 1 | package com.cjs.site.util.union; |
2 | 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; | 3 | import com.cjs.site.util.lang.DateEnum; |
6 | import com.cjs.site.util.lang.DateUtil; | 4 | import com.cjs.site.util.lang.DateUtil; |
7 | import com.cjs.site.util.lang.JsonUtil; | 5 | import com.cjs.site.util.lang.JsonUtil; |
... | @@ -9,6 +7,7 @@ import org.apache.commons.codec.digest.DigestUtils; | ... | @@ -9,6 +7,7 @@ import org.apache.commons.codec.digest.DigestUtils; |
9 | import org.apache.commons.lang3.RandomStringUtils; | 7 | import org.apache.commons.lang3.RandomStringUtils; |
10 | import org.apache.commons.lang3.StringUtils; | 8 | import org.apache.commons.lang3.StringUtils; |
11 | 9 | ||
10 | +import javax.servlet.http.HttpServletRequest; | ||
12 | import java.io.*; | 11 | import java.io.*; |
13 | import java.net.URL; | 12 | import java.net.URL; |
14 | import java.net.URLConnection; | 13 | import java.net.URLConnection; |
... | @@ -79,7 +78,7 @@ public class UnionPayUtil { | ... | @@ -79,7 +78,7 @@ public class UnionPayUtil { |
79 | } | 78 | } |
80 | } | 79 | } |
81 | 80 | ||
82 | -/* public static Map<String, String> getRequestParams(HttpServletRequest request) { | 81 | + public static Map<String, String> getRequestParams(HttpServletRequest request) { |
83 | Map<String, String[]> params = request.getParameterMap(); | 82 | Map<String, String[]> params = request.getParameterMap(); |
84 | Map<String, String> params2 = new HashMap<String, String>(); | 83 | Map<String, String> params2 = new HashMap<String, String>(); |
85 | for (String key : params.keySet()) { | 84 | for (String key : params.keySet()) { |
... | @@ -89,22 +88,6 @@ public class UnionPayUtil { | ... | @@ -89,22 +88,6 @@ public class UnionPayUtil { |
89 | } | 88 | } |
90 | } | 89 | } |
91 | return params2; | 90 | return params2; |
92 | - }*/ | ||
93 | - | ||
94 | - @SuppressWarnings("unchecked") | ||
95 | - public static void main(String[] args) { | ||
96 | - CreateQrCode createQrCode = new CreateQrCode(); | ||
97 | - createQrCode.setQrCodeId(getQrCodeId()); | ||
98 | - createQrCode.setBillNo(createQrCode.getQrCodeId()); | ||
99 | - createQrCode.setTotalAmount("1"); | ||
100 | - createQrCode.setRequestTimestamp(DateUtil.getNow()); | ||
101 | - createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | ||
102 | - createQrCode.setSrcReserve("201905140001"); | ||
103 | - Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | ||
104 | - String json = sendPost(UnionConstants.CREATE_ORDER, mapTypes); | ||
105 | - UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | ||
106 | - System.out.println(createQrCode.getQrCodeId()); | ||
107 | - System.out.println(JsonUtil.toJson(response)); | ||
108 | } | 91 | } |
109 | 92 | ||
110 | public static String sendPost(String url, Map<String, String> data) { | 93 | public static String sendPost(String url, Map<String, String> data) { | ... | ... |
... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
30 | </select> | 30 | </select> |
31 | 31 | ||
32 | <update id="update" parameterType="OutpropApplyPayInfo"> | 32 | <update id="update" parameterType="OutpropApplyPayInfo"> |
33 | - UPDATE HS_ASSET.OUTPROPAPPLY_PAY SET STATUS = #{status}, UPDATED_AT = NOW() | 33 | + UPDATE HS_ASSET.OUTPROPAPPLY_PAY SET STATUS = #{status}, PAY_AT = TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') |
34 | WHERE TRADE_NO = #{tradeNo} | 34 | WHERE TRADE_NO = #{tradeNo} |
35 | </update> | 35 | </update> |
36 | 36 | ... | ... |
-
Please register or login to post a comment