订单声音配置后台代码
This commit is contained in:
parent
014e591916
commit
f09fa1e8b6
|
|
@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -21,8 +22,8 @@ import org.springframework.web.bind.annotation.*;
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
* @Description: web-系统配置控制层
|
* @Description: web-系统配置控制层
|
||||||
*/
|
*/
|
||||||
@RestController
|
@Controller
|
||||||
@RequestMapping("/web/sys/global/config")
|
@RequestMapping("/config/globalConfig")
|
||||||
@Tag(name = "web-系统配置控制层")
|
@Tag(name = "web-系统配置控制层")
|
||||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
public class SysGlobalConfigController {
|
public class SysGlobalConfigController {
|
||||||
|
|
@ -38,6 +39,7 @@ public class SysGlobalConfigController {
|
||||||
private final ISysGlobalConfigService service;
|
private final ISysGlobalConfigService service;
|
||||||
|
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@Operation(summary = "系统配置查询接口(根据类型查询)", method = "GET")
|
@Operation(summary = "系统配置查询接口(根据类型查询)", method = "GET")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "typeId", description = "配置类型Code", required = true, in = ParameterIn.PATH)
|
@Parameter(name = "typeId", description = "配置类型Code", required = true, in = ParameterIn.PATH)
|
||||||
|
|
@ -47,6 +49,7 @@ public class SysGlobalConfigController {
|
||||||
return AjaxResult.success(SysGlobalConfigResponseVO.toVo(service.loadByConfigType(typeId)));
|
return AjaxResult.success(SysGlobalConfigResponseVO.toVo(service.loadByConfigType(typeId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@RequiresPermissions("sys:order:audio:config:update")
|
@RequiresPermissions("sys:order:audio:config:update")
|
||||||
@Operation(summary = "系统配置修改", method = "PUT")
|
@Operation(summary = "系统配置修改", method = "PUT")
|
||||||
@PutMapping(path = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
@PutMapping(path = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
|
|
||||||
|
|
@ -1299,12 +1299,14 @@ public class OrderDetailController extends BaseController {
|
||||||
return AjaxResult.success(orderDetailService.afterDetailOrderCount(orderDetail));
|
return AjaxResult.success(orderDetailService.afterDetailOrderCount(orderDetail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
||||||
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public AjaxResult statisticsNow() {
|
public AjaxResult statisticsNow() {
|
||||||
return AjaxResult.success(orderDetailService.orderStatisticsReturnByNow());
|
return AjaxResult.success(orderDetailService.orderStatisticsReturnByNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
||||||
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public AjaxResult statistics() {
|
public AjaxResult statistics() {
|
||||||
|
|
|
||||||
|
|
@ -1616,12 +1616,14 @@ public class OrderMasterController extends BaseController {
|
||||||
return AjaxResult.success(orderMasterService.countOrderMasterList(orderMaster));
|
return AjaxResult.success(orderMasterService.countOrderMasterList(orderMaster));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
||||||
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public AjaxResult statisticsNow() {
|
public AjaxResult statisticsNow() {
|
||||||
return AjaxResult.success(orderMasterService.orderStatisticsReturnByNow());
|
return AjaxResult.success(orderMasterService.orderStatisticsReturnByNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
||||||
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public AjaxResult statistics() {
|
public AjaxResult statistics() {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class SysGlobalConfigRequestVO {
|
||||||
private Integer dataType;
|
private Integer dataType;
|
||||||
|
|
||||||
@Schema(description = "单位")
|
@Schema(description = "单位")
|
||||||
private String unit;
|
private String configUnit;
|
||||||
|
|
||||||
public static SysGlobalConfig toModel(SysGlobalConfigRequestVO vo){
|
public static SysGlobalConfig toModel(SysGlobalConfigRequestVO vo){
|
||||||
SysGlobalConfig sysConfig = new SysGlobalConfig();
|
SysGlobalConfig sysConfig = new SysGlobalConfig();
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class SysGlobalConfigResponseVO {
|
||||||
private String dataTypeEnumDesc;
|
private String dataTypeEnumDesc;
|
||||||
|
|
||||||
@Schema(description = "单位")
|
@Schema(description = "单位")
|
||||||
private String unit;
|
private String configUnit;
|
||||||
|
|
||||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||||
@JsonFormat(pattern = SysConstants.DATE_TIME_FORMAT, locale = "zh", timezone = "GMT+8")
|
@JsonFormat(pattern = SysConstants.DATE_TIME_FORMAT, locale = "zh", timezone = "GMT+8")
|
||||||
|
|
|
||||||
|
|
@ -1,134 +1,139 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('修改商品')"/>
|
<th:block th:include="include :: header('')"/>
|
||||||
<th:block th:include="include :: select2-css"/>
|
<th:block th:include="include :: select2-css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<form class="form-horizontal" id="form-goods-edit" th:object="${goods}">
|
<form id="form-goods-add" class="form-horizontal">
|
||||||
<input id="goodsId" name="goodsId" type="hidden" th:field="*{goodsId}"/>
|
|
||||||
<h4 class="form-header h4">基本信息</h4>
|
<h4 class="form-header h4">基本信息</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label is-required">商品名称:</label>
|
<label class="col-sm-4 control-label is-required">主订单已发布更新提示音:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="goodsName" placeholder="请输入商品名称" class="form-control" type="text" maxlength="30"
|
<input name="orderMasterHaveReleasedUrl" id="orderMasterHaveReleasedUrl" placeholder="主订单已发布更新提示音" class="form-control" type="text"
|
||||||
th:field="*{goodsName}"
|
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-sm-6">-->
|
|
||||||
<!-- <div class="form-group">-->
|
|
||||||
<!-- <label class="col-sm-4 control-label is-required">价格:</label>-->
|
|
||||||
<!-- <div class="col-sm-8">-->
|
|
||||||
<!-- <input name="goodsPrice" placeholder="请输入商品价格" class="form-control" type="text" maxlength="12"-->
|
|
||||||
<!-- th:field="*{goodsPrice}"-->
|
|
||||||
<!-- required>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="row">-->
|
|
||||||
<!-- <div class="col-sm-6">-->
|
|
||||||
<!-- <div class="form-group">-->
|
|
||||||
<!-- <label class="col-sm-4 control-label is-required">优惠价:</label>-->
|
|
||||||
<!-- <div class="col-sm-8">-->
|
|
||||||
<!-- <input name="discountsPrice" placeholder="请输入优惠价" class="form-control" type="text"-->
|
|
||||||
<!-- th:field="*{discountsPrice}"-->
|
|
||||||
<!-- maxlength="12" required>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div class="col-sm-6">-->
|
|
||||||
<!-- <div class="form-group">-->
|
|
||||||
<!-- <label class="col-sm-4 control-label is-required">团购价:</label>-->
|
|
||||||
<!-- <div class="col-sm-8">-->
|
|
||||||
<!-- <input name="groupPrice" placeholder="请输入团购价" class="form-control" type="text" maxlength="12"-->
|
|
||||||
<!-- th:field="*{groupPrice}"-->
|
|
||||||
<!-- required>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">商品类别:</label>
|
<label class="col-sm-4 control-label is-required">主订单新订单更新提示音:</label>
|
||||||
<div class="col-xs-8">
|
|
||||||
<select name="deptGoodsCategoryId" class="form-control m-b">
|
|
||||||
<option th:each="item : ${deptGoodsCategories}" th:text="${item.goodsCategoryName}"
|
|
||||||
th:value="${item.deptGoodsCategoryId}" th:field="*{deptGoodsCategoryId}"></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-4 control-label">状态:</label>
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select name="status" class="form-control m-b" th:with="type=${@dict.getType('goods_status')}">
|
<input name="orderMasterNewOrderUrl" id="orderMasterNewOrderUrl" placeholder="主订单新订单更新提示音" class="form-control" type="text"
|
||||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{status}"
|
required>
|
||||||
th:value="${dict.dictValue}"></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="row">-->
|
|
||||||
<!-- <div class="col-sm-6">-->
|
|
||||||
<!-- <div class="form-group">-->
|
|
||||||
<!-- <label class="col-sm-4 control-label is-required">商品库存:</label>-->
|
|
||||||
<!-- <div class="col-sm-8">-->
|
|
||||||
<!-- <input name="goodsNumber" placeholder="请输入商品库存" class="form-control" type="text" maxlength="12"-->
|
|
||||||
<!-- th:field="*{goodsNumber}"-->
|
|
||||||
<!-- required>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<h4 class="form-header h4">其他信息</h4>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-xs-2 control-label">备注:</label>
|
<label class="col-sm-4 control-label is-required">子订单售后更新提示音:</label>
|
||||||
<div class="col-xs-10">
|
<div class="col-sm-8">
|
||||||
<textarea name="remark" maxlength="500" class="form-control" rows="3"
|
<input name="orderDetailsAfterUrl" id="orderDetailsAfterUrl" placeholder="子订单售后更新提示音" class="form-control" type="text"
|
||||||
th:field="*{remark}"></textarea>
|
required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label is-required">子订单售后纠纷更新提示音:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="orderDetailsAfterSalesDisputeUrl" id="orderDetailsAfterSalesDisputeUrl" placeholder="子订单售后纠纷更新提示音" class="form-control" type="text"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="tijiao()">提交</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<th:block th:include="include :: footer"/>
|
<th:block th:include="include :: footer"/>
|
||||||
<th:block th:include="include :: select2-js"/>
|
<th:block th:include="include :: select2-js"/>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
var prefix = ctx + "goods/goods";
|
var prefix = ctx + "goods/goods";
|
||||||
|
|
||||||
$("#form-goods-edit").validate({
|
var id = "";
|
||||||
onkeyup: false,
|
var name = "";
|
||||||
rules: {},
|
var sort = "";
|
||||||
messages: {},
|
var describe = "";
|
||||||
focusCleanup: true
|
var type = "";
|
||||||
});
|
var dataType = "";
|
||||||
|
var configUnit = "";
|
||||||
|
|
||||||
function submitHandler() {
|
//请求接口加载页面输入框值
|
||||||
if ($.validate.form()) {
|
function globalConfiginit(){
|
||||||
var data = $("#form-goods-edit").serializeArray();
|
$.ajax({
|
||||||
$.operate.saveTab(prefix + "/edit", data);
|
type: "GET",
|
||||||
$.modal.close();
|
dataType:"json",
|
||||||
}
|
url: "/config/globalConfig/search/type/1001",
|
||||||
|
data: { },
|
||||||
|
success: function (data) {
|
||||||
|
id = data.data.id;
|
||||||
|
name = data.data.name;
|
||||||
|
sort = data.data.sort;
|
||||||
|
describe = data.data.describe;
|
||||||
|
type = data.data.type;
|
||||||
|
dataType = data.data.dataType;
|
||||||
|
configUnit = data.data.configUnit;
|
||||||
|
//alert(data.data.content);
|
||||||
|
var response = JSON.parse(data.data.content);
|
||||||
|
$('#orderMasterHaveReleasedUrl').val(response.orderMasterHaveReleasedUrl);
|
||||||
|
$('#orderMasterNewOrderUrl').val(response.orderMasterNewOrderUrl);
|
||||||
|
$('#orderDetailsAfterUrl').val(response.orderDetailsAfterUrl);
|
||||||
|
$('#orderDetailsAfterSalesDisputeUrl').val(response.orderDetailsAfterSalesDisputeUrl);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//页面加载
|
||||||
|
window.onload = function () {
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
globalConfiginit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交按钮
|
||||||
|
function tijiao(){
|
||||||
|
$.ajax({
|
||||||
|
type: "PUT",
|
||||||
|
dataType:"json",
|
||||||
|
contentType: 'application/json',
|
||||||
|
url: "/config/globalConfig/update",
|
||||||
|
data: JSON.stringify({
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
content: JSON.stringify({
|
||||||
|
"orderMasterHaveReleasedUrl":$('#orderMasterHaveReleasedUrl').val(),
|
||||||
|
"orderMasterNewOrderUrl":$('#orderMasterNewOrderUrl').val(),
|
||||||
|
"orderDetailsAfterUrl":$('#orderDetailsAfterUrl').val(),
|
||||||
|
"orderDetailsAfterSalesDisputeUrl":$('#orderDetailsAfterSalesDisputeUrl').val()
|
||||||
|
}),
|
||||||
|
sort: sort,
|
||||||
|
describe: describe,
|
||||||
|
type: type,
|
||||||
|
dataType: dataType,
|
||||||
|
unit: configUnit
|
||||||
|
}),
|
||||||
|
success: function (data) {
|
||||||
|
if(data.code == 0){
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
globalConfiginit();
|
||||||
|
alert("成功");
|
||||||
|
}else {
|
||||||
|
alert("失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -850,6 +850,95 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 子订单全部
|
||||||
|
var orderDetailsAfterUrl = "";
|
||||||
|
// 子订单新订单
|
||||||
|
var orderDetailsAfterSalesDisputeUrl = "";
|
||||||
|
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
function globalConfiginit(){
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
dataType:"json",
|
||||||
|
url: "/config/globalConfig/search/type/1001",
|
||||||
|
data: { },
|
||||||
|
success: function (data) {
|
||||||
|
var response = JSON.parse(data.data.content);
|
||||||
|
orderDetailsAfterUrl = response.orderDetailsAfterUrl;
|
||||||
|
orderDetailsAfterSalesDisputeUrl = response.orderDetailsAfterSalesDisputeUrl;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//页面加载
|
||||||
|
window.onload = function () {
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
globalConfiginit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义一个要延迟执行的函数
|
||||||
|
function delayedFunction() {
|
||||||
|
console.log("");
|
||||||
|
}
|
||||||
|
|
||||||
|
var totalOrderNumber = 0;
|
||||||
|
var inServiceNumber = 0;
|
||||||
|
var lastTotalOrderNumber = 0;
|
||||||
|
var lastInServiceNumber = 0;
|
||||||
|
|
||||||
|
function fetchData() {
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
dataType: "json",
|
||||||
|
url: "/order/detail/statistics/now",
|
||||||
|
data: {},
|
||||||
|
success: function (data) {
|
||||||
|
// 更新当前值
|
||||||
|
totalOrderNumber = data.data.totalOrderNumber;
|
||||||
|
inServiceNumber = data.data.inServiceNumber;
|
||||||
|
console.log(totalOrderNumber+"-----"+lastTotalOrderNumber );
|
||||||
|
// 检查新值是否大于旧值
|
||||||
|
if (totalOrderNumber > lastTotalOrderNumber) {
|
||||||
|
console.log("收到新子订单数据,开始播放。播放通知音频:" + orderDetailsAfterUrl);
|
||||||
|
// 获取source元素
|
||||||
|
var source = document.getElementById('myAudio');
|
||||||
|
// 设置新的音频文件路径
|
||||||
|
source.src = orderDetailsAfterUrl;
|
||||||
|
var audio = document.getElementById('myAudio');
|
||||||
|
audio.play().catch(function(error) {
|
||||||
|
console.log('播放失败:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置延迟时间为2000毫秒(2秒)
|
||||||
|
setTimeout(delayedFunction, 2000);
|
||||||
|
|
||||||
|
if (inServiceNumber > lastInServiceNumber) {
|
||||||
|
console.log("收到新子单数据,开始播放。播放通知音频:" + orderDetailsAfterSalesDisputeUrl);
|
||||||
|
// 获取source元素
|
||||||
|
var source = document.getElementById('myAudio');
|
||||||
|
// 设置新的音频文件路径
|
||||||
|
source.src = orderDetailsAfterSalesDisputeUrl;
|
||||||
|
var audio = document.getElementById('myAudio');
|
||||||
|
audio.play().catch(function(error) {
|
||||||
|
console.log('播放失败:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新上一次的值
|
||||||
|
lastTotalOrderNumber = totalOrderNumber;
|
||||||
|
lastInServiceNumber = inServiceNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 设置定时器,每隔一分钟执行一次 fetchData 函数
|
||||||
|
setInterval(fetchData, 60000);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<audio id="myAudio" src=""></audio>
|
||||||
|
|
||||||
<th:block th:include="include :: footer"/>
|
<th:block th:include="include :: footer"/>
|
||||||
<th:block th:include="include :: layout-latest-js"/>
|
<th:block th:include="include :: layout-latest-js"/>
|
||||||
|
|
@ -352,6 +353,7 @@
|
||||||
var prefix = ctx + "order/master";
|
var prefix = ctx + "order/master";
|
||||||
var customParams = {};
|
var customParams = {};
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var panehHidden = false;
|
var panehHidden = false;
|
||||||
if ($(this).width() < 769) {
|
if ($(this).width() < 769) {
|
||||||
|
|
@ -1007,6 +1009,94 @@
|
||||||
showPayQrcode(rows.join());
|
showPayQrcode(rows.join());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 主订单全部
|
||||||
|
var orderMasterHaveReleasedUrl = "";
|
||||||
|
// 主订单新订单
|
||||||
|
var orderMasterNewOrderUrl = "";
|
||||||
|
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
function globalConfiginit(){
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
dataType:"json",
|
||||||
|
url: "/config/globalConfig/search/type/1001",
|
||||||
|
data: { },
|
||||||
|
success: function (data) {
|
||||||
|
var response = JSON.parse(data.data.content);
|
||||||
|
orderMasterHaveReleasedUrl = response.orderMasterHaveReleasedUrl;
|
||||||
|
orderMasterNewOrderUrl = response.orderMasterNewOrderUrl;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//页面加载
|
||||||
|
window.onload = function () {
|
||||||
|
//请求接口加载页面输入框值
|
||||||
|
globalConfiginit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义一个要延迟执行的函数
|
||||||
|
function delayedFunction() {
|
||||||
|
console.log("");
|
||||||
|
}
|
||||||
|
|
||||||
|
var totalOrderNumber = 0;
|
||||||
|
var finishCheckNumber = 0;
|
||||||
|
var lastTotalOrderNumber = 0;
|
||||||
|
var lastFinishCheckNumber = 0;
|
||||||
|
|
||||||
|
function fetchData() {
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
dataType: "json",
|
||||||
|
url: "/order/master/statistics/now",
|
||||||
|
data: {},
|
||||||
|
success: function (data) {
|
||||||
|
// 更新当前值
|
||||||
|
totalOrderNumber = data.data.totalOrderNumber;
|
||||||
|
finishCheckNumber = data.data.finishCheckNumber;
|
||||||
|
console.log(totalOrderNumber+"-----"+lastTotalOrderNumber );
|
||||||
|
// 检查新值是否大于旧值
|
||||||
|
if (totalOrderNumber > lastTotalOrderNumber) {
|
||||||
|
console.log("收到新总订单数据,开始播放。播放通知音频:" + orderMasterHaveReleasedUrl);
|
||||||
|
// 获取source元素
|
||||||
|
var source = document.getElementById('myAudio');
|
||||||
|
// 设置新的音频文件路径
|
||||||
|
source.src = orderMasterHaveReleasedUrl;
|
||||||
|
var audio = document.getElementById('myAudio');
|
||||||
|
audio.play().catch(function(error) {
|
||||||
|
console.log('播放失败:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置延迟时间为2000毫秒(2秒)
|
||||||
|
setTimeout(delayedFunction, 2000);
|
||||||
|
|
||||||
|
if (finishCheckNumber > lastFinishCheckNumber) {
|
||||||
|
console.log("收到新订单数据,开始播放。播放通知音频:" + orderMasterNewOrderUrl);
|
||||||
|
// 获取source元素
|
||||||
|
var source = document.getElementById('myAudio');
|
||||||
|
// 设置新的音频文件路径
|
||||||
|
source.src = orderMasterNewOrderUrl;
|
||||||
|
var audio = document.getElementById('myAudio');
|
||||||
|
audio.play().catch(function(error) {
|
||||||
|
console.log('播放失败:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新上一次的值
|
||||||
|
lastTotalOrderNumber = totalOrderNumber;
|
||||||
|
lastFinishCheckNumber = finishCheckNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 设置定时器,每隔一分钟执行一次 fetchData 函数
|
||||||
|
setInterval(fetchData, 60000);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<script id="importTpl" type="text/template">
|
<script id="importTpl" type="text/template">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.ghy.order.quartz;
|
||||||
|
|
||||||
|
import com.ghy.common.utils.DateUtils;
|
||||||
|
import com.ghy.order.service.OrderDetailService;
|
||||||
|
import com.ghy.order.service.OrderMasterService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2024-09-21 00:23
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Version: v1.0
|
||||||
|
* @Description: 订单统计定时任务
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class OrderDetailsStatisticsTask {
|
||||||
|
|
||||||
|
private final OrderDetailService orderDetailService;
|
||||||
|
|
||||||
|
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||||
|
// public void orderMasterStatistics() {
|
||||||
|
// log.info("{}开始全部主订单统计任务。", DateUtils.timeFormat(new Date()));
|
||||||
|
// orderDetailService.orderStatisticsDispose();
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
|
public void orderMasterStatisticsByNow() {
|
||||||
|
log.info("{}开始当天主订单统计任务。", DateUtils.timeFormat(new Date()));
|
||||||
|
orderDetailService.orderStatisticsDisposeByNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,11 +23,11 @@ public class OrderMasterStatisticsTask {
|
||||||
|
|
||||||
private final OrderMasterService orderMasterService;
|
private final OrderMasterService orderMasterService;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void orderMasterStatistics() {
|
// public void orderMasterStatistics() {
|
||||||
log.info("{}开始全部主订单统计任务。", DateUtils.timeFormat(new Date()));
|
// log.info("{}开始全部主订单统计任务。", DateUtils.timeFormat(new Date()));
|
||||||
orderMasterService.orderStatisticsDispose();
|
// orderMasterService.orderStatisticsDispose();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/5 * * * ?")
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
public void orderMasterStatisticsByNow() {
|
public void orderMasterStatisticsByNow() {
|
||||||
|
|
|
||||||
|
|
@ -69,5 +69,5 @@ public class SysGlobalConfig implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 单位
|
||||||
*/
|
*/
|
||||||
private String unit;
|
private String configUnit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<result column="sys_default" property="sysDefault"/>
|
<result column="sys_default" property="sysDefault"/>
|
||||||
<result column="describe" property="describe"/>
|
<result column="describe" property="describe"/>
|
||||||
<result column="data_type" property="dataType"/>
|
<result column="data_type" property="dataType"/>
|
||||||
<result column="unit" property="unit"/>
|
<result column="config_unit" property="configUnit"/>
|
||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="update_time" property="updateTime"/>
|
<result column="update_time" property="updateTime"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
@ -19,14 +19,14 @@
|
||||||
|
|
||||||
<sql id="allColumns">
|
<sql id="allColumns">
|
||||||
`id`
|
`id`
|
||||||
, `name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `unit`,
|
, `name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `config_unit`,
|
||||||
`create_time`, `update_time`
|
`create_time`, `update_time`
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="creates" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
<insert id="creates" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
<include refid="tableName"/>
|
<include refid="tableName"/>
|
||||||
(`name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `unit`,
|
(`name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `config_unit`,
|
||||||
`create_time`, `update_time`)
|
`create_time`, `update_time`)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach item="item" index="sysConfigs" collection="sysConfigs" separator=",">
|
<foreach item="item" index="sysConfigs" collection="sysConfigs" separator=",">
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
#{item.sysDefault},
|
#{item.sysDefault},
|
||||||
#{item.describe},
|
#{item.describe},
|
||||||
#{item.dataType},
|
#{item.dataType},
|
||||||
#{item.unit},
|
#{item.configUnit},
|
||||||
#{item.createTime},
|
#{item.createTime},
|
||||||
#{item.updateTime}
|
#{item.updateTime}
|
||||||
)
|
)
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateById">
|
<update id="updateById">
|
||||||
|
update
|
||||||
<include refid="tableName"/>
|
<include refid="tableName"/>
|
||||||
<set>
|
<set>
|
||||||
`name` = #{sysGlobalConfig.name},
|
`name` = #{sysGlobalConfig.name},
|
||||||
|
|
@ -55,7 +56,7 @@
|
||||||
`sys_default` = #{sysGlobalConfig.sysDefault},
|
`sys_default` = #{sysGlobalConfig.sysDefault},
|
||||||
`describe` = #{sysGlobalConfig.describe},
|
`describe` = #{sysGlobalConfig.describe},
|
||||||
`data_type` = #{sysGlobalConfig.dataType},
|
`data_type` = #{sysGlobalConfig.dataType},
|
||||||
`unit` = #{sysGlobalConfig.unit},
|
`config_unit` = #{sysGlobalConfig.configUnit},
|
||||||
`update_time` = #{sysGlobalConfig.updateTime}
|
`update_time` = #{sysGlobalConfig.updateTime}
|
||||||
</set>
|
</set>
|
||||||
<where>
|
<where>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue