提交 3e3009d9 作者: xiaowang

新增:规格价格

上级 281270af
...@@ -7,6 +7,7 @@ import com.mmc.pms.model.categories.dto.CategoryTypeDTO; ...@@ -7,6 +7,7 @@ import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO; import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO; import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO; import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.service.WebDeviceService; import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -45,18 +46,14 @@ public class ProductMallController extends BaseController { ...@@ -45,18 +46,14 @@ public class ProductMallController extends BaseController {
public ResultBody<MallGoodsDetailDTO> getLeaseGoodsDetail( public ResultBody<MallGoodsDetailDTO> getLeaseGoodsDetail(
Integer goodsId, Integer goodsId,
HttpServletRequest request, HttpServletRequest request,
@ApiParam(value = "租赁:1 销售商品:0") @RequestParam(value = "type") Integer type, @ApiParam(value = "租赁:1 销售商品:0") @RequestParam(value = "type") Integer type) {
@ApiParam(value = "租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
@RequestParam(value = "leaseTerm", required = false)
Integer leaseTerm) {
return webDeviceService.getLeaseGoodsDetail( return webDeviceService.getLeaseGoodsDetail(
goodsId, goodsId,
request.getHeader(TokenConstant.TOKEN) == null request.getHeader(TokenConstant.TOKEN) == null
? null ? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId(), : this.getUserLoginInfoFromRedis(request).getUserAccountId(),
request, request,
type, type);
leaseTerm);
} }
@ApiOperation(value = "web-首页分类数据-展示") @ApiOperation(value = "web-首页分类数据-展示")
...@@ -66,4 +63,15 @@ public class ProductMallController extends BaseController { ...@@ -66,4 +63,15 @@ public class ProductMallController extends BaseController {
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城") @RequestParam(value = "type") Integer type) { @ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城") @RequestParam(value = "type") Integer type) {
return webDeviceService.getPageHomeCategories(type); return webDeviceService.getPageHomeCategories(type);
} }
@ApiOperation(value = "获取设备商品规格价格详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecCPQVO.class)})
@GetMapping("/getLeaseGoodsPriceDetail")
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
@ApiParam(value = "商品id") @RequestParam(value = "productSpecId") Integer productSpecId,
@ApiParam(value = "租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
@RequestParam(value = "leaseTerm")
Integer leaseTerm) {
return webDeviceService.getLeaseGoodsPriceDetail(productSpecId, leaseTerm);
}
} }
...@@ -3,6 +3,7 @@ package com.mmc.pms.dao; ...@@ -3,6 +3,7 @@ package com.mmc.pms.dao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO; import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -105,4 +106,6 @@ public interface GoodsInfoDao { ...@@ -105,4 +106,6 @@ public interface GoodsInfoDao {
void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status); void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status);
void removeWareInfo(List<Integer> ids); void removeWareInfo(List<Integer> ids);
List<SpecPriceVO> getPriceBySpecId(Integer productSpecId, Integer leaseTerm);
} }
...@@ -14,8 +14,10 @@ import java.math.BigDecimal; ...@@ -14,8 +14,10 @@ import java.math.BigDecimal;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SpecPriceVO implements Serializable { public class SpecPriceVO implements Serializable {
private static final long serialVersionUID = -8976672168410262190L; private static final long serialVersionUID = -8976672168410262190L;
private Integer id; private Integer id;
private Integer cooperationTag; private Integer cooperationTag;
private BigDecimal price; private BigDecimal price;
private Integer productSpecId;
private Integer leaseTerm;
} }
...@@ -738,7 +738,9 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -738,7 +738,9 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO(); ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId()); productSpecCPQVO.setProductSpecId(e.getProductSpecId());
productSpecCPQVO.setType(type); productSpecCPQVO.setType(type);
productSpecCPQVO.setLeaseTerm(leaseTerm); if (type.equals(1)) {
productSpecCPQVO.setLeaseTerm(leaseTerm);
}
List<ProductSpecPriceDO> productSpecPrice = List<ProductSpecPriceDO> productSpecPrice =
productDao.getProductSpecPrice(productSpecCPQVO); productDao.getProductSpecPrice(productSpecCPQVO);
List<SpecPriceVO> collect = List<SpecPriceVO> collect =
......
...@@ -18,6 +18,8 @@ import com.mmc.pms.model.other.dto.ModelDTO; ...@@ -18,6 +18,8 @@ import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO; import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO; import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO; import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebDeviceService; import com.mmc.pms.service.WebDeviceService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -218,31 +220,14 @@ public class WebDeviceServiceImpl implements WebDeviceService { ...@@ -218,31 +220,14 @@ public class WebDeviceServiceImpl implements WebDeviceService {
@Override @Override
public ResultBody getLeaseGoodsDetail( public ResultBody getLeaseGoodsDetail(
Integer goodsInfoId, Integer goodsInfoId, Integer userAccountId, HttpServletRequest request, Integer type) {
Integer userAccountId,
HttpServletRequest request,
Integer type,
Integer leaseTerm) {
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId); int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) { if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF); return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
} }
// 初始化商品返回信息的对象 // 初始化商品返回信息的对象
ResultBody goodsInfoDetail = goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, leaseTerm); ResultBody goodsInfoDetail = goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, 0);
MallGoodsDetailDTO result = (MallGoodsDetailDTO) goodsInfoDetail.getResult(); MallGoodsDetailDTO result = (MallGoodsDetailDTO) goodsInfoDetail.getResult();
// if (userAccountId != null) {
// UserAccountSimpleDTO userAccountSimpleDTO =
// userAppApi.feignGetUserSimpleInfo(userAccountId,
// request.getHeader(TokenConstant.TOKEN));
// if (userAccountSimpleDTO.getCooperationTagId() != null) {
// if (!result.getDirectoryId().equals(2)) {
// Integer id =
// result.getGoodsSpec().get(0).getProductSpecList().get(0).getProductSpec();
// ProductSpecPriceDO price = productDao.getProductSpecPriceById(id);
// result.setPrice(price.getPrice());
// }
// }
// }
return ResultBody.success(result); return ResultBody.success(result);
} }
...@@ -296,4 +281,15 @@ public class WebDeviceServiceImpl implements WebDeviceService { ...@@ -296,4 +281,15 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
Integer productSpecId, Integer leaseTerm) {
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
List<SpecPriceVO> specPriceList = goodsInfoDao.getPriceBySpecId(productSpecId, leaseTerm);
productSpecCPQVO.setProductSpecId(productSpecId);
productSpecCPQVO.setLeaseTerm(leaseTerm);
productSpecCPQVO.setSpecPrice(specPriceList);
return ResultBody.success(productSpecCPQVO);
}
} }
...@@ -7,6 +7,7 @@ import com.mmc.pms.model.lease.vo.LeaseVo; ...@@ -7,6 +7,7 @@ import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.WareInfoQO; import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO; import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
...@@ -42,11 +43,9 @@ public interface WebDeviceService { ...@@ -42,11 +43,9 @@ public interface WebDeviceService {
List<SkuInfoDTO> listWareSkuById(Integer id); List<SkuInfoDTO> listWareSkuById(Integer id);
ResultBody getLeaseGoodsDetail( ResultBody getLeaseGoodsDetail(
Integer goodsId, Integer goodsId, Integer userAccountId, HttpServletRequest request, Integer type);
Integer userAccountId,
HttpServletRequest request,
Integer type,
Integer leaseTerm);
ResultBody<CategoryTypeDTO> getPageHomeCategories(Integer type); ResultBody<CategoryTypeDTO> getPageHomeCategories(Integer type);
ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(Integer productSpecId, Integer leaseTerm);
} }
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
categories categories
<where> <where>
is_deleted = 0 is_deleted = 0
<foreach collection="list" item="d" index="index" open="directory_id IN (" close=")" separator=","> <foreach collection="list" item="d" index="index" open=" and directory_id IN (" close=")" separator=",">
#{d} #{d}
</foreach> </foreach>
</where> </where>
......
...@@ -567,4 +567,16 @@ ...@@ -567,4 +567,16 @@
gi.shelf_status DESC , gi.create_time DESC gi.shelf_status DESC , gi.create_time DESC
limit #{pageNo},#{pageSize} limit #{pageNo},#{pageSize}
</select> </select>
<select id="getPriceBySpecId" resultType="com.mmc.pms.model.sale.vo.SpecPriceVO">
SELECT id,
product_spec_id,
cooperation_tag,
price,
lease_term
FROM product_spec_price
WHERE product_spec_id = #{productSpecId}
AND lease_term = #{leaseTerm}
and type = 1
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论