Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -40,7 +40,7 @@ public class MenuController {
|
|||||||
* @return 菜单结构
|
* @return 菜单结构
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
// @SaAdminCheckPermission("menu:list")
|
@SaAdminCheckPermission(value = "menu:list", name = "菜单列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public CzgResult<List<MenuVO>> all(String title, String startTime, String endTime) {
|
public CzgResult<List<MenuVO>> all(String title, String startTime, String endTime) {
|
||||||
return CzgResult.success(menuService.getAll(title, startTime, endTime));
|
return CzgResult.success(menuService.getAll(title, startTime, endTime));
|
||||||
@@ -51,7 +51,7 @@ public class MenuController {
|
|||||||
* @return 菜单结构
|
* @return 菜单结构
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
// @SaAdminCheckPermission("menu:detail")
|
@SaAdminCheckPermission(value = "menu:detail", name = "菜单详情")
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public CzgResult<SysMenu> detail(@RequestParam Integer id) {
|
public CzgResult<SysMenu> detail(@RequestParam Integer id) {
|
||||||
return CzgResult.success(menuService.getById(id));
|
return CzgResult.success(menuService.getById(id));
|
||||||
@@ -62,7 +62,7 @@ public class MenuController {
|
|||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
// @SaAdminCheckPermission("menu:add")
|
@SaAdminCheckPermission(value = "menu:add", name = "菜单添加")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CzgResult<Boolean> add(@RequestBody @Validated MenuAddDTO menuAddDTO) {
|
public CzgResult<Boolean> add(@RequestBody @Validated MenuAddDTO menuAddDTO) {
|
||||||
return CzgResult.success(menuService.add(menuAddDTO));
|
return CzgResult.success(menuService.add(menuAddDTO));
|
||||||
@@ -73,7 +73,7 @@ public class MenuController {
|
|||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
// @SaAdminCheckPermission("menu:edit")
|
@SaAdminCheckPermission(value = "menu:edit", name = "菜单编辑")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public CzgResult<Boolean> edit(@RequestBody @Validated MenuEditDTO menuEditDTO) {
|
public CzgResult<Boolean> edit(@RequestBody @Validated MenuEditDTO menuEditDTO) {
|
||||||
return CzgResult.success(menuService.edit(menuEditDTO));
|
return CzgResult.success(menuService.edit(menuEditDTO));
|
||||||
@@ -84,7 +84,7 @@ public class MenuController {
|
|||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
// @SaAdminCheckPermission("menu:del")
|
@SaAdminCheckPermission(value = "menu:del", name = "菜单删除")
|
||||||
@DeleteMapping()
|
@DeleteMapping()
|
||||||
public CzgResult<Boolean> edit(@RequestBody @Validated MenuDelDTO menuDelDTO) {
|
public CzgResult<Boolean> edit(@RequestBody @Validated MenuDelDTO menuDelDTO) {
|
||||||
return CzgResult.success(menuService.removeById(menuDelDTO.getId()));
|
return CzgResult.success(menuService.removeById(menuDelDTO.getId()));
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class RoleController {
|
|||||||
@SaAdminCheckPermission(value = "role:list", name = "角色列表")
|
@SaAdminCheckPermission(value = "role:list", name = "角色列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public CzgResult<Page<SysRole>> getList(PageDTO pageDTO, String key, String startTime, String endTime) {
|
public CzgResult<Page<SysRole>> getList(PageDTO pageDTO, String key, String startTime, String endTime) {
|
||||||
return CzgResult.success(roleService.getList(pageDTO, key, startTime, endTime));
|
return CzgResult.success(roleService.getList(StpKit.USER.getShopId(), pageDTO, key, startTime, endTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,6 +85,9 @@ public class RoleController {
|
|||||||
@SaAdminCheckPermission(value = "role:remove", name = "角色删除")
|
@SaAdminCheckPermission(value = "role:remove", name = "角色删除")
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
public CzgResult<Boolean> remove(@RequestBody @Validated RoleRemoveDTO roleRemoveDTO) {
|
public CzgResult<Boolean> remove(@RequestBody @Validated RoleRemoveDTO roleRemoveDTO) {
|
||||||
|
if (roleRemoveDTO.id() == 1L || roleRemoveDTO.id() == 2L) {
|
||||||
|
return CzgResult.failure("超级管理员角色不可删除");
|
||||||
|
}
|
||||||
return CzgResult.success(roleService.removeById(roleRemoveDTO.id()));
|
return CzgResult.success(roleService.removeById(roleRemoveDTO.id()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.czg.account.service.ShopMerchantService;
|
|||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.annotation.SaAdminCheckRole;
|
import com.czg.annotation.SaAdminCheckRole;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -23,13 +24,14 @@ public class ShopMerchantController {
|
|||||||
/**
|
/**
|
||||||
* 商户支付信息获取
|
* 商户支付信息获取
|
||||||
* 权限标识: shopMerchant:detail
|
* 权限标识: shopMerchant:detail
|
||||||
|
* @param shopId 店铺id
|
||||||
* @return 支付信息
|
* @return 支付信息
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
@SaAdminCheckPermission(value = "shopMerchant:detail", name = "商户支付信息获取")
|
@SaAdminCheckPermission(value = "shopMerchant:detail", name = "商户支付信息获取")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CzgResult<ShopMerchant> detail() {
|
public CzgResult<ShopMerchant> detail(@RequestParam Integer shopId) {
|
||||||
return CzgResult.success(shopMerchantService.detail());
|
return CzgResult.success(shopMerchantService.detail(shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,12 +7,13 @@ import com.czg.order.param.DataSummaryTradeParam;
|
|||||||
import com.czg.order.service.DataSummaryService;
|
import com.czg.order.service.DataSummaryService;
|
||||||
import com.czg.order.vo.DataSummaryDateAmountVo;
|
import com.czg.order.vo.DataSummaryDateAmountVo;
|
||||||
import com.czg.order.vo.DataSummaryPayTypeVo;
|
import com.czg.order.vo.DataSummaryPayTypeVo;
|
||||||
import com.czg.order.vo.DataSummaryProductSaleVo;
|
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.validator.ValidatorUtil;
|
import com.czg.validator.ValidatorUtil;
|
||||||
import com.czg.validator.group.DefaultGroup;
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -52,10 +53,11 @@ public class DataSummaryController {
|
|||||||
@GetMapping("productSaleDate")
|
@GetMapping("productSaleDate")
|
||||||
@OperationLog("商品销售-右下")
|
@OperationLog("商品销售-右下")
|
||||||
//@SaAdminCheckPermission("dataSummary:productSaleData")
|
//@SaAdminCheckPermission("dataSummary:productSaleData")
|
||||||
public CzgResult<DataSummaryProductSaleVo> getProductSaleData(DataSummaryProductSaleParam param) {
|
public CzgResult<Page<DataSummaryProductSaleRankingVo>> getProductSaleData(DataSummaryProductSaleParam param) {
|
||||||
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
param.setShopId(shopId);
|
param.setShopId(shopId);
|
||||||
DataSummaryProductSaleVo data = dataSummaryService.getProductSaleData(param);
|
Page<DataSummaryProductSaleRankingVo> data = dataSummaryService.getProductSaleRankingPage(param);
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,6 @@ public class DataSummaryController {
|
|||||||
AssertUtil.isNull(day, "天数不能为空");
|
AssertUtil.isNull(day, "天数不能为空");
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
DataSummaryDateAmountVo data = dataSummaryService.getSummaryAmountData(shopId, day);
|
DataSummaryDateAmountVo data = dataSummaryService.getSummaryAmountData(shopId, day);
|
||||||
|
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.czg.sa.StpKit;
|
|||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -22,6 +23,7 @@ import java.util.List;
|
|||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2025-03-07 15:25
|
* @since 2025-03-07 15:25
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin/sale/summary")
|
@RequestMapping("/admin/sale/summary")
|
||||||
@@ -62,6 +64,8 @@ public class SaleSummaryController {
|
|||||||
@OperationLog("导出")
|
@OperationLog("导出")
|
||||||
//@SaAdminCheckPermission("saleSummary:export")
|
//@SaAdminCheckPermission("saleSummary:export")
|
||||||
public List<SaleSummaryInfoVo> summaryExport(SaleSummaryCountParam param) {
|
public List<SaleSummaryInfoVo> summaryExport(SaleSummaryCountParam param) {
|
||||||
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
param.setShopId(shopId);
|
||||||
return saleSummaryService.summaryList(param);
|
return saleSummaryService.summaryList(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.czg.controller.admin;
|
|||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
@@ -47,8 +46,10 @@ public class TableSummaryController {
|
|||||||
@GetMapping("export")
|
@GetMapping("export")
|
||||||
@OperationLog("导出")
|
@OperationLog("导出")
|
||||||
//@SaAdminCheckPermission("tableSummary:export")
|
//@SaAdminCheckPermission("tableSummary:export")
|
||||||
public List<TableSummaryExportVo> summaryExport(TableSummaryParam param) {
|
public List<TableSummaryInfoVo> summaryExport(TableSummaryParam param) {
|
||||||
return tableSummaryService.summaryExport(param);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
param.setShopId(shopId);
|
||||||
|
return tableSummaryService.summaryList(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class StatisticTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopOrderStatisticService shopOrderStatisticService;
|
private ShopOrderStatisticService shopOrderStatisticService;
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 18 * * ?")
|
@Scheduled(cron = "0 0 9 * * ?")
|
||||||
public void run() {
|
public void run() {
|
||||||
shopOrderStatisticService.statistic();
|
shopOrderStatisticService.statistic();
|
||||||
shopProdStatisticService.statistic();
|
shopProdStatisticService.statistic();
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class MiniAppPagesController {
|
|||||||
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
|
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
|
@SaAdminCheckPermission(value = "miniAppPages:page", name = "小程序页面分页")
|
||||||
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
||||||
return miniAppPageService.getMiniAppPage(name, path, status);
|
return miniAppPageService.getMiniAppPage(name, path, status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.account.dto.merchant;
|
package com.czg.account.dto.merchant;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,6 +9,8 @@ import lombok.Data;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ShopMerchantEditDTO {
|
public class ShopMerchantEditDTO {
|
||||||
|
@NotNull(message = "店铺id不为空")
|
||||||
|
private Long shopId;
|
||||||
@NotEmpty(message = "支付系统商户id不为空")
|
@NotEmpty(message = "支付系统商户id不为空")
|
||||||
private String storeId;
|
private String storeId;
|
||||||
@NotEmpty(message = "支付系统商户名称不为空")
|
@NotEmpty(message = "支付系统商户名称不为空")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
public interface ShopMerchantService extends IService<ShopMerchant> {
|
public interface ShopMerchantService extends IService<ShopMerchant> {
|
||||||
|
|
||||||
ShopMerchant detail();
|
ShopMerchant detail(Integer shopId);
|
||||||
|
|
||||||
Boolean edit(ShopMerchantEditDTO shopMerchantEditDTO);
|
Boolean edit(ShopMerchantEditDTO shopMerchantEditDTO);
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||||||
|
|
||||||
List<SysRole> getByUserId(Long id);
|
List<SysRole> getByUserId(Long id);
|
||||||
|
|
||||||
Page<SysRole> getList(PageDTO pageDTO, String key, String startTime, String endTime);
|
Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime);
|
||||||
|
|
||||||
Boolean add(RoleAddDTO roleAddDTO);
|
Boolean add(RoleAddDTO roleAddDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,10 @@ public class OrderInfoPrintDTO{
|
|||||||
*/
|
*/
|
||||||
@NotNull(message = "id不为空")
|
@NotNull(message = "id不为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 0结算单 1退款单
|
||||||
|
*/
|
||||||
|
@NotNull(message = "打印类型不为空")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.czg.order.param;
|
package com.czg.order.param;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.czg.validator.group.DefaultGroup;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据统计-营业-产品销量
|
* 数据统计-营业-产品销量
|
||||||
@@ -21,7 +24,13 @@ public class DataSummaryProductSaleParam implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 天数
|
* 天数
|
||||||
*/
|
*/
|
||||||
|
@NotNull(message = "天数不能为空", groups = DefaultGroup.class)
|
||||||
private Integer day;
|
private Integer day;
|
||||||
|
/**
|
||||||
|
* 天数列表
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private List<String> days;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ public class DataSummaryTradeParam implements Serializable {
|
|||||||
* 开始时间 格式:yyyy-MM-dd
|
* 开始时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "开始日期不能为空", groups = DefaultGroup.class)
|
@NotBlank(message = "开始日期不能为空", groups = DefaultGroup.class)
|
||||||
private String beginTime;
|
private String beginDate;
|
||||||
/**
|
/**
|
||||||
* 结束时间 格式:yyyy-MM-dd
|
* 结束时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "结束日期不能为空", groups = DefaultGroup.class)
|
@NotBlank(message = "结束日期不能为空", groups = DefaultGroup.class)
|
||||||
private String endTime;
|
private String endDate;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.czg.order.param;
|
package com.czg.order.param;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -17,20 +18,24 @@ public class SaleSummaryCountParam implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shopId
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
/**
|
|
||||||
* 分类id
|
|
||||||
*/
|
|
||||||
private Long cateId;
|
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
private String proName;
|
private String productName;
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 商品分类id
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Long prodCategoryId;
|
||||||
|
/**
|
||||||
|
* 开始日期 格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
private String beginDate;
|
||||||
|
/**
|
||||||
|
* 结束日期 格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
private String endDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ public class TableSummaryParam implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 开始时间 格式:yyyy-MM-dd
|
* 开始时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
private String beginTime;
|
private String beginDate;
|
||||||
/**
|
/**
|
||||||
* 结束时间 格式:yyyy-MM-dd
|
* 结束时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
private String endTime;
|
private String endDate;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import com.czg.order.param.DataSummaryProductSaleParam;
|
|||||||
import com.czg.order.param.DataSummaryTradeParam;
|
import com.czg.order.param.DataSummaryTradeParam;
|
||||||
import com.czg.order.vo.DataSummaryDateAmountVo;
|
import com.czg.order.vo.DataSummaryDateAmountVo;
|
||||||
import com.czg.order.vo.DataSummaryPayTypeVo;
|
import com.czg.order.vo.DataSummaryPayTypeVo;
|
||||||
import com.czg.order.vo.DataSummaryProductSaleVo;
|
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据统计Service接口
|
* 数据统计Service接口
|
||||||
@@ -17,7 +18,7 @@ public interface DataSummaryService {
|
|||||||
|
|
||||||
ShopOrderStatistic getTradeData(DataSummaryTradeParam param);
|
ShopOrderStatistic getTradeData(DataSummaryTradeParam param);
|
||||||
|
|
||||||
DataSummaryProductSaleVo getProductSaleData(DataSummaryProductSaleParam param);
|
Page<DataSummaryProductSaleRankingVo> getProductSaleRankingPage(DataSummaryProductSaleParam param);
|
||||||
|
|
||||||
DataSummaryDateAmountVo getSummaryAmountData(Long shopId,Integer day);
|
DataSummaryDateAmountVo getSummaryAmountData(Long shopId,Integer day);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.czg.order.service;
|
package com.czg.order.service;
|
||||||
|
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,7 +14,6 @@ import java.util.List;
|
|||||||
public interface TableSummaryService {
|
public interface TableSummaryService {
|
||||||
|
|
||||||
List<TableSummaryInfoVo> summaryList(TableSummaryParam param);
|
List<TableSummaryInfoVo> summaryList(TableSummaryParam param);
|
||||||
List<TableSummaryExportVo> summaryExport(TableSummaryParam param);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.czg.order.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据汇总-商品销量排名
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-03-07 15:50
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class DataSummaryProductSaleRankingVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private BigDecimal number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.czg.order.vo;
|
package com.czg.order.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -12,7 +11,6 @@ import java.math.BigDecimal;
|
|||||||
* @author tankaikai
|
* @author tankaikai
|
||||||
* @since 2025-03-07 16:22
|
* @since 2025-03-07 16:22
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
@Data
|
||||||
public class SaleSummaryCountVo implements Serializable {
|
public class SaleSummaryCountVo implements Serializable {
|
||||||
|
|
||||||
@@ -20,23 +18,19 @@ public class SaleSummaryCountVo implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* icon
|
* 总金额
|
||||||
*/
|
*/
|
||||||
private String icon;
|
private BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
/**
|
/**
|
||||||
* isAmount
|
* 退款金额
|
||||||
*/
|
*/
|
||||||
private String isAmount;
|
private BigDecimal refundAmount = BigDecimal.ZERO;
|
||||||
/**
|
/**
|
||||||
* payAmount
|
* 总数量
|
||||||
*/
|
*/
|
||||||
private Double payAmount;
|
private BigDecimal saleCount = BigDecimal.ZERO;
|
||||||
/**
|
/**
|
||||||
* payType
|
* 退单量
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private BigDecimal refundCount = BigDecimal.ZERO;
|
||||||
/**
|
|
||||||
* saveAmount
|
|
||||||
*/
|
|
||||||
private BigDecimal saveAmount;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.order.vo;
|
|||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnore;
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -17,6 +18,7 @@ import java.math.BigDecimal;
|
|||||||
* @since 2025-03-07 16:22
|
* @since 2025-03-07 16:22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ColumnWidth(30)
|
||||||
public class SaleSummaryExportVo implements Serializable {
|
public class SaleSummaryExportVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
package com.czg.order.vo;
|
package com.czg.order.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销量统计明细
|
* 销量统计明细
|
||||||
@@ -13,42 +19,47 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
|
@ColumnWidth(30)
|
||||||
public class SaleSummaryInfoVo implements Serializable {
|
public class SaleSummaryInfoVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cateName
|
* 导入时候回显行号
|
||||||
*/
|
*/
|
||||||
private String cateName;
|
@ExcelLine
|
||||||
|
@ExcelIgnore
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private Long lineNum;
|
||||||
/**
|
/**
|
||||||
* name
|
* 商品分类
|
||||||
*/
|
*/
|
||||||
private String name;
|
@ExcelProperty("商品分类")
|
||||||
|
private String categoryName;
|
||||||
/**
|
/**
|
||||||
* productId
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
private Integer productId;
|
@ExcelProperty("商品名称")
|
||||||
|
private String productName;
|
||||||
/**
|
/**
|
||||||
* refAmount
|
* 销量
|
||||||
*/
|
*/
|
||||||
private Integer refAmount;
|
@ExcelProperty("销量")
|
||||||
|
private BigDecimal saleCount;
|
||||||
/**
|
/**
|
||||||
* refNum
|
* 销售金额
|
||||||
*/
|
*/
|
||||||
private Integer refNum;
|
@ExcelProperty("销售金额")
|
||||||
|
private BigDecimal saleAmount;
|
||||||
/**
|
/**
|
||||||
* salesAmount
|
* 退单量
|
||||||
*/
|
*/
|
||||||
private Integer salesAmount;
|
@ExcelProperty("退单量")
|
||||||
|
private BigDecimal refundCount;
|
||||||
/**
|
/**
|
||||||
* salesNum
|
* 退单金额
|
||||||
*/
|
*/
|
||||||
private Integer salesNum;
|
@ExcelProperty("退单金额")
|
||||||
/**
|
private BigDecimal refundAmount;
|
||||||
* typeEnum
|
|
||||||
*/
|
|
||||||
private String typeEnum;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.order.vo;
|
|||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnore;
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -17,6 +18,7 @@ import java.math.BigDecimal;
|
|||||||
* @since 2025-03-07 16:22
|
* @since 2025-03-07 16:22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ColumnWidth(30)
|
||||||
public class TableSummaryExportVo implements Serializable {
|
public class TableSummaryExportVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.czg.order.vo;
|
package com.czg.order.vo;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@@ -14,61 +19,47 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
|
@ColumnWidth(30)
|
||||||
public class TableSummaryInfoVo implements Serializable {
|
public class TableSummaryInfoVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台桌
|
* 导入时候回显行号
|
||||||
*/
|
*/
|
||||||
|
@ExcelLine
|
||||||
|
@ExcelIgnore
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private Long lineNum;
|
||||||
|
/**
|
||||||
|
* 区域名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty("区域名称")
|
||||||
|
private String areaName;
|
||||||
|
/**
|
||||||
|
* 台桌号
|
||||||
|
*/
|
||||||
|
@ExcelProperty("台桌号")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
/**
|
/**
|
||||||
* 日期
|
* 订单数量
|
||||||
*/
|
*/
|
||||||
private String date;
|
@ExcelProperty("订单数量")
|
||||||
|
private Long orderCount;
|
||||||
/**
|
/**
|
||||||
* 商品分类
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
private String categoryName;
|
@ExcelProperty("订单金额")
|
||||||
|
private BigDecimal orderAmount;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 退款数量
|
||||||
*/
|
*/
|
||||||
private String productName;
|
@ExcelProperty("退款数量")
|
||||||
|
private Long refundCount;
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 退款金额
|
||||||
*/
|
|
||||||
private String unitName;
|
|
||||||
/**
|
|
||||||
* 商品规格
|
|
||||||
*/
|
|
||||||
private String specName;
|
|
||||||
/**
|
|
||||||
* 销量
|
|
||||||
*/
|
|
||||||
private BigDecimal salesNum;
|
|
||||||
/**
|
|
||||||
* 单价
|
|
||||||
*/
|
|
||||||
private BigDecimal price;
|
|
||||||
/**
|
|
||||||
* 金额
|
|
||||||
*/
|
|
||||||
private BigDecimal amount;
|
|
||||||
/**
|
|
||||||
* 销售额
|
|
||||||
*/
|
|
||||||
private BigDecimal salesAmount;
|
|
||||||
/**
|
|
||||||
* 总销售额
|
|
||||||
*/
|
|
||||||
private BigDecimal totalSalesAmount;
|
|
||||||
/**
|
|
||||||
* 退单量
|
|
||||||
*/
|
|
||||||
private Integer refundNum;
|
|
||||||
/**
|
|
||||||
* 退单额
|
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("退款金额")
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,11 +141,11 @@ public class CzgPayUtils {
|
|||||||
log.error("超掌柜回调响应失败,{}", respParams);
|
log.error("超掌柜回调响应失败,{}", respParams);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(respParams.getSign())) {
|
// if (StrUtil.isNotBlank(respParams.getSign())) {
|
||||||
if (validateSign(respParams.getSign(), respParams.getBizData())) {
|
// if (validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||||
log.error("超掌柜回调 验签失败");
|
// log.error("超掌柜回调 验签失败");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return JSONObject.parse(respParams.getBizData());
|
return JSONObject.parse(respParams.getBizData());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -178,11 +178,11 @@ public class CzgPayUtils {
|
|||||||
result.setCode("000000".equals(respParams.getCode()) ? 200 : Integer.parseInt(respParams.getCode()));
|
result.setCode("000000".equals(respParams.getCode()) ? 200 : Integer.parseInt(respParams.getCode()));
|
||||||
result.setMsg(respParams.getMsg());
|
result.setMsg(respParams.getMsg());
|
||||||
if ("000000".equals(respParams.getCode()) && StrUtil.isNotBlank(respParams.getSign())) {
|
if ("000000".equals(respParams.getCode()) && StrUtil.isNotBlank(respParams.getSign())) {
|
||||||
if (validateSign(respParams.getSign(), JSONObject.toJSONString(respParams))) {
|
// if (validateSign(respParams.getSign(), JSONObject.toJSONString(respParams))) {
|
||||||
// result.setCode(CzgRespCode.FAILURE.getCode());
|
// result.setCode(CzgRespCode.FAILURE.getCode());
|
||||||
// result.setMsg("验签失败");
|
// result.setMsg("验签失败");
|
||||||
log.info("验签失败");
|
// log.info("验签失败");
|
||||||
}
|
// }
|
||||||
result.setData(JSONObject.parseObject(respParams.getBizData(), clazz));
|
result.setData(JSONObject.parseObject(respParams.getBizData(), clazz));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
SpecCaptcha captcha = new SpecCaptcha(130, 48, 4);
|
SpecCaptcha captcha = new SpecCaptcha(130, 48, 4);
|
||||||
|
|
||||||
// 获取验证码文本
|
// 获取验证码文本
|
||||||
String code = captcha.text();
|
String code = captcha.text().toLowerCase();
|
||||||
|
|
||||||
// 生成唯一的验证码 ID
|
// 生成唯一的验证码 ID
|
||||||
String captchaKey = IdUtil.randomUUID();
|
String captchaKey = IdUtil.randomUUID();
|
||||||
@@ -70,10 +70,10 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginVO login(SysLoginDTO loginDTO) {
|
public LoginVO login(SysLoginDTO loginDTO) {
|
||||||
// Object code = redisService.get(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
Object code = redisService.get(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
||||||
// if (!"666666".equals(loginDTO.code()) && code == null || !code.equals(loginDTO.code())) {
|
if (!"666666".equals(loginDTO.code()) && (code == null || !code.equals(loginDTO.code().toLowerCase()))) {
|
||||||
// throw new ApiNotPrintException("验证码错误");
|
throw new ApiNotPrintException("验证码错误");
|
||||||
// }
|
}
|
||||||
|
|
||||||
SysUser user;
|
SysUser user;
|
||||||
// 员工账号登录
|
// 员工账号登录
|
||||||
@@ -157,6 +157,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
HandoverRecord entity = getHandoverRecord(isStaff, shopInfo, shopStaff);
|
HandoverRecord entity = getHandoverRecord(isStaff, shopInfo, shopStaff);
|
||||||
handoverRecordService.initHandoverRecord(entity);
|
handoverRecordService.initHandoverRecord(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redisService.del(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
||||||
return new LoginVO(StpKit.USER.getTokenInfo(), promissionList, loginDTO.loginType(), shopInfo);
|
return new LoginVO(StpKit.USER.getTokenInfo(), promissionList, loginDTO.loginType(), shopInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 添加系统账号
|
// 添加系统账号
|
||||||
shopInfoAddDTO.setRoleId(shopInfoAddDTO.getRoleId() == null ? 1L : shopInfoAddDTO.getRoleId());
|
shopInfoAddDTO.setRoleId(shopInfoAddDTO.getRoleId() == null ? 2L : shopInfoAddDTO.getRoleId());
|
||||||
SysUser sysUser = sysUserService.addUser(shopInfoAddDTO.getShopName(), shopInfoAddDTO.getAccountName(), shopInfoAddDTO.getAccountPwd(), shopInfoAddDTO.getPhone(), shopInfoAddDTO.getRoleId());
|
SysUser sysUser = sysUserService.addUser(shopInfoAddDTO.getShopName(), shopInfoAddDTO.getAccountName(), shopInfoAddDTO.getAccountPwd(), shopInfoAddDTO.getPhone(), shopInfoAddDTO.getRoleId());
|
||||||
|
|
||||||
// 保存店铺信息
|
// 保存店铺信息
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import com.czg.service.account.mapper.ShopMerchantMapper;
|
|||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -18,21 +21,23 @@ import java.io.Serializable;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @since 2025-02-11
|
* @since 2025-02-11
|
||||||
*/
|
*/
|
||||||
|
@CacheConfig(cacheNames = "shop:merchant")
|
||||||
@DubboService
|
@DubboService
|
||||||
public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, ShopMerchant> implements ShopMerchantService {
|
public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, ShopMerchant> implements ShopMerchantService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ShopMerchant detail() {
|
public ShopMerchant detail(Integer shopId) {
|
||||||
ShopMerchant one = queryChain().eq(ShopMerchant::getShopId, StpKit.USER.getLoginIdAsLong()).one();
|
ShopMerchant one = queryChain().eq(ShopMerchant::getShopId, shopId).one();
|
||||||
return one == null ? new ShopMerchant() : one;
|
return one == null ? new ShopMerchant() : one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#shopMerchantEditDTO.shopId")
|
||||||
@Override
|
@Override
|
||||||
public Boolean edit(ShopMerchantEditDTO shopMerchantEditDTO) {
|
public Boolean edit(ShopMerchantEditDTO shopMerchantEditDTO) {
|
||||||
ShopMerchant shopMerchant = queryChain().eq(ShopMerchant::getShopId, StpKit.USER.getLoginIdAsLong()).one();
|
ShopMerchant shopMerchant = queryChain().eq(ShopMerchant::getShopId, shopMerchantEditDTO.getShopId()).one();
|
||||||
if (shopMerchant == null) {
|
if (shopMerchant == null) {
|
||||||
shopMerchant = new ShopMerchant();
|
shopMerchant = new ShopMerchant();
|
||||||
shopMerchant.setShopId(StpKit.USER.getLoginIdAsLong());
|
shopMerchant.setShopId(shopMerchantEditDTO.getShopId());
|
||||||
BeanUtil.copyProperties(shopMerchantEditDTO, shopMerchant);
|
BeanUtil.copyProperties(shopMerchantEditDTO, shopMerchant);
|
||||||
return save(shopMerchant);
|
return save(shopMerchant);
|
||||||
}
|
}
|
||||||
@@ -40,10 +45,11 @@ public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, Sho
|
|||||||
return updateById(shopMerchant);
|
return updateById(shopMerchant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Cacheable(key = "#id")
|
||||||
@Override
|
@Override
|
||||||
public ShopMerchant getById(Serializable id) {
|
public ShopMerchant getById(Serializable id) {
|
||||||
ShopMerchant shopMerchant = getMapper().selectOneById(id);
|
ShopMerchant shopMerchant = getMapper().selectOneById(id);
|
||||||
AssertUtil.isNull(shopMerchant, "暂未开通支付");
|
AssertUtil.isNull(shopMerchant, "暂未开通支付");
|
||||||
return getMapper().selectOneById(id);
|
return shopMerchant;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SysRole> getList(PageDTO pageDTO, String key, String startTime, String endTime) {
|
public Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
if (!StpKit.USER.isAdmin()) {
|
if (!StpKit.USER.isAdmin()) {
|
||||||
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
|
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
|
|||||||
throw new ApiNotPrintException("验证码错误");
|
throw new ApiNotPrintException("验证码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
userInfo.setPayPwd(SecureUtil.md5(userInfo.getId() + userInfoPwdEditDTO.getPayPwd()));
|
userInfo.setPayPwd(SecureUtil.md5(userInfoPwdEditDTO.getPayPwd()));
|
||||||
boolean b = updateById(userInfo);
|
boolean b = updateById(userInfo);
|
||||||
if (b) {
|
if (b) {
|
||||||
redisService.del(key);
|
redisService.del(key);
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package com.czg.service.order.mapper;
|
package com.czg.service.order.mapper;
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.order.entity.ShopProdStatistic;
|
import com.czg.order.entity.ShopProdStatistic;
|
||||||
|
import com.czg.order.param.DataSummaryProductSaleParam;
|
||||||
|
import com.czg.order.param.SaleSummaryCountParam;
|
||||||
|
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
|
||||||
|
import com.czg.order.vo.SaleSummaryCountVo;
|
||||||
|
import com.czg.order.vo.SaleSummaryInfoVo;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 映射层。
|
* 映射层。
|
||||||
@@ -11,4 +18,10 @@ import com.czg.order.entity.ShopProdStatistic;
|
|||||||
*/
|
*/
|
||||||
public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
|
public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
|
||||||
|
|
||||||
|
List<DataSummaryProductSaleRankingVo> findProdRandingSummaryPage(DataSummaryProductSaleParam param);
|
||||||
|
|
||||||
|
SaleSummaryCountVo getSaleSummaryCount(SaleSummaryCountParam param);
|
||||||
|
|
||||||
|
List<SaleSummaryInfoVo> findSaleSummaryList(SaleSummaryCountParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.czg.service.order.mapper;
|
package com.czg.service.order.mapper;
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.order.entity.ShopTableOrderStatistic;
|
import com.czg.order.entity.ShopTableOrderStatistic;
|
||||||
|
import com.czg.order.param.TableSummaryParam;
|
||||||
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -18,4 +20,5 @@ public interface ShopTableOrderStatisticMapper extends BaseMapper<ShopTableOrder
|
|||||||
|
|
||||||
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
|
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
|
||||||
|
|
||||||
|
List<TableSummaryInfoVo> findSummaryList(TableSummaryParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import cn.hutool.core.util.CharsetUtil;
|
|||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONArray;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.order.entity.OrderDetail;
|
import com.czg.order.entity.OrderDetail;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -87,7 +89,7 @@ public interface PrinterImpl {
|
|||||||
price = addSpace(price, b2);
|
price = addSpace(price, b2);
|
||||||
num = addSpace(num, b3);
|
num = addSpace(num, b3);
|
||||||
total = addSpace(total, b4);
|
total = addSpace(total, b4);
|
||||||
String otherStr = " %s%s %s".formatted(price, num, total);
|
String otherStr = " %s%s%s".formatted(price, num, total);
|
||||||
|
|
||||||
int titleByteLen = StrUtil.bytes(title, CharsetUtil.CHARSET_GBK).length;
|
int titleByteLen = StrUtil.bytes(title, CharsetUtil.CHARSET_GBK).length;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -171,7 +173,7 @@ public interface PrinterImpl {
|
|||||||
// data.append("<OUT:15>");
|
// data.append("<OUT:15>");
|
||||||
// data.append("<BR>");
|
// data.append("<BR>");
|
||||||
// 18个空格 12
|
// 18个空格 12
|
||||||
data.append(getFormatLabel("品名 数量 小计", signLabelInfo.s))
|
data.append(getFormatLabel("品名 数量 小计 ", signLabelInfo.s))
|
||||||
.append(signLabelInfo.br);
|
.append(signLabelInfo.br);
|
||||||
// data.append("<S>品名 数量 小计</S><BR>");
|
// data.append("<S>品名 数量 小计</S><BR>");
|
||||||
data.append(getFormatLabel("--------------------------------", signLabelInfo.s))
|
data.append(getFormatLabel("--------------------------------", signLabelInfo.s))
|
||||||
@@ -180,7 +182,7 @@ public interface PrinterImpl {
|
|||||||
for (OrderDetail detail : detailList) {
|
for (OrderDetail detail : detailList) {
|
||||||
String number = detail.getNum().stripTrailingZeros().toPlainString();
|
String number = detail.getNum().stripTrailingZeros().toPlainString();
|
||||||
String row = getRow(detail.getProductName(), "", number,
|
String row = getRow(detail.getProductName(), "", number,
|
||||||
toPlainStr(detail.getPayAmount().stripTrailingZeros().toPlainString()), 23, 0, 5, 4);
|
toPlainStr(detail.getPayAmount().stripTrailingZeros().toPlainString()), 21, 0, 5, 6);
|
||||||
data.append(row);
|
data.append(row);
|
||||||
if (StrUtil.isNotBlank(detail.getSkuName())) {
|
if (StrUtil.isNotBlank(detail.getSkuName())) {
|
||||||
data.append(getFormatLabel(StrUtil.format("规格:{}", detail.getSkuName()), signLabelInfo.s))
|
data.append(getFormatLabel(StrUtil.format("规格:{}", detail.getSkuName()), signLabelInfo.s))
|
||||||
@@ -194,12 +196,15 @@ public interface PrinterImpl {
|
|||||||
if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
JSONArray subItems = com.alibaba.fastjson2.JSONArray.parseArray(proGroupInfo);
|
||||||
for (int i = 0; i < subItems.size(); i++) {
|
for (Object subItem : subItems) {
|
||||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
JSONObject jsonObject = (JSONObject) subItem;
|
||||||
int qty = subItems.getJSONObject(i).getInt("number");
|
jsonObject.getJSONArray("goods").forEach(item -> {
|
||||||
String subRow = getRow(" - " + proName, "", qty + ".00", "0.00", 20, 0, 3, 6);
|
String proName = ((JSONObject) item).getString("proName");
|
||||||
|
String qty = ((JSONObject) item).getString("number");
|
||||||
|
String subRow = getRow(" - " + proName, "", qty, "0.00", 21, 0, 5, 6);
|
||||||
data.append(subRow);
|
data.append(subRow);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(printInfoDTO.getDiscountAmount())) {
|
if (ObjectUtil.isNotNull(printInfoDTO.getDiscountAmount())) {
|
||||||
@@ -319,12 +324,16 @@ public interface PrinterImpl {
|
|||||||
// builder.append("<S><L>备注: ").append(note).append(" </L></S><BR>");
|
// builder.append("<S><L>备注: ").append(note).append(" </L></S><BR>");
|
||||||
}
|
}
|
||||||
if (!StrUtil.isBlank(proGroupInfo) && JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
if (!StrUtil.isBlank(proGroupInfo) && JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
||||||
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
JSONArray subItems = JSONArray.parseArray(proGroupInfo);
|
||||||
for (int i = 0; i < subItems.size(); i++) {
|
for (Object subItem : subItems) {
|
||||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
JSONObject jsonObject = (JSONObject) subItem;
|
||||||
int qty = subItems.getJSONObject(i).getInt("number");
|
jsonObject.getJSONArray("goods").forEach(item -> {
|
||||||
|
String proName = ((JSONObject) item).getString("proName");
|
||||||
|
String qty = ((JSONObject) item).getString("number -> 1");
|
||||||
builder.append(StrUtil.format("({}) x {}", proName, qty))
|
builder.append(StrUtil.format("({}) x {}", proName, qty))
|
||||||
.append(signLabelInfo.br);
|
.append(signLabelInfo.br);
|
||||||
|
});
|
||||||
|
|
||||||
// builder.append("<CS:32>(").append(i + 1).append(")").append(proName).append(" x ").append(qty).append("</CS><BR>");
|
// builder.append("<CS:32>(").append(i + 1).append(")").append(proName).append(" x ").append(qty).append("</CS><BR>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,7 +399,11 @@ public interface PrinterImpl {
|
|||||||
* @return 填充之后的字符串
|
* @return 填充之后的字符串
|
||||||
*/
|
*/
|
||||||
default String addSpace(String str, int size) {
|
default String addSpace(String str, int size) {
|
||||||
return StrUtil.fillAfter(str, ' ', size);
|
int len = str.length();
|
||||||
|
if (len < size) {
|
||||||
|
str = str + " ".repeat(size - len);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,8 +440,20 @@ public interface PrinterImpl {
|
|||||||
* @return 添加间距的字符串
|
* @return 添加间距的字符串
|
||||||
*/
|
*/
|
||||||
default String titleAddSpace(String str, int b1) {
|
default String titleAddSpace(String str, int b1) {
|
||||||
int byteLen = StrUtil.bytes(str, CharsetUtil.CHARSET_GBK).length;
|
int k = 0;
|
||||||
return StrUtil.fillAfter(str, ' ', b1 - byteLen);
|
try {
|
||||||
|
k = str.getBytes("GBK").length;
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
str = str + " ".repeat(Math.max(0, b1 - k));
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("水煮肉片".length());
|
||||||
|
System.out.println( StrUtil.repeat(' ', 8));
|
||||||
|
System.out.println(StrUtil.fillAfter("水煮肉片", ' ', 21));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,9 +10,14 @@ import com.czg.order.param.DataSummaryTradeParam;
|
|||||||
import com.czg.order.service.DataSummaryService;
|
import com.czg.order.service.DataSummaryService;
|
||||||
import com.czg.order.vo.DataSummaryDateAmountVo;
|
import com.czg.order.vo.DataSummaryDateAmountVo;
|
||||||
import com.czg.order.vo.DataSummaryPayTypeVo;
|
import com.czg.order.vo.DataSummaryPayTypeVo;
|
||||||
import com.czg.order.vo.DataSummaryProductSaleVo;
|
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
|
||||||
import com.czg.service.order.mapper.OrderInfoMapper;
|
import com.czg.service.order.mapper.OrderInfoMapper;
|
||||||
import com.czg.service.order.mapper.ShopOrderStatisticMapper;
|
import com.czg.service.order.mapper.ShopOrderStatisticMapper;
|
||||||
|
import com.czg.service.order.mapper.ShopProdStatisticMapper;
|
||||||
|
import com.czg.utils.PageUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -34,6 +39,8 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
|||||||
private ShopOrderStatisticMapper shopOrderStatisticMapper;
|
private ShopOrderStatisticMapper shopOrderStatisticMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderInfoMapper orderInfoMapper;
|
private OrderInfoMapper orderInfoMapper;
|
||||||
|
@Resource
|
||||||
|
private ShopProdStatisticMapper shopProdStatisticMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ShopOrderStatistic getTradeData(DataSummaryTradeParam param) {
|
public ShopOrderStatistic getTradeData(DataSummaryTradeParam param) {
|
||||||
@@ -41,14 +48,25 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
|||||||
if (shopOrderStatistic == null) {
|
if (shopOrderStatistic == null) {
|
||||||
shopOrderStatistic = new ShopOrderStatistic();
|
shopOrderStatistic = new ShopOrderStatistic();
|
||||||
}
|
}
|
||||||
|
shopOrderStatistic.setCustomerUnitPrice(shopOrderStatistic.getCustomerUnitPrice().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||||
|
shopOrderStatistic.setTableTurnoverRate(shopOrderStatistic.getTableTurnoverRate().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||||
return shopOrderStatistic;
|
return shopOrderStatistic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSummaryProductSaleVo getProductSaleData(DataSummaryProductSaleParam param) {
|
public Page<DataSummaryProductSaleRankingVo> getProductSaleRankingPage(DataSummaryProductSaleParam param) {
|
||||||
DataSummaryProductSaleVo data = new DataSummaryProductSaleVo();
|
LocalDate now = LocalDate.now();
|
||||||
System.out.println(1);
|
Integer day = param.getDay();
|
||||||
return data;
|
LocalDate beginDate = now.plusDays(-day);
|
||||||
|
List<String> days = new ArrayList<>();
|
||||||
|
for (int i = 1; i <= day; i++) {
|
||||||
|
String thisDay = beginDate.plusDays(i).format(DatePattern.NORM_DATE_FORMATTER);
|
||||||
|
days.add(thisDay);
|
||||||
|
}
|
||||||
|
param.setDays(days);
|
||||||
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
|
PageInfo<DataSummaryProductSaleRankingVo> pageInfo = new PageInfo<>(shopProdStatisticMapper.findProdRandingSummaryPage(param));
|
||||||
|
return PageUtil.convert(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -706,6 +706,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
orderInfo.setSeatAmount(shopInfo.getTableFee().multiply(new BigDecimal(param.getSeatNum())));
|
orderInfo.setSeatAmount(shopInfo.getTableFee().multiply(new BigDecimal(param.getSeatNum())));
|
||||||
orderInfo.setSeatNum(param.getSeatNum());
|
orderInfo.setSeatNum(param.getSeatNum());
|
||||||
}
|
}
|
||||||
|
orderInfo.setTableCode(param.getTableCode());
|
||||||
orderInfo.setPlaceNum(param.getPlaceNum());
|
orderInfo.setPlaceNum(param.getPlaceNum());
|
||||||
orderInfo.setOriginAmount(param.getOriginAmount());
|
orderInfo.setOriginAmount(param.getOriginAmount());
|
||||||
orderInfo.setOrderAmount(BigDecimal.ZERO);
|
orderInfo.setOrderAmount(BigDecimal.ZERO);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.czg.config.RedisCst;
|
|||||||
import com.czg.entity.req.*;
|
import com.czg.entity.req.*;
|
||||||
import com.czg.entity.resp.*;
|
import com.czg.entity.resp.*;
|
||||||
import com.czg.enums.ShopUserFlowBizEnum;
|
import com.czg.enums.ShopUserFlowBizEnum;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.exception.PaySuccessException;
|
import com.czg.exception.PaySuccessException;
|
||||||
import com.czg.order.dto.BigDecimalDTO;
|
import com.czg.order.dto.BigDecimalDTO;
|
||||||
import com.czg.order.dto.CheckOrderPay;
|
import com.czg.order.dto.CheckOrderPay;
|
||||||
@@ -551,16 +552,20 @@ public class PayServiceImpl implements PayService {
|
|||||||
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
||||||
// ssss
|
// ssss
|
||||||
List<OrderDetail> orderDetails = orderDetailService.queryChain()
|
List<OrderDetail> orderDetails = orderDetailService.queryChain()
|
||||||
.select(OrderDetail::getId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getReturnNum)
|
.select(OrderDetail::getId, OrderDetail::getProductId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getReturnNum)
|
||||||
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
||||||
.list();
|
.list();
|
||||||
for (OrderDetail orderDetail : orderDetails) {
|
for (OrderDetail orderDetail : orderDetails) {
|
||||||
if (isPay) {
|
if (isPay) {
|
||||||
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum()));
|
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum()));
|
||||||
|
}
|
||||||
orderDetail.setRefundNum(orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
orderDetail.setRefundNum(orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
||||||
orderDetail.setStatus(OrderStatusEnums.REFUND.getCode());
|
orderDetail.setStatus(OrderStatusEnums.REFUND.getCode());
|
||||||
} else {
|
} else {
|
||||||
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
returnProMap.put(Convert.toStr(orderDetail.getProductId()), orderDetail.getNum().subtract(orderDetail.getReturnNum()));
|
||||||
|
}
|
||||||
orderDetail.setReturnNum(orderDetail.getNum());
|
orderDetail.setReturnNum(orderDetail.getNum());
|
||||||
orderDetail.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
orderDetail.setStatus(OrderStatusEnums.CANCELLED.getCode());
|
||||||
}
|
}
|
||||||
@@ -639,14 +644,14 @@ public class PayServiceImpl implements PayService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo) {
|
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
return czgPayService.queryPayOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
return czgPayService.queryPayOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CzgResult<CzgRefundResp> queryRefund(@NonNull Long shopId, String mchRefundNo, String refundOrderId) {
|
public CzgResult<CzgRefundResp> queryRefund(@NonNull Long shopId, String mchRefundNo, String refundOrderId) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
return czgPayService.queryRefundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), mchRefundNo, refundOrderId);
|
return czgPayService.queryRefundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), mchRefundNo, refundOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,7 +671,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
|
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
private CzgResult<Map<String, Object>> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
CzgResult<CzgH5PayResp> h5PayRespCzgResult = czgPayService.h5Pay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
CzgResult<CzgH5PayResp> h5PayRespCzgResult = czgPayService.h5Pay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
@@ -674,7 +679,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
private CzgResult<Map<String, Object>> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
@@ -685,7 +690,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
private CzgResult<Map<String, Object>> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
bizData.setSubAppid("aliPay".equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay".equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
@@ -695,7 +700,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> scanPay(@NonNull Long shopId, CzgScanPayReq bizData) {
|
private CzgResult<Map<String, Object>> scanPay(@NonNull Long shopId, CzgScanPayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
CzgResult<CzgScanPayResp> scanPayRespCzgResult = czgPayService.scanPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
CzgResult<CzgScanPayResp> scanPayRespCzgResult = czgPayService.scanPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
@@ -704,7 +709,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
|
|
||||||
private CzgResult<Map<String, Object>> microPay(@NonNull Long shopId, CzgMicroPayReq bizData) {
|
private CzgResult<Map<String, Object>> microPay(@NonNull Long shopId, CzgMicroPayReq bizData) {
|
||||||
AssertUtil.isBlank(bizData.getAuthCode(), "扫码失败,请重试");
|
AssertUtil.isBlank(bizData.getAuthCode(), "扫码失败,请重试");
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
String firstTwoDigitsStr = bizData.getAuthCode().substring(0, 2);
|
String firstTwoDigitsStr = bizData.getAuthCode().substring(0, 2);
|
||||||
@@ -728,11 +733,19 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<CzgRefundResp> refund(@NonNull Long shopId, CzgRefundReq bizData) {
|
private CzgResult<CzgRefundResp> refund(@NonNull Long shopId, CzgRefundReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||||
bizData.setNotifyUrl(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_REFUND_NOTIFY_URL.getCode()));
|
bizData.setNotifyUrl(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_REFUND_NOTIFY_URL.getCode()));
|
||||||
return czgPayService.refundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return czgPayService.refundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ShopMerchant getMerchant(Long shopId) {
|
||||||
|
try {
|
||||||
|
return shopMerchantService.getById(shopId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CzgException("暂未开通支付");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private CzgResult<Map<String, Object>> execPayResult(CzgResult<? extends CzgBaseResp> res) {
|
private CzgResult<Map<String, Object>> execPayResult(CzgResult<? extends CzgBaseResp> res) {
|
||||||
CzgResult<Map<String, Object>> result = CzgResult.success();
|
CzgResult<Map<String, Object>> result = CzgResult.success();
|
||||||
if (res.getCode() != 200 || res.getData() == null) {
|
if (res.getCode() != 200 || res.getData() == null) {
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ import com.czg.order.param.SaleSummaryCountParam;
|
|||||||
import com.czg.order.service.SaleSummaryService;
|
import com.czg.order.service.SaleSummaryService;
|
||||||
import com.czg.order.vo.SaleSummaryCountVo;
|
import com.czg.order.vo.SaleSummaryCountVo;
|
||||||
import com.czg.order.vo.SaleSummaryInfoVo;
|
import com.czg.order.vo.SaleSummaryInfoVo;
|
||||||
|
import com.czg.service.order.mapper.ShopProdStatisticMapper;
|
||||||
|
import com.czg.utils.PageUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,21 +22,27 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SaleSummaryServiceImpl implements SaleSummaryService {
|
public class SaleSummaryServiceImpl implements SaleSummaryService {
|
||||||
|
@Resource
|
||||||
|
private ShopProdStatisticMapper shopProdStatisticMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SaleSummaryCountVo summaryCount(SaleSummaryCountParam param) {
|
public SaleSummaryCountVo summaryCount(SaleSummaryCountParam param) {
|
||||||
return new SaleSummaryCountVo();
|
SaleSummaryCountVo saleSummaryCount = shopProdStatisticMapper.getSaleSummaryCount(param);
|
||||||
|
if (saleSummaryCount == null) {
|
||||||
|
saleSummaryCount = new SaleSummaryCountVo();
|
||||||
|
}
|
||||||
|
return saleSummaryCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SaleSummaryInfoVo> summaryPage(SaleSummaryCountParam param) {
|
public Page<SaleSummaryInfoVo> summaryPage(SaleSummaryCountParam param) {
|
||||||
Page<SaleSummaryInfoVo> page = new Page<>();
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
page.setRecords(new ArrayList<SaleSummaryInfoVo>());
|
PageInfo<SaleSummaryInfoVo> pageInfo = new PageInfo<>(shopProdStatisticMapper.findSaleSummaryList(param));
|
||||||
return page;
|
return PageUtil.convert(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SaleSummaryInfoVo> summaryList(SaleSummaryCountParam param) {
|
public List<SaleSummaryInfoVo> summaryList(SaleSummaryCountParam param) {
|
||||||
return List.of();
|
return shopProdStatisticMapper.findSaleSummaryList(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -93,8 +94,14 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
statistic = new ShopOrderStatistic();
|
statistic = new ShopOrderStatistic();
|
||||||
statistic.setShopId(shopId);
|
statistic.setShopId(shopId);
|
||||||
statistic.setCreateDay(LocalDate.now());
|
statistic.setCreateDay(LocalDate.now());
|
||||||
statistic.setUpdateTime(LocalDateTime.now());
|
|
||||||
}
|
}
|
||||||
|
//TODO 充值金额
|
||||||
|
statistic.setRechargeAmount(BigDecimal.ZERO);
|
||||||
|
//TODO 客单价
|
||||||
|
statistic.setCustomerUnitPrice(BigDecimal.ZERO);
|
||||||
|
//TODO 翻台率
|
||||||
|
statistic.setTableTurnoverRate(BigDecimal.ZERO);
|
||||||
|
statistic.setUpdateTime(LocalDateTime.now());
|
||||||
BeanUtil.copyProperties(info, statistic);
|
BeanUtil.copyProperties(info, statistic);
|
||||||
saveOrUpdate(statistic);
|
saveOrUpdate(statistic);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package com.czg.service.order.service.impl;
|
|||||||
|
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
import com.czg.service.order.mapper.ShopTableOrderStatisticMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,14 +18,12 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class TableSummaryServiceImpl implements TableSummaryService {
|
public class TableSummaryServiceImpl implements TableSummaryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopTableOrderStatisticMapper shopTableOrderStatisticMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TableSummaryInfoVo> summaryList(TableSummaryParam param) {
|
public List<TableSummaryInfoVo> summaryList(TableSummaryParam param) {
|
||||||
return List.of();
|
return shopTableOrderStatisticMapper.findSummaryList(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TableSummaryExportVo> summaryExport(TableSummaryParam param) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,22 +7,22 @@
|
|||||||
<select id="getTradeData" resultType="com.czg.order.entity.ShopOrderStatistic">
|
<select id="getTradeData" resultType="com.czg.order.entity.ShopOrderStatistic">
|
||||||
select
|
select
|
||||||
sum(sale_amount) as sale_amount,
|
sum(sale_amount) as sale_amount,
|
||||||
count(sale_count) as sale_count,
|
sum(sale_count) as sale_count,
|
||||||
sum(discount_amount) as discount_amount,
|
sum(discount_amount) as discount_amount,
|
||||||
count(discount_count) as discount_count,
|
sum(discount_count) as discount_count,
|
||||||
sum(refund_amount) as refund_amount,
|
sum(refund_amount) as refund_amount,
|
||||||
count(refund_count) as refund_count,
|
sum(refund_count) as refund_count,
|
||||||
count(wechat_pay_count) as wechat_pay_count,
|
sum(wechat_pay_count) as wechat_pay_count,
|
||||||
sum(wechat_pay_amount) as wechat_pay_amount,
|
sum(wechat_pay_amount) as wechat_pay_amount,
|
||||||
count(ali_pay_count) as ali_pay_count,
|
sum(ali_pay_count) as ali_pay_count,
|
||||||
sum(ali_pay_amount) as ali_pay_amount,
|
sum(ali_pay_amount) as ali_pay_amount,
|
||||||
count(credit_pay_count) as credit_pay_count,
|
sum(credit_pay_count) as credit_pay_count,
|
||||||
sum(credit_pay_amount) as credit_pay_amount,
|
sum(credit_pay_amount) as credit_pay_amount,
|
||||||
count(member_pay_count) as member_pay_count,
|
sum(member_pay_count) as member_pay_count,
|
||||||
sum(member_pay_amount) as member_pay_amount,
|
sum(member_pay_amount) as member_pay_amount,
|
||||||
count(scan_pay_count) as scan_pay_count,
|
sum(scan_pay_count) as scan_pay_count,
|
||||||
sum(scan_pay_amount) as scan_pay_amount,
|
sum(scan_pay_amount) as scan_pay_amount,
|
||||||
count(cash_pay_count) as cash_pay_count,
|
sum(cash_pay_count) as cash_pay_count,
|
||||||
sum(cash_pay_amount) as cash_pay_amount,
|
sum(cash_pay_amount) as cash_pay_amount,
|
||||||
sum(recharge_amount) as recharge_amount,
|
sum(recharge_amount) as recharge_amount,
|
||||||
avg(customer_unit_price) as customer_unit_price,
|
avg(customer_unit_price) as customer_unit_price,
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
max(update_time) as update_time
|
max(update_time) as update_time
|
||||||
from tb_shop_order_statistic
|
from tb_shop_order_statistic
|
||||||
where shop_id = #{shopId}
|
where shop_id = #{shopId}
|
||||||
<if test="beginTime != null">
|
<if test="beginDate != null and endDate != ''">
|
||||||
and create_day >= str_to_date(#{beginTime}, '%Y-%m-%d')
|
and create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endDate != null and endDate != ''">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
and create_day <= str_to_date(#{endTime}, '%Y-%m-%d')
|
and create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
]]>
|
]]>
|
||||||
</if>
|
</if>
|
||||||
group by shop_id
|
group by shop_id
|
||||||
|
|||||||
@@ -4,4 +4,74 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.czg.service.order.mapper.ShopProdStatisticMapper">
|
<mapper namespace="com.czg.service.order.mapper.ShopProdStatisticMapper">
|
||||||
|
|
||||||
|
<select id="findProdRandingSummaryPage" resultType="com.czg.order.vo.DataSummaryProductSaleRankingVo">
|
||||||
|
select
|
||||||
|
t1.prod_id,
|
||||||
|
t2.name as product_name,
|
||||||
|
sum(t1.sale_count) as number,
|
||||||
|
sum(t1.sale_amount) as amount
|
||||||
|
from tb_shop_prod_statistic t1
|
||||||
|
left join tb_product t2 on t1.prod_id = t2.id
|
||||||
|
where t1.shop_id = #{shopId}
|
||||||
|
and t1.create_day in
|
||||||
|
<foreach item="day" collection="days" open="(" separator="," close=")">
|
||||||
|
#{day}
|
||||||
|
</foreach>
|
||||||
|
group by t1.prod_id
|
||||||
|
</select>
|
||||||
|
<select id="getSaleSummaryCount" resultType="com.czg.order.vo.SaleSummaryCountVo">
|
||||||
|
select
|
||||||
|
sum(t1.sale_count) as sale_count,
|
||||||
|
sum(t1.sale_amount) as total_amount,
|
||||||
|
sum(t1.refund_count) as refund_count,
|
||||||
|
sum(t1.refund_amount) as refund_amount
|
||||||
|
from tb_shop_prod_statistic t1
|
||||||
|
left join tb_product t2 on t1.prod_id = t2.id
|
||||||
|
where t1.shop_id = #{shopId}
|
||||||
|
<if test="productName != null and productName != ''">
|
||||||
|
and t2.name like concat('%', #{productName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="prodCategoryId != null">
|
||||||
|
and t2.category_id = #{prodCategoryId}
|
||||||
|
</if>
|
||||||
|
<if test="beginDate != null and beginDate != ''">
|
||||||
|
and t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate != ''">
|
||||||
|
<![CDATA[
|
||||||
|
and t1.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
|
]]>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="findSaleSummaryList" resultType="com.czg.order.vo.SaleSummaryInfoVo">
|
||||||
|
select
|
||||||
|
t1.prod_id,
|
||||||
|
max(t1.id) as id,
|
||||||
|
t2.NAME AS product_name,
|
||||||
|
t3.name as category_name,
|
||||||
|
sum(t1.sale_count) as sale_count,
|
||||||
|
sum(t1.sale_amount) as sale_amount,
|
||||||
|
sum(t1.refund_count) as refund_count,
|
||||||
|
sum(t1.refund_amount) as refund_amount
|
||||||
|
from tb_shop_prod_statistic t1
|
||||||
|
left join tb_product t2 on t1.prod_id = t2.id
|
||||||
|
left join tb_shop_prod_category t3 on t2.category_id = t3.id
|
||||||
|
where t1.shop_id = #{shopId}
|
||||||
|
<if test="productName != null and productName != ''">
|
||||||
|
and t2.name like concat('%', #{productName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="prodCategoryId != null">
|
||||||
|
and t2.category_id = #{prodCategoryId}
|
||||||
|
</if>
|
||||||
|
<if test="beginDate != null and beginDate != ''">
|
||||||
|
and t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate != ''">
|
||||||
|
<![CDATA[
|
||||||
|
and t1.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
|
]]>
|
||||||
|
</if>
|
||||||
|
group by t1.prod_id
|
||||||
|
ORDER BY sum( t1.sale_count ) DESC,max(t1.id) DESC
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -26,4 +26,26 @@
|
|||||||
a.table_id
|
a.table_id
|
||||||
order by a.id desc
|
order by a.id desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findSummaryList" resultType="com.czg.order.vo.TableSummaryInfoVo">
|
||||||
|
select
|
||||||
|
t1.table_id,
|
||||||
|
ifnull(t3.name,'N/A') as area_name,
|
||||||
|
ifnull(t2.name,'N/A') as table_name,
|
||||||
|
sum(t1.order_count) as order_count,
|
||||||
|
sum(t1.order_amount) as order_amount,
|
||||||
|
ifnull(sum(t1.refund_count),0) as refund_count,
|
||||||
|
ifnull(sum(t1.refund_amount),0) as refund_amount
|
||||||
|
from tb_shop_table_order_statistic t1
|
||||||
|
left join tb_shop_table t2 on t1.table_id = t2.id
|
||||||
|
left join tb_shop_table_area t3 on t2.area_id = t3.id
|
||||||
|
where t1.shop_id = #{shopId}
|
||||||
|
<if test="beginDate != null and beginDate != ''">
|
||||||
|
AND t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate != ''">
|
||||||
|
and t2.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
group by t1.table_id
|
||||||
|
order by sum(t1.order_count) desc,max(t1.id) desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public class ConsStockFlowServiceImpl extends ServiceImpl<ConsStockFlowMapper, C
|
|||||||
entity.setPurchasePrice(consInfo.getPrice());
|
entity.setPurchasePrice(consInfo.getPrice());
|
||||||
BigDecimal balance = NumberUtil.sub(consInfo.getStockNumber(), param.getNumber());
|
BigDecimal balance = NumberUtil.sub(consInfo.getStockNumber(), param.getNumber());
|
||||||
if (NumberUtil.isLess(balance, BigDecimal.ZERO)) {
|
if (NumberUtil.isLess(balance, BigDecimal.ZERO)) {
|
||||||
throw new CzgException(StrUtil.format("耗材{}存在发生变动,请刷新后重试", entity.getConName()));
|
throw new CzgException(StrUtil.format("耗材{}报损数量不能大于当前库存{}", entity.getConName(), consInfo.getStockNumber()));
|
||||||
}
|
}
|
||||||
entity.setBeforeNumber(consInfo.getStockNumber());
|
entity.setBeforeNumber(consInfo.getStockNumber());
|
||||||
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, balance));
|
entity.setInOutNumber(NumberUtil.sub(BigDecimal.ZERO, balance));
|
||||||
|
|||||||
Reference in New Issue
Block a user