Ver Fonte

feat: 货道管理接口

pangqijun há 3 meses atrás
pai
commit
f402bc58d9

+ 1 - 1
src/main/java/org/springblade/common/enums/OrderTypeEnum.java

@@ -9,7 +9,7 @@ import org.springblade.core.log.exception.ServiceException;
 @Getter
 public enum OrderTypeEnum {
 	NORMAL("拼团订单", 1, "grouponOrderServiceImpl"),
-	GOODS("商品订单", 2, "grouponOrderServiceImpl");
+	GOODS("商品订单", 2, "orderGoodsServiceImpl");
 
 	private String name;
 	private Integer value;

+ 10 - 2
src/main/java/org/springblade/modules/api/controller/ApiFacilityCargoWayController.java

@@ -1,6 +1,7 @@
 package org.springblade.modules.api.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -44,6 +45,11 @@ public class ApiFacilityCargoWayController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "设置货道商品", notes = "传入facilityCargoWay")
     public R<Void> submit(@Valid @RequestBody FacilityCargoWay facilityCargoWay) {
+        FacilityCargoWay cargoWay = iFacilityCargoWayService.getById(facilityCargoWay.getId());
+        Assert.notNull(cargoWay, "未查询到货道信息");
+        if (facilityCargoWay.getGoodsStore() > cargoWay.getVolume()) {
+            return R.fail("商品数量不能大于货道容量");
+        }
         return R.status(iFacilityCargoWayService.saveOrUpdate(facilityCargoWay));
     }
 
@@ -59,8 +65,10 @@ public class ApiFacilityCargoWayController {
             Map<Long, GoodsInfo> map = goodsInfos.stream().collect(Collectors.toMap(BaseEntity::getId, Function.identity()));
             for (FacilityCargoWayVO vo : vos) {
                 GoodsInfo goodsInfo = map.get(vo.getGoodsId());
-                vo.setGoodsName(goodsInfo.getGoodsName());
-                vo.setGoodsCover(goodsInfo.getGoodsCover());
+                if (goodsInfo != null) {
+                    vo.setGoodsName(goodsInfo.getGoodsName());
+                    vo.setGoodsCover(goodsInfo.getGoodsCover());
+                }
             }
         }
         return R.data(vos);

+ 7 - 1
src/main/java/org/springblade/modules/api/controller/ApiGoodsController.java

@@ -22,6 +22,8 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.modules.api.request.GoodsListRequest;
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.service.IFacilityCargoWayService;
 import org.springblade.modules.business.service.IFacilityService;
 import org.springblade.modules.mall.entity.CategoryInfo;
 import org.springblade.modules.mall.entity.GoodsInfo;
@@ -50,6 +52,7 @@ public class ApiGoodsController extends BladeController {
     private final ICategoryInfoService categoryInfoService;
     private final IGoodsInfoService goodsInfoService;
     private final IFacilityService iFacilityService;
+    private final IFacilityCargoWayService iFacilityCargoWayService;
 
     @GetMapping("/category/list")
     @ApiOperationSupport(order = 1)
@@ -108,8 +111,11 @@ public class ApiGoodsController extends BladeController {
     @GetMapping("/goods/detail")
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "商品详情", notes = "传入goodsInfo")
-    public R<GoodsInfoVO> detail(GoodsInfo goodsInfo) {
+    public R<GoodsInfoVO> detail(GoodsInfoVO goodsInfo) {
         GoodsInfo detail = goodsInfoService.detail(goodsInfo.getId());
+        FacilityCargoWay cargoWay = iFacilityCargoWayService.getById(goodsInfo.getCargoWayId());
+        Assert.notNull(cargoWay, "未查询到货道信息");
+        detail.setSalePrice(cargoWay.getSalePrice());
         return R.data(GoodsInfoWrapper.build().entityVO(detail));
     }
 

+ 12 - 0
src/main/java/org/springblade/modules/api/controller/ApiMerchantUserController.java

@@ -58,6 +58,18 @@ public class ApiMerchantUserController {
         return R.data(vo);
     }
 
+    @PostMapping("/merchant/update")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "更新用户信息")
+    public R<Void> updateUserInfo(@RequestBody UserMerchantVO userMerchantVO) {
+        User user = iUserService.getById(AuthUtil.getUserId());
+        Assert.notNull(user, "未查询到用户信息");
+//        UserMerchantVO vo = iUserMerchantService.getByUserId(AuthUtil.getUserId());
+//        Assert.notNull(user, "未查询到商户信息");
+        user.setAvatar(userMerchantVO.getAvatar());
+        return R.status(iUserService.updateById(user));
+    }
+
     @PostMapping("/addChildAccount")
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "添加子账号", notes = "传入userMerchant")

+ 6 - 6
src/main/java/org/springblade/modules/business/entity/FacilityCargoWay.java

@@ -51,32 +51,32 @@ public class FacilityCargoWay extends BaseEntity {
     /**
      * 商品id
      */
-    @ApiModelProperty(name = "商品id")
+    @ApiModelProperty(value = "商品id")
     private Long goodsId;
     /**
      * 售价
      */
-    @ApiModelProperty(name = "售价")
+    @ApiModelProperty(value = "售价")
     private BigDecimal salePrice;
     /**
      * 折扣
      */
-    @ApiModelProperty(name = "折扣")
+    @ApiModelProperty(value = "折扣")
     private Double discount;
     /**
      * 商品库存
      */
-    @ApiModelProperty(name = "商品库存")
+    @ApiModelProperty(value = "商品库存")
     private Integer goodsStore;
     /**
      * 货道总交易数量
      */
-    @ApiModelProperty(name = "货道总交易数量")
+    @ApiModelProperty(value = "货道总交易数量")
     private Integer totalTrade;
     /**
      * 货道总交易金额
      */
-    @ApiModelProperty(name = "货道总交易金额")
+    @ApiModelProperty(value = "货道总交易金额")
     private BigDecimal totalAmount;
 
     public Double getDiscount() {

+ 2 - 1
src/main/java/org/springblade/modules/business/mapper/FacilityMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.business.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.modules.business.entity.Facility;
 import org.springblade.modules.business.vo.FacilityVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -42,5 +43,5 @@ public interface FacilityMapper extends BaseMapper<Facility> {
 	 */
 	List<FacilityVO> selectFacilityPage(IPage page, FacilityVO facility);
 
-    List<GoodsInfoVO> selectGoods(Long deviceId);
+    List<GoodsInfoVO> selectGoods(@Param("deviceId") Long deviceId, @Param("cargoWayId") Long cargoWayId);
 }

+ 5 - 1
src/main/java/org/springblade/modules/business/mapper/FacilityMapper.xml

@@ -33,11 +33,15 @@
             fcw.goods_store totalStock,
             fcw.discount,
             fcw.sale_price,
-            fcw.id cargoWayId
+            fcw.id cargoWayId,
+            fcw.cargo_no cargoWayNo
         FROM
             t_facility_cargo_way fcw
                 JOIN t_goods_info gi ON fcw.goods_id = gi.id
         where fcw.facility_id = #{deviceId}
+        <if test="cargoWayId != null">
+            and fcw.id = #{cargoWayId}
+        </if>
     </select>
 
 </mapper>

+ 1 - 1
src/main/java/org/springblade/modules/business/service/impl/FacilityServiceImpl.java

@@ -55,7 +55,7 @@ public class FacilityServiceImpl extends ServiceImpl<FacilityMapper, Facility> i
 
 	@Override
 	public List<GoodsInfoVO> getGoods(Long deviceId) {
-		return baseMapper.selectGoods(deviceId);
+		return baseMapper.selectGoods(deviceId, null);
 	}
 
 	@Transactional

+ 1 - 1
src/main/java/org/springblade/modules/finance/service/impl/OrderGoodsServiceImpl.java

@@ -31,7 +31,7 @@ import java.math.BigDecimal;
  * @since 2024-07-17
  */
 @AllArgsConstructor
-@Service
+@Service("orderGoodsServiceImpl")
 public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGoods> implements IOrderGoodsService, SubmitOrderService {
 
 	private final IOrderService iOrderService;

+ 2 - 0
src/main/java/org/springblade/modules/mall/vo/GoodsInfoVO.java

@@ -53,6 +53,8 @@ public class GoodsInfoVO extends GoodsInfo {
 
 	@ApiModelProperty(value = "货道id")
 	private Long cargoWayId;
+	@ApiModelProperty(value = "货道编号")
+	private String cargoWayNo;
 
 	public String getAuditStatusDesc() {
 		return AuditStatusEnum.getNameByValue(this.getAuditStatus());

+ 2 - 2
src/main/java/org/springblade/modules/system/entity/UserMerchant.java

@@ -53,12 +53,12 @@ public class UserMerchant implements Serializable {
 	/**
 	 * 银行卡号
 	 */
-	@ApiModelProperty(name = "银行卡号")
+	@ApiModelProperty(value = "银行卡号")
 	private String bankCardNumber;
 	/**
 	 * 开户行
 	 */
-	@ApiModelProperty(name = "开户行")
+	@ApiModelProperty(value = "开户行")
 	private String openingBank;
 	/**
 	* 地址