订单声音配置后台代码
This commit is contained in:
parent
aac5ba8b20
commit
014e591916
|
|
@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -11,6 +12,7 @@ import org.springframework.web.client.RestTemplate;
|
||||||
*
|
*
|
||||||
* @author clunt
|
* @author clunt
|
||||||
*/
|
*/
|
||||||
|
@EnableScheduling
|
||||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||||
public class GhyApplication
|
public class GhyApplication
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.ghy.web.controller.config;
|
||||||
|
|
||||||
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
|
import com.ghy.system.service.ISysGlobalConfigService;
|
||||||
|
import com.ghy.web.pojo.vo.SysGlobalConfigRequestVO;
|
||||||
|
import com.ghy.web.pojo.vo.SysGlobalConfigResponseVO;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Date: 2023-11-09 14:42
|
||||||
|
* @Version: 1.0
|
||||||
|
* @Description: web-系统配置控制层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/web/sys/global/config")
|
||||||
|
@Tag(name = "web-系统配置控制层")
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class SysGlobalConfigController {
|
||||||
|
|
||||||
|
private String prefix = "config/globalConfig";
|
||||||
|
|
||||||
|
@RequiresPermissions("sys:order:audio:config")
|
||||||
|
@GetMapping()
|
||||||
|
public String place() {
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ISysGlobalConfigService service;
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "系统配置查询接口(根据类型查询)", method = "GET")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "typeId", description = "配置类型Code", required = true, in = ParameterIn.PATH)
|
||||||
|
})
|
||||||
|
@GetMapping(path = "/search/type/{typeId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult searchByType(@PathVariable("typeId") Integer typeId) {
|
||||||
|
return AjaxResult.success(SysGlobalConfigResponseVO.toVo(service.loadByConfigType(typeId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("sys:order:audio:config:update")
|
||||||
|
@Operation(summary = "系统配置修改", method = "PUT")
|
||||||
|
@PutMapping(path = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult update(@RequestBody SysGlobalConfigRequestVO sysConfigRequestVO) {
|
||||||
|
return AjaxResult.success(service.update(SysGlobalConfigRequestVO.toModel(sysConfigRequestVO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -34,9 +34,11 @@ import com.ghy.worker.domain.WorkerCertification;
|
||||||
import com.ghy.worker.service.IWorkerCertificationService;
|
import com.ghy.worker.service.IWorkerCertificationService;
|
||||||
import com.ghy.worker.service.WorkerService;
|
import com.ghy.worker.service.WorkerService;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
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.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -1296,4 +1298,16 @@ public class OrderDetailController extends BaseController {
|
||||||
public AjaxResult afterDetailOrderCount(OrderDetail orderDetail) {
|
public AjaxResult afterDetailOrderCount(OrderDetail orderDetail) {
|
||||||
return AjaxResult.success(orderDetailService.afterDetailOrderCount(orderDetail));
|
return AjaxResult.success(orderDetailService.afterDetailOrderCount(orderDetail));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
||||||
|
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult statisticsNow() {
|
||||||
|
return AjaxResult.success(orderDetailService.orderStatisticsReturnByNow());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
||||||
|
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult statistics() {
|
||||||
|
return AjaxResult.success(orderDetailService.orderStatisticsReturn());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,14 @@ import com.ghy.worker.domain.WorkerCertification;
|
||||||
import com.ghy.worker.service.IWorkerCertificationService;
|
import com.ghy.worker.service.IWorkerCertificationService;
|
||||||
import com.ghy.worker.service.WorkerService;
|
import com.ghy.worker.service.WorkerService;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
|
@ -1613,4 +1615,16 @@ public class OrderMasterController extends BaseController {
|
||||||
}
|
}
|
||||||
return AjaxResult.success(orderMasterService.countOrderMasterList(orderMaster));
|
return AjaxResult.success(orderMasterService.countOrderMasterList(orderMaster));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取当天订单统计数据", method = "GET")
|
||||||
|
@GetMapping(path = "/statistics/now", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult statisticsNow() {
|
||||||
|
return AjaxResult.success(orderMasterService.orderStatisticsReturnByNow());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取全部订单统计数据", method = "GET")
|
||||||
|
@GetMapping(path = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public AjaxResult statistics() {
|
||||||
|
return AjaxResult.success(orderMasterService.orderStatisticsReturn());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ghy.web.pojo.vo;
|
||||||
|
|
||||||
|
import com.ghy.system.domain.SysGlobalConfig;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 但星霖
|
||||||
|
* @Date 2023-03-20 20:37:16
|
||||||
|
* 说明:系统配置返回vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(description = "系统配置请求返回vo")
|
||||||
|
public class SysGlobalConfigRequestVO {
|
||||||
|
|
||||||
|
@Schema(description = "配置项主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "配置项名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "配置项内容json串")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "排序号")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
@Schema(description = "配置类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "数据内容类型")
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
public static SysGlobalConfig toModel(SysGlobalConfigRequestVO vo){
|
||||||
|
SysGlobalConfig sysConfig = new SysGlobalConfig();
|
||||||
|
BeanUtils.copyProperties(vo, sysConfig);
|
||||||
|
return sysConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.ghy.web.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.ghy.common.annotation.SysConstants;
|
||||||
|
import com.ghy.common.enums.SysGlobalConfigDataTypeEnum;
|
||||||
|
import com.ghy.common.enums.SysGlobalConfigEnum;
|
||||||
|
import com.ghy.common.utils.ObjectVerifyUtils;
|
||||||
|
import com.ghy.system.domain.SysGlobalConfig;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 但星霖
|
||||||
|
* @Date 2023-03-20 20:37:16
|
||||||
|
* 说明:系统配置返回vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Schema(description = "系统配置返回vo")
|
||||||
|
public class SysGlobalConfigResponseVO {
|
||||||
|
|
||||||
|
@Schema(description = "配置项主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "配置项名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "配置项内容json串")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "排序号")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
@Schema(description = "配置类型")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "配置类型枚举")
|
||||||
|
private SysGlobalConfigEnum typeEnum;
|
||||||
|
|
||||||
|
@Schema(description = "配置类型Desc")
|
||||||
|
private String typeEnumDesc;
|
||||||
|
|
||||||
|
@Schema(description = "数据内容类型")
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
@Schema(description = "数据内容类型")
|
||||||
|
private SysGlobalConfigDataTypeEnum dataTypeEnum;
|
||||||
|
|
||||||
|
@Schema(description = "数据内容类型")
|
||||||
|
private String dataTypeEnumDesc;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonFormat(pattern = SysConstants.DATE_TIME_FORMAT, locale = "zh", timezone = "GMT+8")
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||||
|
@JsonFormat(pattern = SysConstants.DATE_TIME_FORMAT, locale = "zh", timezone = "GMT+8")
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
public static SysGlobalConfigResponseVO toVo(SysGlobalConfig model) {
|
||||||
|
if (ObjectVerifyUtils.isNull(model)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
SysGlobalConfigResponseVO vo = new SysGlobalConfigResponseVO();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
// 配置类型
|
||||||
|
if (ObjectVerifyUtils.isNotNull(model.getType())) {
|
||||||
|
SysGlobalConfigEnum configEnum = SysGlobalConfigEnum.parse(model.getType());
|
||||||
|
if (ObjectVerifyUtils.isNotNull(configEnum)) {
|
||||||
|
vo.setTypeEnum(configEnum);
|
||||||
|
vo.setTypeEnumDesc(configEnum.desc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 配置类型数据类型
|
||||||
|
if (ObjectVerifyUtils.isNotNull(model.getDataType())) {
|
||||||
|
SysGlobalConfigDataTypeEnum sysConfigDataTypeEnum = SysGlobalConfigDataTypeEnum.parse(model.getDataType());
|
||||||
|
if (ObjectVerifyUtils.isNotNull(sysConfigDataTypeEnum)) {
|
||||||
|
vo.setDataTypeEnum(sysConfigDataTypeEnum);
|
||||||
|
vo.setDataTypeEnumDesc(sysConfigDataTypeEnum.desc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 时间类单独处理
|
||||||
|
vo.setCreateTime(ObjectVerifyUtils.isNotNull(model.getCreateTime()) ? new Date(model.getCreateTime()) : null);
|
||||||
|
vo.setUpdateTime(ObjectVerifyUtils.isNotNull(model.getUpdateTime()) ? new Date(model.getUpdateTime()) : null);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<SysGlobalConfigResponseVO> toVoList(List<SysGlobalConfig> sysConfigList) {
|
||||||
|
List<SysGlobalConfigResponseVO> voList = new ArrayList<>();
|
||||||
|
if (ObjectVerifyUtils.isNotEmpty(sysConfigList)) {
|
||||||
|
sysConfigList.forEach(sysConfig -> voList.add(toVo(sysConfig)));
|
||||||
|
}
|
||||||
|
return voList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,134 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('修改商品')"/>
|
||||||
|
<th:block th:include="include :: select2-css"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<form class="form-horizontal" id="form-goods-edit" th:object="${goods}">
|
||||||
|
<input id="goodsId" name="goodsId" type="hidden" th:field="*{goodsId}"/>
|
||||||
|
<h4 class="form-header h4">基本信息</h4>
|
||||||
|
<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="goodsName" placeholder="请输入商品名称" class="form-control" type="text" maxlength="30"
|
||||||
|
th:field="*{goodsName}"
|
||||||
|
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="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="form-group">
|
||||||
|
<label class="col-sm-4 control-label">商品类别:</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">
|
||||||
|
<select name="status" class="form-control m-b" th:with="type=${@dict.getType('goods_status')}">
|
||||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:field="*{status}"
|
||||||
|
th:value="${dict.dictValue}"></option>
|
||||||
|
</select>
|
||||||
|
</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="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-2 control-label">备注:</label>
|
||||||
|
<div class="col-xs-10">
|
||||||
|
<textarea name="remark" maxlength="500" class="form-control" rows="3"
|
||||||
|
th:field="*{remark}"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<th:block th:include="include :: footer"/>
|
||||||
|
<th:block th:include="include :: select2-js"/>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "goods/goods";
|
||||||
|
|
||||||
|
$("#form-goods-edit").validate({
|
||||||
|
onkeyup: false,
|
||||||
|
rules: {},
|
||||||
|
messages: {},
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
var data = $("#form-goods-edit").serializeArray();
|
||||||
|
$.operate.saveTab(prefix + "/edit", data);
|
||||||
|
$.modal.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ghy.common.annotation;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public interface SysConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统启动时间
|
||||||
|
*/
|
||||||
|
Date SYSTEM_START_TIME = new Date();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统默认编码
|
||||||
|
*/
|
||||||
|
String DEFAULT_CHAR_SET = "UTF-8";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式
|
||||||
|
*/
|
||||||
|
String DATE_FORMAT = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只要月份日期格式
|
||||||
|
*/
|
||||||
|
String NOVEMBER_DATE_FORMAT = "MM-dd";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期时间格式
|
||||||
|
*/
|
||||||
|
String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆后的标志
|
||||||
|
*/
|
||||||
|
String TOKEN_PARA_NAME = "Authentication";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.ghy.common.enums;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 但星霖
|
||||||
|
* @Date 2023-03-30 11:26:22
|
||||||
|
* 说明:系统全局配置枚举相关
|
||||||
|
*/
|
||||||
|
public enum SysGlobalConfigDataTypeEnum implements IEnumType {
|
||||||
|
|
||||||
|
VALUE_TIME_SECS(1, "时间-秒"),
|
||||||
|
VALUE_TIME_MIN(2, "时间-分"),
|
||||||
|
VALUE_TIME_HOUR(3, "时间-时"),
|
||||||
|
VALUE_TIME_DAY(4, "时间-天"),
|
||||||
|
VALUE_TIME_WEEK(5, "时间-周"),
|
||||||
|
VALUE_TIME_MONTH(6, "时间-月"),
|
||||||
|
VALUE_TIME_YEAR(7, "时间-年"),
|
||||||
|
VALUE_TEXT(10, "文本"),
|
||||||
|
VALUE_JSON(11, "JSON"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private final static Map<Integer, SysGlobalConfigDataTypeEnum> BY_CODE_MAP
|
||||||
|
= Arrays.stream(SysGlobalConfigDataTypeEnum.values()).collect(Collectors.toMap(SysGlobalConfigDataTypeEnum::code, code -> code));
|
||||||
|
|
||||||
|
private final static Map<String, SysGlobalConfigDataTypeEnum> BY_NAME_MAP
|
||||||
|
= Arrays.stream(SysGlobalConfigDataTypeEnum.values()).collect(Collectors.toMap(code -> code.name().toLowerCase(), code -> code));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code 代码
|
||||||
|
* @param desc 描述
|
||||||
|
*/
|
||||||
|
SysGlobalConfigDataTypeEnum(final int code, final String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int code() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code 代码
|
||||||
|
* @return 转换出来的状态码
|
||||||
|
*/
|
||||||
|
public static SysGlobalConfigDataTypeEnum parse(Integer code) {
|
||||||
|
return BY_CODE_MAP.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SysGlobalConfigDataTypeEnum parse(Integer code, SysGlobalConfigDataTypeEnum defaultState) {
|
||||||
|
return BY_CODE_MAP.getOrDefault(code, defaultState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name 名字
|
||||||
|
* @return 转换出来的状态码
|
||||||
|
*/
|
||||||
|
public static SysGlobalConfigDataTypeEnum parse(String name) {
|
||||||
|
if (StringUtils.isBlank(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BY_NAME_MAP.get(name.trim().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SysGlobalConfigDataTypeEnum parse(String name, SysGlobalConfigDataTypeEnum defaultState) {
|
||||||
|
if (StringUtils.isBlank(name)) {
|
||||||
|
return defaultState;
|
||||||
|
}
|
||||||
|
return BY_NAME_MAP.getOrDefault(name.trim().toLowerCase(), defaultState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
package com.ghy.common.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 但星霖
|
||||||
|
* @Date 2023-03-30 11:26:22
|
||||||
|
* 说明:系统配置枚举相关
|
||||||
|
*/
|
||||||
|
public enum SysGlobalConfigEnum implements IEnumType {
|
||||||
|
|
||||||
|
ORDER_REMIND_AUDIO_CONFIG(1001, "订单提醒音频配置"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private final static Map<Integer, SysGlobalConfigEnum> BY_CODE_MAP
|
||||||
|
= Arrays.stream(SysGlobalConfigEnum.values()).collect(Collectors.toMap(SysGlobalConfigEnum::code, code -> code));
|
||||||
|
|
||||||
|
private final static Map<String, SysGlobalConfigEnum> BY_NAME_MAP
|
||||||
|
= Arrays.stream(SysGlobalConfigEnum.values()).collect(Collectors.toMap(code -> code.name().toLowerCase(), code -> code));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code 代码
|
||||||
|
* @param desc 描述
|
||||||
|
*/
|
||||||
|
SysGlobalConfigEnum(final int code, final String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int code() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code 代码
|
||||||
|
* @return 转换出来的状态码
|
||||||
|
*/
|
||||||
|
public static SysGlobalConfigEnum parse(Integer code) {
|
||||||
|
return BY_CODE_MAP.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SysGlobalConfigEnum parse(Integer code, SysGlobalConfigEnum defaultState) {
|
||||||
|
return BY_CODE_MAP.getOrDefault(code, defaultState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name 名字
|
||||||
|
* @return 转换出来的状态码
|
||||||
|
*/
|
||||||
|
public static SysGlobalConfigEnum parse(String name) {
|
||||||
|
if (StringUtils.isBlank(name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return BY_NAME_MAP.get(name.trim().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SysGlobalConfigEnum parse(String name, SysGlobalConfigEnum defaultState) {
|
||||||
|
if (StringUtils.isBlank(name)) {
|
||||||
|
return defaultState;
|
||||||
|
}
|
||||||
|
return BY_NAME_MAP.getOrDefault(name.trim().toLowerCase(), defaultState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3,6 +3,11 @@ package com.ghy.common.utils;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
|
@ -28,6 +33,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间转换
|
||||||
|
*
|
||||||
|
* @param dateTime 时间
|
||||||
|
* @return 转换后的时间类型
|
||||||
|
*/
|
||||||
|
public static String timeFormat(Date dateTime) {
|
||||||
|
Instant instant = dateTime.toInstant();
|
||||||
|
ZoneId zone = ZoneId.systemDefault();
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
|
||||||
|
return localDateTime.format(DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前Date型日期
|
* 获取当前Date型日期
|
||||||
*
|
*
|
||||||
|
|
@ -169,4 +187,26 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
return simpleDateFormat.format(date);
|
return simpleDateFormat.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取传入时间的指定当天开始时间
|
||||||
|
public static Date getDayStartTime(Long time) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(time);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取传入时间的指定当天结算时间
|
||||||
|
public static Date getDayEndTime(Long time) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(time);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.ghy.common.utils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2024-09-26 22:49
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Version: v1.0
|
||||||
|
* @Description: 参数校验工具类
|
||||||
|
*/
|
||||||
|
public class ObjectVerifyUtils {
|
||||||
|
|
||||||
|
public static boolean isEmpty(Collection<?> coll) {
|
||||||
|
return coll == null || coll.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isNotEmpty(Collection<?> coll) {
|
||||||
|
return !isEmpty(coll);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isNull(Object... objs) {
|
||||||
|
Object[] var1 = objs;
|
||||||
|
int var2 = objs.length;
|
||||||
|
|
||||||
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
|
Object obj = var1[var3];
|
||||||
|
if (isEmpty(obj)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNotNull(Object... obj) {
|
||||||
|
return !isNull(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNotEmpty(Object obj) {
|
||||||
|
return !isEmpty(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEmpty(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return true;
|
||||||
|
} else if (obj.getClass().isArray()) {
|
||||||
|
return Array.getLength(obj) == 0;
|
||||||
|
} else if (obj instanceof CharSequence) {
|
||||||
|
return ((CharSequence)obj).length() == 0;
|
||||||
|
} else if (obj instanceof Collection) {
|
||||||
|
return ((Collection)obj).isEmpty();
|
||||||
|
} else if (obj instanceof Map) {
|
||||||
|
return ((Map)obj).isEmpty();
|
||||||
|
} else if (obj instanceof Iterable) {
|
||||||
|
return !((Iterable)obj).iterator().hasNext();
|
||||||
|
} else if (obj instanceof Iterator) {
|
||||||
|
return !((Iterator)obj).hasNext();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -117,4 +117,7 @@ public interface OrderDetailMapper {
|
||||||
int deleteByMaster(Long masterId);
|
int deleteByMaster(Long masterId);
|
||||||
|
|
||||||
OrderDetailCount differentStatusOrderCount(OrderDetail orderDetail);
|
OrderDetailCount differentStatusOrderCount(OrderDetail orderDetail);
|
||||||
|
|
||||||
|
// 根据开始/结算时间进行查询有效的订单详情数据。
|
||||||
|
List<OrderDetail> searchByOrderStartTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.ghy.order.domain.OrderMasterCount;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -110,4 +111,8 @@ public interface OrderMasterMapper {
|
||||||
int removeWorker(Long id);
|
int removeWorker(Long id);
|
||||||
|
|
||||||
OrderMasterCount differentStatusOrderCount(OrderMaster orderMaster);
|
OrderMasterCount differentStatusOrderCount(OrderMaster orderMaster);
|
||||||
|
|
||||||
|
|
||||||
|
// 根据开始/结算时间进行查询有效的订单主数据。
|
||||||
|
List<OrderMaster> searchByOrderStartTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.ghy.order.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2024-09-12 23:12
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Version: v1.0
|
||||||
|
* @Description: 订单详情统计dto
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderDetailStatisticsDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* '0. 1.待排期 2.待上门 3.服务中 4.已完成 5.已取消',
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 待接单 数量
|
||||||
|
private Integer pendingOrderNumber = 0;
|
||||||
|
|
||||||
|
// 待排期 数量
|
||||||
|
private Integer waitingDateNumber = 0;
|
||||||
|
|
||||||
|
// 待上门 数量
|
||||||
|
private Integer waitSeeNumber = 0;
|
||||||
|
|
||||||
|
// 服务中 数量
|
||||||
|
private Integer inServiceNumber = 0;
|
||||||
|
|
||||||
|
// 已完成 数量
|
||||||
|
private Integer completedNumber = 0;
|
||||||
|
|
||||||
|
// 已取消 数量
|
||||||
|
private Integer canceledNumber = 0;
|
||||||
|
|
||||||
|
// 总数
|
||||||
|
private Integer totalOrderNumber = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.ghy.order.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2024-09-12 23:12
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Version: v1.0
|
||||||
|
* @Description: 主订单统计dto
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderMasterStatisticsDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总数
|
||||||
|
*/
|
||||||
|
private Integer totalOrderNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已取消订单数量
|
||||||
|
*/
|
||||||
|
private Integer cancelNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成订单数量
|
||||||
|
*/
|
||||||
|
private Integer finishNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待确认订单数量
|
||||||
|
*/
|
||||||
|
private Integer finishCheckNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务中订单数量
|
||||||
|
*/
|
||||||
|
private Integer serverNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待上门订单数量
|
||||||
|
*/
|
||||||
|
private Integer goingNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待排期订单数量
|
||||||
|
*/
|
||||||
|
private Integer plainNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待接单订单数量
|
||||||
|
*/
|
||||||
|
private Integer receiveNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待确认时申请取消订单数量
|
||||||
|
*/
|
||||||
|
private Integer finishCheckCancelNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务中申请取消订单数量
|
||||||
|
*/
|
||||||
|
private Integer serverCancelNumber = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待上门时申请取消订单数量
|
||||||
|
*/
|
||||||
|
private Integer goingCancelNumber = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.ghy.order.quartz;
|
||||||
|
|
||||||
|
import com.ghy.common.utils.DateUtils;
|
||||||
|
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 OrderMasterStatisticsTask {
|
||||||
|
|
||||||
|
private final OrderMasterService orderMasterService;
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
|
public void orderMasterStatistics() {
|
||||||
|
log.info("{}开始全部主订单统计任务。", DateUtils.timeFormat(new Date()));
|
||||||
|
orderMasterService.orderStatisticsDispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/5 * * * ?")
|
||||||
|
public void orderMasterStatisticsByNow() {
|
||||||
|
log.info("{}开始当天主订单统计任务。", DateUtils.timeFormat(new Date()));
|
||||||
|
orderMasterService.orderStatisticsDisposeByNow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ghy.order.service;
|
||||||
|
|
||||||
import com.ghy.common.enums.OrderStatus;
|
import com.ghy.common.enums.OrderStatus;
|
||||||
import com.ghy.order.domain.*;
|
import com.ghy.order.domain.*;
|
||||||
|
import com.ghy.order.pojo.dto.OrderDetailStatisticsDTO;
|
||||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
|
|
||||||
|
|
@ -188,4 +189,16 @@ public interface OrderDetailService {
|
||||||
OrderDetailCount differentStatusOrderCount(OrderDetail orderDetail);
|
OrderDetailCount differentStatusOrderCount(OrderDetail orderDetail);
|
||||||
|
|
||||||
Long afterDetailOrderCount(OrderDetail orderDetail);
|
Long afterDetailOrderCount(OrderDetail orderDetail);
|
||||||
|
|
||||||
|
// 订单详情数据统计返回 每次都统计全表 数据量比较小
|
||||||
|
OrderDetailStatisticsDTO orderStatisticsReturn();
|
||||||
|
|
||||||
|
// 订单详情数据统计返回 每次都统计全表 数据量比较小
|
||||||
|
OrderDetailStatisticsDTO orderStatisticsDispose();
|
||||||
|
|
||||||
|
// 订单详情数据统计返回 根据时间统计当前日期天
|
||||||
|
OrderDetailStatisticsDTO orderStatisticsReturnByNow();
|
||||||
|
|
||||||
|
// 订单详情数据统计返回 根据时间统计当前日期天
|
||||||
|
OrderDetailStatisticsDTO orderStatisticsDisposeByNow();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ghy.order.service;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.order.domain.OrderMaster;
|
import com.ghy.order.domain.OrderMaster;
|
||||||
import com.ghy.order.domain.OrderMasterCount;
|
import com.ghy.order.domain.OrderMasterCount;
|
||||||
|
import com.ghy.order.pojo.dto.OrderMasterStatisticsDTO;
|
||||||
import com.ghy.order.request.AppOrderRequest;
|
import com.ghy.order.request.AppOrderRequest;
|
||||||
import com.ghy.order.request.OrderChangePriceReq;
|
import com.ghy.order.request.OrderChangePriceReq;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
|
|
@ -175,4 +176,16 @@ public interface OrderMasterService {
|
||||||
*/
|
*/
|
||||||
AjaxResult batchChangePrice(OrderChangePriceReq changePriceReq);
|
AjaxResult batchChangePrice(OrderChangePriceReq changePriceReq);
|
||||||
|
|
||||||
|
// 订单主表数据统计返回 每次都统计全表 数据量比较小
|
||||||
|
OrderMasterStatisticsDTO orderStatisticsReturn();
|
||||||
|
|
||||||
|
// 订单主表数据统计返回 每次都统计全表 数据量比较小
|
||||||
|
OrderMasterStatisticsDTO orderStatisticsDispose();
|
||||||
|
|
||||||
|
// 订单主表数据统计返回 根据时间统计当前日期天
|
||||||
|
OrderMasterStatisticsDTO orderStatisticsReturnByNow();
|
||||||
|
|
||||||
|
// 订单主表数据统计返回 根据时间统计当前日期天
|
||||||
|
OrderMasterStatisticsDTO orderStatisticsDisposeByNow();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,7 @@ import com.ghy.common.constant.UserConstants;
|
||||||
import com.ghy.common.core.text.Convert;
|
import com.ghy.common.core.text.Convert;
|
||||||
import com.ghy.common.enums.*;
|
import com.ghy.common.enums.*;
|
||||||
import com.ghy.common.exception.base.BaseException;
|
import com.ghy.common.exception.base.BaseException;
|
||||||
import com.ghy.common.utils.AdapayUtils;
|
import com.ghy.common.utils.*;
|
||||||
import com.ghy.common.utils.MoneyUtil;
|
|
||||||
import com.ghy.common.utils.ObjectUtils;
|
|
||||||
import com.ghy.common.utils.StringUtils;
|
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
import com.ghy.customer.service.CustomerService;
|
import com.ghy.customer.service.CustomerService;
|
||||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
|
|
@ -26,6 +23,7 @@ import com.ghy.order.domain.*;
|
||||||
import com.ghy.order.mapper.OrderAddSubtractMapper;
|
import com.ghy.order.mapper.OrderAddSubtractMapper;
|
||||||
import com.ghy.order.mapper.OrderDetailMapper;
|
import com.ghy.order.mapper.OrderDetailMapper;
|
||||||
import com.ghy.order.mapper.OrderMasterMapper;
|
import com.ghy.order.mapper.OrderMasterMapper;
|
||||||
|
import com.ghy.order.pojo.dto.OrderDetailStatisticsDTO;
|
||||||
import com.ghy.order.service.*;
|
import com.ghy.order.service.*;
|
||||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||||
import com.ghy.payment.domain.FinancialDetail;
|
import com.ghy.payment.domain.FinancialDetail;
|
||||||
|
|
@ -116,6 +114,9 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
@Value("${adapay.fee_rate:0.008}")
|
@Value("${adapay.fee_rate:0.008}")
|
||||||
private String feeRate;
|
private String feeRate;
|
||||||
|
|
||||||
|
private final OrderDetailStatisticsDTO statisticsDTO = new OrderDetailStatisticsDTO();
|
||||||
|
private final OrderDetailStatisticsDTO statisticsDTOByNow = new OrderDetailStatisticsDTO();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insertOrderDetail(OrderDetail orderDetail) {
|
public int insertOrderDetail(OrderDetail orderDetail) {
|
||||||
return orderDetailMapper.insertOrderDetail(orderDetail);
|
return orderDetailMapper.insertOrderDetail(orderDetail);
|
||||||
|
|
@ -1184,4 +1185,102 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
}
|
}
|
||||||
return this.countOrderDetailList(orderDetail);
|
return this.countOrderDetailList(orderDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDetailStatisticsDTO orderStatisticsReturn() {
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDetailStatisticsDTO orderStatisticsDispose() {
|
||||||
|
// 拿到当前时间
|
||||||
|
Long time = System.currentTimeMillis();
|
||||||
|
// 根据时间返回查询
|
||||||
|
List<OrderDetail> orderDetails = orderDetailMapper.searchByOrderStartTime(DateUtils.getDayStartTime(time), DateUtils.getDayEndTime(time));
|
||||||
|
// 订单数据统计
|
||||||
|
if (orderDetails != null && !orderDetails.isEmpty()) {
|
||||||
|
// 根据map数据进行数据分类处理 根据订单状态类型进行数据分类处理。
|
||||||
|
Map<Integer, List<OrderDetail>> masterOrderMap = orderDetails.stream().collect(Collectors.groupingBy(OrderDetail::getOrderStatus));
|
||||||
|
// 循环订单状态类型进行状态类型 switch进行归类处理。
|
||||||
|
for (Integer orderStateKey : masterOrderMap.keySet()) {
|
||||||
|
/**
|
||||||
|
* 0.待接单 1.待排期 2.待上门 3.服务中 4.已完成 5.已取消
|
||||||
|
*/
|
||||||
|
switch (orderStateKey) {
|
||||||
|
case 0:
|
||||||
|
statisticsDTO.setPendingOrderNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
statisticsDTO.setWaitingDateNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
statisticsDTO.setWaitSeeNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
statisticsDTO.setInServiceNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
statisticsDTO.setCompletedNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
statisticsDTO.setCanceledNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 总数
|
||||||
|
statisticsDTO.setTotalOrderNumber(orderDetails.size());
|
||||||
|
}
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDetailStatisticsDTO orderStatisticsReturnByNow() {
|
||||||
|
return statisticsDTOByNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDetailStatisticsDTO orderStatisticsDisposeByNow() {
|
||||||
|
// 拿到当前时间
|
||||||
|
Long time = System.currentTimeMillis();
|
||||||
|
// 根据时间返回查询
|
||||||
|
List<OrderDetail> orderDetails = orderDetailMapper.searchByOrderStartTime(DateUtils.getDayStartTime(time), DateUtils.getDayEndTime(time));
|
||||||
|
// 订单数据统计
|
||||||
|
if (orderDetails != null && !orderDetails.isEmpty()) {
|
||||||
|
// 根据map数据进行数据分类处理 根据订单状态类型进行数据分类处理。
|
||||||
|
Map<Integer, List<OrderDetail>> masterOrderMap = orderDetails.stream().collect(Collectors.groupingBy(OrderDetail::getOrderStatus));
|
||||||
|
// 循环订单状态类型进行状态类型 switch进行归类处理。
|
||||||
|
for (Integer orderStateKey : masterOrderMap.keySet()) {
|
||||||
|
/**
|
||||||
|
* 0.待接单 1.待排期 2.待上门 3.服务中 4.已完成 5.已取消
|
||||||
|
*/
|
||||||
|
switch (orderStateKey) {
|
||||||
|
case 0:
|
||||||
|
statisticsDTOByNow.setPendingOrderNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
statisticsDTOByNow.setWaitingDateNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
statisticsDTOByNow.setWaitSeeNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
statisticsDTOByNow.setInServiceNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
statisticsDTOByNow.setCompletedNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
statisticsDTOByNow.setCanceledNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 总数
|
||||||
|
statisticsDTOByNow.setTotalOrderNumber(orderDetails.size());
|
||||||
|
}
|
||||||
|
return statisticsDTOByNow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,14 @@ import com.ghy.common.enums.OrderStatus;
|
||||||
import com.ghy.common.enums.PayStatus;
|
import com.ghy.common.enums.PayStatus;
|
||||||
import com.ghy.common.enums.RefundType;
|
import com.ghy.common.enums.RefundType;
|
||||||
import com.ghy.common.utils.AdapayUtils;
|
import com.ghy.common.utils.AdapayUtils;
|
||||||
|
import com.ghy.common.utils.DateUtils;
|
||||||
|
import com.ghy.common.utils.ObjectUtils;
|
||||||
import com.ghy.order.domain.OrderDetail;
|
import com.ghy.order.domain.OrderDetail;
|
||||||
import com.ghy.order.domain.OrderGoods;
|
import com.ghy.order.domain.OrderGoods;
|
||||||
import com.ghy.order.domain.OrderMaster;
|
import com.ghy.order.domain.OrderMaster;
|
||||||
import com.ghy.order.domain.OrderMasterCount;
|
import com.ghy.order.domain.OrderMasterCount;
|
||||||
import com.ghy.order.mapper.OrderMasterMapper;
|
import com.ghy.order.mapper.OrderMasterMapper;
|
||||||
|
import com.ghy.order.pojo.dto.OrderMasterStatisticsDTO;
|
||||||
import com.ghy.order.request.AppOrderRequest;
|
import com.ghy.order.request.AppOrderRequest;
|
||||||
import com.ghy.order.request.OrderChangePriceReq;
|
import com.ghy.order.request.OrderChangePriceReq;
|
||||||
import com.ghy.order.service.OrderDetailService;
|
import com.ghy.order.service.OrderDetailService;
|
||||||
|
|
@ -48,6 +51,7 @@ import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品模块实现类
|
* 商品模块实现类
|
||||||
|
|
@ -82,6 +86,10 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
||||||
|
|
||||||
private final static ThreadLocal<SimpleDateFormat> dateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMddHHmmss"));
|
private final static ThreadLocal<SimpleDateFormat> dateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMddHHmmss"));
|
||||||
|
|
||||||
|
// 这里没有使用redis 暂时将这个查询统计实体放入内存吧。默认调用的时候直接更新他就可以了。
|
||||||
|
private final OrderMasterStatisticsDTO statisticsDTO = new OrderMasterStatisticsDTO();
|
||||||
|
private final OrderMasterStatisticsDTO statisticsDTOByNow = new OrderMasterStatisticsDTO();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized String createOrderCode() {
|
public synchronized String createOrderCode() {
|
||||||
INDEX.compareAndSet(9999L, 1L);
|
INDEX.compareAndSet(9999L, 1L);
|
||||||
|
|
@ -604,4 +612,150 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderMasterStatisticsDTO orderStatisticsReturn() {
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderMasterStatisticsDTO orderStatisticsDispose() {
|
||||||
|
// 根据时间返回查询
|
||||||
|
List<OrderMaster> orderMasters = orderMasterMapper.searchByOrderStartTime(null, null);
|
||||||
|
// 订单数据统计
|
||||||
|
if (orderMasters != null && !orderMasters.isEmpty()) {
|
||||||
|
// 根据map数据进行数据分类处理 根据订单状态类型进行数据分类处理。
|
||||||
|
Map<Integer, List<OrderMaster>> masterOrderMap = orderMasters.stream().collect(Collectors.groupingBy(OrderMaster::getOrderStatus));
|
||||||
|
// 循环订单状态类型进行状态类型 switch进行归类处理。
|
||||||
|
for (Integer orderStateKey : masterOrderMap.keySet()) {
|
||||||
|
/**
|
||||||
|
* GOING_CANCEL(-2, "待上门时申请取消"),
|
||||||
|
* SERVER_CANCEL(-3, "服务中申请取消"),
|
||||||
|
* FINISH_CHECK_CANCEL(-4, "待确认时申请取消"),
|
||||||
|
*
|
||||||
|
* RECEIVE(0, "待接单"),
|
||||||
|
* PLAIN(1, "待排期"),
|
||||||
|
* GOING(2, "待上门"),
|
||||||
|
* SERVER(3, "服务中"),
|
||||||
|
* FINISH_CHECK(4, "待确认"),
|
||||||
|
* FINISH(5, "已完成"),
|
||||||
|
* CANCEL(6, "已取消");
|
||||||
|
*/
|
||||||
|
OrderStatus orderStatus = OrderStatus.parse(orderStateKey);
|
||||||
|
if (ObjectUtils.isNotNull(orderStatus)) {
|
||||||
|
switch (orderStatus) {
|
||||||
|
case CANCEL:
|
||||||
|
statisticsDTO.setCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH:
|
||||||
|
statisticsDTO.setFinishNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH_CHECK:
|
||||||
|
statisticsDTO.setFinishCheckNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case SERVER:
|
||||||
|
statisticsDTO.setServerNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case GOING:
|
||||||
|
statisticsDTO.setGoingNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case PLAIN:
|
||||||
|
statisticsDTO.setPlainNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case RECEIVE:
|
||||||
|
statisticsDTO.setReceiveNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case GOING_CANCEL:
|
||||||
|
statisticsDTO.setGoingCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case SERVER_CANCEL:
|
||||||
|
statisticsDTO.setServerCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH_CHECK_CANCEL:
|
||||||
|
statisticsDTO.setFinishCheckCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 总数
|
||||||
|
statisticsDTO.setTotalOrderNumber(orderMasters.size());
|
||||||
|
}
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderMasterStatisticsDTO orderStatisticsReturnByNow() {
|
||||||
|
return statisticsDTOByNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderMasterStatisticsDTO orderStatisticsDisposeByNow() {
|
||||||
|
// 拿到当前时间
|
||||||
|
Long time = System.currentTimeMillis();
|
||||||
|
// 根据时间返回查询
|
||||||
|
List<OrderMaster> orderMasters = orderMasterMapper.searchByOrderStartTime(DateUtils.getDayStartTime(time), DateUtils.getDayEndTime(time));
|
||||||
|
// 订单数据统计
|
||||||
|
if (orderMasters != null && !orderMasters.isEmpty()) {
|
||||||
|
// 根据map数据进行数据分类处理 根据订单状态类型进行数据分类处理。
|
||||||
|
Map<Integer, List<OrderMaster>> masterOrderMap = orderMasters.stream().collect(Collectors.groupingBy(OrderMaster::getOrderStatus));
|
||||||
|
// 循环订单状态类型进行状态类型 switch进行归类处理。
|
||||||
|
for (Integer orderStateKey : masterOrderMap.keySet()) {
|
||||||
|
/**
|
||||||
|
* GOING_CANCEL(-2, "待上门时申请取消"),
|
||||||
|
* SERVER_CANCEL(-3, "服务中申请取消"),
|
||||||
|
* FINISH_CHECK_CANCEL(-4, "待确认时申请取消"),
|
||||||
|
*
|
||||||
|
* RECEIVE(0, "待接单"),
|
||||||
|
* PLAIN(1, "待排期"),
|
||||||
|
* GOING(2, "待上门"),
|
||||||
|
* SERVER(3, "服务中"),
|
||||||
|
* FINISH_CHECK(4, "待确认"),
|
||||||
|
* FINISH(5, "已完成"),
|
||||||
|
* CANCEL(6, "已取消");
|
||||||
|
*/
|
||||||
|
OrderStatus orderStatus = OrderStatus.parse(orderStateKey);
|
||||||
|
if (ObjectUtils.isNotNull(orderStatus)) {
|
||||||
|
switch (orderStatus) {
|
||||||
|
case CANCEL:
|
||||||
|
statisticsDTOByNow.setCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH:
|
||||||
|
statisticsDTOByNow.setFinishNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH_CHECK:
|
||||||
|
statisticsDTOByNow.setFinishCheckNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case SERVER:
|
||||||
|
statisticsDTOByNow.setServerNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case GOING:
|
||||||
|
statisticsDTOByNow.setGoingNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case PLAIN:
|
||||||
|
statisticsDTOByNow.setPlainNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case RECEIVE:
|
||||||
|
statisticsDTOByNow.setReceiveNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case GOING_CANCEL:
|
||||||
|
statisticsDTOByNow.setGoingCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case SERVER_CANCEL:
|
||||||
|
statisticsDTOByNow.setServerCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
case FINISH_CHECK_CANCEL:
|
||||||
|
statisticsDTOByNow.setFinishCheckCancelNumber(masterOrderMap.get(orderStateKey).size());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 总数
|
||||||
|
statisticsDTOByNow.setTotalOrderNumber(orderMasters.size());
|
||||||
|
}
|
||||||
|
return statisticsDTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,33 +5,33 @@
|
||||||
<mapper namespace="com.ghy.order.mapper.OrderDetailMapper">
|
<mapper namespace="com.ghy.order.mapper.OrderDetailMapper">
|
||||||
|
|
||||||
<resultMap id="OrderDetailResult" type="com.ghy.order.domain.OrderDetail">
|
<resultMap id="OrderDetailResult" type="com.ghy.order.domain.OrderDetail">
|
||||||
<id property="id" column="id"/>
|
<id property="id" column="id"/>
|
||||||
<result property="code" column="code"/>
|
<result property="code" column="code"/>
|
||||||
<result property="orderMasterId" column="order_master_id"/>
|
<result property="orderMasterId" column="order_master_id"/>
|
||||||
<result property="orderMasterCode" column="order_master_code"/>
|
<result property="orderMasterCode" column="order_master_code"/>
|
||||||
<result property="customerId" column="customer_id"/>
|
<result property="customerId" column="customer_id"/>
|
||||||
<result property="orderType" column="order_type"/>
|
<result property="orderType" column="order_type"/>
|
||||||
<result property="orderStatus" column="order_status"/>
|
<result property="orderStatus" column="order_status"/>
|
||||||
<result property="workerId" column="worker_id"/>
|
<result property="workerId" column="worker_id"/>
|
||||||
<result property="revTime" column="rev_time"/>
|
<result property="revTime" column="rev_time"/>
|
||||||
<result property="expectTimeStart" column="expect_time_start"/>
|
<result property="expectTimeStart" column="expect_time_start"/>
|
||||||
<result property="expectTimeEnd" column="expect_time_end"/>
|
<result property="expectTimeEnd" column="expect_time_end"/>
|
||||||
<result property="workBeginTime" column="work_begin_time"/>
|
<result property="workBeginTime" column="work_begin_time"/>
|
||||||
<result property="workFinishTime" column="work_finish_time"/>
|
<result property="workFinishTime" column="work_finish_time"/>
|
||||||
<result property="drawCashId" column="draw_cash_id"/>
|
<result property="drawCashId" column="draw_cash_id"/>
|
||||||
<result property="drawCashTime" column="draw_cash_time"/>
|
<result property="drawCashTime" column="draw_cash_time"/>
|
||||||
<result property="arrivalTime" column="arrival_time"/>
|
<result property="arrivalTime" column="arrival_time"/>
|
||||||
<result property="drawCashStatus" column="draw_cash_status"/>
|
<result property="drawCashStatus" column="draw_cash_status"/>
|
||||||
<result property="clockInLocation" column="clock_in_location"/>
|
<result property="clockInLocation" column="clock_in_location"/>
|
||||||
<result property="shelveStatus" column="shelve_status"/>
|
<result property="shelveStatus" column="shelve_status"/>
|
||||||
<result property="ledgerAccountStatus" column="ledger_account_status"/>
|
<result property="ledgerAccountStatus" column="ledger_account_status"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="timeout" column="timeout_"/>
|
<result property="timeout" column="timeout_"/>
|
||||||
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
<result property="timeoutFineTimes" column="timeout_fine_times"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOrderDetail">
|
<sql id="selectOrderDetail">
|
||||||
|
|
@ -93,10 +93,10 @@
|
||||||
od.timeout_,
|
od.timeout_,
|
||||||
od.timeout_fine_times
|
od.timeout_fine_times
|
||||||
FROM order_detail od
|
FROM order_detail od
|
||||||
LEFT JOIN order_master om ON om.id = od.order_master_id
|
LEFT JOIN order_master om ON om.id = od.order_master_id
|
||||||
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
LEFT JOIN customer_address ca ON ca.customer_address_id = om.address_id
|
||||||
LEFT JOIN goods g ON g.goods_id = om.goods_id
|
LEFT JOIN goods g ON g.goods_id = om.goods_id
|
||||||
left join worker w on od.worker_id = w.worker_id
|
left join worker w on od.worker_id = w.worker_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
|
<select id="selectOrderDetailList" parameterType="com.ghy.order.domain.OrderDetail" resultMap="OrderDetailResult">
|
||||||
|
|
@ -202,9 +202,9 @@
|
||||||
#{drawCashStatus}
|
#{drawCashStatus}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="workFinishTimeExisted">-->
|
<!-- <if test="workFinishTimeExisted">-->
|
||||||
<!-- AND od.work_finish_time is not null-->
|
<!-- AND od.work_finish_time is not null-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<if test="timeout != null">
|
<if test="timeout != null">
|
||||||
AND od.timeout_ = #{timeout}
|
AND od.timeout_ = #{timeout}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -270,9 +270,9 @@
|
||||||
<if test="shelveStatus != null">
|
<if test="shelveStatus != null">
|
||||||
AND od.shelve_status = ${shelveStatus}
|
AND od.shelve_status = ${shelveStatus}
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="workFinishTimeExisted">-->
|
<!-- <if test="workFinishTimeExisted">-->
|
||||||
<!-- AND od.work_finish_time is not null-->
|
<!-- AND od.work_finish_time is not null-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<if test="drawCashStatusList != null and drawCashStatusList.size() > 0">
|
<if test="drawCashStatusList != null and drawCashStatusList.size() > 0">
|
||||||
AND od.draw_cash_status in
|
AND od.draw_cash_status in
|
||||||
<foreach collection="drawCashStatusList" item="drawCashStatus" open="(" separator="," close=")">
|
<foreach collection="drawCashStatusList" item="drawCashStatus" open="(" separator="," close=")">
|
||||||
|
|
@ -306,12 +306,14 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectById" parameterType="long" resultMap="OrderDetailResult">
|
<select id="selectById" parameterType="long" resultMap="OrderDetailResult">
|
||||||
<include refid="selectOrderDetail"/> WHERE id = #{orderDetailId}
|
<include refid="selectOrderDetail"/>
|
||||||
|
WHERE id = #{orderDetailId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectByOrderMasterId" parameterType="long" resultMap="OrderDetailResult">
|
<select id="selectByOrderMasterId" parameterType="long" resultMap="OrderDetailResult">
|
||||||
<include refid="selectOrderDetail"/> WHERE order_master_id = #{orderMasterId}
|
<include refid="selectOrderDetail"/>
|
||||||
|
WHERE order_master_id = #{orderMasterId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteOrderDetailByIds" parameterType="Long">
|
<delete id="deleteOrderDetailByIds" parameterType="Long">
|
||||||
|
|
@ -322,7 +324,9 @@
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteByMaster">
|
<delete id="deleteByMaster">
|
||||||
DELETE FROM order_detail WHERE order_master_id = #{masterId}
|
DELETE
|
||||||
|
FROM order_detail
|
||||||
|
WHERE order_master_id = #{masterId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<update id="updateOrderDetail" parameterType="com.ghy.order.domain.OrderDetail">
|
<update id="updateOrderDetail" parameterType="com.ghy.order.domain.OrderDetail">
|
||||||
|
|
@ -358,13 +362,13 @@
|
||||||
<update id="updateStatus">
|
<update id="updateStatus">
|
||||||
UPDATE order_detail
|
UPDATE order_detail
|
||||||
SET order_status = #{orderStatus},
|
SET order_status = #{orderStatus},
|
||||||
update_time = SYSDATE()
|
update_time = SYSDATE()
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateTimeout">
|
<update id="updateTimeout">
|
||||||
UPDATE order_detail
|
UPDATE order_detail
|
||||||
SET timeout_ = #{timeout},
|
SET timeout_ = #{timeout},
|
||||||
timeout_fine_times = #{timeoutFineTimes}
|
timeout_fine_times = #{timeoutFineTimes}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -379,16 +383,14 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="statusCount" resultType="com.ghy.order.domain.OrderStatusCount">
|
<select id="statusCount" resultType="com.ghy.order.domain.OrderStatusCount">
|
||||||
SELECT
|
SELECT `order_status` AS `orderStatus`,
|
||||||
`order_status` AS `orderStatus`,
|
COUNT(*) AS `count`
|
||||||
COUNT( * ) AS `count`
|
FROM `order_detail`
|
||||||
FROM
|
GROUP BY order_status
|
||||||
`order_detail`
|
|
||||||
GROUP BY
|
|
||||||
order_status
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertOrderDetail" parameterType="com.ghy.order.domain.OrderDetail" useGeneratedKeys="true"
|
||||||
|
keyProperty="id">
|
||||||
INSERT INTO order_detail(
|
INSERT INTO order_detail(
|
||||||
<if test="code != null and code != ''">code,</if>
|
<if test="code != null and code != ''">code,</if>
|
||||||
<if test="orderMasterId != null and orderMasterId != 0">order_master_id,</if>
|
<if test="orderMasterId != null and orderMasterId != 0">order_master_id,</if>
|
||||||
|
|
@ -430,7 +432,7 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getByOrderIdList" resultMap="OrderDetailResult">
|
<select id="getByOrderIdList" resultMap="OrderDetailResult">
|
||||||
<include refid="selectOrderDetail" />
|
<include refid="selectOrderDetail"/>
|
||||||
<where>
|
<where>
|
||||||
and order_master_id in
|
and order_master_id in
|
||||||
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
<foreach item="item" index="orderIdList" collection="orderIdList" open="(" separator="," close=")">
|
||||||
|
|
@ -457,7 +459,8 @@
|
||||||
WHERE draw_cash_id = #{drawCashId}
|
WHERE draw_cash_id = #{drawCashId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="differentStatusOrderCount" resultType="com.ghy.order.domain.OrderDetailCount" parameterType="com.ghy.order.domain.OrderDetail">
|
<select id="differentStatusOrderCount" resultType="com.ghy.order.domain.OrderDetailCount"
|
||||||
|
parameterType="com.ghy.order.domain.OrderDetail">
|
||||||
select
|
select
|
||||||
count(case when od.order_status = 0 then 1 else null end) as newOrderNum,
|
count(case when od.order_status = 0 then 1 else null end) as newOrderNum,
|
||||||
count(case when od.order_status = 1 then 1 else null end) as acceptedOrderNum,
|
count(case when od.order_status = 1 then 1 else null end) as acceptedOrderNum,
|
||||||
|
|
@ -466,7 +469,7 @@
|
||||||
count(case when od.order_status = 4 then 1 else null end) as confirmingOrderNum,
|
count(case when od.order_status = 4 then 1 else null end) as confirmingOrderNum,
|
||||||
count(case when od.order_status = 5 then 1 else null end) as finishedOrderNum,
|
count(case when od.order_status = 5 then 1 else null end) as finishedOrderNum,
|
||||||
count(case when od.order_status = 6 then 1 else null end) as canceledOrderNum
|
count(case when od.order_status = 6 then 1 else null end) as canceledOrderNum
|
||||||
from order_detail od left join order_master om on od.order_master_id = om.id
|
from order_detail od left join order_master om on od.order_master_id = om.id
|
||||||
where 1 = 1
|
where 1 = 1
|
||||||
<if test="timeout != null">
|
<if test="timeout != null">
|
||||||
AND od.timeout_ = #{timeout}
|
AND od.timeout_ = #{timeout}
|
||||||
|
|
@ -475,4 +478,19 @@
|
||||||
AND om.is_call = #{isCall}
|
AND om.is_call = #{isCall}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="searchByOrderStartTime" resultMap="OrderDetailResult">
|
||||||
|
select
|
||||||
|
<include refid="selectOrderDetail"/>
|
||||||
|
from
|
||||||
|
order_detail
|
||||||
|
<where>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
create_time <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
create_time <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -537,4 +537,19 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="searchByOrderStartTime" parameterType="com.ghy.order.domain.OrderMaster" resultMap="OrderMasterResult">
|
||||||
|
select
|
||||||
|
<include refid="selectOrderMaster" />
|
||||||
|
from
|
||||||
|
order_master
|
||||||
|
<where>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
create_time <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
create_time <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.ghy.system.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author 但星霖
|
||||||
|
* @Date 2023-03-23 09:45:52
|
||||||
|
* 说明:系统配置表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysGlobalConfig implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置项名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置项内容json串(界面循环显示json串的key-value)
|
||||||
|
* 系统配置json字符串/或者文本信息
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型
|
||||||
|
* 对应枚举 SysConfigEnum
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否展现给用户查询使用,此字段作用未用于给屏蔽掉查询,此字段为默认1的时候就是为系统变量不可更改。
|
||||||
|
*/
|
||||||
|
private Boolean sysDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据内容类型
|
||||||
|
* 对应系统枚举字段数据
|
||||||
|
* SysConfigDataTypeEnum
|
||||||
|
*/
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
private String unit;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.ghy.system.mapper;
|
||||||
|
|
||||||
|
import com.ghy.system.domain.SysGlobalConfig;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Date: 2023-11-08 16:12
|
||||||
|
* @Version: 1.0
|
||||||
|
* @Description: 系统配置表数据库访问层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysGlobalConfigMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据新增数据,支持数组,单数据。
|
||||||
|
*
|
||||||
|
* @param sysGlobalConfigs 系统配置数据数组
|
||||||
|
* @return 新增的数量信息
|
||||||
|
*/
|
||||||
|
Integer creates(@Param("sysGlobalConfigs") SysGlobalConfig... sysGlobalConfigs);
|
||||||
|
|
||||||
|
// 根据主键id修改
|
||||||
|
Integer updateById(@Param("sysGlobalConfig") SysGlobalConfig sysGlobalConfig);
|
||||||
|
|
||||||
|
// 根据主键id查询
|
||||||
|
SysGlobalConfig selectById(@Param("id") Long id);
|
||||||
|
|
||||||
|
// 根据主键id删除
|
||||||
|
Integer deleteById(@Param("id") Long id);
|
||||||
|
|
||||||
|
// 根据类型查询
|
||||||
|
SysGlobalConfig loadByConfigType(@Param("configType") Integer configType);
|
||||||
|
|
||||||
|
// 根据名称校验数据
|
||||||
|
SysGlobalConfig vailName(@Param("name") String name);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.ghy.system.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ghy.system.domain.SysGlobalConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Date: 2023-11-08 16:12
|
||||||
|
* @Version: 1.0
|
||||||
|
* @Description: 系统配置表业务接口层
|
||||||
|
*/
|
||||||
|
public interface ISysGlobalConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统配置项数据新增
|
||||||
|
*
|
||||||
|
* @param sysConfig 配置项数据实体
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean create(SysGlobalConfig sysConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统配置项数据修改 根据Id进行修改
|
||||||
|
*
|
||||||
|
* @param sysConfig 配置项数据实体
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean update(SysGlobalConfig sysConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统配置项数据删除 根据id进行删除
|
||||||
|
*
|
||||||
|
* @param id 系统配置项主键id
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean delete(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置项主键id进行数据查询
|
||||||
|
*
|
||||||
|
* @param id 配置主键id
|
||||||
|
* @return config配置项实体信息
|
||||||
|
*/
|
||||||
|
SysGlobalConfig loadById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置名称进行查询配置项数据
|
||||||
|
*
|
||||||
|
* @param name 配置项名称
|
||||||
|
* @param configId 配置Id
|
||||||
|
* @return 是否可用
|
||||||
|
*/
|
||||||
|
Boolean vailName(String name, Long configId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据type进行查询对应系统配置信息
|
||||||
|
*
|
||||||
|
* @param type 系统配置类型
|
||||||
|
* @return SysConfig 系统配置实体
|
||||||
|
*/
|
||||||
|
SysGlobalConfig loadByConfigType(Integer type);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package com.ghy.system.service.impl;
|
||||||
|
|
||||||
|
import com.ghy.common.exception.ServiceException;
|
||||||
|
import com.ghy.common.utils.DateUtils;
|
||||||
|
import com.ghy.common.utils.ObjectUtils;
|
||||||
|
import com.ghy.system.domain.SysGlobalConfig;
|
||||||
|
import com.ghy.system.mapper.SysGlobalConfigMapper;
|
||||||
|
import com.ghy.system.service.ISysGlobalConfigService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Date: 2024-09-21 23:36
|
||||||
|
* @Author: 但星霖
|
||||||
|
* @Version: v1.0
|
||||||
|
* @Description: 系统配置表业务接口层实现类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class SysGlobalConfigServiceImpl implements ISysGlobalConfigService {
|
||||||
|
|
||||||
|
private final SysGlobalConfigMapper mapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean create(SysGlobalConfig sysConfig) {
|
||||||
|
log.info("{}收到系统配置清数据新增,新增内容:{}", DateUtils.timeFormat(new Date()), sysConfig);
|
||||||
|
if (!vailName(sysConfig.getName(), null)) {
|
||||||
|
log.error("系统配置项:{}新增失败,系统配置项名称重复。", sysConfig.getName());
|
||||||
|
throw new ServiceException("系统配置项:" + sysConfig.getName() + "新增失败,名称重复。请检查后重新提交");
|
||||||
|
}
|
||||||
|
// 检查新增的类型
|
||||||
|
if (ObjectUtils.isNotNull(mapper.loadByConfigType(sysConfig.getType()))) {
|
||||||
|
log.error("系统配置项:{}新增失败,系统配置类型已存在。", sysConfig.getName());
|
||||||
|
throw new ServiceException("系统配置项:" + sysConfig.getName() + "新增失败,系统配置类型已存在。请检查后重新提交");
|
||||||
|
}
|
||||||
|
// 创建时间
|
||||||
|
sysConfig.setCreateTime(System.currentTimeMillis());
|
||||||
|
// 修改时间
|
||||||
|
sysConfig.setUpdateTime(System.currentTimeMillis());
|
||||||
|
mapper.creates(sysConfig);
|
||||||
|
log.info("{}新增系统配置项成功,新增内容:{}", DateUtils.timeFormat(new Date()), sysConfig);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(SysGlobalConfig sysConfig) {
|
||||||
|
log.info("{}收到系统配置清数据修改,新增内容:{}", DateUtils.timeFormat(new Date()), sysConfig);
|
||||||
|
SysGlobalConfig sysConfigByDbCrw = mapper.selectById(sysConfig.getId());
|
||||||
|
if (ObjectUtils.isNull(sysConfigByDbCrw)) {
|
||||||
|
log.error("系统配置项:{}修改失败,在当前库中未匹配到正常的配置数据。", sysConfig.getId());
|
||||||
|
throw new ServiceException("系统配置项:" + sysConfig.getId() + "修改失败,在当前库中未匹配到正常的配置数据。请检查后重新提交");
|
||||||
|
}
|
||||||
|
// 检查新增的类型
|
||||||
|
SysGlobalConfig configByTypeInDb = mapper.loadByConfigType(sysConfig.getType());
|
||||||
|
if (ObjectUtils.isNotNull(configByTypeInDb) && !Objects.equals(configByTypeInDb.getId(), sysConfig.getId())) {
|
||||||
|
log.error("系统配置项:{}修改失败,系统配置类型已存在。", sysConfig.getName());
|
||||||
|
throw new ServiceException("系统配置项:" + sysConfig.getName() + "修改失败,系统配置类型已存在。请检查后重新提交");
|
||||||
|
}
|
||||||
|
// 内容
|
||||||
|
sysConfigByDbCrw.setContent(sysConfig.getContent());
|
||||||
|
// 排序
|
||||||
|
sysConfigByDbCrw.setSort(sysConfig.getSort());
|
||||||
|
// 修改时间
|
||||||
|
sysConfigByDbCrw.setUpdateTime(System.currentTimeMillis());
|
||||||
|
mapper.updateById(sysConfigByDbCrw);
|
||||||
|
log.info("{}修改系统配置项成功,替换内容:{}", DateUtils.timeFormat(new Date()), sysConfig);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(Long id) {
|
||||||
|
log.info("{}收到系统配置删除:{}", DateUtils.timeFormat(new Date()), id);
|
||||||
|
SysGlobalConfig sysConfigByCrw = mapper.selectById(id);
|
||||||
|
if (ObjectUtils.isNull(sysConfigByCrw)) {
|
||||||
|
log.error("系统配置项:{}删除失败,在当前库中未匹配到正常的配置数据。", id);
|
||||||
|
throw new ServiceException("系统配置项:" + id + "删除失败,在当前库中未匹配到正常的配置数据。请检查后重新提交");
|
||||||
|
}
|
||||||
|
mapper.deleteById(sysConfigByCrw.getId());
|
||||||
|
log.info("{}删除系统配置项成功,删除系统配置id:{}", DateUtils.timeFormat(new Date()), id);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysGlobalConfig loadById(Long id) {
|
||||||
|
return mapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean vailName(String name, Long configId) {
|
||||||
|
SysGlobalConfig sysConfig = mapper.vailName(name);
|
||||||
|
if (ObjectUtils.isNull(sysConfig)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (ObjectUtils.isNotNull(configId)) {
|
||||||
|
return Objects.equals(configId, sysConfig.getId());
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysGlobalConfig loadByConfigType(Integer type) {
|
||||||
|
return mapper.loadByConfigType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.ghy.system.mapper.SysGlobalConfigMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ghy.system.domain.SysGlobalConfig" id="BaseResultMap">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<result column="name" property="name"/>
|
||||||
|
<result column="content" property="content"/>
|
||||||
|
<result column="sort" property="sort"/>
|
||||||
|
<result column="type" property="type"/>
|
||||||
|
<result column="sys_default" property="sysDefault"/>
|
||||||
|
<result column="describe" property="describe"/>
|
||||||
|
<result column="data_type" property="dataType"/>
|
||||||
|
<result column="unit" property="unit"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="tableName">sys_global_config</sql>
|
||||||
|
|
||||||
|
<sql id="allColumns">
|
||||||
|
`id`
|
||||||
|
, `name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `unit`,
|
||||||
|
`create_time`, `update_time`
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="creates" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
||||||
|
INSERT INTO
|
||||||
|
<include refid="tableName"/>
|
||||||
|
(`name`, `content`, `sort`, `type`,`sys_default`, `describe`, `data_type`, `unit`,
|
||||||
|
`create_time`, `update_time`)
|
||||||
|
VALUES
|
||||||
|
<foreach item="item" index="sysConfigs" collection="sysConfigs" separator=",">
|
||||||
|
(
|
||||||
|
#{item.name},
|
||||||
|
#{item.content},
|
||||||
|
#{item.sort},
|
||||||
|
#{item.type},
|
||||||
|
#{item.sysDefault},
|
||||||
|
#{item.describe},
|
||||||
|
#{item.dataType},
|
||||||
|
#{item.unit},
|
||||||
|
#{item.createTime},
|
||||||
|
#{item.updateTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateById">
|
||||||
|
<include refid="tableName"/>
|
||||||
|
<set>
|
||||||
|
`name` = #{sysGlobalConfig.name},
|
||||||
|
`content` = #{sysGlobalConfig.content},
|
||||||
|
`sort` = #{sysGlobalConfig.sort},
|
||||||
|
`type` = #{sysGlobalConfig.type},
|
||||||
|
`sys_default` = #{sysGlobalConfig.sysDefault},
|
||||||
|
`describe` = #{sysGlobalConfig.describe},
|
||||||
|
`data_type` = #{sysGlobalConfig.dataType},
|
||||||
|
`unit` = #{sysGlobalConfig.unit},
|
||||||
|
`update_time` = #{sysGlobalConfig.updateTime}
|
||||||
|
</set>
|
||||||
|
<where>
|
||||||
|
`id` = #{sysGlobalConfig.id}
|
||||||
|
</where>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectById" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="allColumns"/>
|
||||||
|
from
|
||||||
|
<include refid="tableName"/>
|
||||||
|
<where>
|
||||||
|
`id` = #{id}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="loadByConfigType" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="allColumns"/>
|
||||||
|
from
|
||||||
|
<include refid="tableName"/>
|
||||||
|
<where>
|
||||||
|
`type` = #{configType}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete from
|
||||||
|
<include refid="tableName"/>
|
||||||
|
<where>
|
||||||
|
`id` = #{id}
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="vailName" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="allColumns"/>
|
||||||
|
from
|
||||||
|
<include refid="tableName"/>
|
||||||
|
<where>
|
||||||
|
`name` = #{name} and sys_default = 0
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue