Skip to content

Commit

Permalink
V1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
szvone committed Feb 26, 2019
1 parent 5b92e4f commit 6d87da9
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ V免签 是基于SpringBoot 2.1.1 实现的一套免签支付程序,主要包

## 更新记录

+ v1.4(2019.02.26)
+ 增加订单删除功能
+ 增加一键删除过期订单功能
+ 增加一键删除7天前订单功能
+ 增加PHP异步回调示例代码,请在 API说明->回调参数说明 中参考使用

+ v1.3(2019.02.25)
+ 修复监控端安卓7.0以上系统监控App闪退问题
+ 修复监控端检测服务状态无法正确检测是否正常问题
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/vone/mq/controller/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,29 @@ public CommonRes getMain(HttpSession session){
return adminService.getMain();
}

@RequestMapping("/admin/delOrder")
public CommonRes delOrder(HttpSession session,Long id){
if (session.getAttribute("login")==null){
return ResUtil.error("未登录");
}

return adminService.delOrder(id);
}

@RequestMapping("/admin/delGqOrder")
public CommonRes delGqOrder(HttpSession session){
if (session.getAttribute("login")==null){
return ResUtil.error("未登录");
}

return adminService.delGqOrder();
}
@RequestMapping("/admin/delLastOrder")
public CommonRes delLastOrder(HttpSession session){
if (session.getAttribute("login")==null){
return ResUtil.error("未登录");
}

return adminService.delLastOrder();
}
}
11 changes: 11 additions & 0 deletions src/main/java/com/vone/mq/dao/PayOrderDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ public interface PayOrderDao extends JpaRepository<PayOrder,Long>, JpaSpecifica

@Query(value = "select sum(price) from pay_order where state = ?1", nativeQuery = true)
double getCountMoney(int state);


@Transactional
int deleteByState(int state);


@Transactional
@Modifying
@Query(value = "delete from pay_order where create_date<?1", nativeQuery = true)
int deleteByAfterCreateDate(String date);

}
39 changes: 35 additions & 4 deletions src/main/java/com/vone/mq/service/AdminService.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,29 @@ public CommonRes getMain(){
todaySuccessOrder += todaySuccessOrder2;

int todayCloseOrder = payOrderDao.getTodayCount(startDate,endDate,-1);//当日失败订单
double todayMoney = payOrderDao.getTodayCountMoney(startDate,endDate,1);
double todayMoney2 = payOrderDao.getTodayCountMoney(startDate,endDate,2);

double todayMoney;
double todayMoney2;
try {
todayMoney = payOrderDao.getTodayCountMoney(startDate,endDate,1);
todayMoney2 = payOrderDao.getTodayCountMoney(startDate,endDate,2);
}catch (Exception e){
todayMoney = 0;
todayMoney2 = 0;
}

todayMoney = Arith.add(todayMoney,todayMoney2);

int countOrder = payOrderDao.getCount(1);
double countMoney = payOrderDao.getCountMoney(1);
double countMoney2 = payOrderDao.getCountMoney(2);
double countMoney;
double countMoney2;
try {
countMoney = payOrderDao.getCountMoney(1);
countMoney2 = payOrderDao.getCountMoney(2);
}catch (Exception e){
countMoney = 0;
countMoney2 = 0;
}
countMoney = Arith.add(countMoney,countMoney2);


Expand Down Expand Up @@ -238,6 +254,21 @@ public CommonRes delPayQrcode(Long id){
payQrcodeDao.deleteById(id);
return ResUtil.success();
}
public CommonRes delOrder(Long id){
payOrderDao.deleteById(id);
return ResUtil.success();
}
public CommonRes delGqOrder(){
payOrderDao.deleteByState(-1);
return ResUtil.success();
}

public CommonRes delLastOrder(){
payOrderDao.deleteByAfterCreateDate(String.valueOf(new Date().getTime()-7*86400*1000));
return ResUtil.success();
}


public static String md5(String text) {
//加密后的字符串
String encodeStr= DigestUtils.md5DigestAsHex(text.getBytes());
Expand Down
93 changes: 93 additions & 0 deletions src/main/webapp/admin/orderlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@
</div>
</div>

<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delGq">删除所有过期订单</button>
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delLast">删除七天前订单</button>

</div>
</script>
<table id="demo" lay-filter="test"></table>

<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="bd">补单</a>
<a class="layui-btn layui-btn-xs" lay-event="info">详情</a>
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>

</script>


Expand Down Expand Up @@ -63,6 +71,7 @@
elem: '#demo'
,height: 'full-160'
,url: '/admin/getOrders'
,toolbar: '#toolbarDemo'
,where: {
state:$("#state").val(),
type:$("#type").val()
Expand Down Expand Up @@ -146,6 +155,32 @@



});

console.log(data.id);
});
}else if(layEvent === 'del'){
layer.confirm('确定要删除订单吗?', function(index){
layer.msg('操作中', {
icon: 16
,shade: 0.01
});

$.post("/admin/delOrder","id="+data.id,function (data) {
if (data.code==1){
layer.msg("操作成功!");
myTable.reload({
where: {
state:$("#state").val(),
type:$("#type").val()
}
});
}else{
layer.msg(data.msg);
}



});

console.log(data.id);
Expand All @@ -172,6 +207,64 @@

});


//头工具栏事件
table.on('toolbar(test)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
case 'delGq':
layer.confirm('确定要删除所有过期订单吗?', function(index){
layer.msg('操作中', {
icon: 16
,shade: 0.01
});

$.post("/admin/delGqOrder",function (data) {
if (data.code==1){
layer.msg("操作成功!");
myTable.reload({
where: {
state:$("#state").val(),
type:$("#type").val()
}
});
}else{
layer.msg(data.msg);
}

});

});

break;
case 'delLast':
layer.confirm('确定要删除七天前的所有订单吗?', function(index){
layer.msg('操作中', {
icon: 16
,shade: 0.01
});

$.post("/admin/delLastOrder",function (data) {
if (data.code==1){
layer.msg("操作成功!");
myTable.reload({
where: {
state:$("#state").val(),
type:$("#type").val()
}
});
}else{
layer.msg(data.msg);
}

});

});
break;
};
});


