Showing
7 changed files
with
70 additions
and
23 deletions
1 | package com.cjs.site.action.user.fund; | 1 | 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 org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
5 | import org.springframework.stereotype.Controller; | 6 | import org.springframework.stereotype.Controller; |
6 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
... | @@ -30,7 +31,8 @@ public class PickPayAction { | ... | @@ -30,7 +31,8 @@ public class PickPayAction { |
30 | 31 | ||
31 | //支付通知 | 32 | //支付通知 |
32 | @RequestMapping(value = "notify", method = RequestMethod.POST) | 33 | @RequestMapping(value = "notify", method = RequestMethod.POST) |
33 | - public String notify(Map<String,String> params) { | 34 | + public String notify(Map<String, String> params) { |
35 | + System.out.println("map----params参数" + JsonUtil.toJson(params)); | ||
34 | pickPayBiz.isValidNotify(params); | 36 | pickPayBiz.isValidNotify(params); |
35 | return "/jsp/payResult.jsp"; | 37 | return "/jsp/payResult.jsp"; |
36 | } | 38 | } | ... | ... |
... | @@ -5,6 +5,7 @@ import java.util.List; | ... | @@ -5,6 +5,7 @@ import java.util.List; |
5 | 5 | ||
6 | import javax.servlet.http.HttpSession; | 6 | import javax.servlet.http.HttpSession; |
7 | 7 | ||
8 | +import com.cjs.site.model.user.account.UserInfo; | ||
8 | import com.cjs.site.util.lang.DateUtil; | 9 | import com.cjs.site.util.lang.DateUtil; |
9 | import org.apache.logging.log4j.LogManager; | 10 | import org.apache.logging.log4j.LogManager; |
10 | import org.apache.logging.log4j.Logger; | 11 | import org.apache.logging.log4j.Logger; |
... | @@ -98,7 +99,7 @@ public class PickAction { | ... | @@ -98,7 +99,7 @@ public class PickAction { |
98 | /** | 99 | /** |
99 | * 自提 | 100 | * 自提 |
100 | */ | 101 | */ |
101 | - @RequestMapping("self")//todo 自提方式重定向页面应跳转到待支付页面 | 102 | + @RequestMapping("self") |
102 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, | 103 | public String selfPick(OutpropApplyPickInfo pickInfo, Model model, |
103 | RedirectAttributes attributes, HttpSession session) { | 104 | RedirectAttributes attributes, HttpSession session) { |
104 | ResultInfo resultInfo = pickBiz.selfPickNew(pickInfo); | 105 | ResultInfo resultInfo = pickBiz.selfPickNew(pickInfo); |
... | @@ -129,7 +130,7 @@ public class PickAction { | ... | @@ -129,7 +130,7 @@ public class PickAction { |
129 | /** | 130 | /** |
130 | * 顺丰到付 | 131 | * 顺丰到付 |
131 | */ | 132 | */ |
132 | - @RequestMapping("express")//todo 顺丰到付提货进入支付-提货详情页 | 133 | + @RequestMapping("express") |
133 | public String expressPick(OutpropApplyPickInfo pickInfo, Integer addressId, Model model, | 134 | public String expressPick(OutpropApplyPickInfo pickInfo, Integer addressId, Model model, |
134 | RedirectAttributes attributes, HttpSession session) { | 135 | RedirectAttributes attributes, HttpSession session) { |
135 | ResultInfo resultInfo = pickBiz.expressPick(pickInfo, addressId); | 136 | ResultInfo resultInfo = pickBiz.expressPick(pickInfo, addressId); |
... | @@ -146,7 +147,7 @@ public class PickAction { | ... | @@ -146,7 +147,7 @@ public class PickAction { |
146 | /** | 147 | /** |
147 | * 转赵涌在线拍卖 | 148 | * 转赵涌在线拍卖 |
148 | */ | 149 | */ |
149 | - @RequestMapping("zhaoonline")//todo `转赵涌在线拍卖跳转 | 150 | + @RequestMapping("zhaoonline")// |
150 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, | 151 | public String zhaoonlinePick(OutpropApplyPickInfo pickInfo, Model model, |
151 | RedirectAttributes attributes, HttpSession session) { | 152 | RedirectAttributes attributes, HttpSession session) { |
152 | session.setAttribute("pickInfo",pickInfo); | 153 | session.setAttribute("pickInfo",pickInfo); |
... | @@ -184,7 +185,7 @@ public class PickAction { | ... | @@ -184,7 +185,7 @@ public class PickAction { |
184 | } | 185 | } |
185 | 186 | ||
186 | @RequestMapping("payInfo") | 187 | @RequestMapping("payInfo") |
187 | - @SuppressWarnings("unchecked")//todo 计算托管费用 | 188 | + @SuppressWarnings("unchecked") |
188 | public String payInfo(HttpSession session, Model model, String pickType, | 189 | public String payInfo(HttpSession session, Model model, String pickType, |
189 | OutpropApplyPickInfo pickInfo, Integer addressId) { | 190 | OutpropApplyPickInfo pickInfo, Integer addressId) { |
190 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session.getAttribute("applyList"); | 191 | List<OutpropApplyInfo> applyList = (List<OutpropApplyInfo>) session.getAttribute("applyList"); |
... | @@ -197,11 +198,27 @@ public class PickAction { | ... | @@ -197,11 +198,27 @@ public class PickAction { |
197 | } | 198 | } |
198 | BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(trusteeshipCycle)). | 199 | BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(trusteeshipCycle)). |
199 | multiply(new BigDecimal(pickTotal)); | 200 | multiply(new BigDecimal(pickTotal)); |
200 | - if (addressId != null){ | 201 | + if ("1".equals(pickType)){//上门自提 |
202 | + pickInfo = (OutpropApplyPickInfo)session.getAttribute("pickInfo"); | ||
203 | + if (pickInfo.getPickType().equals("01")){ | ||
204 | + UserInfo userInfo = (UserInfo)session.getAttribute("USER_INFO"); | ||
205 | + model.addAttribute("pickName", userInfo.getClient_id()); | ||
206 | + pickInfo.setPickType("0"); | ||
207 | + }else { | ||
208 | + pickInfo.setPickType("1"); | ||
209 | + model.addAttribute("pickName", pickInfo.getDelegateName()); | ||
210 | + } | ||
211 | + }else if ("2".equals(pickType)){//顺丰到付 | ||
212 | + pickInfo.setPickType(pickType); | ||
213 | + pickInfo.setCreateDate(String.valueOf(addressId)); | ||
201 | model.addAttribute("pickName", addressDao.queryById(addressId).getUserName()); | 214 | model.addAttribute("pickName", addressDao.queryById(addressId).getUserName()); |
215 | + }else if ("3".equals(pickType)){//转赵涌在线 | ||
216 | + pickInfo = (OutpropApplyPickInfo)session.getAttribute("pickInfo"); | ||
217 | + pickInfo.setPickType(pickType); | ||
218 | + model.addAttribute("pickName", pickInfo.getZhaoonlineId()); | ||
202 | } | 219 | } |
220 | + session.setAttribute("pickInfo", pickInfo); | ||
203 | model.addAttribute("pickDate", pickInfo.getPickDate()); | 221 | model.addAttribute("pickDate", pickInfo.getPickDate()); |
204 | - model.addAttribute("pickType", pickType); | ||
205 | model.addAttribute("applyList", applyList); | 222 | model.addAttribute("applyList", applyList); |
206 | model.addAttribute("warehousingCharges", totalAmount); | 223 | model.addAttribute("warehousingCharges", totalAmount); |
207 | model.addAttribute("totalAmount", totalAmount.add(new BigDecimal("6"))); | 224 | model.addAttribute("totalAmount", totalAmount.add(new BigDecimal("6"))); | ... | ... |
... | @@ -44,10 +44,6 @@ public class PickPayBiz { | ... | @@ -44,10 +44,6 @@ public class PickPayBiz { |
44 | private DataSourceTransactionManager transactionManager; | 44 | private DataSourceTransactionManager transactionManager; |
45 | 45 | ||
46 | public Map<String, Object> createOrder(HttpSession session) { | 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)); | ||
51 | Map<String, Object> result = new HashMap<String, Object>(); | 47 | Map<String, Object> result = new HashMap<String, Object>(); |
52 | result.put("code", true); | 48 | result.put("code", true); |
53 | 49 | ||
... | @@ -69,14 +65,17 @@ public class PickPayBiz { | ... | @@ -69,14 +65,17 @@ public class PickPayBiz { |
69 | createQrCode.setTotalAmount(String.valueOf(totalAmount.multiply(BigDecimal.valueOf(100)).intValue())); | 65 | createQrCode.setTotalAmount(String.valueOf(totalAmount.multiply(BigDecimal.valueOf(100)).intValue())); |
70 | createQrCode.setRequestTimestamp(DateUtil.getNow()); | 66 | createQrCode.setRequestTimestamp(DateUtil.getNow()); |
71 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); | 67 | createQrCode.setBillDate(DateUtil.getNow(DateEnum.DATE)); |
72 | - createQrCode.setSrcReserve(pickNo); | 68 | + //此处拼接提货信息 |
69 | + OutpropApplyPickInfo pickInfo = (OutpropApplyPickInfo) session.getAttribute("pickInfo"); | ||
70 | + pickInfo.setPickNo(pickNo); | ||
71 | + createQrCode.setSrcReserve(JsonUtil.toJsonRemoveNull(pickInfo)); | ||
73 | @SuppressWarnings("unchecked") | 72 | @SuppressWarnings("unchecked") |
74 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); | 73 | Map<String, String> mapTypes = JsonUtil.fromJson(JsonUtil.toJson(createQrCode), Map.class); |
75 | String json = UnionPayUtil.sendPost(UnionConstants.CREATE_ORDER, mapTypes); | 74 | String json = UnionPayUtil.sendPost(UnionConstants.CREATE_ORDER, mapTypes); |
76 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); | 75 | UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); |
77 | if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { | 76 | if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { |
78 | result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getQrCodeId())); | 77 | result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getQrCodeId())); |
79 | - insertPickPay(userId, createQrCode.getBillNo(), pickNo); | 78 | + insertPickPay(userId, createQrCode.getBillNo(), pickNo, createQrCode.getSrcReserve()); |
80 | } else { | 79 | } else { |
81 | result.put("code", false); | 80 | result.put("code", false); |
82 | result.put("msg", response.getErrMsg()); | 81 | result.put("msg", response.getErrMsg()); |
... | @@ -101,8 +100,14 @@ public class PickPayBiz { | ... | @@ -101,8 +100,14 @@ public class PickPayBiz { |
101 | update.setStatus("2"); | 100 | update.setStatus("2"); |
102 | outpropApplyPayDao.update(update); | 101 | outpropApplyPayDao.update(update); |
103 | 102 | ||
104 | - //todo 更新库存,生成提货单<包含提货类型,提货人,提货日期,保价费> | 103 | + OutpropApplyPickInfo pickInfo = JsonUtil.fromJson(result.get("srcReserve"), OutpropApplyPickInfo.class); |
105 | - | 104 | + if ("0".equals(pickInfo.getPickType()) || "1".equals(pickInfo.getPickType())) { |
105 | + pickBiz.selfPick(pickInfo); | ||
106 | + } else if ("2".equals(pickInfo.getPickType())) { | ||
107 | + pickBiz.expressPick(pickInfo, Integer.parseInt(pickInfo.getCreateDate())); | ||
108 | + } else if ("3".equals(pickInfo.getPickType())) { | ||
109 | + pickBiz.zhaoonlinePick(pickInfo); | ||
110 | + } | ||
106 | } | 111 | } |
107 | transactionManager.commit(status); | 112 | transactionManager.commit(status); |
108 | return true; | 113 | return true; |
... | @@ -113,13 +118,14 @@ public class PickPayBiz { | ... | @@ -113,13 +118,14 @@ public class PickPayBiz { |
113 | return false; | 118 | return false; |
114 | } | 119 | } |
115 | 120 | ||
116 | - private void insertPickPay(String clientId, String tradeNo, String applyNo) { | 121 | + private void insertPickPay(String clientId, String tradeNo, String applyNo, String extInfo) { |
117 | OutpropApplyPayInfo insert = new OutpropApplyPayInfo(); | 122 | OutpropApplyPayInfo insert = new OutpropApplyPayInfo(); |
118 | insert.setCreatedAt(DateUtil.getNow()); | 123 | insert.setCreatedAt(DateUtil.getNow()); |
119 | insert.setClientId(clientId); | 124 | insert.setClientId(clientId); |
120 | insert.setStatus("1"); | 125 | insert.setStatus("1"); |
121 | insert.setTradeNo(tradeNo); | 126 | insert.setTradeNo(tradeNo); |
122 | insert.setApplyNo(applyNo); | 127 | insert.setApplyNo(applyNo); |
128 | + insert.setExtInfo(extInfo); | ||
123 | outpropApplyPayDao.insert(insert); | 129 | outpropApplyPayDao.insert(insert); |
124 | } | 130 | } |
125 | 131 | ... | ... |
... | @@ -16,6 +16,7 @@ public class OutpropApplyPayInfo extends BaseInfo { | ... | @@ -16,6 +16,7 @@ public class OutpropApplyPayInfo extends BaseInfo { |
16 | private String payAt; | 16 | private String payAt; |
17 | private String createdAt; | 17 | private String createdAt; |
18 | private String updatedAt; | 18 | private String updatedAt; |
19 | + private String extInfo; | ||
19 | 20 | ||
20 | public String getTradeNo() { | 21 | public String getTradeNo() { |
21 | return tradeNo; | 22 | return tradeNo; |
... | @@ -72,4 +73,12 @@ public class OutpropApplyPayInfo extends BaseInfo { | ... | @@ -72,4 +73,12 @@ public class OutpropApplyPayInfo extends BaseInfo { |
72 | public void setUpdatedAt(String updatedAt) { | 73 | public void setUpdatedAt(String updatedAt) { |
73 | this.updatedAt = updatedAt; | 74 | this.updatedAt = updatedAt; |
74 | } | 75 | } |
76 | + | ||
77 | + public String getExtInfo() { | ||
78 | + return extInfo; | ||
79 | + } | ||
80 | + | ||
81 | + public void setExtInfo(String extInfo) { | ||
82 | + this.extInfo = extInfo; | ||
83 | + } | ||
75 | } | 84 | } | ... | ... |
... | @@ -8,6 +8,7 @@ import java.util.HashMap; | ... | @@ -8,6 +8,7 @@ import java.util.HashMap; |
8 | import java.util.List; | 8 | import java.util.List; |
9 | import java.util.Map; | 9 | import java.util.Map; |
10 | 10 | ||
11 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
11 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
12 | import org.apache.logging.log4j.LogManager; | 13 | import org.apache.logging.log4j.LogManager; |
13 | import org.apache.logging.log4j.Logger; | 14 | import org.apache.logging.log4j.Logger; |
... | @@ -62,6 +63,16 @@ public class JsonUtil { | ... | @@ -62,6 +63,16 @@ public class JsonUtil { |
62 | } | 63 | } |
63 | } | 64 | } |
64 | 65 | ||
66 | + public static String toJsonRemoveNull(Object obj){ | ||
67 | + try { | ||
68 | + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
69 | + return mapper.writeValueAsString(obj); | ||
70 | + } catch (JsonProcessingException e) { | ||
71 | + logger.error("write to json string error:" + obj, e); | ||
72 | + return null; | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
65 | /** | 76 | /** |
66 | * 将单个键值对转换成JSON字符串,用于返回只有一个键值对json时的便捷方法 | 77 | * 将单个键值对转换成JSON字符串,用于返回只有一个键值对json时的便捷方法 |
67 | * @param obj 目标对象 | 78 | * @param obj 目标对象 | ... | ... |
... | @@ -10,16 +10,17 @@ | ... | @@ -10,16 +10,17 @@ |
10 | <result property="applyNo" column="APPLY_NO" /> | 10 | <result property="applyNo" column="APPLY_NO" /> |
11 | <result property="payAt" column="PAY_AT" /> | 11 | <result property="payAt" column="PAY_AT" /> |
12 | <result property="status" column="STATUS" /> | 12 | <result property="status" column="STATUS" /> |
13 | + <result property="extInfo" column="EXT_INFO" /> | ||
13 | </resultMap> | 14 | </resultMap> |
14 | 15 | ||
15 | <sql id="base_field"> | 16 | <sql id="base_field"> |
16 | - TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS | 17 | + TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS,EXT_INFO |
17 | </sql> | 18 | </sql> |
18 | 19 | ||
19 | <insert id="insert" parameterType="OutpropApplyPayInfo"> | 20 | <insert id="insert" parameterType="OutpropApplyPayInfo"> |
20 | - INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS) | 21 | + INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS,EXT_INFO) |
21 | VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR}, | 22 | VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR}, |
22 | - #{applyNo, jdbcType=VARCHAR}, #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR}) | 23 | + #{applyNo, jdbcType=VARCHAR}, #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR}, #{extInfo, jdbcType=VARCHAR}) |
23 | </insert> | 24 | </insert> |
24 | 25 | ||
25 | <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap"> | 26 | <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap"> | ... | ... |
... | @@ -100,9 +100,10 @@ | ... | @@ -100,9 +100,10 @@ |
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="${pickType == '1'}">上门自提</c:if> | 103 | + <c:if test="${pickInfo.pickType == 0}">上门自提</c:if> |
104 | - <c:if test="${pickType == '2' }">顺丰到付</c:if> | 104 | + <c:if test="${pickInfo.pickType == 1}">委托自提</c:if> |
105 | - <c:if test="${pickType == '3' }">转赵涌在线</c:if> | 105 | + <c:if test="${pickInfo.pickType == 2}">顺丰到付</c:if> |
106 | + <c:if test="${pickInfo.pickType == 3}">转赵涌在线</c:if> | ||
106 | </div> | 107 | </div> |
107 | </div> | 108 | </div> |
108 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> | 109 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> |
... | @@ -113,7 +114,7 @@ | ... | @@ -113,7 +114,7 @@ |
113 | ${pickName } | 114 | ${pickName } |
114 | </div> | 115 | </div> |
115 | </div> | 116 | </div> |
116 | - <c:if test="${pickType == '1'}"> | 117 | + <c:if test="${pickType == 1 or pickType == 2}"> |
117 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> | 118 | <div style="width: 100%;height: 30px;line-height: 30px;width: 620px;"> |
118 | <div style="display: inline-block;vertical-align: top;width: 100px;"> | 119 | <div style="display: inline-block;vertical-align: top;width: 100px;"> |
119 | 提货日期: | 120 | 提货日期: | ... | ... |
-
Please register or login to post a comment