bruce

仓管费

...@@ -76,7 +76,7 @@ public class PickPayBiz { ...@@ -76,7 +76,7 @@ public class PickPayBiz {
76 UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class); 76 UnionResponse response = JsonUtil.fromJson(json, UnionResponse.class);
77 if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) { 77 if (response != null && response.getErrCode().equals(UnionConstants.SUCCESS_CODE)) {
78 result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getQrCodeId())); 78 result.put("qrCode", UnionPayUtil.createQrCode(createQrCode.getQrCodeId()));
79 - insertPickPay(userId, createQrCode.getBillNo(), createQrCode.getSrcReserve()); 79 + insertPickPay(userId, createQrCode.getBillNo(), createQrCode.getSrcReserve(),totalAmount.toString(),DateUtil.getTrustCycle());
80 } else { 80 } else {
81 result.put("code", false); 81 result.put("code", false);
82 result.put("msg", response.getErrMsg()); 82 result.put("msg", response.getErrMsg());
...@@ -90,44 +90,48 @@ public class PickPayBiz { ...@@ -90,44 +90,48 @@ public class PickPayBiz {
90 90
91 public Boolean isValidNotify(Map<String, String> result) { 91 public Boolean isValidNotify(Map<String, String> result) {
92 if (UnionPayUtil.checkSign(result)) { 92 if (UnionPayUtil.checkSign(result)) {
93 - DefaultTransactionDefinition def = new DefaultTransactionDefinition(); 93 + if (result.get("status").equals(UnionConstants.NOTIFY_PAY_STATUS)) {
94 - def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); 94 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
95 - TransactionStatus status = transactionManager.getTransaction(def); 95 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
96 - try { 96 + TransactionStatus status = transactionManager.getTransaction(def);
97 - String tradeNo = result.get("billNo"); 97 + try {
98 - OutpropApplyPayInfo info = outpropApplyPayDao.selectByTradeNo(tradeNo); 98 + String tradeNo = result.get("billNo");
99 - if (!info.getStatus().equals("2")) { 99 + OutpropApplyPayInfo info = outpropApplyPayDao.selectByTradeNo(tradeNo);
100 - OutpropApplyPayInfo update = new OutpropApplyPayInfo(); 100 + if (!info.getStatus().equals("2")) {
101 - update.setTradeNo(tradeNo); 101 + OutpropApplyPayInfo update = new OutpropApplyPayInfo();
102 - update.setStatus("2"); 102 + update.setTradeNo(tradeNo);
103 - outpropApplyPayDao.update(update); 103 + update.setStatus("2");
104 + outpropApplyPayDao.update(update);
104 105
105 - OutpropApplyPickInfo pickInfo = JsonUtil.fromJson(result.get("srcReserve"), OutpropApplyPickInfo.class); 106 + OutpropApplyPickInfo pickInfo = JsonUtil.fromJson(result.get("srcReserve"), OutpropApplyPickInfo.class);
106 - pickInfo.setClientId(info.getClientId()); 107 + pickInfo.setClientId(info.getClientId());
107 - if ("0".equals(pickInfo.getPickType()) || "1".equals(pickInfo.getPickType())) { 108 + if ("0".equals(pickInfo.getPickType()) || "1".equals(pickInfo.getPickType())) {
108 - pickBiz.selfPickNew(pickInfo); 109 + pickBiz.selfPickNew(pickInfo);
109 - } else if ("2".equals(pickInfo.getPickType())) { 110 + } else if ("2".equals(pickInfo.getPickType())) {
110 - pickBiz.expressPickNew(pickInfo); 111 + pickBiz.expressPickNew(pickInfo);
111 - } else if ("3".equals(pickInfo.getPickType())) { 112 + } else if ("3".equals(pickInfo.getPickType())) {
112 - pickBiz.zhaoonlinePickNew(pickInfo); 113 + pickBiz.zhaoonlinePickNew(pickInfo);
114 + }
113 } 115 }
116 + transactionManager.commit(status);
117 + return true;
118 + } catch (Exception e) {
119 + transactionManager.rollback(status);
114 } 120 }
115 - transactionManager.commit(status);
116 - return true;
117 - } catch (Exception e) {
118 - transactionManager.rollback(status);
119 } 121 }
120 } 122 }
121 return false; 123 return false;
122 } 124 }
123 125
124 - private void insertPickPay(String clientId, String tradeNo, String extInfo) { 126 + private void insertPickPay(String clientId, String tradeNo, String extInfo, String amount, Integer cycle) {
125 OutpropApplyPayInfo insert = new OutpropApplyPayInfo(); 127 OutpropApplyPayInfo insert = new OutpropApplyPayInfo();
126 insert.setCreatedAt(DateUtil.getNow()); 128 insert.setCreatedAt(DateUtil.getNow());
127 insert.setClientId(clientId); 129 insert.setClientId(clientId);
128 insert.setStatus("1"); 130 insert.setStatus("1");
129 insert.setTradeNo(tradeNo); 131 insert.setTradeNo(tradeNo);
130 insert.setExtInfo(extInfo); 132 insert.setExtInfo(extInfo);
133 + insert.setAmount(amount);
134 + insert.setTrusteeshipCycle(cycle);
131 outpropApplyPayDao.insert(insert); 135 outpropApplyPayDao.insert(insert);
132 } 136 }
133 137
......
...@@ -17,6 +17,8 @@ public class OutpropApplyPayInfo extends BaseInfo { ...@@ -17,6 +17,8 @@ public class OutpropApplyPayInfo extends BaseInfo {
17 private String createdAt; 17 private String createdAt;
18 private String updatedAt; 18 private String updatedAt;
19 private String extInfo; 19 private String extInfo;
20 + private String amount;
21 + private Integer trusteeshipCycle;
20 22
21 public String getTradeNo() { 23 public String getTradeNo() {
22 return tradeNo; 24 return tradeNo;
...@@ -81,4 +83,20 @@ public class OutpropApplyPayInfo extends BaseInfo { ...@@ -81,4 +83,20 @@ public class OutpropApplyPayInfo extends BaseInfo {
81 public void setExtInfo(String extInfo) { 83 public void setExtInfo(String extInfo) {
82 this.extInfo = extInfo; 84 this.extInfo = extInfo;
83 } 85 }
86 +
87 + public String getAmount() {
88 + return amount;
89 + }
90 +
91 + public void setAmount(String amount) {
92 + this.amount = amount;
93 + }
94 +
95 + public Integer getTrusteeshipCycle() {
96 + return trusteeshipCycle;
97 + }
98 +
99 + public void setTrusteeshipCycle(Integer trusteeshipCycle) {
100 + this.trusteeshipCycle = trusteeshipCycle;
101 + }
84 } 102 }
......
...@@ -37,6 +37,10 @@ public class UnionConstants { ...@@ -37,6 +37,10 @@ public class UnionConstants {
37 * 银联商务response返回正确的状态码 37 * 银联商务response返回正确的状态码
38 */ 38 */
39 public static final String SUCCESS_CODE = "SUCCESS"; 39 public static final String SUCCESS_CODE = "SUCCESS";
40 + /**
41 + * 银联商务推送支付成功状态的状态码
42 + */
43 + public static final String NOTIFY_PAY_STATUS = "TRADE_SUCCESS";
40 44
41 public static final String NOTIFY_DOMAIN = "http://zyn.yocung.com"; 45 public static final String NOTIFY_DOMAIN = "http://zyn.yocung.com";
42 46
......
...@@ -11,16 +11,19 @@ ...@@ -11,16 +11,19 @@
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 <result property="extInfo" column="EXT_INFO" />
14 + <result property="amount" column="AMOUNT" />
15 + <result property="trusteeshipCycle" column="TRUSTEESHIP_CYCLE" />
14 </resultMap> 16 </resultMap>
15 17
16 <sql id="base_field"> 18 <sql id="base_field">
17 - TRADE_NO,CREATED_AT,UPDATED_AT,PAY_AT,STATUS,EXT_INFO,CLIENT_ID 19 + TRADE_NO,CREATED_AT,UPDATED_AT,PAY_AT,STATUS,EXT_INFO,CLIENT_ID,AMOUNT,TRUSTEESHIP_CYCLE
18 </sql> 20 </sql>
19 21
20 <insert id="insert" parameterType="OutpropApplyPayInfo"> 22 <insert id="insert" parameterType="OutpropApplyPayInfo">
21 - INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,PAY_AT,STATUS,EXT_INFO,CLIENT_ID) 23 + INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,PAY_AT,STATUS,EXT_INFO,CLIENT_ID,AMOUNT,TRUSTEESHIP_CYCLE)
22 VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR}, 24 VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR},
23 - #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR}, #{extInfo, jdbcType=VARCHAR}, #{clientId, jdbcType=VARCHAR}) 25 + #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR}, #{extInfo, jdbcType=VARCHAR}, #{clientId, jdbcType=VARCHAR},
26 + #{amount, jdbcType=VARCHAR}, #{trusteeshipCycle})
24 </insert> 27 </insert>
25 28
26 <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap"> 29 <select id="selectByTradeNo" parameterType="java.lang.String" resultMap="BaseMap">
......