|
|
@@ -12,8 +12,10 @@ import com.fs.his.service.IFsPackageOrderService;
|
|
|
import com.fs.his.strategy.RewardResult;
|
|
|
import com.fs.his.strategy.RewardStrategy;
|
|
|
import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
+import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
|
import com.fs.hisStore.param.FsStoreOrderCreateParamAppReward;
|
|
|
import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
|
+import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -30,6 +32,9 @@ public class FirstLoginProductStrategy implements RewardStrategy {
|
|
|
|
|
|
@Autowired
|
|
|
private IFsStoreOrderScrmService storeOrderScrmService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IFsStoreProductScrmService storeProductScrmService;
|
|
|
@Override
|
|
|
public RewardResult process(FsUserRewards reward) {
|
|
|
log.info("处理首次登录商品发放: rewardId={}", reward.getId());
|
|
|
@@ -105,19 +110,21 @@ public class FirstLoginProductStrategy implements RewardStrategy {
|
|
|
}
|
|
|
|
|
|
private FsStoreOrderCreateParamAppReward buildStoreOrderCreateParam(FsUserRewards reward, FsUser fsUser) {
|
|
|
+ FsStoreProductScrm fsStoreProductScrm = storeProductScrmService.selectFsStoreProductById(reward.getGoodsId());
|
|
|
+ if (fsStoreProductScrm == null){
|
|
|
+ log.error("商城商品不存在: {}", reward.getGoodsId());
|
|
|
+ throw new CustomException("商城商品不存在");
|
|
|
+ }
|
|
|
FsStoreOrderCreateParamAppReward param = new FsStoreOrderCreateParamAppReward();
|
|
|
+ param.setPayPrice(fsStoreProductScrm.getPrice());
|
|
|
+ param.setErpType(fsStoreProductScrm.getErpType());
|
|
|
+ param.setAppRewardFlag(1);//首次注册奖品订单标识
|
|
|
+ param.setPayType("1");//全款
|
|
|
param.setCompanyId(reward.getCompanyId());
|
|
|
param.setCompanyUserId(reward.getCompanyUserId());
|
|
|
param.setUserId(fsUser.getUserId());
|
|
|
param.setAddressId(reward.getAddressId());
|
|
|
param.setGoodsId(reward.getGoodsId());
|
|
|
- FsStoreOrderScrm fsStoreOrderScrm = storeOrderScrmService.selectFsStoreOrderById(param.getGoodsId());
|
|
|
- if (fsStoreOrderScrm == null){
|
|
|
- log.error("商城商品不存在: {}", param.getGoodsId());
|
|
|
- throw new CustomException("商城商品不存在");
|
|
|
- }
|
|
|
- param.setErpType(fsStoreOrderScrm.getErpType());
|
|
|
- param.setAppRewardFlag(1);//首次注册奖品订单标识
|
|
|
return param;
|
|
|
}
|
|
|
|