|
@@ -7,6 +7,9 @@ import com.iamberry.wechat.core.entity.cart.UserGiftDto;
|
|
|
import com.iamberry.wechat.core.entity.channel.ChannelPrice;
|
|
|
import com.iamberry.wechat.core.entity.drp.PlaceInfo;
|
|
|
import com.iamberry.wechat.core.entity.member.Member;
|
|
|
+import com.iamberry.wechat.core.entity.order.Order;
|
|
|
+import com.iamberry.wechat.core.entity.page.PageRequest;
|
|
|
+import com.iamberry.wechat.core.entity.page.PagedResult;
|
|
|
import com.iamberry.wechat.core.entity.product.*;
|
|
|
import com.iamberry.wechat.face.admin.SystemService;
|
|
|
import com.iamberry.wechat.face.cart.CartService;
|
|
@@ -25,6 +28,7 @@ import com.iamberry.wechat.tools.QrCodeUtil;
|
|
|
import com.iamberry.wechat.tools.ResultInfo;
|
|
|
import com.iamberry.wechat.tools.StaticInfo;
|
|
|
import com.iamberry.wechat.utils.Result;
|
|
|
+import com.iamberry.wechat.utils.StitchAttrUtil;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -631,7 +635,9 @@ public class ProductInfoHandler {
|
|
|
@RequestMapping("/listProductColorByTypeId")
|
|
|
public ResultMsg listProductColorByTypeId( @RequestParam(value= "typeId") Integer typeId,
|
|
|
@RequestParam(value= "pageSize",defaultValue= "6" ,required=false) Integer pageSize,
|
|
|
- @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO){
|
|
|
+ @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
|
|
|
+ @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum
|
|
|
+ ){
|
|
|
ResultMsg rm=new ResultMsg();
|
|
|
if(typeId!=null&&typeId<0){
|
|
|
rm.setStatus(false);
|
|
@@ -640,19 +646,46 @@ public class ProductInfoHandler {
|
|
|
return rm;
|
|
|
}
|
|
|
|
|
|
- ProductColor productColor=new ProductColor();
|
|
|
- productColor.setProductType(typeId);
|
|
|
- productColor.getPage().setPageSize(pageSize);
|
|
|
- productColor.getPage().setPageNumber(pageNO);
|
|
|
- productColor.getPage().initRecordBegin();
|
|
|
- List<ProductColor> list=productInfoService.listProductColorByTypeId(productColor);
|
|
|
- if(list!=null&&list.size()<0){
|
|
|
- rm.setStatus(false);
|
|
|
- rm.setResultCode(ResultInfo.ERRORCODE);
|
|
|
- return rm;
|
|
|
+ ProductType productType = new ProductType();
|
|
|
+ productType.setTypeId(typeId);
|
|
|
+
|
|
|
+ Product product = new Product();
|
|
|
+ product.setProductType(productType);
|
|
|
+ // 封装请求数据
|
|
|
+ PageRequest<Product> pageRequest = new PageRequest<>(product, pageNO, pageSize, totalNum == 0);
|
|
|
+ // 查询订单列表
|
|
|
+ PagedResult<Product> result = productInfoService.getProductPage(pageRequest);
|
|
|
+
|
|
|
+ for (Product pro:result.getDataList()) {
|
|
|
+ ProductColor productColor = new ProductColor();
|
|
|
+ productColor.setColorProductId(pro.getProductId());
|
|
|
+ List<ProductColor> productColorList = productInfoService.listProductColorByTypeId(productColor);
|
|
|
+
|
|
|
+ if(productColorList != null && productColorList.size() > 0){
|
|
|
+ pro.setColorId(productColorList.get(0).getColorId());
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer max=0,min=0;
|
|
|
+ for (ProductColor pc:productColorList) {
|
|
|
+ if(pc.getColorDiscount() > max){
|
|
|
+ max = pc.getColorDiscount();
|
|
|
+ }
|
|
|
+ if(min == 0 || pc.getColorDiscount() < min){
|
|
|
+ min = pc.getColorDiscount();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(max == min){
|
|
|
+ pro.setProductShowPrice(String.valueOf(max/100));
|
|
|
+ }else{
|
|
|
+ pro.setProductShowPrice(min/100 + "-" +max/100);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ Boolean lastPage = StitchAttrUtil.getSa().getLastPage(result);
|
|
|
+
|
|
|
Map<String,Object> map=new HashMap<String, Object>();
|
|
|
- map.put("productColorList",list);
|
|
|
+ map.put("list", result.getDataList());
|
|
|
+ map.put("lastPage",lastPage);
|
|
|
map.put("typeId",typeId);
|
|
|
rm.setStatus(true);
|
|
|
rm.setResultCode(ResultInfo.SUCCESSCODE);
|