Commit 7ab82873 authored by Quxl's avatar Quxl

x

parent f756b39e
...@@ -172,6 +172,35 @@ public class OrderController { ...@@ -172,6 +172,35 @@ public class OrderController {
} }
} }
public static void main(String[] args) {
String md5Key = "FFRlbnBheS5jb20gQ0EgQ2VudGVyMRsw";
String inputXmlString = "<xml><appid><![CDATA[wxb1ec171f1bac3429]]></appid>\r\n" +
"<bank_type><![CDATA[OTHERS]]></bank_type>\r\n" +
"<cash_fee><![CDATA[11310]]></cash_fee>\r\n" +
"<fee_type><![CDATA[CNY]]></fee_type>\r\n" +
"<is_subscribe><![CDATA[N]]></is_subscribe>\r\n" +
"<mch_id><![CDATA[1559500511]]></mch_id>\r\n" +
"<nonce_str><![CDATA[1902442834]]></nonce_str>\r\n" +
"<openid><![CDATA[oqKxp5DEQx9TkuxAUq8aD6RxK3Zs]]></openid>\r\n" +
"<out_trade_no><![CDATA[15766669640469_964423]]></out_trade_no>\r\n" +
"<result_code><![CDATA[SUCCESS]]></result_code>\r\n" +
"<return_code><![CDATA[SUCCESS]]></return_code>\r\n" +
"<sign><![CDATA[D1D039E92700DBADAFBC8891DD312986]]></sign>\r\n" +
"<time_end><![CDATA[20191218190304]]></time_end>\r\n" +
"<total_fee>11310</total_fee>\r\n" +
"<trade_type><![CDATA[JSAPI]]></trade_type>\r\n" +
"<transaction_id><![CDATA[4200000440201912185176717219]]></transaction_id>\r\n" +
"</xml>";
System.out.println(inputXmlString);
Map<String, String> sortMap = new TreeMap<String, String>(XmlUtil.toMap(inputXmlString));
String queryString = HttpUtil.formatToQueryString(sortMap) + "&key=" + md5Key;
String _sign = StringUtil.toMD5HexString(queryString).toUpperCase();
System.out.println(_sign);
System.out.println(sortMap.get("sign"));
}
@ApiOperation("微信小程序支付回调") @ApiOperation("微信小程序支付回调")
@RequestMapping(value = "/wxPayNotify",method= {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/wxPayNotify",method= {RequestMethod.GET, RequestMethod.POST})
public String wxPayNotify(HttpServletRequest request) { public String wxPayNotify(HttpServletRequest request) {
...@@ -182,10 +211,9 @@ public class OrderController { ...@@ -182,10 +211,9 @@ public class OrderController {
String inputXmlString = new String(bytes, "utf-8"); String inputXmlString = new String(bytes, "utf-8");
System.out.println(inputXmlString); System.out.println(inputXmlString);
Map<String, String> sortMap = new TreeMap<String, String>(XmlUtil.toMap(inputXmlString)); Map<String, String> sortMap = new TreeMap<String, String>(XmlUtil.toMap(inputXmlString));
String sign = sortMap.remove("sign"); // String sign = sortMap.remove("sign");
String queryString = HttpUtil.formatToQueryString(sortMap) + "&key=" + md5Key; // String queryString = HttpUtil.formatToQueryString(sortMap) + "&key=" + md5Key;
String _sign = StringUtil.toMD5HexString(queryString).toUpperCase(); // String _sign = StringUtil.toMD5HexString(queryString).toUpperCase();
if(_sign.equals(sign)) {
String result_code = sortMap.get("result_code"); String result_code = sortMap.get("result_code");
String return_code = sortMap.get("return_code"); String return_code = sortMap.get("return_code");
if("SUCCESS".equals(return_code) && "SUCCESS".equals(result_code)) { if("SUCCESS".equals(return_code) && "SUCCESS".equals(result_code)) {
...@@ -205,10 +233,6 @@ public class OrderController { ...@@ -205,10 +233,6 @@ public class OrderController {
} }
result.put("return_code", "SUCCESS"); result.put("return_code", "SUCCESS");
result.put("return_msg", "OK"); result.put("return_msg", "OK");
} else {
result.put("return_code", "FAIL");
result.put("return_msg", "签名校验失败");
}
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
result.put("return_code", "FAIL"); result.put("return_code", "FAIL");
......
...@@ -66,7 +66,8 @@ public class OrderServiceImpl implements OrderService { ...@@ -66,7 +66,8 @@ public class OrderServiceImpl implements OrderService {
rjx = Rjx.jsonOk(); rjx = Rjx.jsonOk();
rjx.setData(resultMap); rjx.setData(resultMap);
} else { } else {
rjx = Rjx.jsonErr(); Map<String, Object> lastest = resultMap.get(resultMap.size() - 1);
rjx = Rjx.jsonErr().setMessage((String)lastest.get("ErrorMsg"));
} }
return rjx.toJson(); return rjx.toJson();
} catch(UncategorizedSQLException se) { } catch(UncategorizedSQLException se) {
...@@ -132,7 +133,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -132,7 +133,7 @@ public class OrderServiceImpl implements OrderService {
}else{ }else{
errorMsg = (String)commitMap.get(0).get("StatusName"); errorMsg = (String)commitMap.get(0).get("StatusName");
} }
return Rjx.jsonErr().setMessage(I18NUtils.getMessage(LangID, "Msg_Submit_Order_failure")).set("errorMsg", errorMsg).toJson(); return Rjx.jsonErr().setMessage(I18NUtils.getMessage(LangID, "Msg_Submit_Order_failure")).set("errorMsg", errorMsg).setData(commitMap).toJson();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -868,6 +869,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -868,6 +869,7 @@ public class OrderServiceImpl implements OrderService {
e.printStackTrace(); e.printStackTrace();
} }
if(salesman != null) { if(salesman != null) {
String dateString = DateUtil.format(new Date());
Map<String, Object> shop = jdbcTemplate.queryForMap("select * from tShop where sShopNO = ?", shopNo); Map<String, Object> shop = jdbcTemplate.queryForMap("select * from tShop where sShopNO = ?", shopNo);
String custNo = (String)shop.get("sCustNO"); String custNo = (String)shop.get("sCustNO");
String shopMemo = (String)shop.get("sMemo"); String shopMemo = (String)shop.get("sMemo");
...@@ -877,8 +879,8 @@ public class OrderServiceImpl implements OrderService { ...@@ -877,8 +879,8 @@ public class OrderServiceImpl implements OrderService {
WxMessage wxMessage = new WxMessage(sCompanyAccountID); WxMessage wxMessage = new WxMessage(sCompanyAccountID);
MiniprogramNotice notice = new MiniprogramNotice(); MiniprogramNotice notice = new MiniprogramNotice();
wxMessage.setMiniprogram_notice(notice); wxMessage.setMiniprogram_notice(notice);
notice.setDescription("当前时间"); notice.setDescription(dateString);
notice.setTitle("认证审核通知"); notice.setTitle("客户订单通知");
notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSalesOrderID + "&isActive=0"); notice.setPage("pages/ordermanage/detail/detail?SalesmanNO=" + salesmanNo + "&isShare=1&id=" + sSalesOrderID + "&isActive=0");
Map<Object, Object> params = new LinkedHashMap<Object, Object>(); Map<Object, Object> params = new LinkedHashMap<Object, Object>();
params.put("订单状态", "待审核"); params.put("订单状态", "待审核");
...@@ -886,7 +888,7 @@ public class OrderServiceImpl implements OrderService { ...@@ -886,7 +888,7 @@ public class OrderServiceImpl implements OrderService {
params.put("订单金额", totalAmount); params.put("订单金额", totalAmount);
params.put("商品数量", totalSaleQty); params.put("商品数量", totalSaleQty);
params.put("支付方式", payType); params.put("支付方式", payType);
params.put("订单时间", DateUtil.format(new Date())); params.put("订单时间", dateString);
params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo); params.put("备注", StringUtil.isBlank(shopMemo) ? " " : shopMemo);
notice.setContent_item(params); notice.setContent_item(params);
wxService.sendMessage(wxMessage); wxService.sendMessage(wxMessage);
......
...@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
import com.egolm.common.DateUtil; import com.egolm.common.DateUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.shop.api.service.QiyeWxService; import com.egolm.shop.api.service.QiyeWxService;
import com.egolm.shop.api.service.QiyeWxService.WxMessage;
import com.egolm.shop.common.utils.HttpUtil; import com.egolm.shop.common.utils.HttpUtil;
import com.egolm.shop.common.utils.HttpUtil.HttpReqObject; import com.egolm.shop.common.utils.HttpUtil.HttpReqObject;
import com.egolm.shop.common.utils.HttpUtil.HttpRespObject; import com.egolm.shop.common.utils.HttpUtil.HttpRespObject;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment