| | |
| | | @PostMapping("/add") |
| | | @ApiOperation("添加商品到购物车") |
| | | public Result<Object> addToCart(@Valid @RequestBody CartItemDTO cartItemDTO, |
| | | @RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | @RequestParam @NotNull String userId, |
| | | @RequestParam String unitId) { |
| | | try { |
| | | boolean result = cartService.addToCart(userId, unitId, cartItemDTO); |
| | | if (result) { |
| | |
| | | |
| | | @DeleteMapping("/remove") |
| | | @ApiOperation("从购物车移除商品") |
| | | public Result<Object> removeFromCart(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId, |
| | | public Result<Object> removeFromCart(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId, |
| | | @RequestParam @NotNull Long pricingId) { |
| | | try { |
| | | boolean result = cartService.removeFromCart(userId, unitId, pricingId); |
| | |
| | | |
| | | @PutMapping("/update") |
| | | @ApiOperation("更新购物车商品数量") |
| | | public Result<Object> updateCartItemQuantity(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId, |
| | | public Result<Object> updateCartItemQuantity(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId, |
| | | @RequestParam @NotNull Long pricingId, |
| | | @RequestParam @NotNull @Min(1) Integer quantity) { |
| | | try { |
| | |
| | | |
| | | @DeleteMapping("/clear") |
| | | @ApiOperation("清空购物车") |
| | | public Result<Object> clearCart(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> clearCart(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId) { |
| | | try { |
| | | boolean result = cartService.clearCart(userId, unitId); |
| | | if (result) { |
| | |
| | | |
| | | @GetMapping("/info") |
| | | @ApiOperation("获取购物车信息") |
| | | public Result<Object> getCart(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> getCart(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId) { |
| | | try { |
| | | CartVO cart = cartService.getCart(userId, unitId); |
| | | return Result.success(cart); |
| | |
| | | |
| | | @GetMapping("/items") |
| | | @ApiOperation("获取购物车商品列表") |
| | | public Result<Object> getCartItems(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> getCartItems(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId) { |
| | | try { |
| | | List<CartItemVO> items = cartService.getCartItems(userId, unitId); |
| | | return Result.success(items); |
| | |
| | | |
| | | @DeleteMapping("/batch-remove") |
| | | @ApiOperation("批量删除购物车商品") |
| | | public Result<Object> batchRemoveFromCart(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId, |
| | | public Result<Object> batchRemoveFromCart(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId, |
| | | @RequestBody List<Long> pricingIds) { |
| | | try { |
| | | boolean result = cartService.batchRemoveFromCart(userId, unitId, pricingIds); |
| | |
| | | |
| | | @GetMapping("/count") |
| | | @ApiOperation("获取购物车商品数量") |
| | | public Result<Object> getCartItemCount(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> getCartItemCount(@RequestParam @NotNull String userId, |
| | | @RequestParam String unitId) { |
| | | try { |
| | | Integer count = cartService.getCartItemCount(userId, unitId); |
| | | return Result.success(count); |
| | |
| | | |
| | | @PostMapping("/sync-to-db") |
| | | @ApiOperation("同步Redis购物车数据到数据库") |
| | | public Result<Object> syncCartToDatabase(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> syncCartToDatabase(@RequestParam @NotNull String userId, |
| | | @RequestParam @NotNull String unitId) { |
| | | try { |
| | | boolean result = cartService.syncCartToDatabase(userId, unitId); |
| | | if (result) { |
| | |
| | | |
| | | @PostMapping("/load-from-db") |
| | | @ApiOperation("从数据库加载购物车数据到Redis") |
| | | public Result<Object> loadCartFromDatabase(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> loadCartFromDatabase(@RequestParam @NotNull String userId, |
| | | @RequestParam @NotNull String unitId) { |
| | | try { |
| | | boolean result = cartService.loadCartFromDatabase(userId, unitId); |
| | | if (result) { |
| | |
| | | |
| | | @GetMapping("/consistency") |
| | | @ApiOperation("检查购物车数据一致性") |
| | | public Result<Object> checkCartConsistency(@RequestParam @NotNull Long userId, |
| | | @RequestParam @NotNull Long unitId) { |
| | | public Result<Object> checkCartConsistency(@RequestParam @NotNull String userId, |
| | | @RequestParam @NotNull String unitId) { |
| | | try { |
| | | boolean isConsistent = cartService.checkCartConsistency(userId, unitId); |
| | | if (isConsistent) { |
| | |
| | | catch (Exception e) { log.error("查询买家订单列表失败", e); return Result.error("查询买家订单列表失败:" + e.getMessage()); } |
| | | } |
| | | |
| | | @PostMapping("/buyer/page/with-product-conditions") |
| | | @ApiOperation("分页查询买家订单列表(支持产品条件)") |
| | | public Result<Object> getBuyerOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) { |
| | | try { return Result.success(orderInfoService.getBuyerOrderPageWithProductConditions(queryDTO)); } |
| | | catch (Exception e) { log.error("查询买家订单列表失败", e); return Result.error("查询买家订单列表失败:" + e.getMessage()); } |
| | | } |
| | | |
| | | @PostMapping("/create") |
| | | @ApiOperation("创建订单(包含订单详情),需在 Header 携带 Idempotency-Token 防重复提交") |
| | | public Result<OrderInfo> createOrder(@RequestHeader(value = "Idempotency-Token", required = false) String token, |
| | |
| | | return Result.error("提供者ID不能为空"); |
| | | } |
| | | return Result.success(orderInfoService.getSellerOrderPage(queryDTO)); |
| | | } catch (Exception e) { |
| | | log.error("查询卖家订单列表失败", e); |
| | | return Result.error("查询卖家订单列表失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/seller/page/with-product-conditions") |
| | | @ApiOperation("分页查询卖家订单列表(支持产品条件)") |
| | | public Result<Object> getSellerOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) { |
| | | try { |
| | | if (queryDTO.getProviderId() == null) { |
| | | return Result.error("提供者ID不能为空"); |
| | | } |
| | | return Result.success(orderInfoService.getSellerOrderPageWithProductConditions(queryDTO)); |
| | | } catch (Exception e) { |
| | | log.error("查询卖家订单列表失败", e); |
| | | return Result.error("查询卖家订单列表失败:" + e.getMessage()); |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/workflow/update") |
| | | @ApiOperation("根据订单ID更新工作流ID(workflow_id)") |
| | | public Result<Boolean> updateWorkflowId( |
| | | @ApiParam("订单ID") @RequestParam @NotBlank String orderId, |
| | | @ApiParam("工作流ID") @RequestParam @NotBlank String workflowId) { |
| | | try { |
| | | boolean result = orderInfoService.updateWorkflowId(orderId, workflowId); |
| | | return result ? Result.success(true) : Result.error("更新工作流ID失败"); |
| | | } catch (Exception e) { |
| | | log.error("更新工作流ID失败,订单ID: {}", orderId, e); |
| | | return Result.error("更新工作流ID失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/agreement/check/{orderId}") |
| | | @ApiOperation("检查订单是否包含协议类型的子订单") |
| | | public Result<Boolean> checkAgreementPriceType( |
| | |
| | | |
| | | @GetMapping("/total/user/{userId}") |
| | | @ApiOperation("获取用户积分统计") |
| | | public Result<UserPoints> getUserPointsTotal(@ApiParam("用户ID") @PathVariable Long userId) { |
| | | public Result<UserPoints> getUserPointsTotal(@ApiParam("用户ID") @PathVariable String userId) { |
| | | try { |
| | | UserPoints userPoints = pointsFlowService.getUserPointsTotal(userId); |
| | | return Result.success(userPoints); |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @GetMapping("/product/{productId}") |
| | | @ApiOperation("根据产品ID查询定价列表") |
| | | public Result<List<ProductPricing>> getPricingByProductId(@ApiParam("产品ID") @PathVariable Long productId) { |
| | | public Result<List<ProductPricing>> getPricingByProductId(@ApiParam("产品ID") @PathVariable String productId) { |
| | | try { |
| | | if (productId == null) { |
| | | if (!StringUtils.hasText(productId)) { |
| | | return Result.error("产品ID不能为空"); |
| | | } |
| | | List<ProductPricing> result = productPricingService.getPricingByProductId(productId); |
| | |
| | | public class AddPointsFlowDTO { |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | @NotNull(message = "用户ID不能为空") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("提供者ID") |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | @NotNull(message = "单位ID不能为空") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("规则类型(0获得/1消费)") |
| | | @NotNull(message = "规则类型不能为空") |
| | |
| | | @ApiModelProperty("积分规则类别(资源贡献、资源传播、资源交易、交流社区互动)") |
| | | @NotBlank(message = "积分规则编码") |
| | | private String ruleNameCode; |
| | | |
| | | @ApiModelProperty("数据类目)") |
| | | @NotBlank(message = "数据类目不能为空") |
| | | private String dataCategoty; |
| | | |
| | | @ApiModelProperty("关联订单ID") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty("触发次数(默认为1)") |
| | | private Integer count = 1; |
| | |
| | | |
| | | @ApiModelProperty("商品ID") |
| | | @NotNull(message = "商品ID不能为空") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String productName; |
| | |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | @NotNull(message = "用户ID不能为空") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | @NotNull(message = "单位ID不能为空") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("产品名称") |
| | | @NotBlank(message = "产品名称不能为空") |
| | |
| | | private String providerName; |
| | | |
| | | @ApiModelProperty("提供者ID") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("支付方式(如:积分/现金/混合)") |
| | | @NotBlank(message = "支付方式不能为空") |
| | |
| | | |
| | | @ApiModelProperty("产品ID") |
| | | @NotNull(message = "产品ID不能为空") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("产品套件名称") |
| | | private String suiteName; |
| | |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty("产品提供者ID") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("产品提供者名称") |
| | | private String providerName; |
| | |
| | | private Integer pageSize = 10; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("提供者ID") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("订单状态") |
| | | private String orderStatus; |
| | |
| | | |
| | | @ApiModelProperty("排序方向(asc/desc)") |
| | | private String orderDirection = "desc"; |
| | | |
| | | @ApiModelProperty("行业领域ID") |
| | | private String industryId; |
| | | |
| | | @ApiModelProperty("单位工程ID") |
| | | private String unitProjectId; |
| | | |
| | | @ApiModelProperty("产品类型ID") |
| | | private String productTypeId; |
| | | |
| | | @ApiModelProperty("产品类型子级ID") |
| | | private String productSubTypeId; |
| | | |
| | | } |
| | |
| | | private Integer pageSize = 10; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("流水类型(0获得1/消费)") |
| | | private Integer dataType; |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("approval_record") |
| | | @TableName("tb_approval_record") |
| | | @ApiModel(value = "ApprovalRecord", description = "审批记录") |
| | | public class ApprovalRecord { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("cart") |
| | | @TableName("tb_cart") |
| | | @ApiModel(value = "Cart", description = "购物车") |
| | | public class Cart { |
| | | @ApiModelProperty("主键ID") |
| | |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | @TableField("unit_id") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("商品定价ID") |
| | | @TableField("pricing_id") |
| | |
| | | |
| | | @ApiModelProperty("商品ID") |
| | | @TableField("product_id") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | @TableField("product_name") |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("order_approval") |
| | | @TableName("tb_order_approval") |
| | | @ApiModel(value = "OrderApproval", description = "订单审批记录") |
| | | public class OrderApproval { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("order_attachment") |
| | | @TableName("tb_order_attachment") |
| | | @ApiModel(value = "OrderAttachment", description = "订单附件") |
| | | public class OrderAttachment { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("order_detail") |
| | | @TableName("tb_order_detail") |
| | | @ApiModel(value = "OrderDetail", description = "订单详情") |
| | | public class OrderDetail { |
| | | |
| | |
| | | |
| | | @ApiModelProperty("产品ID") |
| | | @TableField("product_id") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("产品套件名称") |
| | | @TableField("suite_name") |
| | |
| | | |
| | | @ApiModelProperty("产品提供者ID") |
| | | @TableField("provider_id") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("产品提供者名称") |
| | | @TableField("provider_name") |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("order_evaluation") |
| | | @TableName("tb_order_evaluation") |
| | | @ApiModel(value = "OrderEvaluation", description = "订单评价") |
| | | public class OrderEvaluation { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("order_info") |
| | | @TableName("tb_order_info") |
| | | public class OrderInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | * 产品ID |
| | | */ |
| | | @TableField("product_id") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | /** |
| | | * 单位ID |
| | | */ |
| | | @TableField("unit_id") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | /** |
| | | * 产品名称 |
| | |
| | | * 提供者ID |
| | | */ |
| | | @TableField("provider_id") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | /** |
| | | * 申请时间 |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("points") |
| | | @TableName("tb_points") |
| | | @ApiModel(value = "Points", description = "积分主表") |
| | | public class Points implements Serializable { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("points_flow") |
| | | @TableName("tb_points_flow") |
| | | public class PointsFlow implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | * 用户ID |
| | | */ |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | /** |
| | | * 单位ID |
| | | */ |
| | | @TableField("unit_id") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | /** |
| | | * 数据类目 |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("points_rule") |
| | | @TableName("tb_points_rule") |
| | | @ApiModel(value = "PointsRule", description = "积分规则") |
| | | public class PointsRule implements Serializable { |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("product") |
| | | @TableName("tb_product") |
| | | public class Product implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("product_pricing") |
| | | @TableName("tb_product_pricing") |
| | | public class ProductPricing implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | * 关联产品ID |
| | | */ |
| | | @TableField("product_id") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | /** |
| | | * 产品名称 |
| | |
| | | * 产品提供者ID |
| | | */ |
| | | @TableField("provider_id") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | /** |
| | | * 产品提供者名称 |
New file |
| | |
| | | package com.webmanage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 产品信息表实体类 |
| | | */ |
| | | @Data |
| | | @TableName("tb_report_result_submission") |
| | | public class ReportResultSubmission { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | private String name; |
| | | |
| | | private String describe; |
| | | |
| | | private String sourceId; |
| | | |
| | | private String sourceName; |
| | | |
| | | private String schemeId; |
| | | |
| | | private String schemeName; |
| | | |
| | | private String industrialChainId; |
| | | |
| | | private String industrialChainName; |
| | | |
| | | private String importantAreaId; |
| | | |
| | | private String importantAreaName; |
| | | |
| | | private String sceneId; |
| | | |
| | | private String sceneName; |
| | | |
| | | private String deptId; |
| | | |
| | | private String submissionUnit; |
| | | |
| | | private Integer sort; |
| | | |
| | | private String status; |
| | | |
| | | private String approStatus; |
| | | |
| | | private String createBy; |
| | | |
| | | private String createUserId; |
| | | |
| | | private LocalDateTime createTime; |
| | | |
| | | private String updateBy; |
| | | |
| | | private String updateUserId; |
| | | |
| | | private LocalDateTime updateTime; |
| | | |
| | | private String deleted; |
| | | |
| | | private String homeImage; |
| | | |
| | | private String uploadDoc; |
| | | |
| | | private String uploadVideo; |
| | | |
| | | private String flowId; |
| | | |
| | | private String typeId; |
| | | |
| | | private String typeName; |
| | | |
| | | private String typeChildId; |
| | | |
| | | private String typeChildName; |
| | | |
| | | private String businessProcessId; |
| | | |
| | | private String businessProcessName; |
| | | |
| | | private String awardId; |
| | | |
| | | private String awardName; |
| | | |
| | | private String dataSource; |
| | | |
| | | private String importantDistrictId; |
| | | |
| | | private String importantDistrictName; |
| | | |
| | | private String unitId; |
| | | |
| | | private String display; |
| | | |
| | | private String url1; |
| | | |
| | | private String importantFullName; |
| | | } |
| | |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("user_points") |
| | | @TableName("tb_user_points") |
| | | public class UserPoints implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | * 用户ID |
| | | */ |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | /** |
| | | * 单位ID |
| | | */ |
| | | @TableField("unit_id") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | /** |
| | | * 积分余额 |
| | |
| | | /** |
| | | * 根据用户ID和单位ID查询购物车商品列表 |
| | | */ |
| | | List<Cart> selectByUserIdAndUnitId(@Param("userId") Long userId, @Param("unitId") Long unitId); |
| | | List<Cart> selectByUserIdAndUnitId(@Param("userId") String userId, @Param("unitId") String unitId); |
| | | |
| | | /** |
| | | * 根据用户ID、单位ID和定价ID查询购物车商品 |
| | | */ |
| | | Cart selectByUserIdUnitIdAndPricingId(@Param("userId") Long userId, @Param("unitId") Long unitId, @Param("pricingId") Long pricingId); |
| | | Cart selectByUserIdUnitIdAndPricingId(@Param("userId") String userId, @Param("unitId") String unitId, @Param("pricingId") Long pricingId); |
| | | |
| | | /** |
| | | * 根据用户ID和单位ID统计购物车商品数量 |
| | | */ |
| | | Integer countByUserIdAndUnitId(@Param("userId") Long userId, @Param("unitId") Long unitId); |
| | | Integer countByUserIdAndUnitId(@Param("userId") String userId, @Param("unitId") String unitId); |
| | | |
| | | /** |
| | | * 根据用户ID和单位ID计算购物车总金额 |
| | | */ |
| | | java.math.BigDecimal sumTotalAmountByUserIdAndUnitId(@Param("userId") Long userId, @Param("unitId") Long unitId); |
| | | java.math.BigDecimal sumTotalAmountByUserIdAndUnitId(@Param("userId") String userId, @Param("unitId") String unitId); |
| | | |
| | | Integer deleteByCustomerCondition(@Param("id") Long id); |
| | | } |
| | |
| | | /** |
| | | * 分页查询买家订单列表 |
| | | */ |
| | | IPage<OrderInfo> selectBuyerOrderPage(Page<OrderInfo> page, @Param("userId") Long userId, |
| | | @Param("unitId") Long unitId, @Param("orderStatus") String orderStatus, |
| | | IPage<OrderInfo> selectBuyerOrderPage(Page<OrderInfo> page, @Param("userId") String userId, |
| | | @Param("unitId") String unitId, @Param("orderStatus") String orderStatus, |
| | | @Param("paymentStatus") String paymentStatus, @Param("paymentType") String paymentType, |
| | | @Param("productName") String productName, @Param("providerName") String providerName, |
| | | @Param("orderId") String orderId, @Param("applyTimeStart") String applyTimeStart, |
| | |
| | | /** |
| | | * 分页查询卖家订单列表 |
| | | */ |
| | | IPage<OrderInfo> selectSellerOrderPage(Page<OrderInfo> page, @Param("providerId") Long providerId, |
| | | IPage<OrderInfo> selectSellerOrderPage(Page<OrderInfo> page, @Param("providerId") String providerId, |
| | | @Param("orderStatus") String orderStatus, @Param("paymentStatus") String paymentStatus, |
| | | @Param("productName") String productName, @Param("orderId") String orderId, |
| | | @Param("applyTimeStart") String applyTimeStart, @Param("applyTimeEnd") String applyTimeEnd, |
| | |
| | | @Param("orderId") String orderId, @Param("applyTimeStart") String applyTimeStart, |
| | | @Param("applyTimeEnd") String applyTimeEnd, @Param("orderBy") String orderBy, |
| | | @Param("orderDirection") String orderDirection); |
| | | |
| | | /** |
| | | * 分页查询买家订单列表(支持产品条件) |
| | | */ |
| | | IPage<OrderInfo> selectBuyerOrderPageWithProductConditions(Page<OrderInfo> page, @Param("userId") String userId, |
| | | @Param("unitId") String unitId, @Param("orderStatus") String orderStatus, |
| | | @Param("paymentStatus") String paymentStatus, @Param("paymentType") String paymentType, |
| | | @Param("productName") String productName, @Param("providerName") String providerName, |
| | | @Param("orderId") String orderId, @Param("applyTimeStart") String applyTimeStart, |
| | | @Param("applyTimeEnd") String applyTimeEnd, @Param("createTimeStart") String createTimeStart, |
| | | @Param("createTimeEnd") String createTimeEnd, @Param("orderBy") String orderBy, |
| | | @Param("orderDirection") String orderDirection, @Param("productIds") java.util.List<String> productIds); |
| | | |
| | | /** |
| | | * 分页查询卖家订单列表(支持产品条件) |
| | | */ |
| | | IPage<OrderInfo> selectSellerOrderPageWithProductConditions(Page<OrderInfo> page, @Param("providerId") String providerId, |
| | | @Param("orderStatus") String orderStatus, @Param("paymentStatus") String paymentStatus, |
| | | @Param("productName") String productName, @Param("orderId") String orderId, |
| | | @Param("applyTimeStart") String applyTimeStart, @Param("applyTimeEnd") String applyTimeEnd, |
| | | @Param("createTimeStart") String createTimeStart, @Param("createTimeEnd") String createTimeEnd, |
| | | @Param("orderBy") String orderBy, @Param("orderDirection") String orderDirection, @Param("productIds") java.util.List<String> productIds); |
| | | } |
| | |
| | | /** |
| | | * 根据产品ID查询定价列表 |
| | | */ |
| | | List<ProductPricing> selectByProductId(@Param("productId") Long productId); |
| | | List<ProductPricing> selectByProductId(@Param("productId") String productId); |
| | | |
| | | /** |
| | | * 根据条件查询产品定价 |
New file |
| | |
| | | package com.webmanage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.webmanage.entity.ReportResultSubmission; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 产品信息表Mapper接口 |
| | | */ |
| | | @Mapper |
| | | public interface ReportResultSubmissionMapper extends BaseMapper<ReportResultSubmission> { |
| | | |
| | | /** |
| | | * 根据条件查询产品ID列表 |
| | | * @param industryId 行业领域ID |
| | | * @param unitProjectId 单位工程ID |
| | | * @param productTypeId 产品类型ID |
| | | * @param productSubTypeId 产品类型子级ID |
| | | * @return 产品ID列表 |
| | | */ |
| | | List<String> selectProductIdsByConditions( |
| | | @Param("industryId") String industryId, |
| | | @Param("unitProjectId") String unitProjectId, |
| | | @Param("productTypeId") String productTypeId, |
| | | @Param("productSubTypeId") String productSubTypeId |
| | | ); |
| | | } |
| | |
| | | /** |
| | | * 根据用户ID查询积分信息 |
| | | */ |
| | | UserPoints selectByUserId(@Param("userId") Long userId); |
| | | UserPoints selectByUserId(@Param("userId") String userId); |
| | | |
| | | /** |
| | | * 根据单位ID查询积分信息 |
| | | */ |
| | | UserPoints selectByUnitId(@Param("unitId") Long unitId); |
| | | UserPoints selectByUnitId(@Param("unitId") String unitId); |
| | | } |
| | |
| | | import com.webmanage.vo.CartItemVO; |
| | | |
| | | public interface CartPersistenceService { |
| | | void saveOrUpdate(Long userId, Long unitId, CartItemVO item); |
| | | void remove(Long userId, Long unitId, Long pricingId); |
| | | void clear(Long userId, Long unitId); |
| | | void saveOrUpdate(String userId, String unitId, CartItemVO item); |
| | | void remove(String userId, String unitId, Long pricingId); |
| | | void clear(String userId, String unitId); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * 添加商品到购物车(Redis + 数据库) |
| | | */ |
| | | boolean addToCart(Long userId, Long unitId, CartItemDTO cartItemDTO); |
| | | boolean addToCart(String userId, String unitId, CartItemDTO cartItemDTO); |
| | | |
| | | /** |
| | | * 从购物车移除商品(Redis + 数据库) |
| | | */ |
| | | boolean removeFromCart(Long userId, Long unitId, Long pricingId); |
| | | boolean removeFromCart(String userId, String unitId, Long pricingId); |
| | | |
| | | /** |
| | | * 更新购物车商品数量(Redis + 数据库) |
| | | */ |
| | | boolean updateCartItemQuantity(Long userId, Long unitId, Long pricingId, Integer quantity); |
| | | boolean updateCartItemQuantity(String userId, String unitId, Long pricingId, Integer quantity); |
| | | |
| | | /** |
| | | * 清空购物车(Redis + 数据库) |
| | | */ |
| | | boolean clearCart(Long userId, Long unitId); |
| | | boolean clearCart(String userId, String unitId); |
| | | |
| | | /** |
| | | * 获取购物车信息(优先Redis,失败则从数据库加载) |
| | | */ |
| | | CartVO getCart(Long userId, Long unitId); |
| | | CartVO getCart(String userId, String unitId); |
| | | |
| | | /** |
| | | * 获取购物车商品列表(优先Redis,失败则从数据库加载) |
| | | */ |
| | | List<CartItemVO> getCartItems(Long userId, Long unitId); |
| | | List<CartItemVO> getCartItems(String userId, String unitId); |
| | | |
| | | /** |
| | | * 检查购物车商品库存 |
| | | */ |
| | | boolean checkCartItemStock(Long userId, Long unitId, Long pricingId); |
| | | boolean checkCartItemStock(String userId, String unitId, Long pricingId); |
| | | |
| | | /** |
| | | * 批量删除购物车商品(Redis + 数据库) |
| | | */ |
| | | boolean batchRemoveFromCart(Long userId, Long unitId, List<Long> pricingIds); |
| | | boolean batchRemoveFromCart(String userId, String unitId, List<Long> pricingIds); |
| | | |
| | | /** |
| | | * 获取购物车商品数量(优先Redis,失败则从数据库加载) |
| | | */ |
| | | Integer getCartItemCount(Long userId, Long unitId); |
| | | Integer getCartItemCount(String userId, String unitId); |
| | | |
| | | /** |
| | | * 从数据库加载购物车数据到Redis |
| | | */ |
| | | boolean loadCartFromDatabase(Long userId, Long unitId); |
| | | boolean loadCartFromDatabase(String userId, String unitId); |
| | | |
| | | /** |
| | | * 同步Redis数据到数据库 |
| | | */ |
| | | boolean syncCartToDatabase(Long userId, Long unitId); |
| | | boolean syncCartToDatabase(String userId, String unitId); |
| | | |
| | | /** |
| | | * 检查购物车数据一致性 |
| | | */ |
| | | boolean checkCartConsistency(Long userId, Long unitId); |
| | | boolean checkCartConsistency(String userId, String unitId); |
| | | } |
| | |
| | | /** |
| | | * 分页查询买家订单列表 |
| | | */ |
| | | PageResult<OrderInfo> getBuyerOrderPage(OrderQueryDTO queryDTO); |
| | | PageResult<OrderDetailVO> getBuyerOrderPage(OrderQueryDTO queryDTO); |
| | | |
| | | /** |
| | | * 分页查询卖家订单列表 |
| | | */ |
| | | PageResult<OrderInfo> getSellerOrderPage(OrderQueryDTO queryDTO); |
| | | PageResult<OrderDetailVO> getSellerOrderPage(OrderQueryDTO queryDTO); |
| | | |
| | | /** |
| | | * 分页查询买家订单列表(支持产品条件) |
| | | */ |
| | | PageResult<OrderDetailVO> getBuyerOrderPageWithProductConditions(OrderQueryDTO queryDTO); |
| | | |
| | | /** |
| | | * 分页查询卖家订单列表(支持产品条件) |
| | | */ |
| | | PageResult<OrderDetailVO> getSellerOrderPageWithProductConditions(OrderQueryDTO queryDTO); |
| | | |
| | | /** |
| | | * 分页查询待审批订单列表 |
| | |
| | | * @return 是否取消成功 |
| | | */ |
| | | boolean cancelOrder(String orderId); |
| | | |
| | | /** |
| | | * 根据订单ID更新工作流ID |
| | | * @param orderId 订单ID |
| | | * @param workflowId 工作流实例ID |
| | | * @return 是否更新成功 |
| | | */ |
| | | boolean updateWorkflowId(String orderId, String workflowId); |
| | | } |
| | |
| | | /** |
| | | * 获取用户积分统计 |
| | | */ |
| | | UserPoints getUserPointsTotal(Long userId); |
| | | UserPoints getUserPointsTotal(String userId); |
| | | |
| | | /** |
| | | * 获取单位积分统计 |
| | |
| | | /** |
| | | * 根据产品ID查询定价列表 |
| | | */ |
| | | List<ProductPricing> getPricingByProductId(Long productId); |
| | | List<ProductPricing> getPricingByProductId(String productId); |
| | | |
| | | /** |
| | | * 根据条件查询产品定价 |
| | |
| | | /** |
| | | * 获取个人积分统计 |
| | | */ |
| | | PointsStatsVO getPersonalPointsStats(Long userId); |
| | | PointsStatsVO getPersonalPointsStats(String userId); |
| | | |
| | | /** |
| | | * 获取单位积分统计 |
| | | */ |
| | | PointsStatsVO getUnitPointsStats(Long unitId); |
| | | PointsStatsVO getUnitPointsStats(String unitId); |
| | | |
| | | /** |
| | | * 更新用户积分 |
| | | */ |
| | | void updateUserPoints(Long userId, Long unitId, Integer points); |
| | | void updateUserPoints(String userId, String unitId, Integer points); |
| | | } |
| | |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.AsyncConfigurer; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @Override |
| | | @Async("asyncExecutor") |
| | | public void saveOrUpdate(Long userId, Long unitId, CartItemVO item) { |
| | | public void saveOrUpdate(String userId, String unitId, CartItemVO item) { |
| | | try { |
| | | Cart cart = new Cart(); |
| | | BeanUtils.copyProperties(item, cart); |
| | | cart.setUserId(userId); |
| | | cart.setUnitId(unitId); |
| | | if(StringUtils.hasText(unitId)){ |
| | | cart.setUnitId(unitId); |
| | | } |
| | | cart.setUpdateTime(LocalDateTime.now()); |
| | | Cart existing = cartMapper.selectByUserIdUnitIdAndPricingId(userId, unitId, item.getPricingId()); |
| | | if (existing != null) { |
| | |
| | | |
| | | @Override |
| | | @Async("asyncExecutor") |
| | | public void remove(Long userId, Long unitId, Long pricingId) { |
| | | public void remove(String userId, String unitId, Long pricingId) { |
| | | try { |
| | | Cart existing = cartMapper.selectByUserIdUnitIdAndPricingId(userId, unitId, pricingId); |
| | | if (existing != null) { |
| | |
| | | |
| | | @Override |
| | | @Async("asyncExecutor") |
| | | public void clear(Long userId, Long unitId) { |
| | | public void clear(String userId, String unitId) { |
| | | try { |
| | | java.util.List<Cart> cartItems = cartMapper.selectByUserIdAndUnitId(userId, unitId); |
| | | for (Cart item : cartItems) { |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean addToCart(Long userId, Long unitId, CartItemDTO cartItemDTO) { |
| | | public boolean addToCart(String userId, String unitId, CartItemDTO cartItemDTO) { |
| | | try { |
| | | // 验证商品定价是否存在 |
| | | ProductPricing pricing = productPricingMapper.selectById(cartItemDTO.getPricingId()); |
| | |
| | | } |
| | | |
| | | // 构建购物车key |
| | | String cartKey = buildCartKey(userId, unitId); |
| | | String cartKey = buildCartKey(userId,unitId); |
| | | String cartItemKey = buildCartItemKey(userId, unitId, cartItemDTO.getPricingId()); |
| | | |
| | | // 检查商品是否已在购物车中 |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean removeFromCart(Long userId, Long unitId, Long pricingId) { |
| | | public boolean removeFromCart(String userId, String unitId, Long pricingId) { |
| | | try { |
| | | String cartItemKey = buildCartItemKey(userId, unitId, pricingId); |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateCartItemQuantity(Long userId, Long unitId, Long pricingId, Integer quantity) { |
| | | public boolean updateCartItemQuantity(String userId, String unitId, Long pricingId, Integer quantity) { |
| | | try { |
| | | if (quantity <= 0) { |
| | | return removeFromCart(userId, unitId, pricingId); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean clearCart(Long userId, Long unitId) { |
| | | public boolean clearCart(String userId, String unitId) { |
| | | try { |
| | | String cartKey = buildCartKey(userId, unitId); |
| | | List<Long> pricingIds = getCartItemPricingIds(userId, unitId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CartVO getCart(Long userId, Long unitId) { |
| | | public CartVO getCart(String userId, String unitId) { |
| | | try { |
| | | CartVO cartVO = new CartVO(); |
| | | cartVO.setUserId(userId); |
| | | cartVO.setUnitId(unitId); |
| | | |
| | | if (StringUtils.hasText(unitId)){ |
| | | cartVO.setUnitId(unitId); |
| | | } |
| | | List<CartItemVO> items = getCartItems(userId, unitId); |
| | | cartVO.setItems(items); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CartItemVO> getCartItems(Long userId, Long unitId) { |
| | | public List<CartItemVO> getCartItems(String userId, String unitId) { |
| | | try { |
| | | // 优先从Redis获取 |
| | | List<CartItemVO> items = getCartItemsFromRedis(userId, unitId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkCartItemStock(Long userId, Long unitId, Long pricingId) { |
| | | public boolean checkCartItemStock(String userId, String unitId, Long pricingId) { |
| | | // TODO: 实现库存检查逻辑 |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean batchRemoveFromCart(Long userId, Long unitId, List<Long> pricingIds) { |
| | | public boolean batchRemoveFromCart(String userId, String unitId, List<Long> pricingIds) { |
| | | try { |
| | | if (CollectionUtils.isEmpty(pricingIds)) { |
| | | return true; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer getCartItemCount(Long userId, Long unitId) { |
| | | public Integer getCartItemCount(String userId, String unitId) { |
| | | try { |
| | | // 优先从Redis获取 |
| | | String cartKey = buildCartKey(userId, unitId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean loadCartFromDatabase(Long userId, Long unitId) { |
| | | public boolean loadCartFromDatabase(String userId, String unitId) { |
| | | try { |
| | | List<Cart> cartItems = cartMapper.selectByUserIdAndUnitId(userId, unitId); |
| | | if (CollectionUtils.isEmpty(cartItems)) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean syncCartToDatabase(Long userId, Long unitId) { |
| | | public boolean syncCartToDatabase(String userId, String unitId) { |
| | | try { |
| | | List<CartItemVO> redisItems = getCartItemsFromRedis(userId, unitId); |
| | | if (CollectionUtils.isEmpty(redisItems)) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkCartConsistency(Long userId, Long unitId) { |
| | | public boolean checkCartConsistency(String userId, String unitId) { |
| | | try { |
| | | List<CartItemVO> redisItems = getCartItemsFromRedis(userId, unitId); |
| | | List<Cart> dbItems = cartMapper.selectByUserIdAndUnitId(userId, unitId); |
| | |
| | | |
| | | // ==================== 私有方法 ==================== |
| | | |
| | | private String buildCartKey(Long userId, Long unitId) { |
| | | return CART_KEY_PREFIX + userId + ":" + unitId; |
| | | private String buildCartKey(String userId, String unitId) { |
| | | if(StringUtils.hasText(unitId)){ |
| | | return CART_KEY_PREFIX + userId + ":" + unitId; |
| | | } |
| | | return CART_KEY_PREFIX + userId; |
| | | } |
| | | |
| | | private String buildCartItemKey(Long userId, Long unitId, Long pricingId) { |
| | | return CART_ITEM_KEY_PREFIX + userId + ":" + unitId + ":" + pricingId; |
| | | private String buildCartItemKey(String userId, String unitId, Long pricingId) { |
| | | if(StringUtils.hasText(unitId)){ |
| | | return CART_ITEM_KEY_PREFIX + userId + ":" + unitId + ":" + pricingId; |
| | | } |
| | | return CART_ITEM_KEY_PREFIX + userId + ":" + pricingId; |
| | | } |
| | | |
| | | private void updateCartItemList(Long userId, Long unitId, Long pricingId, boolean add) { |
| | | private void updateCartItemList(String userId, String unitId, Long pricingId, boolean add) { |
| | | String cartKey = buildCartKey(userId, unitId); |
| | | List<Long> pricingIds = (List<Long>) redisTemplate.opsForValue().get(cartKey); |
| | | |
| | |
| | | redisTemplate.opsForValue().set(cartKey, pricingIds, CART_EXPIRE_DAYS, TimeUnit.DAYS); |
| | | } |
| | | |
| | | private List<Long> getCartItemPricingIds(Long userId, Long unitId) { |
| | | private List<Long> getCartItemPricingIds(String userId, String unitId) { |
| | | String cartKey = buildCartKey(userId, unitId); |
| | | List<Long> pricingIds = (List<Long>) redisTemplate.opsForValue().get(cartKey); |
| | | return pricingIds != null ? pricingIds : new ArrayList<>(); |
| | | } |
| | | |
| | | private List<CartItemVO> getCartItemsFromRedis(Long userId, Long unitId) { |
| | | private List<CartItemVO> getCartItemsFromRedis(String userId, String unitId) { |
| | | try { |
| | | String cartKey = buildCartKey(userId, unitId); |
| | | List<Long> pricingIds = (List<Long>) redisTemplate.opsForValue().get(cartKey); |
| | |
| | | } |
| | | } |
| | | |
| | | private List<CartItemVO> getCartItemsFromDatabase(Long userId, Long unitId) { |
| | | private List<CartItemVO> getCartItemsFromDatabase(String userId, String unitId) { |
| | | try { |
| | | List<Cart> cartItems = cartMapper.selectByUserIdAndUnitId(userId, unitId); |
| | | List<CartItemVO> items = new ArrayList<>(); |
| | |
| | | return itemVO; |
| | | } |
| | | |
| | | private void syncCartItemToDatabase(Long userId, Long unitId, CartItemVO item) { |
| | | private void syncCartItemToDatabase(String userId, String unitId, CartItemVO item) { |
| | | try { |
| | | Cart cart = new Cart(); |
| | | BeanUtils.copyProperties(item, cart); |
| | |
| | | } |
| | | } |
| | | |
| | | private void removeCartItemFromDatabase(Long userId, Long unitId, Long pricingId) { |
| | | private void removeCartItemFromDatabase(String userId, String unitId, Long pricingId) { |
| | | try { |
| | | Cart existingCart = cartMapper.selectByUserIdUnitIdAndPricingId(userId, unitId, pricingId); |
| | | if (existingCart != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | private void clearCartFromDatabase(Long userId, Long unitId) { |
| | | private void clearCartFromDatabase(String userId, String unitId) { |
| | | try { |
| | | // 使用逻辑删除 |
| | | List<Cart> cartItems = cartMapper.selectByUserIdAndUnitId(userId, unitId); |
| | |
| | | import com.webmanage.mapper.OrderDetailMapper; |
| | | import com.webmanage.mapper.OrderEvaluationMapper; |
| | | import com.webmanage.mapper.OrderInfoMapper; |
| | | import com.webmanage.mapper.ReportResultSubmissionMapper; |
| | | import com.webmanage.service.OrderInfoService; |
| | | import com.webmanage.service.OrderNoService; |
| | | import com.webmanage.service.MinioService; |
| | |
| | | @Resource |
| | | private MinioService minioService; |
| | | |
| | | @Resource |
| | | private ReportResultSubmissionMapper reportResultSubmissionMapper; |
| | | |
| | | @Override |
| | | public PageResult<OrderInfo> getBuyerOrderPage(OrderQueryDTO queryDTO) { |
| | | public PageResult<OrderDetailVO> getBuyerOrderPage(OrderQueryDTO queryDTO) { |
| | | // 参数校验 |
| | | if (queryDTO.getUserId() == null) { |
| | | throw new BusinessException("用户ID不能为空"); |
| | |
| | | queryDTO.getCreateTimeEnd() != null ? queryDTO.getCreateTimeEnd().toString() : null, |
| | | queryDTO.getOrderBy(), queryDTO.getOrderDirection() |
| | | ); |
| | | // 将订单与详情联表封装到VO |
| | | List<OrderDetailVO> voList = result.getRecords().stream().map(order -> { |
| | | OrderDetailVO vo = new OrderDetailVO(); |
| | | BeanUtils.copyProperties(order, vo); |
| | | List<OrderDetail> details = orderDetailMapper.selectByOrderId(order.getOrderId()); |
| | | List<OrderDetailItemVO> items = details.stream().map(d -> { |
| | | OrderDetailItemVO item = new OrderDetailItemVO(); |
| | | BeanUtils.copyProperties(d, item); |
| | | return item; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | vo.setOrderDetails(items); |
| | | return vo; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | |
| | | // 构建返回结果 |
| | | return new PageResult<OrderInfo>( |
| | | result.getRecords(), |
| | | return new PageResult<OrderDetailVO>( |
| | | voList, |
| | | result.getTotal(), |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<OrderInfo> getSellerOrderPage(OrderQueryDTO queryDTO) { |
| | | public PageResult<OrderDetailVO> getSellerOrderPage(OrderQueryDTO queryDTO) { |
| | | // 参数校验 |
| | | if (queryDTO.getProviderId() == null) { |
| | | throw new BusinessException("提供者ID不能为空"); |
| | |
| | | queryDTO.getOrderBy(), queryDTO.getOrderDirection() |
| | | ); |
| | | |
| | | // 将订单与详情联表封装到VO |
| | | List<OrderDetailVO> voList = result.getRecords().stream().map(order -> { |
| | | OrderDetailVO vo = new OrderDetailVO(); |
| | | BeanUtils.copyProperties(order, vo); |
| | | List<OrderDetail> details = orderDetailMapper.selectByOrderId(order.getOrderId()); |
| | | List<OrderDetailItemVO> items = details.stream().map(d -> { |
| | | OrderDetailItemVO item = new OrderDetailItemVO(); |
| | | BeanUtils.copyProperties(d, item); |
| | | return item; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | vo.setOrderDetails(items); |
| | | return vo; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | |
| | | // 构建返回结果 |
| | | return new PageResult<OrderInfo>( |
| | | result.getRecords(), |
| | | return new PageResult<OrderDetailVO>( |
| | | voList, |
| | | result.getTotal(), |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | |
| | | // 构建返回结果 |
| | | return new PageResult<OrderInfo>( |
| | | result.getRecords(), |
| | | result.getTotal(), |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | | result.getPages() |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<OrderDetailVO> getBuyerOrderPageWithProductConditions(OrderQueryDTO queryDTO) { |
| | | // 参数校验 |
| | | if (queryDTO.getUserId() == null) { |
| | | throw new BusinessException("用户ID不能为空"); |
| | | } |
| | | |
| | | // 根据产品条件查询产品ID列表 |
| | | List<String> productIds = null; |
| | | if (StringUtils.hasText(queryDTO.getIndustryId()) || StringUtils.hasText(queryDTO.getUnitProjectId()) || |
| | | StringUtils.hasText(queryDTO.getProductTypeId()) || StringUtils.hasText(queryDTO.getProductSubTypeId())) { |
| | | productIds = reportResultSubmissionMapper.selectProductIdsByConditions( |
| | | queryDTO.getIndustryId(), queryDTO.getUnitProjectId(), |
| | | queryDTO.getProductTypeId(), queryDTO.getProductSubTypeId() |
| | | ); |
| | | |
| | | // 如果没有找到匹配的产品,直接返回空结果 |
| | | if (CollectionUtils.isEmpty(productIds)) { |
| | | return new PageResult<OrderDetailVO>( |
| | | java.util.Collections.emptyList(), |
| | | 0L, |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | | 0L |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 创建分页对象 |
| | | Page<OrderInfo> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize()); |
| | | |
| | | // 执行分页查询 |
| | | IPage<OrderInfo> result = baseMapper.selectBuyerOrderPageWithProductConditions( |
| | | page, queryDTO.getUserId(), queryDTO.getUnitId(), queryDTO.getOrderStatus(), |
| | | queryDTO.getPaymentStatus(), queryDTO.getPaymentType(), queryDTO.getProductName(), |
| | | queryDTO.getProviderName(), queryDTO.getOrderId(), |
| | | queryDTO.getApplyTimeStart() != null ? queryDTO.getApplyTimeStart().toString() : null, |
| | | queryDTO.getApplyTimeEnd() != null ? queryDTO.getApplyTimeEnd().toString() : null, |
| | | queryDTO.getCreateTimeStart() != null ? queryDTO.getCreateTimeStart().toString() : null, |
| | | queryDTO.getCreateTimeEnd() != null ? queryDTO.getCreateTimeEnd().toString() : null, |
| | | queryDTO.getOrderBy(), queryDTO.getOrderDirection(), productIds |
| | | ); |
| | | |
| | | // 将订单与详情联表封装到VO |
| | | List<OrderDetailVO> voList = result.getRecords().stream().map(order -> { |
| | | OrderDetailVO vo = new OrderDetailVO(); |
| | | BeanUtils.copyProperties(order, vo); |
| | | List<OrderDetail> details = orderDetailMapper.selectByOrderId(order.getOrderId()); |
| | | List<OrderDetailItemVO> items = details.stream().map(d -> { |
| | | OrderDetailItemVO item = new OrderDetailItemVO(); |
| | | BeanUtils.copyProperties(d, item); |
| | | return item; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | vo.setOrderDetails(items); |
| | | return vo; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | |
| | | // 构建返回结果 |
| | | return new PageResult<OrderDetailVO>( |
| | | voList, |
| | | result.getTotal(), |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | | result.getPages() |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<OrderDetailVO> getSellerOrderPageWithProductConditions(OrderQueryDTO queryDTO) { |
| | | // 参数校验 |
| | | if (queryDTO.getProviderId() == null) { |
| | | throw new BusinessException("提供者ID不能为空"); |
| | | } |
| | | |
| | | // 根据产品条件查询产品ID列表 |
| | | List<String> productIds = null; |
| | | if (StringUtils.hasText(queryDTO.getIndustryId()) || StringUtils.hasText(queryDTO.getUnitProjectId()) || |
| | | StringUtils.hasText(queryDTO.getProductTypeId()) || StringUtils.hasText(queryDTO.getProductSubTypeId())) { |
| | | productIds = reportResultSubmissionMapper.selectProductIdsByConditions( |
| | | queryDTO.getIndustryId(), queryDTO.getUnitProjectId(), |
| | | queryDTO.getProductTypeId(), queryDTO.getProductSubTypeId() |
| | | ); |
| | | |
| | | // 如果没有找到匹配的产品,直接返回空结果 |
| | | if (CollectionUtils.isEmpty(productIds)) { |
| | | return new PageResult<OrderDetailVO>( |
| | | java.util.Collections.emptyList(), |
| | | 0L, |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | | 0L |
| | | ); |
| | | } |
| | | } |
| | | |
| | | // 创建分页对象 |
| | | Page<OrderInfo> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize()); |
| | | |
| | | // 执行分页查询 |
| | | IPage<OrderInfo> result = baseMapper.selectSellerOrderPageWithProductConditions( |
| | | page, queryDTO.getProviderId(), queryDTO.getOrderStatus(), queryDTO.getPaymentStatus(), |
| | | queryDTO.getProductName(), queryDTO.getOrderId(), |
| | | queryDTO.getApplyTimeStart() != null ? queryDTO.getApplyTimeStart().toString() : null, |
| | | queryDTO.getApplyTimeEnd() != null ? queryDTO.getApplyTimeEnd().toString() : null, |
| | | queryDTO.getCreateTimeStart() != null ? queryDTO.getCreateTimeStart().toString() : null, |
| | | queryDTO.getCreateTimeEnd() != null ? queryDTO.getCreateTimeEnd().toString() : null, |
| | | queryDTO.getOrderBy(), queryDTO.getOrderDirection(), productIds |
| | | ); |
| | | |
| | | // 将订单与详情联表封装到VO |
| | | List<OrderDetailVO> voList = result.getRecords().stream().map(order -> { |
| | | OrderDetailVO vo = new OrderDetailVO(); |
| | | BeanUtils.copyProperties(order, vo); |
| | | List<OrderDetail> details = orderDetailMapper.selectByOrderId(order.getOrderId()); |
| | | List<OrderDetailItemVO> items = details.stream().map(d -> { |
| | | OrderDetailItemVO item = new OrderDetailItemVO(); |
| | | BeanUtils.copyProperties(d, item); |
| | | return item; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | vo.setOrderDetails(items); |
| | | return vo; |
| | | }).collect(java.util.stream.Collectors.toList()); |
| | | |
| | | // 构建返回结果 |
| | | return new PageResult<OrderDetailVO>( |
| | | voList, |
| | | result.getTotal(), |
| | | queryDTO.getPageNum().longValue(), |
| | | queryDTO.getPageSize().longValue(), |
| | |
| | | throw new BusinessException("取消订单失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateWorkflowId(String orderId, String workflowId) { |
| | | if (!StringUtils.hasText(orderId)) { |
| | | throw new BusinessException("订单ID不能为空"); |
| | | } |
| | | if (!StringUtils.hasText(workflowId)) { |
| | | throw new BusinessException("工作流ID不能为空"); |
| | | } |
| | | |
| | | OrderInfo orderInfo = this.getById(orderId); |
| | | if (orderInfo == null) { |
| | | throw new BusinessException("订单不存在"); |
| | | } |
| | | |
| | | orderInfo.setWorkflowId(workflowId); |
| | | orderInfo.setUpdatedAt(LocalDateTime.now()); |
| | | return this.updateById(orderInfo); |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public PageResult<PointsFlow> getPersonalPointsFlowPage(PointsFlowQueryDTO queryDTO) { |
| | | if (queryDTO.getUserId() == null) { |
| | | if (!StringUtils.hasText(queryDTO.getUserId())) { |
| | | throw new BusinessException("用户ID不能为空"); |
| | | } |
| | | |
| | |
| | | throw new BusinessException("参数不能为空"); |
| | | } |
| | | |
| | | Long userId = addPointsFlowDTO.getUserId(); |
| | | Long unitId = addPointsFlowDTO.getUnitId(); |
| | | String userId = addPointsFlowDTO.getUserId(); |
| | | String providerId = addPointsFlowDTO.getProviderId(); |
| | | String unitId = addPointsFlowDTO.getUnitId(); |
| | | Integer ruleType = addPointsFlowDTO.getRuleType(); |
| | | String category = addPointsFlowDTO.getCategory(); |
| | | String ruleNameCode = addPointsFlowDTO.getRuleNameCode(); |
| | | Integer count = addPointsFlowDTO.getCount() != null ? addPointsFlowDTO.getCount() : 1; |
| | | |
| | | // 根据ruleType、ruleNameCode、category查询生效时间最新的积分规则 |
| | | PointsRule pointsRule = getLatestEffectiveRule(ruleType, ruleNameCode, category); |
| | | if (pointsRule == null) { |
| | | throw new BusinessException("积分规则不存在或未启用: ruleType=" + ruleType + ", ruleNameCode=" + ruleNameCode + ", category=" + category); |
| | | boolean applyUser = StringUtils.hasText(userId) ; |
| | | boolean applyProvider = StringUtils.hasText(providerId) ;; |
| | | if (!applyUser && !applyProvider) { |
| | | throw new BusinessException("userId 与 providerId 不能同时为空"); |
| | | } |
| | | |
| | | // 验证规则类型是否匹配 |
| | | if (!ruleType.equals(pointsRule.getRuleType())) { |
| | | throw new BusinessException("规则类型不匹配,期望: " + pointsRule.getRuleType() + ",实际: " + ruleType); |
| | | // 分别获取用户侧/提供者侧最新生效规则(按 points_winner 过滤:1用户、0提供者) |
| | | PointsRule userRule = null; |
| | | PointsRule providerRule = null; |
| | | if (applyUser) { |
| | | userRule = getLatestEffectiveRule(ruleType, ruleNameCode, category, 1); |
| | | if (userRule == null) { |
| | | throw new BusinessException("未找到用户侧生效规则: ruleType=" + ruleType + ", ruleNameCode=" + ruleNameCode + ", category=" + category + ", points_winner=1"); |
| | | } |
| | | if (!ruleType.equals(userRule.getRuleType())) { |
| | | throw new BusinessException("用户侧规则类型不匹配,期望: " + userRule.getRuleType() + ",实际: " + ruleType); |
| | | } |
| | | } |
| | | if (applyProvider) { |
| | | providerRule = getLatestEffectiveRule(ruleType, ruleNameCode, category, 0); |
| | | if (providerRule == null) { |
| | | throw new BusinessException("未找到提供者侧生效规则: ruleType=" + ruleType + ", ruleNameCode=" + ruleNameCode + ", category=" + category + ", points_winner=0"); |
| | | } |
| | | if (!ruleType.equals(providerRule.getRuleType())) { |
| | | throw new BusinessException("提供者侧规则类型不匹配,期望: " + providerRule.getRuleType() + ",实际: " + ruleType); |
| | | } |
| | | } |
| | | |
| | | // 计算积分值 |
| | | Integer basePoints = pointsRule.getPointsValue() != null ? pointsRule.getPointsValue() : 0; |
| | | Integer totalPoints = basePoints * count; |
| | | |
| | | // 如果是消费类型,积分为负数 |
| | | if (ruleType == RuleTypeEnum.CONSUME.getCode()) { // 1表示消费类型 |
| | | totalPoints = -totalPoints; |
| | | // 计算两侧积分变化(各自按规则计算) |
| | | int userPointsChange = 0; |
| | | int providerPointsChange = 0; |
| | | if (applyUser) { |
| | | int base = userRule.getPointsValue() != null ? userRule.getPointsValue() : 0; |
| | | int amount = base * count; |
| | | userPointsChange = (ruleType == RuleTypeEnum.CONSUME.getCode()) ? -Math.abs(amount) : Math.abs(amount); |
| | | } |
| | | if (applyProvider) { |
| | | int base = providerRule.getPointsValue() != null ? providerRule.getPointsValue() : 0; |
| | | int amount = base * count; |
| | | providerPointsChange = (ruleType == RuleTypeEnum.CONSUME.getCode()) ? -Math.abs(amount) : Math.abs(amount); |
| | | } |
| | | |
| | | // 检查每日积分上限 |
| | | if (pointsRule.getIsLimit() != null && pointsRule.getIsLimit() == 0) { // 0表示有每日上限 |
| | | checkDailyLimitByRule(userId, unitId, pointsRule, totalPoints); |
| | | // 每日上限校验(分别校验) |
| | | if (applyUser && userRule.getIsLimit() != null && userRule.getIsLimit() == 0) { |
| | | checkDailyLimitByRule(userId, unitId, userRule, userPointsChange); |
| | | } |
| | | if (applyProvider && providerRule.getIsLimit() != null && providerRule.getIsLimit() == 0) { |
| | | checkDailyLimitByRule(providerId, providerId, providerRule, providerPointsChange); |
| | | } |
| | | |
| | | // 如果是扣积分操作,先检查余额是否足够 |
| | | if (totalPoints < 0) { |
| | | checkBalanceSufficient(userId, unitId, Math.abs(totalPoints)); |
| | | // 余额校验(仅在扣减时) |
| | | if (applyUser && userPointsChange < 0) { |
| | | checkBalanceSufficient(userId, unitId, Math.abs(userPointsChange)); |
| | | } |
| | | if (applyProvider && providerPointsChange < 0) { |
| | | checkBalanceSufficient(providerId, providerId, Math.abs(providerPointsChange)); |
| | | } |
| | | |
| | | // 创建积分流水记录 |
| | | PointsFlow pointsFlow = new PointsFlow(); |
| | | pointsFlow.setUserId(userId); |
| | | pointsFlow.setUnitId(unitId); |
| | | pointsFlow.setDataType(ruleType); |
| | | pointsFlow.setDataCategory(addPointsFlowDTO.getCategory()); |
| | | pointsFlow.setPoints(totalPoints); |
| | | pointsFlow.setName(addPointsFlowDTO.getDescription() != null ? addPointsFlowDTO.getDescription() : pointsRule.getRuleDescription()); |
| | | pointsFlow.setFlowTime(LocalDateTime.now()); |
| | | pointsFlow.setRlueId(pointsRule.getId()); |
| | | // 生成用户侧流水并更新账户 |
| | | if (applyUser && userPointsChange != 0) { |
| | | PointsFlow pointsFlow = new PointsFlow(); |
| | | pointsFlow.setUserId(userId); |
| | | pointsFlow.setUnitId(unitId); |
| | | pointsFlow.setDataType(ruleType); |
| | | pointsFlow.setDataCategory(addPointsFlowDTO.getCategory()); |
| | | pointsFlow.setPoints(userPointsChange); |
| | | pointsFlow.setName(addPointsFlowDTO.getDescription() != null ? addPointsFlowDTO.getDescription() : userRule.getRuleDescription()); |
| | | pointsFlow.setFlowTime(LocalDateTime.now()); |
| | | pointsFlow.setRlueId(userRule.getId()); |
| | | |
| | | boolean saved = save(pointsFlow); |
| | | if (!saved) { |
| | | throw new BusinessException("保存积分流水失败"); |
| | | boolean saved = save(pointsFlow); |
| | | if (!saved) { |
| | | throw new BusinessException("保存积分流水失败"); |
| | | } |
| | | |
| | | updateUserPointsByRule(userId, unitId, userPointsChange); |
| | | } |
| | | |
| | | // 更新用户积分账户 |
| | | updateUserPointsByRule(userId, unitId, totalPoints); |
| | | // 生成提供者侧流水并更新账户 |
| | | if (applyProvider && providerPointsChange != 0) { |
| | | PointsFlow providerFlow = new PointsFlow(); |
| | | providerFlow.setUserId(providerId); |
| | | providerFlow.setUnitId(providerId); |
| | | providerFlow.setDataType(ruleType); |
| | | providerFlow.setDataCategory(addPointsFlowDTO.getCategory()); |
| | | providerFlow.setPoints(providerPointsChange); |
| | | providerFlow.setName(addPointsFlowDTO.getDescription() != null ? addPointsFlowDTO.getDescription() : providerRule.getRuleDescription()); |
| | | providerFlow.setFlowTime(LocalDateTime.now()); |
| | | providerFlow.setRlueId(providerRule.getId()); |
| | | |
| | | boolean providerSaved = save(providerFlow); |
| | | if (!providerSaved) { |
| | | throw new BusinessException("保存提供者积分流水失败"); |
| | | } |
| | | |
| | | updateProviderUnitPoints(providerId, providerPointsChange); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public UserPoints getUserPointsTotal(Long userId) { |
| | | if (userId == null) { |
| | | public UserPoints getUserPointsTotal(String userId) { |
| | | if (!StringUtils.hasText(userId)) { |
| | | throw new BusinessException("用户ID不能为null"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据ruleType、ruleNameCode、category、points_winner查询生效时间最新的积分规则 |
| | | */ |
| | | private PointsRule getLatestEffectiveRule(Integer ruleType, String ruleNameCode, String category, Integer pointsWinner) { |
| | | QueryWrapper<PointsRule> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("deleted", 0) |
| | | .eq("is_enabled", 0) |
| | | .eq("rule_type", ruleType) |
| | | .eq("rule_name_code", ruleNameCode) |
| | | .eq("data_category", category) |
| | | .eq(pointsWinner != null, "points_winner", pointsWinner) |
| | | .orderByDesc("created_at") |
| | | .last("LIMIT 1"); |
| | | return pointsRuleService.getOne(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 检查每日积分上限(基于规则) |
| | | */ |
| | | private void checkDailyLimitByRule(Long userId, Long unitId, PointsRule pointsRule, Integer currentPoints) { |
| | | private void checkDailyLimitByRule(String userId, String unitId, PointsRule pointsRule, Integer currentPoints) { |
| | | // 获取今日开始和结束时间 |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDateTime startOfDay = today.atStartOfDay(); |
| | |
| | | /** |
| | | * 检查积分余额是否足够 |
| | | */ |
| | | private void checkBalanceSufficient(Long userId, Long unitId, Integer requiredPoints) { |
| | | private void checkBalanceSufficient(String userId, String unitId, Integer requiredPoints) { |
| | | // 检查个人积分余额 |
| | | QueryWrapper<UserPoints> userWrapper = new QueryWrapper<>(); |
| | | userWrapper.eq("deleted", 0) |
| | |
| | | /** |
| | | * 更新用户积分 |
| | | */ |
| | | private void updateUserPoints(Long userId, Long unitId, Integer pointsValue) { |
| | | private void updateUserPoints(String userId, String unitId, Integer pointsValue) { |
| | | // 更新个人积分 |
| | | QueryWrapper<UserPoints> userWrapper = new QueryWrapper<>(); |
| | | userWrapper.eq("deleted", 0) |
| | |
| | | /** |
| | | * 根据规则更新用户积分账户 |
| | | */ |
| | | private void updateUserPointsByRule(Long userId, Long unitId, Integer pointsValue) { |
| | | private void updateUserPointsByRule(String userId, String unitId, Integer pointsValue) { |
| | | // 更新个人积分账户 |
| | | QueryWrapper<UserPoints> userWrapper = new QueryWrapper<>(); |
| | | userWrapper.eq("deleted", 0) |
| | |
| | | userPointsMapper.updateById(unitPoints); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 仅更新提供者(单位)积分账户 |
| | | */ |
| | | private void updateProviderUnitPoints(String providerUnitId, Integer pointsValue) { |
| | | QueryWrapper<UserPoints> unitWrapper = new QueryWrapper<>(); |
| | | unitWrapper.eq("deleted", 0) |
| | | .eq("unit_id", providerUnitId); |
| | | |
| | | UserPoints unitPoints = userPointsMapper.selectOne(unitWrapper); |
| | | if (unitPoints == null) { |
| | | if (pointsValue < 0) { |
| | | throw new BusinessException("提供者积分余额不足,无法扣除积分"); |
| | | } |
| | | |
| | | unitPoints = new UserPoints(); |
| | | unitPoints.setUserId(null); |
| | | unitPoints.setUnitId(providerUnitId); |
| | | unitPoints.setBalance(pointsValue); |
| | | unitPoints.setTotalEarned(pointsValue > 0 ? pointsValue : 0); |
| | | unitPoints.setTotalConsumed(pointsValue < 0 ? Math.abs(pointsValue) : 0); |
| | | userPointsMapper.insert(unitPoints); |
| | | } else { |
| | | if (pointsValue < 0 && unitPoints.getBalance() + pointsValue < 0) { |
| | | throw new BusinessException("提供者积分余额不足,当前余额: " + unitPoints.getBalance() + ",需要扣除: " + Math.abs(pointsValue)); |
| | | } |
| | | |
| | | unitPoints.setBalance(unitPoints.getBalance() + pointsValue); |
| | | |
| | | if (pointsValue > 0) { |
| | | unitPoints.setTotalEarned(unitPoints.getTotalEarned() != null ? |
| | | unitPoints.getTotalEarned() + pointsValue : pointsValue); |
| | | } |
| | | if (pointsValue < 0) { |
| | | unitPoints.setTotalConsumed(unitPoints.getTotalConsumed() != null ? |
| | | unitPoints.getTotalConsumed() + Math.abs(pointsValue) : Math.abs(pointsValue)); |
| | | } |
| | | |
| | | unitPoints.setUpdateTime(LocalDateTime.now()); |
| | | userPointsMapper.updateById(unitPoints); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductPricing> getPricingByProductId(Long productId) { |
| | | public List<ProductPricing> getPricingByProductId(String productId) { |
| | | try { |
| | | if (productId == null) { |
| | | throw new BusinessException("产品ID不能为空"); |
| | | } |
| | | return baseMapper.selectByProductId(productId); |
| | | } catch (Exception e) { |
| | | log.error("根据产品ID查询定价失败: ", e); |
| | |
| | | public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoints> implements UserPointsService { |
| | | |
| | | @Override |
| | | public PointsStatsVO getPersonalPointsStats(Long userId) { |
| | | public PointsStatsVO getPersonalPointsStats(String userId) { |
| | | UserPoints userPoints = this.baseMapper.selectByUserId(userId); |
| | | |
| | | PointsStatsVO statsVO = new PointsStatsVO(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PointsStatsVO getUnitPointsStats(Long unitId) { |
| | | public PointsStatsVO getUnitPointsStats(String unitId) { |
| | | UserPoints userPoints = this.baseMapper.selectByUnitId(unitId); |
| | | |
| | | PointsStatsVO statsVO = new PointsStatsVO(); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateUserPoints(Long userId, Long unitId, Integer points) { |
| | | public void updateUserPoints(String userId, String unitId, Integer points) { |
| | | // 查询用户积分记录 |
| | | LambdaQueryWrapper<UserPoints> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(UserPoints::getUserId, userId); |
| | |
| | | private Long pricingId; |
| | | |
| | | @ApiModelProperty("商品ID") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String productName; |
| | |
| | | public class CartVO { |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("购物车商品项列表") |
| | | private List<CartItemVO> items; |
| | |
| | | private Long pricingId; |
| | | |
| | | @ApiModelProperty("产品ID") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("产品套件名称") |
| | | private String suiteName; |
| | |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty("产品提供者ID") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("产品提供者名称") |
| | | private String providerName; |
| | |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty("产品ID") |
| | | private Long productId; |
| | | private String productId; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private Long userId; |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("单位ID") |
| | | private Long unitId; |
| | | private String unitId; |
| | | |
| | | @ApiModelProperty("产品名称") |
| | | private String productName; |
| | |
| | | private String providerName; |
| | | |
| | | @ApiModelProperty("提供者ID") |
| | | private Long providerId; |
| | | private String providerId; |
| | | |
| | | @ApiModelProperty("申请时间") |
| | | private LocalDateTime applyTime; |
| | |
| | | |
| | | <select id="selectApprovalRecordPage" resultMap="BaseResultMap"> |
| | | SELECT ar.<include refid="Base_Column_List"/> |
| | | FROM approval_record ar |
| | | LEFT JOIN order_info oi ON ar.order_id = oi.order_id |
| | | FROM tb_approval_record ar |
| | | LEFT JOIN tb_order_info oi ON ar.order_id = oi.order_id |
| | | WHERE ar.deleted = 0 |
| | | <if test="orderId != null and orderId != ''"> |
| | | AND ar.order_id = #{orderId} |
| | |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List"/> |
| | | FROM approval_record |
| | | FROM tb_approval_record |
| | | WHERE deleted = 0 AND order_id = #{orderId} |
| | | ORDER BY created_at ASC |
| | | </select> |
| | | |
| | | <select id="selectPendingApprovalPage" resultMap="BaseResultMap"> |
| | | SELECT ar.<include refid="Base_Column_List"/> |
| | | FROM approval_record ar |
| | | LEFT JOIN order_info oi ON ar.order_id = oi.order_id |
| | | FROM tb_approval_record ar |
| | | LEFT JOIN tb_order_info oi ON ar.order_id = oi.order_id |
| | | WHERE ar.deleted = 0 AND ar.approval_result IS NULL |
| | | <if test="orderId != null and orderId != ''"> |
| | | AND ar.order_id = #{orderId} |
| | |
| | | |
| | | <resultMap id="BaseResultMap" type="com.webmanage.entity.Cart"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="user_id" property="userId" jdbcType="BIGINT"/> |
| | | <result column="unit_id" property="unitId" jdbcType="BIGINT"/> |
| | | <result column="user_id" property="userId" jdbcType="VARCHAR"/> |
| | | <result column="unit_id" property="unitId" jdbcType="VARCHAR"/> |
| | | <result column="pricing_id" property="pricingId" jdbcType="BIGINT"/> |
| | | <result column="product_id" property="productId" jdbcType="BIGINT"/> |
| | | <result column="product_id" property="productId" jdbcType="VARCHAR"/> |
| | | <result column="product_name" property="productName" jdbcType="VARCHAR"/> |
| | | <result column="suite_name" property="suiteName" jdbcType="VARCHAR"/> |
| | | <result column="sales_form" property="salesForm" jdbcType="VARCHAR"/> |
| | |
| | | |
| | | <select id="selectByUserIdAndUnitId" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List"/> |
| | | FROM cart |
| | | FROM tb_cart |
| | | WHERE deleted = 0 |
| | | AND user_id = #{userId} |
| | | AND unit_id = #{unitId} |
| | | AND user_id = #{userId} |
| | | <if test="unitId !=null and unitId != ''"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | ORDER BY add_time DESC |
| | | </select> |
| | | |
| | | <select id="selectByUserIdUnitIdAndPricingId" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List"/> |
| | | FROM cart |
| | | WHERE deleted = 0 |
| | | AND user_id = #{userId} |
| | | AND unit_id = #{unitId} |
| | | FROM tb_cart |
| | | WHERE deleted = 0 |
| | | AND user_id = #{userId} |
| | | <if test="unitId != '' and unitId != null"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | AND pricing_id = #{pricingId} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="countByUserIdAndUnitId" resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) |
| | | FROM cart |
| | | FROM tb_cart |
| | | WHERE deleted = 0 |
| | | AND user_id = #{userId} |
| | | AND unit_id = #{unitId} |
| | | AND user_id = #{userId} |
| | | <if test="unitId != '' and unitId != null"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="sumTotalAmountByUserIdAndUnitId" resultType="java.math.BigDecimal"> |
| | | SELECT COALESCE(SUM(total_price), 0) |
| | | FROM cart |
| | | FROM tb_cart |
| | | WHERE deleted = 0 |
| | | AND user_id = #{userId} |
| | | AND unit_id = #{unitId} |
| | | AND user_id = #{userId} |
| | | <if test="unitId != '' and unitId != null"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | </select> |
| | | <delete id="deleteByCustomerCondition"> |
| | | delete from cart where id = #{id} |
| | | delete from tb_cart where id = #{id} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_attachment |
| | | FROM tb_order_attachment |
| | | WHERE deleted = 0 AND order_id = #{orderId} |
| | | ORDER BY created_at ASC |
| | | </select> |
| | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_detail |
| | | FROM tb_order_detail |
| | | WHERE deleted = 0 AND order_id = #{orderId} |
| | | ORDER BY created_at ASC |
| | | </select> |
| | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_evaluation |
| | | FROM tb_order_evaluation |
| | | WHERE deleted = 0 AND order_id = #{orderId} |
| | | LIMIT 1 |
| | | </select> |
| | |
| | | <select id="selectBuyerOrderPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_info |
| | | FROM tb_order_info |
| | | WHERE deleted = 0 |
| | | <if test="userId != null"> |
| | | AND user_id = #{userId} |
| | | </if> |
| | | <if test="unitId != null"> |
| | | <if test="unitId != null and unitId != ''"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | <if test="orderStatus != null and orderStatus != ''"> |
| | |
| | | <select id="selectSellerOrderPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_info |
| | | FROM tb_order_info |
| | | WHERE deleted = 0 |
| | | <if test="providerId != null"> |
| | | <if test="providerId != null and providerId != ''"> |
| | | AND provider_id = #{providerId} |
| | | </if> |
| | | <if test="orderStatus != null and orderStatus != ''"> |
| | |
| | | <select id="selectPendingApprovalOrderPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM order_info |
| | | FROM tb_order_info |
| | | WHERE deleted = 0 |
| | | AND order_status IN ('待上传文件', '待授权', '待交易确认', '已完成', '已评价') |
| | | <if test="orderStatus != null and orderStatus != ''"> |
| | |
| | | </choose> |
| | | </select> |
| | | |
| | | <!-- 分页查询买家订单列表(支持产品条件) --> |
| | | <select id="selectBuyerOrderPageWithProductConditions" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM tb_order_info |
| | | WHERE deleted = 0 |
| | | <if test="userId != null"> |
| | | AND user_id = #{userId} |
| | | </if> |
| | | <if test="unitId != null and unitId != ''"> |
| | | AND unit_id = #{unitId} |
| | | </if> |
| | | <if test="orderStatus != null and orderStatus != ''"> |
| | | AND order_status = #{orderStatus} |
| | | </if> |
| | | <if test="paymentStatus != null and paymentStatus != ''"> |
| | | AND payment_status = #{paymentStatus} |
| | | </if> |
| | | <if test="paymentType != null and paymentType != ''"> |
| | | AND payment_type = #{paymentType} |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND product_name LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | <if test="providerName != null and providerName != ''"> |
| | | AND provider_name LIKE CONCAT('%', #{providerName}, '%') |
| | | </if> |
| | | <if test="orderId != null and orderId != ''"> |
| | | AND order_id LIKE CONCAT('%', #{orderId}, '%') |
| | | </if> |
| | | <if test="applyTimeStart != null and applyTimeStart != ''"> |
| | | AND apply_time >= #{applyTimeStart}::timestamp |
| | | </if> |
| | | <if test="applyTimeEnd != null and applyTimeEnd != ''"> |
| | | AND apply_time <= #{applyTimeEnd}::timestamp |
| | | </if> |
| | | <if test="createTimeStart != null and createTimeStart != ''"> |
| | | AND created_at >= #{createTimeStart}::timestamp |
| | | </if> |
| | | <if test="createTimeEnd != null and createTimeEnd != ''"> |
| | | AND created_at <= #{createTimeEnd}::timestamp |
| | | </if> |
| | | <if test="productIds != null and productIds.size() > 0"> |
| | | AND product_id IN |
| | | <foreach collection="productIds" item="productId" open="(" separator="," close=")"> |
| | | #{productId} |
| | | </foreach> |
| | | </if> |
| | | ORDER BY |
| | | <choose> |
| | | <when test="orderBy != null and orderBy != ''"> |
| | | ${orderBy} |
| | | </when> |
| | | <otherwise> |
| | | created_at |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="orderDirection != null and orderDirection == 'asc'"> |
| | | ASC |
| | | </when> |
| | | <otherwise> |
| | | DESC |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | |
| | | <!-- 分页查询卖家订单列表(支持产品条件) --> |
| | | <select id="selectSellerOrderPageWithProductConditions" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM tb_order_info |
| | | WHERE deleted = 0 |
| | | <if test="providerId != null and providerId != ''"> |
| | | AND provider_id = #{providerId} |
| | | </if> |
| | | <if test="orderStatus != null and orderStatus != ''"> |
| | | AND order_status = #{orderStatus} |
| | | </if> |
| | | <if test="paymentStatus != null and paymentStatus != ''"> |
| | | AND payment_status = #{paymentStatus} |
| | | </if> |
| | | <if test="productName != null and productName != ''"> |
| | | AND product_name LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | <if test="orderId != null and orderId != ''"> |
| | | AND order_id LIKE CONCAT('%', #{orderId}, '%') |
| | | </if> |
| | | <if test="applyTimeStart != null and applyTimeStart != ''"> |
| | | AND apply_time >= #{applyTimeStart}::timestamp |
| | | </if> |
| | | <if test="applyTimeEnd != null and applyTimeEnd != ''"> |
| | | AND apply_time <= #{applyTimeEnd}::timestamp |
| | | </if> |
| | | <if test="createTimeStart != null and createTimeStart != ''"> |
| | | AND created_at >= #{createTimeStart}::timestamp |
| | | </if> |
| | | <if test="createTimeEnd != null and createTimeEnd != ''"> |
| | | AND created_at <= #{createTimeEnd}::timestamp |
| | | </if> |
| | | <if test="productIds != null and productIds.size() > 0"> |
| | | AND product_id IN |
| | | <foreach collection="productIds" item="productId" open="(" separator="," close=")"> |
| | | #{productId} |
| | | </foreach> |
| | | </if> |
| | | ORDER BY |
| | | <choose> |
| | | <when test="orderBy != null and orderBy != ''"> |
| | | ${orderBy} |
| | | </when> |
| | | <otherwise> |
| | | created_at |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="orderDirection != null and orderDirection == 'asc'"> |
| | | ASC |
| | | </when> |
| | | <otherwise> |
| | | DESC |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 分页查询积分主表 --> |
| | | <select id="selectPointsMainPage" resultType="com.webmanage.entity.Points"> |
| | | SELECT * |
| | | FROM points |
| | | FROM tb_points |
| | | WHERE deleted = 0 |
| | | <if test="queryDTO.pointsName != null and queryDTO.pointsName != ''"> |
| | | AND points_name LIKE CONCAT('%', #{queryDTO.pointsName}, '%') |
New file |
| | |
| | | <?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.webmanage.mapper.ProductMapper"> |
| | | |
| | | <!-- 结果映射 --> |
| | | <resultMap id="BaseResultMap" type="com.webmanage.entity.Product"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="product_name" property="productName" jdbcType="VARCHAR"/> |
| | | <result column="product_code" property="productCode" jdbcType="VARCHAR"/> |
| | | <result column="product_type" property="productType" jdbcType="VARCHAR"/> |
| | | <result column="category" property="category" jdbcType="VARCHAR"/> |
| | | <result column="description" property="description" jdbcType="VARCHAR"/> |
| | | <result column="provider_id" property="providerId" jdbcType="BIGINT"/> |
| | | <result column="provider_name" property="providerName" jdbcType="VARCHAR"/> |
| | | <result column="provider_type" property="providerType" jdbcType="VARCHAR"/> |
| | | <result column="status" property="status" jdbcType="VARCHAR"/> |
| | | <result column="audit_status" property="auditStatus" jdbcType="VARCHAR"/> |
| | | <result column="tags" property="tags" jdbcType="VARCHAR"/> |
| | | <result column="cover_image" property="coverImage" jdbcType="VARCHAR"/> |
| | | <result column="demo_url" property="demoUrl" jdbcType="VARCHAR"/> |
| | | <result column="doc_url" property="docUrl" jdbcType="VARCHAR"/> |
| | | <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/> |
| | | <result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/> |
| | | <result column="created_by" property="createdBy" jdbcType="BIGINT"/> |
| | | <result column="updated_by" property="updatedBy" jdbcType="BIGINT"/> |
| | | <result column="deleted" property="deleted" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <!-- 基础字段 --> |
| | | <sql id="Base_Column_List"> |
| | | id, product_name, product_code, product_type, category, description, |
| | | provider_id, provider_name, provider_type, status, audit_status, |
| | | tags, cover_image, demo_url, doc_url, created_at, updated_at, |
| | | created_by, updated_by, deleted |
| | | </sql> |
| | | |
| | | <!-- 根据条件查询产品列表 --> |
| | | <select id="selectProductList" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM tb_product |
| | | WHERE deleted = 0 |
| | | <if test="productName != null and productName != ''"> |
| | | AND product_name LIKE CONCAT('%', #{productName}, '%') |
| | | </if> |
| | | <if test="productType != null and productType != ''"> |
| | | AND product_type = #{productType} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="providerId != null"> |
| | | AND provider_id = #{providerId} |
| | | </if> |
| | | ORDER BY created_at DESC |
| | | </select> |
| | | |
| | | <!-- 根据ID查询产品详情 --> |
| | | <select id="selectProductById" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM tb_product |
| | | WHERE id = #{id} AND deleted = 0 |
| | | </select> |
| | | |
| | | <!-- 更新产品状态 --> |
| | | <update id="updateProductStatus"> |
| | | UPDATE tb_product |
| | | SET status = #{status}, updated_at = CURRENT_TIMESTAMP |
| | | WHERE id = #{id} AND deleted = 0 |
| | | </update> |
| | | |
| | | <!-- 更新产品审核状态 --> |
| | | <update id="updateProductAuditStatus"> |
| | | UPDATE tb_product |
| | | SET audit_status = #{auditStatus}, updated_at = CURRENT_TIMESTAMP |
| | | WHERE id = #{id} AND deleted = 0 |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | <result column="points_price" property="pointsPrice" jdbcType="DECIMAL"/> |
| | | <result column="currency_price" property="currencyPrice" jdbcType="DECIMAL"/> |
| | | <result column="is_active" property="isActive" jdbcType="BOOLEAN"/> |
| | | <result column="product_id" property="productId" jdbcType="BIGINT"/> |
| | | <result column="product_id" property="productId" jdbcType="VARCHAR"/> |
| | | <result column="product_name" property="productName" jdbcType="VARCHAR"/> |
| | | <result column="provider_id" property="providerId" jdbcType="BIGINT"/> |
| | | <result column="provider_id" property="providerId" jdbcType="VARCHAR"/> |
| | | <result column="provider_name" property="providerName" jdbcType="VARCHAR"/> |
| | | <result column="description" property="description" jdbcType="VARCHAR"/> |
| | | <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/> |
| | |
| | | <select id="selectProductPricingPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM product_pricing |
| | | FROM tb_product_pricing |
| | | WHERE deleted = 0 |
| | | <if test="productId != null"> |
| | | AND product_id = #{productId} |
| | |
| | | <select id="selectByProductId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM product_pricing |
| | | FROM tb_product_pricing |
| | | WHERE deleted = 0 AND product_id = #{productId} |
| | | ORDER BY created_at DESC |
| | | </select> |
| | |
| | | <select id="selectByCondition" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM product_pricing |
| | | FROM tb_product_pricing |
| | | WHERE deleted = 0 |
| | | <if test="suiteName != null and suiteName != ''"> |
| | | AND suite_name LIKE CONCAT('%', #{suiteName}, '%') |
New file |
| | |
| | | <?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.webmanage.mapper.ReportResultSubmissionMapper"> |
| | | |
| | | <!-- 根据条件查询产品ID列表 --> |
| | | <select id="selectProductIdsByConditions" resultType="java.lang.String"> |
| | | SELECT id |
| | | FROM tb_report_result_submission |
| | | WHERE deleted = '0' |
| | | <if test="industryId != null and industryId != ''"> |
| | | AND industrial_chain_id = #{industryId} |
| | | </if> |
| | | <if test="unitProjectId != null and unitProjectId != ''"> |
| | | AND important_area_id = #{unitProjectId} |
| | | </if> |
| | | <if test="productTypeId != null and productTypeId != ''"> |
| | | AND type_id = #{productTypeId} |
| | | </if> |
| | | <if test="productSubTypeId != null and productSubTypeId != ''"> |
| | | AND type_child_id = #{productSubTypeId} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 根据用户ID查询积分信息 --> |
| | | <select id="selectByUserId" resultType="com.webmanage.entity.UserPoints"> |
| | | SELECT * |
| | | FROM user_points |
| | | FROM tb_user_points |
| | | WHERE user_id = #{userId} |
| | | AND deleted = 0 |
| | | LIMIT 1 |
| | |
| | | <!-- 根据单位ID查询积分信息 --> |
| | | <select id="selectByUnitId" resultType="com.webmanage.entity.UserPoints"> |
| | | SELECT * |
| | | FROM user_points |
| | | FROM tb_user_points |
| | | WHERE unit_id = #{unitId} |
| | | AND deleted = 0 |
| | | LIMIT 1 |