Merge branch 'master' into jxfk
# Conflicts: # pjcloud-upms/pjcloud-upms-api/src/main/java/com/bsd/pjcloud/admin/api/vo/SimpleUserListVO.java
This commit is contained in:
commit
f239198c07
205 files changed
+7308
-1253
No files matched your search
+1
-1
@@ -33,6 +33,6 @@ create database `pjcloudx_thirdparty` default character set utf8mb4 collate utf8
|
||||
create database `pjcloudx_canteen` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_erp` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_supermarket` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_supermarket_erp` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_integrated` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `pjcloudx_hardware` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
+141
-21
@@ -52,11 +52,13 @@ CREATE TABLE hard_door_manager
|
||||
power_status int DEFAULT NULL COMMENT '1:通电;2:断电',
|
||||
net_status int DEFAULT NULL COMMENT '在线状态。1:在线;2:离线',
|
||||
sale_status int DEFAULT NULL COMMENT '售卖状态。1:在售;2:停售',
|
||||
sim_sn varchar(32) NOT NULL COMMENT 'sim 卡号。设备有上报会返回,若一次上报都没有,则返回 null',
|
||||
signal_intensity int DEFAULT NULL COMMENT 'sim 信号强度。大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差;',
|
||||
signal_ratio int DEFAULT NULL COMMENT '信噪比,体现信道传输质量的参数。大于 15 表示质量好;15 到 0 表示质量中等;小于等于 0 表示质量差;',
|
||||
signal_time int DEFAULT NULL COMMENT 'sim 信号值更新时间。yyyy-MM-dd HH:mm:ss',
|
||||
cabinet_list text DEFAULT NULL COMMENT '货柜列表JSON',
|
||||
signal_time datetime DEFAULT NULL COMMENT 'sim 信号值更新时间。yyyy-MM-dd HH:mm:ss',
|
||||
restart_time datetime DEFAULT NULL COMMENT '上次重启时间',
|
||||
system_volume int DEFAULT 0 COMMENT '系统音量',
|
||||
media_volume int DEFAULT 0 COMMENT '媒体音量',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
@@ -68,6 +70,87 @@ CREATE TABLE hard_door_manager
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='柜子设备管理';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_door_cabinet
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `hard_door_cabinet`;
|
||||
CREATE TABLE hard_door_cabinet
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
hard_door_id bigint NOT NULL COMMENT '智能柜编号',
|
||||
cabinet_no int NOT NULL COMMENT '货柜编号(1,2)',
|
||||
is_lock_online varchar(16) NOT NULL COMMENT '锁在线1:在线;2:离线;',
|
||||
lock_status int NOT NULL COMMENT '锁状态1:开锁;2:关锁;',
|
||||
door_status int NOT NULL COMMENT '门状态1:门关;2:门开',
|
||||
sale_status int NOT NULL COMMENT '货柜售卖状态1:在售;2:停售',
|
||||
qr_code varchar(256) DEFAULT NULL COMMENT '二维码',
|
||||
# 其他字段
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='智能柜货柜';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_door_flow
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `hard_door_flow`;
|
||||
CREATE TABLE hard_door_flow
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户编号',
|
||||
biz_type varchar(32) NOT NULL COMMENT '业务类型',
|
||||
hard_id bigint DEFAULT NULL COMMENT '硬件id',
|
||||
hard_door_id bigint DEFAULT NULL COMMENT '智能柜id',
|
||||
cabinet_no int DEFAULT NULL COMMENT '货柜编号',
|
||||
order_id bigint DEFAULT NULL COMMENT '订单编号',
|
||||
auth_id bigint DEFAULT NULL COMMENT '授权编号',
|
||||
# 请求开门
|
||||
request_open_dto text DEFAULT NULL COMMENT '请求开门参数',
|
||||
request_open_vo text DEFAULT NULL COMMENT '请求开门返回',
|
||||
request_open_time datetime DEFAULT NULL COMMENT '请求开门时间',
|
||||
# 请求开门回调
|
||||
is_open varchar(32) DEFAULT NULL COMMENT '是否开门',
|
||||
open_callback_time datetime DEFAULT NULL COMMENT '开门回调时间',
|
||||
open_callback_vo text DEFAULT NULL COMMENT '开门回调结果',
|
||||
# 视频回调
|
||||
video_callback_vo text DEFAULT NULL COMMENT '视频回调结果',
|
||||
video_callback_time datetime DEFAULT NULL COMMENT '视频回调时间',
|
||||
# sku识别
|
||||
sku_submit_dto text DEFAULT NULL COMMENT 'sku识别提交参数',
|
||||
sku_submit_vo text DEFAULT NULL COMMENT 'sku识别提交结果',
|
||||
sku_submit_recog_id varchar(32) DEFAULT NULL COMMENT 'sku识别提交id(用于查询)',
|
||||
sku_submit_time datetime DEFAULT NULL COMMENT 'sku识别提交时间',
|
||||
# sku识别回调
|
||||
sku_callback_vo text DEFAULT NULL COMMENT 'sku识别回调结果',
|
||||
sku_callback_time datetime DEFAULT NULL COMMENT 'sku识别回调时间',
|
||||
# sku主动获取
|
||||
sku_driving_dto text DEFAULT NULL COMMENT 'sku识别主动获取参数',
|
||||
sku_driving_vo text DEFAULT NULL COMMENT 'sku识别主动获取结果',
|
||||
sku_driving_time datetime DEFAULT NULL COMMENT 'sku识别主动获取时间',
|
||||
# 流程相关
|
||||
flow_status varchar(32) DEFAULT NULL COMMENT '流程状态',
|
||||
error text DEFAULT NULL COMMENT '流程错误信息',
|
||||
error_desc varchar(64) DEFAULT NULL COMMENT '流程错误描述(展示)',
|
||||
# 购买成功
|
||||
pay_time datetime DEFAULT NULL COMMENT '购买成功时间',
|
||||
# 其他字段
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='柜子订单流程';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_group
|
||||
-- ----------------------------
|
||||
@@ -266,6 +349,7 @@ CREATE TABLE hard_broadcast
|
||||
user_id bigint NOT NULL COMMENT '预定用户',
|
||||
hard_id bigint NOT NULL COMMENT '硬件id',
|
||||
topic varchar(128) NOT NULL COMMENT 'mq主题',
|
||||
biz_type varchar(64) NOT NULL COMMENT '关联业务类型',
|
||||
biz_id varchar(64) NOT NULL COMMENT '关联业务编号',
|
||||
title varchar(64) NOT NULL COMMENT '预定标题',
|
||||
content varchar(128) NOT NULL COMMENT '广播内容',
|
||||
@@ -283,26 +367,53 @@ CREATE TABLE hard_broadcast
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB COMMENT ='设备广播';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS hard_appt;
|
||||
CREATE TABLE hard_appt
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
title varchar(64) NOT NULL COMMENT '标题',
|
||||
start_time time DEFAULT NULL COMMENT '开始时间',
|
||||
end_time time DEFAULT NULL COMMENT '结束时间',
|
||||
hour_type varchar(32) NOT NULL COMMENT '唯一标识',
|
||||
sort int DEFAULT 0 NOT NULL COMMENT '排序',
|
||||
status varchar(32) NOT NULL COMMENT '状态',
|
||||
remark varchar(256) DEFAULT NULL COMMENT '备注',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB COMMENT ='设备预约管理';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_auth
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS hard_auth;
|
||||
CREATE TABLE hard_auth
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
auth_type varchar(32) DEFAULT NULL COMMENT '授权类型如微信小程序、支付宝、浙政钉',
|
||||
user_id bigint NOT NULL COMMENT '预定用户',
|
||||
hard_id bigint NOT NULL COMMENT '硬件id',
|
||||
auth_status char(1) DEFAULT '0' COMMENT '是否授权',
|
||||
auth_time datetime DEFAULT NULL COMMENT '授权时间',
|
||||
is_done char(1) DEFAULT '0' COMMENT '是否完成',
|
||||
is_done_time datetime DEFAULT NULL COMMENT '完成时间',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
auth_type varchar(32) DEFAULT NULL COMMENT '授权类型如微信小程序、支付宝、浙政钉',
|
||||
user_id bigint NOT NULL COMMENT '预定用户',
|
||||
hard_id bigint NOT NULL COMMENT '硬件id',
|
||||
cabinet_no int DEFAULT NULL COMMENT '货柜编号',
|
||||
auth_status char(1) DEFAULT '0' COMMENT '是否授权',
|
||||
auth_time datetime DEFAULT NULL COMMENT '授权时间',
|
||||
is_done char(1) DEFAULT '0' COMMENT '是否完成',
|
||||
is_done_time datetime DEFAULT NULL COMMENT '完成时间',
|
||||
is_manual_change varchar(32) DEFAULT NULL COMMENT '是否人工处理',
|
||||
manual_change_user_id bigint DEFAULT NULL COMMENT '人工处理用户id',
|
||||
manual_change_time datetime DEFAULT NULL COMMENT '人工处理时间',
|
||||
manual_change_remark varchar(128) DEFAULT NULL COMMENT '人工处理备注',
|
||||
manual_change_pic varchar(512) DEFAULT NULL COMMENT '人工处理图片',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB COMMENT ='硬件授权';
|
||||
|
||||
@@ -313,9 +424,10 @@ DROP TABLE IF EXISTS hard_spu;
|
||||
CREATE TABLE hard_spu
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
spu_category_id bigint NOT NULL COMMENT '商品分类id',
|
||||
spu_category_id bigint DEFAULT NULL COMMENT '商品分类id',
|
||||
name varchar(64) NOT NULL COMMENT '商品名',
|
||||
pic varchar(256) NOT NULL COMMENT '商品图片',
|
||||
cover varchar(256) NOT NULL COMMENT '商品封面图片',
|
||||
pic varchar(1024) NOT NULL COMMENT '商品图片用于识别',
|
||||
price int NOT NULL COMMENT '单价(分)',
|
||||
sales_count int DEFAULT 0 NOT NULL COMMENT '销量',
|
||||
repertory_count int DEFAULT 0 NOT NULL COMMENT '库存',
|
||||
@@ -325,13 +437,16 @@ CREATE TABLE hard_spu
|
||||
specs_taste varchar(128) DEFAULT NULL COMMENT '规格-口味',
|
||||
specs_capacity varchar(128) DEFAULT NULL COMMENT '规格-容量',
|
||||
specs_weight varchar(128) DEFAULT NULL COMMENT '规格-重量',
|
||||
sku_type varchar(32) DEFAULT NULL COMMENT 'sku类型,0:标准库;1:私有库 ',
|
||||
sku_type varchar(32) DEFAULT NULL COMMENT 'sku类型,0:标准库;1:私有库',
|
||||
ks_sku_id varchar(32) DEFAULT NULL COMMENT '旷世skuid',
|
||||
ks_res_sku_id varchar(32) DEFAULT NULL COMMENT '旷世返回的业务方sku_id',
|
||||
ks_barcode varchar(32) DEFAULT NULL COMMENT '69码',
|
||||
ks_has_sub_sku varchar(128) DEFAULT NULL COMMENT '是否为集合SKU',
|
||||
ks_sub_sku text DEFAULT NULL COMMENT '集合SKU的子SKU信息',
|
||||
ks_sub_sku_json text DEFAULT NULL COMMENT '集合SKU的子SKU信息JSON',
|
||||
ks_status char(1) DEFAULT NULL COMMENT '旷世审核状态',
|
||||
ks_status_title varchar(64) DEFAULT NULL COMMENT '旷世审核状态标题',
|
||||
ks_comments varchar(512) DEFAULT NULL COMMENT '旷世审核状态描述',
|
||||
version int DEFAULT 0 NOT NULL COMMENT '乐观锁',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
@@ -352,6 +467,9 @@ CREATE TABLE hard_spu_join
|
||||
cabinet_no varchar(32) DEFAULT NULL COMMENT '货柜编号',
|
||||
spu_id bigint DEFAULT NULL COMMENT '商品id',
|
||||
hard_door_number int DEFAULT NULL COMMENT '商品放置层数',
|
||||
version bigint DEFAULT 0 COMMENT '乐观锁',
|
||||
sales_count bigint DEFAULT 0 COMMENT '销量',
|
||||
repertory_count bigint NOT NULL DEFAULT 0 COMMENT '库存',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
@@ -389,10 +507,12 @@ CREATE TABLE hard_spu_repertory
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
hard_id bigint NOT NULL COMMENT '设备id',
|
||||
hard_door_id bigint NOT NULL COMMENT '智能柜编号',
|
||||
cabinet_no int NOT NULL COMMENT '货柜编号(1,2)',
|
||||
spu_id bigint NOT NULL COMMENT '商品id',
|
||||
before_count int NOT NULL COMMENT '更新前的库存数量',
|
||||
count int DEFAULT 0 COMMENT '更新库存数量',
|
||||
biz_id bigint DEFAULT NULL COMMENT '上架业务关联id',
|
||||
biz_type tinytext NOT NULL COMMENT '上架类型',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
@@ -1,5 +1,35 @@
|
||||
create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_transaction
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS sys_user_transaction;
|
||||
CREATE TABLE `sys_user_transaction`
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
biz_id bigint DEFAULT NULL COMMENT '业务id',
|
||||
biz_type varchar(32) NOT NULL COMMENT '业务类型',
|
||||
# 岗位调动字段
|
||||
source_dept_id bigint DEFAULT NULL COMMENT '源部门id',
|
||||
target_dept_id bigint DEFAULT NULL COMMENT '目标部门id',
|
||||
# 离职字段
|
||||
is_wallet_transaction varchar(32) DEFAULT NULL COMMENT '是否离职自动转账',
|
||||
wallet_transaction_time datetime DEFAULT NULL COMMENT '离职自动转账时间',
|
||||
# 审批字读
|
||||
process_id varchar(256) DEFAULT NULL COMMENT '流程id',
|
||||
process_status varchar(10) DEFAULT NULL COMMENT '审核状体',
|
||||
process_time datetime DEFAULT NULL COMMENT '审核时间',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='人员调动表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_face
|
||||
@@ -415,6 +445,7 @@ CREATE TABLE wallet_code_use
|
||||
status char(1) DEFAULT '0' NOT NULL COMMENT '是否使用',
|
||||
code varchar(1024) DEFAULT NULL COMMENT '二维码',
|
||||
code_content varchar(1024) DEFAULT NULL COMMENT '二维码内容',
|
||||
short_code varchar(32) DEFAULT '' COMMENT '短码',
|
||||
use_time timestamp NULL COMMENT '使用时间',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.bsd.pjcloud.canteen.dto;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CanteenDailyMenuCVDTO {
|
||||
|
||||
/**
|
||||
* 原商户id
|
||||
*/
|
||||
@NotNull
|
||||
private Long sourceMerchantId;
|
||||
|
||||
|
||||
/**
|
||||
* 目标商户id
|
||||
*/
|
||||
@NotNull
|
||||
private List<Long> targetMerchantId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@NotNull
|
||||
private LocalDate startTime;
|
||||
}
|
||||
+12
@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenDailyMenuCVDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
@@ -108,6 +109,14 @@ public class CanteenDailyMenuController {
|
||||
return R.ok(canteenDailyMenuService.updateById(canteenDailyMenu));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "一键复制", description = "一键复制")
|
||||
@SysLog("一键复制")
|
||||
@PostMapping("/cv")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')")
|
||||
public R cv(@RequestBody CanteenDailyMenuCVDTO creenDailyMenuCVDTO) {
|
||||
return canteenDailyMenuService.cv(creenDailyMenuCVDTO);
|
||||
}
|
||||
/**
|
||||
* 通过id删除每日菜谱
|
||||
*
|
||||
@@ -214,4 +223,7 @@ public class CanteenDailyMenuController {
|
||||
}
|
||||
return R.ok(canteenDailyMenuService.selectTimeFood(time, merchantId, categoryId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-5
@@ -54,11 +54,7 @@ public class CanteenSpuController {
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
public R getCanteenSpuPage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
|
||||
wrapper.orderByAsc(CanteenSpuEntity::getSort);
|
||||
return R.ok(canteenSpuService.pageScope(page, wrapper));
|
||||
return R.ok(canteenSpuService.pageScope(page, canteenSpu));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.canteen.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.vo.ADCanteenDailyMenuListVO;
|
||||
import com.bsd.pjcloud.canteen.vo.DailyMenuVO;
|
||||
import com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
@@ -27,4 +30,8 @@ public interface CanteenDailyMenuMapper extends PjcloudBaseMapper<CanteenDailyMe
|
||||
*/
|
||||
List<ADCanteenDailyMenuListVO> getCanteenMenuList(@Param("day") String day, @Param("hourType") Integer hourType,
|
||||
@Param("categoryId") Long categoryId, @Param("merchantId") Long merchantId,DataScope dataScope);
|
||||
|
||||
|
||||
|
||||
Page<DailyMenuAppVO> selectTimeFoodPage(@Param("page")Page page, DailyMenuDTO dailyMenuDTO);
|
||||
}
|
||||
+10
@@ -2,10 +2,12 @@ package com.bsd.pjcloud.canteen.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenDailyMenuCVDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
import com.bsd.pjcloud.canteen.vo.ADCanteenDailyMenuListVO;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -50,4 +52,12 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
List<ADCanteenDailyMenuListVO> getCanteenMenuListScope(String day, Integer hourType, Long categoryId, Long merchantId);
|
||||
|
||||
Page selectTimeFoodPage(Page page, DailyMenuDTO dailyMenuDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 一键复制
|
||||
* @param creenDailyMenuCVDTO
|
||||
* @return
|
||||
*/
|
||||
R cv(CanteenDailyMenuCVDTO creenDailyMenuCVDTO);
|
||||
}
|
||||
+2
-2
@@ -38,10 +38,10 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper);
|
||||
Object pageScope(Page page, CanteenSpuEntity canteenSpu);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+71
-73
@@ -5,6 +5,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenDailyMenuCVDTO;
|
||||
import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenSpuEntity;
|
||||
@@ -99,30 +100,30 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveToday(CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
List<Long> spuIds = Optional.ofNullable(canteenDailyMenu.getSpuIds()).orElse(Collections.emptyList());
|
||||
if (spuIds.isEmpty()) return;
|
||||
List<Long> spuIds = Optional.ofNullable(canteenDailyMenu.getSpuIds()).orElse(Collections.emptyList());
|
||||
if (spuIds.isEmpty()) return;
|
||||
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> queryWrapper = new LambdaQueryWrapper<CanteenDailyMenuEntity>()
|
||||
.eq(CanteenDailyMenuEntity::getMerchantId, canteenDailyMenu.getMerchantId())
|
||||
.eq(CanteenDailyMenuEntity::getStartTime, canteenDailyMenu.getStartTime())
|
||||
.eq(CanteenDailyMenuEntity::getHourType, canteenDailyMenu.getHourType())
|
||||
.select(CanteenDailyMenuEntity::getSpuId); // 仅查询必要字段
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> queryWrapper = new LambdaQueryWrapper<CanteenDailyMenuEntity>()
|
||||
.eq(CanteenDailyMenuEntity::getMerchantId, canteenDailyMenu.getMerchantId())
|
||||
.eq(CanteenDailyMenuEntity::getStartTime, canteenDailyMenu.getStartTime())
|
||||
.eq(CanteenDailyMenuEntity::getHourType, canteenDailyMenu.getHourType())
|
||||
.select(CanteenDailyMenuEntity::getSpuId); // 仅查询必要字段
|
||||
|
||||
List<Long> existSpuIds = baseMapper.selectList(queryWrapper)
|
||||
.stream()
|
||||
.map(CanteenDailyMenuEntity::getSpuId)
|
||||
.collect(Collectors.toList());
|
||||
List<Long> existSpuIds = baseMapper.selectList(queryWrapper)
|
||||
.stream()
|
||||
.map(CanteenDailyMenuEntity::getSpuId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CanteenDailyMenuEntity> insertList = spuIds.stream()
|
||||
.filter(id -> !existSpuIds.contains(id))
|
||||
.map(id -> {
|
||||
CanteenDailyMenuEntity entity = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(canteenDailyMenu, entity);
|
||||
entity.setSpuId(id);
|
||||
return entity;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
saveBatch(insertList);
|
||||
List<CanteenDailyMenuEntity> insertList = spuIds.stream()
|
||||
.filter(id -> !existSpuIds.contains(id))
|
||||
.map(id -> {
|
||||
CanteenDailyMenuEntity entity = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(canteenDailyMenu, entity);
|
||||
entity.setSpuId(id);
|
||||
return entity;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
saveBatch(insertList);
|
||||
|
||||
// 发送mq消息
|
||||
sendMqttMsg(canteenDailyMenu.getMerchantId());
|
||||
@@ -143,60 +144,57 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
|
||||
@Override
|
||||
public Page selectTimeFoodPage(Page page, DailyMenuDTO dailyMenuDTO) {
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> canteenDailyMenuEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(CanteenDailyMenuEntity::getMerchantId, dailyMenuDTO.getMerchantId());
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(CanteenDailyMenuEntity::getStartTime, dailyMenuDTO.getStartTime());
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(dailyMenuDTO.getHourType() != null,
|
||||
CanteenDailyMenuEntity::getHourType, dailyMenuDTO.getHourType());
|
||||
|
||||
//查询
|
||||
LambdaQueryWrapper<CanteenSpuEntity> onlineFoodSpuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null != dailyMenuDTO.getCategoryId(), CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(CanteenSpuEntity::getIsShow, "1");
|
||||
List<CanteenSpuEntity> spuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(spuEntities)){
|
||||
List<Long> spuIds = spuEntities.stream().map(CanteenSpuEntity::getId).collect(Collectors.toList());
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.notIn(CanteenDailyMenuEntity::getSpuId, spuIds);
|
||||
}
|
||||
|
||||
Page pageData = baseMapper.selectPage(page, canteenDailyMenuEntityLambdaQueryWrapper);
|
||||
List<CanteenDailyMenuEntity> canteenDailyMenuEntities = pageData.getRecords();
|
||||
if (CollectionUtils.isNotEmpty(canteenDailyMenuEntities)) {
|
||||
List<Long> spuIds = canteenDailyMenuEntities.stream().map(CanteenDailyMenuEntity::getSpuId).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CanteenSpuEntity> spuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.in(CanteenSpuEntity::getId, spuIds);
|
||||
List<CanteenSpuEntity> list = canteenSpuService.list(spuDOLambdaQueryWrapper);
|
||||
// 按 id 分组成 Map
|
||||
Map<Long, CanteenSpuEntity> spuEntityMap = list.stream()
|
||||
.collect(Collectors.toMap(CanteenSpuEntity::getId, spu -> spu));
|
||||
// 构造新的 VO 列表
|
||||
List<DailyMenuAppVO> dailyMenuVOList = canteenDailyMenuEntities.stream()
|
||||
.map(menu -> {
|
||||
DailyMenuAppVO vo = new DailyMenuAppVO();
|
||||
BeanUtils.copyProperties(menu, vo); // 拷贝通用属性
|
||||
CanteenSpuEntity spuEntity = spuEntityMap.get(menu.getSpuId());
|
||||
if (spuEntity != null) {
|
||||
vo.setSpuId(spuEntity.getId());
|
||||
vo.setStock(spuEntity.getStock());
|
||||
vo.setPrice(spuEntity.getPrice());
|
||||
vo.setPicUrl(spuEntity.getPicUrl());
|
||||
vo.setName(spuEntity.getName());
|
||||
vo.setSort(spuEntity.getSort());
|
||||
vo.setIsShow(spuEntity.getIsShow());
|
||||
// 其他需要的字段
|
||||
}
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
dailyMenuVOList.sort(Comparator.comparing(DailyMenuAppVO::getSort));
|
||||
pageData.setRecords(dailyMenuVOList);
|
||||
return pageData;
|
||||
}
|
||||
|
||||
return null;
|
||||
Page<DailyMenuAppVO> pageData = baseMapper.selectTimeFoodPage(page, dailyMenuDTO);
|
||||
return pageData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public R cv(CanteenDailyMenuCVDTO creenDailyMenuCVDTO) {
|
||||
LocalDate startTime = creenDailyMenuCVDTO.getStartTime();
|
||||
//取出复制源
|
||||
Long sourceMerchantId = creenDailyMenuCVDTO.getSourceMerchantId();
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> canteenDailyMenuEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
canteenDailyMenuEntityLambdaQueryWrapper
|
||||
.eq(CanteenDailyMenuEntity::getMerchantId, sourceMerchantId);
|
||||
canteenDailyMenuEntityLambdaQueryWrapper.eq(CanteenDailyMenuEntity::getStartTime, startTime);
|
||||
List<CanteenDailyMenuEntity> canteenDailyMenuEntities = baseMapper.selectList(canteenDailyMenuEntityLambdaQueryWrapper);
|
||||
if (CollectionUtils.isEmpty(canteenDailyMenuEntities)) {
|
||||
return R.failed("复制源数据为空");
|
||||
}
|
||||
// 目标源处理
|
||||
List<Long> targetMerchantIds = creenDailyMenuCVDTO.getTargetMerchantId();
|
||||
for (Long targetMerchantId : targetMerchantIds) {
|
||||
// 查询目标商户已存在的spuId
|
||||
Set<String> existKeys = baseMapper.selectList(new LambdaQueryWrapper<CanteenDailyMenuEntity>()
|
||||
.eq(CanteenDailyMenuEntity::getMerchantId, targetMerchantId)
|
||||
.eq(CanteenDailyMenuEntity::getStartTime, startTime)
|
||||
.select(CanteenDailyMenuEntity::getSpuId, CanteenDailyMenuEntity::getHourType))
|
||||
.stream()
|
||||
.map(menu -> menu.getSpuId() + "_" + menu.getHourType()) // 生成唯一组合键
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
|
||||
// 过滤需要新增的数据
|
||||
// 过滤需要新增的数据(同时校验spuId和hourType)
|
||||
List<CanteenDailyMenuEntity> newEntities = canteenDailyMenuEntities.stream()
|
||||
.filter(menu -> !existKeys.contains(menu.getSpuId() + "_" + menu.getHourType())) // 关键修改点
|
||||
.map(menu -> {
|
||||
CanteenDailyMenuEntity entity = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(menu, entity);
|
||||
entity.setMerchantId(targetMerchantId);
|
||||
entity.setId(null);
|
||||
return entity;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(newEntities)) {
|
||||
saveBatch(newEntities); // 使用批量插入
|
||||
sendMqttMsg(targetMerchantId);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
// 发送mq消息
|
||||
private void sendMqttMsg(Long mchId) {
|
||||
if (ObjectUtil.isEmpty(mchId)) return;
|
||||
|
||||
+8
-2
@@ -95,8 +95,14 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
public Object pageScope(Page page, CanteenSpuEntity canteenSpu) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
|
||||
wrapper.orderByAsc(CanteenSpuEntity::getSort).orderByDesc(CanteenSpuEntity::getId);
|
||||
|
||||
Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
return pageData;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+41
-9
@@ -54,15 +54,16 @@
|
||||
</select>
|
||||
<select id="getCanteenMenuList" resultMap="adCanteenDailyMenuListVO">
|
||||
SELECT
|
||||
sp.id as spu_id,
|
||||
t.id,
|
||||
sp.name,
|
||||
sp.pic_url,
|
||||
t.hour_type,
|
||||
sp.price,
|
||||
sp.stock,
|
||||
sp.category_id,
|
||||
t.dept_id
|
||||
sp.id as spu_id,
|
||||
t.id,
|
||||
sp.name,
|
||||
sp.pic_url,
|
||||
t.hour_type,
|
||||
sp.price,
|
||||
sp.stock,
|
||||
sp.category_id,
|
||||
t.dept_id,
|
||||
t.create_by
|
||||
FROM canteen_daily_menu t
|
||||
LEFT JOIN canteen_spu sp
|
||||
on t.spu_id=sp.id
|
||||
@@ -82,4 +83,35 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectTimeFoodPage" resultType="com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO" parameterType="com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO">
|
||||
SELECT m.id,
|
||||
m.hour_type,
|
||||
s.id as spu_id,
|
||||
s.`name`,
|
||||
s.price,
|
||||
s.stock,
|
||||
s.pic_url,
|
||||
s.sort,
|
||||
s.is_show,
|
||||
c.id as category_id
|
||||
FROM `canteen_daily_menu` m
|
||||
left JOIN canteen_spu s
|
||||
on m.spu_id = s.id
|
||||
LEFT JOIN canteen_category c
|
||||
on s.category_id = c.id
|
||||
<where>
|
||||
m.del_flag = 0 and s.del_flag = 0 and m.merchant_id = #{dailyMenuDTO.merchantId} and s.is_show = 0
|
||||
<if test="dailyMenuDTO.startTime != null">
|
||||
AND m.start_time = #{dailyMenuDTO.startTime}
|
||||
</if>
|
||||
<if test="dailyMenuDTO.categoryId != null">
|
||||
AND s.category_id = #{dailyMenuDTO.categoryId}
|
||||
</if>
|
||||
<if test="dailyMenuDTO.hourType != null">
|
||||
AND m.hour_type = #{dailyMenuDTO.hourType}
|
||||
</if>
|
||||
</where>
|
||||
order by s.sort asc
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
+3
@@ -32,4 +32,7 @@ public interface CommonRoleConstant {
|
||||
// 商户角色
|
||||
String MCH_USER = "MCH_USER";
|
||||
|
||||
// 智能柜管理员
|
||||
String HARD_DOOR_ADMIN_USER = "HARD_DOOR_ADMIN";
|
||||
|
||||
}
|
||||
+2
-1
@@ -6,7 +6,8 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum MerchantTypeEnum {
|
||||
CANTEEN("1", "食堂"),
|
||||
OTHER_CANTEEN("0", "其他食堂"),
|
||||
CANTEEN("1", "自营食堂"),
|
||||
SUPERMARKET("2", "合作商家"),
|
||||
SELF_SUPERMARKET("3", "自营商家"),
|
||||
;
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.common.core.util;
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.WebUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.util.DigestUtils;
|
||||
|
||||
public class DeviceFingerprintUtil {
|
||||
public static String generate(HttpServletRequest request) {
|
||||
String userAgent = request.getHeader("User-Agent");
|
||||
// String ip = WebUtils.getIP(request);
|
||||
String accept = request.getHeader("Accept");
|
||||
System.out.println(userAgent);
|
||||
System.out.println(accept);
|
||||
System.out.println("******");
|
||||
System.out.println(DigestUtils.md5DigestAsHex((userAgent + accept).getBytes()));
|
||||
return DigestUtils.md5DigestAsHex((userAgent + accept).getBytes());
|
||||
}
|
||||
}
|
||||
@@ -52,5 +52,11 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-thirdparty-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.hard.api.constant;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 硬件授权类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardAuthTypeEnum {
|
||||
|
||||
HARD_DDOR_AUTH("10", "智能柜授权"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static HardAuthTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.hard.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 硬件广播类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardBroadcastEnum {
|
||||
OFFLINE_CANTEEN_RESERVE("1", "线下食堂订餐广播"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static HardBroadcastEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.bsd.pjcloud.hard.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 开门类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardDoorOpenTypeEnum {
|
||||
RECORD_VIDEO("1", "录制视频"),
|
||||
NO_RECORD_VIDEO("4", "不录制视频"),
|
||||
MAINTENANCE_UNLOCK("5", "检修开锁"),
|
||||
MAINTENANCE_LOCK("6", "检修关锁");;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static List<String> getMaintenanceListCodes() {
|
||||
return List.of(MAINTENANCE_UNLOCK.getType(), MAINTENANCE_LOCK.getType());
|
||||
}
|
||||
|
||||
public static HardDoorOpenTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.hard.api.constant.flow;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 智能柜开门流程
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardDoorFlowBizEnum {
|
||||
PAY_OPEN("10", "购买开门"),
|
||||
REPERTORY_OPEN("20", "上架开门"),
|
||||
ACCESS_OPEN("30", "检修开门"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static HardDoorFlowBizEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.bsd.pjcloud.hard.api.constant.flow;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 智能柜流程
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HardDoorFlowEnum {
|
||||
FLOW_AUTH("10", "用户授权", "20"),
|
||||
FLOW_APPLY_OPEN("20", "智能柜申请开门", "30"),
|
||||
FLOW_CALLBACK_OPEN("30", "智能柜开门响应", "40"),
|
||||
FLOW_CALLBACK_VIDEO("40", "智能柜视频回调", "50"),
|
||||
FLOW_SUBMIT_RECOGNITION("50", "旷世提交识别", "60"),
|
||||
FLOW_CALLBACK_RECOGNITION("60", "旷世识别响应", "70"),
|
||||
FLOW_PAY_ORDER("70", "订单结算", null),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
private final String nextType;
|
||||
|
||||
public static HardDoorFlowEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().get();
|
||||
}
|
||||
|
||||
public static HardDoorFlowEnum getNextType(HardDoorFlowEnum type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
HardDoorFlowEnum currentFlow = valueOfByType(type.getType());
|
||||
if (ObjectUtil.isEmpty(currentFlow) || ObjectUtil.isEmpty(currentFlow.getNextType())) return null;
|
||||
return valueOfByType(currentFlow.getNextType());
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -19,6 +19,7 @@ public enum HardOrderStatusEnum {
|
||||
OFFLINE_PAY("6", "没有网络本地支付"),
|
||||
REFUND("10", "退款"),
|
||||
CANCEL("20", "已核销"),
|
||||
UNFOLLOW("30", "已取消(智能柜)"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public enum HardPayTypeEnum {
|
||||
FOREIGN_TICKET_QR_CODE("6", "外来人员二维码支付"),
|
||||
RESERVE_QR_CODE("7", "线上订餐二维码支付"),
|
||||
CASH("8", "现金支付"),
|
||||
HARD_DOOR_FREE_PAY("9", "智能柜免密支付"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.util.Arrays;
|
||||
@Getter
|
||||
public enum HardSpuRepertoryTypeEnum {
|
||||
HANDLER("10", "手动上架"),
|
||||
AUTO("20", "自动上架"),
|
||||
PERSION("20", "上架员上架"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardApptDto extends HardApptEntity {
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardAuthAppDto {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 授权id
|
||||
*/
|
||||
@NotNull(message = "授权id不能为空")
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
*/
|
||||
@NotEmpty(message = "是否授权不能为空")
|
||||
private String authStatus;
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardAuthErrorChangeDto {
|
||||
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@NotNull(message = "流程id不能为空")
|
||||
private Long flowId;
|
||||
|
||||
/**
|
||||
* 处理图片
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 处理原因
|
||||
*/
|
||||
@NotEmpty(message = "请输入处理原因")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class HardDoorFlowDto extends HardDoorFlowEntity {
|
||||
|
||||
private LocalDate[] createTimeList;
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.constant.flow.HardDoorFlowBizEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardDoorFlowOpenDto {
|
||||
|
||||
/**
|
||||
* 柜子id
|
||||
*/
|
||||
@NotNull(message = "hardDoorId不能为空")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 智能柜编号
|
||||
*/
|
||||
@NotNull(message = "货柜编号不能为空")
|
||||
private Integer cabinetNo;
|
||||
|
||||
/**
|
||||
* 智能柜子流程id
|
||||
*/
|
||||
private Long hardDoorFlowId;
|
||||
|
||||
/**
|
||||
* 流程类型
|
||||
*/
|
||||
private HardDoorFlowBizEnum flowType;
|
||||
|
||||
/**
|
||||
* 开门操作类型
|
||||
*/
|
||||
private HardDoorOpenTypeEnum openType;
|
||||
|
||||
/**
|
||||
* 开门用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 授权id
|
||||
*/
|
||||
private Long authId;
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.bsd.pjcloud.hard.api.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardGetAuthAppDto {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 智能柜设备id
|
||||
*/
|
||||
@NotNull(message = "智能柜设备id不能为空")
|
||||
private Long doorHardId;
|
||||
|
||||
/**
|
||||
* 货柜编号
|
||||
*/
|
||||
@NotNull(message = "货柜编号不能为空")
|
||||
private Integer cabinetNo;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.manager;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardDoorCabinetDto extends HardDoorCabinetEntity {
|
||||
}
|
||||
+2
-1
@@ -22,7 +22,8 @@ public class HardAdminRefundDto {
|
||||
@Schema(description = "相关描述")
|
||||
private String applyDescription;
|
||||
|
||||
@Schema(description="补充凭证图片")
|
||||
@Schema(description = "补充凭证图片")
|
||||
@NotNull(message = "补充凭证图片不能为空")
|
||||
private String applyPicUrls;
|
||||
|
||||
}
|
||||
+3
@@ -45,4 +45,7 @@ public class HardAppCreateOrderDto {
|
||||
// 饭卡id
|
||||
private Long walletId;
|
||||
|
||||
// 预约id
|
||||
private Long apptId;
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class DeductionSpuRepertoryDto {
|
||||
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@NotNull(message = "流程id不能为空")
|
||||
private Long flowId;
|
||||
|
||||
/**
|
||||
* 上架数量
|
||||
*/
|
||||
@NotEmpty(message = "商品列表不能为空")
|
||||
private List<DeductionSpuRepertoryDto.Item> list;
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@NotNull(message = "商品id不能为空")
|
||||
private Long hardSpuId;
|
||||
|
||||
@NotNull(message = "增加库存不能为空")
|
||||
private Integer plusCount;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DeductionSpuStockDto {
|
||||
|
||||
private Long hardSpuId;
|
||||
|
||||
private Integer incrCount;
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardPutawayDto {
|
||||
|
||||
/**
|
||||
* 绑定id
|
||||
*/
|
||||
@NotNull(message = "绑定id不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@NotNull(message = "商品id")
|
||||
private Long hardSpuId;
|
||||
|
||||
}
|
||||
-6
@@ -1,18 +1,12 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HardSpuDto extends HardSpuEntity {
|
||||
|
||||
private List<Long> spuIdList;
|
||||
|
||||
+6
@@ -5,4 +5,10 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuJoinDto extends HardSpuJoinEntity {
|
||||
|
||||
/**
|
||||
* 是否有商品
|
||||
*/
|
||||
private Boolean isSpu = false;
|
||||
|
||||
}
|
||||
+2
@@ -13,4 +13,6 @@ public class HardSpuRepertoryDto extends HardSpuRepertoryEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private Long cabinetId;
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
package com.bsd.pjcloud.hard.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 设备预约管理
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_appt")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "设备预约管理")
|
||||
public class HardApptEntity extends Model<HardApptEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@Schema(description = "开始时间")
|
||||
private LocalTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@Schema(description = "结束时间")
|
||||
private LocalTime endTime;
|
||||
|
||||
/**
|
||||
* 预约时间段
|
||||
*/
|
||||
@Schema(description = "预约时间段")
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+42
-4
@@ -3,8 +3,7 @@ package com.bsd.pjcloud.hard.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -12,6 +11,9 @@ import java.time.LocalDateTime;
|
||||
/**
|
||||
* 硬件授权
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_auth")
|
||||
@@ -40,9 +42,15 @@ public class HardAuthEntity extends Model<HardAuthEntity> {
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* 是否授权
|
||||
* 货柜编号
|
||||
*/
|
||||
@Schema(description = "是否授权")
|
||||
@Schema(description = "货柜编号")
|
||||
private Integer cabinetNo;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
@Schema(description = "授权类型")
|
||||
private String authType;
|
||||
|
||||
/**
|
||||
@@ -69,6 +77,36 @@ public class HardAuthEntity extends Model<HardAuthEntity> {
|
||||
@Schema(description = "完成时间")
|
||||
private LocalDateTime isDoneTime;
|
||||
|
||||
/**
|
||||
* 是否人工处理
|
||||
*/
|
||||
@Schema(description = "是否人工处理")
|
||||
private String isManualChange;
|
||||
|
||||
/**
|
||||
* 人工处理用户id
|
||||
*/
|
||||
@Schema(description = "人工处理用户id")
|
||||
private Long manualChangeUserId;
|
||||
|
||||
/**
|
||||
* 人工处理时间
|
||||
*/
|
||||
@Schema(description = "人工处理时间")
|
||||
private LocalDateTime manualChangeTime;
|
||||
|
||||
/**
|
||||
* 人工处理备注
|
||||
*/
|
||||
@Schema(description = "人工处理备注")
|
||||
private String manualChangeRemark;
|
||||
|
||||
/**
|
||||
* 人工处理图片
|
||||
*/
|
||||
@Schema(description = "人工处理图片")
|
||||
private String manualChangePic;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+88
-79
@@ -3,14 +3,17 @@ package com.bsd.pjcloud.hard.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 设备广播
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_broadcast")
|
||||
@@ -19,118 +22,124 @@ import java.time.LocalDateTime;
|
||||
public class HardBroadcastEntity extends Model<HardBroadcastEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 广播编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "广播编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预定用户
|
||||
*/
|
||||
@Schema(description="预定用户")
|
||||
/**
|
||||
* 预定用户
|
||||
*/
|
||||
@Schema(description = "预定用户")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 硬件id
|
||||
*/
|
||||
@Schema(description="硬件id")
|
||||
/**
|
||||
* 硬件id
|
||||
*/
|
||||
@Schema(description = "硬件id")
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* mq主题
|
||||
*/
|
||||
@Schema(description="mq主题")
|
||||
/**
|
||||
* mq主题
|
||||
*/
|
||||
@Schema(description = "mq主题")
|
||||
private String topic;
|
||||
|
||||
/**
|
||||
* 关联业务编号
|
||||
*/
|
||||
@Schema(description="关联业务编号")
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@Schema(description = "业务类型")
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 关联业务编号
|
||||
*/
|
||||
@Schema(description = "关联业务编号")
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* 预定标题
|
||||
*/
|
||||
@Schema(description="预定标题")
|
||||
/**
|
||||
* 预定标题
|
||||
*/
|
||||
@Schema(description = "预定标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 广播内容
|
||||
*/
|
||||
@Schema(description="广播内容")
|
||||
/**
|
||||
* 广播内容
|
||||
*/
|
||||
@Schema(description = "广播内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 当前广播次数
|
||||
*/
|
||||
@Schema(description="当前广播次数")
|
||||
/**
|
||||
* 当前广播次数
|
||||
*/
|
||||
@Schema(description = "当前广播次数")
|
||||
private Integer broadcastCount;
|
||||
|
||||
/**
|
||||
* 最大广播次数
|
||||
*/
|
||||
@Schema(description="最大广播次数")
|
||||
/**
|
||||
* 最大广播次数
|
||||
*/
|
||||
@Schema(description = "最大广播次数")
|
||||
private Integer broadcastMaxCount;
|
||||
|
||||
/**
|
||||
* 是否广播语音
|
||||
*/
|
||||
@Schema(description="是否广播语音")
|
||||
/**
|
||||
* 是否广播语音
|
||||
*/
|
||||
@Schema(description = "是否广播语音")
|
||||
private String isBroadcast;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@Schema(description="是否完成")
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
@Schema(description = "是否完成")
|
||||
private String isDone;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Schema(description="完成时间")
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@Schema(description = "完成时间")
|
||||
private LocalDateTime isDoneTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
package com.bsd.pjcloud.hard.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 智能柜流程
|
||||
*
|
||||
* @author hard
|
||||
* @date 2025-04-14 16:08:33
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_door_flow")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "智能柜流程")
|
||||
public class HardDoorFlowEntity extends Model<HardDoorFlowEntity> {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
@Schema(description = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@Schema(description = "业务类型")
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 硬件id
|
||||
*/
|
||||
@Schema(description = "硬件id")
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* 智能柜id
|
||||
*/
|
||||
@Schema(description = "智能柜id")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 货柜编号
|
||||
*/
|
||||
@Schema(description = "货柜编号")
|
||||
private Integer cabinetNo;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@Schema(description = "订单编号")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 授权编号
|
||||
*/
|
||||
@Schema(description = "授权编号")
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 请求开门参数
|
||||
*/
|
||||
@Schema(description = "请求开门参数")
|
||||
private String requestOpenDto;
|
||||
|
||||
/**
|
||||
* 请求开门返回
|
||||
*/
|
||||
@Schema(description = "请求开门返回")
|
||||
private String requestOpenVo;
|
||||
|
||||
/**
|
||||
* 请求开门时间
|
||||
*/
|
||||
@Schema(description = "请求开门时间")
|
||||
private LocalDateTime requestOpenTime;
|
||||
|
||||
/**
|
||||
* 是否开门
|
||||
*/
|
||||
@Schema(description = "是否开门")
|
||||
private String isOpen;
|
||||
|
||||
/**
|
||||
* 开门回调时间
|
||||
*/
|
||||
@Schema(description = "开门回调时间")
|
||||
private LocalDateTime openCallbackTime;
|
||||
|
||||
/**
|
||||
* 开门回调结果
|
||||
*/
|
||||
@Schema(description = "开门回调结果")
|
||||
private String openCallbackVo;
|
||||
|
||||
/**
|
||||
* 视频回调结果
|
||||
*/
|
||||
@Schema(description = "视频回调结果")
|
||||
private String videoCallbackVo;
|
||||
|
||||
/**
|
||||
* 视频回调时间
|
||||
*/
|
||||
@Schema(description = "视频回调时间")
|
||||
private LocalDateTime videoCallbackTime;
|
||||
|
||||
|
||||
/**
|
||||
* sku识别提交参数
|
||||
*/
|
||||
@Schema(description = "sku识别提交参数")
|
||||
private String skuSubmitDto;
|
||||
|
||||
/**
|
||||
* sku识别提交结果
|
||||
*/
|
||||
@Schema(description = "sku识别提交结果")
|
||||
private String skuSubmitVo;
|
||||
|
||||
/**
|
||||
* sku识别提交id(用于查询)
|
||||
*/
|
||||
@Schema(description = "sku识别提交id(用于查询)")
|
||||
private String skuSubmitRecogId;
|
||||
|
||||
/**
|
||||
* sku识别提交时间
|
||||
*/
|
||||
@Schema(description = "sku识别提交时间")
|
||||
private LocalDateTime skuSubmitTime;
|
||||
|
||||
/**
|
||||
* sku识别回调结果
|
||||
*/
|
||||
@Schema(description = "sku识别回调结果")
|
||||
private String skuCallbackVo;
|
||||
|
||||
/**
|
||||
* sku识别回调时间
|
||||
*/
|
||||
@Schema(description = "sku识别回调时间")
|
||||
private LocalDateTime skuCallbackTime;
|
||||
|
||||
/**
|
||||
* sku识别主动获取参数
|
||||
*/
|
||||
@Schema(description = "sku识别主动获取参数")
|
||||
private String skuDrivingDto;
|
||||
|
||||
/**
|
||||
* sku识别主动获取结果
|
||||
*/
|
||||
@Schema(description = "sku识别主动获取结果")
|
||||
private String skuDrivingVo;
|
||||
|
||||
/**
|
||||
* sku识别主动获取时间
|
||||
*/
|
||||
@Schema(description = "sku识别主动获取时间")
|
||||
private LocalDateTime skuDrivingTime;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@Schema(description = "支付时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private String flowStatus;
|
||||
|
||||
/**
|
||||
* 流程错误信息
|
||||
*/
|
||||
@Schema(description = "流程错误信息")
|
||||
private String error;
|
||||
|
||||
/**
|
||||
* 流程错误描述(展示)
|
||||
*/
|
||||
@Schema(description = "流程错误描述(展示)")
|
||||
private String errorDesc;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 智能柜货柜
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2025-04-15 18:28:46
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_door_cabinet")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "智能柜货柜")
|
||||
public class HardDoorCabinetEntity extends Model<HardDoorCabinetEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 智能柜编号
|
||||
*/
|
||||
@Schema(description="智能柜编号")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 货柜编号(1,2)
|
||||
*/
|
||||
@Schema(description="货柜编号(1,2)")
|
||||
private Integer cabinetNo;
|
||||
|
||||
/**
|
||||
* 锁在线1:在线;2:离线;
|
||||
*/
|
||||
@Schema(description="锁在线1:在线;2:离线;")
|
||||
private String isLockOnline;
|
||||
|
||||
/**
|
||||
* 锁状态1:开锁;2:关锁;
|
||||
*/
|
||||
@Schema(description="锁状态1:开锁;2:关锁;")
|
||||
private Integer lockStatus;
|
||||
|
||||
/**
|
||||
* 门状态1:门关;2:门开
|
||||
*/
|
||||
@Schema(description="门状态1:门关;2:门开")
|
||||
private Integer doorStatus;
|
||||
|
||||
/**
|
||||
* 货柜售卖状态1:在售;2:停售
|
||||
*/
|
||||
@Schema(description="货柜售卖状态1:在售;2:停售")
|
||||
private Integer saleStatus;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
@Schema(description="二维码")
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+20
-7
@@ -7,6 +7,7 @@ import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能柜设置
|
||||
@@ -89,6 +90,12 @@ public class HardDoorManagerEntity extends Model<HardDoorManagerEntity> {
|
||||
@Schema(description = "售卖状态。1:在售;2:停售")
|
||||
private Integer saleStatus;
|
||||
|
||||
/**
|
||||
* sim 卡号。设备有上报会返回,若一次上报都没有,则返回 null。
|
||||
*/
|
||||
@Schema(description = "sim 卡号。设备有上报会返回,若一次上报都没有,则返回 null。")
|
||||
private String simSn;
|
||||
|
||||
/**
|
||||
* sim 信号强度。大于-95 表示信号强度好;-95 到-105 表示信号强度中等;小于-105 表示信号差;
|
||||
*/
|
||||
@@ -105,13 +112,7 @@ public class HardDoorManagerEntity extends Model<HardDoorManagerEntity> {
|
||||
* sim 信号值更新时间。yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
@Schema(description = "sim 信号值更新时间。yyyy-MM-dd HH:mm:ss")
|
||||
private Integer signalTime;
|
||||
|
||||
/**
|
||||
* 货柜列表JSON
|
||||
*/
|
||||
@Schema(description = "货柜列表JSON")
|
||||
private String cabinetList;
|
||||
private LocalDateTime signalTime;
|
||||
|
||||
/**
|
||||
* 上次重启时间
|
||||
@@ -119,6 +120,18 @@ public class HardDoorManagerEntity extends Model<HardDoorManagerEntity> {
|
||||
@Schema(description = "上次重启时间")
|
||||
private LocalDateTime restartTime;
|
||||
|
||||
/**
|
||||
* 系统音量
|
||||
*/
|
||||
@Schema(description = "系统音量")
|
||||
private Integer systemVolume;
|
||||
|
||||
/**
|
||||
* 媒体音量
|
||||
*/
|
||||
@Schema(description = "媒体音量")
|
||||
private Integer mediaVolume;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+13
-1
@@ -123,6 +123,12 @@ public class HardOrderEntity extends Model<HardOrderEntity> {
|
||||
@Schema(description = "用餐类型")
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 预约时间段id
|
||||
*/
|
||||
@Schema(description = "预约时间段id")
|
||||
private Long apptId;
|
||||
|
||||
/**
|
||||
* 订单设备类型
|
||||
*/
|
||||
@@ -178,11 +184,17 @@ public class HardOrderEntity extends Model<HardOrderEntity> {
|
||||
private String refundStatus;
|
||||
|
||||
/**
|
||||
* 订单取消时间
|
||||
* 订单取消时间(退款订单)
|
||||
*/
|
||||
@Schema(description = "订单取消时间")
|
||||
private LocalDateTime applyCancelTime;
|
||||
|
||||
/**
|
||||
* 订单取消时间(智能柜)
|
||||
*/
|
||||
@Schema(description = "订单取消时间(智能柜)")
|
||||
private LocalDateTime unfollowTime;
|
||||
|
||||
/**
|
||||
* 设备上的唯一订单号
|
||||
*/
|
||||
|
||||
+32
-5
@@ -7,8 +7,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -16,6 +15,9 @@ import java.time.LocalDateTime;
|
||||
/**
|
||||
* 硬件商品
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_spu")
|
||||
@@ -46,9 +48,15 @@ public class HardSpuEntity extends Model<HardSpuEntity> {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
* 商品封面图片
|
||||
*/
|
||||
@Schema(description = "商品图片")
|
||||
@Schema(description = "商品封面图片")
|
||||
private String cover;
|
||||
|
||||
/**
|
||||
* 商品图片用于识别
|
||||
*/
|
||||
@Schema(description = "商品图片用于识别")
|
||||
private String pic;
|
||||
|
||||
/**
|
||||
@@ -109,11 +117,24 @@ public class HardSpuEntity extends Model<HardSpuEntity> {
|
||||
|
||||
/**
|
||||
* sku类型,0:标准库;1:私有库
|
||||
*
|
||||
* @see HardKsSkuTypeEnum
|
||||
*/
|
||||
@Schema(description = "sku类型,0:标准库;1:私有库")
|
||||
private String skuType;
|
||||
|
||||
/**
|
||||
* 旷世skuid
|
||||
*/
|
||||
@Schema(description = "旷世skuid")
|
||||
private String ksSkuId;
|
||||
|
||||
/**
|
||||
* 旷世返回的业务方sku_id
|
||||
*/
|
||||
@Schema(description = "旷世返回的业务方sku_id")
|
||||
private String ksResSkuId;
|
||||
|
||||
/**
|
||||
* 69码
|
||||
*/
|
||||
@@ -130,7 +151,7 @@ public class HardSpuEntity extends Model<HardSpuEntity> {
|
||||
* 是否为集合SKU
|
||||
*/
|
||||
@Schema(description = "是否为集合SKU")
|
||||
private String ksSubSku;
|
||||
private String ksSubSkuJson;
|
||||
|
||||
/**
|
||||
* 旷世审核状态
|
||||
@@ -144,6 +165,12 @@ public class HardSpuEntity extends Model<HardSpuEntity> {
|
||||
@Schema(description = "旷世审核状态标题")
|
||||
private String ksStatusTitle;
|
||||
|
||||
/**
|
||||
* 乐观锁
|
||||
*/
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 旷世审核状态描述
|
||||
*/
|
||||
|
||||
+19
@@ -51,6 +51,25 @@ public class HardSpuJoinEntity extends Model<HardSpuJoinEntity> {
|
||||
@Schema(description = "放置层数")
|
||||
private Integer hardDoorNumber;
|
||||
|
||||
/**
|
||||
* 乐观锁
|
||||
*/
|
||||
@Version
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
@Schema(description = "销量")
|
||||
private Integer salesCount;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description = "库存")
|
||||
private Integer repertoryCount;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+16
-3
@@ -37,10 +37,17 @@ public class HardSpuRepertoryEntity extends Model<HardSpuRepertoryEntity> {
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
* 硬件柜子id
|
||||
*/
|
||||
@Schema(description = "设备id")
|
||||
private Long hardId;
|
||||
@Schema(description = "硬件柜子id")
|
||||
private Long hardDoorId;
|
||||
|
||||
/**
|
||||
* 柜门编号
|
||||
*/
|
||||
@Schema(description = "柜门编号")
|
||||
private Integer cabinetNo;
|
||||
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
@@ -63,6 +70,12 @@ public class HardSpuRepertoryEntity extends Model<HardSpuRepertoryEntity> {
|
||||
@Schema(description = "更新库存数量")
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 上架业务关联id
|
||||
*/
|
||||
@Schema(description = "上架业务关联id")
|
||||
private Long bizId;
|
||||
|
||||
/**
|
||||
* 上架类型
|
||||
*/
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.bsd.pjcloud.hard.api.feign;
|
||||
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorOpenCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVideoCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
|
||||
@FeignClient(contextId = "remoteHardDoorService", value = ServiceNameConstants.HARDWARE_SERVICE)
|
||||
public interface RemoteHardDoorService {
|
||||
|
||||
/**
|
||||
* 处理柜子开门回调
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/hard-door-flow/dispose-locak-callback")
|
||||
void disposeLocakCallback(@RequestBody DoorOpenCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理柜子视频回调
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/hard-door-flow/dispose-video-callback")
|
||||
void disposeVideoCallback(@RequestBody DoorVideoCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理柜子视频回调
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/hard-door-flow/dispose-status-callback")
|
||||
void disposeStatusCallback(@RequestBody DoorStatusCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理旷世识别回调
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/hard-door-flow/dispose-recognition-callback")
|
||||
void disposeRecognitionCallback(@RequestBody KsRecognitionCallbackDto dto);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.hard.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardApptVo extends HardApptEntity {
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.bsd.pjcloud.hard.api.vo;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardDoorFlowVo extends HardDoorFlowEntity implements BaseHardInterface, BaseUserDeptInterface {
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private String userDeptName;
|
||||
|
||||
private HardAuthEntity hardAuth;
|
||||
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.hard.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardGetAuthAppVo {
|
||||
|
||||
/**
|
||||
* 授权id
|
||||
*/
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 授权信息
|
||||
*/
|
||||
private String authDesc;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.manager;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardDoorCabinetCodeVo {
|
||||
|
||||
/**
|
||||
* 智能柜id
|
||||
*/
|
||||
private String hardDoorId;
|
||||
|
||||
/**
|
||||
* 货柜编号
|
||||
*/
|
||||
private String cabinetNo;
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.manager;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardDoorCabinetVo extends HardDoorCabinetEntity implements BaseHardInterface {
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private Long hardId;
|
||||
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
private String deviceCode;
|
||||
|
||||
}
|
||||
+9
-1
@@ -1,10 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.manager;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.base.BaseHardInterface;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardDoorManagerVo extends HardDoorManagerEntity {
|
||||
public class HardDoorManagerVo extends HardDoorManagerEntity implements BaseHardInterface {
|
||||
/**
|
||||
* 硬件设备相关
|
||||
*/
|
||||
@@ -12,4 +16,8 @@ public class HardDoorManagerVo extends HardDoorManagerEntity {
|
||||
|
||||
private String hardType;
|
||||
|
||||
private List<String> hardTypeCodes;
|
||||
|
||||
private List<HardDoorCabinetEntity> cabinetList;
|
||||
|
||||
}
|
||||
+11
-8
@@ -7,7 +7,7 @@ import com.bsd.pjcloud.wallet.api.vo.base.BaseMchInterface;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuRepertoryVo extends HardSpuRepertoryEntity implements BaseMchInterface, BaseHardInterface, BaseUserInterface {
|
||||
public class HardSpuRepertoryVo extends HardSpuRepertoryEntity implements BaseMchInterface, BaseUserInterface, BaseHardInterface {
|
||||
|
||||
/**
|
||||
* 商品相关
|
||||
@@ -34,13 +34,6 @@ public class HardSpuRepertoryVo extends HardSpuRepertoryEntity implements BaseMc
|
||||
|
||||
private String logoPic;
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
@@ -50,5 +43,15 @@ public class HardSpuRepertoryVo extends HardSpuRepertoryEntity implements BaseMc
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 设备相关
|
||||
*/
|
||||
private Long hardId;
|
||||
|
||||
private String hardName;
|
||||
|
||||
private String hardType;
|
||||
|
||||
private String deviceCode;
|
||||
|
||||
}
|
||||
+1
@@ -1,2 +1,3 @@
|
||||
com.bsd.pjcloud.hard.api.feign.RemoteHardDoorService
|
||||
com.bsd.pjcloud.hard.api.feign.RemoteHardOrderService
|
||||
com.bsd.pjcloud.hard.api.feign.RemoteHardThirdSelfZyService
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.bsd.pjcloud.hard.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardApptService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 设备预约管理
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hard-appt")
|
||||
@Tag(description = "hard-appt", name = "设备预约管理管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardApptController {
|
||||
|
||||
private final HardApptService hardApptService;
|
||||
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
@Operation(summary = "app预约时间列表", description = "app预约时间列表")
|
||||
@GetMapping("/app/list")
|
||||
public R<List<HardApptEntity>> appList() {
|
||||
List<HardApptEntity> list = hardApptService.list(new LambdaQueryWrapper<HardApptEntity>()
|
||||
.eq(HardApptEntity::getStatus, YesNoEnum.YES.getCode())
|
||||
.orderByDesc(HardApptEntity::getSort)
|
||||
);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_view')")
|
||||
public R getHardApptPage(@ParameterObject Page page, @ParameterObject HardApptEntity dto) {
|
||||
LambdaQueryWrapper<HardApptEntity> wrapper = new LambdaQueryWrapper<HardApptEntity>()
|
||||
.like(ObjectUtil.isNotEmpty(dto.getTitle()), HardApptEntity::getTitle, dto.getTitle());
|
||||
return R.ok(hardApptService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardApptService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增设备预约管理", description = "新增设备预约管理")
|
||||
@SysLog("新增设备预约管理")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_add')")
|
||||
public R save(@RequestBody HardApptEntity hardAppt) {
|
||||
return R.ok(hardApptService.create(hardAppt));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改设备预约管理", description = "修改设备预约管理")
|
||||
@SysLog("修改设备预约管理")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_edit')")
|
||||
public R updateById(@RequestBody HardApptEntity hardAppt) {
|
||||
return R.ok(hardApptService.edit(hardAppt));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除设备预约管理", description = "通过id删除设备预约管理")
|
||||
@SysLog("通过id删除设备预约管理")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
hardApptService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAppt_export')")
|
||||
public List<HardApptEntity> export(HardApptEntity hardAppt, Long[] ids) {
|
||||
return hardApptService.list(Wrappers.lambdaQuery(hardAppt).in(ArrayUtil.isNotEmpty(ids), HardApptEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+36
-3
@@ -2,16 +2,20 @@ package com.bsd.pjcloud.hard.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.*;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -20,10 +24,10 @@ import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 硬件授权
|
||||
@@ -37,6 +41,35 @@ public class HardAuthController {
|
||||
|
||||
private final HardAuthService hardAuthService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
@Operation(summary = "app获取智能柜授权信息", description = "app获取智能柜授权信息")
|
||||
@PostMapping("/app/get-auth-hard-door")
|
||||
public R<HardGetAuthAppVo> appGetAuthHardDoor(@Valid @RequestBody HardGetAuthAppDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(hardAuthService.appGetAuthHardDoor(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app智能柜授权", description = "app智能柜授权")
|
||||
@PostMapping("/app/auth-hard-door")
|
||||
public R appAuthHardDoor(@Valid @RequestBody HardAuthAppDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(hardAuthService.appAuthHardDoor(dto));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "流程错误手动处理", description = "流程错误手动处理")
|
||||
@PostMapping("/error-change")
|
||||
@Idempotent(expireTime = 5, info = "正在开门中,请勿重复操作")
|
||||
public R errorChange(@Validated @RequestBody HardAuthErrorChangeDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
hardAuthService.errorChange(dto, user.getId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAuth_view')")
|
||||
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
package com.bsd.pjcloud.hard.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.flow.HardDoorFlowBizEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorOpenCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVideoCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能柜流程
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hard-door-flow")
|
||||
@Tag(description = "hard-door-flow", name = "智能柜流程管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardDoorFlowController {
|
||||
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
/**
|
||||
* 处理柜子开门回调
|
||||
*/
|
||||
@Inner()
|
||||
@PostMapping("/dispose-locak-callback")
|
||||
public void disposeLocakCallback(@RequestBody DoorOpenCallbackDto dto) {
|
||||
hardDoorFlowService.disposeLocakCallback(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理柜子视频回调
|
||||
*/
|
||||
@Inner()
|
||||
@PostMapping("/dispose-video-callback")
|
||||
public void disposeVideoCallback(@RequestBody DoorVideoCallbackDto dto) {
|
||||
hardDoorFlowService.disposeVideoCallback(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理柜子状态回调
|
||||
*/
|
||||
@Inner()
|
||||
@PostMapping("/dispose-status-callback")
|
||||
public void disposeStatusCallback(@RequestBody DoorStatusCallbackDto dto) {
|
||||
hardDoorFlowService.disposeStatusCallback(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理旷世识别回调
|
||||
*/
|
||||
@Inner()
|
||||
@PostMapping("/dispose-recognition-callback")
|
||||
public void disposeRecognitionCallback(@RequestBody KsRecognitionCallbackDto dto) {
|
||||
hardDoorFlowService.disposeRecognitionCallback(dto);
|
||||
}
|
||||
|
||||
/* ************************************* end 远程调用 end ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
@Operation(summary = "上架开门", description = "上架开门")
|
||||
@PostMapping("/app/open-repertory")
|
||||
@Idempotent(expireTime = 5, info = "正在开门中,请勿重复操作")
|
||||
public R<Long> openRepertory(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.REPERTORY_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.NO_RECORD_VIDEO);
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(hardDoorFlowService.openDoorRepertory(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app检修开门", description = "app检修开门")
|
||||
@PostMapping("/app/open-access")
|
||||
@Idempotent(expireTime = 5, info = "正在开门中,请勿重复操作")
|
||||
public R appOpenAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_UNLOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.openDoorAccess(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "app检修开门", description = "app检修开门")
|
||||
@PostMapping("/app/close-access")
|
||||
@Idempotent(expireTime = 5, info = "正在关门中,请勿重复操作")
|
||||
public R appCloseAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_LOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.closeAccess(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "检修开门", description = "检修开门")
|
||||
@PostMapping("/open-access")
|
||||
@Idempotent(expireTime = 5, info = "正在开门中,请勿重复操作")
|
||||
public R openAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_UNLOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.openDoorAccess(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "检修关门", description = "检修关门")
|
||||
@PostMapping("/close-access")
|
||||
@Idempotent(expireTime = 5, info = "正在关门中,请勿重复操作")
|
||||
public R closeAccess(@Validated @RequestBody HardDoorFlowOpenDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setFlowType(HardDoorFlowBizEnum.ACCESS_OPEN);
|
||||
dto.setOpenType(HardDoorOpenTypeEnum.MAINTENANCE_LOCK);
|
||||
dto.setUserId(user.getId());
|
||||
hardDoorFlowService.closeAccess(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "复杂查询", description = "复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
public R<Page<HardDoorFlowVo>> pageJoin(@ParameterObject Page page, @ParameterObject HardDoorFlowDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardDoorFlowService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
public R<HardDoorFlowVo> join(@PathVariable("id") Long id) {
|
||||
return R.ok(hardDoorFlowService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过订单id查询流程", description = "通过订单id查询流程")
|
||||
@GetMapping("/get-by-order-id")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')")
|
||||
public R<HardDoorFlowVo> getByOrderId(@RequestParam Long orderId) {
|
||||
return R.ok(hardDoorFlowService.getByOrderId(orderId));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "新增智能柜流程", description = "新增智能柜流程")
|
||||
@SysLog("新增智能柜流程")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_add')")
|
||||
public R save(@RequestBody HardDoorFlowEntity hardDoorFlow) {
|
||||
return R.ok(hardDoorFlowService.save(hardDoorFlow));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改智能柜流程", description = "修改智能柜流程")
|
||||
@SysLog("修改智能柜流程")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_edit')")
|
||||
public R updateById(@RequestBody HardDoorFlowEntity hardDoorFlow) {
|
||||
return R.ok(hardDoorFlowService.updateById(hardDoorFlow));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除智能柜流程", description = "通过id删除智能柜流程")
|
||||
@SysLog("通过id删除智能柜流程")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardDoorFlowService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_export')")
|
||||
public List<HardDoorFlowEntity> export(HardDoorFlowEntity hardDoorFlow, Long[] ids) {
|
||||
return hardDoorFlowService.list(Wrappers.lambdaQuery(hardDoorFlow).in(ArrayUtil.isNotEmpty(ids), HardDoorFlowEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+34
-2
@@ -9,12 +9,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardChangeVolume;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorCabinetService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVolumeDto;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -39,16 +42,39 @@ import java.util.List;
|
||||
public class HardDoorManagerController {
|
||||
|
||||
private final HardDoorManagerService hardDoorManagerService;
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "app查询智能柜列表", description = "app查询智能柜列表")
|
||||
@GetMapping("/app/page")
|
||||
public R<Page<HardDoorManagerVo>> appPage(@ParameterObject Page page, @ParameterObject HardDoorManagerDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardDoorManagerService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询智能柜详情", description = "app查询智能柜详情")
|
||||
@GetMapping("/app/detail")
|
||||
public R appDetail(@RequestParam Long hardDoorId) {
|
||||
return R.ok(hardDoorManagerService.getByHardDoorId(hardDoorId));
|
||||
}
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "绑定设备", description = "绑定设备")
|
||||
@PostMapping("/bind")
|
||||
public R bind(@RequestBody HardDoorManagerEntity dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getImei())) throw new RuntimeException("设备IMEI卡号不能为空");
|
||||
if (ObjectUtil.isEmpty(dto.getDeviceCode())) throw new RuntimeException("设备内置设备编号不能为空");
|
||||
hardDoorManagerService.bind(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "刷新智能柜货柜二维码", description = "刷新智能柜货柜二维码")
|
||||
@GetMapping("/refresh-qr-code")
|
||||
public R refreshQrCode(@RequestParam Long hardDoorId, @RequestParam Integer cabinetNo) {
|
||||
return R.ok(hardDoorCabinetService.refreshQrCode(hardDoorId, cabinetNo));
|
||||
}
|
||||
|
||||
@Operation(summary = "音量修改", description = "音量修改")
|
||||
@PostMapping("/change-volume")
|
||||
public R changeVolume(@Validated @RequestBody HardChangeVolume dto) {
|
||||
@@ -56,6 +82,12 @@ public class HardDoorManagerController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "柜门下拉查询", description = "柜门下拉查询")
|
||||
@GetMapping("/select-cabinet")
|
||||
public R<Page<HardDoorCabinetVo>> selectCabinet(@ParameterObject Page page, @ParameterObject HardDoorCabinetDto dto) {
|
||||
return R.ok(hardDoorManagerService.selectCabinet(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardDoorManager_view')")
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public class HardManagerController {
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardInvoice_view')")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardManagerDto dto) {
|
||||
return R.ok(hardManagerService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
+3
-30
@@ -3,7 +3,6 @@ package com.bsd.pjcloud.hard.controller.order;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
@@ -20,7 +19,6 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
@@ -44,7 +42,6 @@ import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -139,7 +136,7 @@ public class HardOrderController {
|
||||
dto.setIsFindCarList(false);
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
// 查询用户部门
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
UserInfo userInfo = userService.getInnerByUserId(user.getId()).getData();
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
@@ -164,9 +161,9 @@ public class HardOrderController {
|
||||
@Operation(summary = "app创建订单", description = "app创建订单")
|
||||
@GetMapping("/app/create-order")
|
||||
@Idempotent(expireTime = 10, info = "正在创建订单中,请勿重复操作")
|
||||
public R appCreateOrder(@RequestParam Long carParentId, @RequestParam HardTypeEnum hardType) {
|
||||
public R appCreateOrder(@RequestParam Long carParentId, @RequestParam Long apptId, @RequestParam HardTypeEnum hardType) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
HardAppCreateOrderDto dto = HardAppCreateOrderDto.builder().carParentId(carParentId).walletType(WalletTypeEnum.EAT).hardType(hardType).userId(user.getId()).orderType(HardOrderTypeEnum.RESERVE).payType(HardPayTypeEnum.WALLET_DEFAULT).build();
|
||||
HardAppCreateOrderDto dto = HardAppCreateOrderDto.builder().carParentId(carParentId).walletType(WalletTypeEnum.EAT).hardType(hardType).userId(user.getId()).orderType(HardOrderTypeEnum.RESERVE).payType(HardPayTypeEnum.WALLET_DEFAULT).apptId(apptId).build();
|
||||
return R.ok(hardwareOrderService.appCreateOrder(dto));
|
||||
}
|
||||
|
||||
@@ -230,30 +227,6 @@ public class HardOrderController {
|
||||
return R.ok(hardwareOrderService.join(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增订单表", description = "新增订单表")
|
||||
@SysLog("新增订单表")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_add')")
|
||||
public R save(@RequestBody HardOrderEntity hardwareOrder) {
|
||||
return R.ok(hardwareOrderService.save(hardwareOrder));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改订单表", description = "修改订单表")
|
||||
@SysLog("修改订单表")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_edit')")
|
||||
public R updateById(@RequestBody HardOrderEntity hardwareOrder) {
|
||||
return R.ok(hardwareOrderService.updateById(hardwareOrder));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除订单表", description = "通过id删除订单表")
|
||||
@SysLog("通过id删除订单表")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardwareOrderService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_export')")
|
||||
public void export(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
|
||||
+26
-2
@@ -66,10 +66,10 @@ public class HardOrderTotalController {
|
||||
/* ************************************* start app start ************************************* */
|
||||
@Operation(summary = "app查询商户每天流水记录", description = "app查询订单列表根据权限")
|
||||
@GetMapping("/app/mch-water-day")
|
||||
public R appMchTotal(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
public R appMchWaterDay(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
// 查询用户部门
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
UserInfo userInfo = userService.getInnerByUserId(user.getId()).getData();
|
||||
dto.setIsFindCarList(false);
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
@@ -85,6 +85,30 @@ public class HardOrderTotalController {
|
||||
dto.setMchIds(mchDtoIds);
|
||||
return R.ok(hardOrderTotalService.listCsByDay(page, dto, user));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询商户全部流水记录", description = "app查询商户全部流水记录")
|
||||
@GetMapping("/app/mch-water-total")
|
||||
public R appMchWaterTotal(@ParameterObject HardOrderDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
// 查询用户部门
|
||||
UserInfo userInfo = userService.getInnerByUserId(user.getId()).getData();
|
||||
dto.setIsFindCarList(false);
|
||||
// 判断是否为合作超市管理员工
|
||||
if (!hardManagerService.isSuperMarketAdmin(user)) return R.ok(new Page());
|
||||
// 查询用户属于的商户
|
||||
MchManageVo mch = mchService.getFirstMchByDeptId(userInfo.getSysUser().getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("该用户下不存在商户");
|
||||
List<Long> mchDtoIds = new ArrayList<>(List.of(mch.getId()));
|
||||
// 查询商户和下面的子商户
|
||||
List<MchManageVo> mchList = mchService.getByParentId(mch.getId()).getData();
|
||||
// 查询子商户
|
||||
List<Long> mchIds = mchList.stream().map(MchManageVo::getId).toList();
|
||||
mchDtoIds.addAll(mchIds);
|
||||
dto.setMchIds(mchDtoIds);
|
||||
return R.ok(hardOrderTotalService.mchWaterTotal(dto, user));
|
||||
}
|
||||
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@PostMapping("/page-list-sb")
|
||||
|
||||
+57
@@ -7,11 +7,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardPutawayDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -39,6 +42,45 @@ public class HardSpuController {
|
||||
|
||||
private final HardSpuService hardSpuService;
|
||||
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "app上架", description = "上架")
|
||||
@PostMapping("/app/putaway")
|
||||
@Idempotent(expireTime = 5, info = "正在上架中,请勿重复操作")
|
||||
public R appPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.putaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "app下架", description = "下架")
|
||||
@PostMapping("/app/un-putaway")
|
||||
@Idempotent(expireTime = 5, info = "正在下架中,请勿重复操作")
|
||||
public R appUnPutaway(@Valid @RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.unPutaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询货柜补货商品列表", description = "查询货柜补货商品列表")
|
||||
@GetMapping("/app/cabinet-putaway-list")
|
||||
public R appCabinetPutawayList(@RequestParam Long hardDoorId, @RequestParam String cabinetNo) {
|
||||
return R.ok(hardSpuService.appCabinetPutawayList(hardDoorId, cabinetNo));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询货柜商品列表", description = "查询货柜商品列表")
|
||||
@GetMapping("/app/cabinet-list")
|
||||
public R appCabinetList(@RequestParam Long hardId, @RequestParam String cabinetNo) {
|
||||
return R.ok(hardSpuService.getByCabinetNo(hardId, cabinetNo));
|
||||
}
|
||||
|
||||
@Operation(summary = "app商品类表", description = "app商品类表")
|
||||
@GetMapping("/app/page")
|
||||
public R appPage(@ParameterObject Page page, @ParameterObject HardSpuDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuService.scopPageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
/* ************************************* end APP end ************************************* */
|
||||
|
||||
@Operation(summary = "拉取旷世商品", description = "拉取旷世商品")
|
||||
@GetMapping("/async-all")
|
||||
public R asyncAll() {
|
||||
@@ -52,6 +94,21 @@ public class HardSpuController {
|
||||
return R.ok(hardSpuService.getByCabinetNo(hardId, cabinetNo));
|
||||
}
|
||||
|
||||
@Operation(summary = "上架", description = "上架")
|
||||
@PostMapping("/putaway")
|
||||
public R putaway(@RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.putaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "下架", description = "下架")
|
||||
@PostMapping("/un-putaway")
|
||||
public R unPutaway(@RequestBody HardPutawayDto dto) {
|
||||
hardSpuService.unPutaway(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "下拉查询", description = "下拉查询")
|
||||
@GetMapping("/select")
|
||||
public R select(@ParameterObject Page page, @ParameterObject HardSpuDto dto) {
|
||||
|
||||
+19
-5
@@ -2,17 +2,21 @@ package com.bsd.pjcloud.hard.controller.spu;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -25,7 +29,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 硬件商品库存更新记录
|
||||
@@ -39,10 +42,17 @@ public class HardSpuRepertoryController {
|
||||
|
||||
private final HardSpuRepertoryService hardSpuRepertoryService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
/* ************************************* start APP start ************************************* */
|
||||
|
||||
@Operation(summary = "app上架完成", description = "app上架完成")
|
||||
@PostMapping("/app/repertory-done")
|
||||
@Idempotent(expireTime = 5, info = "正在操作中,请勿重复操作")
|
||||
public R<Boolean> appRepertoryDone(@Valid @RequestBody DeductionSpuRepertoryDto body) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(hardSpuRepertoryService.appRepertoryDone(body, user.getId()));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
/* ************************************* end APP end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@@ -71,9 +81,13 @@ public class HardSpuRepertoryController {
|
||||
@SysLog("新增硬件商品库存更新记录")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_add')")
|
||||
public R save(@Validated @RequestBody HardSpuRepertoryEntity hardSpuRepertory) {
|
||||
@Idempotent(expireTime = 5, info = "正在上架中,请勿重复操作")
|
||||
public R save(@Validated @RequestBody HardSpuRepertoryDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getCabinetId())) {
|
||||
return R.failed("请选择所属柜门");
|
||||
}
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(hardSpuRepertoryService.create(hardSpuRepertory, user));
|
||||
return R.ok(hardSpuRepertoryService.create(dto, user));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品库存更新记录", description = "修改硬件商品库存更新记录")
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.hard.mapper;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardApptMapper extends PjcloudBaseMapper<HardApptEntity> {
|
||||
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.bsd.pjcloud.hard.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardDoorFlowMapper extends PjcloudBaseMapper<HardDoorFlowEntity> {
|
||||
|
||||
|
||||
default Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope) {
|
||||
MPJLambdaQueryWrapper<HardDoorFlowEntity> wrapper = new MPJLambdaQueryWrapper<HardDoorFlowEntity>()
|
||||
.selectAll(HardDoorFlowEntity.class)
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getUserId()), HardDoorFlowEntity::getUserId, dto.getUserId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getBizType()), HardDoorFlowEntity::getBizType, dto.getBizType())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardDoorId()), HardDoorFlowEntity::getHardDoorId, dto.getHardDoorId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getCabinetNo()), HardDoorFlowEntity::getCabinetNo, dto.getCabinetNo())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getOrderId()), HardDoorFlowEntity::getOrderId, dto.getOrderId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsOpen()), HardDoorFlowEntity::getIsOpen, dto.getIsOpen())
|
||||
.between(
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()),
|
||||
HardDoorFlowEntity::getCreateTime,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
|
||||
)
|
||||
.orderByDesc(HardDoorFlowEntity::getCreateTime)
|
||||
.orderByDesc(HardDoorFlowEntity::getId);
|
||||
return selectJoinPage(page, HardDoorFlowVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.bsd.pjcloud.hard.mapper.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HardDoorCabinetMapper extends PjcloudBaseMapper<HardDoorCabinetEntity> {
|
||||
|
||||
Page<HardDoorCabinetVo> scopePageJoin(Page page, @Param("dto") HardDoorCabinetDto dto, DataScope dataScope);
|
||||
|
||||
}
|
||||
+3
-1
@@ -14,5 +14,7 @@ public interface HardDoorManagerMapper extends PjcloudBaseMapper<HardDoorManager
|
||||
|
||||
Page<HardDoorManagerVo> scopePageJoin(Page page, @Param("dto") HardDoorManagerDto dto, DataScope dataScope);
|
||||
|
||||
HardDoorManagerVo pageJoin(@Param("hardId") Long hardId);
|
||||
HardDoorManagerVo pageJoinByHardDoorId(@Param("hardDoorId") Long hardDoorId);
|
||||
|
||||
HardDoorManagerVo pageJoinByHardId(@Param("hardId") Long hardId);
|
||||
}
|
||||
+2
@@ -101,6 +101,8 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
|
||||
List<HardOrderCsVo> listCsByDay(@Param("dto") HardOrderDto totalDto);
|
||||
|
||||
HardOrderCsVo listCsTotal(@Param("dto") HardOrderDto totalDto);
|
||||
|
||||
List<HardOrderPayTypeVo> listOrerPayType(@Param("dto") HardOrderDto dto);
|
||||
|
||||
List<HardOrderSumAndCountVo> sumAndCount(@Param("dto") HardOrderSumAndCountDto dto);
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface HardApptService extends IService<HardApptEntity> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardApptEntity hardAppt);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Long edit(HardApptEntity hardAppt);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
}
|
||||
+25
@@ -3,11 +3,36 @@ package com.bsd.pjcloud.hard.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthAppDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthErrorChangeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardGetAuthAppDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface HardAuthService extends IService<HardAuthEntity> {
|
||||
|
||||
Page<HardAuthVo> scopePageJoin(Page page, HardAuthDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* app获取智能柜授权信息
|
||||
*/
|
||||
HardGetAuthAppVo appGetAuthHardDoor(@Valid HardGetAuthAppDto dto);
|
||||
|
||||
/**
|
||||
* app智能柜授权
|
||||
*/
|
||||
Long appAuthHardDoor(HardAuthAppDto dto);
|
||||
|
||||
/**
|
||||
* 判断当前用户信誉
|
||||
*/
|
||||
boolean judgeUserCredit(Long userId);
|
||||
|
||||
/**
|
||||
* 流程错误手动处理
|
||||
*/
|
||||
void errorChange(HardAuthErrorChangeDto dto, Long userId);
|
||||
}
|
||||
+11
@@ -2,13 +2,24 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
|
||||
public interface HardBroadcastService extends IService<HardBroadcastEntity> {
|
||||
|
||||
Page<HardBroadcastVo> scopePageJoin(Page page, HardBroadcastDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 添加线下食堂预约订单广播
|
||||
*/
|
||||
void addReserveOrderTask(HardOrderEntity orderdetail, UserInfo userInfo);
|
||||
|
||||
/**
|
||||
* 完成硬件广播
|
||||
*/
|
||||
void doneBroadcast(HardOrderEntity orderdetail);
|
||||
}
|
||||
+1
-11
@@ -31,27 +31,17 @@ public interface HardCarService extends IService<HardCarEntity> {
|
||||
|
||||
/**
|
||||
* 新增或者更新购物车
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
void saveOrUpload(HardCarSaveOrUpdateDto dto);
|
||||
|
||||
/**
|
||||
* @param userId 用户id
|
||||
* @param merchantId 商户id
|
||||
* @param sysType 硬件设备类型
|
||||
* @param list g购物车类表
|
||||
* @return 父购物车id
|
||||
* 创建购物车
|
||||
*/
|
||||
Long createCard(Long userId, Long merchantId, HardTypeEnum sysType, HardOrderTypeEnum orderTYpe, List<HardCreateCarDto> list);
|
||||
|
||||
|
||||
/**
|
||||
* 生成购买商品的描述
|
||||
*
|
||||
* @param sysType 订单类型
|
||||
* @param list 购物车列表
|
||||
* @return
|
||||
*/
|
||||
String computerCarSubject(HardTypeEnum sysType, HardOrderTypeEnum orderType, List<HardCreateCarDto> list);
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorStatusVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HardDoorCabinetService extends IService<HardDoorCabinetEntity> {
|
||||
|
||||
Page<HardDoorCabinetVo> scopePageJoin(Page page, HardDoorCabinetDto dto, DataScope dataScope);
|
||||
|
||||
void saveOrUpdate(Long hardDoorId, List<DoorStatusVo.Cabinet> list);
|
||||
|
||||
List<HardDoorCabinetEntity> getListByHardDoorId(Long hardDoorId);
|
||||
|
||||
/**
|
||||
* 刷新智能柜货柜二维码
|
||||
*/
|
||||
String refreshQrCode(Long hardDoorId, Integer cabinetNo);
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorOpenCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorStatusCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVideoCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
|
||||
public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
|
||||
|
||||
/**
|
||||
* 复杂查询
|
||||
*/
|
||||
Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope);
|
||||
|
||||
HardDoorFlowVo join(Long id);
|
||||
|
||||
/**
|
||||
* 通过订单id查询流程
|
||||
*/
|
||||
HardDoorFlowVo getByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 检修开门
|
||||
*/
|
||||
void openDoorAccess(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 检修关门
|
||||
*/
|
||||
void closeAccess(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 购买开门
|
||||
*/
|
||||
void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail);
|
||||
|
||||
/**
|
||||
* 上架开门
|
||||
*/
|
||||
Long openDoorRepertory(HardDoorFlowOpenDto dto);
|
||||
|
||||
/**
|
||||
* 处理开门回调
|
||||
*/
|
||||
void disposeLocakCallback(DoorOpenCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理柜子状态回调
|
||||
*/
|
||||
void disposeStatusCallback(DoorStatusCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理视频回调
|
||||
*/
|
||||
void disposeVideoCallback(DoorVideoCallbackDto dto);
|
||||
|
||||
/**
|
||||
* 处理旷世识别回调
|
||||
*/
|
||||
void disposeRecognitionCallback(KsRecognitionCallbackDto dto);
|
||||
}
|
||||
+27
@@ -3,27 +3,54 @@ package com.bsd.pjcloud.hard.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardChangeVolume;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
|
||||
public interface HardDoorManagerService extends IService<HardDoorManagerEntity> {
|
||||
|
||||
Page<HardDoorManagerVo> scopePageJoin(Page page, HardDoorManagerDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 柜门下拉查询
|
||||
*/
|
||||
Page<HardDoorCabinetVo> selectCabinet(Page page, HardDoorCabinetDto dto);
|
||||
|
||||
/**
|
||||
* 根据智能硬件id查询详情
|
||||
*/
|
||||
HardDoorManagerVo getByHardDoorId(Long hardDoorId);
|
||||
|
||||
/**
|
||||
* 根据硬件id查询详情
|
||||
*/
|
||||
HardDoorManagerVo getByHardId(Long hardId);
|
||||
|
||||
/**
|
||||
* 根据硬件设备编号查询详情
|
||||
*/
|
||||
HardDoorManagerVo getByDeviceCode(String deviceCode);
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
*/
|
||||
void bind(HardDoorManagerEntity dto);
|
||||
|
||||
/**
|
||||
* 刷新设备信息
|
||||
*/
|
||||
HardDoorManagerEntity refresh(String deviceCode);
|
||||
|
||||
/**
|
||||
* 音量修改
|
||||
*/
|
||||
void changeVolume(HardChangeVolume dto);
|
||||
|
||||
/**
|
||||
* 校验设备和货柜编号
|
||||
*/
|
||||
HardDoorManagerVo checkDeviceAndCabinet(Long hardDoorId, Integer cabinetNo);
|
||||
}
|
||||
+19
-1
@@ -2,15 +2,18 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,6 +45,21 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
*/
|
||||
Long appCreateOrderScancode(@Valid HardAppCreateOrderDto dto);
|
||||
|
||||
/**
|
||||
* 创建智能柜订单
|
||||
*/
|
||||
Long createHardDoorOrder(Long userId, Long hardId);
|
||||
|
||||
/**
|
||||
* 结算智能柜订单
|
||||
*/
|
||||
Long payHardDoorOrder(HardOrderEntity dto, List<KsRecognitionCallbackDto.ResultSku> ksSpuList);
|
||||
|
||||
/**
|
||||
* 智能柜取消订单
|
||||
*/
|
||||
Long cancelHardDoorOrder(Long orderId);
|
||||
|
||||
/**
|
||||
* 快速扣款,离线订单使用
|
||||
*/
|
||||
@@ -75,5 +93,5 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
/**
|
||||
* 创建订单后发送mq消息
|
||||
*/
|
||||
void createOrderAfterSendMqMsg(Long orderId);
|
||||
void createOrderAfterSendMqMsg(Long orderId, UserInfo userInfo);
|
||||
}
|
||||
+6
@@ -26,6 +26,11 @@ public interface HardOrderTotalService {
|
||||
*/
|
||||
List<HardOrderCsVo> listCsByDay(Page page, HardOrderDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 查询商户总共流水记录
|
||||
*/
|
||||
HardOrderCsVo mchWaterTotal(HardOrderDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 部门交易记录
|
||||
*/
|
||||
@@ -45,4 +50,5 @@ public interface HardOrderTotalService {
|
||||
* 统计每天、每周、每月、每年的交易人数和次数
|
||||
*/
|
||||
HardChartLatitudeVo chartLatitude(Long merchantId);
|
||||
|
||||
}
|
||||
+2
@@ -10,4 +10,6 @@ import java.util.List;
|
||||
public interface HardSpuJoinService extends IService<HardSpuJoinEntity> {
|
||||
|
||||
List<HardSpuJoinVo> scopeList(HardSpuJoinDto dto);
|
||||
|
||||
List<HardSpuJoinVo> getSpuList(Long hardDoorId, Integer cabinetNo);
|
||||
}
|
||||
+8
-1
@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -17,7 +19,7 @@ public interface HardSpuRepertoryService extends IService<HardSpuRepertoryEntity
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardSpuRepertoryEntity entity, PjcloudUser user);
|
||||
Long create(HardSpuRepertoryDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
@@ -28,4 +30,9 @@ public interface HardSpuRepertoryService extends IService<HardSpuRepertoryEntity
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
/**
|
||||
* app上架完成
|
||||
*/
|
||||
Boolean appRepertoryDone(DeductionSpuRepertoryDto body, Long userId);
|
||||
}
|
||||
+33
-1
@@ -3,7 +3,10 @@ package com.bsd.pjcloud.hard.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuStockDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardPutawayDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo;
|
||||
@@ -19,6 +22,10 @@ public interface HardSpuService extends IService<HardSpuEntity> {
|
||||
*/
|
||||
Page<HardSpuVo> scopPageJoin(Page page, HardSpuDto dto, DataScope dataScope);
|
||||
|
||||
List<HardSpuEntity> get(List<String> ksSpuIds);
|
||||
|
||||
List<HardSpuEntity> getByIds(List<Long> spuIds);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@@ -37,10 +44,35 @@ public interface HardSpuService extends IService<HardSpuEntity> {
|
||||
/**
|
||||
* 根据 hardwareId 和 cabinetNo 查询商品
|
||||
*/
|
||||
List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo);
|
||||
List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long Long, String cabinetNo);
|
||||
|
||||
/**
|
||||
* 查询货柜补货商品列表
|
||||
*/
|
||||
List<HardSpuJoinVo> appCabinetPutawayList(Long hardDoorId, String cabinetNo);
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
void putaway(HardPutawayDto dto);
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
void unPutaway(HardPutawayDto dto);
|
||||
|
||||
/**
|
||||
* 拉取旷世商品
|
||||
*/
|
||||
void asyncAll();
|
||||
|
||||
/**
|
||||
* 检验商品
|
||||
*/
|
||||
HardSpuEntity validateSpu(Long hardSpuId);
|
||||
|
||||
/**
|
||||
* 扣减库存
|
||||
*/
|
||||
Boolean deductionSpuStock(HardDoorFlowEntity hardDoorFlow, List<DeductionSpuStockDto> list);
|
||||
}
|
||||
+2
-2
@@ -28,7 +28,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
public HardAdUserVo getUserById(Long userId, HardTypeEnum type) {
|
||||
HardAdUserVo result = new HardAdUserVo();
|
||||
// 查询用户
|
||||
UserInfo user = userService.getByUserId(userId).getData();
|
||||
UserInfo user = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(user)) return null;
|
||||
// 查询钱包
|
||||
// WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY;
|
||||
@@ -59,7 +59,7 @@ public class HardApiServiceImpl implements HardApiService {
|
||||
WalletManageEntity wallet = remoteWalletService.getWalletByCardNumber(card).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) return null;
|
||||
// 查询用户
|
||||
UserInfo user = userService.getByUserId(wallet.getUserId()).getData();
|
||||
UserInfo user = userService.getInnerByUserId(wallet.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) return null;
|
||||
SysUser sysUser = user.getSysUser();
|
||||
result.setUserId(sysUser.getUserId());
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import com.bsd.pjcloud.hard.mapper.HardApptMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardApptService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 设备预约管理
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEntity> implements HardApptService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(HardApptEntity dto) {
|
||||
// title不能重复
|
||||
if (existTitle(dto.getTitle(), null)) {
|
||||
throw new RuntimeException("标题不能重复");
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Override
|
||||
public Long edit(HardApptEntity dto) {
|
||||
// title不能重复
|
||||
if (existTitle(dto.getTitle(), dto.getId())) {
|
||||
throw new RuntimeException("标题不能重复");
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
baseMapper.deleteBatchIds(list);
|
||||
}
|
||||
|
||||
private boolean existTitle(String title, Long id) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardApptEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(title), HardApptEntity::getTitle, title)
|
||||
.ne(ObjectUtil.isNotEmpty(id), HardApptEntity::getId, id)
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(id)) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
+130
-1
@@ -1,28 +1,41 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardAuthDto;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardAuthTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.flow.HardDoorFlowBizEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardDoorOpenTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.*;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardGetAuthAppVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardAuthMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardAuthService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,6 +48,10 @@ import java.util.List;
|
||||
@Service
|
||||
public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEntity> implements HardAuthService {
|
||||
|
||||
private final HardDoorManagerService hardDoorManagerService;
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
private final HardOrderService hardOrderService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
@@ -46,6 +63,96 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* app获取智能柜授权信息
|
||||
*/
|
||||
@Override
|
||||
public HardGetAuthAppVo appGetAuthHardDoor(HardGetAuthAppDto dto) {
|
||||
// 检验智能柜
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getDoorHardId(), dto.getCabinetNo());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
throw new RuntimeException("获取智能柜授权信息错误");
|
||||
}
|
||||
HardAuthEntity insetObj = HardAuthEntity.builder()
|
||||
.userId(dto.getUserId())
|
||||
.hardId(hardDoorDetail.getHardId())
|
||||
.cabinetNo(dto.getCabinetNo())
|
||||
.authType(HardAuthTypeEnum.HARD_DDOR_AUTH.getType())
|
||||
.authStatus(YesNoEnum.NO.getCode())
|
||||
.isDone(YesNoEnum.NO.getCode())
|
||||
.build();
|
||||
baseMapper.insert(insetObj);
|
||||
HardGetAuthAppVo auhtVo = new HardGetAuthAppVo();
|
||||
auhtVo.setAuthDesc(getHardDoorAuthDesc());
|
||||
auhtVo.setAuthId(insetObj.getId());
|
||||
return auhtVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* app智能柜授权
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long appAuthHardDoor(HardAuthAppDto dto) {
|
||||
// 查询授权信息
|
||||
HardAuthEntity authEntity = baseMapper.selectById(dto.getAuthId());
|
||||
if (ObjectUtil.isEmpty(authEntity)) throw new RuntimeException("授权信息不存在");
|
||||
// 查询设备信息
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByHardId(authEntity.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("授权信息不存在");
|
||||
HardAuthEntity updateObj = HardAuthEntity.builder().id(dto.getAuthId()).authStatus(dto.getAuthStatus()).authTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(updateObj);
|
||||
if (ObjectUtil.equals(dto.getAuthStatus(), YesNoEnum.YES.getCode())) {
|
||||
// 开门
|
||||
HardDoorFlowOpenDto openDoorDto = new HardDoorFlowOpenDto();
|
||||
openDoorDto.setHardDoorId(hardDoorDetail.getId());
|
||||
openDoorDto.setCabinetNo(authEntity.getCabinetNo());
|
||||
openDoorDto.setFlowType(HardDoorFlowBizEnum.PAY_OPEN);
|
||||
openDoorDto.setOpenType(HardDoorOpenTypeEnum.RECORD_VIDEO);
|
||||
openDoorDto.setUserId(dto.getUserId());
|
||||
openDoorDto.setAuthId(dto.getAuthId());
|
||||
hardDoorFlowService.openDoorPay(openDoorDto, hardDoorDetail);
|
||||
}
|
||||
return dto.getAuthId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户信誉
|
||||
*/
|
||||
@Override
|
||||
public boolean judgeUserCredit(Long userId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardAuthEntity>()
|
||||
.eq(HardAuthEntity::getUserId, userId)
|
||||
.eq(HardAuthEntity::getAuthStatus, YesNoEnum.YES.getCode())
|
||||
.eq(HardAuthEntity::getIsDone, YesNoEnum.NO.getCode())
|
||||
.ne(HardAuthEntity::getIsManualChange, YesNoEnum.YES.getCode())
|
||||
);
|
||||
return count <= 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程错误手动处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void errorChange(HardAuthErrorChangeDto dto, Long userId) {
|
||||
HardDoorFlowEntity hardDoorFlow = hardDoorFlowService.getById(dto.getFlowId());
|
||||
if (ObjectUtil.isEmpty(hardDoorFlow)) {
|
||||
throw new RuntimeException("智能柜子购买流程不存在");
|
||||
}
|
||||
HardAuthEntity hardAuth = baseMapper.selectById(hardDoorFlow.getAuthId());
|
||||
HardAuthEntity updateObj = new HardAuthEntity();
|
||||
updateObj.setId(hardAuth.getId());
|
||||
updateObj.setManualChangeUserId(userId);
|
||||
updateObj.setIsManualChange(YesNoEnum.YES.getCode());
|
||||
updateObj.setManualChangeTime(LocalDateTime.now());
|
||||
updateObj.setManualChangeRemark(dto.getRemark());
|
||||
updateObj.setManualChangePic(dto.getImage());
|
||||
baseMapper.updateById(updateObj);
|
||||
// 更新订单状态
|
||||
hardOrderService.cancelHardDoorOrder(hardDoorFlow.getOrderId());
|
||||
}
|
||||
|
||||
private void disposeList(List<HardAuthVo> list, HardAuthDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
@@ -67,4 +174,26 @@ public class HardAuthServiceImpl extends ServiceImpl<HardAuthMapper, HardAuthEnt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取智能柜授权描述
|
||||
*/
|
||||
private String getHardDoorAuthDesc() {
|
||||
StringBuilder strBuilder = new StringBuilder();
|
||||
strBuilder.append("授权告示\n")
|
||||
.append("欢迎使用我们的智能柜设备!为确保您可以顺利使用免密支付的先拿后付功能,请您仔细阅读以下授权条款:\n")
|
||||
.append("\n授权使用\n")
|
||||
.append("我们需要您的授权,以允许您通过智能柜进行商品的获取和自动结算。您同意在使用本设备时遵守以下条款。\n")
|
||||
.append("\n使用流程\n")
|
||||
.append("请您首先同意本授权,并启动开门程序。\n")
|
||||
.append("设备开门后,您可以选择并取走所需商品。\n")
|
||||
.append("关闭柜门后,系统将自动进行结算,费用将通过您事先绑定的支付方式扣除。\n")
|
||||
.append("\n免密支付\n")
|
||||
.append("您的支付信息将被安全存储,结算时无需再次输入密码。请确认您所使用的支付方式已正确绑定至您的账户。\n")
|
||||
.append("\n隐私保护\n")
|
||||
.append("您的个人信息和支付信息将受到严格保护,并仅用于本次交易及相关服务。\n")
|
||||
.append("\n同意条款\n")
|
||||
.append("使用本智能柜设备即视为您已阅读并同意以上所有条款。请谨慎使用,确保遵守使用规定。");
|
||||
return strBuilder.toString();
|
||||
}
|
||||
}
|
||||
+124
-1
@@ -1,24 +1,33 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardBroadcastEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardBroadcastDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardBroadcastEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardAuthVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardBroadcastVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardBroadcastMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardBroadcastService;
|
||||
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
|
||||
import com.bsd.pjcloud.mqtt.constant.MqttActionEnum;
|
||||
import com.bsd.pjcloud.mqtt.dto.hard.HardTakeFoodBroadcastMsg;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,10 +45,14 @@ import java.util.List;
|
||||
@Service
|
||||
public class HardBroadcastServiceImpl extends ServiceImpl<HardBroadcastMapper, HardBroadcastEntity> implements HardBroadcastService {
|
||||
|
||||
static private final String TAG = "硬件广播";
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
|
||||
@Override
|
||||
public Page<HardBroadcastVo> scopePageJoin(Page page, HardBroadcastDto dto, DataScope dataScope) {
|
||||
Page<HardBroadcastVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
@@ -47,6 +60,116 @@ public class HardBroadcastServiceImpl extends ServiceImpl<HardBroadcastMapper, H
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加线下食堂预约订单广播
|
||||
*/
|
||||
@Override
|
||||
public void addReserveOrderTask(HardOrderEntity orderdetail, UserInfo userInfo) {
|
||||
if (ObjectUtil.isEmpty(orderdetail)) return;
|
||||
HardTypeEnum hardTypeEnum = HardTypeEnum.valueOfByType(orderdetail.getSysType());
|
||||
if (ObjectUtil.isEmpty(orderdetail)) {
|
||||
log.error("|{}|发送线下订餐mq消息失败,设备类型错误hardType不存在hardType|{}|", TAG, orderdetail.getSysType());
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.notEqual(hardTypeEnum, HardTypeEnum.CANTEEN)) return;
|
||||
HardOrderTypeEnum hardOrderType = HardOrderTypeEnum.valueOfByType(orderdetail.getOrderType());
|
||||
if (ObjectUtil.isEmpty(hardOrderType)) {
|
||||
log.error("|{}|发送线下订餐mq消息失败,订餐类型错误hardType不存在hardType|{}|", TAG, orderdetail.getOrderType());
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.notEqual(hardOrderType, HardOrderTypeEnum.RESERVE)) return;
|
||||
// 是否重复
|
||||
HardBroadcastEntity broadcastDetail = baseMapper.selectOne(new LambdaQueryWrapper<HardBroadcastEntity>()
|
||||
.eq(HardBroadcastEntity::getBizId, orderdetail.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(broadcastDetail)) {
|
||||
log.error("|{}|发送线下订餐mq消息失败,广播已存在|{}|", TAG, orderdetail.getId());
|
||||
return;
|
||||
}
|
||||
// 查询设备
|
||||
HardManagerEntity hardDetail = hardManagerMapper.selectOne(new LambdaQueryWrapper<HardManagerEntity>()
|
||||
.eq(HardManagerEntity::getMerchantId, orderdetail.getMerchantId())
|
||||
.eq(HardManagerEntity::getIsTakeFood, YesNoEnum.YES.getCode())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(hardDetail)) {
|
||||
log.error("|{}|发送线下订餐mq消息失败,默认订餐设备不存在|{}|", TAG, orderdetail.getId());
|
||||
return;
|
||||
}
|
||||
String content = "";
|
||||
String phone = userInfo.getSysUser().getPhone();
|
||||
if (ObjectUtil.isNotEmpty(phone) && phone.length() >= 4) {
|
||||
content = phone.substring(phone.length() - 4);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(content)) {
|
||||
log.error("|{}|发送线下订餐mq消息失败,生成发送消息错误|{}|", TAG, orderdetail.getId());
|
||||
return;
|
||||
}
|
||||
HardBroadcastEntity saveObj = HardBroadcastEntity.builder()
|
||||
.userId(orderdetail.getUserId())
|
||||
.hardId(hardDetail.getId())
|
||||
.topic(hardDetail.getMainTopic())
|
||||
.bizType(HardBroadcastEnum.OFFLINE_CANTEEN_RESERVE.getType())
|
||||
.bizId(String.valueOf(orderdetail.getId()))
|
||||
.title(HardBroadcastEnum.OFFLINE_CANTEEN_RESERVE.getDescription())
|
||||
.content(content)
|
||||
.broadcastCount(0)
|
||||
.broadcastMaxCount(20)
|
||||
.isBroadcast(YesNoEnum.YES.getCode())
|
||||
.isDone(YesNoEnum.NO.getCode())
|
||||
.build();
|
||||
baseMapper.insert(saveObj);
|
||||
String topic = saveObj.getTopic().replaceAll("/#", "");
|
||||
// 发送mq
|
||||
HardTakeFoodBroadcastMsg msg = new HardTakeFoodBroadcastMsg();
|
||||
msg.setTopic(topic);
|
||||
msg.setAction(MqttActionEnum.TAKE_FOOD_BROADCAST);
|
||||
msg.setUserId(String.valueOf(userInfo.getSysUser().getUserId()));
|
||||
msg.setUsername(userInfo.getSysUser().getName());
|
||||
msg.setUserMobile(userInfo.getSysUser().getPhone());
|
||||
msg.setId(String.valueOf(saveObj.getId()));
|
||||
msg.setTitle(saveObj.getTitle());
|
||||
msg.setContent(saveObj.getContent());
|
||||
msg.setBroadcastMaxCount(saveObj.getBroadcastMaxCount());
|
||||
msg.setProductDesc(orderdetail.getProductDesc());
|
||||
msg.setPayPrice(orderdetail.getPayPrice());
|
||||
msg.setHourType(orderdetail.getHourType());
|
||||
remoteMqttEventService.sendTakeFoodBroadcast(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成硬件广播
|
||||
*/
|
||||
@Override
|
||||
public void doneBroadcast(HardOrderEntity orderdetail) {
|
||||
if (ObjectUtil.isEmpty(orderdetail)) return;
|
||||
HardTypeEnum hardTypeEnum = HardTypeEnum.valueOfByType(orderdetail.getSysType());
|
||||
if (ObjectUtil.isEmpty(orderdetail)) {
|
||||
log.error("|{}|doneBroadcast发送mq消息失败,设备类型错误hardType不存在hardType|{}|", TAG, orderdetail.getSysType());
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.notEqual(hardTypeEnum, HardTypeEnum.CANTEEN)) return;
|
||||
HardOrderTypeEnum hardOrderType = HardOrderTypeEnum.valueOfByType(orderdetail.getOrderType());
|
||||
if (ObjectUtil.isEmpty(hardOrderType)) {
|
||||
log.error("|{}|doneBroadcast发送mq消息失败,订餐类型错误hardType不存在hardType|{}|", TAG, orderdetail.getOrderType());
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.notEqual(hardOrderType, HardOrderTypeEnum.RESERVE)) return;
|
||||
HardBroadcastEntity broadcastDetail = baseMapper.selectOne(new LambdaQueryWrapper<HardBroadcastEntity>()
|
||||
.eq(HardBroadcastEntity::getBizId, orderdetail.getId())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(broadcastDetail)) {
|
||||
log.error("|{}|doneBroadcast发送mq消息失败,广播不存在|{}|", TAG, orderdetail.getId());
|
||||
return;
|
||||
}
|
||||
HardBroadcastEntity updateObj = HardBroadcastEntity.builder()
|
||||
.id(broadcastDetail.getId())
|
||||
.isBroadcast(YesNoEnum.NO.getCode())
|
||||
.isDone(YesNoEnum.YES.getCode())
|
||||
.isDoneTime(orderdetail.getCreateTime())
|
||||
.build();
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
private void disposeList(List<HardBroadcastVo> list, HardBroadcastDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
|
||||
+444
@@ -0,0 +1,444 @@
|
||||
package com.bsd.pjcloud.hard.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.UserVO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.constant.flow.HardDoorFlowBizEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.flow.HardDoorFlowEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardDoorFlowOpenDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardAuthEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuJoinVo;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import com.bsd.pjcloud.hard.mapper.HardDoorFlowMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdDoorApiService;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdKsService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.*;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionDto;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorOpenVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.ks.KsRecognitionVo;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能柜流程
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, HardDoorFlowEntity> implements HardDoorFlowService {
|
||||
|
||||
private static final String TAG = "智能柜流程";
|
||||
|
||||
private final HardDoorManagerService hardDoorManagerService;
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
private final HardSpuJoinService hardSpuJoinService;
|
||||
private final HardOrderService hardOrderService;
|
||||
@Lazy
|
||||
private final HardAuthService hardAuthService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoterThirdDoorApiService thirdDoorApiService;
|
||||
private final RemoterThirdKsService thirdKsService;
|
||||
private final RemoteUserService remoteUserService;
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
|
||||
/**
|
||||
* 复杂查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardDoorFlowVo> scopePageJoin(Page page, HardDoorFlowDto dto, DataScope dataScope) {
|
||||
Page<HardDoorFlowVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardDoorFlowVo join(Long id) {
|
||||
HardDoorFlowEntity detail = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(detail)) return null;
|
||||
HardDoorFlowVo result = BeanUtil.toBean(detail, HardDoorFlowVo.class);
|
||||
disposeList(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过订单id查询流程
|
||||
*/
|
||||
@Override
|
||||
public HardDoorFlowVo getByOrderId(Long orderId) {
|
||||
HardDoorFlowEntity detail = baseMapper.selectOne(new LambdaQueryWrapper<HardDoorFlowEntity>().eq(HardDoorFlowEntity::getOrderId, orderId));
|
||||
if (ObjectUtil.isEmpty(detail)) return null;
|
||||
HardDoorFlowVo result = BeanUtil.toBean(detail, HardDoorFlowVo.class);
|
||||
disposeList(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据旷世识别id查询
|
||||
*/
|
||||
public HardDoorFlowEntity get(String ksRecogId) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<HardDoorFlowEntity>()
|
||||
.eq(HardDoorFlowEntity::getSkuSubmitRecogId, ksRecogId)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long openDoor(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorVo) {
|
||||
HardDoorFlowEntity saveObj = HardDoorFlowEntity.builder().flowStatus(HardDoorFlowEnum.FLOW_AUTH.getType()).userId(dto.getUserId()).bizType(dto.getFlowType().getType()).isOpen(YesNoEnum.NO.getCode()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
hardDoorManagerService.refresh(hardDoorVo.getDeviceCode());
|
||||
// 校验设备和货柜编号
|
||||
HardDoorManagerEntity hardDoorStatus = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(saveObj.getId()).flowStatus(saveObj.getFlowStatus()).hardId(hardDoorStatus.getHardId()).hardDoorId(dto.getHardDoorId()).cabinetNo(dto.getCabinetNo()).flowStatus(HardDoorFlowEnum.FLOW_APPLY_OPEN.getType()).requestOpenTime(LocalDateTime.now()).build();
|
||||
// 请求开门
|
||||
DoorOpenDto openDto = BeanUtil.toBean(dto, DoorOpenDto.class);
|
||||
openDto.setDeviceCode(hardDoorVo.getDeviceCode());
|
||||
openDto.setCabinetNo(dto.getCabinetNo());
|
||||
openDto.setOutOpenNo(String.valueOf(saveObj.getId()));
|
||||
openDto.setEventType(Integer.valueOf(dto.getOpenType().getType()));
|
||||
DoorOpenVo openVo = thirdDoorApiService.open(openDto).getData();
|
||||
updateObj.setRequestOpenDto(JSONUtil.toJsonStr(openDto));
|
||||
updateObj.setRequestOpenVo(JSONUtil.toJsonStr(openVo));
|
||||
if (ObjectUtil.isEmpty(openVo) || !openVo.isSuccess()) {
|
||||
String errorMsg = "智能柜申请开门错误," + openVo.getMessage();
|
||||
updateObj.setError(errorMsg);
|
||||
baseMapper.updateById(updateObj);
|
||||
throw new RuntimeException(errorMsg);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getAuthId())) updateObj.setAuthId(dto.getAuthId());
|
||||
baseMapper.updateById(updateObj);
|
||||
return updateObj.getId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检修开门
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void openDoorAccess(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
getSelf().openDoor(dto, doorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检修关门
|
||||
*/
|
||||
@Override
|
||||
public void closeAccess(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
// 请求关门
|
||||
DoorOpenDto openDto = BeanUtil.toBean(dto, DoorOpenDto.class);
|
||||
openDto.setDeviceCode(doorDetail.getDeviceCode());
|
||||
openDto.setCabinetNo(dto.getCabinetNo());
|
||||
openDto.setOutOpenNo(RandomUtil.randomString(32));
|
||||
openDto.setEventType(Integer.valueOf(dto.getOpenType().getType()));
|
||||
DoorOpenVo openVo = thirdDoorApiService.open(openDto).getData();
|
||||
if (ObjectUtil.isEmpty(openVo) || !openVo.isSuccess()) {
|
||||
throw new RuntimeException("关门失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买开门
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void openDoorPay(HardDoorFlowOpenDto dto, HardDoorManagerVo hardDoorDetail) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getHardDoorFlowId()) || ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
return;
|
||||
}
|
||||
// 查看用户消费钱包余额
|
||||
String walletErrorMsg = remoteWalletService.innserIsUseDoor(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(walletErrorMsg)) {
|
||||
throw new RuntimeException(walletErrorMsg);
|
||||
}
|
||||
// 查看用户信誉
|
||||
boolean userCredit = hardAuthService.judgeUserCredit(dto.getUserId());
|
||||
if (!userCredit) {
|
||||
throw new RuntimeException("用户信誉不足,请联系管理员");
|
||||
}
|
||||
// 查看当前用户是否有正在进行购买的动作
|
||||
Long isHaveFlowCount = baseMapper.selectCount(new LambdaQueryWrapper<HardDoorFlowEntity>()
|
||||
.eq(HardDoorFlowEntity::getUserId, dto.getUserId())
|
||||
.eq(HardDoorFlowEntity::getIsOpen, YesNoEnum.NO.getCode())
|
||||
.eq(HardDoorFlowEntity::getBizType, HardDoorFlowBizEnum.PAY_OPEN.getType())
|
||||
.between(HardDoorFlowEntity::getCreateTime, LocalDateTime.now().minus(1, ChronoUnit.HOURS), LocalDateTime.now())
|
||||
);
|
||||
if (isHaveFlowCount > 0) throw new RuntimeException("正在购买中请勿重复操作,请稍后再试");
|
||||
// 查询货柜是否配置spu信息
|
||||
List<HardSpuJoinVo> spuList = hardSpuJoinService.getSpuList(hardDoorDetail.getId(), dto.getCabinetNo());
|
||||
if (ObjectUtil.isEmpty(spuList) || spuList.isEmpty()) throw new RuntimeException("货柜商品信息为空,请上架");
|
||||
getSelf().openDoor(dto, hardDoorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架开门
|
||||
*/
|
||||
@Override
|
||||
public Long openDoorRepertory(HardDoorFlowOpenDto dto) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerVo doorDetail = hardDoorManagerService.checkDeviceAndCabinet(dto.getHardDoorId(), dto.getCabinetNo());
|
||||
return getSelf().openDoor(dto, doorDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理开门回调
|
||||
*/
|
||||
@Override
|
||||
public void disposeLocakCallback(DoorOpenCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto.getType()) || ObjectUtil.equals(dto.getResultCode(), "FAIL")) return;
|
||||
// 查询流程
|
||||
HardDoorFlowEntity flowDetail = baseMapper.selectById(dto.getOutOpenNo());
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getOpenCallbackTime())) return;
|
||||
boolean isOpenDoor = ObjectUtil.equals(dto.getType(), "OPEN");
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).isOpen(isOpenDoor ? YesNoEnum.YES.getCode() : YesNoEnum.NO.getCode()).flowStatus(HardDoorFlowEnum.FLOW_CALLBACK_OPEN.getType()).openCallbackVo(JSONUtil.toJsonStr(dto)).openCallbackTime(LocalDateTime.now()).build();
|
||||
// 如果是购买的话
|
||||
if (ObjectUtil.equals(flowDetail.getBizType(), HardDoorFlowBizEnum.PAY_OPEN.getType())) {
|
||||
// 创建订单
|
||||
Long orderId = hardOrderService.createHardDoorOrder(flowDetail.getUserId(), flowDetail.getHardId());
|
||||
updateObj.setOrderId(orderId);
|
||||
}
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理柜子状态回调
|
||||
*/
|
||||
@Override
|
||||
public void disposeStatusCallback(DoorStatusCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
log.error("|{}|disposeStatusCallback 意外的错误,参数错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
HardDoorManagerVo hardDoorDetail = hardDoorManagerService.getByDeviceCode(dto.getDeviceCode());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
log.error("|{}|disposeStatusCallback 意外的错误,设备不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
hardDoorCabinetService.saveOrUpdate(hardDoorDetail.getId(), dto.getCabinetList());
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|disposeStatusCallback 更新柜子状态失败dto|{}|", TAG, JSONUtil.toJsonStr(dto), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理视频回调
|
||||
*/
|
||||
@Override
|
||||
public void disposeVideoCallback(DoorVideoCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getVideoList()) || ObjectUtil.equals(dto.getResultCode(), "FAIL")) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,参数错误或者状态错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 查询流程
|
||||
HardDoorFlowEntity flowDetail = baseMapper.selectById(dto.getOutOpenNo());
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getSkuSubmitTime())) {
|
||||
log.info("|{}|disposeVideoCallback 意外的错误,流程不存在或重复dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 更新视频回调流程
|
||||
HardDoorFlowEntity callbackUpdateObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).flowStatus(HardDoorFlowEnum.FLOW_CALLBACK_VIDEO.getType()).videoCallbackVo(JSONUtil.toJsonStr(dto)).videoCallbackTime(LocalDateTime.now()).build();
|
||||
baseMapper.updateById(callbackUpdateObj);
|
||||
// 提交视频
|
||||
List<String> videoList = dto.getVideoList().stream().map(DoorVideoCallbackDto.Video::getVideoUrl).toList();
|
||||
// 提交柜子商品信息
|
||||
List<HardSpuJoinVo> spuList = hardSpuJoinService.getSpuList(flowDetail.getHardDoorId(), flowDetail.getCabinetNo());
|
||||
Map<String, Object> ksMap = new HashMap<>();
|
||||
List<Map<String, Object>> ksSpuMap = new ArrayList<>();
|
||||
for (HardSpuJoinVo v : spuList) {
|
||||
if (ObjectUtil.isEmpty(v.getSpuDetail())) continue;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("sku_id", v.getSpuDetail().getKsSkuId());
|
||||
map.put("floor_num", v.getHardDoorNumber());
|
||||
ksSpuMap.add(map);
|
||||
}
|
||||
ksMap.put("origin_time", System.currentTimeMillis());
|
||||
ksMap.put("sku_scope", ksSpuMap);
|
||||
// 提交识别
|
||||
KsRecognitionDto ksRecognitionDto = new KsRecognitionDto();
|
||||
ksRecognitionDto.setRecog_id(String.valueOf(flowDetail.getId()));
|
||||
ksRecognitionDto.setExtra_params(ksMap);
|
||||
ksRecognitionDto.setResource_type("1");
|
||||
ksRecognitionDto.setContainer_id(String.valueOf(flowDetail.getHardDoorId()));
|
||||
ksRecognitionDto.setResource_urls(videoList);
|
||||
// third服务生成
|
||||
ksRecognitionDto.setNotify_url("");
|
||||
ksRecognitionDto.setSub_mch_id(String.valueOf(flowDetail.getOrderId()));
|
||||
// 更新sku提交流程
|
||||
HardDoorFlowEntity submitUploadObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).flowStatus(HardDoorFlowEnum.FLOW_SUBMIT_RECOGNITION.getType()).skuSubmitTime(LocalDateTime.now()).build();
|
||||
KsRecognitionVo ksRecognitionVo = thirdKsService.recognition(ksRecognitionDto).getData();
|
||||
submitUploadObj.setSkuSubmitDto(JSONUtil.toJsonStr(ksRecognitionDto));
|
||||
submitUploadObj.setSkuSubmitVo(JSONUtil.toJsonStr(ksRecognitionVo));
|
||||
submitUploadObj.setSkuSubmitRecogId(ksRecognitionVo.getKs_recog_id());
|
||||
if (ObjectUtil.isEmpty(ksRecognitionVo) || !ksRecognitionVo.isSuccess() || ObjectUtil.isEmpty(ksRecognitionVo.getKs_recog_id())) {
|
||||
String errorMsg = String.format("|%s|disposeVideoCallback 提交识别错误dto|%s|vo|%s|", TAG, JSONUtil.toJsonStr(ksRecognitionDto), JSONUtil.toJsonStr(ksRecognitionVo));
|
||||
log.error(errorMsg);
|
||||
submitUploadObj.setErrorDesc(errorMsg);
|
||||
}
|
||||
// 更新流程
|
||||
baseMapper.updateById(submitUploadObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理旷世识别回调
|
||||
*/
|
||||
@Override
|
||||
public void disposeRecognitionCallback(KsRecognitionCallbackDto dto) {
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
log.error("|{}|disposeRecognitionCallback 参数错误dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 更新流程
|
||||
HardDoorFlowEntity flowDetail = get(dto.getKs_recog_id());
|
||||
if (ObjectUtil.isEmpty(flowDetail) || ObjectUtil.isNotEmpty(flowDetail.getSkuCallbackTime())) {
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,流程不存在或重复dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
// 查询授权流程
|
||||
HardAuthEntity authDetail = hardAuthService.getById(flowDetail.getAuthId());
|
||||
if (ObjectUtil.isEmpty(authDetail)) {
|
||||
log.error("|{}|disposeRecognitionCallback 意外的错误,授权流程不存在dto|{}|", TAG, JSONUtil.toJsonStr(dto));
|
||||
return;
|
||||
}
|
||||
HardDoorFlowEntity updateObj = HardDoorFlowEntity.builder().id(flowDetail.getId()).flowStatus(HardDoorFlowEnum.FLOW_CALLBACK_RECOGNITION.getType()).skuCallbackVo(JSONUtil.toJsonStr(dto)).skuCallbackTime(LocalDateTime.now()).build();
|
||||
String ksFlowCode = dto.getState().getCode();
|
||||
String ksRecognitionCode = dto.getResult().getStatus().getCode();
|
||||
if (ObjectUtil.notEqual(ksFlowCode, "2") || ObjectUtil.notEqual(ksRecognitionCode, "2")) {
|
||||
if (ObjectUtil.equals(ksFlowCode, "2") && ObjectUtil.equals(ksRecognitionCode, "3")) {
|
||||
// 未拿商品取消订单
|
||||
hardOrderService.cancelHardDoorOrder(flowDetail.getOrderId());
|
||||
baseMapper.updateById(updateObj);
|
||||
return;
|
||||
}
|
||||
String ksErrorMsg = String.format("商品识别响应错误:ksFlowCode:%s;ksRecognitionCode:%s;", ksFlowCode, ksRecognitionCode);
|
||||
log.error(ksErrorMsg);
|
||||
updateObj.setError(ksErrorMsg);
|
||||
baseMapper.updateById(updateObj);
|
||||
return;
|
||||
}
|
||||
KsRecognitionCallbackDto.Result result = dto.getResult();
|
||||
List<KsRecognitionCallbackDto.ResultSku> resultSkuList = result.getResult();
|
||||
if (ObjectUtil.isEmpty(resultSkuList)) {
|
||||
String ksErrorMsg = "商品识别响应错误,识别的商品列表为空";
|
||||
log.error(ksErrorMsg);
|
||||
updateObj.setError(ksErrorMsg);
|
||||
baseMapper.updateById(updateObj);
|
||||
return;
|
||||
}
|
||||
// 查询订单
|
||||
HardOrderEntity orderDetail = hardOrderService.getById(flowDetail.getOrderId());
|
||||
if (ObjectUtil.isEmpty(orderDetail)) {
|
||||
String ksErrorMsg = String.format("订单结算错误,订单不存在orderId%s", flowDetail.getOrderId());
|
||||
log.error(ksErrorMsg);
|
||||
updateObj.setError(ksErrorMsg);
|
||||
baseMapper.updateById(updateObj);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Long orderId = hardOrderService.payHardDoorOrder(orderDetail, resultSkuList);
|
||||
if (ObjectUtil.isNotEmpty(orderId)) {
|
||||
updateObj.setPayTime(LocalDateTime.now());
|
||||
updateObj.setFlowStatus(HardDoorFlowEnum.FLOW_PAY_ORDER.getType());
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
// 完成授权流程
|
||||
HardAuthEntity updateAuthObj = HardAuthEntity.builder().id(authDetail.getId()).isDone(YesNoEnum.YES.getCode()).isDoneTime(LocalDateTime.now()).build();
|
||||
hardAuthService.updateById(updateAuthObj);
|
||||
} catch (Exception e) {
|
||||
String ksErrorMsg = String.format("订单结算错误,订单支付失败error%s;", e.getMessage());
|
||||
log.error(ksErrorMsg);
|
||||
updateObj.setError(ksErrorMsg);
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeList(List<HardDoorFlowVo> list, HardDoorFlowDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardDoorFlowVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
// 用户相关
|
||||
List<Long> userIds = list.stream().map(HardDoorFlowVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<UserVO>> userList = remoteUserService.getUserDeptByIds(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList.getData(), UserVO::getUserId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeList(HardDoorFlowVo detail) {
|
||||
// 用户
|
||||
List<UserVO> usrList = remoteUserService.getUserDeptByIds(List.of(detail.getUserId())).getData();
|
||||
if (ObjectUtil.isNotEmpty(usrList)) {
|
||||
DataUtil.convertUserDept(detail, usrList.get(0));
|
||||
}
|
||||
// 设备
|
||||
HardManagerEntity hardManager = hardManagerMapper.selectById(detail.getHardDoorId());
|
||||
if (ObjectUtil.isNotEmpty(hardManager)) {
|
||||
HardUtil.convertHard(detail, hardManager);
|
||||
}
|
||||
// 设备id
|
||||
HardAuthEntity hardAuth = hardAuthService.getById(detail.getAuthId());
|
||||
if (ObjectUtil.isNotEmpty(hardAuth)) {
|
||||
detail.setHardAuth(hardAuth);
|
||||
}
|
||||
}
|
||||
|
||||
private HardDoorFlowServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -129,7 +129,7 @@ public class HardInvoiceServiceImpl extends ServiceImpl<HardInvoiceMapper, HardI
|
||||
.eq(HardCarEntity::getParentCarId, order.getParentCarId())
|
||||
);
|
||||
// 查询用户
|
||||
UserInfo user = Optional.of(userService.getByUserId(order.getUserId())).map(R::getData).orElseThrow(() -> new RuntimeException("用户不存在"));
|
||||
UserInfo user = Optional.of(userService.getInnerByUserId(order.getUserId())).map(R::getData).orElseThrow(() -> new RuntimeException("用户不存在"));
|
||||
SysUser sysUser = user.getSysUser();
|
||||
// 查询商户
|
||||
MchManageVo mch = Optional.of(remoteMchService.getById(order.getMerchantId())).map(R::getData).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
|
||||
+4
-4
@@ -67,13 +67,13 @@ public class HardThirdSelfZyServiceImpl implements HardThirdSelfZyService {
|
||||
public HardCallbackPayVo pay(HardCallbackPayDto dto) {
|
||||
try {
|
||||
// 查询用户
|
||||
UserInfo userDetail = remoteUserService.getByUserId(dto.getUserId()).getData();
|
||||
UserInfo userDetail = remoteUserService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
// 钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
|
||||
// 用户
|
||||
UserInfo user = remoteUserService.getByUserId(wallet.getUserId()).getData();
|
||||
UserInfo user = remoteUserService.getInnerByUserId(wallet.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("用户不存在");
|
||||
// 查询正元默认商户
|
||||
MchManageVo zyDefaultMch = getZyDefaultMch();
|
||||
@@ -97,7 +97,6 @@ public class HardThirdSelfZyServiceImpl implements HardThirdSelfZyService {
|
||||
.parentCarId(null)
|
||||
.sysType(null)
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.merchantId(null)
|
||||
.orderType(HardOrderTypeEnum.ZY.getType())
|
||||
.payType(HardPayTypeEnum.WALLET_CARD.getType())
|
||||
.orderSourceTypeId(null)
|
||||
@@ -108,6 +107,7 @@ public class HardThirdSelfZyServiceImpl implements HardThirdSelfZyService {
|
||||
.productDesc(subject)
|
||||
.walletId(wallet.getId())
|
||||
.build();
|
||||
log.info("|{}| 正元支付创建订单参数|{}", TAG, JSONUtil.toJsonStr(orderObj));
|
||||
boolean isCreateOrder = hardOrderService.save(orderObj);
|
||||
if (!isCreateOrder) throw new RuntimeException("创建订单失败");
|
||||
hardOrderService.fastReduceBalance(orderObj);
|
||||
@@ -136,7 +136,7 @@ public class HardThirdSelfZyServiceImpl implements HardThirdSelfZyService {
|
||||
// 校验订单是否可以退款
|
||||
HardOrderVo order = hardAfterSaleService.validateOrderCanRefund(dto.getOrderId());
|
||||
// 用户
|
||||
UserInfo user = remoteUserService.getByUserId(order.getUserId()).getData();
|
||||
UserInfo user = remoteUserService.getInnerByUserId(order.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("用户不存在");
|
||||
// 添加售后订单
|
||||
HardAfterSaleEntity saveObj = BeanUtils.toBean(dto, HardAfterSaleEntity.class);
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.manager;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteFileService;
|
||||
import com.bsd.pjcloud.common.core.util.QRCodeImageGenerator;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetCodeVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardDoorCabinetMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorCabinetService;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorStatusVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 智能柜货柜
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardDoorCabinetServiceImpl extends ServiceImpl<HardDoorCabinetMapper, HardDoorCabinetEntity> implements HardDoorCabinetService {
|
||||
|
||||
private final RemoteFileService remoteFileService;
|
||||
|
||||
@Override
|
||||
public Page<HardDoorCabinetVo> scopePageJoin(Page page, HardDoorCabinetDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(Long hardDoorId, List<DoorStatusVo.Cabinet> list) {
|
||||
List<HardDoorCabinetEntity> cabinetList = baseMapper.selectList(new LambdaQueryWrapper<HardDoorCabinetEntity>()
|
||||
.eq(HardDoorCabinetEntity::getHardDoorId, hardDoorId)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(cabinetList)) {
|
||||
List<HardDoorCabinetEntity> addList = new ArrayList<>();
|
||||
for (DoorStatusVo.Cabinet cabinet : list) {
|
||||
HardDoorCabinetEntity entity = new HardDoorCabinetEntity();
|
||||
entity.setHardDoorId(hardDoorId);
|
||||
entity.setCabinetNo(cabinet.getCabinetNo());
|
||||
entity.setIsLockOnline(cabinet.getIsLockOnline());
|
||||
entity.setLockStatus(cabinet.getLockStatus());
|
||||
entity.setDoorStatus(cabinet.getDoorStatus());
|
||||
entity.setSaleStatus(cabinet.getSaleStatus());
|
||||
addList.add(entity);
|
||||
}
|
||||
baseMapper.insert(addList);
|
||||
return;
|
||||
}
|
||||
for (DoorStatusVo.Cabinet cabinet : list) {
|
||||
cabinetList.stream().filter(i -> ObjectUtil.equals(i.getCabinetNo(), cabinet.getCabinetNo()))
|
||||
.findFirst()
|
||||
.ifPresent(i -> {
|
||||
i.setIsLockOnline(cabinet.getIsLockOnline());
|
||||
i.setLockStatus(cabinet.getLockStatus());
|
||||
i.setDoorStatus(cabinet.getDoorStatus());
|
||||
i.setSaleStatus(cabinet.getSaleStatus());
|
||||
baseMapper.updateById(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardDoorCabinetEntity> getListByHardDoorId(Long hardDoorId) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<HardDoorCabinetEntity>()
|
||||
.eq(HardDoorCabinetEntity::getHardDoorId, hardDoorId)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新智能柜货柜二维码
|
||||
*/
|
||||
@Override
|
||||
public String refreshQrCode(Long hardDoorId, Integer cabinetNo) {
|
||||
// 查找货柜
|
||||
HardDoorCabinetEntity cabinetDetail = baseMapper.selectOne(new LambdaQueryWrapper<HardDoorCabinetEntity>()
|
||||
.eq(HardDoorCabinetEntity::getHardDoorId, hardDoorId)
|
||||
.eq(HardDoorCabinetEntity::getCabinetNo, cabinetNo)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(cabinetDetail)) throw new RuntimeException("货柜不存在");
|
||||
HardDoorCabinetCodeVo cabinetCodeVo = new HardDoorCabinetCodeVo();
|
||||
cabinetCodeVo.setHardDoorId(String.valueOf(hardDoorId));
|
||||
cabinetCodeVo.setCabinetNo(String.valueOf(cabinetNo));
|
||||
// 生成二维码
|
||||
String coeContent = Base64.encode(JSONUtil.toJsonStr(cabinetCodeVo));
|
||||
try {
|
||||
byte[] bytes = QRCodeImageGenerator.generateQrCodeImage(coeContent, 300);
|
||||
MultipartFile multipartFile = new MockMultipartFile("file", hardDoorId + "-" + System.currentTimeMillis() + ".png", "image/png", new ByteArrayInputStream(bytes));
|
||||
R upload = remoteFileService.innerUpload(multipartFile, null, null, null);
|
||||
Map data = (Map) upload.getData();
|
||||
String url = (String) data.get("url");
|
||||
// 更新
|
||||
HardDoorCabinetEntity updateObj = new HardDoorCabinetEntity();
|
||||
updateObj.setId(cabinetDetail.getId());
|
||||
updateObj.setQrCode(url);
|
||||
baseMapper.updateById(updateObj);
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
log.error("refreshQrCode刷新智能柜货柜二维码,hardDoorId:{},cabinetNo:{}", hardDoorId, cabinetNo, e);
|
||||
throw new RuntimeException("刷新二维码失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
+170
-17
@@ -1,28 +1,40 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.manager;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorCabinetDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardDoorManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardChangeVolume;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorCabinetVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardDoorManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardDoorManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorCabinetService;
|
||||
import com.bsd.pjcloud.hard.service.HardDoorManagerService;
|
||||
import com.bsd.pjcloud.thirdparty.api.feign.RemoterThirdDoorApiService;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorBindDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorRegisterDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVideoDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.DoorVolumeDto;
|
||||
import com.bsd.pjcloud.thirdparty.dto.door.*;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorBindVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorRegisterVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorStatusVo;
|
||||
import com.bsd.pjcloud.thirdparty.vo.door.DoorVolumeVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 智能柜设置
|
||||
*/
|
||||
@@ -32,11 +44,41 @@ import org.springframework.validation.annotation.Validated;
|
||||
@Service
|
||||
public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMapper, HardDoorManagerEntity> implements HardDoorManagerService {
|
||||
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
private final RemoterThirdDoorApiService thirdDoorApiService;
|
||||
|
||||
@Override
|
||||
public Page<HardDoorManagerVo> scopePageJoin(Page page, HardDoorManagerDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
Page<HardDoorManagerVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
disposeList(pageList.getRecords(), dto);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 柜门下拉查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardDoorCabinetVo> selectCabinet(Page page, HardDoorCabinetDto dto) {
|
||||
DataScope dataScope = new DataScope();
|
||||
return hardDoorCabinetService.scopePageJoin(page, dto, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据硬件id查询详情
|
||||
*/
|
||||
@Override
|
||||
public HardDoorManagerVo getByHardDoorId(Long hardDoorId) {
|
||||
HardDoorManagerVo hardDoor = baseMapper.pageJoinByHardDoorId(hardDoorId);
|
||||
if (ObjectUtil.isNotEmpty(hardDoor)) {
|
||||
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
|
||||
if (ObjectUtil.isNotEmpty(cabinetList)) {
|
||||
hardDoor.setCabinetList(cabinetList);
|
||||
}
|
||||
}
|
||||
return hardDoor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,39 +86,57 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
*/
|
||||
@Override
|
||||
public HardDoorManagerVo getByHardId(Long hardId) {
|
||||
return baseMapper.pageJoin(hardId);
|
||||
HardDoorManagerVo hardDoor = baseMapper.pageJoinByHardId(hardId);
|
||||
if (ObjectUtil.isNotEmpty(hardDoor)) {
|
||||
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
|
||||
if (ObjectUtil.isNotEmpty(cabinetList)) {
|
||||
hardDoor.setCabinetList(cabinetList);
|
||||
}
|
||||
}
|
||||
return hardDoor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardDoorManagerVo getByDeviceCode(String deviceCode) {
|
||||
HardDoorManagerEntity hardDoor = baseMapper.selectOne(new LambdaQueryWrapper<HardDoorManagerEntity>()
|
||||
.eq(HardDoorManagerEntity::getDeviceCode, deviceCode)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(hardDoor)) return null;
|
||||
HardDoorManagerVo hardDoorVo = BeanUtil.toBean(hardDoor, HardDoorManagerVo.class);
|
||||
if (ObjectUtil.isNotEmpty(hardDoorVo)) {
|
||||
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoor.getId());
|
||||
if (ObjectUtil.isNotEmpty(cabinetList)) {
|
||||
hardDoorVo.setCabinetList(cabinetList);
|
||||
}
|
||||
}
|
||||
return hardDoorVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bind(HardDoorManagerEntity dto) {
|
||||
// 查询设备
|
||||
HardDoorManagerVo hardDoorDetail = getByHardId(dto.getHardId());
|
||||
HardDoorManagerVo hardDoorDetail = getByHardDoorId(dto.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
saveOrUpdate.setImei(dto.getImei());
|
||||
saveOrUpdate.setDeviceCode(dto.getDeviceCode());
|
||||
saveOrUpdate.setDoorCount(dto.getDoorCount());
|
||||
baseMapper.insert(saveOrUpdate);
|
||||
dto.setId(saveOrUpdate.getId());
|
||||
} else {
|
||||
HardDoorManagerEntity saveOrUpdate = new HardDoorManagerEntity();
|
||||
saveOrUpdate.setId(hardDoorDetail.getId());
|
||||
saveOrUpdate.setHardId(dto.getHardId());
|
||||
saveOrUpdate.setImei(dto.getImei());
|
||||
saveOrUpdate.setDeviceCode(dto.getDeviceCode());
|
||||
saveOrUpdate.setDoorCount(dto.getDoorCount());
|
||||
baseMapper.updateById(saveOrUpdate);
|
||||
}
|
||||
// 设备绑定
|
||||
DoorBindDto bindDto = new DoorBindDto();
|
||||
bindDto.setImei(dto.getImei());
|
||||
bindDto.setDeviceCode(dto.getDeviceCode());
|
||||
bindDto.setOutDeviceCode(String.valueOf(dto.getHardId()));
|
||||
DoorBindVo bindVo = thirdDoorApiService.bind(bindDto).getData();
|
||||
if (!bindVo.isSuccess()) {
|
||||
throw new RuntimeException(bindVo.getMessage());
|
||||
}
|
||||
// 设备注册
|
||||
DoorRegisterDto registerDto = new DoorRegisterDto();
|
||||
registerDto.setImei(dto.getImei());
|
||||
@@ -85,6 +145,62 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
if (!registerVo.isSuccess()) {
|
||||
throw new RuntimeException(registerVo.getMessage());
|
||||
}
|
||||
if (ObjectUtil.isEmpty(registerVo.getDeviceCode())) {
|
||||
throw new RuntimeException("设备注册失败");
|
||||
}
|
||||
// 设备绑定
|
||||
DoorBindDto bindDto = new DoorBindDto();
|
||||
bindDto.setImei(dto.getImei());
|
||||
bindDto.setDeviceCode(registerVo.getDeviceCode());
|
||||
bindDto.setOutDeviceCode(String.valueOf(dto.getHardId()));
|
||||
DoorBindVo bindVo = thirdDoorApiService.bind(bindDto).getData();
|
||||
if (!bindVo.isSuccess()) {
|
||||
throw new RuntimeException(bindVo.getMessage());
|
||||
}
|
||||
// 查询设备详情
|
||||
HardDoorManagerEntity hardDoorManagerDetail = baseMapper.selectById(dto.getId());
|
||||
// 注册的设备信息
|
||||
HardDoorManagerEntity updateObj = new HardDoorManagerEntity();
|
||||
updateObj.setId(hardDoorManagerDetail.getId());
|
||||
updateObj.setDeviceCode(registerVo.getDeviceCode());
|
||||
updateObj.setCabinetNum(registerVo.getCabinetNum());
|
||||
updateObj.setCabinetCameraNum(registerVo.getCabinetCameraNum());
|
||||
updateObj.setCabinetWeightUnitNum(registerVo.getCabinetWeightUnitNum());
|
||||
baseMapper.updateById(updateObj);
|
||||
refresh(updateObj.getDeviceCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public HardDoorManagerEntity refresh(String deviceCode) {
|
||||
// 查询设备
|
||||
HardDoorManagerEntity hardDoorDetail = baseMapper.selectOne(new LambdaQueryWrapper<HardDoorManagerEntity>()
|
||||
.eq(HardDoorManagerEntity::getDeviceCode, deviceCode)
|
||||
.orderByDesc(HardDoorManagerEntity::getCreateTime)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) throw new RuntimeException("刷新失败,设备不存在");
|
||||
DoorStatusDto statusDto = new DoorStatusDto();
|
||||
statusDto.setDeviceCode(deviceCode);
|
||||
DoorStatusVo statusVo = thirdDoorApiService.status(statusDto).getData();
|
||||
if (!statusVo.isSuccess()) {
|
||||
throw new RuntimeException(statusVo.getMessage());
|
||||
}
|
||||
HardDoorManagerEntity updateObj = new HardDoorManagerEntity();
|
||||
updateObj.setId(hardDoorDetail.getId());
|
||||
updateObj.setPowerStatus(statusVo.getPowerStatus());
|
||||
updateObj.setNetStatus(statusVo.getNetStatus());
|
||||
updateObj.setNetStatus(statusVo.getSaleStatus());
|
||||
updateObj.setSaleStatus(statusVo.getSaleStatus());
|
||||
updateObj.setSimSn(statusVo.getSimSn());
|
||||
updateObj.setSignalIntensity(statusVo.getSignalIntensity());
|
||||
updateObj.setSignalRatio(statusVo.getSignalRatio());
|
||||
updateObj.setSignalTime(statusVo.getSignalTime());
|
||||
if (ObjectUtil.isNotEmpty(statusVo.getCabinetStatusList())) {
|
||||
hardDoorCabinetService.saveOrUpdate(hardDoorDetail.getId(), statusVo.getCabinetStatusList());
|
||||
}
|
||||
baseMapper.updateById(updateObj);
|
||||
return updateObj;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +209,7 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
@Override
|
||||
public void changeVolume(HardChangeVolume dto) {
|
||||
// 查询设备
|
||||
HardDoorManagerVo hardDoorDetail = getByHardId(dto.getHardId());
|
||||
HardDoorManagerVo hardDoorDetail = getByHardDoorId(dto.getHardId());
|
||||
if (ObjectUtil.isEmpty(hardDoorDetail)) {
|
||||
throw new RuntimeException("设备不存在");
|
||||
}
|
||||
@@ -105,5 +221,42 @@ public class HardDoorManagerServiceImpl extends ServiceImpl<HardDoorManagerMappe
|
||||
if (!volumeVo.isSuccess()) {
|
||||
throw new RuntimeException(volumeVo.getMessage());
|
||||
}
|
||||
// 修改音量
|
||||
HardDoorManagerEntity updateObj = new HardDoorManagerEntity();
|
||||
updateObj.setId(hardDoorDetail.getId());
|
||||
updateObj.setSystemVolume(dto.getSystemVolume());
|
||||
updateObj.setMediaVolume(dto.getMediaVolume());
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验设备和货柜编号
|
||||
*/
|
||||
public HardDoorManagerVo checkDeviceAndCabinet(Long hardDoorId, Integer cabinetNo) {
|
||||
// 查询智能柜
|
||||
HardDoorManagerEntity doorDetail = getById(hardDoorId);
|
||||
if (ObjectUtil.isEmpty(doorDetail)) throw new RuntimeException("智能柜不存在");
|
||||
List<HardDoorCabinetEntity> cabinetList = hardDoorCabinetService.getListByHardDoorId(hardDoorId);
|
||||
if (ObjectUtil.isEmpty(cabinetList)) throw new RuntimeException("货柜不存在");
|
||||
if (ObjectUtil.isEmpty(cabinetList.stream().filter(i -> ObjectUtil.equals(i.getCabinetNo(), cabinetNo)).findFirst().orElse(null))) {
|
||||
throw new RuntimeException("货柜不存在");
|
||||
}
|
||||
HardDoorManagerVo doorVo = BeanUtil.toBean(doorDetail, HardDoorManagerVo.class);
|
||||
doorVo.setCabinetList(cabinetList);
|
||||
return doorVo;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardDoorManagerVo> list, HardDoorManagerDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardDoorManagerVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -216,7 +216,7 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
CurrentUserHardTypeInfoDto result = new CurrentUserHardTypeInfoDto();
|
||||
Long userId = user.getId();
|
||||
if (ObjectUtil.isEmpty(userId)) return result;
|
||||
UserInfo userInfo = userService.getByUserId(userId).getData();
|
||||
UserInfo userInfo = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return result;
|
||||
String[] roles = userInfo.getRoleCodes();
|
||||
if (roles.length == 0) return result;
|
||||
@@ -238,7 +238,7 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
@Override
|
||||
public List<Long> getCurrentUserMchInfo(PjcloudUser user, List<Long> mchIds) {
|
||||
if (ObjectUtil.isEmpty(mchIds)) mchIds = new ArrayList<>();
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
UserInfo userInfo = userService.getInnerByUserId(user.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return mchIds;
|
||||
String[] roles = userInfo.getRoleCodes();
|
||||
if (roles.length == 0) return mchIds;
|
||||
@@ -258,7 +258,7 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
|
||||
@Override
|
||||
public boolean isSuperMarketAdmin(PjcloudUser user) {
|
||||
UserInfo userInfo = userService.getByUserId(user.getId()).getData();
|
||||
UserInfo userInfo = userService.getInnerByUserId(user.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) return false;
|
||||
String[] roles = userInfo.getRoleCodes();
|
||||
if (roles.length == 0) return false;
|
||||
|
||||
+1
-3
@@ -44,7 +44,6 @@ import com.bsd.pjcloud.wallet.api.feign.RemoteWalletRechargeService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.seata.spring.annotation.GlobalTransactional;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -53,7 +52,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 售后订单
|
||||
@@ -183,7 +181,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
// 用户
|
||||
if (ObjectUtil.isNotEmpty(detail.getUserId())) {
|
||||
R<UserInfo> user = userService.getByUserId(detail.getUserId());
|
||||
R<UserInfo> user = userService.getInnerByUserId(detail.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(user.getData())) {
|
||||
DataUtil.convertUser(detail, user.getData().getSysUser());
|
||||
}
|
||||
|
||||
+64
@@ -20,11 +20,13 @@ import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardCarVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardCarMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardParentCarMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketUnitSkuService;
|
||||
import com.bsd.pjcloud.supermarket.vo.erp.SmErpUnitWithSpuVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -53,6 +55,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
|
||||
private final HardOrderMapper hardCarMapper;
|
||||
private final HardParentCarMapper hardParentCarMapper;
|
||||
private final HardSpuService hardSpuService;
|
||||
|
||||
private final RemoteOnlineCanteenSpuService onlineCanteenSpuService;
|
||||
private final RemoteCanteenSpuService canteenSpuService;
|
||||
@@ -180,6 +183,27 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
}
|
||||
yield supermarketTotalPrice.get();
|
||||
}
|
||||
case DOOR -> {
|
||||
AtomicInteger doorTotalPrice = new AtomicInteger();
|
||||
// 查询智能柜
|
||||
List<HardSpuEntity> supList = hardSpuService.getByIds(productIds);
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
Integer price = spu.getPrice();
|
||||
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
|
||||
// 按数量
|
||||
int itemTotalPrice = v.getProductCount() * price;
|
||||
doorTotalPrice.addAndGet(itemTotalPrice);
|
||||
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
|
||||
// 按重量
|
||||
// 向上取整
|
||||
int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
|
||||
doorTotalPrice.addAndGet(itemTotalPrice);
|
||||
}
|
||||
});
|
||||
}
|
||||
yield doorTotalPrice.get();
|
||||
}
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
@@ -272,6 +296,37 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
baseMapper.insert(carObjectList);
|
||||
return;
|
||||
}
|
||||
// 智能柜
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.DOOR)) {
|
||||
List<HardCarEntity> carObjectList = new ArrayList<>();
|
||||
List<HardSpuEntity> supList = hardSpuService.getByIds(productIds);
|
||||
for (HardCreateCarDto v : productList) {
|
||||
HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build();
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
Integer price = spu.getPrice();
|
||||
int totalPrice = 0;
|
||||
// 按重量
|
||||
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
|
||||
// 按数量
|
||||
totalPrice = v.getProductCount() * price;
|
||||
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
|
||||
// 按重量
|
||||
totalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
item.setProductId(spu.getId());
|
||||
item.setProductName(spu.getName());
|
||||
item.setProductPrice(price);
|
||||
item.setProductPic(spu.getCover());
|
||||
item.setTotalPrice((long) totalPrice);
|
||||
// item.setProductNature(v.getProductNature().getType());
|
||||
item.setProductCount(v.getProductCount());
|
||||
item.setProductWeight(v.getProductWeight());
|
||||
carObjectList.add(item);
|
||||
});
|
||||
}
|
||||
baseMapper.insert(carObjectList);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -308,6 +363,15 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
});
|
||||
}
|
||||
}
|
||||
// 智能柜
|
||||
if (ObjectUtil.equals(sysType, HardTypeEnum.DOOR)) {
|
||||
List<HardSpuEntity> supList = hardSpuService.getByIds(productIds);
|
||||
for (HardCreateCarDto v : list) {
|
||||
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
str.append(spu.getName()).append("x").append(v.getProductCount()).append(";");
|
||||
});
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
|
||||
+202
-13
@@ -2,7 +2,9 @@ package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
@@ -13,12 +15,14 @@ import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteOnlineCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardProductNatureEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
@@ -29,21 +33,24 @@ import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardCreateCarDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuStockDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardParentCarEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardDoorFlowVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardManagerVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardCarVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.hard.service.HardInvoiceService;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.thirdparty.dto.ks.KsRecognitionCallbackDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
@@ -90,6 +97,11 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
private final HardParentCarServiceImpl hardParentCarServiceImpl;
|
||||
@Lazy
|
||||
private final HardInvoiceService hardInvoiceService;
|
||||
@Lazy
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
private final HardBroadcastService hardBroadcastService;
|
||||
private final HardSpuService hardSpuService;
|
||||
private final HardApptService hardApptService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteCodeUseService remoteCodeUseService;
|
||||
@@ -176,7 +188,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
// 用户
|
||||
if (ObjectUtil.isNotEmpty(detail.getUserId())) {
|
||||
R<UserInfo> user = userService.getByUserId(detail.getUserId());
|
||||
R<UserInfo> user = userService.getInnerByUserId(detail.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(user.getData())) {
|
||||
DataUtil.convertUser(detail, user.getData().getSysUser());
|
||||
}
|
||||
@@ -215,7 +227,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
MchManageVo mch = validateCreateOrderDto(dto);
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("机器绑定的商户不存在");
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getByUserId(dto.getUserId()).getData();
|
||||
UserInfo userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
// 是否需要支付
|
||||
boolean isPay = isPay(dto.getOrderType(), dto.getOrderPayType());
|
||||
@@ -279,7 +291,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
// 钱包扣款
|
||||
if (isPay) getSelf().fastReduceBalance(orderObj);
|
||||
// 发送mq消息
|
||||
getSelf().createOrderAfterSendMqMsg(orderObj.getId());
|
||||
getSelf().createOrderAfterSendMqMsg(orderObj.getId(), userDetail);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@@ -288,8 +300,11 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long appCreateOrder(@Valid HardAppCreateOrderDto dto) {
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getByUserId(dto.getUserId()).getData();
|
||||
UserInfo userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
// 判断是否有重复的预约订单
|
||||
Long reserveCount = isHaveCanteenReserve(dto.getUserId());
|
||||
if (reserveCount > 100) throw new RuntimeException("您有" + reserveCount + "笔未核销的预约订单,请先核销");
|
||||
// 钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), dto.getWalletType()).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
|
||||
@@ -297,7 +312,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
HardParentCarEntity parentCar = hardCarService.getParentCarById(dto.getCarParentId());
|
||||
if (ObjectUtil.isEmpty(parentCar)) throw new RuntimeException("购物车不存在");
|
||||
// 查询商户
|
||||
MchManageVo hardManager = remoteMchService.getById(dto.getMerchantId()).getData();
|
||||
MchManageVo hardManager = remoteMchService.getById(parentCar.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(hardManager)) throw new RuntimeException("商户不存在");
|
||||
// 查询父购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(dto.getCarParentId());
|
||||
@@ -339,12 +354,21 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
.isOfflineOrder(YesNoEnum.NO.getCode())
|
||||
.productDesc(subject)
|
||||
.build();
|
||||
if (ObjectUtil.equals(dto.getOrderType(), HardOrderTypeEnum.RESERVE)) {
|
||||
// 查询时间段
|
||||
HardApptEntity hardAppt = hardApptService.getById(dto.getApptId());
|
||||
if (ObjectUtil.isEmpty(hardAppt)) throw new RuntimeException("预约时间段不存在");
|
||||
orderObj.setHourType(hardAppt.getHourType());
|
||||
orderObj.setApptId(hardAppt.getId());
|
||||
}
|
||||
if (isPay) orderObj.setWalletId(wallet.getId());
|
||||
baseMapper.insert(orderObj);
|
||||
// 钱包扣款
|
||||
if (isPay) getSelf().fastReduceBalance(orderObj);
|
||||
// 是否需要创建二维码
|
||||
getSelf().generateCode(orderObj);
|
||||
// 发送mq消息
|
||||
getSelf().createOrderAfterSendMqMsg(orderObj.getId(), userDetail);
|
||||
// 扣减库存
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
return orderObj.getId();
|
||||
@@ -357,7 +381,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
MchManageVo mch = remoteMchService.getById(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(mch)) throw new RuntimeException("商户不存在");
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getByUserId(dto.getUserId()).getData();
|
||||
UserInfo userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
|
||||
// 钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWalletById(dto.getWalletId()).getData();
|
||||
@@ -398,6 +422,123 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建智能柜订单
|
||||
*/
|
||||
@Override
|
||||
public Long createHardDoorOrder(Long userId, Long hardId) {
|
||||
// 查询用户
|
||||
UserInfo userDetail = userService.getInnerByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("创建智能柜订单失败,用户不存在");
|
||||
// 查询设备
|
||||
HardManagerVo hard = hardManagerService.getByHardId(hardId);
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,设备不存在");
|
||||
// 查询商户
|
||||
MchManageVo mch = remoteMchService.getById(hard.getMerchantId()).getData();
|
||||
if (ObjectUtil.isEmpty(hard)) throw new RuntimeException("创建智能柜订单失败,商户不存在");
|
||||
// 默认超市钱包
|
||||
WalletManageEntity wallet = remoteWalletService.getWallet(userId, WalletTypeEnum.PAY).getData();
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("创建智能柜订单失败,用户消费钱包不存在");
|
||||
HardOrderEntity orderObj = HardOrderEntity.builder()
|
||||
.walletId(wallet.getId())
|
||||
.hardId(hardId)
|
||||
.merchantType(mch.getTypes())
|
||||
.merchantId(mch.getId())
|
||||
.merchantDeptId(mch.getDeptId())
|
||||
.userId(userDetail.getSysUser().getUserId())
|
||||
.userDeptId(userDetail.getSysUser().getDeptId())
|
||||
.sysType(HardTypeEnum.DOOR.getType())
|
||||
.orderStatus(HardOrderStatusEnum.CREATE.getType())
|
||||
.orderType(HardOrderTypeEnum.BELOW.getType())
|
||||
.payType(HardPayTypeEnum.HARD_DOOR_FREE_PAY.getType())
|
||||
.totalPrice(0)
|
||||
.extraPrice(0)
|
||||
.payPrice(0)
|
||||
.isOfflineOrder(YesNoEnum.NO.getCode())
|
||||
.productDesc("智能柜商品*?")
|
||||
.build();
|
||||
baseMapper.insert(orderObj);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算智能柜订单
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long payHardDoorOrder(HardOrderEntity dto, List<KsRecognitionCallbackDto.ResultSku> ksSpuList) {
|
||||
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(ksSpuList)) return null;
|
||||
// 创建购物车
|
||||
List<String> ksSpuIds = ksSpuList.stream().map(KsRecognitionCallbackDto.ResultSku::getKs_sku_id).toList();
|
||||
List<HardSpuEntity> hardSpuList = hardSpuService.get(ksSpuIds);
|
||||
if (ObjectUtil.isEmpty(hardSpuList)) {
|
||||
log.error("|{}|智能柜订单结算,商品不存在dto|{}|ksSpuList|{}|", TAG, JSONUtil.toJsonStr(dto), JSONUtil.toJsonStr(ksSpuList));
|
||||
return null;
|
||||
}
|
||||
List<HardCreateCarDto> carListDto = new ArrayList<>();
|
||||
for (KsRecognitionCallbackDto.ResultSku v : ksSpuList) {
|
||||
hardSpuList.stream().filter(i -> ObjectUtil.equals(i.getKsSkuId(), v.getKs_sku_id())).findFirst().ifPresent(hardSpu -> {
|
||||
HardCreateCarDto entity = new HardCreateCarDto();
|
||||
entity.setProductId(hardSpu.getId());
|
||||
entity.setProductNature(HardProductNatureEnum.DEFAULT);
|
||||
entity.setProductCount(Integer.parseInt(v.getSku_num()));
|
||||
carListDto.add(entity);
|
||||
});
|
||||
}
|
||||
HardTypeEnum sysType = HardTypeEnum.valueOfByType(dto.getSysType());
|
||||
HardOrderTypeEnum orderType = HardOrderTypeEnum.valueOfByType(dto.getOrderType());
|
||||
// 获取商品价格
|
||||
Integer totalPrice = hardCarService.computerCarTotalPrice(sysType, orderType, carListDto);
|
||||
// 添加购物车
|
||||
Long parentCarId = hardCarService.createCard(dto.getUserId(), dto.getMerchantId(), sysType, orderType, carListDto);
|
||||
// 获取商品描述
|
||||
String subject = hardCarService.computerCarSubject(sysType, orderType, carListDto);
|
||||
// 更新订单信息
|
||||
HardOrderEntity updateObj = HardOrderEntity.builder()
|
||||
.id(dto.getId())
|
||||
.parentCarId(parentCarId)
|
||||
.totalPrice(totalPrice)
|
||||
.payPrice(totalPrice)
|
||||
.extraPrice(0)
|
||||
.productDesc(subject)
|
||||
.build();
|
||||
baseMapper.updateById(updateObj);
|
||||
HardOrderEntity orderObj = baseMapper.selectById(updateObj.getId());
|
||||
// 扣减库存
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
// 钱包扣款
|
||||
getSelf().fastReduceBalance(orderObj);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 智能柜取消订单
|
||||
*/
|
||||
@Override
|
||||
public Long cancelHardDoorOrder(Long orderId) {
|
||||
// 查询订单
|
||||
HardOrderEntity order = baseMapper.selectById(orderId);
|
||||
if (ObjectUtil.isEmpty(order)) {
|
||||
log.error("|{}|智能柜订单取消失败,订单不存在|{}|", TAG, orderId);
|
||||
return null;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(order.getPayPrice()) && order.getPayPrice() > 0) {
|
||||
log.error("|{}|智能柜订单取消失败,订单价格大于0|{}|", TAG, orderId);
|
||||
return null;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(order.getOrderStatus()) && ObjectUtil.equals(order.getOrderStatus(), HardOrderStatusEnum.UNFOLLOW.getType())) {
|
||||
log.error("|{}|智能柜订单取消失败,订单已核销|{}|", TAG, orderId);
|
||||
return null;
|
||||
}
|
||||
HardOrderEntity updateObj = HardOrderEntity.builder()
|
||||
.id(order.getId())
|
||||
.orderStatus(HardOrderStatusEnum.UNFOLLOW.getType())
|
||||
.unfollowTime(LocalDateTime.now())
|
||||
.build();
|
||||
baseMapper.updateById(updateObj);
|
||||
return updateObj.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void fastReduceBalance(HardOrderEntity order) {
|
||||
@@ -513,7 +654,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
if (!ObjectUtil.isAllNotEmpty(hardTypeEnum, orderTypeEnum)) return;
|
||||
String CarErrorMsg = ObjectUtil.equals(isReduce, YesNoEnum.YES) ? "扣减库存" : "恢复库存";
|
||||
int base = ObjectUtil.equals(isReduce, YesNoEnum.YES) ? -1 : 1;
|
||||
// 食堂扣件库存
|
||||
// 食堂扣减库存
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.CANTEEN) && ObjectUtil.equals(orderTypeEnum, HardOrderTypeEnum.RESERVE)) {
|
||||
// 查询购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(order.getParentCarId());
|
||||
@@ -534,7 +675,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
// 超市扣家库存
|
||||
// 超市扣减库存
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.SUPERMARKET)) {
|
||||
// 查询购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(order.getParentCarId());
|
||||
@@ -563,11 +704,36 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
// 智能柜扣减库存
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.DOOR)) {
|
||||
// 查询购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(order.getParentCarId());
|
||||
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("扣减库存错误,购物车不存在");
|
||||
List<DeductionSpuStockDto> list = carList.stream().map(v -> {
|
||||
DeductionSpuStockDto entity = new DeductionSpuStockDto();
|
||||
entity.setHardSpuId(v.getProductId());
|
||||
entity.setIncrCount(v.getProductCount());
|
||||
return entity;
|
||||
}).toList();
|
||||
// 查询订单流程
|
||||
HardDoorFlowVo doorFlow = hardDoorFlowService.getByOrderId(order.getId());
|
||||
if (ObjectUtil.isEmpty(doorFlow)) {
|
||||
log.info("|{}|{},失败,order不存在:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(list));
|
||||
return;
|
||||
}
|
||||
Boolean isDeduction = hardSpuService.deductionSpuStock(doorFlow, list);
|
||||
if (!isDeduction) {
|
||||
log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(list));
|
||||
throw new RuntimeException("扣减智能柜库存" + CarErrorMsg + "错误");
|
||||
}
|
||||
log.info("扣减智能柜库存成功|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(list));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 发送mq消息
|
||||
@Override
|
||||
public void createOrderAfterSendMqMsg(Long orderId) {
|
||||
public void createOrderAfterSendMqMsg(Long orderId, UserInfo userInfo) {
|
||||
try {
|
||||
HardOrderEntity orderdetail = baseMapper.selectById(orderId);
|
||||
if (ObjectUtil.isEmpty(orderdetail)) {
|
||||
@@ -587,8 +753,20 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
log.info("|{}|发送mq消息成功,超市打印发票order|{}|", TAG, JSON.toJSONString(orderId));
|
||||
}
|
||||
}
|
||||
case CANTEEN -> {
|
||||
HardOrderTypeEnum hardOrderType = HardOrderTypeEnum.valueOfByType(orderdetail.getOrderType());
|
||||
if (ObjectUtil.isEmpty(hardTypeEnum)) {
|
||||
log.error("|{}|发送mq消息失败,订餐类型错误hardType不存在hardType|{}|", TAG, orderdetail.getOrderType());
|
||||
return;
|
||||
}
|
||||
// 发送订餐mq
|
||||
if (ObjectUtil.equals(hardOrderType, HardOrderTypeEnum.RESERVE)) {
|
||||
hardBroadcastService.addReserveOrderTask(orderdetail, userInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 不返回错误
|
||||
log.info("|{}|发送mq消息成功,意外的错误error|{}|", TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -650,6 +828,17 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
|
||||
return HardTypeEnum.isReserve(hardTypeEnum);
|
||||
}
|
||||
|
||||
// 用户是否有正在进行中的订餐
|
||||
private Long isHaveCanteenReserve(Long userId) {
|
||||
return baseMapper.selectCount(new LambdaQueryWrapper<HardOrderEntity>()
|
||||
.eq(HardOrderEntity::getUserId, userId)
|
||||
.eq(HardOrderEntity::getMerchantType, MerchantTypeEnum.CANTEEN.getType())
|
||||
.eq(HardOrderEntity::getSysType, HardTypeEnum.CANTEEN.getType())
|
||||
.eq(HardOrderEntity::getOrderType, HardOrderTypeEnum.RESERVE.getType())
|
||||
.eq(HardOrderEntity::getOrderStatus, HardOrderStatusEnum.PAY.getType())
|
||||
);
|
||||
}
|
||||
|
||||
/* ************************************* end 支付相关 end ************************************* */
|
||||
|
||||
private HardOrderServiceImpl getSelf() {
|
||||
|
||||
+226
-175
@@ -87,7 +87,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
DataScope refundDataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
|
||||
refundDataScope.setScopeDeptName("merchant_dept_id");
|
||||
List<HardOrderSbVo> refundList = hardOrderMapper.listSb(refundDto, refundDataScope);
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
DataScope profitDataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
|
||||
@@ -102,7 +102,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getHardId(), v.getHardId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
@@ -153,7 +153,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
DataScope refundDataScope = DataScope.of();
|
||||
refundDataScope.setScopeDeptName("merchant_dept_id");
|
||||
List<HardOrderCsVo> refundList = hardOrderMapper.listCs(refundDto, refundDataScope);
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
DataScope profitDataScope = DataScope.of();
|
||||
@@ -167,7 +167,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
@@ -203,7 +203,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCsByDay(refundDto);
|
||||
});
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
CompletableFuture<List<HardOrderCsVo>> profitListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
@@ -222,7 +222,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
v.setTotalRefundCount(i.getTotalPayCount());
|
||||
});
|
||||
}
|
||||
// 盈利
|
||||
// 消费净次数
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getDay(), v.getDay()) && ObjectUtil.equals(i.getMerchantId(), v.getMerchantId())).findFirst().ifPresent(i -> {
|
||||
v.setTotalProfitPrice(i.getTotalPayPrice());
|
||||
@@ -244,186 +244,237 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
return totalList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商户总共流水记录
|
||||
*/
|
||||
@Override
|
||||
public HardOrderCsVo mchWaterTotal(HardOrderDto dto, PjcloudUser user) {
|
||||
// 查询总流水
|
||||
CompletableFuture<HardOrderCsVo> totalFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto totalDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
totalDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
return hardOrderMapper.listCsTotal(totalDto);
|
||||
});
|
||||
// 扣款总流水
|
||||
CompletableFuture<HardOrderCsVo> refundFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto refundDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
return hardOrderMapper.listCsTotal(refundDto);
|
||||
});
|
||||
// 消费净次数
|
||||
CompletableFuture<HardOrderCsVo> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderDto profitDto = BeanUtil.toBean(dto, HardOrderDto.class);
|
||||
profitDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
return hardOrderMapper.listCsTotal(profitDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(totalFuture, refundFuture, profitFuture);
|
||||
allFutures.join();
|
||||
HardOrderCsVo totalList = totalFuture.join();
|
||||
HardOrderCsVo refundList = refundFuture.join();
|
||||
HardOrderCsVo profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
if (ObjectUtil.isEmpty(totalList)) return new HardOrderCsVo();
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
if (ObjectUtil.isNotEmpty(refundList.getTotalPayPrice())) {
|
||||
totalList.setTotalRefundPrice(refundList.getTotalPayPrice());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(refundList.getTotalPayCount())) {
|
||||
totalList.setTotalRefundCount(refundList.getTotalPayCount());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
if (ObjectUtil.isNotEmpty(profitList.getTotalPayPrice())) {
|
||||
totalList.setTotalProfitPrice(profitList.getTotalPayPrice());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(profitList.getTotalPayCount())) {
|
||||
totalList.setTotalProfitCount(profitList.getTotalPayCount());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
MchManageVo mchDetail = remoteMchService.getById(totalList.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDetail)) {
|
||||
WalletDataUtil.convertMch(totalList, mchDetail);
|
||||
}
|
||||
return totalList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门交易记录
|
||||
*/
|
||||
@Override
|
||||
public List<HardDeptTotalVo> pageListDept(HardDeptTotalDto dto) {
|
||||
// 查询部门
|
||||
CompletableFuture<List<SysDept>> deptFuture = CompletableFuture.supplyAsync(() -> {
|
||||
DeptAllListDto deptDto = new DeptAllListDto();
|
||||
deptDto.setIsInclude(dto.getIsInclude());
|
||||
if (ObjectUtil.isNotEmpty(dto.getDeptId())) {
|
||||
deptDto.setDeptId(dto.getDeptId());
|
||||
DeptAllListDto deptDto = new DeptAllListDto();
|
||||
deptDto.setIsInclude(dto.getIsInclude());
|
||||
if (ObjectUtil.isNotEmpty(dto.getDeptId())) {
|
||||
deptDto.setDeptId(dto.getDeptId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getDeptIds())) {
|
||||
deptDto.setDeptId(null);
|
||||
deptDto.setDeptIds(dto.getDeptIds());
|
||||
}
|
||||
List<SysDept> deptList = remoteDeptService.getInnerAllDept(deptDto).getData();
|
||||
if (ObjectUtil.isEmpty(deptList)) return null;
|
||||
List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
List<HardDeptTotalVo> resultList = deptList.stream().map(v -> {
|
||||
HardDeptTotalVo item = new HardDeptTotalVo();
|
||||
item.setDeptId(v.getDeptId());
|
||||
item.setDeptName(v.getName());
|
||||
return item;
|
||||
}).toList();
|
||||
// 查询钱包批量充值流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletBatchFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getDeptIds())) {
|
||||
deptDto.setDeptId(null);
|
||||
deptDto.setDeptIds(dto.getDeptIds());
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteDeptService.getInnerAllDept(deptDto).getData();
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
CompletableFuture<List<HardDeptTotalVo>> resultListFuture = deptFuture.thenApply(deptList -> {
|
||||
if (ObjectUtil.isEmpty(deptList)) return null;
|
||||
List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
List<HardDeptTotalVo> resultList = deptList.stream().map(v -> {
|
||||
HardDeptTotalVo item = new HardDeptTotalVo();
|
||||
item.setDeptId(v.getDeptId());
|
||||
item.setDeptName(v.getName());
|
||||
return item;
|
||||
}).toList();
|
||||
// 查询钱包批量充值流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletBatchFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询钱包批量扣减流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletReduceFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询钱包单次充值流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceBatchFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询钱包单次扣减流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceReduceFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询订单支付流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> payFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto payDto = new HardOrderSumAndCountDto();
|
||||
payDto.setUserDeptIds(deptIds);
|
||||
payDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
payDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
payDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(payDto);
|
||||
});
|
||||
// 查询订单退款流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> refundFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setUserDeptIds(deptIds);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
// 查询钱包批量扣减流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletReduceFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.BATCH.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询钱包单次充值流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceBatchFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询钱包单次扣减流水
|
||||
CompletableFuture<List<WalletTransactionSumAndCountVo>> walletOnceReduceFuture = CompletableFuture.supplyAsync(() -> {
|
||||
WalletTransactionSumAndCountDto walletDto = new WalletTransactionSumAndCountDto();
|
||||
walletDto.setDeptIds(deptIds);
|
||||
walletDto.setBizTypes(List.of(WalletBizEnum.UPDATE.getCode()));
|
||||
walletDto.setType(WalletTransactionSumAndCountDto.TYPE_EXPENSE);
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
walletDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
walletDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return remoteWalletTransactionService.sumAndCount(walletDto).getData();
|
||||
});
|
||||
// 查询订单支付流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> payFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto payDto = new HardOrderSumAndCountDto();
|
||||
payDto.setUserDeptIds(deptIds);
|
||||
payDto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
payDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
payDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(payDto);
|
||||
});
|
||||
// 查询订单退款流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> refundFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setUserDeptIds(deptIds);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPayErrorCodes());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
// 消费净次数
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setUserDeptIds(deptIds);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture, profitFuture);
|
||||
allFutures.join();
|
||||
List<WalletTransactionSumAndCountVo> walletBatchList = walletBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletReduceList = walletReduceFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletOnceBatchList = walletOnceBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletOnceReduceList = walletOnceReduceFuture.join();
|
||||
List<HardOrderSumAndCountVo> payList = payFuture.join();
|
||||
List<HardOrderSumAndCountVo> refundList = refundFuture.join();
|
||||
List<HardOrderSumAndCountVo> profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
if (ObjectUtil.isNotEmpty(walletBatchList)) {
|
||||
walletBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletPrice(i.getSum());
|
||||
v.setWalletCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletReduceList)) {
|
||||
walletReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
// v.setWalletReducePrice(i.getSum());
|
||||
v.setWalletReducePrice(Math.abs(i.getSum()));
|
||||
v.setWalletReduceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceBatchList)) {
|
||||
walletOnceBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletOncePrice(i.getSum());
|
||||
v.setWalletOnceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceReduceList)) {
|
||||
walletOnceReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
// v.setWalletOnceReducePrice(i.getSum());
|
||||
v.setWalletOnceReducePrice(Math.abs(i.getSum()));
|
||||
v.setWalletOnceReduceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(payList)) {
|
||||
payList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderPayPrice(i.getSum());
|
||||
v.setOrderPayCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderRefundPrice(i.getSum());
|
||||
v.setOrderRefundCont(i.getCount());
|
||||
});
|
||||
}
|
||||
// 查看盈利流水
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> profitFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto refundDto = new HardOrderSumAndCountDto();
|
||||
refundDto.setUserDeptIds(deptIds);
|
||||
refundDto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
refundDto.setCreateTimeList(dto.getCreateTimeList());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getWalletTypeId())) {
|
||||
refundDto.setWalletTypeId(dto.getWalletTypeId());
|
||||
}
|
||||
return hardOrderMapper.sumAndCount(refundDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(walletBatchFuture, walletReduceFuture, payFuture, refundFuture, walletOnceBatchFuture, walletOnceReduceFuture, profitFuture);
|
||||
allFutures.join();
|
||||
List<WalletTransactionSumAndCountVo> walletBatchList = walletBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletReduceList = walletReduceFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletOnceBatchList = walletOnceBatchFuture.join();
|
||||
List<WalletTransactionSumAndCountVo> walletOnceReduceList = walletOnceReduceFuture.join();
|
||||
List<HardOrderSumAndCountVo> payList = payFuture.join();
|
||||
List<HardOrderSumAndCountVo> refundList = refundFuture.join();
|
||||
List<HardOrderSumAndCountVo> profitList = profitFuture.join();
|
||||
// 聚合一下数据
|
||||
for (HardDeptTotalVo v : resultList) {
|
||||
if (ObjectUtil.isNotEmpty(walletBatchList)) {
|
||||
walletBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletPrice(i.getSum());
|
||||
v.setWalletCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletReduceList)) {
|
||||
walletReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletReducePrice(i.getSum());
|
||||
v.setWalletReduceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceBatchList)) {
|
||||
walletOnceBatchList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletOncePrice(i.getSum());
|
||||
v.setWalletOnceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletOnceReduceList)) {
|
||||
walletOnceReduceList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setWalletOnceReducePrice(i.getSum());
|
||||
v.setWalletOnceReduceCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(payList)) {
|
||||
payList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderPayPrice(i.getSum());
|
||||
v.setOrderPayCount(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(refundList)) {
|
||||
refundList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderRefundPrice(i.getSum());
|
||||
v.setOrderRefundCont(i.getCount());
|
||||
});
|
||||
}
|
||||
// 查看盈利流水
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderProfitPrice(i.getSum());
|
||||
v.setOrderProfitCont(i.getCount());
|
||||
});
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(profitList)) {
|
||||
profitList.stream().filter(i -> ObjectUtil.equals(i.getDeptId(), v.getDeptId())).findFirst().ifPresent(i -> {
|
||||
v.setOrderProfitPrice(i.getSum());
|
||||
v.setOrderProfitCont(i.getCount());
|
||||
});
|
||||
}
|
||||
return resultList;
|
||||
});
|
||||
return resultListFuture.join();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+21
-6
@@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -33,20 +34,34 @@ public class HardSpuJoinServiceImpl extends ServiceImpl<HardSpuJoinMapper, HardS
|
||||
@Override
|
||||
public List<HardSpuJoinVo> scopeList(HardSpuJoinDto dto) {
|
||||
List<HardSpuJoinEntity> list = baseMapper.selectList(new LambdaQueryWrapper<HardSpuJoinEntity>()
|
||||
.eq(HardSpuJoinEntity::getHardDoorNumber, dto.getHardDoorNumber())
|
||||
.eq(HardSpuJoinEntity::getHardDoorId, dto.getHardDoorId())
|
||||
.eq(HardSpuJoinEntity::getCabinetNo, dto.getCabinetNo())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardDoorNumber()), HardSpuJoinEntity::getHardDoorNumber, dto.getHardDoorNumber())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardDoorId()), HardSpuJoinEntity::getHardDoorId, dto.getHardDoorId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getCabinetNo()), HardSpuJoinEntity::getCabinetNo, dto.getCabinetNo())
|
||||
.isNotNull(ObjectUtil.isNotEmpty(dto.getIsSpu()) && dto.getIsSpu(), HardSpuJoinEntity::getSpuId)
|
||||
.orderByAsc(HardSpuJoinEntity::getHardDoorNumber)
|
||||
.orderByDesc(HardSpuJoinEntity::getSpuId)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(list)) return List.of();
|
||||
if (ObjectUtil.isEmpty(list)) return new ArrayList<>();
|
||||
List<HardSpuJoinVo> joinList = BeanUtils.toBean(list, HardSpuJoinVo.class);
|
||||
List<Long> spuIds = joinList.stream().map(HardSpuJoinVo::getSpuId).toList();
|
||||
// 查询商品
|
||||
if (ObjectUtil.isNotEmpty(spuIds)) {
|
||||
List<HardSpuVo> spuList = hardSpuMapper.scopPageList(HardSpuDto.builder().build(), null);
|
||||
HardSpuDto spuDto = new HardSpuDto();
|
||||
spuDto.setSpuIdList(spuIds);
|
||||
List<HardSpuVo> spuList = hardSpuMapper.scopPageList(spuDto, null);
|
||||
for (HardSpuJoinVo v : joinList) {
|
||||
spuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getSpuId())).findFirst().ifPresent(v::setSpuDetail);
|
||||
}
|
||||
}
|
||||
return List.of();
|
||||
return joinList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HardSpuJoinVo> getSpuList(Long hardDoorId, Integer cabinetNo) {
|
||||
HardSpuJoinDto queryDto = new HardSpuJoinDto();
|
||||
queryDto.setHardDoorId(hardDoorId);
|
||||
queryDto.setCabinetNo(String.valueOf(cabinetNo));
|
||||
queryDto.setIsSpu(true);
|
||||
return scopeList(queryDto);
|
||||
}
|
||||
}
|
||||
+109
-27
@@ -12,17 +12,17 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.constant.spu.HardSpuRepertoryTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.DeductionSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardDoorCabinetEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuJoinEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.utils.HardUtil;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
import com.bsd.pjcloud.hard.mapper.manager.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuRepertoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
import com.bsd.pjcloud.hard.service.*;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -45,12 +45,13 @@ import java.util.List;
|
||||
public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMapper, HardSpuRepertoryEntity> implements HardSpuRepertoryService {
|
||||
|
||||
private final HardSpuService hardSpuService;
|
||||
private final HardDoorFlowService hardDoorFlowService;
|
||||
private final HardDoorCabinetService hardDoorCabinetService;
|
||||
private final HardSpuJoinService hardSpuJoinService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
@Override
|
||||
public Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope) {
|
||||
Page<HardSpuRepertoryVo> pageList = baseMapper.scopePageJoin(page, dto, dataScope);
|
||||
@@ -63,27 +64,54 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create(HardSpuRepertoryEntity entity, PjcloudUser user) {
|
||||
public Long create(HardSpuRepertoryDto dto, PjcloudUser user) {
|
||||
// 查询商品
|
||||
HardSpuEntity spuDetail = hardSpuService.getById(entity.getSpuId());
|
||||
HardSpuEntity spuDetail = hardSpuService.getById(dto.getSpuId());
|
||||
if (ObjectUtil.isEmpty(spuDetail)) {
|
||||
throw new RuntimeException("商品不存在");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(spuDetail.getSpuCategoryId())) {
|
||||
throw new RuntimeException("商品分类不能为空");
|
||||
}
|
||||
if (ObjectUtil.equals(spuDetail.getPrice(), 0)) {
|
||||
throw new RuntimeException("商品价格不能为0");
|
||||
}
|
||||
// 查询货柜
|
||||
HardDoorCabinetEntity doorCabinet = hardDoorCabinetService.getById(dto.getCabinetId());
|
||||
if (ObjectUtil.isEmpty(doorCabinet)) {
|
||||
throw new RuntimeException("货柜不存在");
|
||||
}
|
||||
dto.setHardDoorId(doorCabinet.getHardDoorId());
|
||||
dto.setCabinetNo(doorCabinet.getCabinetNo());
|
||||
HardSpuJoinEntity cabinetSpu = hardSpuJoinService.getOne(new LambdaQueryWrapper<HardSpuJoinEntity>()
|
||||
.eq(HardSpuJoinEntity::getHardDoorId, dto.getHardDoorId())
|
||||
.eq(HardSpuJoinEntity::getCabinetNo, dto.getCabinetNo())
|
||||
.eq(HardSpuJoinEntity::getSpuId, dto.getSpuId())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(cabinetSpu)) {
|
||||
throw new RuntimeException("货柜中没有这个商品");
|
||||
}
|
||||
Integer beforeCount = 0;
|
||||
if (ObjectUtil.isNotEmpty(spuDetail.getRepertoryCount())) {
|
||||
beforeCount = spuDetail.getRepertoryCount();
|
||||
}
|
||||
entity.setBeforeCount(beforeCount);
|
||||
entity.setUserId(user.getId());
|
||||
entity.setHardId(entity.getHardId());
|
||||
entity.setBizType(HardSpuRepertoryTypeEnum.HANDLER.getType());
|
||||
baseMapper.insert(entity);
|
||||
// 更新商品库存
|
||||
dto.setBeforeCount(beforeCount);
|
||||
dto.setUserId(user.getId());
|
||||
dto.setBizType(HardSpuRepertoryTypeEnum.HANDLER.getType());
|
||||
baseMapper.insert(dto);
|
||||
// 更新商品总库存
|
||||
HardSpuEntity spu = new HardSpuEntity();
|
||||
spu.setId(spuDetail.getId());
|
||||
spu.setRepertoryCount(entity.getCount() + beforeCount);
|
||||
spu.setRepertoryCount(dto.getCount() + beforeCount);
|
||||
spu.setVersion(spuDetail.getVersion());
|
||||
hardSpuService.updateById(spu);
|
||||
return entity.getId();
|
||||
// 更新柜门商品库存
|
||||
HardSpuJoinEntity cabinetSpuJoin = new HardSpuJoinEntity();
|
||||
cabinetSpuJoin.setId(cabinetSpu.getId());
|
||||
cabinetSpuJoin.setVersion(cabinetSpu.getVersion());
|
||||
cabinetSpuJoin.setRepertoryCount(dto.getCount() + cabinetSpu.getRepertoryCount());
|
||||
hardSpuJoinService.updateById(cabinetSpuJoin);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,6 +171,70 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* app上架完成
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean appRepertoryDone(DeductionSpuRepertoryDto body, Long userId) {
|
||||
// 查询流程是否存在
|
||||
HardDoorFlowEntity hardDoorFlow = hardDoorFlowService.getById(body.getFlowId());
|
||||
if (ObjectUtil.isEmpty(hardDoorFlow)) {
|
||||
throw new RuntimeException("上架流程不存在");
|
||||
}
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuRepertoryEntity>().eq(HardSpuRepertoryEntity::getBizId, body.getFlowId()));
|
||||
if (count > 0) {
|
||||
throw new RuntimeException("改上架已结束");
|
||||
}
|
||||
List<DeductionSpuRepertoryDto.Item> list = body.getList().stream().filter(v -> v.getPlusCount() > 0).toList();
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new RuntimeException("上架商品不能为空");
|
||||
}
|
||||
// 查询商品列表
|
||||
List<Long> spuIds = list.stream().map(DeductionSpuRepertoryDto.Item::getHardSpuId).toList();
|
||||
List<HardSpuEntity> spuList = hardSpuService.listByIds(spuIds);
|
||||
// 查询货柜商品列表
|
||||
List<HardSpuJoinEntity> spuJoinList = hardSpuJoinService.list(new LambdaQueryWrapper<HardSpuJoinEntity>()
|
||||
.in(HardSpuJoinEntity::getSpuId, spuIds)
|
||||
.eq(HardSpuJoinEntity::getHardDoorId, hardDoorFlow.getHardDoorId())
|
||||
.eq(HardSpuJoinEntity::getCabinetNo, hardDoorFlow.getCabinetNo())
|
||||
);
|
||||
// 更新上架记录
|
||||
for (DeductionSpuRepertoryDto.Item i : list) {
|
||||
spuList.stream().filter(v -> v.getId().equals(i.getHardSpuId())).findFirst().ifPresent(spu -> {
|
||||
HardSpuRepertoryEntity entity = new HardSpuRepertoryEntity();
|
||||
Integer beforeCount = 0;
|
||||
if (ObjectUtil.isNotEmpty(spu.getRepertoryCount())) {
|
||||
beforeCount = spu.getRepertoryCount();
|
||||
}
|
||||
entity.setHardDoorId(hardDoorFlow.getHardDoorId());
|
||||
entity.setCabinetNo(hardDoorFlow.getCabinetNo());
|
||||
entity.setSpuId(spu.getId());
|
||||
entity.setUserId(userId);
|
||||
entity.setBeforeCount(beforeCount);
|
||||
entity.setCount(i.getPlusCount());
|
||||
entity.setBizId(body.getFlowId());
|
||||
entity.setBizType(HardSpuRepertoryTypeEnum.PERSION.getType());
|
||||
baseMapper.insert(entity);
|
||||
// 更新总商品库存
|
||||
HardSpuEntity spuEntity = new HardSpuEntity();
|
||||
spuEntity.setId(spu.getId());
|
||||
spuEntity.setVersion(spu.getVersion());
|
||||
spuEntity.setRepertoryCount(entity.getCount() + beforeCount);
|
||||
hardSpuService.updateById(spuEntity);
|
||||
// 更新货柜商品库存
|
||||
spuJoinList.stream().filter(v -> ObjectUtil.equals(v.getSpuId(), spu.getId())).findFirst().ifPresent(spuJoin -> {
|
||||
HardSpuJoinEntity spuJoinEntity = new HardSpuJoinEntity();
|
||||
spuJoinEntity.setId(spuJoin.getId());
|
||||
spuJoinEntity.setVersion(spuJoin.getVersion());
|
||||
spuJoinEntity.setRepertoryCount(entity.getCount() + spuJoin.getRepertoryCount());
|
||||
hardSpuJoinService.updateById(spuJoinEntity);
|
||||
});
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void disposeList(List<HardSpuRepertoryVo> list, HardSpuRepertoryDto dto) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 商户
|
||||
@@ -154,16 +246,6 @@ public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMap
|
||||
WalletDataUtil.convertMchList(list, CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.stream().map(HardSpuRepertoryVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(hardIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list, CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
// 用户
|
||||
List<Long> userIds = list.stream().map(HardSpuRepertoryVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = remoteUserService.getUserById(new ArrayList<>(userIds));
|
||||
|
||||
Loaded 100 of 205 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user