|
@@ -1,14 +1,15 @@
|
|
|
package org.jeecg.modules.app.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import org.jeecg.modules.app.service.IDetailService;
|
|
|
import org.jeecg.modules.app.vo.PlaceInfoVO;
|
|
|
+import org.jeecg.modules.system.app.entity.AppOrderProduct;
|
|
|
import org.jeecg.modules.system.app.entity.AppSite;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppCoursesMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppCoursesPriceRulesMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppOrderProductMapper;
|
|
|
-import org.jeecg.modules.system.app.mapper.AppSiteMapper;
|
|
|
+import org.jeecg.modules.system.app.entity.AppSitePriceRules;
|
|
|
+import org.jeecg.modules.system.app.mapper.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
|
|
|
public class DetailServiceImpl implements IDetailService {
|
|
|
@Resource
|
|
@@ -19,14 +20,22 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
private AppCoursesPriceRulesMapper appCoursesPriceRulesMapper;
|
|
|
@Resource
|
|
|
private AppOrderProductMapper appOrderProductMapper;
|
|
|
+ @Resource
|
|
|
+ private AppSitePriceRulesMapper appSitePriceRulesMapper;
|
|
|
|
|
|
@Override
|
|
|
public PlaceInfoVO getPlaceInfo(String id) {
|
|
|
AppSite appSite = appSiteMapper.selectById(id);
|
|
|
PlaceInfoVO placeInfo = appSiteMapper.getPlaceInfo(id);
|
|
|
+ AppSitePriceRules appSitePriceRules = appSitePriceRulesMapper.selectOne(Wrappers.<AppSitePriceRules>lambdaQuery()
|
|
|
+ .eq(AppSitePriceRules::getSiteId, id)
|
|
|
+ .eq(AppSitePriceRules::getStatus, 0)
|
|
|
+ .last("limit 1"));
|
|
|
PlaceInfoVO.PlaceInfoMsgVO placeInfoMsgVO = new PlaceInfoVO.PlaceInfoMsgVO();
|
|
|
-// placeInfoMsgVO.setName(appSite.getName())
|
|
|
-// .setSales(appSite.getSales())
|
|
|
+ placeInfoMsgVO.setName(appSite.getName())
|
|
|
+ .setSales(getPlaceSales(id))
|
|
|
+ .setOriginalPrice(appSitePriceRules.getOriginalPrice())
|
|
|
+ .setSellingPrice(appSitePriceRules.getSellingPrice());
|
|
|
return placeInfo;
|
|
|
}
|
|
|
|
|
@@ -38,20 +47,14 @@ public class DetailServiceImpl implements IDetailService {
|
|
|
* @Param
|
|
|
**/
|
|
|
public int getPlaceSales(String id) {
|
|
|
-// List<String> ids = appCoursesPriceRulesMapper.selectObjs(
|
|
|
-// Wrappers.<AppCoursesPriceRules>lambdaQuery()
|
|
|
-// .eq(AppCoursesPriceRules::getCoursesId, id)
|
|
|
-// .select(AppCoursesPriceRules::getId)
|
|
|
-// ).stream()
|
|
|
-// .map(obj -> (String) obj)
|
|
|
-// .collect(Collectors.toList());
|
|
|
-// if (!ids.isEmpty()) {
|
|
|
-// int totalOrders = appOrderProductMapper.selectCount(
|
|
|
-// Wrappers.<AppOrderProduct>lambdaQuery()
|
|
|
-// .in(AppOrderProduct::getProductId, ids)
|
|
|
-// );
|
|
|
-// }
|
|
|
-//
|
|
|
- return 0;
|
|
|
+ List<String> ids = appCoursesPriceRulesMapper.selectRuleIdsByCourseId(id);
|
|
|
+ int totalOrders = 0;
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
+ totalOrders = Math.toIntExact(appOrderProductMapper.selectCount(
|
|
|
+ Wrappers.<AppOrderProduct>lambdaQuery()
|
|
|
+ .in(AppOrderProduct::getProductId, ids)
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ return totalOrders;
|
|
|
}
|
|
|
}
|