Skip to content

Commit

Permalink
V1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed Feb 25, 2019
1 parent f7174ca commit 06c50f4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ V免签 是基于SpringBoot 2.1.1 实现的一套免签支付程序,主要包
+ 本系统原理为监控收款后手机的通知栏推送消息,所以请保持微信/支付宝/V免签监控端后台正常运行,且添加到内存清理白名单!

## 更新记录

+ v1.0(2019.01.31)
+ 初版发布
+ v1.2(2019.02.25)
+ 修复收款金额为整数时校验错误的问题
+ 再次修复部分用户无法上传通用收款码问题

+ v1.1(2019.02.10)
+ 修复部分用户无法上传通用收款码问题

+ v1.0(2019.01.31)
+ 初版发布


## 版权信息

Expand Down
19 changes: 15 additions & 4 deletions src/main/java/com/vone/mq/controller/WebController.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public CommonRes deQrcode2(@RequestParam("file") MultipartFile file) {
* @return
*/
@RequestMapping("/createOrder")
public String createOrder(String payId, String param, Integer type, Double price, String notifyUrl, String returnUrl, String sign, Integer isHtml) {
public String createOrder(String payId, String param, Integer type, String price, String notifyUrl, String returnUrl, String sign, Integer isHtml) {
if (payId == null || payId.equals("")) {
return new Gson().toJson(ResUtil.error("请传入商户订单号"));
}
Expand All @@ -127,12 +127,23 @@ public String createOrder(String payId, String param, Integer type, Double price
if (type != 1 && type != 2) {
return new Gson().toJson(ResUtil.error("支付方式错误=>1|微信 2|支付宝"));
}
if (price == null) {


Double priceD;
try {
priceD = Double.valueOf(price);
} catch (Exception e){
return new Gson().toJson(ResUtil.error("请传入订单金额"));
}
if (price < 0) {

if (priceD == null) {
return new Gson().toJson(ResUtil.error("请传入订单金额"));
}
if (priceD < 0) {
return new Gson().toJson(ResUtil.error("订单金额必须大于0"));
}


if (sign == null || sign.equals("")) {
return new Gson().toJson(ResUtil.error("请传入签名"));
}
Expand Down Expand Up @@ -173,7 +184,7 @@ public CommonRes appHeart(String t, String sign) {
}

@RequestMapping("/appPush")
public CommonRes appPush(Integer type, Double price, String t, String sign) {
public CommonRes appPush(Integer type, String price, String t, String sign) {
return webService.appPush(type, price, t, sign);
}

Expand Down
19 changes: 11 additions & 8 deletions src/main/java/com/vone/mq/service/WebService.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ public class WebService {
@Autowired
private PayQrcodeDao payQrcodeDao;

public CommonRes createOrder(String payId, String param, Integer type, Double price, String notifyUrl, String returnUrl, String sign){
public CommonRes createOrder(String payId, String param, Integer type, String price, String notifyUrl, String returnUrl, String sign){
String key = settingDao.findById("key").get().getVvalue();
String jsSign = md5(payId+param+type+price+key);
if (!sign.equals(jsSign)){
return ResUtil.error("签名校验不通过");
}

Double priceD = Double.valueOf(price);


Date currentTime = new Date();

SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
Expand All @@ -47,7 +50,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr

int payQf = Integer.parseInt(settingDao.findById("payQf").get().getVvalue());
//实际支付价格
double reallyPrice = price;
double reallyPrice = priceD;

int row = 0;
while (row == 0){
Expand Down Expand Up @@ -106,7 +109,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr
payOrder.setCloseDate(0);
payOrder.setParam(param);
payOrder.setType(type);
payOrder.setPrice(price);
payOrder.setPrice(priceD);
payOrder.setReallyPrice(reallyPrice);
payOrder.setNotifyUrl(notifyUrl);
payOrder.setReturnUrl(returnUrl);
Expand All @@ -119,7 +122,7 @@ public CommonRes createOrder(String payId, String param, Integer type, Double pr


String timeOut = settingDao.findById("close").get().getVvalue();
CreateOrderRes createOrderRes = new CreateOrderRes(payId,orderId,type,price,reallyPrice,payUrl,isAuto,0,Integer.valueOf(timeOut),payOrder.getCreateDate());
CreateOrderRes createOrderRes = new CreateOrderRes(payId,orderId,type,priceD,reallyPrice,payUrl,isAuto,0,Integer.valueOf(timeOut),payOrder.getCreateDate());

return ResUtil.success(createOrderRes);
}
Expand Down Expand Up @@ -172,7 +175,7 @@ public CommonRes appHeart(String t,String sign){
return ResUtil.success();
}

public CommonRes appPush(Integer type,Double price,String t,String sign){
public CommonRes appPush(Integer type,String price,String t,String sign){
String key = settingDao.findById("key").get().getVvalue();
long cz = Long.valueOf(t)-new Date().getTime();

Expand All @@ -196,7 +199,7 @@ public CommonRes appPush(Integer type,Double price,String t,String sign){
return ResUtil.error("重复推送");
}

PayOrder payOrder = payOrderDao.findByReallyPriceAndStateAndType(price,0,type);
PayOrder payOrder = payOrderDao.findByReallyPriceAndStateAndType(Double.valueOf(price),0,type);

if (payOrder==null){

Expand All @@ -208,8 +211,8 @@ public CommonRes appPush(Integer type,Double price,String t,String sign){
payOrder.setCloseDate(new Date().getTime());
payOrder.setParam("无订单转账");
payOrder.setType(type);
payOrder.setPrice(price);
payOrder.setReallyPrice(price);
payOrder.setPrice(Double.valueOf(price));
payOrder.setReallyPrice(Double.valueOf(price));
payOrder.setState(1);
payOrder.setPayUrl("无订单转账");
payOrderDao.save(payOrder);
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/admin/setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
if (res.code == -1) {
return layer.msg('上传失败');
}
if (res.data=="" || res.data.substr(0,6)!="wxp://"){
if (res.data==""){
return layer.msg('请上传微信无金额收款二维码');
}
$('#wximg').attr('src', "enQrcode?url="+res.data);
Expand All @@ -148,7 +148,7 @@
if (res.code == -1) {
return layer.msg('上传失败');
}
if (res.data=="" || res.data.substr(0,22).toUpperCase()!="HTTPS://QR.ALIPAY.COM/"){
if (res.data=="" ){
return layer.msg('请上传支付宝无金额收款二维码');
}
$('#zfbimg').attr('src', "enQrcode?url="+res.data);
Expand Down

0 comments on commit 06c50f4

Please sign in to comment.