Helius
2020-12-24 22bef59bbd7a0ca2718abeaa15f5918480483791
finish shopping goods detail interface
1 files added
7 files modified
312 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiOrderAction.java 15 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/ShoppingGoodsDetailVo.java 203 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardAssembleDao.java 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsAssembleDao.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsService.java 3 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java 49 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardAssembleDao.xml 20 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsAssembleDao.xml 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiOrderAction.java
@@ -9,6 +9,7 @@
import com.matrix.system.app.dto.OrderListDto;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.OrderDetailVo;
import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.bean.ShoppingGoodsCategory;
@@ -70,6 +71,20 @@
        return AjaxResult.buildSuccessInstance(shoppingGoodsService.findShoppingGoodsListForApi(shoppingGoodsListDto), shoppingGoodsService.findShoppingGoodsListTotalForApi(shoppingGoodsListDto));
    }
    @ApiOperation(value = "获取商品详情", notes = "获取商品详情")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = ShoppingGoodsDetailVo.class)
    })
    @GetMapping(value = "/findGoodsDetailById/{goodsId}")
    public AjaxResult findGoodsDetailById(@PathVariable("goodsId") Long goodsId) {
        ShoppingGoodsDetailVo goodsDetail = shoppingGoodsService.findApiShoppingGoodsDetailById(goodsId);
        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功");
        ajaxResult.putInMap("goods", goodsDetail);
        return ajaxResult;
    }
    @ApiOperation(value = "创建订单", notes = "创建订单")
    @PostMapping(value = "/createOrder")
    public AjaxResult createOrder(@RequestBody @Validated CreateOrderDto createOrderDto) {
zq-erp/src/main/java/com/matrix/system/app/vo/ShoppingGoodsDetailVo.java
New file
@@ -0,0 +1,203 @@
package com.matrix.system.app.vo;
import com.matrix.system.hive.bean.ShoppingGoodsCategory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.List;
/**
 * @author wzy
 * @date 2020-12-24
 **/
@ApiModel(value = "ShoppingGoodsDetailVo", description = "商品详情返回参数类")
public class ShoppingGoodsDetailVo {
    @ApiModelProperty(value = "商品编号")
    private String goodsNo;
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    @ApiModelProperty(value = "销售价格")
    private BigDecimal salePrice;
    @ApiModelProperty(value = "销量")
    private Integer saleCnt;
    @ApiModelProperty(value = "主图")
    private String img;
    @ApiModelProperty(value = "详情")
    private String desc;
    @ApiModelProperty(value = "商品类型")
    private String goodsType;
    @ApiModelProperty(value = "容积")
    private Integer volume;
    @ApiModelProperty(value = "规格")
    private String measure;
    @ApiModelProperty(value = "最大销售数量")
    private Integer maxSaleCnt;
    @ApiModelProperty(value = "每人限购次数")
    private String limitBuyCnt;
    @ApiModelProperty(value = "充值卡使用范围 是-所有产品 否-部分产品")
    private String carIsAll;
    @ApiModelProperty(value = "赠送金额")
    private BigDecimal giftPrice;
    @ApiModelProperty(value = "项目关联产品--配料表、卡项可消费产品")
    List<ShoppingGoodsDetailVo> assembleProj;
    @ApiModelProperty(value = "套餐项目权益")
    List<ShoppingGoodsDetailVo> assembleTaocanProj;
    @ApiModelProperty(value = "套餐产品权益")
    List<ShoppingGoodsDetailVo> assembleTaocanProduct;
    @ApiModelProperty(value = "卡项产品可消费类型")
    List<ShoppingGoodsCategory> cardCategory;
    public BigDecimal getGiftPrice() {
        return giftPrice;
    }
    public void setGiftPrice(BigDecimal giftPrice) {
        this.giftPrice = giftPrice;
    }
    public String getCarIsAll() {
        return carIsAll;
    }
    public void setCarIsAll(String carIsAll) {
        this.carIsAll = carIsAll;
    }
    public String getGoodsNo() {
        return goodsNo;
    }
    public void setGoodsNo(String goodsNo) {
        this.goodsNo = goodsNo;
    }
    public String getGoodsName() {
        return goodsName;
    }
    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }
    public BigDecimal getSalePrice() {
        return salePrice;
    }
    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }
    public Integer getSaleCnt() {
        return saleCnt;
    }
    public void setSaleCnt(Integer saleCnt) {
        this.saleCnt = saleCnt;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    public String getGoodsType() {
        return goodsType;
    }
    public void setGoodsType(String goodsType) {
        this.goodsType = goodsType;
    }
    public Integer getVolume() {
        return volume;
    }
    public void setVolume(Integer volume) {
        this.volume = volume;
    }
    public String getMeasure() {
        return measure;
    }
    public void setMeasure(String measure) {
        this.measure = measure;
    }
    public Integer getMaxSaleCnt() {
        return maxSaleCnt;
    }
    public void setMaxSaleCnt(Integer maxSaleCnt) {
        this.maxSaleCnt = maxSaleCnt;
    }
    public String getLimitBuyCnt() {
        return limitBuyCnt;
    }
    public void setLimitBuyCnt(String limitBuyCnt) {
        this.limitBuyCnt = limitBuyCnt;
    }
    public List<ShoppingGoodsDetailVo> getAssembleProj() {
        return assembleProj;
    }
    public void setAssembleProj(List<ShoppingGoodsDetailVo> assembleProj) {
        this.assembleProj = assembleProj;
    }
    public List<ShoppingGoodsDetailVo> getAssembleTaocanProj() {
        return assembleTaocanProj;
    }
    public void setAssembleTaocanProj(List<ShoppingGoodsDetailVo> assembleTaocanProj) {
        this.assembleTaocanProj = assembleTaocanProj;
    }
    public List<ShoppingGoodsDetailVo> getAssembleTaocanProduct() {
        return assembleTaocanProduct;
    }
    public void setAssembleTaocanProduct(List<ShoppingGoodsDetailVo> assembleTaocanProduct) {
        this.assembleTaocanProduct = assembleTaocanProduct;
    }
    public List<ShoppingGoodsCategory> getCardCategory() {
        return cardCategory;
    }
    public void setCardCategory(List<ShoppingGoodsCategory> cardCategory) {
        this.cardCategory = cardCategory;
    }
}
zq-erp/src/main/java/com/matrix/system/hive/dao/MoneyCardAssembleDao.java
@@ -3,7 +3,9 @@
import java.util.List;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
import com.matrix.system.hive.bean.MoneyCardAssemble;
import com.matrix.system.hive.bean.ShoppingGoodsCategory;
import org.apache.ibatis.annotations.Param;
@@ -37,4 +39,8 @@
    public void batchInsert(@Param("list") List<MoneyCardAssemble> newAssemble);
    public    List<MoneyCardAssemble> selectByCardId(Long cardId);
    List<ShoppingGoodsDetailVo> selectCardRelationGoods(@Param("cardId") Long cardId);
    List<ShoppingGoodsCategory> selectCardRelationCategory(@Param("cardId") Long cardId);
}
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsAssembleDao.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
import com.matrix.system.hive.bean.ShoppingGoodsAssemble;
import org.apache.ibatis.annotations.Param;
@@ -63,4 +64,6 @@
    public int deleteByGoodsId(@Param("shoppingGoodsId") Long shoppingGoodsId);
    public void batchInsert(@Param("list") List<ShoppingGoodsAssemble> list);
    List<ShoppingGoodsDetailVo> selectGoodsRelationGoodsList(@Param("goodsId") Long id, @Param("goodsType") String goodsType);
}
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsService.java
@@ -2,6 +2,7 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.plugin.util.BaseServices;
@@ -107,4 +108,6 @@
    List<ShoppingGoodsListVo> findShoppingGoodsListForApi(ShoppingGoodsListDto shoppingGoodsListDto);
    int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto);
    ShoppingGoodsDetailVo findApiShoppingGoodsDetailById(Long id);
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java
@@ -7,16 +7,14 @@
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsDetailVo;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.dao.UtilDao;
import com.matrix.system.common.tools.ServiceUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.constance.TableMapping;
import com.matrix.system.hive.bean.MoneyCardAssemble;
import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.bean.ShoppingGoodsAssemble;
import com.matrix.system.hive.bean.SysShopInfo;
import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.MoneyCardAssembleDao;
import com.matrix.system.hive.dao.ShoppingGoodsAssembleDao;
import com.matrix.system.hive.dao.ShoppingGoodsDao;
@@ -30,6 +28,7 @@
import javax.validation.constraints.NotNull;
import java.awt.event.WindowStateListener;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
@@ -487,6 +486,48 @@
    public int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        shoppingGoodsListDto.setShopId(user.getShopId());
        return shoppingGoodsDao.selectShopppingGoodsAipTotal(shoppingGoodsListDto);
    }
    @Override
    public ShoppingGoodsDetailVo findApiShoppingGoodsDetailById(Long id) {
        ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(id);
        ShoppingGoodsDetailVo goodsDetailVo = goodsToGoodsDetailVo(shoppingGoods);
        if (ShoppingGoods.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())) {
            List<ShoppingGoodsDetailVo> products = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP);
            List<ShoppingGoodsDetailVo> proj = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM);
            goodsDetailVo.setAssembleTaocanProduct(products);
            goodsDetailVo.setAssembleTaocanProj(proj);
        } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_XM.equals(shoppingGoods.getGoodType())) {
            List<ShoppingGoodsDetailVo> products = shoppingGoodsAssembleDao.selectGoodsRelationGoodsList(shoppingGoods.getId(), null);
            goodsDetailVo.setAssembleProj(products);
        } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_CZK.equals(shoppingGoods.getGoodType())) {
            List<ShoppingGoodsDetailVo> cardGoods = moneyCardAssembleDao.selectCardRelationGoods(shoppingGoods.getId());
            List<ShoppingGoodsCategory> cardCategory = moneyCardAssembleDao.selectCardRelationCategory(shoppingGoods.getId());
            goodsDetailVo.setAssembleProj(cardGoods);
            goodsDetailVo.setCardCategory(cardCategory);
        }
        return goodsDetailVo;
    }
    private ShoppingGoodsDetailVo goodsToGoodsDetailVo(ShoppingGoods shoppingGoods) {
        ShoppingGoodsDetailVo goodsDetailVo = new ShoppingGoodsDetailVo();
        goodsDetailVo.setImg(shoppingGoods.getImg());
        goodsDetailVo.setGoodsName(shoppingGoods.getName());
        goodsDetailVo.setGoodsNo(shoppingGoods.getGoodsNo());
        goodsDetailVo.setGoodsType(shoppingGoods.getGoodType());
        goodsDetailVo.setDesc(shoppingGoods.getDescription());
        goodsDetailVo.setMaxSaleCnt(shoppingGoods.getCarMaxSaleCount());
        goodsDetailVo.setLimitBuyCnt(shoppingGoods.getIsOnce());
        goodsDetailVo.setMeasure(shoppingGoods.getMeasure());
        goodsDetailVo.setVolume(shoppingGoods.getVolume());
        goodsDetailVo.setSalePrice(BigDecimal.valueOf(shoppingGoods.getSealPice()));
        goodsDetailVo.setSaleCnt(shoppingGoods.getRealSealCount());
        goodsDetailVo.setGiftPrice(BigDecimal.valueOf(shoppingGoods.getReferencePice() == null ? 0 : shoppingGoods.getReferencePice()));
        return goodsDetailVo;
    }
}
zq-erp/src/main/resources/mybatis/mapper/hive/MoneyCardAssembleDao.xml
@@ -224,4 +224,24 @@
            card_id
        from money_card_assemble where card_id=#{cardId}
    </select>
    <select id="selectCardRelationGoods" resultType="com.matrix.system.app.vo.ShoppingGoodsDetailVo">
        select
            b.name goodsName,
            b.measure measure,
            b.volume volume
        from money_card_assemble a
        inner join shopping_goods b on a.goods_id=b.id
        where a.card_id=#{cardId}
    </select>
    <select id="selectCardRelationCategory" resultType="com.matrix.system.hive.bean.ShoppingGoodsCategory">
        select
            a.id id,
            a.name name,
            a.parent_id parentId
        from shopping_goods_category a
        inner join money_card_assemble b on a.id=b.cate_id
        where b.card_id=#{cardId};
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsAssembleDao.xml
@@ -432,5 +432,18 @@
        WHERE shopping_goods_id = #{shoppingGoodsId}
    </update>
    <select id="selectGoodsRelationGoodsList" resultType="com.matrix.system.app.vo.ShoppingGoodsDetailVo">
        select
            b.name goodsName,
            b.measure measure,
            b.volume volume
        from shopping_goods_assemble a
        inner join shopping_goods b on a.assembleGoodId=b.id
        where a.shopping_goods_id=#{goodsId}
        <if test="goodsType!= null and goodsType != ''">
            and b.good_type=#{goodsType}
        </if>
    </select>
</mapper>