feat(approval): 添加审批码字段及相关功能

- 在return_approval表中添加code字段用于存储审批码
- 在审批相关DTO、Entity、Query中添加code字段支持
- 修改商品详情查询SQL,添加店铺名称字段
- 移除资产申请时的库存校验逻辑
This commit is contained in:
dzq 2025-06-13 09:00:18 +08:00
parent 2c4ccc4dfd
commit 9cc755f83c
11 changed files with 30 additions and 5 deletions

View File

@ -80,7 +80,7 @@ public class ShopGoodsController extends BaseController {
/**
* 获取单个商品信息
*/
@Operation(summary = "商品列表")
@Operation(summary = "商品详情")
// @PreAuthorize("@permission.has('shop:goods:list')")
@GetMapping("/getGoodsInfo")
public ResponseDTO<ShopGoodsDTO> getGoodsInfo(@RequestParam Long goodsId) {

View File

@ -148,14 +148,14 @@ public class AssetApplicationService {
throw new IllegalArgumentException("Insufficient stock");
}
List<CabinetCellEntity> cabinetCellEntities = cabinetCellService.selectByGoodsId(shopGoodsEntity.getGoodsId());
/*List<CabinetCellEntity> cabinetCellEntities = cabinetCellService.selectByGoodsId(shopGoodsEntity.getGoodsId());
if (cabinetCellEntities == null || cabinetCellEntities.isEmpty()) {
throw new IllegalArgumentException("No cabinet cells found for the goods");
}
Integer totalStock = cabinetCellEntities.stream().map(CabinetCellEntity::getStock).reduce(0, Integer::sum);
if (totalStock < command.getApplyQuantity()) {
throw new IllegalArgumentException("Insufficient stock in cabinet cells");
}
}*/
AddApprovalGoodsCommand approvalGoodsCommand = new AddApprovalGoodsCommand();
approvalGoodsCommand.initBaseEntity();

View File

@ -22,6 +22,9 @@ public class PostAssetApprovalCommand {
@ApiModelProperty("申请说明")
private String applyRemark;
@ApiModelProperty("核销码")
private String code;
@ApiModelProperty("手机号码")
private String mobile;

View File

@ -54,6 +54,10 @@ public class ReturnApprovalEntity extends BaseEntity<ReturnApprovalEntity> {
@TableField("external_approval_id")
private Long externalApprovalId;
@ApiModelProperty("审批码")
@TableField("code")
private String code;
@ApiModelProperty("企业微信id")
@TableField("corpid")
private String corpid;

View File

@ -50,6 +50,9 @@ public class ReturnApprovalDTO {
@ExcelColumn(name = "外部归属类型的审批ID")
private Long externalApprovalId;
@ExcelColumn(name = "审批码")
private String code;
@ExcelColumn(name = "企业微信id")
private String corpid;

View File

@ -18,6 +18,7 @@ public class SearchApiReturnApprovalQuery<T> extends AbstractPageQuery<T> {
private Integer status;
private Long externalGoodsId;
private Long externalApprovalId;
private String code;
private String corpid;
private String applyUserid;
private String auditUserid;
@ -40,6 +41,7 @@ public class SearchApiReturnApprovalQuery<T> extends AbstractPageQuery<T> {
.eq(status != null, "ra.status", status)
.eq(externalGoodsId != null, "ra.external_goods_id", externalGoodsId)
.eq(externalApprovalId != null, "ra.external_approval_id", externalApprovalId)
.eq(StrUtil.isNotEmpty(code), "ra.code", code)
.eq(approvalType != null, "ra.approval_type", approvalType)
.eq(StrUtil.isNotEmpty(corpid), "ra.corpid", corpid)
.eq(StrUtil.isNotEmpty(applyUserid), "ra.apply_userid", applyUserid)

View File

@ -18,6 +18,7 @@ public class SearchReturnApprovalQuery<T> extends AbstractPageQuery<T> {
private Integer status;
private Long externalGoodsId;
private Long externalApprovalId;
private String code;
private String corpid;
private String applyUserid;
private String auditUserid;
@ -42,6 +43,7 @@ public class SearchReturnApprovalQuery<T> extends AbstractPageQuery<T> {
.eq(status != null, "ra.status", status)
.eq(externalGoodsId != null, "ra.external_goods_id", externalGoodsId)
.eq(externalApprovalId != null, "ra.external_approval_id", externalApprovalId)
.eq(StrUtil.isNotEmpty(code), "ra.code", code)
.eq(approvalType != null, "ra.approval_type", approvalType)
.eq(StrUtil.isNotEmpty(corpid), "ra.corpid", corpid)
.eq(StrUtil.isNotEmpty(applyUserid), "ra.apply_userid", applyUserid)

View File

@ -16,6 +16,8 @@ public class SearchGoodsDO extends ShopGoodsEntity {
private Long cabinetId;
@TableField("cabinet_name")
private String cabinetName;
@TableField("shop_name_str")
private String shopNameStr;
@TableField("cell_no")
private Integer cellNo;
@TableField("cell_no_str")

View File

@ -87,10 +87,12 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
@Select("SELECT g.*, " +
"SUM(cc.stock) AS total_stock, " +
"GROUP_CONCAT(DISTINCT cc.cell_no) AS cell_no_str, " +
"GROUP_CONCAT(DISTINCT sc.cabinet_name) AS cabinet_name " +
"GROUP_CONCAT(DISTINCT sc.cabinet_name) AS cabinet_name, " +
"GROUP_CONCAT(DISTINCT s.shop_name) AS shop_name_str " +
"FROM shop_goods g " +
"LEFT JOIN cabinet_cell cc ON g.goods_id = cc.goods_id AND cc.deleted = 0 " +
"LEFT JOIN smart_cabinet sc ON cc.cabinet_id = sc.cabinet_id AND sc.deleted = 0 " +
"LEFT JOIN shop s ON s.shop_id = sc.shop_id AND s.deleted = 0 " +
"WHERE g.goods_id = #{goodsId} ")
SearchGoodsDO getGoodsInfo(@Param("goodsId") Long goodsId);

View File

@ -99,6 +99,9 @@ public class ShopGoodsDTO {
@ExcelColumn(name = "已分配库存")
private Integer totalStock;
@ExcelColumn(name = "地址名称")
private String shopNameStr;
@ExcelColumn(name = "商品使用说明")
private String usageInstruction;

View File

@ -21,3 +21,7 @@ AFTER `mode`;
ALTER TABLE `shop`
ADD COLUMN `cover_img` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '封面图URL'
AFTER `balance_enable`;
ALTER TABLE `return_approval`
ADD COLUMN `code` varchar(32) DEFAULT NULL COMMENT '审批码'
AFTER `external_approval_id`;