Bläddra i källkod

益寿缘app-修复App奖品创建商城订单无法推送的问题

cgp 6 dagar sedan
förälder
incheckning
f3a4673d9b

+ 1 - 1
fs-service/src/main/java/com/fs/his/domain/FsUserRewards.java

@@ -105,7 +105,7 @@ public class FsUserRewards {
     private Long companyId;
 
     /**
-     * 销售id 当前分支是益寿缘分支不做区分默认为1
+     * 销售id 当前分支是益寿缘分支不做区分
      * */
     @TableField(exist = false)
     private Long companyUserId;

+ 1 - 1
fs-service/src/main/java/com/fs/his/strategy/impl/FirstLoginProductStrategy.java

@@ -116,7 +116,7 @@ public class FirstLoginProductStrategy implements RewardStrategy {
             throw new CustomException("商城商品不存在");
         }
         FsStoreOrderCreateParamAppReward param = new FsStoreOrderCreateParamAppReward();
-        param.setPayPrice(fsStoreProductScrm.getPrice());
+        param.setCostPrice(fsStoreProductScrm.getCostPrice());
         param.setErpType(fsStoreProductScrm.getErpType());
         param.setAppRewardFlag(1);//首次注册奖品订单标识
         param.setPayType("1");//全款

+ 1 - 1
fs-service/src/main/java/com/fs/his/strategy/impl/WatchCourseProductStrategy.java

@@ -115,7 +115,7 @@ public class WatchCourseProductStrategy  implements RewardStrategy {
             throw new CustomException("商城商品不存在");
         }
         FsStoreOrderCreateParamAppReward param = new FsStoreOrderCreateParamAppReward();
-        param.setPayPrice(fsStoreProductScrm.getPrice());
+        param.setCostPrice(fsStoreProductScrm.getCostPrice());
         param.setErpType(fsStoreProductScrm.getErpType());
         param.setAppRewardFlag(2);//2:看课奖品订单
         param.setPayType("1");//全款

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductAttrValueScrmMapper.java

@@ -151,5 +151,5 @@ public interface FsStoreProductAttrValueScrmMapper
     /**
      * 根据商品ID查询商品属性SKU值ID
      * */
-    Long selectProductAttrValueIdByProductId(Long goodsId);
+    FsStoreProductAttrValueScrm selectProductAttrValueByProductId(Long goodsId);
 }

+ 11 - 10
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -1023,8 +1023,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     public R createOrderScrmForAppRewards(long userId, FsStoreOrderCreateParamAppReward param) {
         FsStoreOrderComputedParam computedParam = new FsStoreOrderComputedParam();
         BeanUtils.copyProperties(param, computedParam);
-        //计算金额
-        //FsStoreOrderComputeDTO dto = this.computedOrder(userId, computedParam);
+        FsStoreProductAttrValueScrm fsStoreProductAttrValueScrm = fsStoreProductAttrValueMapper.selectProductAttrValueByProductId(param.getGoodsId());
+        if (fsStoreProductAttrValueScrm == null){
+            log.error("订单创建失败,SKU属性不存在,商品id:{}",param.getGoodsId());
+            return R.error("订单创建失败");
+        }
         //获取地址
         FsUserAddressScrm address = userAddressMapper.selectFsUserAddressById(param.getAddressId());
         //生成分布式唯一值
@@ -1045,7 +1048,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
 
         storeOrder.setPayPostage(BigDecimal.ZERO);
         storeOrder.setDeductionPrice(BigDecimal.ZERO);
-        storeOrder.setPaid(0);
+        storeOrder.setPaid(1);//已支付
         storeOrder.setPayType(param.getPayType());
         storeOrder.setUseIntegral(BigDecimal.ZERO);
         storeOrder.setBackIntegral(BigDecimal.ZERO);
@@ -1064,7 +1067,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         }
 
         //实际支付金额
-         storeOrder.setPayPrice(param.getPayPrice());
+         storeOrder.setPayPrice(fsStoreProductAttrValueScrm.getPrice());
 
         storeOrder.setStatus(1); //待发货
         storeOrder.setOrderCreateType(param.getOrderCreateType());
@@ -1072,7 +1075,6 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         if (storeOrder.getCustomerId() == null) {
             storeOrder.setCustomerId(param.getCustomerId());
         }
-
         storeOrder.setOrderType(param.getOrderType());
         storeOrder.setOrderMedium(param.getOrderMedium());
         if (param.getAppRewardFlag()!=null){
@@ -1094,13 +1096,12 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
 
         FsStoreCartQueryVO vo = new FsStoreCartQueryVO();
         vo.setProductId(param.getGoodsId());
-        vo.setCartNum(1);//数量
+        vo.setCartNum(1);//数量1
+        vo.setPrice(fsStoreProductAttrValueScrm.getPrice());
+        vo.setBarCode(fsStoreProductAttrValueScrm.getBarCode());
         //扣减库存
         fsStoreProductMapper.decProductAttrStock(param.getGoodsId(),1);
-        Long productAttrValueId=fsStoreProductAttrValueMapper.selectProductAttrValueIdByProductId(param.getGoodsId());
-        if (productAttrValueId!=null){
-            fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId,1);
-        }
+        fsStoreProductAttrValueMapper.decProductAttrStock(fsStoreProductAttrValueScrm.getId(),1);
         //保存OrderItem
         List<FsStoreOrderItemScrm> listOrderItem = new ArrayList<>();
         //保存购物车商品信息

+ 2 - 2
fs-service/src/main/resources/mapper/hisStore/FsStoreProductAttrValueScrmMapper.xml

@@ -58,8 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getFsStoreProductAttrValueListInProductId" resultType="com.fs.hisStore.domain.FsStoreProductAttrValueScrm">
         select *,cost_price AS cost from fs_store_product_attr_value_scrm where product_id IN <foreach collection="productIds" index="index" item="item" open="(" separator="," close=")">#{item}</foreach>
     </select>
-    <select id="selectProductAttrValueIdByProductId" resultType="java.lang.Long">
-        select id from fs_store_product_attr_value_scrm where product_id = #{productId}
+    <select id="selectProductAttrValueByProductId" resultMap="FsStoreProductAttrValueResult">
+        select * from fs_store_product_attr_value_scrm where product_id = #{productId}
     </select>
 
     <insert id="insertFsStoreProductAttrValue" parameterType="FsStoreProductAttrValueScrm" useGeneratedKeys="true" keyProperty="id">