dingxin před 6 roky
rodič
revize
038f8057b6

+ 12
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AliPayController.java Zobrazit soubor

@@ -8,6 +8,7 @@ import com.community.commom.session.UserElement;
8 8
 import com.community.huiju.common.wxpay.WXPayConstants;
9 9
 import com.community.huiju.common.wxpay.WXPayUtil;
10 10
 import com.community.huiju.service.AliPayServiceI;
11
+import com.community.huiju.service.WxPayServiceI;
11 12
 import com.google.common.collect.Maps;
12 13
 import io.swagger.annotations.Api;
13 14
 import io.swagger.annotations.ApiImplicitParam;
@@ -49,6 +50,9 @@ public class AliPayController {
49 50
 	@Autowired
50 51
 	private AliPayServiceI aliPayService;
51 52
 	
53
+	@Autowired
54
+	private WxPayServiceI wxPayService;
55
+	
52 56
 	@Value("${alipay.ALIPAY_PUBLIC_KEY}")
53 57
 	private String ALIPAY_PUBLIC_KEY;
54 58
 	
@@ -73,7 +77,8 @@ public class AliPayController {
73 77
 	
74 78
 	@ApiOperation(value = "支付宝手机订单支付完成后回调", notes = "支付宝手机订单支付完成后回调")
75 79
 	@RequestMapping(value = "/aliPayNotify",method = RequestMethod.POST)
76
-	public void wxNotify(HttpServletRequest request, HttpServletResponse response){
80
+	public void aliPayNotify(HttpServletRequest request, HttpServletResponse response){
81
+		System.out.println("alipay result  start =======");
77 82
 		Map<String,String> params = new HashMap<String,String>();
78 83
 		Map requestParams = request.getParameterMap();
79 84
 		for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
@@ -90,11 +95,15 @@ public class AliPayController {
90 95
 		}
91 96
 		//切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
92 97
 		try {
93
-			System.out.println(params);
94 98
 			boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET_UTF8,"RSA2");
95
-			System.out.println(flag);
99
+			if (flag){
100
+				params.put("pay_type","2");
101
+				wxPayService.wxNotify(params);
102
+			}
96 103
 		} catch (AlipayApiException e) {
97 104
 			e.printStackTrace();
105
+		} catch (Exception e) {
106
+			e.printStackTrace();
98 107
 		}
99 108
 	}
100 109
 }

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/WxPayController.java Zobrazit soubor

@@ -95,6 +95,7 @@ public class WxPayController {
95 95
 			Map<String, String> resultMap = WXPayUtil.xmlToMap(result);
96 96
 			if (WXPayConstants.SUCCESS.equalsIgnoreCase(resultMap.get("result_code"))) {
97 97
 				//处理业务逻辑 修改订单状态等
98
+				resultMap.put("pay_type","0");
98 99
 				String state = wxPayService.wxNotify(resultMap);
99 100
 				if (state.equals("success")){
100 101
 					log.info("微信支付成功。。");

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransactionReply.java Zobrazit soubor

@@ -21,6 +21,16 @@ public class TpTransactionReply {
21 21
 
22 22
     private Date createDate;
23 23
 
24
+    /**
25
+     * 住户端 的角色
26
+     */
27
+    private String taRoleName;
28
+
29
+    /**
30
+     * 被回复人 的角色
31
+     */
32
+    private String replyRoleName;
33
+
24 34
     public Integer getId() {
25 35
         return id;
26 36
     }
@@ -92,4 +102,20 @@ public class TpTransactionReply {
92 102
     public void setCreateDate(Date createDate) {
93 103
         this.createDate = createDate;
94 104
     }
105
+
106
+    public String getTaRoleName() {
107
+        return taRoleName;
108
+    }
109
+
110
+    public void setTaRoleName(String taRoleName) {
111
+        this.taRoleName = taRoleName;
112
+    }
113
+
114
+    public String getReplyRoleName() {
115
+        return replyRoleName;
116
+    }
117
+
118
+    public void setReplyRoleName(String replyRoleName) {
119
+        this.replyRoleName = replyRoleName;
120
+    }
95 121
 }

+ 5
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/AliPayServiceImpl.java Zobrazit soubor

@@ -27,6 +27,8 @@ import org.springframework.beans.factory.annotation.Value;
27 27
 import org.springframework.stereotype.Service;
28 28
 import org.springframework.transaction.annotation.Transactional;
29 29
 
30
+import java.math.BigDecimal;
31
+
30 32
 import static com.alipay.api.AlipayConstants.CHARSET_UTF8;
31 33
 
32 34
 /**
@@ -96,11 +98,11 @@ public class AliPayServiceImpl implements AliPayServiceI {
96 98
 		AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
97 99
 		//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
98 100
 		AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
99
-		model.setBody("我是测试数据");
100
-		model.setSubject("App支付测试Java");
101
+		model.setBody(tpBillInvoice.getBillName());
102
+		model.setSubject(tpBillInvoice.getBillName());
101 103
 		model.setOutTradeNo(tpBillInvoice.getOutTradeNo());
102 104
 		model.setTimeoutExpress("30m");
103
-		model.setTotalAmount("0.01");
105
+		model.setTotalAmount(BigDecimal.valueOf(Long.valueOf(tpBillInvoice.getPayPrice())).divide(new BigDecimal(100)).toString());
104 106
 		model.setProductCode("QUICK_MSECURITY_PAY");
105 107
 		request.setBizModel(model);
106 108
 		request.setNotifyUrl("http://106.14.20.193:8086/app-api/aliPayNotify");

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java Zobrazit soubor

@@ -134,8 +134,8 @@ public class WxPayServiceImpl implements WxPayServiceI {
134 134
 		tpBillInvoice.setBillStatus("1");
135 135
 		tpBillInvoice.setPayDate(new Date());
136 136
 		tpBillInvoice.setUpdateDate(new Date());
137
-		// 缴费方式  0:微信支付  1:线下缴费
138
-		tpBillInvoice.setPayType("0");
137
+		// 缴费方式  0:微信支付  1:线下缴费 2.支付宝支付
138
+		tpBillInvoice.setPayType(resultMap.get("pay_type"));
139 139
 		tpBillInvoiceMapper.updateByPrimaryKeySelective(tpBillInvoice);
140 140
 
141 141
 		//插入流水账单表
@@ -146,7 +146,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
146 146
 		tpBillStatement.setPayPrice(tpBillInvoice.getPayPrice());
147 147
 		tpBillStatement.setPayName(tpBillInvoice.getPayName());
148 148
 		tpBillStatement.setPayRemark(tpBillInvoice.getBillName());
149
-		tpBillStatement.setPayType("0");
149
+		tpBillStatement.setPayType(resultMap.get("pay_type"));
150 150
 		tpBillStatement.setCreateTime(new Date());
151 151
 		tpBillStatementMapper.insert(tpBillStatement);
152 152
 

+ 5
- 3
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionReplyMapper.xml Zobrazit soubor

@@ -141,8 +141,10 @@
141 141
   </update>
142 142
   <select id="getCommunityIdAndTransactionId" resultMap="BaseResultMap">
143 143
     select
144
-    <include refid="Base_Column_List"/>
145
-    from tp_transaction_reply
146
-    where community_id = #{communityId,jdbcType=INTEGER} and transaction_id = #{transactionId,jdbcType=INTEGER}
144
+      tr.*,
145
+      (select tsr.role_name from ta_sys_user_role tsur LEFT JOIN ta_sys_role tsr on tsur.role_id = tsr.id where tsur.user_id = tr.ta_user_id) as taRoleName,
146
+      (select tsr.role_name from ta_sys_user_role tsur LEFT JOIN ta_sys_role tsr on tsur.role_id = tsr.id where tsur.user_id = tr.reply_ta_user_id) as replyRoleName
147
+    from tp_transaction_reply tr
148
+    where tr.community_id = #{communityId,jdbcType=INTEGER} and tr.transaction_id = #{transactionId,jdbcType=INTEGER}
147 149
   </select>
148 150
 </mapper>