Showing
13 changed files
with
185 additions
and
75 deletions
... | @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ... | @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; |
8 | import org.springframework.web.bind.annotation.ResponseBody; | 8 | import org.springframework.web.bind.annotation.ResponseBody; |
9 | 9 | ||
10 | import javax.servlet.http.HttpServletRequest; | 10 | import javax.servlet.http.HttpServletRequest; |
11 | +import javax.servlet.http.HttpSession; | ||
12 | +import java.util.Map; | ||
11 | 13 | ||
12 | /** | 14 | /** |
13 | * Created by bruce on 2019-05-14 13:41 | 15 | * Created by bruce on 2019-05-14 13:41 |
... | @@ -22,14 +24,14 @@ public class PickPayAction { | ... | @@ -22,14 +24,14 @@ public class PickPayAction { |
22 | //创建订单 | 24 | //创建订单 |
23 | @RequestMapping(value = "/createOrder", method = RequestMethod.GET) | 25 | @RequestMapping(value = "/createOrder", method = RequestMethod.GET) |
24 | @ResponseBody | 26 | @ResponseBody |
25 | - public Object createOrder() { | 27 | + public Object createOrder(HttpSession session) { |
26 | - return pickPayBiz.createOrder(); | 28 | + return pickPayBiz.createOrder(session); |
27 | } | 29 | } |
28 | 30 | ||
29 | //支付通知 | 31 | //支付通知 |
30 | @RequestMapping(value = "notify", method = RequestMethod.POST) | 32 | @RequestMapping(value = "notify", method = RequestMethod.POST) |
31 | - public String notify(HttpServletRequest request) { | 33 | + public String notify(Map<String,String> params) { |
32 | - pickPayBiz.isValidNotify(request); | 34 | + pickPayBiz.isValidNotify(params); |
33 | return "/jsp/payResult.jsp"; | 35 | return "/jsp/payResult.jsp"; |
34 | } | 36 | } |
35 | 37 | ... | ... |
1 | package com.cjs.site.action.user.pick; | 1 | package com.cjs.site.action.user.pick; |
2 | 2 | ||
3 | +import java.math.BigDecimal; | ||
3 | import java.util.List; | 4 | import java.util.List; |
4 | 5 | ||
5 | import javax.servlet.http.HttpSession; | 6 | import javax.servlet.http.HttpSession; |
... | @@ -28,40 +29,43 @@ import com.cjs.site.util.web.ActionUtil; | ... | @@ -28,40 +29,43 @@ import com.cjs.site.util.web.ActionUtil; |
28 | 29 | ||
29 | /** | 30 | /** |
30 | * 提货 | 31 | * 提货 |
31 | - * | ||
32 | - * @author tongyufu | ||
33 | * | 32 | * |
33 | + * @author tongyufu | ||
34 | */ | 34 | */ |
35 | @Controller | 35 | @Controller |
36 | @RequestMapping("/user/pick") | 36 | @RequestMapping("/user/pick") |
37 | public class PickAction { | 37 | public class PickAction { |
38 | 38 | ||
39 | - Logger log = LogManager.getLogger(); | 39 | + Logger log = LogManager.getLogger(); |
40 | @Autowired | 40 | @Autowired |
41 | - private PickBiz pickBiz; | 41 | + private PickBiz pickBiz; |
42 | @Autowired | 42 | @Autowired |
43 | private UserAddressDao addressDao; | 43 | private UserAddressDao addressDao; |
44 | @Autowired | 44 | @Autowired |
45 | private PickPackageDao pickPackageDao; | 45 | private PickPackageDao pickPackageDao; |
46 | @Autowired | 46 | @Autowired |
47 | - private WarehouseDao warehouseDao; | 47 | + private WarehouseDao warehouseDao; |
48 | @Autowired | 48 | @Autowired |
49 | - private WarehouseBiz warehouseBiz; | 49 | + private WarehouseBiz warehouseBiz; |
50 | 50 | ||
51 | - /**提货方式选择*/ | 51 | + /** |
52 | + * 提货方式选择 | ||
53 | + */ | ||
52 | @SuppressWarnings("unchecked") | 54 | @SuppressWarnings("unchecked") |
53 | @RequestMapping("") | 55 | @RequestMapping("") |
54 | public String pickView(@RequestParam String applys, @RequestParam String pickType, | 56 | public String pickView(@RequestParam String applys, @RequestParam String pickType, |
55 | @RequestParam String pack, Integer packageId, HttpSession session) { | 57 | @RequestParam String pack, Integer packageId, HttpSession session) { |
56 | applys = applys.replace("\'", "\""); | 58 | applys = applys.replace("\'", "\""); |
57 | session.setAttribute("applyList", | 59 | session.setAttribute("applyList", |
58 | - JsonUtil.fromJson(applys, List.class, OutpropApplyInfo.class)); | 60 | + JsonUtil.fromJson(applys, List.class, OutpropApplyInfo.class)); |
59 | session.setAttribute("pack", pack); | 61 | session.setAttribute("pack", pack); |
60 | session.setAttribute("packageId", packageId); | 62 | session.setAttribute("packageId", packageId); |
61 | return "redirect:/user/pick/tab?pickType=" + pickType; | 63 | return "redirect:/user/pick/tab?pickType=" + pickType; |
62 | } | 64 | } |
63 | 65 | ||
64 | - /**提货方式选择*/ | 66 | + /** |
67 | + * 提货方式选择 | ||
68 | + */ | ||
65 | @SuppressWarnings("unchecked") | 69 | @SuppressWarnings("unchecked") |
66 | @RequestMapping("tab") | 70 | @RequestMapping("tab") |
67 | public String pickTab(@RequestParam String pickType, HttpSession session, Model model) { | 71 | public String pickTab(@RequestParam String pickType, HttpSession session, Model model) { |
... | @@ -79,7 +83,7 @@ public class PickAction { | ... | @@ -79,7 +83,7 @@ public class PickAction { |
79 | return "user/pick/self.jsp"; | 83 | return "user/pick/self.jsp"; |
80 | } else if ("2".equals(pickType)) { //顺丰到付 | 84 | } else if ("2".equals(pickType)) { //顺丰到付 |
81 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session | 85 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session |
82 | - .getAttribute("applyList"); | 86 | + .getAttribute("applyList"); |
83 | int pickTotal = 0; | 87 | int pickTotal = 0; |
84 | for (OutpropApplyInfo apply : applyList) { | 88 | for (OutpropApplyInfo apply : applyList) { |
85 | pickTotal += apply.getOccurAmount(); | 89 | pickTotal += apply.getOccurAmount(); |
... | @@ -91,20 +95,24 @@ public class PickAction { | ... | @@ -91,20 +95,24 @@ public class PickAction { |
91 | return "user/pick/zhaoonline.jsp"; | 95 | return "user/pick/zhaoonline.jsp"; |
92 | } | 96 | } |
93 | 97 | ||
94 | - /**自提*/ | 98 | + /** |
99 | + * 自提 | ||
100 | + */ | ||
95 | @RequestMapping("self")//todo 自提方式重定向页面应跳转到待支付页面 | 101 | @RequestMapping("self")//todo 自提方式重定向页面应跳转到待支付页面 |
96 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, | 102 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, |
97 | - RedirectAttributes attributes) { | 103 | + RedirectAttributes attributes, HttpSession session) { |
98 | - ResultInfo resultInfo = pickBiz.selfPick(pickInfo); | 104 | + ResultInfo resultInfo = pickBiz.selfPickNew(pickInfo); |
99 | - | 105 | + session.setAttribute("pickInfo",pickInfo); |
100 | this.putApplys(resultInfo, pickInfo, "2", model, attributes); | 106 | this.putApplys(resultInfo, pickInfo, "2", model, attributes); |
101 | if (resultInfo.getCode() == 0) { | 107 | if (resultInfo.getCode() == 0) { |
102 | return "user/pick/self.jsp"; | 108 | return "user/pick/self.jsp"; |
103 | } | 109 | } |
104 | - return "redirect:/user/pick/payInfo?pickType=2"; | 110 | + return "redirect:/user/pick/payInfo?pickType=1"; |
105 | } | 111 | } |
106 | 112 | ||
107 | - /**网点自提*/ | 113 | + /** |
114 | + * 网点自提 | ||
115 | + */ | ||
108 | @RequestMapping("warehouse") | 116 | @RequestMapping("warehouse") |
109 | public String warehousePick(OutpropApplyPickInfo pickInfo, Model model, | 117 | public String warehousePick(OutpropApplyPickInfo pickInfo, Model model, |
110 | RedirectAttributes attributes) { | 118 | RedirectAttributes attributes) { |
... | @@ -114,16 +122,18 @@ public class PickAction { | ... | @@ -114,16 +122,18 @@ public class PickAction { |
114 | return "user/pick/warehouseDetail.jsp"; | 122 | return "user/pick/warehouseDetail.jsp"; |
115 | } | 123 | } |
116 | attributes.addFlashAttribute("warehouse", | 124 | attributes.addFlashAttribute("warehouse", |
117 | - warehouseDao.queryByCode(pickInfo.getWarehouseCode())); | 125 | + warehouseDao.queryByCode(pickInfo.getWarehouseCode())); |
118 | - return "redirect:/user/pick/payInfo?pickType=2"; | 126 | + return "redirect:/user/pick/payInfo?pickType=1"; |
119 | } | 127 | } |
120 | 128 | ||
121 | - /**顺丰到付*/ | 129 | + /** |
130 | + * 顺丰到付 | ||
131 | + */ | ||
122 | @RequestMapping("express")//todo 顺丰到付提货进入支付-提货详情页 | 132 | @RequestMapping("express")//todo 顺丰到付提货进入支付-提货详情页 |
123 | public String expressPick(OutpropApplyPickInfo pickInfo, Integer addressId, Model model, | 133 | public String expressPick(OutpropApplyPickInfo pickInfo, Integer addressId, Model model, |
124 | - RedirectAttributes attributes) { | 134 | + RedirectAttributes attributes, HttpSession session) { |
125 | ResultInfo resultInfo = pickBiz.expressPick(pickInfo, addressId); | 135 | ResultInfo resultInfo = pickBiz.expressPick(pickInfo, addressId); |
126 | - | 136 | + session.setAttribute("pickInfo",pickInfo); |
127 | this.putApplys(resultInfo, pickInfo, "3", model, attributes); | 137 | this.putApplys(resultInfo, pickInfo, "3", model, attributes); |
128 | if (resultInfo.getCode() == 0) { | 138 | if (resultInfo.getCode() == 0) { |
129 | model.addAttribute("addresses", addressDao.queryByUserId(ActionUtil.getUser().getClient_id())); | 139 | model.addAttribute("addresses", addressDao.queryByUserId(ActionUtil.getUser().getClient_id())); |
... | @@ -133,20 +143,25 @@ public class PickAction { | ... | @@ -133,20 +143,25 @@ public class PickAction { |
133 | return "redirect:/user/pick/payInfo?pickType=2"; | 143 | return "redirect:/user/pick/payInfo?pickType=2"; |
134 | } | 144 | } |
135 | 145 | ||
136 | - /**转赵涌在线拍卖*/ | 146 | + /** |
147 | + * 转赵涌在线拍卖 | ||
148 | + */ | ||
137 | @RequestMapping("zhaoonline")//todo `转赵涌在线拍卖跳转 | 149 | @RequestMapping("zhaoonline")//todo `转赵涌在线拍卖跳转 |
138 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, | 150 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, |
139 | - RedirectAttributes attributes) { | 151 | + RedirectAttributes attributes, HttpSession session) { |
140 | - ResultInfo resultInfo = pickBiz.zhaoonlinePick(pickInfo); | 152 | + session.setAttribute("pickInfo",pickInfo); |
153 | + ResultInfo resultInfo = pickBiz.zhaoonlinePickNew(pickInfo); | ||
141 | 154 | ||
142 | this.putApplys(resultInfo, pickInfo, "1", model, attributes); | 155 | this.putApplys(resultInfo, pickInfo, "1", model, attributes); |
143 | if (resultInfo.getCode() == 0) { | 156 | if (resultInfo.getCode() == 0) { |
144 | return "user/pick/zhaoonline.jsp"; | 157 | return "user/pick/zhaoonline.jsp"; |
145 | } | 158 | } |
146 | - return "redirect:/user/pick/payInfo?pickType=1"; | 159 | + return "redirect:/user/pick/payInfo?pickType=3"; |
147 | } | 160 | } |
148 | 161 | ||
149 | - /**网点自提*/ | 162 | + /** |
163 | + * 网点自提 | ||
164 | + */ | ||
150 | @SuppressWarnings("unchecked") | 165 | @SuppressWarnings("unchecked") |
151 | @RequestMapping("warehouseDetail") | 166 | @RequestMapping("warehouseDetail") |
152 | public String warehousePickView(@RequestParam("warehouseCode") String warehouseCode, | 167 | public String warehousePickView(@RequestParam("warehouseCode") String warehouseCode, |
... | @@ -156,7 +171,7 @@ public class PickAction { | ... | @@ -156,7 +171,7 @@ public class PickAction { |
156 | 171 | ||
157 | applys = applys.replace("\'", "\""); | 172 | applys = applys.replace("\'", "\""); |
158 | session.setAttribute("applyList", | 173 | session.setAttribute("applyList", |
159 | - JsonUtil.fromJson(applys, List.class, OutpropApplyInfo.class)); | 174 | + JsonUtil.fromJson(applys, List.class, OutpropApplyInfo.class)); |
160 | warehouse = warehouseBiz.parseWarehouseTime(warehouse); | 175 | warehouse = warehouseBiz.parseWarehouseTime(warehouse); |
161 | model.addAttribute("warehouse", warehouse); | 176 | model.addAttribute("warehouse", warehouse); |
162 | return "user/pick/warehouseDetail.jsp"; | 177 | return "user/pick/warehouseDetail.jsp"; |
... | @@ -170,22 +185,26 @@ public class PickAction { | ... | @@ -170,22 +185,26 @@ public class PickAction { |
170 | 185 | ||
171 | @RequestMapping("payInfo") | 186 | @RequestMapping("payInfo") |
172 | @SuppressWarnings("unchecked")//todo 计算托管费用 | 187 | @SuppressWarnings("unchecked")//todo 计算托管费用 |
173 | - public String payInfo(HttpSession session,Model model,String pickType){ | 188 | + public String payInfo(HttpSession session, Model model, String pickType, |
174 | - String userId = ActionUtil.getUser().getUserId(); | 189 | + OutpropApplyPickInfo pickInfo, Integer addressId) { |
175 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session.getAttribute("applyList"); | 190 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session.getAttribute("applyList"); |
176 | int pickTotal = 0; | 191 | int pickTotal = 0; |
192 | + Integer trusteeshipCycle = DateUtil.getTrustCycle(); | ||
177 | for (OutpropApplyInfo apply : applyList) { | 193 | for (OutpropApplyInfo apply : applyList) { |
178 | - apply.setTrusteeshipCycle(DateUtil.getTrustCycle()); | 194 | + apply.setTrusteeshipCycle(trusteeshipCycle); |
179 | apply.setWarehousingCharges(apply.getOccurAmount() * apply.getTrusteeshipCycle() * 0.01D); | 195 | apply.setWarehousingCharges(apply.getOccurAmount() * apply.getTrusteeshipCycle() * 0.01D); |
180 | pickTotal += apply.getOccurAmount(); | 196 | pickTotal += apply.getOccurAmount(); |
181 | } | 197 | } |
182 | - Double totoalAmount = 0.01D * DateUtil.getTrustCycle() * pickTotal; | 198 | + BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(trusteeshipCycle)). |
199 | + multiply(new BigDecimal(pickTotal)); | ||
200 | + if (addressId != null){ | ||
201 | + model.addAttribute("pickName", addressDao.queryById(addressId).getUserName()); | ||
202 | + } | ||
203 | + model.addAttribute("pickDate", pickInfo.getPickDate()); | ||
183 | model.addAttribute("pickType", pickType); | 204 | model.addAttribute("pickType", pickType); |
184 | model.addAttribute("applyList", applyList); | 205 | model.addAttribute("applyList", applyList); |
185 | - model.addAttribute("warehousingCharges", totoalAmount); | 206 | + model.addAttribute("warehousingCharges", totalAmount); |
186 | - model.addAttribute("totalAmount", totoalAmount + 6D); | 207 | + model.addAttribute("totalAmount", totalAmount.add(new BigDecimal("6"))); |
187 | - model.addAttribute("pickTotal", pickTotal); | ||
188 | - model.addAttribute("addresses", JsonUtil.toJson(addressDao.queryByUserId(userId))); | ||
189 | return "user/pick/payInfo.jsp"; | 208 | return "user/pick/payInfo.jsp"; |
190 | } | 209 | } |
191 | 210 | ... | ... |
... | @@ -105,6 +105,23 @@ public class PickBiz { | ... | @@ -105,6 +105,23 @@ public class PickBiz { |
105 | return amount; | 105 | return amount; |
106 | } | 106 | } |
107 | 107 | ||
108 | + public ResultInfo selfPickNew(OutpropApplyPickInfo pickInfo){ | ||
109 | + String pickType = StringUtils.isBlank(pickInfo.getDelegateName()) ? "0" : "1"; | ||
110 | + if ("1".equals(pickType)) { | ||
111 | + if (StringUtils.isBlank(pickInfo.getDelegateId())) { | ||
112 | + return new ResultInfo(0, "委托人证件号码不能为空"); | ||
113 | + } | ||
114 | + if (StringUtils.isBlank(pickInfo.getDelegateName())) { | ||
115 | + return new ResultInfo(0, "委托人姓名不能为空"); | ||
116 | + } | ||
117 | + } | ||
118 | + String pickDate = pickInfo.getPickDate(); | ||
119 | + if (StringUtils.isBlank(pickDate)) { | ||
120 | + return new ResultInfo(0, "提货日期不能为空"); | ||
121 | + } | ||
122 | + return new ResultInfo(-1,""); | ||
123 | + } | ||
124 | + | ||
108 | /** | 125 | /** |
109 | * 自提 | 126 | * 自提 |
110 | */ | 127 | */ |
... | @@ -241,6 +258,15 @@ public class PickBiz { | ... | @@ -241,6 +258,15 @@ public class PickBiz { |
241 | return resultInfo; | 258 | return resultInfo; |
242 | } | 259 | } |
243 | 260 | ||
261 | + public ResultInfo zhaoonlinePickNew(OutpropApplyPickInfo pickInfo){ | ||
262 | + try { | ||
263 | + zhaoonlineBiz.checkZhaoonlineId(pickInfo.getZhaoonlineId()); | ||
264 | + } catch (ServiceException e) { | ||
265 | + return new ResultInfo(0, e.getMessage()); | ||
266 | + } | ||
267 | + return new ResultInfo(-1,""); | ||
268 | + } | ||
269 | + | ||
244 | /**转赵涌在线拍卖*/ | 270 | /**转赵涌在线拍卖*/ |
245 | public ResultInfo zhaoonlinePick(OutpropApplyPickInfo pickInfo) { | 271 | public ResultInfo zhaoonlinePick(OutpropApplyPickInfo pickInfo) { |
246 | //ResultInfo resultInfo = this.checkPickTime(9, 16); | 272 | //ResultInfo resultInfo = this.checkPickTime(9, 16); | ... | ... |
... | @@ -5,6 +5,7 @@ import com.cjs.site.dao.user.pick.PickPackDao; | ... | @@ -5,6 +5,7 @@ import com.cjs.site.dao.user.pick.PickPackDao; |
5 | import com.cjs.site.model.union.CreateQrCode; | 5 | import com.cjs.site.model.union.CreateQrCode; |
6 | import com.cjs.site.model.union.UnionResponse; | 6 | import com.cjs.site.model.union.UnionResponse; |
7 | import com.cjs.site.model.user.pick.OutpropApplyPayInfo; | 7 | import com.cjs.site.model.user.pick.OutpropApplyPayInfo; |
8 | +import com.cjs.site.model.user.pick.OutpropApplyPickInfo; | ||
8 | import com.cjs.site.model.user.pick.PickPackInfo; | 9 | import com.cjs.site.model.user.pick.PickPackInfo; |
9 | import com.cjs.site.util.lang.DateEnum; | 10 | import com.cjs.site.util.lang.DateEnum; |
10 | import com.cjs.site.util.lang.DateUtil; | 11 | import com.cjs.site.util.lang.DateUtil; |
... | @@ -20,7 +21,8 @@ import org.springframework.transaction.TransactionDefinition; | ... | @@ -20,7 +21,8 @@ import org.springframework.transaction.TransactionDefinition; |
20 | import org.springframework.transaction.TransactionStatus; | 21 | import org.springframework.transaction.TransactionStatus; |
21 | import org.springframework.transaction.support.DefaultTransactionDefinition; | 22 | import org.springframework.transaction.support.DefaultTransactionDefinition; |
22 | 23 | ||
23 | -import javax.servlet.http.HttpServletRequest; | 24 | +import javax.servlet.http.HttpSession; |
25 | +import java.math.BigDecimal; | ||
24 | import java.util.HashMap; | 26 | import java.util.HashMap; |
25 | import java.util.List; | 27 | import java.util.List; |
26 | import java.util.Map; | 28 | import java.util.Map; |
... | @@ -41,7 +43,11 @@ public class PickPayBiz { | ... | @@ -41,7 +43,11 @@ public class PickPayBiz { |
41 | @Qualifier("transactionManagerOracle") | 43 | @Qualifier("transactionManagerOracle") |
42 | private DataSourceTransactionManager transactionManager; | 44 | private DataSourceTransactionManager transactionManager; |
43 | 45 | ||
44 | - public Map<String, Object> createOrder() { | 46 | + public Map<String, Object> createOrder(HttpSession session) { |
47 | + String pickType = (String)session.getAttribute("pickType"); | ||
48 | + OutpropApplyPickInfo pickInfo = (OutpropApplyPickInfo)session.getAttribute("pickInfo"); | ||
49 | + System.out.println("---------------------------" + pickType); | ||
50 | + System.out.println("---------------------------" + JsonUtil.toJson(pickInfo)); | ||
45 | Map<String, Object> result = new HashMap<String, Object>(); | 51 | Map<String, Object> result = new HashMap<String, Object>(); |
46 | result.put("code", true); | 52 | result.put("code", true); |
47 | 53 | ||
... | @@ -51,13 +57,16 @@ public class PickPayBiz { | ... | @@ -51,13 +57,16 @@ public class PickPayBiz { |
51 | for (PickPackInfo apply : applyList) { | 57 | for (PickPackInfo apply : applyList) { |
52 | pickTotal += apply.getCurrentAmount(); | 58 | pickTotal += apply.getCurrentAmount(); |
53 | } | 59 | } |
54 | - Double totalAmount = (0.01D * DateUtil.getTrustCycle() * pickTotal) + 6D; | 60 | +// BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(DateUtil.getTrustCycle())). |
61 | +// multiply(new BigDecimal(pickTotal)).add(new BigDecimal("6")); | ||
62 | + BigDecimal totalAmount = new BigDecimal("0.01");//调试接口代码写死 | ||
55 | result.put("totalAmount", totalAmount); | 63 | result.put("totalAmount", totalAmount); |
56 | String pickNo = pickBiz.createPickNo(); | 64 | String pickNo = pickBiz.createPickNo(); |
57 | try { | 65 | try { |
58 | CreateQrCode createQrCode = new CreateQrCode(); | 66 | CreateQrCode createQrCode = new CreateQrCode(); |
59 | - createQrCode.setBillNo(UnionPayUtil.getOrderNo()); | 67 | + createQrCode.setQrCodeId(UnionPayUtil.getQrCodeId()); |
60 | - createQrCode.setTotalAmount(totalAmount.toString()); | 68 | + createQrCode.setBillNo(createQrCode.getQrCodeId()); |
69 | + createQrCode.setTotalAmount(String.valueOf(totalAmount.multiply(BigDecimal.valueOf(100)).intValue())); | ||
61 | createQrCode.setRequestTimestamp(DateUtil.getNow()); | 70 | createQrCode.setRequestTimestamp(DateUtil.getNow()); |
62 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | 71 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); |
63 | createQrCode.setSrcReserve(pickNo); | 72 | createQrCode.setSrcReserve(pickNo); |
... | @@ -66,7 +75,7 @@ public class PickPayBiz { | ... | @@ -66,7 +75,7 @@ public class PickPayBiz { |
66 | String json = UnionPayUtil.sendPost(UnionConstants.CREATE_ORDER, mapTypes); | 75 | String json = UnionPayUtil.sendPost(UnionConstants.CREATE_ORDER, mapTypes); |
67 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | 76 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); |
68 | if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { | 77 | if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { |
69 | - result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getBillNo())); | 78 | + result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getQrCodeId())); |
70 | insertPickPay(userId, createQrCode.getBillNo(), pickNo); | 79 | insertPickPay(userId, createQrCode.getBillNo(), pickNo); |
71 | } else { | 80 | } else { |
72 | result.put("code", false); | 81 | result.put("code", false); |
... | @@ -79,8 +88,7 @@ public class PickPayBiz { | ... | @@ -79,8 +88,7 @@ public class PickPayBiz { |
79 | return result; | 88 | return result; |
80 | } | 89 | } |
81 | 90 | ||
82 | - public Boolean isValidNotify(HttpServletRequest request) { | 91 | + public Boolean isValidNotify(Map<String, String> result) { |
83 | - Map<String, String> result = UnionPayUtil.getRequestParams(request); | ||
84 | if (UnionPayUtil.checkSign(result)) { | 92 | if (UnionPayUtil.checkSign(result)) { |
85 | DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | 93 | DefaultTransactionDefinition def = new DefaultTransactionDefinition(); |
86 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | 94 | def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); |
... | @@ -94,6 +102,7 @@ public class PickPayBiz { | ... | @@ -94,6 +102,7 @@ public class PickPayBiz { |
94 | outpropApplyPayDao.update(update); | 102 | outpropApplyPayDao.update(update); |
95 | 103 | ||
96 | //todo 更新库存,生成提货单<包含提货类型,提货人,提货日期,保价费> | 104 | //todo 更新库存,生成提货单<包含提货类型,提货人,提货日期,保价费> |
105 | + | ||
97 | } | 106 | } |
98 | transactionManager.commit(status); | 107 | transactionManager.commit(status); |
99 | return true; | 108 | return true; | ... | ... |
1 | package com.cjs.site.dao.user.pick; | 1 | package com.cjs.site.dao.user.pick; |
2 | 2 | ||
3 | import com.cjs.site.model.user.pick.OutpropApplyPayInfo; | 3 | import com.cjs.site.model.user.pick.OutpropApplyPayInfo; |
4 | +import com.cjs.site.util.db.OracleDao; | ||
4 | import org.springframework.stereotype.Repository; | 5 | import org.springframework.stereotype.Repository; |
5 | 6 | ||
6 | /** | 7 | /** |
7 | * Created by bruce on 2019-05-06 16:22 | 8 | * Created by bruce on 2019-05-06 16:22 |
8 | */ | 9 | */ |
9 | @Repository | 10 | @Repository |
10 | -public interface OutpropApplyPayDao { | 11 | +public interface OutpropApplyPayDao extends OracleDao { |
11 | 12 | ||
12 | void insert(OutpropApplyPayInfo entity); | 13 | void insert(OutpropApplyPayInfo entity); |
13 | 14 | ... | ... |
... | @@ -11,7 +11,7 @@ public class CreateQrCode implements Serializable { | ... | @@ -11,7 +11,7 @@ public class CreateQrCode implements Serializable { |
11 | 11 | ||
12 | private static final long serialVersionUID = 4945657951041450816L; | 12 | private static final long serialVersionUID = 4945657951041450816L; |
13 | 13 | ||
14 | - private String msgSrc = "赵涌牛"; | 14 | + private String msgSrc = "WWW.TEST.COM"; |
15 | private String msgType = "bills.getQRCode"; | 15 | private String msgType = "bills.getQRCode"; |
16 | private String requestTimestamp; | 16 | private String requestTimestamp; |
17 | private String srcReserve; | 17 | private String srcReserve; |
... | @@ -21,6 +21,9 @@ public class CreateQrCode implements Serializable { | ... | @@ -21,6 +21,9 @@ public class CreateQrCode implements Serializable { |
21 | private String billNo; | 21 | private String billNo; |
22 | private String billDate; | 22 | private String billDate; |
23 | private String totalAmount; | 23 | private String totalAmount; |
24 | + private String qrCodeId; | ||
25 | + private String returnUrl = "https://www.zhao.com/login"; | ||
26 | + private String notifyUrl = "http://192.168.10.106/notify.do"; | ||
24 | 27 | ||
25 | public String getMsgSrc() { | 28 | public String getMsgSrc() { |
26 | return msgSrc; | 29 | return msgSrc; |
... | @@ -101,4 +104,28 @@ public class CreateQrCode implements Serializable { | ... | @@ -101,4 +104,28 @@ public class CreateQrCode implements Serializable { |
101 | public void setTotalAmount(String totalAmount) { | 104 | public void setTotalAmount(String totalAmount) { |
102 | this.totalAmount = totalAmount; | 105 | this.totalAmount = totalAmount; |
103 | } | 106 | } |
107 | + | ||
108 | + public String getQrCodeId() { | ||
109 | + return qrCodeId; | ||
110 | + } | ||
111 | + | ||
112 | + public void setQrCodeId(String qrCodeId) { | ||
113 | + this.qrCodeId = qrCodeId; | ||
114 | + } | ||
115 | + | ||
116 | + public String getReturnUrl() { | ||
117 | + return returnUrl; | ||
118 | + } | ||
119 | + | ||
120 | + public void setReturnUrl(String returnUrl) { | ||
121 | + this.returnUrl = returnUrl; | ||
122 | + } | ||
123 | + | ||
124 | + public String getNotifyUrl() { | ||
125 | + return notifyUrl; | ||
126 | + } | ||
127 | + | ||
128 | + public void setNotifyUrl(String notifyUrl) { | ||
129 | + this.notifyUrl = notifyUrl; | ||
130 | + } | ||
104 | } | 131 | } | ... | ... |
... | @@ -7,7 +7,7 @@ import com.cjs.site.model.BaseInfo; | ... | @@ -7,7 +7,7 @@ import com.cjs.site.model.BaseInfo; |
7 | */ | 7 | */ |
8 | public class OutpropApplyPayInfo extends BaseInfo { | 8 | public class OutpropApplyPayInfo extends BaseInfo { |
9 | 9 | ||
10 | - private static final long serialVersionUID = 6737890770319470632L; | 10 | + private static final long serialVersionUID = 1L; |
11 | 11 | ||
12 | private String tradeNo; | 12 | private String tradeNo; |
13 | private String clientId; | 13 | private String clientId; | ... | ... |
... | @@ -33,7 +33,7 @@ public enum DateEnum { | ... | @@ -33,7 +33,7 @@ public enum DateEnum { |
33 | DATETIME2("yyyy-MM-dd HH:mm"), | 33 | DATETIME2("yyyy-MM-dd HH:mm"), |
34 | 34 | ||
35 | //yyyyMMddmmHHssSSS | 35 | //yyyyMMddmmHHssSSS |
36 | - UNSIGNED_DATE_TIME_MILLS("yyyyMMddmmHHssSSS"); | 36 | + UNSIGNED_DATE_TIME_MILLS("yyyyMMddHHmmssSSS"); |
37 | private String value; | 37 | private String value; |
38 | 38 | ||
39 | private DateEnum(String value) { | 39 | private DateEnum(String value) { | ... | ... |
... | @@ -20,22 +20,22 @@ public class UnionConstants { | ... | @@ -20,22 +20,22 @@ public class UnionConstants { |
20 | /** | 20 | /** |
21 | * 银联商务分配的来源编号 | 21 | * 银联商务分配的来源编号 |
22 | */ | 22 | */ |
23 | - public static final String MSG_ID = "0001"; | 23 | + public static final String MSG_ID = "3194"; |
24 | /** | 24 | /** |
25 | * 银联商务分配的商户号 | 25 | * 银联商务分配的商户号 |
26 | */ | 26 | */ |
27 | - public static final String MID = "98632165101"; | 27 | + public static final String MID = "898340149000005"; |
28 | /** | 28 | /** |
29 | * 终端号,默认赋值 | 29 | * 终端号,默认赋值 |
30 | */ | 30 | */ |
31 | - public static final String TID = "A00000001"; | 31 | + public static final String TID = "88880001"; |
32 | /** | 32 | /** |
33 | * 银联商务分配的密钥 | 33 | * 银联商务分配的密钥 |
34 | */ | 34 | */ |
35 | - public static final String MD5_KEY = "SFASDGSDDFERQRSADFAYTJRGJGFH"; | 35 | + public static final String MD5_KEY = "fcAmtnx7MwismjWNhNKdHC44mNXtnEQeJkRrhKJwyrW2ysRR"; |
36 | /** | 36 | /** |
37 | * 银联商务response返回正确的状态码 | 37 | * 银联商务response返回正确的状态码 |
38 | */ | 38 | */ |
39 | - public static final String SUCCESS_CODE = "BAD_REQUEST"; | 39 | + public static final String SUCCESS_CODE = "SUCCESS"; |
40 | 40 | ||
41 | } | 41 | } | ... | ... |
... | @@ -5,19 +5,15 @@ import com.cjs.site.model.union.UnionResponse; | ... | @@ -5,19 +5,15 @@ import com.cjs.site.model.union.UnionResponse; |
5 | import com.cjs.site.util.lang.DateEnum; | 5 | import com.cjs.site.util.lang.DateEnum; |
6 | import com.cjs.site.util.lang.DateUtil; | 6 | import com.cjs.site.util.lang.DateUtil; |
7 | import com.cjs.site.util.lang.JsonUtil; | 7 | import com.cjs.site.util.lang.JsonUtil; |
8 | -import com.cjs.site.util.sand.SandPayUtil; | ||
9 | import org.apache.commons.codec.digest.DigestUtils; | 8 | import org.apache.commons.codec.digest.DigestUtils; |
10 | import org.apache.commons.lang3.RandomStringUtils; | 9 | import org.apache.commons.lang3.RandomStringUtils; |
11 | import org.apache.commons.lang3.StringUtils; | 10 | import org.apache.commons.lang3.StringUtils; |
12 | 11 | ||
13 | -import javax.servlet.http.HttpServletRequest; | ||
14 | import java.io.*; | 12 | import java.io.*; |
15 | import java.net.URL; | 13 | import java.net.URL; |
16 | import java.net.URLConnection; | 14 | import java.net.URLConnection; |
17 | import java.net.URLDecoder; | 15 | import java.net.URLDecoder; |
18 | -import java.util.Date; | 16 | +import java.util.*; |
19 | -import java.util.HashMap; | ||
20 | -import java.util.Map; | ||
21 | 17 | ||
22 | /** | 18 | /** |
23 | * Created by bruce on 2019-05-14 10:07 | 19 | * Created by bruce on 2019-05-14 10:07 |
... | @@ -29,11 +25,37 @@ public class UnionPayUtil { | ... | @@ -29,11 +25,37 @@ public class UnionPayUtil { |
29 | } | 25 | } |
30 | 26 | ||
31 | private static String makeSign(Map<String, String> params) { | 27 | private static String makeSign(Map<String, String> params) { |
32 | - String preStr = SandPayUtil.map2String(params); | 28 | + String preStr = buildSignString(params); |
33 | String text = preStr + UnionConstants.MD5_KEY; | 29 | String text = preStr + UnionConstants.MD5_KEY; |
34 | return DigestUtils.md5Hex(getContentBytes(text)).toUpperCase(); | 30 | return DigestUtils.md5Hex(getContentBytes(text)).toUpperCase(); |
35 | } | 31 | } |
36 | 32 | ||
33 | + private static String buildSignString(Map<String, String> params) { | ||
34 | + if (params == null || params.size() == 0) { | ||
35 | + return ""; | ||
36 | + } | ||
37 | + List<String> keys = new ArrayList<String>(params.size()); | ||
38 | + for (String key : params.keySet()) { | ||
39 | + if ("sign".equals(key)) | ||
40 | + continue; | ||
41 | + if (StringUtils.isEmpty(params.get(key))) | ||
42 | + continue; | ||
43 | + keys.add(key); | ||
44 | + } | ||
45 | + Collections.sort(keys); | ||
46 | + StringBuilder buf = new StringBuilder(); | ||
47 | + for (int i = 0; i < keys.size(); i++) { | ||
48 | + String key = keys.get(i); | ||
49 | + String value = params.get(key); | ||
50 | + if (i == keys.size() - 1) { | ||
51 | + buf.append(key).append("=").append(value); | ||
52 | + } else { | ||
53 | + buf.append(key).append("=").append(value).append("&"); | ||
54 | + } | ||
55 | + } | ||
56 | + return buf.toString(); | ||
57 | + } | ||
58 | + | ||
37 | public static Boolean checkSign(Map<String, String> params) { | 59 | public static Boolean checkSign(Map<String, String> params) { |
38 | String sign = params.get("sign"); | 60 | String sign = params.get("sign"); |
39 | if (StringUtils.isBlank(sign)) { | 61 | if (StringUtils.isBlank(sign)) { |
... | @@ -43,7 +65,7 @@ public class UnionPayUtil { | ... | @@ -43,7 +65,7 @@ public class UnionPayUtil { |
43 | return StringUtils.equalsIgnoreCase(sign, signV); | 65 | return StringUtils.equalsIgnoreCase(sign, signV); |
44 | } | 66 | } |
45 | 67 | ||
46 | - public static String getOrderNo() { | 68 | + public static String getQrCodeId() { |
47 | String date = DateUtil.parseDate(new Date(), DateEnum.UNSIGNED_DATE_TIME_MILLS); | 69 | String date = DateUtil.parseDate(new Date(), DateEnum.UNSIGNED_DATE_TIME_MILLS); |
48 | String rand = RandomStringUtils.randomNumeric(7); | 70 | String rand = RandomStringUtils.randomNumeric(7); |
49 | return UnionConstants.MSG_ID + date + rand; | 71 | return UnionConstants.MSG_ID + date + rand; |
... | @@ -57,7 +79,7 @@ public class UnionPayUtil { | ... | @@ -57,7 +79,7 @@ public class UnionPayUtil { |
57 | } | 79 | } |
58 | } | 80 | } |
59 | 81 | ||
60 | - public static Map<String, String> getRequestParams(HttpServletRequest request) { | 82 | +/* public static Map<String, String> getRequestParams(HttpServletRequest request) { |
61 | Map<String, String[]> params = request.getParameterMap(); | 83 | Map<String, String[]> params = request.getParameterMap(); |
62 | Map<String, String> params2 = new HashMap<String, String>(); | 84 | Map<String, String> params2 = new HashMap<String, String>(); |
63 | for (String key : params.keySet()) { | 85 | for (String key : params.keySet()) { |
... | @@ -67,19 +89,21 @@ public class UnionPayUtil { | ... | @@ -67,19 +89,21 @@ public class UnionPayUtil { |
67 | } | 89 | } |
68 | } | 90 | } |
69 | return params2; | 91 | return params2; |
70 | - } | 92 | + }*/ |
71 | 93 | ||
72 | @SuppressWarnings("unchecked") | 94 | @SuppressWarnings("unchecked") |
73 | public static void main(String[] args) { | 95 | public static void main(String[] args) { |
74 | CreateQrCode createQrCode = new CreateQrCode(); | 96 | CreateQrCode createQrCode = new CreateQrCode(); |
75 | - createQrCode.setBillNo(getOrderNo()); | 97 | + createQrCode.setQrCodeId(getQrCodeId()); |
76 | - createQrCode.setTotalAmount("1D"); | 98 | + createQrCode.setBillNo(createQrCode.getQrCodeId()); |
99 | + createQrCode.setTotalAmount("1"); | ||
77 | createQrCode.setRequestTimestamp(DateUtil.getNow()); | 100 | createQrCode.setRequestTimestamp(DateUtil.getNow()); |
78 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | 101 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); |
79 | createQrCode.setSrcReserve("201905140001"); | 102 | createQrCode.setSrcReserve("201905140001"); |
80 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | 103 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); |
81 | String json = sendPost(UnionConstants.CREATE_ORDER, mapTypes); | 104 | String json = sendPost(UnionConstants.CREATE_ORDER, mapTypes); |
82 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | 105 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); |
106 | + System.out.println(createQrCode.getQrCodeId()); | ||
83 | System.out.println(JsonUtil.toJson(response)); | 107 | System.out.println(JsonUtil.toJson(response)); |
84 | } | 108 | } |
85 | 109 | ||
... | @@ -88,8 +112,7 @@ public class UnionPayUtil { | ... | @@ -88,8 +112,7 @@ public class UnionPayUtil { |
88 | BufferedReader in = null; | 112 | BufferedReader in = null; |
89 | StringBuilder result = new StringBuilder(); | 113 | StringBuilder result = new StringBuilder(); |
90 | 114 | ||
91 | - Map<String, String> params = new HashMap<String, String>(); | 115 | + data.put("sign", makeSign(data)); |
92 | - params.put("sign", makeSign(data)); | ||
93 | 116 | ||
94 | try { | 117 | try { |
95 | URL realUrl = new URL(url); | 118 | URL realUrl = new URL(url); |
... | @@ -100,7 +123,7 @@ public class UnionPayUtil { | ... | @@ -100,7 +123,7 @@ public class UnionPayUtil { |
100 | conn.setDoOutput(true); | 123 | conn.setDoOutput(true); |
101 | conn.setDoInput(true); | 124 | conn.setDoInput(true); |
102 | out = new PrintWriter(conn.getOutputStream()); | 125 | out = new PrintWriter(conn.getOutputStream()); |
103 | - out.print(SandPayUtil.map2String(params)); | 126 | + out.write(JsonUtil.toJson(data)); |
104 | out.flush(); | 127 | out.flush(); |
105 | in = new BufferedReader(new InputStreamReader(conn.getInputStream())); | 128 | in = new BufferedReader(new InputStreamReader(conn.getInputStream())); |
106 | String line; | 129 | String line; | ... | ... |
... | @@ -18,7 +18,8 @@ | ... | @@ -18,7 +18,8 @@ |
18 | 18 | ||
19 | <insert id="insert" parameterType="OutpropApplyPayInfo"> | 19 | <insert id="insert" parameterType="OutpropApplyPayInfo"> |
20 | INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS) | 20 | INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS) |
21 | - VALUES (#{tradeNo}, #{createdAt}, #{updatedAt}, #{applyNo}, #{payAt}, #{status}) | 21 | + VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR}, |
22 | + #{applyNo, jdbcType=VARCHAR}, #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR}) | ||
22 | </insert> | 23 | </insert> |
23 | 24 | ||
24 | <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap"> | 25 | <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap"> | ... | ... |
... | @@ -34,7 +34,7 @@ | ... | @@ -34,7 +34,7 @@ |
34 | <a class="tab-seletced" href="/user/pick/tab?pickType=2">顺丰到付</a> | 34 | <a class="tab-seletced" href="/user/pick/tab?pickType=2">顺丰到付</a> |
35 | </div> | 35 | </div> |
36 | <div class="content zhaoonline"> | 36 | <div class="content zhaoonline"> |
37 | - <form id="pickForm" action="${ctx }/user/pick/payInfo" method="post"> | 37 | + <form id="pickForm" action="${ctx }/user/pick/payInfo?pickType=2" method="post"> |
38 | <div class="aBtn"> | 38 | <div class="aBtn"> |
39 | <h4 >请选择收货地址</h4> | 39 | <h4 >请选择收货地址</h4> |
40 | <a class="red-btn add-address" href="${ctx }/user/address/search">添加收货地址</a> | 40 | <a class="red-btn add-address" href="${ctx }/user/address/search">添加收货地址</a> | ... | ... |
... | @@ -100,7 +100,7 @@ | ... | @@ -100,7 +100,7 @@ |
100 | 提货方式: | 100 | 提货方式: |
101 | </div> | 101 | </div> |
102 | <div style="display: inline-block;vertical-align: top;width: 500px;"> | 102 | <div style="display: inline-block;vertical-align: top;width: 500px;"> |
103 | - <c:if test="${pick.pickType == '0'}">上门自提</c:if> | 103 | + <c:if test="${pickType == '1'}">上门自提</c:if> |
104 | <c:if test="${pickType == '2' }">顺丰到付</c:if> | 104 | <c:if test="${pickType == '2' }">顺丰到付</c:if> |
105 | <c:if test="${pickType == '3' }">转赵涌在线</c:if> | 105 | <c:if test="${pickType == '3' }">转赵涌在线</c:if> |
106 | </div> | 106 | </div> |
... | @@ -110,17 +110,19 @@ | ... | @@ -110,17 +110,19 @@ |
110 | 提货人: | 110 | 提货人: |
111 | </div> | 111 | </div> |
112 | <div style="display: inline-block;vertical-align: top;width: 500px;"> | 112 | <div style="display: inline-block;vertical-align: top;width: 500px;"> |
113 | - 陈鹏 | 113 | + ${pickName } |
114 | </div> | 114 | </div> |
115 | </div> | 115 | </div> |
116 | + <c:if test="${pickType == '1'}"> | ||
116 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> | 117 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> |
117 | <div style="display: inline-block;vertical-align: top;width: 100px;"> | 118 | <div style="display: inline-block;vertical-align: top;width: 100px;"> |
118 | 提货日期: | 119 | 提货日期: |
119 | </div> | 120 | </div> |
120 | <div style="display: inline-block;vertical-align: top;width: 500px;"> | 121 | <div style="display: inline-block;vertical-align: top;width: 500px;"> |
121 | - 2019年4月25日 | 122 | + ${pickDate } |
122 | </div> | 123 | </div> |
123 | </div> | 124 | </div> |
125 | + </c:if> | ||
124 | </div> | 126 | </div> |
125 | <h4 style="margin-top: 60px;font-weight: bold;">仓储明细</h4> | 127 | <h4 style="margin-top: 60px;font-weight: bold;">仓储明细</h4> |
126 | <div style="width: 760px;margin-top: 20px;"> | 128 | <div style="width: 760px;margin-top: 20px;"> | ... | ... |
-
Please register or login to post a comment