|
@@ -8,8 +8,11 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
|
|
+import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
import com.cyksj.mapper.OrderDonMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
|
|
|
+import com.cyksj.mapper.manage.distribute.DistributeGeneralSkuRateMapper;
|
|
|
|
|
+import com.cyksj.mapper.manage.distribute.UserPlatSkuDistributeRateMapper;
|
|
|
import com.cyksj.model.dto.UserWhoami;
|
|
import com.cyksj.model.dto.UserWhoami;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
@@ -36,6 +39,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -73,6 +77,12 @@ public class UserController {
|
|
|
|
|
|
|
|
private final CorpInteractiveReaderFrontService corpInteractiveReaderFrontService;
|
|
private final CorpInteractiveReaderFrontService corpInteractiveReaderFrontService;
|
|
|
|
|
|
|
|
|
|
+ private final UserPlatSkuDistributeRateMapper userPlatSkuDistributeRateMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final DistributeGeneralSkuRateMapper distributeGeneralSkuRateMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final GoodsDonSkuMapper skuMapper;
|
|
|
|
|
+
|
|
|
@GetMapping(value = "/wx/whoami")
|
|
@GetMapping(value = "/wx/whoami")
|
|
|
public Result<UserWhoami> whoami() {
|
|
public Result<UserWhoami> whoami() {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
@@ -426,4 +436,46 @@ public class UserController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 推广平台海报列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/ds/poster/goods")
|
|
|
|
|
+ public Result<List<DistributePosterGoodsFrontView>> getPosterGoods() {
|
|
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<DistributePosterGoodsFrontView> searchAll = beanSearcher.searchAll(DistributePosterGoodsFrontView.class, MapUtils
|
|
|
|
|
+ .flatBuilder(request.getParameterMap())
|
|
|
|
|
+ .put("uid", String.format(" and ud.user_id = %s", userId))
|
|
|
|
|
+ .build());
|
|
|
|
|
+ searchAll.forEach(e -> {
|
|
|
|
|
+ if (e.getIsSkuRate()) {
|
|
|
|
|
+ BigDecimal price = e.getPrice();
|
|
|
|
|
+ GoodsDonSku sku = skuMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
|
|
+ .eq(GoodsDonSku::getGoodsId, e.getGoodsId())
|
|
|
|
|
+ .eq(GoodsDonSku::getPrice, price)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (sku != null) {
|
|
|
|
|
+ if (e.getDistributeId() != null) {
|
|
|
|
|
+ UserPlatSkuDistributeRate userPlatSkuDistributeRate = userPlatSkuDistributeRateMapper.selectOne(Wrappers.lambdaQuery(UserPlatSkuDistributeRate.class)
|
|
|
|
|
+ .eq(UserPlatSkuDistributeRate::getDistributeId, e.getDistributeId())
|
|
|
|
|
+ .eq(UserPlatSkuDistributeRate::getGoodsId, e.getGoodsId())
|
|
|
|
|
+ .eq(UserPlatSkuDistributeRate::getSkuId, sku.getId())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (userPlatSkuDistributeRate != null) {
|
|
|
|
|
+ e.setRate(userPlatSkuDistributeRate.getRate());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ DistributeGeneralSkuRate distributeGeneralSkuRate = distributeGeneralSkuRateMapper.selectOne(Wrappers.lambdaQuery(DistributeGeneralSkuRate.class)
|
|
|
|
|
+ .eq(DistributeGeneralSkuRate::getGoodsId, e.getGoodsId())
|
|
|
|
|
+ .eq(DistributeGeneralSkuRate::getSkuId, sku.getId())
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (distributeGeneralSkuRate != null) {
|
|
|
|
|
+ e.setRate(distributeGeneralSkuRate.getRate());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(searchAll);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|