feat:智能柜流程代码生成

This commit is contained in:
dzc committed 2025-04-14 16:13:17 +08:00
1 parent 753078984c
commit f369039b21
10 files changed
+349 -4

No files matched your search

+32
View File
@@ -71,6 +71,38 @@ CREATE TABLE hard_door_manager
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 '编号',
order_id bigint NOT NULL COMMENT '订单编号',
auth_id bigint NOT NULL COMMENT '授权编号',
open_event_id varchar(32) NOT NULL COMMENT '开门事件编号',
open_out_open_no varchar(32) NOT NULL COMMENT '商户自定义开门请求号',
open_callback_res varchar(512) DEFAULT NULL COMMENT '开门回调结果',
open_callback_time datetime DEFAULT NULL COMMENT '开门回调时间',
video_callback_res varchar(512) DEFAULT NULL COMMENT '视频回调结果',
video_callback_time datetime DEFAULT NULL COMMENT '视频回调时间',
sku_ks_recog_id varchar(32) DEFAULT NULL COMMENT '识别任务唯一ID,用于结果获取,重新发起售后识别',
sku_submit_time datetime DEFAULT NULL COMMENT 'sku识别提交时间',
sku_callback_res varchar(512) DEFAULT NULL COMMENT 'sku识别回调结果',
sku_callback_time datetime DEFAULT NULL COMMENT 'sku识别回调时间',
sku_driving_res varchar(512) DEFAULT NULL COMMENT 'sku识别主动获取结果',
sku_driving_time datetime DEFAULT NULL COMMENT 'sku识别主动获取时间',
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
-- ----------------------------
@@ -0,0 +1,157 @@
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;
/**
* 智能柜流程
*
* @author hard
* @date 2025-04-14 16:08:33
*/
@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 orderId;
/**
* 授权编号
*/
@Schema(description="授权编号")
private Long authId;
/**
* 开门事件编号
*/
@Schema(description="开门事件编号")
private String openEventId;
/**
* 商户自定义开门请求号
*/
@Schema(description="商户自定义开门请求号")
private String openOutOpenNo;
/**
* 开门回调结果
*/
@Schema(description="开门回调结果")
private String openCallbackRes;
/**
* 开门回调时间
*/
@Schema(description="开门回调时间")
private LocalDateTime openCallbackTime;
/**
* 视频回调结果
*/
@Schema(description="视频回调结果")
private String videoCallbackRes;
/**
* 视频回调时间
*/
@Schema(description="视频回调时间")
private LocalDateTime videoCallbackTime;
/**
* 识别任务唯一ID,用于结果获取,重新发起售后识别
*/
@Schema(description="识别任务唯一ID,用于结果获取,重新发起售后识别")
private String skuKsRecogId;
/**
* sku识别提交时间
*/
@Schema(description="sku识别提交时间")
private LocalDateTime skuSubmitTime;
/**
* sku识别回调结果
*/
@Schema(description="sku识别回调结果")
private String skuCallbackRes;
/**
* sku识别回调时间
*/
@Schema(description="sku识别回调时间")
private LocalDateTime skuCallbackTime;
/**
* sku识别主动获取结果
*/
@Schema(description="sku识别主动获取结果")
private String skuDrivingRes;
/**
* sku识别主动获取时间
*/
@Schema(description="sku识别主动获取时间")
private LocalDateTime skuDrivingTime;
/**
* 创建人
*/
@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;
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.hard.api.vo;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import lombok.Data;
@Data
public class HardDoorFlowVo extends HardDoorFlowEntity {
}
@@ -0,0 +1,82 @@
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.log.annotation.SysLog;
import com.bsd.pjcloud.dzc.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.dzc.service.HardDoorFlowService;
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-door-flow" )
@Tag(description = "hard-door-flow" , name = "智能柜流程管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class HardDoorFlowController {
private final HardDoorFlowService hardDoorFlowService;
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')" )
public R getHardDoorFlowPage(@ParameterObject Page page, @ParameterObject HardDoorFlowEntity hardDoorFlow) {
LambdaQueryWrapper<HardDoorFlowEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(hardDoorFlowService.page(page, wrapper));
}
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('dzc_hardDoorFlow_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(hardDoorFlowService.getById(id));
}
@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));
}
}
@@ -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.HardDoorFlowEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HardDoorFlowMapper extends PjcloudBaseMapper<HardDoorFlowEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.hard.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
public interface HardDoorFlowService extends IService<HardDoorFlowEntity> {
}
@@ -0,0 +1,14 @@
package com.bsd.pjcloud.hard.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity;
import com.bsd.pjcloud.hard.mapper.HardDoorFlowMapper;
import com.bsd.pjcloud.hard.service.HardDoorFlowService;
import org.springframework.stereotype.Service;
/**
* 智能柜流程
*/
@Service
public class HardDoorFlowServiceImpl extends ServiceImpl<HardDoorFlowMapper, HardDoorFlowEntity> implements HardDoorFlowService {
}
@@ -48,6 +48,6 @@ public class HardSpuJoinServiceImpl extends ServiceImpl<HardSpuJoinMapper, HardS
spuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getSpuId())).findFirst().ifPresent(v::setSpuDetail);
}
}
return List.of();
return joinList;
}
}
@@ -31,6 +31,7 @@ import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
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.*;
@@ -104,6 +105,7 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
* 根据 hardwareId 和 cabinetNo 查询商品
*/
@Override
@Transactional(rollbackFor = Exception.class)
public List<Map<Integer, List<HardSpuJoinVo>>> getByCabinetNo(Long hardId, String cabinetNo) {
List<Map<Integer, List<HardSpuJoinVo>>> result = new LinkedList<>();
// 查询设备
@@ -128,13 +130,16 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
hardSpuJoinEntity.setHardDoorId(hardId);
hardSpuJoinEntity.setHardDoorNumber(i);
hardSpuJoinService.save(hardSpuJoinEntity);
storeySpu.add(BeanUtil.toBean(hardSpuJoinEntity, HardSpuJoinVo.class));
HardSpuJoinVo hardSpuJoinVo = BeanUtil.toBean(hardSpuJoinEntity, HardSpuJoinVo.class);
if (ObjectUtil.isNotEmpty(hardSpuJoinVo)) {
storeySpu.add(hardSpuJoinVo);
}
}
Map<Integer, List<HardSpuJoinVo>> addMap = new HashMap<>();
addMap.put(i, storeySpu);
result.add(addMap);
}
return List.of();
return result;
}
/**
@@ -249,7 +254,7 @@ public class HardSpuServiceImpl extends ServiceImpl<HardSpuMapper, HardSpuEntity
baseMapper.updateById(updateList);
}
}
return false;
return true;
}
/**
@@ -0,0 +1,28 @@
<?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.HardDoorFlowMapper">
<resultMap id="hardDoorFlowMap" type="com.bsd.pjcloud.hard.api.entity.HardDoorFlowEntity">
<id property="id" column="id"/>
<result property="orderId" column="order_id"/>
<result property="authId" column="auth_id"/>
<result property="openEventId" column="open_event_id"/>
<result property="openOutOpenNo" column="open_out_open_no"/>
<result property="openCallbackRes" column="open_callback_res"/>
<result property="openCallbackTime" column="open_callback_time"/>
<result property="videoCallbackRes" column="video_callback_res"/>
<result property="videoCallbackTime" column="video_callback_time"/>
<result property="skuKsRecogId" column="sku_ks_recog_id"/>
<result property="skuSubmitTime" column="sku_submit_time"/>
<result property="skuCallbackRes" column="sku_callback_res"/>
<result property="skuCallbackTime" column="sku_callback_time"/>
<result property="skuDrivingRes" column="sku_driving_res"/>
<result property="skuDrivingTime" column="sku_driving_time"/>
<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>