Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2151a60a81
28 files changed
+1291
-1
No files matched your search
+115
-1
@@ -221,4 +221,118 @@ CREATE TABLE hard_after_sale_log
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB COMMENT ='售后订单日志';
|
||||
) ENGINE = InnoDB COMMENT ='售后订单日志';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_broadcast
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS hard_broadcast;
|
||||
CREATE TABLE hard_broadcast
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '预定用户',
|
||||
hard_id bigint NOT NULL COMMENT '硬件id',
|
||||
topic varchar(128) NOT NULL COMMENT 'mq主题',
|
||||
biz_id varchar(64) NOT NULL COMMENT '关联业务编号',
|
||||
title varchar(64) NOT NULL COMMENT '预定标题',
|
||||
unique_code varchar(16) NOT NULL COMMENT '广播唯一编号',
|
||||
broadcast_count int DEFAULT 0 NOT NULL COMMENT '广播次数',
|
||||
is_broadcast char(1) DEFAULT '0' 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',
|
||||
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 '编号',
|
||||
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',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB COMMENT ='硬件授权';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_spu
|
||||
-- ----------------------------
|
||||
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',
|
||||
name varchar(64) NOT NULL COMMENT '商品名',
|
||||
pic varchar(256) NOT NULL COMMENT '商品图片',
|
||||
price int NOT NULL COMMENT '单价(分)',
|
||||
sales_count int DEFAULT 0 NOT NULL COMMENT '销量',
|
||||
repertory_count int DEFAULT 0 NOT NULL COMMENT '库存',
|
||||
sort int DEFAULT 0 NOT NULL COMMENT '排序',
|
||||
status char(1) DEFAULT '0' COMMENT '是否启用',
|
||||
is_default char(1) DEFAULT '0' COMMENT '是否为标品',
|
||||
ks_status char(1) DEFAULT '0' COMMENT '旷世审核状态',
|
||||
ks_status_title varchar(64) NOT NULL COMMENT '旷世审核状态标题',
|
||||
ks_comments 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 ='硬件商品';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for hard_spu_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS hard_spu_category;
|
||||
CREATE TABLE hard_spu_category
|
||||
(
|
||||
id bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
name varchar(64) NOT NULL COMMENT '分类名',
|
||||
sort 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 '修改人',
|
||||
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_spu_repertory
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS hard_spu_repertory;
|
||||
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',
|
||||
spu_id bigint NOT NULL COMMENT '商品id',
|
||||
count bigint 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 '修改人',
|
||||
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 ='硬件商品库存更新记录';
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuCategoryDto extends HardSpuCategoryEntity {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class HardSpuDto extends HardSpuEntity {
|
||||
|
||||
private LocalDateTime[] createTimeList;
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuRepertoryDto extends HardSpuRepertoryEntity {
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.spu;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 硬件商品分类
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_spu_category")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "硬件商品分类")
|
||||
public class HardSpuCategoryEntity extends Model<HardSpuCategoryEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
@Schema(description="分类名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description="排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.spu;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 硬件商品
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_spu")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "硬件商品")
|
||||
public class HardSpuEntity extends Model<HardSpuEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 商品分类id
|
||||
*/
|
||||
@Schema(description = "商品分类id")
|
||||
private Long spuCategoryId;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
@Schema(description = "商品名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品图片
|
||||
*/
|
||||
@Schema(description = "商品图片")
|
||||
private String pic;
|
||||
|
||||
/**
|
||||
* 单价(分)
|
||||
*/
|
||||
@Schema(description = "单价(分)")
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
@Schema(description = "销量")
|
||||
private Integer salesCount;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description = "库存")
|
||||
private Integer repertoryCount;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否为标品
|
||||
*/
|
||||
@Schema(description = "是否为标品")
|
||||
private String isDefault;
|
||||
|
||||
/**
|
||||
* 旷世审核状态
|
||||
*/
|
||||
@Schema(description = "旷世审核状态")
|
||||
private String ksStatus;
|
||||
|
||||
/**
|
||||
* 旷世审核状态标题
|
||||
*/
|
||||
@Schema(description = "旷世审核状态标题")
|
||||
private String ksStatusTitle;
|
||||
|
||||
/**
|
||||
* 旷世审核状态描述
|
||||
*/
|
||||
@Schema(description = "旷世审核状态描述")
|
||||
private String ksComments;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.spu;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 硬件商品库存更新记录
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("hard_spu_repertory")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "硬件商品库存更新记录")
|
||||
public class HardSpuRepertoryEntity extends Model<HardSpuRepertoryEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description="用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@Schema(description="设备id")
|
||||
private Long hardId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
@Schema(description="商品id")
|
||||
private Long spuId;
|
||||
|
||||
/**
|
||||
* 更新库存数量
|
||||
*/
|
||||
@Schema(description="更新库存数量")
|
||||
private Long count;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuCategoryVo extends HardSpuCategoryEntity {
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuRepertoryVo extends HardSpuRepertoryEntity {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.spu;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardSpuVo extends HardSpuEntity {
|
||||
|
||||
/**
|
||||
* 分类相关
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.bsd.pjcloud.hard.controller.spu;
|
||||
|
||||
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.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuCategoryService;
|
||||
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-spu-category")
|
||||
@Tag(description = "hard-spu-category", name = "硬件商品分类管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardSpuCategoryController {
|
||||
|
||||
private final HardSpuCategoryService hardSpuCategoryService;
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_view')")
|
||||
public R getHardSpuCategoryPage(@ParameterObject Page page, @ParameterObject HardSpuCategoryEntity hardSpuCategory) {
|
||||
LambdaQueryWrapper<HardSpuCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardSpuCategoryService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuCategoryDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuCategoryService.scopPageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardSpuCategoryService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增硬件商品分类", description = "新增硬件商品分类")
|
||||
@SysLog("新增硬件商品分类")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_add')")
|
||||
public R save(@RequestBody HardSpuCategoryEntity entity) {
|
||||
return R.ok(hardSpuCategoryService.create(entity));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品分类", description = "修改硬件商品分类")
|
||||
@SysLog("修改硬件商品分类")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_edit')")
|
||||
public R updateById(@RequestBody HardSpuCategoryEntity entity) {
|
||||
return R.ok(hardSpuCategoryService.edit(entity));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除硬件商品分类", description = "通过id删除硬件商品分类")
|
||||
@SysLog("通过id删除硬件商品分类")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
hardSpuCategoryService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuCategory_export')")
|
||||
public List<HardSpuCategoryEntity> export(HardSpuCategoryEntity hardSpuCategory, Long[] ids) {
|
||||
return hardSpuCategoryService.list(Wrappers.lambdaQuery(hardSpuCategory).in(ArrayUtil.isNotEmpty(ids), HardSpuCategoryEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.bsd.pjcloud.hard.controller.spu;
|
||||
|
||||
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.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
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-spu")
|
||||
@Tag(description = "hard-spu", name = "硬件商品管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardSpuController {
|
||||
|
||||
private final HardSpuService hardSpuService;
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_view')")
|
||||
public R getHardSpuPage(@ParameterObject Page page, @ParameterObject HardSpuEntity hardSpu) {
|
||||
LambdaQueryWrapper<HardSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardSpuService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuService.scopPageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardSpuService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增硬件商品", description = "新增硬件商品")
|
||||
@SysLog("新增硬件商品")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_add')")
|
||||
public R save(@RequestBody HardSpuEntity hardSpu) {
|
||||
return R.ok(hardSpuService.create(hardSpu));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品", description = "修改硬件商品")
|
||||
@SysLog("修改硬件商品")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_edit')")
|
||||
public R updateById(@RequestBody HardSpuEntity hardSpu) {
|
||||
return R.ok(hardSpuService.edit(hardSpu));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除硬件商品", description = "通过id删除硬件商品")
|
||||
@SysLog("通过id删除硬件商品")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
hardSpuService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpu_export')")
|
||||
public List<HardSpuEntity> export(HardSpuEntity hardSpu, Long[] ids) {
|
||||
return hardSpuService.list(Wrappers.lambdaQuery(hardSpu).in(ArrayUtil.isNotEmpty(ids), HardSpuEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.bsd.pjcloud.hard.controller.spu;
|
||||
|
||||
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.log.annotation.SysLog;
|
||||
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 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-spu-repertory")
|
||||
@Tag(description = "hard-spu-repertory", name = "硬件商品库存更新记录管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardSpuRepertoryController {
|
||||
|
||||
private final HardSpuRepertoryService hardSpuRepertoryService;
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
public R getHardSpuRepertoryPage(@ParameterObject Page page, @ParameterObject HardSpuRepertoryEntity hardSpuRepertory) {
|
||||
LambdaQueryWrapper<HardSpuRepertoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardSpuRepertoryService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardSpuRepertoryDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(hardSpuRepertoryService.scopePageJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardSpuRepertoryService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增硬件商品库存更新记录", description = "新增硬件商品库存更新记录")
|
||||
@SysLog("新增硬件商品库存更新记录")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_add')")
|
||||
public R save(@RequestBody HardSpuRepertoryEntity hardSpuRepertory) {
|
||||
return R.ok(hardSpuRepertoryService.save(hardSpuRepertory));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改硬件商品库存更新记录", description = "修改硬件商品库存更新记录")
|
||||
@SysLog("修改硬件商品库存更新记录")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_edit')")
|
||||
public R updateById(@RequestBody HardSpuRepertoryEntity hardSpuRepertory) {
|
||||
return R.ok(hardSpuRepertoryService.updateById(hardSpuRepertory));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除硬件商品库存更新记录", description = "通过id删除硬件商品库存更新记录")
|
||||
@SysLog("通过id删除硬件商品库存更新记录")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardSpuRepertoryService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardSpuRepertory_export')")
|
||||
public List<HardSpuRepertoryEntity> export(HardSpuRepertoryEntity hardSpuRepertory, Long[] ids) {
|
||||
return hardSpuRepertoryService.list(Wrappers.lambdaQuery(hardSpuRepertory).in(ArrayUtil.isNotEmpty(ids), HardSpuRepertoryEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.hard.mapper.spu;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardSpuCategoryMapper extends PjcloudBaseMapper<HardSpuCategoryEntity> {
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.bsd.pjcloud.hard.mapper.spu;
|
||||
|
||||
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.spu.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HardSpuMapper extends PjcloudBaseMapper<HardSpuEntity> {
|
||||
|
||||
Page<HardSpuVo> scopPageJoin(Page page, @Param("dto") HardSpuDto dto, @Param("dataScope") DataScope dataScope);
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.hard.mapper.spu;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardSpuRepertoryMapper extends PjcloudBaseMapper<HardSpuRepertoryEntity> {
|
||||
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
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.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuCategoryVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface HardSpuCategoryService extends IService<HardSpuCategoryEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<HardSpuCategoryVo> scopPageJoin(Page page, HardSpuCategoryDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardSpuCategoryEntity entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
Long edit(HardSpuCategoryEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
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.HardSpuRepertoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuRepertoryVo;
|
||||
|
||||
public interface HardSpuRepertoryService extends IService<HardSpuRepertoryEntity> {
|
||||
|
||||
Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope);
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
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.HardSpuDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface HardSpuService extends IService<HardSpuEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<HardSpuVo> scopPageJoin(Page page, HardSpuDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(HardSpuEntity entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
Long edit(HardSpuEntity entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
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.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.dto.spu.HardSpuCategoryDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.spu.HardSpuCategoryVo;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuCategoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuCategoryService;
|
||||
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 HardSpuCategoryServiceImpl extends ServiceImpl<HardSpuCategoryMapper, HardSpuCategoryEntity> implements HardSpuCategoryService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardSpuCategoryVo> scopPageJoin(Page page, HardSpuCategoryDto dto, DataScope dataScope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(HardSpuCategoryEntity entity) {
|
||||
if (existName(entity)) {
|
||||
throw new RuntimeException("分类名不能重复");
|
||||
}
|
||||
baseMapper.insert(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@Override
|
||||
public Long edit(HardSpuCategoryEntity entity) {
|
||||
if (existName(entity)) {
|
||||
throw new RuntimeException("分类名不能重复");
|
||||
}
|
||||
baseMapper.updateById(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
baseMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类名是否重复
|
||||
*/
|
||||
private boolean existName(HardSpuCategoryEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuCategoryEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getName()), HardSpuCategoryEntity::getName, dto.getName())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), HardSpuCategoryEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
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 com.bsd.pjcloud.hard.mapper.spu.HardSpuRepertoryMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuRepertoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 硬件商品库存更新记录
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardSpuRepertoryServiceImpl extends ServiceImpl<HardSpuRepertoryMapper, HardSpuRepertoryEntity> implements HardSpuRepertoryService {
|
||||
|
||||
@Override
|
||||
public Page<HardSpuRepertoryVo> scopePageJoin(Page page, HardSpuRepertoryDto dto, DataScope dataScope) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.spu;
|
||||
|
||||
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.data.datascope.DataScope;
|
||||
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.HardSpuVo;
|
||||
import com.bsd.pjcloud.hard.mapper.spu.HardSpuMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardSpuService;
|
||||
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 HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity> implements HardSpuService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<HardSpuVo> scopPageJoin(Page page, HardSpuDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopPageJoin(page, dto, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(HardSpuEntity entity) {
|
||||
if (existName(entity)) {
|
||||
throw new RuntimeException("商品名不能重复");
|
||||
}
|
||||
baseMapper.insert(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@Override
|
||||
public Long edit(HardSpuEntity entity) {
|
||||
if (existName(entity)) {
|
||||
throw new RuntimeException("商品名不能重复");
|
||||
}
|
||||
baseMapper.updateById(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
baseMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品是否重复
|
||||
*/
|
||||
private boolean existName(HardSpuEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardSpuEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getName()), HardSpuEntity::getName, dto.getName())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), HardSpuEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.spu.HardSpuCategoryMapper">
|
||||
<resultMap id="hardSpuCategoryMap" type="com.bsd.pjcloud.hard.api.entity.spu.HardSpuCategoryEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.spu.HardSpuMapper">
|
||||
<resultMap id="hardSpuMap" type="com.bsd.pjcloud.hard.api.entity.spu.HardSpuEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="spuCategoryId" column="spu_category_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="pic" column="pic"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="salesCount" column="sales_count"/>
|
||||
<result property="repertoryCount" column="repertory_count"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="ksStatus" column="ks_status"/>
|
||||
<result property="ksStatusTitle" column="ks_status_title"/>
|
||||
<result property="ksComments" column="ks_comments"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.spu_category_id,
|
||||
a.name,
|
||||
a.pic,
|
||||
a.price,
|
||||
a.sales_count,
|
||||
a.repertory_count,
|
||||
a.sort,
|
||||
a.status,
|
||||
a.is_default,
|
||||
a.ks_status,
|
||||
a.ks_status_title,
|
||||
a.ks_comments,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.name != null ">
|
||||
and a.name like concat('%', #{dto.name}, '%')
|
||||
</if>
|
||||
<if test="dto.spuCategoryId != null ">
|
||||
and a.spu_category_id = #{dto.spuCategoryId}
|
||||
</if>
|
||||
<if test="dto.spuCategoryId != null ">
|
||||
and a.spu_category_id = #{dto.spuCategoryId}
|
||||
</if>
|
||||
<if test="dto.status != null and dto.status != '' ">
|
||||
and a.status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.isDefault != null and dto.isDefault != '' ">
|
||||
and a.is_default = #{dto.isDefault}
|
||||
</if>
|
||||
<if test="dto.ksStatus != null and dto.ksStatus != '' ">
|
||||
and a.ks_status = #{dto.ksStatus}
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopPageJoin" resultType="com.bsd.pjcloud.hard.api.vo.spu.HardSpuVo">
|
||||
<include refid="selectA"/>
|
||||
c.name as categoryName
|
||||
from hard_spu a
|
||||
left join hard_spu_category c on c.id = a.spu_category_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.sort desc, a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.spu.HardSpuRepertoryMapper">
|
||||
<resultMap id="hardSpuRepertoryMap" type="com.bsd.pjcloud.hard.api.entity.spu.HardSpuRepertoryEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="hardId" column="hard_id"/>
|
||||
<result property="spuId" column="spu_id"/>
|
||||
<result property="count" column="count"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.bsd.pjcloud.mqtt.broadcast;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 硬件语音广播
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BroadcastVideoService {
|
||||
|
||||
private ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
// 用于管理定时任务
|
||||
private ScheduledFuture<?> scheduledFuture;
|
||||
// 用于管理自动停止任务
|
||||
private ScheduledFuture<?> autoStopFuture;
|
||||
|
||||
private final int interval = 60;
|
||||
private final int autoInterval = 60 * 5;
|
||||
|
||||
/**
|
||||
* 启动广播
|
||||
*/
|
||||
public void startBroadcast() {
|
||||
if (scheduledFuture == null || scheduledFuture.isDone()) {
|
||||
scheduledFuture = executorService.scheduleAtFixedRate(() -> {
|
||||
playAudio();
|
||||
}, 0, interval, TimeUnit.SECONDS);
|
||||
log.info("广播已启动");
|
||||
startAutoStopTask();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止广播
|
||||
*/
|
||||
public void stopBroadcast() {
|
||||
if (scheduledFuture == null) return;
|
||||
scheduledFuture.cancel(false);
|
||||
scheduledFuture = null;
|
||||
if (autoStopFuture != null) {
|
||||
autoStopFuture.cancel(false);
|
||||
autoStopFuture = null;
|
||||
}
|
||||
log.info("广播已停止");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动关闭广播任务
|
||||
*/
|
||||
private void startAutoStopTask() {
|
||||
autoStopFuture = executorService.schedule(() -> {
|
||||
if (scheduledFuture != null && !scheduledFuture.isDone()) {
|
||||
log.info("{}秒内未收到消息,自动停止广播", autoInterval);
|
||||
stopBroadcast();
|
||||
}
|
||||
}, autoInterval, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放音频
|
||||
*/
|
||||
private void playAudio() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -36,6 +36,7 @@ public class MqttEventController {
|
||||
@GetMapping("/send-config-change-msg")
|
||||
public R<Boolean> sendConfigChangeMsg(@RequestParam Long deptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
mqttEventService.getTopicParamsByUserDeptId(dto, deptId);
|
||||
dto.setAction(MqttActionEnum.CONFIG);
|
||||
dto.setMerchantDeptId(deptId);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
|
||||
+2
@@ -4,7 +4,9 @@ import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
|
||||
Reference in new issue
Block a user