Merge branch 'master' into prod
This commit is contained in:
@@ -59,8 +59,8 @@ public class AuthorizationController {
|
|||||||
* @return token信息
|
* @return token信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public CzgResult<LoginVO> login(@Validated @RequestBody SysLoginDTO loginDTO, @RequestHeader(defaultValue = "WEB") String platformType) {
|
public CzgResult<LoginVO> login(@Validated @RequestBody SysLoginDTO loginDTO, @RequestHeader(defaultValue = "WEB") String platformtype) {
|
||||||
return CzgResult.success(authorizationService.login(loginDTO, platformType));
|
return CzgResult.success(authorizationService.login(loginDTO, platformtype));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.czg.account.entity.HandoverRecord;
|
|||||||
import com.czg.account.service.HandoverRecordService;
|
import com.czg.account.service.HandoverRecordService;
|
||||||
import com.czg.account.vo.HandoverProductListVo;
|
import com.czg.account.vo.HandoverProductListVo;
|
||||||
import com.czg.account.vo.HandoverTotalVo;
|
import com.czg.account.vo.HandoverTotalVo;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.annotation.SaStaffCheckPermission;
|
import com.czg.annotation.SaStaffCheckPermission;
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.enums.YesNoEnum;
|
import com.czg.enums.YesNoEnum;
|
||||||
@@ -42,8 +43,8 @@ public class HandoverRecordController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("交班记录-分页")
|
@OperationLog("交班记录-分页")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
||||||
//@SaAdminCheckPermission("handoverRecord:page")
|
@SaAdminCheckPermission("handoverRecord:page")
|
||||||
public CzgResult<Page<HandoverRecordDTO>> page(@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate) {
|
public CzgResult<Page<HandoverRecordDTO>> page(@RequestParam(required = false) String beginDate, @RequestParam(required = false) String endDate) {
|
||||||
Page<HandoverRecordDTO> page = handoverRecordService.getHandoverRecordPage(beginDate, endDate);
|
Page<HandoverRecordDTO> page = handoverRecordService.getHandoverRecordPage(beginDate, endDate);
|
||||||
return CzgResult.success(page);
|
return CzgResult.success(page);
|
||||||
@@ -56,8 +57,8 @@ public class HandoverRecordController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@OperationLog("交班记录-查看")
|
@OperationLog("交班记录-查看")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
||||||
//@SaAdminCheckPermission("handoverRecord:info")
|
@SaAdminCheckPermission("handoverRecord:info")
|
||||||
public CzgResult<List<HandoverProductListVo>> info(@PathVariable Long id) {
|
public CzgResult<List<HandoverProductListVo>> info(@PathVariable Long id) {
|
||||||
List<HandoverProductListVo> data = handoverRecordService.getHandoverProductListById(id);
|
List<HandoverProductListVo> data = handoverRecordService.getHandoverProductListById(id);
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
@@ -71,8 +72,8 @@ public class HandoverRecordController {
|
|||||||
@ResponseExcel(name = "交班售出商品明细")
|
@ResponseExcel(name = "交班售出商品明细")
|
||||||
@GetMapping("/export/{id}")
|
@GetMapping("/export/{id}")
|
||||||
@OperationLog("交班记录-导出")
|
@OperationLog("交班记录-导出")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
||||||
//@SaAdminCheckPermission("handoverRecord:export")
|
@SaAdminCheckPermission("handoverRecord:export")
|
||||||
public List<HandoverProductListVo> export(@PathVariable Long id) {
|
public List<HandoverProductListVo> export(@PathVariable Long id) {
|
||||||
return handoverRecordService.getHandoverProductListById(id);
|
return handoverRecordService.getHandoverProductListById(id);
|
||||||
}
|
}
|
||||||
@@ -82,8 +83,8 @@ public class HandoverRecordController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("total")
|
@GetMapping("total")
|
||||||
@OperationLog("收银机-交班数据统计")
|
@OperationLog("收银机-交班数据统计")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
||||||
//@SaAdminCheckPermission("handoverRecord:total")
|
@SaAdminCheckPermission("handoverRecord:total")
|
||||||
public CzgResult<HandoverTotalVo> total() {
|
public CzgResult<HandoverTotalVo> total() {
|
||||||
HandoverTotalVo data = handoverRecordService.totalHandoverData();
|
HandoverTotalVo data = handoverRecordService.totalHandoverData();
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
@@ -96,8 +97,8 @@ public class HandoverRecordController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("handover")
|
@PostMapping("handover")
|
||||||
@OperationLog("收银机-交班/关班")
|
@OperationLog("收银机-交班/关班")
|
||||||
@SaStaffCheckPermission("yun_xu_jiao_ban")
|
// @SaStaffCheckPermission("yun_xu_jiao_ban")
|
||||||
//@SaAdminCheckPermission("handoverRecord:handover")
|
@SaAdminCheckPermission("handoverRecord:handover")
|
||||||
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
||||||
Long id = handoverRecordService.handover();
|
Long id = handoverRecordService.handover();
|
||||||
return CzgResult.success(id);
|
return CzgResult.success(id);
|
||||||
@@ -110,8 +111,8 @@ public class HandoverRecordController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/network/print/{id}")
|
@PostMapping("/network/print/{id}")
|
||||||
@OperationLog("收银机-交班/关班-网络打印机打印交班小票")
|
@OperationLog("收银机-交班/关班-网络打印机打印交班小票")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_suo_you_jiao_ban_ji_lu")
|
||||||
//@SaAdminCheckPermission("handoverRecord:networkPrint")
|
@SaAdminCheckPermission("handoverRecord:networkPrint")
|
||||||
public CzgResult<Void> handover(@PathVariable Long id) {
|
public CzgResult<Void> handover(@PathVariable Long id) {
|
||||||
handoverRecordService.printHandoverReceipt(id, YesNoEnum.YES.value());
|
handoverRecordService.printHandoverReceipt(id, YesNoEnum.YES.value());
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.czg.controller.admin;
|
|||||||
import com.czg.account.dto.menu.MenuAddDTO;
|
import com.czg.account.dto.menu.MenuAddDTO;
|
||||||
import com.czg.account.dto.menu.MenuDelDTO;
|
import com.czg.account.dto.menu.MenuDelDTO;
|
||||||
import com.czg.account.dto.menu.MenuEditDTO;
|
import com.czg.account.dto.menu.MenuEditDTO;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
import com.czg.account.entity.SysMenu;
|
import com.czg.account.entity.SysMenu;
|
||||||
import com.czg.account.service.SysMenuService;
|
import com.czg.account.service.SysMenuService;
|
||||||
import com.czg.account.vo.MenuVO;
|
import com.czg.account.vo.MenuVO;
|
||||||
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.*;
|
||||||
@@ -35,6 +37,16 @@ public class MenuController {
|
|||||||
return CzgResult.success(menuService.getMenu());
|
return CzgResult.success(menuService.getMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收银机菜单
|
||||||
|
* @return 所有菜单
|
||||||
|
*/
|
||||||
|
@GetMapping("/list/cash")
|
||||||
|
public CzgResult<List<CashMenu>> all() {
|
||||||
|
return CzgResult.success(menuService.getCashAll());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有菜单
|
* 获取所有菜单
|
||||||
* @return 菜单结构
|
* @return 菜单结构
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.czg.controller.admin;
|
|||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.RoleAddDTO;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
import com.czg.account.dto.role.RoleEditDTO;
|
||||||
|
import com.czg.account.dto.role.RolePermissionDTO;
|
||||||
import com.czg.account.dto.role.RoleRemoveDTO;
|
import com.czg.account.dto.role.RoleRemoveDTO;
|
||||||
import com.czg.account.entity.SysRole;
|
import com.czg.account.entity.SysRole;
|
||||||
import com.czg.account.service.SysRoleService;
|
import com.czg.account.service.SysRoleService;
|
||||||
@@ -44,12 +45,13 @@ public class RoleController {
|
|||||||
* 获取角色对应的菜单
|
* 获取角色对应的菜单
|
||||||
* 权限标识: role:menu
|
* 权限标识: role:menu
|
||||||
* @param id 角色id
|
* @param id 角色id
|
||||||
|
* @param type 0管理端 1收银机
|
||||||
* @return 分页数据
|
* @return 分页数据
|
||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(value = "role:menu", name = "角色菜单")
|
@SaAdminCheckPermission(value = "role:menu", name = "角色菜单")
|
||||||
@GetMapping("/menu")
|
@GetMapping("/menu")
|
||||||
public CzgResult<List<Long>> getRoleMenu(@RequestParam Integer id) {
|
public CzgResult<List<Long>> getRoleMenu(@RequestParam Integer id, @RequestParam Integer type) {
|
||||||
return CzgResult.success(roleService.getRoleMenu(StpKit.USER.getLoginIdAsLong(), id));
|
return CzgResult.success(roleService.getRoleMenu(StpKit.USER.getLoginIdAsLong(), id, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,6 +66,16 @@ public class RoleController {
|
|||||||
return CzgResult.success(roleService.add(roleAddDTO));
|
return CzgResult.success(roleService.add(roleAddDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限编辑
|
||||||
|
* @param rolePermissionDTO 权限编辑
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@PutMapping("/permission")
|
||||||
|
public CzgResult<Boolean> editPermission(@RequestBody @Validated RolePermissionDTO rolePermissionDTO) {
|
||||||
|
return CzgResult.success(roleService.editPermission(StpKit.USER.getLoginIdAsLong(), rolePermissionDTO));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑角色
|
* 编辑角色
|
||||||
* 权限标识: role:edit
|
* 权限标识: role:edit
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.czg.account.entity.ShopTable;
|
|||||||
import com.czg.account.service.ShopTableService;
|
import com.czg.account.service.ShopTableService;
|
||||||
import com.czg.account.vo.ShopTableVO;
|
import com.czg.account.vo.ShopTableVO;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.enums.ShopTableStatusEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
@@ -75,7 +76,9 @@ public class ShopTableController {
|
|||||||
if (StrUtil.isNotBlank(tableCode)) {
|
if (StrUtil.isNotBlank(tableCode)) {
|
||||||
queryWrapper.eq(ShopTable::getTableCode, tableCode);
|
queryWrapper.eq(ShopTable::getTableCode, tableCode);
|
||||||
}
|
}
|
||||||
return CzgResult.success(shopTableService.getOne(queryWrapper));
|
ShopTable one = shopTableService.getOne(queryWrapper);
|
||||||
|
one.setStatusMsg(ShopTableStatusEnum.getMsgByValue(one.getStatus()));
|
||||||
|
return CzgResult.success(one);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ShopUserController {
|
|||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(value = "shopUser:summary", name = "店铺用户概述信息")
|
@SaAdminCheckPermission(value = "shopUser:summary", name = "店铺用户概述信息")
|
||||||
@GetMapping("/summary")
|
@GetMapping("/summary")
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
public CzgResult<ShopUserSummaryDTO> summary(Integer isVip) {
|
public CzgResult<ShopUserSummaryDTO> summary(Integer isVip) {
|
||||||
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getUsableShopId(), isVip));
|
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getUsableShopId(), isVip));
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class ShopUserController {
|
|||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(value = "shopUser:flow", name = "店铺用户充值记录")
|
@SaAdminCheckPermission(value = "shopUser:flow", name = "店铺用户充值记录")
|
||||||
@GetMapping("/flow")
|
@GetMapping("/flow")
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode, String startTime, String endTime) {
|
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode, String startTime, String endTime) {
|
||||||
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getUsableShopId(), userId, bizCode, startTime, endTime));
|
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getUsableShopId(), userId, bizCode, startTime, endTime));
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public class ShopUserController {
|
|||||||
*/
|
*/
|
||||||
@SaAdminCheckPermission(value = "shopUser:flow:downLoad", name = "店铺用户充值记录导出")
|
@SaAdminCheckPermission(value = "shopUser:flow:downLoad", name = "店铺用户充值记录导出")
|
||||||
@GetMapping("/flow/download")
|
@GetMapping("/flow/download")
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
public void flowDownload(Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
public void flowDownload(Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
||||||
shopUserFlowService.flowDownload(StpKit.USER.getUsableShopId(), userId, bizCode, startTime, endTime, response);
|
shopUserFlowService.flowDownload(StpKit.USER.getUsableShopId(), userId, bizCode, startTime, endTime, response);
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ public class ShopUserController {
|
|||||||
* @param isVip 0 非vip 1 vip
|
* @param isVip 0 非vip 1 vip
|
||||||
* @return 用户列表
|
* @return 用户列表
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
@SaAdminCheckPermission(value = "shopUser:list", name = "店铺用户列表")
|
@SaAdminCheckPermission(value = "shopUser:list", name = "店铺用户列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CzgResult<Page<ShopUserDTO>> list(String key, Integer isVip, BigDecimal amount) {
|
public CzgResult<Page<ShopUserDTO>> list(String key, Integer isVip, BigDecimal amount) {
|
||||||
@@ -106,7 +106,7 @@ public class ShopUserController {
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @return 用户详情
|
* @return 用户详情
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
@SaAdminCheckPermission(value = "shopUser:detail", name = "店铺用户详情")
|
@SaAdminCheckPermission(value = "shopUser:detail", name = "店铺用户详情")
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public CzgResult<ShopUser> detail(Integer id, Integer userId) {
|
public CzgResult<ShopUser> detail(Integer id, Integer userId) {
|
||||||
@@ -121,7 +121,7 @@ public class ShopUserController {
|
|||||||
*
|
*
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
@SaAdminCheckPermission(value = "shopUser:add", name = "店铺用户添加")
|
@SaAdminCheckPermission(value = "shopUser:add", name = "店铺用户添加")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CzgResult<Boolean> add(@RequestBody @Validated ShopUserAddDTO shopUserAddDTO) {
|
public CzgResult<Boolean> add(@RequestBody @Validated ShopUserAddDTO shopUserAddDTO) {
|
||||||
@@ -133,7 +133,7 @@ public class ShopUserController {
|
|||||||
*
|
*
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
// @SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||||
@SaAdminCheckPermission(value = "shopUser:edit", name = "店铺用户修改")
|
@SaAdminCheckPermission(value = "shopUser:edit", name = "店铺用户修改")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public CzgResult<Boolean> edit(@RequestBody @Validated ShopUserEditDTO shopUserEditDTO) {
|
public CzgResult<Boolean> edit(@RequestBody @Validated ShopUserEditDTO shopUserEditDTO) {
|
||||||
@@ -145,7 +145,7 @@ public class ShopUserController {
|
|||||||
*
|
*
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_xiu_gai_hui_yuan_yu_e")
|
// @SaStaffCheckPermission("yun_xu_xiu_gai_hui_yuan_yu_e")
|
||||||
@SaAdminCheckPermission(value = "shopUser:editFlow", name = "店铺用户余额修改")
|
@SaAdminCheckPermission(value = "shopUser:editFlow", name = "店铺用户余额修改")
|
||||||
@PutMapping("/money")
|
@PutMapping("/money")
|
||||||
public CzgResult<Boolean> editMoney(@RequestBody @Validated ShopUserMoneyEditDTO shopUserMoneyEditDTO) {
|
public CzgResult<Boolean> editMoney(@RequestBody @Validated ShopUserMoneyEditDTO shopUserMoneyEditDTO) {
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.czg.controller.user;
|
|||||||
import com.czg.account.dto.shopinfo.ShopInfoByCodeDTO;
|
import com.czg.account.dto.shopinfo.ShopInfoByCodeDTO;
|
||||||
import com.czg.account.dto.shopinfo.ShopInfoDetailDTO;
|
import com.czg.account.dto.shopinfo.ShopInfoDetailDTO;
|
||||||
import com.czg.account.dto.shopinfo.ShopInfoSubVO;
|
import com.czg.account.dto.shopinfo.ShopInfoSubVO;
|
||||||
|
import com.czg.account.entity.ShopTable;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
|
import com.czg.account.service.ShopTableService;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -23,6 +26,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
public class UShopInfoController {
|
public class UShopInfoController {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopInfoService shopInfoService;
|
private ShopInfoService shopInfoService;
|
||||||
|
@Resource
|
||||||
|
private ShopTableService shopTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 桌码换取详细店铺信息
|
* 桌码换取详细店铺信息
|
||||||
@@ -33,6 +38,15 @@ public class UShopInfoController {
|
|||||||
return CzgResult.success(shopInfoService.getByCode(tableCode, lat, lng, true));
|
return CzgResult.success(shopInfoService.getByCode(tableCode, lat, lng, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桌码获取详细台桌信息
|
||||||
|
* @return 台桌信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/tableInfo")
|
||||||
|
public CzgResult<ShopTable> getTableInfo(@RequestParam String tableCode) {
|
||||||
|
return CzgResult.success(shopTableService.getOne(new QueryWrapper().eq(ShopTable::getTableCode, tableCode)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺详细信息
|
* 获取店铺详细信息
|
||||||
* @return 店铺信息
|
* @return 店铺信息
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class UserAuthorizationController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/test")
|
@PostMapping("/test")
|
||||||
public CzgResult<String> login(@RequestParam long id) {
|
public CzgResult<String> login(@RequestParam long id) {
|
||||||
StpKit.USER.login(id, "2342", null, "", MyStpLogic.LoginType.USER, false);
|
StpKit.USER.login(id, "2342", null, "", MyStpLogic.LoginType.USER, false, "");
|
||||||
return CzgResult.success(StpKit.USER.getTokenValue());
|
return CzgResult.success(StpKit.USER.getTokenValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.czg.config;
|
package com.czg.config;
|
||||||
|
|
||||||
|
import com.czg.account.service.ShopTableService;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -25,6 +27,8 @@ public class RedisKeyExpirationListener implements MessageListener {
|
|||||||
private String database;
|
private String database;
|
||||||
@Resource
|
@Resource
|
||||||
private OrderInfoService tbOrderInfoService;
|
private OrderInfoService tbOrderInfoService;
|
||||||
|
@DubboReference
|
||||||
|
private ShopTableService tableService;
|
||||||
|
|
||||||
|
|
||||||
//redis key失效监听
|
//redis key失效监听
|
||||||
@@ -46,6 +50,10 @@ public class RedisKeyExpirationListener implements MessageListener {
|
|||||||
log.info("监听到订单过期,订单Id: {}", expiredKey);
|
log.info("监听到订单过期,订单Id: {}", expiredKey);
|
||||||
String orderId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_ORDER.length());
|
String orderId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_ORDER.length());
|
||||||
tbOrderInfoService.expired(Long.parseLong(orderId));
|
tbOrderInfoService.expired(Long.parseLong(orderId));
|
||||||
|
}else if (expiredKey.startsWith(RedisCst.classKeyExpired.EXPIRED_TABLE)) {
|
||||||
|
log.info("监听到台桌清台过期,台桌Id: {}", expiredKey);
|
||||||
|
String tableId = expiredKey.substring(RedisCst.classKeyExpired.EXPIRED_TABLE.length());
|
||||||
|
tableService.expiredTable(Long.parseLong(tableId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class VipPayController {
|
|||||||
* 现金充值
|
* 现金充值
|
||||||
* 如果shop_info的 is_member_in_pwd=1 则pwd必填 店铺操作密码
|
* 如果shop_info的 is_member_in_pwd=1 则pwd必填 店铺操作密码
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_shou_kuan")
|
//@SaStaffCheckPermission("yun_xu_shou_kuan")
|
||||||
@PostMapping("/cashPayVip")
|
@PostMapping("/cashPayVip")
|
||||||
@Debounce(value = "#payParam.shopUserId")
|
@Debounce(value = "#payParam.shopUserId")
|
||||||
public CzgResult<Object> cashPayVip(@Validated @RequestBody VipPayParamDTO payParam) {
|
public CzgResult<Object> cashPayVip(@Validated @RequestBody VipPayParamDTO payParam) {
|
||||||
@@ -72,7 +72,7 @@ public class VipPayController {
|
|||||||
/**
|
/**
|
||||||
* 正扫
|
* 正扫
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_shou_kuan")
|
//@SaStaffCheckPermission("yun_xu_shou_kuan")
|
||||||
@PostMapping("/scanPayVip")
|
@PostMapping("/scanPayVip")
|
||||||
@Debounce(value = "#payParam.shopUserId")
|
@Debounce(value = "#payParam.shopUserId")
|
||||||
public CzgResult<Map<String, Object>> scanPayVip(HttpServletRequest request, @Validated @RequestBody VipPayParamDTO payParam) {
|
public CzgResult<Map<String, Object>> scanPayVip(HttpServletRequest request, @Validated @RequestBody VipPayParamDTO payParam) {
|
||||||
@@ -85,7 +85,7 @@ public class VipPayController {
|
|||||||
* 反扫
|
* 反扫
|
||||||
* authCode 必填 扫描码
|
* authCode 必填 扫描码
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_shou_kuan")
|
//@SaStaffCheckPermission("yun_xu_shou_kuan")
|
||||||
@PostMapping("/microPayVip")
|
@PostMapping("/microPayVip")
|
||||||
@Debounce(value = "#payParam.shopUserId")
|
@Debounce(value = "#payParam.shopUserId")
|
||||||
public CzgResult<Map<String, Object>> microPayVip(@Validated @RequestBody VipPayParamDTO payParam) {
|
public CzgResult<Map<String, Object>> microPayVip(@Validated @RequestBody VipPayParamDTO payParam) {
|
||||||
@@ -98,7 +98,7 @@ public class VipPayController {
|
|||||||
* 退款前置
|
* 退款前置
|
||||||
* 最大退款金额 为 充值金额 inAmount
|
* 最大退款金额 为 充值金额 inAmount
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_tui_kuan")
|
//@SaStaffCheckPermission("yun_xu_tui_kuan")
|
||||||
@PostMapping("/refundVipBefore")
|
@PostMapping("/refundVipBefore")
|
||||||
@Debounce(value = "#payParam.flowId")
|
@Debounce(value = "#payParam.flowId")
|
||||||
public CzgResult<Map<String, BigDecimal>> refundVipBefore(@Validated @RequestBody VipRefundDTO payParam) {
|
public CzgResult<Map<String, BigDecimal>> refundVipBefore(@Validated @RequestBody VipRefundDTO payParam) {
|
||||||
@@ -114,7 +114,7 @@ public class VipPayController {
|
|||||||
* 实际可退最大金额为 充值金额
|
* 实际可退最大金额为 充值金额
|
||||||
* 如果实际 大于 理论 则 需要勾选 outOfRange 超额退款 为true 默认为false
|
* 如果实际 大于 理论 则 需要勾选 outOfRange 超额退款 为true 默认为false
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_tui_kuan")
|
//@SaStaffCheckPermission("yun_xu_tui_kuan")
|
||||||
@PostMapping("/refundVip")
|
@PostMapping("/refundVip")
|
||||||
@Debounce(value = "#payParam.flowId")
|
@Debounce(value = "#payParam.flowId")
|
||||||
public CzgResult<Object> refundVip(HttpServletRequest request, @Validated @RequestBody VipRefundDTO payParam) {
|
public CzgResult<Object> refundVip(HttpServletRequest request, @Validated @RequestBody VipRefundDTO payParam) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class AdminOrderController {
|
|||||||
return CzgResult.success(orderInfoService.historyOrder(orderId, tableCode));
|
return CzgResult.success(orderInfoService.historyOrder(orderId, tableCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaStaffCheckPermission("yun_xu_xia_dan")
|
//@SaStaffCheckPermission("yun_xu_xia_dan")
|
||||||
@PostMapping("/createOrder")
|
@PostMapping("/createOrder")
|
||||||
@Debounce(value = "#addDto.tableCode")
|
@Debounce(value = "#addDto.tableCode")
|
||||||
public CzgResult<OrderInfo> createOrder(@Validated @RequestBody OrderInfoAddDTO addDto) {
|
public CzgResult<OrderInfo> createOrder(@Validated @RequestBody OrderInfoAddDTO addDto) {
|
||||||
@@ -87,7 +87,7 @@ public class AdminOrderController {
|
|||||||
* 订单全额退款 只传订单id
|
* 订单全额退款 只传订单id
|
||||||
* 部分退款 传参refundDetail
|
* 部分退款 传参refundDetail
|
||||||
*/
|
*/
|
||||||
@SaStaffCheckPermission("yun_xu_tui_kuan")
|
//@SaStaffCheckPermission("yun_xu_tui_kuan")
|
||||||
@PostMapping("/refundOrder")
|
@PostMapping("/refundOrder")
|
||||||
@Debounce(value = "#refundDTO.orderId")
|
@Debounce(value = "#refundDTO.orderId")
|
||||||
public CzgResult<Object> refundOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
|
public CzgResult<Object> refundOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.annotation.SaStaffCheckPermission;
|
import com.czg.annotation.SaStaffCheckPermission;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.entity.ShopOrderStatistic;
|
import com.czg.order.entity.ShopOrderStatistic;
|
||||||
@@ -39,8 +40,8 @@ public class DataSummaryController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("trade")
|
@GetMapping("trade")
|
||||||
@OperationLog("营业板块-上半部分")
|
@OperationLog("营业板块-上半部分")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
||||||
//@SaAdminCheckPermission("dataSummary:trade")
|
@SaAdminCheckPermission(value = "dataSummary:trade", name = "营业板块-上半部分")
|
||||||
public CzgResult<ShopOrderStatistic> getTradeData(DataSummaryTradeParam param) {
|
public CzgResult<ShopOrderStatistic> getTradeData(DataSummaryTradeParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -56,8 +57,8 @@ public class DataSummaryController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("productSaleDate")
|
@GetMapping("productSaleDate")
|
||||||
@OperationLog("商品销售-右下")
|
@OperationLog("商品销售-右下")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
||||||
//@SaAdminCheckPermission("dataSummary:productSaleData")
|
@SaAdminCheckPermission(value = "dataSummary:productSaleData", name = "商品销售-右下")
|
||||||
public CzgResult<Page<DataSummaryProductSaleRankingVo>> getProductSaleData(DataSummaryProductSaleParam param) {
|
public CzgResult<Page<DataSummaryProductSaleRankingVo>> getProductSaleData(DataSummaryProductSaleParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -76,8 +77,8 @@ public class DataSummaryController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("dateAmount")
|
@GetMapping("dateAmount")
|
||||||
@OperationLog("销售趋势柱状图 左下")
|
@OperationLog("销售趋势柱状图 左下")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
||||||
//@SaAdminCheckPermission("dataSummary:dateAmount")
|
@SaAdminCheckPermission(value = "dataSummary:dateAmount", name = "销售趋势柱状图 左下")
|
||||||
public CzgResult<DataSummaryDateAmountVo> getDateAmount(@RequestParam Integer day, @RequestParam(required = false) Long shopId) {
|
public CzgResult<DataSummaryDateAmountVo> getDateAmount(@RequestParam Integer day, @RequestParam(required = false) Long shopId) {
|
||||||
AssertUtil.isNull(day, "天数不能为空");
|
AssertUtil.isNull(day, "天数不能为空");
|
||||||
if (shopId == null) {
|
if (shopId == null) {
|
||||||
@@ -95,8 +96,8 @@ public class DataSummaryController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("datePayType")
|
@GetMapping("datePayType")
|
||||||
@OperationLog("支付占比饼图 左下")
|
@OperationLog("支付占比饼图 左下")
|
||||||
@SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
// @SaStaffCheckPermission("yun_xu_cha_kan_jing_ying_shu_ju")
|
||||||
//@SaAdminCheckPermission("dataSummary:datePayType")
|
@SaAdminCheckPermission(value = "dataSummary:datePayType", name = "支付占比饼图 左下2")
|
||||||
public CzgResult<DataSummaryPayTypeVo> shopSummaryPayType(@RequestParam Integer day, @RequestParam(required = false) Long shopId) {
|
public CzgResult<DataSummaryPayTypeVo> shopSummaryPayType(@RequestParam Integer day, @RequestParam(required = false) Long shopId) {
|
||||||
if (shopId == null) {
|
if (shopId == null) {
|
||||||
shopId = StpKit.USER.getShopId(0L);
|
shopId = StpKit.USER.getShopId(0L);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class StatisticTask {
|
|||||||
LocalDate endDate = LocalDate.now();
|
LocalDate endDate = LocalDate.now();
|
||||||
List<Long> shopIdList = DbChain.table("tb_shop_info").select("id").objListAs(Long.class);
|
List<Long> shopIdList = DbChain.table("tb_shop_info").select("id").objListAs(Long.class);
|
||||||
List<List<Long>> split = CollUtil.split(shopIdList, 10);
|
List<List<Long>> split = CollUtil.split(shopIdList, 10);
|
||||||
// 1.清除历史统计的数据
|
// 1.清除历史统计的数据
|
||||||
for (List<Long> splitIdList : split) {
|
for (List<Long> splitIdList : split) {
|
||||||
splitIdList.parallelStream().forEach(shopId -> {
|
splitIdList.parallelStream().forEach(shopId -> {
|
||||||
shopOrderStatisticMapper.deleteByQuery(QueryWrapper.create().eq(ShopOrderStatistic::getShopId, shopId));
|
shopOrderStatisticMapper.deleteByQuery(QueryWrapper.create().eq(ShopOrderStatistic::getShopId, shopId));
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ConsStockFlowController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("in")
|
@PostMapping("in")
|
||||||
@OperationLog("耗材入库")
|
@OperationLog("耗材入库")
|
||||||
@SaStaffCheckPermission("yun_xu_hao_cai_ru_ku")
|
//@SaStaffCheckPermission("yun_xu_hao_cai_ru_ku")
|
||||||
//@SaAdminCheckPermission("consStockFlow:in")
|
//@SaAdminCheckPermission("consStockFlow:in")
|
||||||
public CzgResult<Void> inStock(@RequestBody ConsInOutStockHeadParam param) {
|
public CzgResult<Void> inStock(@RequestBody ConsInOutStockHeadParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
@@ -51,7 +51,7 @@ public class ConsStockFlowController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("out")
|
@PostMapping("out")
|
||||||
@OperationLog("耗材出库")
|
@OperationLog("耗材出库")
|
||||||
@SaStaffCheckPermission("yun_xu_hao_cai_chu_ku")
|
//@SaStaffCheckPermission("yun_xu_hao_cai_chu_ku")
|
||||||
//@SaAdminCheckPermission("consStockFlow:out")
|
//@SaAdminCheckPermission("consStockFlow:out")
|
||||||
public CzgResult<Void> outStock(@RequestBody ConsInOutStockHeadParam param) {
|
public CzgResult<Void> outStock(@RequestBody ConsInOutStockHeadParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
@@ -78,7 +78,7 @@ public class ConsStockFlowController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("check")
|
@PostMapping("check")
|
||||||
@OperationLog("库存盘点")
|
@OperationLog("库存盘点")
|
||||||
@SaStaffCheckPermission("yun_xu_hao_cai_pan_dian")
|
//@SaStaffCheckPermission("yun_xu_hao_cai_pan_dian")
|
||||||
//@SaAdminCheckPermission("consStockFlow:check")
|
//@SaAdminCheckPermission("consStockFlow:check")
|
||||||
public CzgResult<Void> checkStock(@RequestBody ConsCheckStockParam param) {
|
public CzgResult<Void> checkStock(@RequestBody ConsCheckStockParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@OperationLog("商品-修改")
|
@OperationLog("商品-修改")
|
||||||
@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:update")
|
//@SaAdminCheckPermission("product:update")
|
||||||
public CzgResult<Void> updateProduct(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProductDTO dto) {
|
public CzgResult<Void> updateProduct(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ProductDTO dto) {
|
||||||
if (dto.getCategoryId() != null) {
|
if (dto.getCategoryId() != null) {
|
||||||
@@ -142,7 +142,7 @@ public class ProductController {
|
|||||||
|
|
||||||
@PostMapping("modifyStock")
|
@PostMapping("modifyStock")
|
||||||
@OperationLog("商品-修改库存")
|
@OperationLog("商品-修改库存")
|
||||||
@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||||
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -161,7 +161,7 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
@OperationLog("商品-删除")
|
@OperationLog("商品-删除")
|
||||||
@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:delete")
|
//@SaAdminCheckPermission("product:delete")
|
||||||
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
||||||
//效验数据
|
//效验数据
|
||||||
@@ -180,7 +180,7 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("onOff")
|
@PostMapping("onOff")
|
||||||
@OperationLog("商品-上下架")
|
@OperationLog("商品-上下架")
|
||||||
@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:on-off")
|
//@SaAdminCheckPermission("product:on-off")
|
||||||
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
|
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -197,7 +197,7 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("markIsSoldOut")
|
@PostMapping("markIsSoldOut")
|
||||||
@OperationLog("商品-标记售罄")
|
@OperationLog("商品-标记售罄")
|
||||||
@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:markIsSoldOut")
|
//@SaAdminCheckPermission("product:markIsSoldOut")
|
||||||
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
|
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -253,7 +253,7 @@ public class ProductController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("reportDamage")
|
@PostMapping("reportDamage")
|
||||||
@OperationLog("商品-报损")
|
@OperationLog("商品-报损")
|
||||||
@SaStaffCheckPermission("yun_xu_ti_jiao_bao_sun")
|
//@SaStaffCheckPermission("yun_xu_ti_jiao_bao_sun")
|
||||||
//@SaAdminCheckPermission("product:reportDamage")
|
//@SaAdminCheckPermission("product:reportDamage")
|
||||||
public CzgResult<Void> reportDamage(@RequestBody ProductReportDamageParam param) {
|
public CzgResult<Void> reportDamage(@RequestBody ProductReportDamageParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public interface RedisCst {
|
|||||||
class classKeyExpired {
|
class classKeyExpired {
|
||||||
//订单key过期
|
//订单key过期
|
||||||
public static final String EXPIRED_ORDER = "expired:order:";
|
public static final String EXPIRED_ORDER = "expired:order:";
|
||||||
|
//台桌清台key过期
|
||||||
|
public static final String EXPIRED_TABLE = "expired:table:";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ public class MyStpLogic {
|
|||||||
public static final StpLogic CLIENT_LOGIC = new StpLogic("client");
|
public static final StpLogic CLIENT_LOGIC = new StpLogic("client");
|
||||||
public static final StpLogic ADMIN_LOGIC = new StpLogic("admin");
|
public static final StpLogic ADMIN_LOGIC = new StpLogic("admin");
|
||||||
|
|
||||||
|
public Object isPC() {
|
||||||
|
return "PC".equals(SaHolder.getRequest().getHeader("Platformtype"));
|
||||||
|
}
|
||||||
|
|
||||||
public enum LoginType {
|
public enum LoginType {
|
||||||
MANAGER, USER, STAFF
|
MANAGER, USER, STAFF
|
||||||
}
|
}
|
||||||
@@ -91,13 +95,14 @@ public class MyStpLogic {
|
|||||||
* @param loginType 登录类型枚举
|
* @param loginType 登录类型枚举
|
||||||
* @param isAdmin 是否为管理员账号
|
* @param isAdmin 是否为管理员账号
|
||||||
*/
|
*/
|
||||||
public void login(Long id, String account, Long shopId, String shopName, LoginType loginType, boolean isAdmin) {
|
public void login(Long id, String account, Long shopId, String shopName, LoginType loginType, boolean isAdmin, String platForm) {
|
||||||
StpLogic logic = getLogic();
|
StpLogic logic = getLogic();
|
||||||
logic.login(id);
|
logic.login(id);
|
||||||
if (loginType.equals(LoginType.MANAGER) && shopId == null) {
|
if (loginType.equals(LoginType.MANAGER) && shopId == null) {
|
||||||
throw new ApiNotPrintException("管理端登录必须传递店铺id");
|
throw new ApiNotPrintException("管理端登录必须传递店铺id");
|
||||||
}
|
}
|
||||||
SaSession session = logic.getSession().set("userId", id).set("isAdmin", isAdmin).set("isManager", loginType.equals(LoginType.MANAGER))
|
SaSession session = logic.getSession().set("userId", id).set("isAdmin", isAdmin).set("isManager", loginType.equals(LoginType.MANAGER))
|
||||||
|
.set("platForm", platForm)
|
||||||
.set("loginType", loginType).set("account", account);
|
.set("loginType", loginType).set("account", account);
|
||||||
if (shopId != null) {
|
if (shopId != null) {
|
||||||
session.set("shopId", shopId);
|
session.set("shopId", shopId);
|
||||||
@@ -107,6 +112,12 @@ public class MyStpLogic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPlatForm() {
|
||||||
|
StpLogic logic = getLogic();
|
||||||
|
Object platForm = logic.getSession().get("platForm");
|
||||||
|
return platForm instanceof String s ? s : "";
|
||||||
|
}
|
||||||
|
|
||||||
public void reLogin(long id) {
|
public void reLogin(long id) {
|
||||||
StpLogic logic = getLogic();
|
StpLogic logic = getLogic();
|
||||||
String token = logic.getTokenValue();
|
String token = logic.getTokenValue();
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-05-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CashMenuDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String component;
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import jakarta.validation.constraints.NotEmpty;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@@ -64,4 +66,18 @@ public class MenuAddDTO {
|
|||||||
* 权限表示
|
* 权限表示
|
||||||
*/
|
*/
|
||||||
private String permission;
|
private String permission;
|
||||||
|
/**
|
||||||
|
* 小程序页面路径
|
||||||
|
*/
|
||||||
|
private String miniPath;
|
||||||
|
/**
|
||||||
|
* 小程序组件
|
||||||
|
*/
|
||||||
|
private String miniComponent;
|
||||||
|
/**
|
||||||
|
* 接口路径支持通配符, 多个逗号分割
|
||||||
|
*/
|
||||||
|
private List<MenuApiInfoItemDTO> apiInfo;
|
||||||
|
|
||||||
|
private String miniIcon;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.account.dto.menu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MenuApiInfoItemDTO {
|
||||||
|
/**
|
||||||
|
* 请求方式 ALL, POST, GET, DELETE, PUT
|
||||||
|
*/
|
||||||
|
private String method;
|
||||||
|
/**
|
||||||
|
* 接口地址,支持通配符*和?
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import jakarta.validation.constraints.NotEmpty;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@@ -55,7 +57,22 @@ public class MenuEditDTO {
|
|||||||
*/
|
*/
|
||||||
private String activeMenu;
|
private String activeMenu;
|
||||||
/**
|
/**
|
||||||
* 权限表示
|
* 权限标识
|
||||||
*/
|
*/
|
||||||
private String permission;
|
private String permission;
|
||||||
|
/**
|
||||||
|
* 小程序页面路径
|
||||||
|
*/
|
||||||
|
private String miniPath;
|
||||||
|
/**
|
||||||
|
* 小程序组件
|
||||||
|
*/
|
||||||
|
private String miniComponent;
|
||||||
|
/**
|
||||||
|
* 接口路径支持通配符
|
||||||
|
*/
|
||||||
|
private List<MenuApiInfoItemDTO> apiInfo;
|
||||||
|
|
||||||
|
private String miniIcon;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,14 @@ public record RoleAddDTO(
|
|||||||
String name,
|
String name,
|
||||||
// 角色级别
|
// 角色级别
|
||||||
Integer level,
|
Integer level,
|
||||||
// 菜单id
|
/**
|
||||||
@NotEmpty(message = "菜单id不能为空")
|
* 管理员菜单id
|
||||||
List<Long> menuIdList,
|
*/
|
||||||
|
List<Long> adminMenuIdList,
|
||||||
|
/**
|
||||||
|
* 收银机菜单id
|
||||||
|
*/
|
||||||
|
List<Long> cashMenuIdList,
|
||||||
// 描述
|
// 描述
|
||||||
String description
|
String description
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -20,8 +20,14 @@ public class RoleEditDTO {
|
|||||||
// 角色等级
|
// 角色等级
|
||||||
private Integer level;
|
private Integer level;
|
||||||
// 菜单id
|
// 菜单id
|
||||||
@NotNull
|
/**
|
||||||
private List<Long> menuIdList;
|
* 管理员菜单id
|
||||||
|
*/
|
||||||
|
List<Long> adminMenuIdList;
|
||||||
|
/**
|
||||||
|
* 收银机菜单id
|
||||||
|
*/
|
||||||
|
List<Long> cashMenuIdList;
|
||||||
// 描述
|
// 描述
|
||||||
private String description;
|
private String description;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.czg.account.dto.role;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RolePermissionDTO {
|
||||||
|
/**
|
||||||
|
* 角色id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long roleId;
|
||||||
|
/**
|
||||||
|
* 管理员菜单id
|
||||||
|
*/
|
||||||
|
List<Long> adminMenuIdList;
|
||||||
|
/**
|
||||||
|
* 收银机菜单id
|
||||||
|
*/
|
||||||
|
List<Long> cashMenuIdList;
|
||||||
|
}
|
||||||
@@ -245,4 +245,13 @@ public class ShopInfoEditDTO {
|
|||||||
* 是否为主店 1-是 0-否
|
* 是否为主店 1-是 0-否
|
||||||
*/
|
*/
|
||||||
private Integer isHeadShop;
|
private Integer isHeadShop;
|
||||||
|
/**
|
||||||
|
* 台桌清理类型 'auto 自动 hand 手动' 默认auto
|
||||||
|
*/
|
||||||
|
private String tableClearType;
|
||||||
|
/**
|
||||||
|
* '自动清台 支付几分钟后 默认10分钟后'
|
||||||
|
*/
|
||||||
|
private Integer tableClearTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,19 +57,30 @@ public class ShopTableDTO implements Serializable {
|
|||||||
private BigDecimal predateAmount;
|
private BigDecimal predateAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* idle-空闲 using-使用中 subscribe预定,closed--关台, opening 开台中,cleaning 台桌清理中
|
* 未绑定:unbound
|
||||||
|
* 空闲:idle
|
||||||
|
* 点餐中:ordering
|
||||||
|
* 未结账:unsettled
|
||||||
|
* 支付中:paying
|
||||||
|
* 已结账 (待清台):settled
|
||||||
|
* 关台:closed
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二维码
|
* 二维码
|
||||||
*/
|
*/
|
||||||
private String qrcode;
|
private String tableCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动清台 0手动 1自动
|
* 自动清台 0手动 1自动
|
||||||
*/
|
*/
|
||||||
private Integer autoClear;
|
private Integer autoClear;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动清台时间 单位分钟 默认10
|
||||||
|
*/
|
||||||
|
private Integer autoClearTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseMenu {
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件
|
||||||
|
*/
|
||||||
|
private String component;
|
||||||
|
/**
|
||||||
|
* 链接地址
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包含的接口
|
||||||
|
*/
|
||||||
|
private String apiInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-05-26
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@Table("sys_cash_menu")
|
||||||
|
public class CashMenu extends BaseMenu implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -82,4 +82,13 @@ public class ShopConfig implements Serializable {
|
|||||||
* 分店数据同步方式 auto-自动同步 manual-手动同步
|
* 分店数据同步方式 auto-自动同步 manual-手动同步
|
||||||
*/
|
*/
|
||||||
private String branchDataSyncMethod;
|
private String branchDataSyncMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台桌清理类型 'auto 自动 hand 手动' 默认auto
|
||||||
|
*/
|
||||||
|
private String tableClearType;
|
||||||
|
/**
|
||||||
|
* '自动清台 支付几分钟后 默认10分钟后'
|
||||||
|
*/
|
||||||
|
private Integer tableClearTime;
|
||||||
}
|
}
|
||||||
@@ -301,4 +301,15 @@ public class ShopInfo implements Serializable {
|
|||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
private String headShopName;
|
private String headShopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台桌清理类型 'auto 自动 hand 手动' 默认auto
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String tableClearType;
|
||||||
|
/**
|
||||||
|
* '自动清台 支付几分钟后 默认10分钟后'
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private Integer tableClearTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.mybatisflex.annotation.Column;
|
|||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -67,9 +68,18 @@ public class ShopTable implements Serializable {
|
|||||||
private BigDecimal predateAmount;
|
private BigDecimal predateAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* idle-空闲 using-使用中 subscribe预定,closed--关台, opening 开台中,cleaning 台桌清理中
|
* {@link com.czg.enums.ShopTableStatusEnum}
|
||||||
|
* 未绑定:unbound
|
||||||
|
* 空闲:idle
|
||||||
|
* 点餐中:ordering
|
||||||
|
* 未结账:unsettled
|
||||||
|
* 支付中:paying
|
||||||
|
* 已结账 (待清台):settled
|
||||||
|
* 关台:closed
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String statusMsg;
|
||||||
|
|
||||||
@Column(onInsertValue = "now()")
|
@Column(onInsertValue = "now()")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
@@ -83,10 +93,9 @@ public class ShopTable implements Serializable {
|
|||||||
private String tableCode;
|
private String tableCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动清台 0手动 1自动
|
* 清台时间(自动清台时使用)
|
||||||
*/
|
*/
|
||||||
private Integer autoClear;
|
private LocalDateTime clearTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用时间
|
* 使用时间
|
||||||
*/
|
*/
|
||||||
@@ -118,7 +127,10 @@ public class ShopTable implements Serializable {
|
|||||||
private Integer useNum;
|
private Integer useNum;
|
||||||
|
|
||||||
public boolean canUseByStatus() {
|
public boolean canUseByStatus() {
|
||||||
return !ShopTableStatusEnum.CLOSED.equalsVal(status) && !ShopTableStatusEnum.CLEANING.equalsVal(status) && !ShopTableStatusEnum.SUBSCRIBE.equalsVal(status);
|
return !ShopTableStatusEnum.UNBOUND.equalsVal(status)
|
||||||
|
&& !ShopTableStatusEnum.SETTLED.equalsVal(status)
|
||||||
|
&& !ShopTableStatusEnum.SUBSCRIBE.equalsVal(status)
|
||||||
|
&& !ShopTableStatusEnum.CLOSED.equalsVal(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.mybatisflex.annotation.KeyType;
|
|||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -18,21 +19,16 @@ import java.time.LocalDateTime;
|
|||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @since 2025-02-10
|
* @since 2025-02-10
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table("sys_menu")
|
@Table("sys_menu")
|
||||||
public class SysMenu implements Serializable {
|
public class SysMenu extends BaseMenu implements Serializable{
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* ID
|
|
||||||
*/
|
|
||||||
@Id(keyType = KeyType.Auto)
|
|
||||||
private Long menuId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上级菜单ID
|
* 上级菜单ID
|
||||||
@@ -54,30 +50,13 @@ public class SysMenu implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件
|
|
||||||
*/
|
|
||||||
private String component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
private Integer menuSort;
|
private Integer menuSort;
|
||||||
|
|
||||||
/**
|
|
||||||
* 图标
|
|
||||||
*/
|
|
||||||
private String icon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 链接地址
|
|
||||||
*/
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否外链
|
* 是否外链
|
||||||
@@ -131,4 +110,24 @@ public class SysMenu implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long isShop;
|
private Long isShop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序页面路径
|
||||||
|
*/
|
||||||
|
private String miniPath;
|
||||||
|
/**
|
||||||
|
* 小程序组件
|
||||||
|
*/
|
||||||
|
private String miniComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 请求方式
|
||||||
|
*/
|
||||||
|
private String method;
|
||||||
|
|
||||||
|
private String miniIcon;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,9 @@ public class SysRolesMenus implements Serializable {
|
|||||||
@Id
|
@Id
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 管理端及小程序 1收银机
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-05-26
|
||||||
|
*/
|
||||||
|
public interface CashMenuService extends IService<CashMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@ public interface ShopTableService extends IService<ShopTable> {
|
|||||||
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
|
Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO);
|
||||||
|
|
||||||
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
|
Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO);
|
||||||
|
Boolean expiredTable(long tableId);
|
||||||
|
|
||||||
Page<ShopTableVO> pageInfo(Long shopId, Integer areaId, String tableCode, String status, String name, Boolean isBind);
|
Page<ShopTableVO> pageInfo(Long shopId, Integer areaId, String tableCode, String status, String name, Boolean isBind);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.account.service;
|
|||||||
|
|
||||||
import com.czg.account.dto.menu.MenuAddDTO;
|
import com.czg.account.dto.menu.MenuAddDTO;
|
||||||
import com.czg.account.dto.menu.MenuEditDTO;
|
import com.czg.account.dto.menu.MenuEditDTO;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
import com.czg.account.entity.SysMenu;
|
import com.czg.account.entity.SysMenu;
|
||||||
import com.czg.account.vo.MenuVO;
|
import com.czg.account.vo.MenuVO;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
@@ -24,4 +25,6 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||||||
|
|
||||||
Boolean edit(MenuEditDTO menuEditDTO);
|
Boolean edit(MenuEditDTO menuEditDTO);
|
||||||
|
|
||||||
|
List<CashMenu> getCashAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.czg.account.service;
|
|||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.RoleAddDTO;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
import com.czg.account.dto.role.RoleEditDTO;
|
||||||
|
import com.czg.account.dto.role.RolePermissionDTO;
|
||||||
import com.czg.account.entity.SysRole;
|
import com.czg.account.entity.SysRole;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
@@ -25,5 +26,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||||||
|
|
||||||
Boolean edit(RoleEditDTO roleEditDTO);
|
Boolean edit(RoleEditDTO roleEditDTO);
|
||||||
|
|
||||||
List<Long> getRoleMenu(long loginIdAsLong, Integer id);
|
List<Long> getRoleMenu(long loginIdAsLong, Integer id, Integer type);
|
||||||
|
|
||||||
|
Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.account.vo;
|
|||||||
|
|
||||||
|
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
|
import com.czg.account.entity.ShopStaff;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -13,6 +14,8 @@ public record LoginVO(
|
|||||||
// 登录类型
|
// 登录类型
|
||||||
Integer loginType,
|
Integer loginType,
|
||||||
// 店铺信息
|
// 店铺信息
|
||||||
ShopInfo shopInfo
|
ShopInfo shopInfo,
|
||||||
|
// 员工信息
|
||||||
|
ShopStaff shopStaff
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,26 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal scanPayAmount = BigDecimal.ZERO;
|
private BigDecimal scanPayAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被扫支付笔数
|
||||||
|
*/
|
||||||
|
private Long backScanPayCount = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被扫支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal backScanPayAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被扫支付笔数
|
||||||
|
*/
|
||||||
|
private Long h5PayCount = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被扫支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal h5PayAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现金支付笔数
|
* 现金支付笔数
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class OrderInfoVo implements Serializable {
|
|||||||
* 店铺Id
|
* 店铺Id
|
||||||
*/
|
*/
|
||||||
private String shopId;
|
private String shopId;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public enum SysParamCodeEnum {
|
|||||||
ALI_OSS_ENDPOINT("ali_oss_endpoint", "阿里云endpoint"),
|
ALI_OSS_ENDPOINT("ali_oss_endpoint", "阿里云endpoint"),
|
||||||
ALI_OSS_ROLE_ARN("ali_oss_role_arn", "阿里云roleArn"),
|
ALI_OSS_ROLE_ARN("ali_oss_role_arn", "阿里云roleArn"),
|
||||||
WX_MINI_VIP_URL("wx_mini_vip_url", "小程序会员页面地址"),
|
WX_MINI_VIP_URL("wx_mini_vip_url", "小程序会员页面地址"),
|
||||||
|
TABLE_CODE_URL("table_code_url", "桌码生成路径"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.boot.CommandLineRunner;
|
|||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.core.annotation.AnnotationUtils;
|
import org.springframework.core.annotation.AnnotationUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
@@ -32,6 +33,45 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
Method method = value.getMethod();
|
Method method = value.getMethod();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Class<?> controllerClass = method.getDeclaringClass();
|
||||||
|
// 获取类上的 @RequestMapping 路径
|
||||||
|
String classPath = "";
|
||||||
|
if (controllerClass.isAnnotationPresent(RequestMapping.class)) {
|
||||||
|
RequestMapping classMapping = controllerClass.getAnnotation(RequestMapping.class);
|
||||||
|
classPath = classMapping.value().length > 0 ? classMapping.value()[0] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取方法上的注解路径和请求方式
|
||||||
|
String methodPaths = "";
|
||||||
|
String httpMethod = "UNKNOWN";
|
||||||
|
|
||||||
|
if (method.isAnnotationPresent(GetMapping.class)) {
|
||||||
|
GetMapping mapping = method.getAnnotation(GetMapping.class);
|
||||||
|
methodPaths = mapping.value().length > 0 ? mapping.value()[0] : "";
|
||||||
|
httpMethod = "GET";
|
||||||
|
} else if (method.isAnnotationPresent(PostMapping.class)) {
|
||||||
|
PostMapping mapping = method.getAnnotation(PostMapping.class);
|
||||||
|
methodPaths = mapping.value().length > 0 ? mapping.value()[0] : "";
|
||||||
|
httpMethod = "POST";
|
||||||
|
} else if (method.isAnnotationPresent(PutMapping.class)) {
|
||||||
|
PutMapping mapping = method.getAnnotation(PutMapping.class);
|
||||||
|
methodPaths = mapping.value().length > 0 ? mapping.value()[0] : "";
|
||||||
|
httpMethod = "PUT";
|
||||||
|
} else if (method.isAnnotationPresent(DeleteMapping.class)) {
|
||||||
|
DeleteMapping mapping = method.getAnnotation(DeleteMapping.class);
|
||||||
|
methodPaths = mapping.value().length > 0 ? mapping.value()[0] : "";
|
||||||
|
httpMethod = "DELETE";
|
||||||
|
} else if (method.isAnnotationPresent(RequestMapping.class)) {
|
||||||
|
RequestMapping mapping = method.getAnnotation(RequestMapping.class);
|
||||||
|
methodPaths = mapping.value().length > 0 ? mapping.value()[0] : "";
|
||||||
|
RequestMethod[] methods = mapping.method();
|
||||||
|
httpMethod = methods.length > 0 ? methods[0].name() : "ALL";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接路径并输出
|
||||||
|
String fullPath = (classPath + "/" + methodPaths).replaceAll("//+", "/");
|
||||||
|
|
||||||
|
|
||||||
// 使用反射获取注解(不 import SaAdminCheckPermission)
|
// 使用反射获取注解(不 import SaAdminCheckPermission)
|
||||||
Class<?> annotationClass = Class.forName("com.czg.annotation.SaAdminCheckPermission");
|
Class<?> annotationClass = Class.forName("com.czg.annotation.SaAdminCheckPermission");
|
||||||
Object annotation = AnnotationUtils.getAnnotation(method, (Class) annotationClass);
|
Object annotation = AnnotationUtils.getAnnotation(method, (Class) annotationClass);
|
||||||
@@ -51,6 +91,8 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
if (menu1 != null) {
|
if (menu1 != null) {
|
||||||
Long menuId = menu1.getLong("menu_id");
|
Long menuId = menu1.getLong("menu_id");
|
||||||
String title = menu1.getString("title");
|
String title = menu1.getString("title");
|
||||||
|
String url = menu1.getString("url");
|
||||||
|
String method1 = menu1.getString("method");
|
||||||
String permission = menu1.getString("permission");
|
String permission = menu1.getString("permission");
|
||||||
String listSql = "select * from sys_roles_menus where menu_id=? and role_id=?";
|
String listSql = "select * from sys_roles_menus where menu_id=? and role_id=?";
|
||||||
List<Row> count1 = Db.selectListBySql(listSql, menuId, 1L);
|
List<Row> count1 = Db.selectListBySql(listSql, menuId, 1L);
|
||||||
@@ -61,17 +103,17 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission);
|
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(permissionName) && (title == null || !title.equals(permissionName))) {
|
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1)) {
|
||||||
sql = "update sys_menu set title=? where menu_id=?";
|
sql = "update sys_menu set title=?, url=?, method=? where menu_id=?";
|
||||||
Db.updateBySql(sql, permissionName, menuId);
|
Db.updateBySql(sql, permissionName, fullPath, httpMethod, menuId);
|
||||||
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);
|
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = "INSERT INTO `czg_cashier`.`sys_menu` ( `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`, `active_menu`, `is_shop`) VALUES " +
|
sql = "INSERT INTO `czg_cashier`.`sys_menu` ( `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`, `active_menu`, `is_shop`, `url`, `method`) VALUES " +
|
||||||
"(0, 2, ?, NULL, '', 2, '', '', b'0', b'0', b'0', ?, NULL, NULL, ?, NULL, NULL, 0);";
|
"(0, 2, ?, NULL, '', 2, '', '', b'0', b'0', b'0', ?, NULL, NULL, ?, NULL, NULL, 0, ?, ?);";
|
||||||
Db.insertBySql(sql, StrUtil.isNotBlank(permissionName) ? permissionName : s, s, DateUtil.date());
|
Db.insertBySql(sql, StrUtil.isNotBlank(permissionName) ? permissionName : s, s, DateUtil.date(), fullPath, httpMethod);
|
||||||
sql = "select * from sys_menu where permission=?";
|
sql = "select * from sys_menu where permission=?";
|
||||||
Row info = Db.selectOneBySql(sql, s);
|
Row info = Db.selectOneBySql(sql, s);
|
||||||
Long menuId = info.getLong("menu_id");
|
Long menuId = info.getLong("menu_id");
|
||||||
|
|||||||
@@ -1,31 +1,62 @@
|
|||||||
package com.czg.enums;
|
package com.czg.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台桌状态枚举
|
* 台桌状态枚举
|
||||||
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum ShopTableStatusEnum {
|
public enum ShopTableStatusEnum {
|
||||||
|
// 未绑定
|
||||||
|
UNBOUND("unbound", "未绑定"),
|
||||||
// 空闲
|
// 空闲
|
||||||
IDLE("idle"),
|
IDLE("idle", "空闲"),
|
||||||
// 使用中
|
// 点餐中
|
||||||
USING("using"),
|
ORDERING("ordering", "点餐中"),
|
||||||
|
// 未结账
|
||||||
|
UNSETTLED("unsettled", "未结账"),
|
||||||
|
// 支付中
|
||||||
|
PAYING("paying", "支付中"),
|
||||||
|
// 已结账 (待清台)
|
||||||
|
SETTLED("settled", "已结账 (待清台)"),
|
||||||
// 关台
|
// 关台
|
||||||
CLOSED("closed"),
|
CLOSED("closed", "关台"),
|
||||||
// 预定
|
// 预定
|
||||||
SUBSCRIBE("subscribe"),
|
SUBSCRIBE("subscribe", "预定"),
|
||||||
// 清台
|
;
|
||||||
CLEANING("cleaning");
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
ShopTableStatusEnum(String value) {
|
// 静态代码块,在类加载时执行,用于初始化映射关系
|
||||||
|
private static final Map<String, String> VALUE_MSG_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (ShopTableStatusEnum status : ShopTableStatusEnum.values()) {
|
||||||
|
VALUE_MSG_MAP.put(status.getValue(), status.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopTableStatusEnum(String value, String msg) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equalsVal(String val) {
|
public boolean equalsVal(String val) {
|
||||||
return val.equals(value);
|
return val.equals(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getMsgByValue(String value) {
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return VALUE_MSG_MAP.get(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,8 @@ public class CzgPayUtils {
|
|||||||
* @return false 验签通过 true 验签失败
|
* @return false 验签通过 true 验签失败
|
||||||
*/
|
*/
|
||||||
private static boolean validateSign(String sign, String dataJsonStr) {
|
private static boolean validateSign(String sign, String dataJsonStr) {
|
||||||
Map<String, Object> dataMap = JSONObject.parseObject(dataJsonStr, new TypeReference<>() {});
|
Map<String, Object> dataMap = JSONObject.parseObject(dataJsonStr, new TypeReference<>() {
|
||||||
|
});
|
||||||
String newSign = MD5Util.md5AsHex(sortFields(new TreeMap<>(dataMap)));
|
String newSign = MD5Util.md5AsHex(sortFields(new TreeMap<>(dataMap)));
|
||||||
return !StrUtil.equals(sign, newSign);
|
return !StrUtil.equals(sign, newSign);
|
||||||
}
|
}
|
||||||
@@ -230,6 +231,29 @@ public class CzgPayUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//// String appId = "66691a6afdf641f0bf1dc701";
|
||||||
|
// String appId = "66e3dd399a7621f45a6293c1";
|
||||||
|
//// String appSecret = "jikd52TefZcSPI5hRWrfPSpQcXZrbqshbnLmqH6UattqspIDEzjbGvZmfwTW58RMf1XuPhN4zE1GbIjKy3b1oabgOx5n79faT93Si6i7g2IPSQJAln2NNsCSNynHIJ8";
|
||||||
|
// String appSecret = "2p7TCixkN3FuhTqJyr23GNAfrqAqUt84T1IOSunCEEqFBP9gVkSO8CqrfNwNAJqLYuWmQou7lbwdW0Lb4zJVkBEdV7CPq3VhnbGDRIpQXpBNPOjJbor1IFGuLLOA7oll";
|
||||||
|
// CzgJsPayReq bizData = new CzgJsPayReq("20250428150248328893", 100L,
|
||||||
|
// "订单支付", "or1l867cx6JFbLgmppwtG46AUhwg","1.80.211.145", "http://store.sxczgkj.com/h5/#/pages/user-order/user-order", "", "");
|
||||||
|
// bizData.setCurrency("cny");
|
||||||
|
// bizData.setPayType("WECHAT");
|
||||||
|
// bizData.setSubAppid("wxd88fffa983758a30");
|
||||||
|
//
|
||||||
|
// bizData.setSubject("订单支付");
|
||||||
|
//// bizData.setStoreId("S2409148611");
|
||||||
|
// bizData.setStoreId("S2406120331");
|
||||||
|
//
|
||||||
|
// CzgBaseReqParams params = CzgBaseReqParams.getInstance(appId, appSecret, bizData);
|
||||||
|
// params.setVersion("1.0");
|
||||||
|
// params.setReqId("57143686759273485473");
|
||||||
|
// params.setReqTime("20250428150248");
|
||||||
|
// params.setSignType("MD5");
|
||||||
|
// CzgResult<CzgH5PayResp> czgH5PayRespCzgResult = sendCzg("https://paymentapi.sxczgkj.cn/api/open/payment/jspay", params, CzgH5PayResp.class);
|
||||||
|
// System.out.println(czgH5PayRespCzgResult);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class CzgH5PayReq extends CzgBaseReq {
|
|||||||
* 用户IP 支付的用户IP
|
* 用户IP 支付的用户IP
|
||||||
*/
|
*/
|
||||||
private String clientIp;
|
private String clientIp;
|
||||||
|
private String payType;
|
||||||
|
//?
|
||||||
|
private String openId;
|
||||||
|
|
||||||
//非必填范围
|
//非必填范围
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-05-26
|
||||||
|
*/
|
||||||
|
public interface CashMenuMapper extends BaseMapper<CashMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -148,7 +148,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
if (!isAllowAccountLogin) {
|
if (!isAllowAccountLogin) {
|
||||||
throw new ApiNotPrintException("当前分店账号被禁止登录");
|
throw new ApiNotPrintException("当前分店账号被禁止登录");
|
||||||
}
|
}
|
||||||
StpKit.USER.login(user.getId(), user.getAccount(), shopInfo.getId(), shopInfo.getShopName(), isStaff ? MyStpLogic.LoginType.STAFF : MyStpLogic.LoginType.MANAGER, user.getIsAdmin());
|
StpKit.USER.login(user.getId(), user.getAccount(), shopInfo.getId(), shopInfo.getShopName(), isStaff ? MyStpLogic.LoginType.STAFF : MyStpLogic.LoginType.MANAGER, user.getIsAdmin(), platType);
|
||||||
// 查询角色
|
// 查询角色
|
||||||
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
|
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
|
||||||
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());
|
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());
|
||||||
@@ -156,7 +156,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
roleNames.add("admin");
|
roleNames.add("admin");
|
||||||
}
|
}
|
||||||
// 权限赋予
|
// 权限赋予
|
||||||
List<String> promissionList = sysMenuMapper.selectByUserId(user.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
List<String> promissionList = sysMenuMapper.selectByUserId(user.getId(), "PC".equals(platType) ? 1 : 0).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
// 加入员工权限
|
// 加入员工权限
|
||||||
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
||||||
promissionList.addAll(shopStaffPromissionList);
|
promissionList.addAll(shopStaffPromissionList);
|
||||||
@@ -180,7 +180,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
redisService.del(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
redisService.del(RedisCst.LOGIN_CODE + loginDTO.uuid());
|
||||||
return new LoginVO(StpKit.USER.getTokenInfo(), new ArrayList<>(), loginDTO.loginType(), shopInfo);
|
return new LoginVO(StpKit.USER.getTokenInfo(), new ArrayList<>(), loginDTO.loginType(), shopInfo, shopStaff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
|
import com.czg.account.service.CashMenuService;
|
||||||
|
import com.czg.service.account.mapper.CashMenuMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务层实现。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-05-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CashMenuServiceImpl extends ServiceImpl<CashMenuMapper, CashMenu> implements CashMenuService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -124,6 +124,7 @@ public class PadProdServiceImpl implements PadProdService {
|
|||||||
return padDetailDTO;
|
return padDetailDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(Long shopId, PadDetailAddDTO padDetailAddDTO) {
|
public Boolean add(Long shopId, PadDetailAddDTO padDetailAddDTO) {
|
||||||
long count = shopProdCategoryService.count(new QueryWrapper().eq(ShopProdCategory::getId, padDetailAddDTO.getProductCategoryId()));
|
long count = shopProdCategoryService.count(new QueryWrapper().eq(ShopProdCategory::getId, padDetailAddDTO.getProductCategoryId()));
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.czg.account.dto.table.ShopTableAddDTO;
|
|||||||
import com.czg.account.dto.table.ShopTableBindDTO;
|
import com.czg.account.dto.table.ShopTableBindDTO;
|
||||||
import com.czg.account.dto.table.ShopTableClearDTO;
|
import com.czg.account.dto.table.ShopTableClearDTO;
|
||||||
import com.czg.account.dto.table.ShopTableDTO;
|
import com.czg.account.dto.table.ShopTableDTO;
|
||||||
|
import com.czg.account.entity.ShopAd;
|
||||||
import com.czg.account.entity.ShopTable;
|
import com.czg.account.entity.ShopTable;
|
||||||
import com.czg.account.entity.ShopTableArea;
|
import com.czg.account.entity.ShopTableArea;
|
||||||
import com.czg.account.entity.ShopTableCode;
|
import com.czg.account.entity.ShopTableCode;
|
||||||
@@ -20,22 +21,28 @@ import com.czg.account.service.ShopTableService;
|
|||||||
import com.czg.account.vo.ShopTableVO;
|
import com.czg.account.vo.ShopTableVO;
|
||||||
import com.czg.enums.ShopTableStatusEnum;
|
import com.czg.enums.ShopTableStatusEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.account.mapper.ShopTableMapper;
|
import com.czg.service.account.mapper.ShopTableMapper;
|
||||||
|
import com.czg.system.enums.SysParamCodeEnum;
|
||||||
|
import com.czg.system.service.SysParamsService;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -55,6 +62,20 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
private ShopTableAreaService shopAreaService;
|
private ShopTableAreaService shopAreaService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShopTableCodeService shopTableCodeService;
|
private ShopTableCodeService shopTableCodeService;
|
||||||
|
@DubboReference
|
||||||
|
private SysParamsService sysParamsService;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
updateChain()
|
||||||
|
.set(ShopTable::getClearTime, null)
|
||||||
|
.set(ShopTable::getStatus, ShopTableStatusEnum.IDLE.getValue())
|
||||||
|
.isNotNull(ShopTable::getTableCode)
|
||||||
|
.isNotNull(ShopTable::getClearTime)
|
||||||
|
.lt(ShopTable::getClearTime, LocalDateTime.now())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(Long shopId, ShopTableAddDTO shopTableAddDTO) {
|
public Boolean add(Long shopId, ShopTableAddDTO shopTableAddDTO) {
|
||||||
@@ -78,7 +99,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
shopTable.setName(name);
|
shopTable.setName(name);
|
||||||
shopTable.setMaxCapacity(shopTableAddDTO.getMaxCapacity());
|
shopTable.setMaxCapacity(shopTableAddDTO.getMaxCapacity());
|
||||||
shopTable.setAreaId(shopTableAddDTO.getAreaId());
|
shopTable.setAreaId(shopTableAddDTO.getAreaId());
|
||||||
shopTable.setStatus(ShopTableStatusEnum.CLOSED.getValue());
|
shopTable.setStatus(ShopTableStatusEnum.UNBOUND.getValue());
|
||||||
tableArrayList.add(shopTable);
|
tableArrayList.add(shopTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +195,7 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
File qrFile = new File(dir, tableCode + ".png");
|
File qrFile = new File(dir, tableCode + ".png");
|
||||||
|
|
||||||
// 生成二维码图片
|
// 生成二维码图片
|
||||||
QrCodeUtil.generate("https://kysh.sxczgkj.cn/codeplate?code=" + tableCode, 300, 300, qrFile);
|
QrCodeUtil.generate(sysParamsService.getSysParamValue(SysParamCodeEnum.TABLE_CODE_URL.getCode()) + tableCode, 300, 300, qrFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先保存数据库记录,确保生成ZIP前无异常
|
// 先保存数据库记录,确保生成ZIP前无异常
|
||||||
@@ -250,13 +271,17 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
@Override
|
@Override
|
||||||
public Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO) {
|
public Boolean updateInfo(long shopId, ShopTableDTO shopTableDTO) {
|
||||||
ShopTable shopTable = BeanUtil.copyProperties(shopTableDTO, ShopTable.class);
|
ShopTable shopTable = BeanUtil.copyProperties(shopTableDTO, ShopTable.class);
|
||||||
|
ShopTable shopTableSource = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableDTO.getId()));
|
||||||
|
if (StrUtil.isBlank(shopTableSource.getTableCode()) && StrUtil.isNotBlank(shopTable.getStatus()) && ShopTableStatusEnum.UNBOUND.equalsVal(shopTable.getStatus())) {
|
||||||
|
throw new ApiNotPrintException("修改失败,该台桌未绑定桌码,绑定桌码后自动进入空闲状态");
|
||||||
|
}
|
||||||
return update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId()));
|
return update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
|
public Boolean clear(long shopId, ShopTableClearDTO shopTableClearDTO) {
|
||||||
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));
|
ShopTable shopTable = getOne(new QueryWrapper().eq(ShopTable::getShopId, shopId).eq(ShopTable::getId, shopTableClearDTO.getId()));
|
||||||
if (!ShopTableStatusEnum.CLEANING.equalsVal(shopTable.getStatus())) {
|
if (!ShopTableStatusEnum.SETTLED.equalsVal(shopTable.getStatus())) {
|
||||||
throw new ApiNotPrintException("台桌不处于待清台状态");
|
throw new ApiNotPrintException("台桌不处于待清台状态");
|
||||||
}
|
}
|
||||||
shopTable.setStatus(ShopTableStatusEnum.IDLE.getValue());
|
shopTable.setStatus(ShopTableStatusEnum.IDLE.getValue());
|
||||||
@@ -269,9 +294,21 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
|
|||||||
.eq(ShopTable::getId, shopTableClearDTO.getId()));
|
.eq(ShopTable::getId, shopTableClearDTO.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean expiredTable(long tableId) {
|
||||||
|
ShopTable shopTable = new ShopTable();
|
||||||
|
shopTable.setClearTime(null);
|
||||||
|
shopTable.setStatus(ShopTableStatusEnum.IDLE.getValue());
|
||||||
|
return update(shopTable, QueryWrapper.create().eq(ShopTable::getId, tableId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ShopTableVO> pageInfo(Long shopId, Integer areaId, String tableCode, String status, String name, Boolean isBind) {
|
public Page<ShopTableVO> pageInfo(Long shopId, Integer areaId, String tableCode, String status, String name, Boolean isBind) {
|
||||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||||
return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId, areaId, tableCode, status, name, isBind)));
|
List<ShopTableVO> shopTableVOS = mapper.pageInfo(shopId, areaId, tableCode, status, name, isBind);
|
||||||
|
for (ShopTableVO shopTableVO : shopTableVOS) {
|
||||||
|
shopTableVO.setStatusMsg(ShopTableStatusEnum.getMsgByValue(shopTableVO.getStatus()));
|
||||||
|
}
|
||||||
|
return PageUtil.convert(new PageInfo<>(shopTableVOS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,6 +341,11 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
if (shopInfo != null) {
|
if (shopInfo != null) {
|
||||||
shopUserDetailDTO.setShopName(shopInfo.getShopName());
|
shopUserDetailDTO.setShopName(shopInfo.getShopName());
|
||||||
shopUserDetailDTO.setShopId(shopInfo.getId());
|
shopUserDetailDTO.setShopId(shopInfo.getId());
|
||||||
|
|
||||||
|
ShopConfig config = shopConfigMapper.selectOneByQuery(new QueryWrapper().eq(ShopConfig::getId, shopId));
|
||||||
|
if (config != null) {
|
||||||
|
BeanUtil.copyProperties(config, shopInfo, "id");
|
||||||
|
}
|
||||||
shopUserDetailDTO.setShopInfo(shopInfo);
|
shopUserDetailDTO.setShopInfo(shopInfo);
|
||||||
List<ShopExtend> shopExtends = shopExtendService.list(new QueryWrapper().eq(ShopExtend::getShopId, shopInfo.getId()));
|
List<ShopExtend> shopExtends = shopExtendService.list(new QueryWrapper().eq(ShopExtend::getShopId, shopInfo.getId()));
|
||||||
shopUserDetailDTO.setShopExtendList(shopExtends);
|
shopUserDetailDTO.setShopExtendList(shopExtends);
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.czg.service.account.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.account.dto.menu.MenuAddDTO;
|
import com.czg.account.dto.menu.MenuAddDTO;
|
||||||
import com.czg.account.dto.menu.MenuEditDTO;
|
import com.czg.account.dto.menu.MenuEditDTO;
|
||||||
|
import com.czg.account.entity.CashMenu;
|
||||||
import com.czg.account.entity.SysMenu;
|
import com.czg.account.entity.SysMenu;
|
||||||
import com.czg.account.entity.SysUsersRoles;
|
import com.czg.account.entity.SysUsersRoles;
|
||||||
|
import com.czg.account.service.CashMenuService;
|
||||||
import com.czg.account.service.SysMenuService;
|
import com.czg.account.service.SysMenuService;
|
||||||
import com.czg.account.vo.MenuVO;
|
import com.czg.account.vo.MenuVO;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
@@ -34,11 +37,13 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
private SysMenuMapper sysMenuMapper;
|
private SysMenuMapper sysMenuMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private SysUsersRolesMapper sysUsersRolesMapper;
|
private SysUsersRolesMapper sysUsersRolesMapper;
|
||||||
|
@Resource
|
||||||
|
private CashMenuService cashMenuService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuVO> getMenu() {
|
public List<MenuVO> getMenu() {
|
||||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||||
List<SysMenu> allMenus = mapper.selectByUserId(sysUserId, null);
|
List<SysMenu> allMenus = mapper.selectByUserId(sysUserId, "PC".equals(StpKit.USER.getPlatForm()) ? 1 : 0);
|
||||||
List<SysUsersRoles> roleList = sysUsersRolesMapper.selectListByQuery(query().select(SysUsersRoles::getRoleId).eq(SysUsersRoles::getUserId, sysUserId));
|
List<SysUsersRoles> roleList = sysUsersRolesMapper.selectListByQuery(query().select(SysUsersRoles::getRoleId).eq(SysUsersRoles::getUserId, sysUserId));
|
||||||
List<Long> roleIdList = roleList.stream().map(SysUsersRoles::getRoleId).toList();
|
List<Long> roleIdList = roleList.stream().map(SysUsersRoles::getRoleId).toList();
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
@@ -98,7 +103,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
if (menuAddDTO.getType() == 3 && menuAddDTO.getPermission() == null) {
|
if (menuAddDTO.getType() == 3 && menuAddDTO.getPermission() == null) {
|
||||||
throw new ApiNotPrintException("权限不为空");
|
throw new ApiNotPrintException("权限不为空");
|
||||||
}
|
}
|
||||||
return save(BeanUtil.copyProperties(menuAddDTO, SysMenu.class));
|
SysMenu sysMenu = BeanUtil.copyProperties(menuAddDTO, SysMenu.class);
|
||||||
|
if (menuAddDTO.getApiInfo() != null && !menuAddDTO.getApiInfo().isEmpty()) {
|
||||||
|
sysMenu.setApiInfo(JSONObject.toJSONString(menuAddDTO.getApiInfo()));
|
||||||
|
}
|
||||||
|
return save(sysMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,6 +118,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
throw new ApiNotPrintException("菜单不存在");
|
throw new ApiNotPrintException("菜单不存在");
|
||||||
}
|
}
|
||||||
BeanUtil.copyProperties(menuEditDTO, menu);
|
BeanUtil.copyProperties(menuEditDTO, menu);
|
||||||
|
if (menuEditDTO.getApiInfo() != null && !menuEditDTO.getApiInfo().isEmpty()) {
|
||||||
|
menu.setApiInfo(JSONObject.toJSONString(menuEditDTO.getApiInfo()));
|
||||||
|
}
|
||||||
return updateById(menu);
|
return updateById(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,4 +181,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||||||
}
|
}
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CashMenu> getCashAll() {
|
||||||
|
return cashMenuService.list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.czg.service.account.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
|
import com.czg.account.dto.menu.MenuApiInfoItemDTO;
|
||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.RoleAddDTO;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
import com.czg.account.dto.role.RoleEditDTO;
|
||||||
import com.czg.account.entity.SysMenu;
|
import com.czg.account.dto.role.RolePermissionDTO;
|
||||||
import com.czg.account.entity.SysRole;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.entity.SysRolesMenus;
|
import com.czg.account.service.CashMenuService;
|
||||||
import com.czg.account.service.SysMenuService;
|
import com.czg.account.service.SysMenuService;
|
||||||
import com.czg.account.service.SysRoleService;
|
import com.czg.account.service.SysRoleService;
|
||||||
import com.czg.account.service.SysRolesMenusService;
|
import com.czg.account.service.SysRolesMenusService;
|
||||||
@@ -23,7 +25,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.mybatisflex.core.query.QueryMethods.column;
|
import static com.mybatisflex.core.query.QueryMethods.column;
|
||||||
|
|
||||||
@@ -39,12 +44,56 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||||||
private SysMenuService sysMenuService;
|
private SysMenuService sysMenuService;
|
||||||
@Resource
|
@Resource
|
||||||
private SysRolesMenusService sysRolesMenusService;
|
private SysRolesMenusService sysRolesMenusService;
|
||||||
|
@Resource
|
||||||
|
private CashMenuService cashMenuService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysRole> getByUserId(Long id) {
|
public List<SysRole> getByUserId(Long id) {
|
||||||
return mapper.selectByUserId(id);
|
return mapper.selectByUserId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将单个路径通配符转为 SQL LIKE 模式
|
||||||
|
*/
|
||||||
|
public static String toSqlLikePattern(String pathPattern) {
|
||||||
|
if (pathPattern == null) return null;
|
||||||
|
|
||||||
|
// 转义 SQL 特殊字符
|
||||||
|
String escaped = pathPattern
|
||||||
|
.replace("\\", "\\\\")
|
||||||
|
.replace("_", "\\_")
|
||||||
|
.replace("%", "\\%");
|
||||||
|
|
||||||
|
// 替换 ** 为占位,避免被 * 干扰
|
||||||
|
String placeholder = "@@DOUBLE_STAR@@";
|
||||||
|
escaped = escaped.replace("**", placeholder);
|
||||||
|
|
||||||
|
// 替换 * 为单层路径匹配
|
||||||
|
escaped = escaped.replace("*", "%");
|
||||||
|
|
||||||
|
// 替换 ? 为单字符匹配
|
||||||
|
escaped = escaped.replace("?", "_");
|
||||||
|
|
||||||
|
// 替换回 **
|
||||||
|
escaped = escaped.replace(placeholder, "%");
|
||||||
|
|
||||||
|
return escaped;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接多个路径通配符为 SQL OR 条件(适用于 MyBatis-Plus apply)
|
||||||
|
*/
|
||||||
|
public static String buildLikeSql(List<MenuApiInfoItemDTO> apiInfoItemDTOS, String columnName) {
|
||||||
|
// 永不成立
|
||||||
|
if (apiInfoItemDTOS == null || apiInfoItemDTOS.isEmpty()) {
|
||||||
|
return "1 = 0";
|
||||||
|
}
|
||||||
|
|
||||||
|
return apiInfoItemDTOS.stream()
|
||||||
|
.map(pattern -> StrUtil.format("({} LIKE '{}' ESCAPE '\\\\' and method = '{}')" , columnName, toSqlLikePattern(pattern.getUrl()), pattern.getMethod()))
|
||||||
|
.collect(Collectors.joining(" OR "));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<SysRole> getList(Long shopId, 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();
|
||||||
@@ -70,25 +119,91 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getRoleMenu(long userId, Integer id) {
|
public List<Long> getRoleMenu(long userId, Integer id, Integer type) {
|
||||||
SysRole role = queryChain().eq(SysRole::getId, id).eq(SysRole::getCreateUserId, userId).one();
|
SysRole role = queryChain().eq(SysRole::getId, id).eq(SysRole::getCreateUserId, userId).one();
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
throw new ApiNotPrintException("角色不存在");
|
throw new ApiNotPrintException("角色不存在");
|
||||||
}
|
}
|
||||||
return sysRolesMenusService.queryChain().eq(SysRolesMenus::getRoleId, id).list().stream().map(SysRolesMenus::getMenuId).toList();
|
|
||||||
|
return sysRolesMenusService.queryChain().eq(SysRolesMenus::getRoleId, id).eq(SysRolesMenus::getType, type).list().stream().map(SysRolesMenus::getMenuId).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addMenu(Long roleId, List<Long> menuIds) {
|
public boolean addMenu(Long roleId, List<Long> menuIds, boolean isAdmin) {
|
||||||
long count = sysMenuService.queryChain().in(SysMenu::getMenuId, menuIds).count();
|
List<MenuApiInfoItemDTO> apiPathList = new ArrayList<>();
|
||||||
if (count != menuIds.size()) {
|
List<SysRolesMenus> rolesMenus = new ArrayList<>();
|
||||||
throw new ApiNotPrintException("菜单id包含错误id");
|
|
||||||
|
// Step 1: 获取菜单列表并校验
|
||||||
|
List<? extends BaseMenu> menuList;
|
||||||
|
if (isAdmin) {
|
||||||
|
List<SysMenu> sysMenuList = sysMenuService.queryChain().in(SysMenu::getMenuId, menuIds).list();
|
||||||
|
menuList = sysMenuList;
|
||||||
|
} else {
|
||||||
|
List<CashMenu> cashMenuList = cashMenuService.queryChain().in(CashMenu::getMenuId, menuIds).list();
|
||||||
|
menuList = cashMenuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<SysRolesMenus> rolesMenus = new ArrayList<>();
|
int type = isAdmin ? 0 : 1;
|
||||||
for (Long id : menuIds) {
|
|
||||||
rolesMenus.add(new SysRolesMenus(id, roleId));
|
// Step 2: 解析 apiInfo 并判断菜单是否已绑定
|
||||||
|
for (BaseMenu menu : menuList) {
|
||||||
|
// 解析 apiInfo
|
||||||
|
if (StrUtil.isNotBlank(menu.getApiInfo())) {
|
||||||
|
List<MenuApiInfoItemDTO> itemDTOS = JSONArray.parseArray(menu.getApiInfo())
|
||||||
|
.toJavaList(MenuApiInfoItemDTO.class);
|
||||||
|
apiPathList.addAll(itemDTOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否已绑定
|
||||||
|
long count = sysRolesMenusService.count(new QueryWrapper()
|
||||||
|
.eq("menu_id", menu.getMenuId())
|
||||||
|
.eq("role_id", roleId)
|
||||||
|
.eq("type", type));
|
||||||
|
if (count == 0) {
|
||||||
|
rolesMenus.add(new SysRolesMenus(menu.getMenuId(), roleId, type));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return sysRolesMenusService.saveBatch(rolesMenus);
|
|
||||||
|
// Step 3: 匹配接口路径补充菜单(如 API 匹配到其他菜单)
|
||||||
|
if (!apiPathList.isEmpty()) {
|
||||||
|
String likeSql = buildLikeSql(apiPathList, "url");
|
||||||
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
|
wrapper.where(likeSql);
|
||||||
|
|
||||||
|
List<SysMenu> matchedMenus = sysMenuService.list(wrapper);
|
||||||
|
for (SysMenu matched : matchedMenus) {
|
||||||
|
long count = sysRolesMenusService.count(new QueryWrapper()
|
||||||
|
.eq("menu_id", matched.getMenuId())
|
||||||
|
.eq("role_id", roleId)
|
||||||
|
.eq("type", type));
|
||||||
|
if (count == 0) {
|
||||||
|
rolesMenus.add(new SysRolesMenus(matched.getMenuId(), roleId, type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 4: 批量保存(如有数据)
|
||||||
|
return rolesMenus.isEmpty() || sysRolesMenusService.saveBatch(rolesMenus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO) {
|
||||||
|
long count = count(new QueryWrapper().eq(SysRole::getId, rolePermissionDTO.getRoleId()).eq(SysRole::getCreateUserId, userId));
|
||||||
|
if (count == 0) {
|
||||||
|
throw new ApiNotPrintException("角色不存在");
|
||||||
|
}
|
||||||
|
sysRolesMenusService.updateChain().eq(SysRolesMenus::getRoleId, rolePermissionDTO.getRoleId()).remove();
|
||||||
|
|
||||||
|
if (rolePermissionDTO.getAdminMenuIdList() != null && !rolePermissionDTO.getAdminMenuIdList().isEmpty()) {
|
||||||
|
addMenu(rolePermissionDTO.getRoleId(), rolePermissionDTO.getAdminMenuIdList(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rolePermissionDTO.getCashMenuIdList() != null && !rolePermissionDTO.getCashMenuIdList().isEmpty()) {
|
||||||
|
addMenu(rolePermissionDTO.getRoleId(), rolePermissionDTO.getCashMenuIdList(), false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,7 +225,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||||||
sysRole.setCreateTime(DateUtil.date().toLocalDateTime());
|
sysRole.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||||
boolean save = save(sysRole);
|
boolean save = save(sysRole);
|
||||||
if (save) {
|
if (save) {
|
||||||
return addMenu(sysRole.getId(), roleAddDTO.menuIdList());
|
if (roleAddDTO.adminMenuIdList() != null && !roleAddDTO.adminMenuIdList().isEmpty()) {
|
||||||
|
addMenu(sysRole.getId(), roleAddDTO.adminMenuIdList(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roleAddDTO.cashMenuIdList() != null && !roleAddDTO.cashMenuIdList().isEmpty()) {
|
||||||
|
addMenu(sysRole.getId(), roleAddDTO.cashMenuIdList(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ApiNotPrintException("保存失败");
|
throw new ApiNotPrintException("保存失败");
|
||||||
@@ -134,8 +255,16 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||||||
boolean b = updateById(role);
|
boolean b = updateById(role);
|
||||||
if (b) {
|
if (b) {
|
||||||
sysRolesMenusService.updateChain().eq(SysRolesMenus::getRoleId, role.getId()).remove();
|
sysRolesMenusService.updateChain().eq(SysRolesMenus::getRoleId, role.getId()).remove();
|
||||||
return addMenu(role.getId(), roleEditDTO.getMenuIdList());
|
|
||||||
|
if (roleEditDTO.getAdminMenuIdList() != null && !roleEditDTO.getAdminMenuIdList().isEmpty()) {
|
||||||
|
addMenu(role.getId(), roleEditDTO.getAdminMenuIdList(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (roleEditDTO.getCashMenuIdList() != null && !roleEditDTO.getCashMenuIdList().isEmpty()) {
|
||||||
|
addMenu(role.getId(), roleEditDTO.getCashMenuIdList(), false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
throw new ApiNotPrintException("保存失败");
|
throw new ApiNotPrintException("保存失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
|
|||||||
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
|
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
|
||||||
userInfoService.saveOrUpdate(userInfo);
|
userInfoService.saveOrUpdate(userInfo);
|
||||||
// StpKit.USER.login(userInfo.getId());
|
// StpKit.USER.login(userInfo.getId());
|
||||||
StpKit.USER.login(userInfo.getId(), openId, null, null, MyStpLogic.LoginType.USER, false);
|
StpKit.USER.login(userInfo.getId(), openId, null, null, MyStpLogic.LoginType.USER, false, "userMini");
|
||||||
return new LoginTokenDTO(StpKit.USER.getTokenValue(), userInfo);
|
return new LoginTokenDTO(StpKit.USER.getTokenValue(), userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?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.czg.service.account.mapper.CashMenuMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
left join sys_menu as c on c.menu_id = b.menu_id
|
left join sys_menu as c on c.menu_id = b.menu_id
|
||||||
where a.user_id = #{userId} and c.menu_id is not null
|
where a.user_id = #{userId} and c.menu_id is not null
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
and c.type=#{type}
|
and b.type=#{type}
|
||||||
</if>
|
</if>
|
||||||
order by menu_sort desc
|
order by menu_sort desc
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
|||||||
data.setCashPayCount(count.getOrDefault(PayEnums.CASH_PAY.getValue(), 0L));
|
data.setCashPayCount(count.getOrDefault(PayEnums.CASH_PAY.getValue(), 0L));
|
||||||
data.setCreditPayAmount(sum.getOrDefault(PayEnums.CREDIT_PAY.getValue(), BigDecimal.ZERO));
|
data.setCreditPayAmount(sum.getOrDefault(PayEnums.CREDIT_PAY.getValue(), BigDecimal.ZERO));
|
||||||
data.setCreditPayCount(count.getOrDefault(PayEnums.CREDIT_PAY.getValue(), 0L));
|
data.setCreditPayCount(count.getOrDefault(PayEnums.CREDIT_PAY.getValue(), 0L));
|
||||||
|
data.setBackScanPayAmount(sum.getOrDefault(PayEnums.BACK_SCAN.getValue(), BigDecimal.ZERO));
|
||||||
|
data.setBackScanPayCount(count.getOrDefault(PayEnums.BACK_SCAN.getValue(), 0L));
|
||||||
|
data.setH5PayAmount(sum.getOrDefault(PayEnums.H5_PAY.getValue(), BigDecimal.ZERO));
|
||||||
|
data.setH5PayCount(count.getOrDefault(PayEnums.H5_PAY.getValue(), 0L));
|
||||||
|
|
||||||
//List<Map<String, Object>> list1 = shopOrderStatisticMapper.getVipRechargeAmountCount(param);
|
//List<Map<String, Object>> list1 = shopOrderStatisticMapper.getVipRechargeAmountCount(param);
|
||||||
List<Map<String, Object>> list1 = (List<Map<String, Object>>) collect.get("getVipRechargeAmountCount");
|
List<Map<String, Object>> list1 = (List<Map<String, Object>>) collect.get("getVipRechargeAmountCount");
|
||||||
Map<String, BigDecimal> sum1 = list1.stream().collect(Collectors.toMap(item -> Convert.toStr(item.get("bizCode")), item -> Convert.toBigDecimal(item.get("amount"))));
|
Map<String, BigDecimal> sum1 = list1.stream().collect(Collectors.toMap(item -> Convert.toStr(item.get("bizCode")), item -> Convert.toBigDecimal(item.get("amount"))));
|
||||||
@@ -95,8 +100,8 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
|||||||
data.setRechargeRefundAmount(sum1.getOrDefault("rechargeRefund", BigDecimal.ZERO).abs());
|
data.setRechargeRefundAmount(sum1.getOrDefault("rechargeRefund", BigDecimal.ZERO).abs());
|
||||||
data.setMemberPayAmount(sum1.getOrDefault("orderPay", BigDecimal.ZERO).abs());
|
data.setMemberPayAmount(sum1.getOrDefault("orderPay", BigDecimal.ZERO).abs());
|
||||||
data.setMemberPayCount(count1.getOrDefault("orderPay", 0L));
|
data.setMemberPayCount(count1.getOrDefault("orderPay", 0L));
|
||||||
data.setSaleAmount(NumberUtil.add(data.getWechatPayAmount(), data.getAliPayAmount(), data.getScanPayAmount(), data.getCashPayAmount(), data.getCreditPayAmount()));
|
data.setSaleAmount(NumberUtil.add(data.getWechatPayAmount(), data.getAliPayAmount(), data.getScanPayAmount(), data.getCashPayAmount(), data.getCreditPayAmount(),data.getBackScanPayAmount(),data.getH5PayAmount()));
|
||||||
data.setSaleCount(NumberUtil.add(data.getWechatPayCount(), data.getAliPayCount(), data.getScanPayCount(), data.getCashPayCount(), data.getCreditPayCount()).longValue());
|
data.setSaleCount(NumberUtil.add(data.getWechatPayCount(), data.getAliPayCount(), data.getScanPayCount(), data.getCashPayCount(), data.getCreditPayCount(),data.getBackScanPayCount(),data.getH5PayCount()).longValue());
|
||||||
BigDecimal refundAmount = list.stream().filter(item -> item.get("payType") != null).map(item -> Convert.toBigDecimal(item.get("refund"), BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add);
|
BigDecimal refundAmount = list.stream().filter(item -> item.get("payType") != null).map(item -> Convert.toBigDecimal(item.get("refund"), BigDecimal.ZERO)).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
data.setRefundAmount(refundAmount);
|
data.setRefundAmount(refundAmount);
|
||||||
long refundCount = list.stream().filter(item -> item.get("payType") != null).map(item -> Convert.toLong(item.get("refundCount"), 0L)).reduce(0L, Long::sum);
|
long refundCount = list.stream().filter(item -> item.get("payType") != null).map(item -> Convert.toLong(item.get("refundCount"), 0L)).reduce(0L, Long::sum);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.czg.service.order.service.impl;
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.exceptions.ValidateException;
|
import cn.hutool.core.exceptions.ValidateException;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.*;
|
import cn.hutool.core.util.*;
|
||||||
@@ -14,6 +16,7 @@ import com.czg.config.RabbitPublisher;
|
|||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||||
|
import com.czg.enums.ShopTableStatusEnum;
|
||||||
import com.czg.enums.ShopUserFlowBizEnum;
|
import com.czg.enums.ShopUserFlowBizEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
@@ -61,6 +64,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkParams.MAX_RETRIES;
|
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkParams.MAX_RETRIES;
|
||||||
|
|
||||||
@@ -119,6 +123,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param) {
|
public Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param) {
|
||||||
|
List<ShopInfo> list = shopInfoService.list(QueryWrapper.create().select(ShopInfo::getId, ShopInfo::getShopName));
|
||||||
|
Map<Long, String> shopMap = list.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
|
||||||
String productName = param.getProductName();
|
String productName = param.getProductName();
|
||||||
List<Long> like = null;
|
List<Long> like = null;
|
||||||
if (StrUtil.isNotBlank(productName)) {
|
if (StrUtil.isNotBlank(productName)) {
|
||||||
@@ -151,6 +157,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
.eq(OrderDetail::getOrderId, s.getId())
|
.eq(OrderDetail::getOrderId, s.getId())
|
||||||
.listAs(OrderDetailSmallVO.class);
|
.listAs(OrderDetailSmallVO.class);
|
||||||
s.setGoods(orderDetails);
|
s.setGoods(orderDetails);
|
||||||
|
s.setShopName(shopMap.get(Long.parseLong(s.getShopId())));
|
||||||
});
|
});
|
||||||
return orderInfoVoPage;
|
return orderInfoVoPage;
|
||||||
}
|
}
|
||||||
@@ -249,6 +256,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
} else {
|
} else {
|
||||||
param.setPayMode("未知");
|
param.setPayMode("未知");
|
||||||
}
|
}
|
||||||
|
table.setStatus(ShopTableStatusEnum.UNSETTLED.getValue());
|
||||||
|
shopTableService.updateById(table);
|
||||||
}
|
}
|
||||||
List<OrderDetail> orderDetails = cartService.getCartByTableCode(shopInfo.getId(), param.getTableCode(), param.getPlaceNum());
|
List<OrderDetail> orderDetails = cartService.getCartByTableCode(shopInfo.getId(), param.getTableCode(), param.getPlaceNum());
|
||||||
AssertUtil.isListEmpty(orderDetails, "下单失败 购物车为空");
|
AssertUtil.isListEmpty(orderDetails, "下单失败 购物车为空");
|
||||||
@@ -787,6 +796,20 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getTableCode())) {
|
||||||
|
ShopTable table = shopTableService.getOneByTableCode(orderInfo.getShopId(), orderInfo.getTableCode());
|
||||||
|
if (table != null) {
|
||||||
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
|
if ("auto".equals(shopInfo.getTableClearType())) {
|
||||||
|
table.setStatus(ShopTableStatusEnum.IDLE.getValue());
|
||||||
|
} else {
|
||||||
|
DateTime dateTime = DateUtil.offsetMinute(DateUtil.date(), shopInfo.getTableClearTime());
|
||||||
|
table.setCreateTime(LocalDateTimeUtil.of(dateTime));
|
||||||
|
redisService.set(RedisCst.classKeyExpired.EXPIRED_TABLE + table.getId(), "", 60L * shopInfo.getTableClearTime());
|
||||||
|
}
|
||||||
|
shopTableService.updateById(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
|
orderDetailService.updateChain().set(OrderDetail::getStatus, OrderStatusEnums.DONE.getCode()).eq(OrderDetail::getOrderId, orderInfo.getId()).update();
|
||||||
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
// if (!"after-pay".equals(orderInfo.getPayMode())) {
|
||||||
//发送打票信息
|
//发送打票信息
|
||||||
@@ -808,6 +831,14 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
updateChain().set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
|
updateChain().set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
|
||||||
.where(OrderInfo::getId).eq(orderId)
|
.where(OrderInfo::getId).eq(orderId)
|
||||||
.update();
|
.update();
|
||||||
|
|
||||||
|
if (StrUtil.isNotBlank(orderInfo.getTableCode())) {
|
||||||
|
ShopTable table = shopTableService.getOneByTableCode(orderInfo.getShopId(), orderInfo.getTableCode());
|
||||||
|
if (table != null) {
|
||||||
|
table.setStatus(ShopTableStatusEnum.IDLE.getValue());
|
||||||
|
shopTableService.updateById(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
rabbitPublisher.sendOrderCancelMsg(orderId.toString());
|
rabbitPublisher.sendOrderCancelMsg(orderId.toString());
|
||||||
} else {
|
} else {
|
||||||
log.info("订单取消失败,订单Id:{},订状态:{}", orderInfo.getId(), orderInfo.getStatus());
|
log.info("订单取消失败,订单Id:{},订状态:{}", orderInfo.getId(), orderInfo.getStatus());
|
||||||
|
|||||||
@@ -41,13 +41,13 @@
|
|||||||
group by shop_id
|
group by shop_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getNewMemberCount" resultType="java.lang.Long">
|
<select id="getNewMemberCount" resultType="java.lang.Long">
|
||||||
select count(1) from tb_shop_user where shop_id = #{shopId}
|
select count(1) from tb_shop_user where shop_id = #{shopId} and is_vip = 1
|
||||||
<if test="beginDate != null and beginDate != ''">
|
<if test="beginDate != null and beginDate != ''">
|
||||||
and create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
|
and join_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
|
||||||
</if>
|
</if>
|
||||||
<if test="endDate != null and endDate != ''">
|
<if test="endDate != null and endDate != ''">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
and create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
|
and join_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
|
||||||
]]>
|
]]>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user