Commit 33b351bf authored by wuwz's avatar wuwz

建行支付

parent 591fec57
......@@ -36,6 +36,10 @@ jQuery(document).ready(function(){
$(".dialog1").hide();
})
$(".dialog-closed2 img,.dialog-bg2").click(function(){
$(".dialog2").hide();
})
$("#ercode-choose").click(function(){
jQuery.get("$!webPath/buyAssociator.htm",
function(data){
......@@ -43,6 +47,7 @@ jQuery(document).ready(function(){
da = da.replace('"','');
da = da.replace('"','');
$("#ewcode_img").attr("src","$!webPath/"+da)
/* $("#ewcode_img").append(data) */
$(".ercode-box").show()
$(".nember_box").hide()
});
......@@ -59,9 +64,30 @@ jQuery(document).ready(function(){
$(".nember_box1").hide()
});
})
$("#ercode-choose2").click(function(){
/* jQuery.get("$!webPath/buyAssociatorBojing.htm",
function(data){
var da = data
da = da.replace('"','');
da = da.replace('"','');
$("#ewcode_img2").attr("src","$!webPath/"+da)
$(".ercode-box2").show()
$(".nember_box2").hide()
}); */
})
$(".had_pay").click(function(){
window.location.href = "$webPath/index.htm"
})
$(".had_pay1").click(function(){
window.location.href = "$webPath/index.htm"
})
$(".had_pay2").click(function(){
window.location.href = "$webPath/index.htm"
})
$("#menberService").click(function(){
......@@ -85,6 +111,16 @@ jQuery(document).ready(function(){
}
})
$("#menberServiceqi").click(function(){
if($falg){
$(".dialog2").show();
}else{
window.location.href="$webPath/user/login.htm"
}
})
if($falg){
if($user.level == 0){
$(".dialog").show();
......@@ -94,7 +130,7 @@ jQuery(document).ready(function(){
}else{
}
jQuery(".sale_two_img img").lazyload({effect:"fadeIn",width:150,height:150});
//鼠标经过推荐商品tab
jQuery("#index_sale_tab ul li").mouseover(function(){
jQuery(this).siblings().removeClass("this");
......@@ -789,7 +825,7 @@ $!httpInclude.include("/nav.htm")
<li>√渠道广阔,助力厂家拓展新市场</li>
<li>√共享渠道+资源+市场+信息+人才</li>
</ul>
<button>选择</button>
<button id="menberServiceqi">选择</button>
</div>
</li>
</ul>
......@@ -805,6 +841,7 @@ $!httpInclude.include("/nav.htm")
<input class="youname" type="text" name="name" placeholder="您的姓名" />
<input class="yourmobile" ype="text" name="phone" placeholder="联系电话" />
<input name="login" type="submit" class="getsubmit_btm" id="tjkf" value="提交给客服"/>
<input class="type" type="hidden" name="type" value="1" />
</form>
</div>
<p>您的联系方式不会泄露,请放心使用</p>
......@@ -879,6 +916,8 @@ $!httpInclude.include("/nav.htm")
<div class="ercode-left">
#if(!$user.url)
<img src="" width="200" height="200" id="ewcode_img" ></img>
<!-- <div width="200" height="200" id="ewcode_img">
</div> -->
#end
<p>请扫二维码支付</p>
</div>
......@@ -944,5 +983,47 @@ $!httpInclude.include("/nav.htm")
</div>
</div>
<div class="dialog2" style="display:none">
<div class="dialog-bg2"></div>
<div class="nember_box2">
<div class="dialog-closed2">
<img src="$!webPath/resources/style/system/front/default/images/new/dialog_colsed.png"></img>
</div>
<div class="dialog_conten2">
<p class="diaglog_title">企业合伙人</p>
<p>共享资源,共享利润</p>
<p class="diaglog_money">¥9999</p>
<p><!-- 专注提高签单效率,提高整体营业额 --></p>
<div class="content_ul">
<ul>
<li>√树立品牌形象,占领市场新风口</li>
<li>√产品统一管理,信息及时更新</li>
<li>√渠道广阔,助力厂家拓展新市场</li>
<li>√共享渠道+资源+市场+信息+人才</li>
</ul>
</div>
<p><a href="#" id="ercode-choose2">选择</a></p>
</div>
</div>
<div class="ercode-box2" style="display:none">
<div class="ercode-content2">
<div class="ercode-title">微信支付</div>
<div class="ercode-clearfix2">
<div class="ercode-left2">
#if(!$user.url)
<img src="" width="200" height="200" id="ewcode_img2" ></img>
#end
<p>请扫二维码支付</p>
</div>
<div class="ercode-right2">
<p class="ercode-numb">铂金合伙人</p>
<p class="ercode-money">¥2999</p>
<p class="hadpay-btn2"><span class="had_pay2">已支付</span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
......@@ -419,13 +419,14 @@ $!httpInclude.include("/nav1.htm")
<div class="form-box">
<p class="form-title">马上获取免费设计</p>
<p class="gray-title">—— 多家品牌精准方案报价 ——</p>
<form action="$webPath/add_customization_bespoke.htm">
<form action="$webPath/add_customization_bespoke.htm?type=1">
<div class="area">
<input type="text" name="address" placeholder="请填写地址"></input>
</div>
<input type="text" name="name" placeholder="您的称呼"></input>
<input type="text" name="phone" placeholder="您的电话"></input>
<input name="login" type="submit" class="getsubmit_btm" value="立即获取"/>
<input class="type" type="hidden" name="type" value="2" />
</form>
</div>
</div>
......
......@@ -370,7 +370,7 @@ $!httpInclude.include("/head.htm")
<img src="$!img" original="$!img" onerror="this.src='$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}';" width="28" height="28"/>
<div class="box-pri">
<p class="goods_Name">$!{da.goods_name}</p>
<p class="good_Price">¥${da.goods_price}</p>
<p class="good_Price">¥${da.store_price}</p>
</div>
</a>
......@@ -387,7 +387,7 @@ $!httpInclude.include("/head.htm")
<img src="$!img" original="$!img" onerror="this.src='$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}';" width="28" height="28"/>
<div class="box-pri">
<p class="goods_Name">$!{da.goods_name}</p>
<p class="good_Price">¥${da.goods_price}</p>
<p class="good_Price">¥${da.store_price}</p>
</div>
</div>
......
......@@ -256,21 +256,36 @@ jQuery(document).ready(function(){
});
}
getCount();
$("#level").change(function(){
var selectVal = $(this).val()
console.log(selectVal)
$("#inputLevel").val(selectVal)
$("#refereeForm").submit()
})
$(".user_level_btn").click(function(){
var begintime = $("#beginTime").val()
var endtime = $("#endTime").val()
$(".count-referee").html("");
getCount(begintime,endtime)
});
$("#level").change(function(){
var selectVal = $(this).val()
console.log(selectVal)
$("#inputLevel").val(selectVal)
$("#refereeForm").submit()
})
console.log($level)
//if($level){
var levelVal = $level
$("#level option").each(function(){
if($(this).val() ==levelVal){
$(this).attr('selected',true)
$(this).click()
}
})
//}
});
</script>
<script type="text/javascript">
//表情过滤
......@@ -345,19 +360,23 @@ $!httpInclude.include("/buyer/head.htm")
<table>
<thead>
<tr>
<td>会员名称</td>
<td>会员昵称</td>
<td>真实名称</td>
<td>注册时间</td>
<td>手机号码</td>
<td>上级ID</td>
<td>
<select id="level">
<option value="">会员等级</option>
<option value="0">普通会员</option>
<option value="1">黄金合伙人</option>
<option value="2">铂金合伙人</option>
<option value="3">企业合伙人</option>
</select>
</td>
</tr>
</thead>
......@@ -366,6 +385,7 @@ $!httpInclude.include("/buyer/head.htm")
<tr class="level0" data-id="$!obj.level">
<td>$!{obj.userName}</td>
<td>$!{obj.trueName}</td>
<td>$!{obj.addTime}</td>
<td>$!{obj.mobile}</td>
<td>$!{obj.referee.userName}</td>
......@@ -393,7 +413,7 @@ $!httpInclude.include("/buyer/head.htm")
<div class="fenyes">
<input name="pageSize" type="hidden" id="brand_ids" value="$!pageSize" />
<input name="level" type="hidden" id="inputLevel" value="" />
<input name="level" type="hidden" id="inputLevel" value="$level" />
<input name="currentPage" type="hidden" id="currentPage" value="$!currentPage" />
<input name="orderBy" type="hidden" id="orderBy" value="addTime" />
<input name="orderType" type="hidden" id="orderType" value="$!orderType" />
......@@ -434,6 +454,7 @@ laydate.render({
}
});
</script>
$!httpInclude.include("/footer.htm")
</body>
......
......@@ -44,6 +44,13 @@ jQuery(document).ready(function(){
jQuery("tr[id^=cash_] input").hide();
}
});
$("#select_back").change(function(){
var selectVal = $(this).val()
console.log(selectVal)
$("#cash_bank").val(selectVal)
})
});
</script>
</head>
......@@ -84,9 +91,34 @@ $!httpInclude.include("/top.htm")
</tr>
<tr id="cash_bank_tr">
<td align="right" valign="top" class="modifysp"><span>收款银行:</span><span><strong class="red" style="font-size:14px;">*</strong></span></td>
<td class="px10"><span class="setinput">
<input name="cash_bank" type="text" id="cash_bank" />
</span></td>
<td class="px10">
<!-- <span class="setinput">
<input name="cash_bank" type=text id="cash_bank" />
</span> -->
<span class="setinput">
<select id="cash_bank" name="cash_bank">
<option value="中国工商银行">中国工商银行</option>
<option value="中国农业银行">中国农业银行</option>
<option value="中国建设银行">中国建设银行</option>
<option value="中国银行">中国银行</option>
<option value="交通银行">交通银行</option>
<option value="招商银行">招商银行</option>
<option value="中信实业银行">中信实业银行</option>
<option value="上海浦东发展银行">上海浦东发展银行</option>
<option value="民生银行">民生银行</option>
<option value="光大银行">光大银行</option>
<option value="广东发展银行">广东发展银行</option>
<option value="兴业银行">兴业银行</option>
<option value="华夏银行">华夏银行</option>
<option value="上海银行">上海银行</option>
<option value="深圳发展银行">深圳发展银行</option>
<option value="深圳市商业银行">深圳市商业银行</option>
<option value="广州市商业银行">广州市商业银行</option>
<option value="东莞市商业银行">东莞市商业银行</option>
<option value="其他银行">其他银行</option>
</select>
</span>
</td>
</tr>
<tr>
<td align="right" valign="top" class="modifysp"><span>收款账号:</span><span><strong class="red" style="font-size:14px;">*</strong></span></td>
......
......@@ -1208,7 +1208,7 @@ input.getsubmit_btm:hover {
top: 50%;
position: absolute;
margin-left: -210px;
margin-top:149px;
/* margin-top:149px; */
text-align: center;
color: #fff;
padding-bottom:30px;
......@@ -1391,6 +1391,169 @@ p.hadpay-btn {
}
/**
会员购买9999弹框
**/
.dialog-closed2 img {
width: 30px;
height: 30px;
}
.nember_box2 {
background: #f97777;
width: 420px;
left: 50%;
top: 50%;
position: absolute;
margin-left: -210px;
/* margin-top:149px; */
text-align: center;
color: #fff;
padding-bottom:30px;
}
.dialog2 {
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
}
.dialog-bg2 {
width: 100%;
height: 100%;
background: #00000063;
position: fixed;
background-size: cover;
left: 0;
bottom: 0;
}
.dialog-closed2 {
width: 30px;
height: 30px;
float: right;
display: block;
margin-right: 20px;
margin-top: 10px;
}
.dialog_conten2 {
padding-top: 50px;
}
.dialog_conten2 p.diaglog_title {
font-size: 28px;
font-weight: 600;
margin-bottom: 15px;
}
.dialog_conten2 p.diaglog_money {
font-size: 60px;
font-weight: 600;
margin: 15px 0 20px 0;
}
.dialog_conten2 p {
font-size: 18px;
}
p.p-desc2 {
padding-bottom: 6px;
}
.dialog2 .content_ul ul {
width: 330px;
margin: 0 auto;
padding-left: 80px;
}
.dialog2 .content_ul ul li {
text-align: left;
background:url(../images/new/left_icon.png) no-repeat left center;
background-size: 25px 25px;
padding-left: 40px;
line-height: 30px;
font-size: 16px;
color: #fff;
}
.dialog2 .content_ul {
margin-top: 20px;
margin-bottom: 25px;
}
.dialog_conten2 a {
line-height: 40px;
background: #fff;
border-radius: 5px;
border: 1px solid #ddd;
font-size: 18px;
padding: 10px 50px;
}
.ercode-box2 {
background: #fff;
border:1px solid #ddd;
width: 440px;
height:380px;
left: 50%;
top: 50%;
position: absolute;
margin-left: -220px;
margin-top:190px;
text-align: center;
color: #333;
padding:0 40px;
}
.ercode-title2 {
font-size: 26px;
font-weight: 600;
text-align: left;
padding: 20px 0 10px 0;
border-bottom: 1px solid #ddd;
}
.ercode-left2 {
float: left;
}
.ercode-left img{
margin-bottom:5px;
}
.ercode-right2 {
float: left;
padding:0 60px;
}
.ercode-clearfix2 {
overflow: hidden;
padding: 30px 0;
}
.ercode-right p {
font-size: 30px;
}
.ercode-right p.ercode-numb {
font-size: 26px;
margin-bottom: 10px;
}
.ercode-right p.ercode-money {
font-size: 40px;
color: #f97777;
font-weight: 600;
}
span.had_pay2 {
border: 1px solid #ddd;
font-size: 16px;
padding: 10px 30px;
border-radius: 5px;
color: #f97777;
}
p.hadpay-btn2 {
margin-top: 75px;
}
/**
会员购买2999弹框
**/
......@@ -1407,7 +1570,7 @@ p.hadpay-btn {
top: 50%;
position: absolute;
margin-left: -210px;
margin-top:149px;
/* margin-top:149px; */
text-align: center;
color: #fff;
padding-bottom:30px;
......
package com.shopping.foundation.domain;
import java.util.List;
import java.util.Map;
public class ResponseEntity {
//返回编码
private int code;
//返回信息
private String message;
//返回集合
private List<Map<String,Object>>list;
//分页使用的数据总条数
private long totalDate;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public long getTotalDate() {
return totalDate;
}
public void setTotalDate(long totalDate) {
this.totalDate = totalDate;
}
}
package com.shopping.foundation.domain;
public class Wechat {
private String openid;
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getSession_key() {
return session_key;
}
public void setSession_key(String session_key) {
this.session_key = session_key;
}
private String session_key;
}
\ No newline at end of file
......@@ -110,9 +110,9 @@ public class PredepositLogManageAction {
//减少用户钱包余额
User user = predepositCash.getCash_user();
BigDecimal decimal = user.getAvailableBalance().subtract(predepositCash.getCash_amount());
/*BigDecimal decimal = user.getAvailableBalance().subtract(predepositCash.getCash_amount());
user.setAvailableBalance(decimal);
this.userService.update(user);
this.userService.update(user);*/
//添加记录
PredepositLog log = new PredepositLog();
......@@ -152,6 +152,12 @@ public class PredepositLogManageAction {
predepositCash.setCash_status(2);
this.predepositCashService.update(predepositCash);
//余额补回
User user = predepositCash.getCash_user();
BigDecimal decimal = user.getAvailableBalance().add(predepositCash.getCash_amount());
user.setAvailableBalance(decimal);
this.userService.update(user);
PredepositCashQueryObject qo = new PredepositCashQueryObject(currentPage, mv, "addTime", "desc");
//qo.addQuery("obj.cash_user.id", new SysMap("user_id", SecurityUserHolder.getCurrentUser().getId()), "=");
IPageList pList = this.predepositCashService.list(qo);
......
......@@ -61,21 +61,22 @@ public class ChildUserBuyerAction {
ModelAndView mv = new JModelAndView("user/default/usercenter/child_user.html",
this.configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response);
User user = SecurityUserHolder.getCurrentUser();
String params = "";
if(user == null) {
return "redirect:/user/login.htm" ;
}else {
UserQueryObject qo = new UserQueryObject(currentPage, mv, orderBy, orderType);
qo.setPageSize(3);
qo.setPageSize(10);
qo.addQuery("obj.referee.id", new SysMap("refereeId", user.getId()),"=");
if(key != null) {
qo.addQuery("obj.userName", new SysMap("userName", "%"+key+"%"),"like");
}
if(level != null) {
qo.addQuery("obj.level", new SysMap("level", level),"=");
params = "&level="+level;
}
IPageList pList = this.userService.list(qo);
CommUtil.saveIPageList2ModelAndView("", "", "", pList, mv);
CommUtil.saveIPageList2ModelAndView("", "", params, pList, mv);
}
//总会员数量
......@@ -84,6 +85,7 @@ public class ChildUserBuyerAction {
Set<User>listUser=this.getAllUser(map);
mv.addObject("totalUser", listUser.size());*/
mv.addObject("level", level == null ?"":level);
return mv;
}
......
......@@ -17,6 +17,8 @@ import com.shopping.foundation.service.IPredepositLogService;
import com.shopping.foundation.service.ISysConfigService;
import com.shopping.foundation.service.IUserConfigService;
import com.shopping.foundation.service.IUserService;
import java.math.BigDecimal;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -138,6 +140,12 @@ public class PredepositCashBuyerAction {
log.setPd_op_type("提现");
log.setPd_type("可用预存款");
this.predepositLogService.save(log);*/
//减少钱包余额
BigDecimal decimal = user.getAvailableBalance().subtract(obj.getCash_amount());
user.setAvailableBalance(decimal);
this.userService.update(user);
mv.addObject("op_title", "提现申请成功");
} else {
mv = new JModelAndView("error.html", this.configService.getSysConfig(), this.userConfigService.getUserConfig(), 1, request, response);
......
package com.shopping.pay.jhpay;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
public class HttpClientUtil {
public static String httpReader(String url, String code) {
System.out.println("GetPage:" + url);
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(url);
String result = null;
try {
client.executeMethod(method);
int status = method.getStatusCode();
if (status == HttpStatus.SC_OK) {
result = method.getResponseBodyAsString();
} else {
System.out.println("Method failed: " + method.getStatusLine());
}
} catch (HttpException e) {
// 发生致命的异常,可能是协议不对或者返回的内容有问题
System.out.println("Please check your provided http address!");
e.printStackTrace();
} catch (IOException e) {
// 发生网络异常
System.out.println("发生网络异常!");
e.printStackTrace();
} finally {
// 释放连接
if (method != null)
method.releaseConnection();
method = null;
client = null;
}
return result;
}
public static String httpGet(String url, String code) {
System.out.println("GetPage:" + url);
String content = null;
HttpClient httpClient = new HttpClient();
// 设置header
httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
"Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2");
GetMethod method = new GetMethod(url);
try {
int statusCode = httpClient.executeMethod(method);
System.out.println("httpClientUtils::statusCode=" + statusCode);
System.out.println(method.getStatusLine());
content = new String(method.getResponseBody(), code);
} catch (Exception e) {
System.out.println("time out");
e.printStackTrace();
} finally {
if (method != null)
method.releaseConnection();
method = null;
httpClient = null;
}
return content;
}
public static String httpPost(String url, Map paramMap, String code) {
System.out.println("GetPage:" + url);
String content = null;
if (url == null || url.trim().length() == 0 || paramMap == null || paramMap.isEmpty())
return null;
HttpClient httpClient = new HttpClient();
// 设置header
httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
"Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2");//
// 代理设置
// httpClient.getHostConfiguration().setProxy("128.128.176.74", 808);
PostMethod method = new PostMethod(url);
Iterator it = paramMap.keySet().iterator();
while (it.hasNext()) {
String key = it.next() + "";
Object o = paramMap.get(key);
if (o != null && o instanceof String) {
method.addParameter(new NameValuePair(key, o.toString()));
}
if (o != null && o instanceof String[]) {
String[] s = (String[]) o;
if (s != null)
for (int i = 0; i < s.length; i++) {
method.addParameter(new NameValuePair(key, s[i]));
}
}
}
try {
int statusCode = httpClient.executeMethod(method);
System.out.println("httpClientUtils::statusCode=" + statusCode);
System.out.println(method.getStatusLine());
content = new String(method.getResponseBody(), code);
} catch (Exception e) {
System.out.println("time out");
e.printStackTrace();
} finally {
if (method != null)
method.releaseConnection();
method = null;
httpClient = null;
}
return content;
}
public static String httpPost(String url, Map paramMap) {
// 编码:UTF-8
return HttpClientUtil.httpPost(url, paramMap, "UTF-8");
}
}
package com.shopping.pay.jhpay;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
public class JHPayUtil {
public String pay(String rmb,String orderId) {
String bankURL="https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain";
//bankURL="http://124.127.94.61:8001/CCBIS/ccbMain";
String MERCHANTID = "105000659990050";
String POSID = "035041678";
String BRANCHID = "441000000";
String ORDERID = orderId;
String PAYMENT= rmb;
String CURCODE="01";
String TXCODE = "530550";
String REMARK1 = "";
String REMARK2 = "";
String RETURNTYPE="3";
String TIMEOUT = "";
String PUB32TR2= "35e5adac1b4728b44d297643020111";
StringBuffer tmp = new StringBuffer(); //验签字段
tmp.append("MERCHANTID=");
tmp.append(MERCHANTID);
tmp.append("&POSID=");
tmp.append(POSID);
tmp.append("&BRANCHID=");
tmp.append(BRANCHID);
tmp.append("&ORDERID=");
tmp.append(ORDERID);
tmp.append("&PAYMENT=");
tmp.append(PAYMENT);
tmp.append("&CURCODE=");
tmp.append(CURCODE);
tmp.append("&TXCODE=");
tmp.append(TXCODE);
tmp.append("&REMARK1=");
tmp.append(REMARK1);
tmp.append("&REMARK2=");
tmp.append(REMARK2);
tmp.append("&RETURNTYPE=");
tmp.append(RETURNTYPE);
tmp.append("&TIMEOUT=");
tmp.append(TIMEOUT);
tmp.append("&PUB=");
tmp.append(PUB32TR2);
Map map = new HashMap();
map.put("CCB_IBSVersion","V6"); //必输项
map.put("MERCHANTID",MERCHANTID);
map.put("BRANCHID",BRANCHID);
map.put("POSID",POSID);
map.put("ORDERID",ORDERID);
map.put("PAYMENT",PAYMENT);
map.put("CURCODE",CURCODE);
map.put("TXCODE",TXCODE);
map.put("REMARK1",REMARK1);
map.put("REMARK2",REMARK2);
map.put("RETURNTYPE",RETURNTYPE);
map.put("TIMEOUT",TIMEOUT);
map.put("MAC",MD5.md5Str(tmp.toString()));
String ret = HttpClientUtil.httpPost(bankURL, map); //请求二维码生成链接串
System.out.println("ret::"+ret);
Gson gson = new Gson();
QrURLDemo qrurl = (QrURLDemo) gson.fromJson(ret, QrURLDemo.class);
System.out.println(qrurl.getPAYURL());
ret = HttpClientUtil.httpGet(qrurl.getPAYURL(), "UTF-8"); //获取二维码串
System.out.println("ret::"+ret);
return ret;
}
}
package com.shopping.pay.jhpay;
import java.io.*;
import java.security.*;
public class MD5 {
public static String md5Str(String str) {
if (str == null)
return "";
return md5Str(str, 0);
}
/**
* 计算消息摘要。
*
* @param data 计算摘要的数据。
* @param offset 数据偏移地址。
* @param length 数据长度。
* @return 摘要结果。(16字节)
*/
public static String md5Str(String str, int offset) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] b = str.getBytes("UTF8");
md5.update(b, offset, b.length);
return byteArrayToHexString(md5.digest());
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
return null;
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
return null;
}
}
/**
*
* @param b byte[]
* @return String
*/
public static String byteArrayToHexString(byte[] b) {
String result = "";
for (int i = 0; i < b.length; i++) {
result += byteToHexString(b[i]);
}
return result;
}
private static String[] hexDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e",
"f" };
/**
* 将字节转换为对应的16进制明文
*
* @param b byte
* @return String
*/
public static String byteToHexString(byte b) {
int n = b;
if (n < 0) {
n = 256 + n;
}
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static void main(String[] args) {
System.out.println(byteToHexString((byte) -99));
String str = "eeeeeeeeeeeeeewrw213123122222222222222222222222213123213213213erwer";
String ened = MD5.md5Str(str);
System.out.println(ened.length());
System.out.println(ened);
}
}
package com.shopping.pay.jhpay;
public class QrURLDemo {
private String SUCCESS;
private String PAYURL;
public String getSUCCESS() {
return SUCCESS;
}
public void setSUCCESS(String success) {
SUCCESS = success;
}
public String getPAYURL() {
return PAYURL;
}
public void setPAYURL(String payurl) {
PAYURL = payurl;
}
}
package com.shopping.view.web.action;
import static org.hamcrest.CoreMatchers.nullValue;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
......@@ -85,9 +87,16 @@ public class BespokeViewAction {
*/
@RequestMapping({ "/add_customization_bespoke.htm" })
public ModelAndView add_customization_bespoke(HttpServletRequest request, HttpServletResponse response, String area,
String name, String phone) {
ModelAndView mv = new JModelAndView("/zs_customization_index.html", this.configService.getSysConfig(),
String name, String phone, String type) {
ModelAndView mv = null;
if ("1".equals(type)) {
mv = new JModelAndView("/index.html", this.configService.getSysConfig(),
this.userConfigService.getUserConfig(), 1, request, response);
} else {
mv = new JModelAndView("/zs_customization_index.html", this.configService.getSysConfig(),
this.userConfigService.getUserConfig(), 1, request, response);
}
WebForm wf = new WebForm();
Bespoke bespoke = wf.toPo(request, Bespoke.class);
Map<String, Object> params = new HashMap<String, Object>();
......@@ -104,9 +113,9 @@ public class BespokeViewAction {
if (("").endsWith(bespoke.getName()) || bespoke.getName() == null) {
flagName = true;
}
if(flagPhone) {
if (flagPhone) {
return mv;
}else {
} else {
List<Bespoke> list = this.bespokeService.query("select obj from Bespoke obj where obj.phone = :phone and "
+ "obj.name = :name and obj.type = :type and obj.state = :state", params, -1, -1);
if (list.size() > 0) {
......
package B2C.PUB;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.ShortBufferException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class MCipherDecode {
static {
if(Security.getProvider("BC")==null)
{
Security.addProvider(new BouncyCastleProvider());
}
}
private String encryptKey = "12345678";
public MCipherDecode(String key)
{
encryptKey = key.substring(0, 8);
}
public String getEncryptKey() {
return encryptKey;
}
public void setEncryptKey(String encryptKey) {
this.encryptKey = encryptKey.substring(0,8);
}
private static byte[] getSrcBytes(byte[] srcBytes, byte[] wrapKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, ShortBufferException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidAlgorithmParameterException
{
SecretKeySpec key = new SecretKeySpec(wrapKey, "DES");
Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding","BC");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] cipherText = cipher.doFinal(srcBytes);
return cipherText;
}
public static byte[] DecodeBase64String(String base64Src) throws IOException
{
BASE64Decoder de = new BASE64Decoder();
byte[] base64Result = de.decodeBuffer(base64Src);
return base64Result;
}
public String getDecodeString(String urlString) throws IOException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, ShortBufferException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidAlgorithmParameterException
{
String tempString = URLDecoder.decode(urlString, "iso-8859-1");
String basedString = tempString.replaceAll(",", "+");
byte[] tempBytes = DecodeBase64String(basedString);
byte[] tempSrcBytes = getSrcBytes(tempBytes,encryptKey.getBytes("iso-8859-1"));
return new String(tempSrcBytes,"iso-8859-1");
}
public static void main(String[] agrs){
String key = "f6528d5c335b7092fc9ec1b3020111";
String str = "梅九六|6214662020019275";
String cipherdURL = "AWWo2KKeATj6XxRglo7uaR0yZ2QQtCW%2C";
//使用MCipherDecode.java类中的getDecodeString(String urlString)方法进行解密,主要步骤如下:
try {
MCipherDecode mcd = new MCipherDecode(key);//设置密钥
String decodedString = mcd.getDecodeString(cipherdURL);//解密
byte[] tempByte = decodedString.getBytes("ISO-8859-1");
decodedString = new String(tempByte,"GBK");
System.out.println("decodedString-- " + decodedString);
}catch(Exception e){
e.printStackTrace();
}
}
}
package com.shopping.view.web.action;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.shopping.pay.jhpay.HttpClientUtil;
import com.shopping.pay.jhpay.MD5;
import com.shopping.pay.jhpay.QrURLDemo;
public class QrDemo {
public static void main(String[] args)throws Exception {
String bankURL="https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain";
//bankURL="http://124.127.94.61:8001/CCBIS/ccbMain";
String MERCHANTID = "105000659990050";
String POSID = "035041678";
String BRANCHID = "441000000";
String ORDERID = "111111111111";
String PAYMENT= "0.01";
String CURCODE="01";
String TXCODE = "530550";
String REMARK1 = "";
String REMARK2 = "";
String RETURNTYPE="3";
String TIMEOUT = "";
String PUB32TR2= "35e5adac1b4728b44d297643020111";
StringBuffer tmp = new StringBuffer(); //验签字段
tmp.append("MERCHANTID=");
tmp.append(MERCHANTID);
tmp.append("&POSID=");
tmp.append(POSID);
tmp.append("&BRANCHID=");
tmp.append(BRANCHID);
tmp.append("&ORDERID=");
tmp.append(ORDERID);
tmp.append("&PAYMENT=");
tmp.append(PAYMENT);
tmp.append("&CURCODE=");
tmp.append(CURCODE);
tmp.append("&TXCODE=");
tmp.append(TXCODE);
tmp.append("&REMARK1=");
tmp.append(REMARK1);
tmp.append("&REMARK2=");
tmp.append(REMARK2);
tmp.append("&RETURNTYPE=");
tmp.append(RETURNTYPE);
tmp.append("&TIMEOUT=");
tmp.append(TIMEOUT);
tmp.append("&PUB=");
tmp.append(PUB32TR2);
Map map = new HashMap();
map.put("CCB_IBSVersion","V6"); //必输项
map.put("MERCHANTID",MERCHANTID);
map.put("BRANCHID",BRANCHID);
map.put("POSID",POSID);
map.put("ORDERID",ORDERID);
map.put("PAYMENT",PAYMENT);
map.put("CURCODE",CURCODE);
map.put("TXCODE",TXCODE);
map.put("REMARK1",REMARK1);
map.put("REMARK2",REMARK2);
map.put("RETURNTYPE",RETURNTYPE);
map.put("TIMEOUT",TIMEOUT);
map.put("MAC",MD5.md5Str(tmp.toString()));
String ret = HttpClientUtil.httpPost(bankURL, map); //请求二维码生成链接串
System.out.println("ret::"+ret);
Gson gson = new Gson();
QrURLDemo qrurl = (QrURLDemo) gson.fromJson(ret, QrURLDemo.class);
System.out.println(qrurl.getPAYURL());
ret = HttpClientUtil.httpGet(qrurl.getPAYURL(), "UTF-8"); //获取二维码串
System.out.println("ret::"+ret);
}
}
package com.shopping.view.web.tools;
import java.util.HashMap;
import java.util.Map;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import com.google.gson.Gson;
import com.shopping.foundation.domain.Wechat;
public class WeChatLogin {
private static final String APPID = "wxe6db3e125aba9b7e";
private static final String SECRET = "51780f9575c8679500959fbbe280d833";
public Map<String,Object> getSssion(String wxCode){
String url = "https://api.weixin.qq.com/sns/jscode2session?appid="+APPID+
"&secret="+SECRET+"&js_code="+ wxCode +"&grant_type=authorization_code";
RestTemplate restTemplate = new RestTemplate();
Map<String,Object>map = new HashMap<String, Object>();
//进行网络请求,访问url接口
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, null, String.class);
if(responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
String sessionData = responseEntity.getBody();
Gson gson = new Gson();
Wechat wechat=gson.fromJson(sessionData,Wechat.class);
map.put("session_key", wechat.getSession_key());
map.put("openid", wechat.getOpenid());
}
return map;
}
}
package com.shopping.view.web.wechat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.shopping.foundation.domain.ResponseEntity;
import com.shopping.foundation.service.ISysConfigService;
import com.shopping.foundation.service.IUserConfigService;
import com.shopping.view.web.tools.WeChatLogin;
@Controller
public class WechatIndexViewAction {
@Autowired
private ISysConfigService configService;
@Autowired
private IUserConfigService userConfigService;
/**
* 根据微信唯一码查询用户
* @param request
* @param response
* @param code
* @return
*/
@RequestMapping({ "/weChat_user.htm" })
public ResponseEntity getByCode(HttpServletRequest request, HttpServletResponse response,String code) {
ResponseEntity responseEntity = new ResponseEntity();
WeChatLogin weChatLogin = new WeChatLogin();
List<Map<String, Object>>list = new ArrayList<Map<String, Object>>();
Map<String,Object>map=weChatLogin.getSssion(code);
if(map.get("session_key") == null || map.get("openid") == null) {
responseEntity.setCode(3);
responseEntity.setMessage("code无效,没有查询到用户");
}else {
String openid = map.get("openid").toString();
//List <Map<String, Object>> userList = wechatResponseRepository.getByCode(openid);
/*if(userList.size() == 0) {
list.add(map);
responseEntity.setCode(2);
responseEntity.setList(list);
responseEntity.setMessage("查询成功,没有绑定用户");
}else {
for (Map<String, Object> user : userList) {
String orgId = wechatResponseRepository.getOrgId(user.get("item_tra").toString());
String orgName = wechatResponseRepository.getOrgName(user.get("item_tra").toString());
user.put("openid", map.get("openid"));
user.put("session_key", map.get("session_key"));
user.put("orgId", orgId);
user.put("orgName", orgName);
list.add(user);
}
responseEntity.setCode(1);
responseEntity.setList(list);
responseEntity.setMessage("查询成功,已绑定对象");
}*/
}
return responseEntity;
}
}
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