form.render();

});
Expand Down
38 changes: 37 additions & 1 deletion src/main/webapp/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,41 @@ <h2 class="layui-colla-title">回调参数说明</h2>
</tbody>
</table>



</blockquote>

<pre class="layui-code">

&lt;?php

ini_set(&quot;error_reporting&quot;,&quot;E_ALL &amp; ~E_NOTICE&quot;);

$key = &quot;83d551f0b3609781a22536ca2658473d&quot;;//通讯密钥


$payId = $_GET[&#x27;payId&#x27;];//商户订单号
$param = $_GET[&#x27;param&#x27;];//创建订单的时候传入的参数
$type = $_GET[&#x27;type&#x27;];//支付方式 :微信支付为1 支付宝支付为2
$price = $_GET[&#x27;price&#x27;];//订单金额
$reallyPrice = $_GET[&#x27;reallyPrice&#x27;];//实际支付金额
$sign = $_GET[&#x27;sign&#x27;];//校验签名,计算方式 = md5(payId + param + type + price + reallyPrice + 通讯密钥)

//开始校验签名
$_sign = md5($payId . $param . $type . $price . $reallyPrice . $key);
if ($_sign != $sign) {
echo &quot;error_sign&quot;;//sign校验不通过
exit();
}


echo &quot;success&quot;;
//继续业务流程
//echo &quot;商户订单号:&quot;.$payId .&quot;&lt;br&gt;自定义参数:&quot;. $param .&quot;&lt;br&gt;支付方式:&quot;. $type .&quot;&lt;br&gt;订单金额:&quot;. $price .&quot;&lt;br&gt;实际支付金额:&quot;. $reallyPrice;

?&gt;
</pre>

</div>
</div>
</div>
Expand All @@ -775,9 +808,12 @@ <h2 class="layui-colla-title">回调参数说明</h2>


<script>
layui.use(['element'], function(){
layui.use(['element','code'], function(){
var element = layui.element;
layui.element.render();
layui.code({
title: 'PHP回调示例代码'
});

});
</script>
Expand Down

0 comments on commit 6d87da9

Please sign in to comment.