Helius
2020-12-23 975d3a1863fd365e0021af323f524250104cf94d
modify
2 files added
11 files modified
328 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiOrderAction.java 46 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/AddVipDto.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/ShoppingGoodsListDto.java 71 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/ShoppingGoodsListVo.java 102 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoDetailVo.java 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsCategoryDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsDao.java 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsCategoryService.java 2 ●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsService.java 6 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsCategoryServiceImpl.java 7 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsCategoryDao.xml 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml 38 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiOrderAction.java
@@ -1,25 +1,61 @@
package com.matrix.system.app.action;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.bean.ShoppingGoodsCategory;
import com.matrix.system.hive.service.ShoppingGoodsCategoryService;
import com.matrix.system.hive.service.ShoppingGoodsService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author wzy
 * @date 2020-12-21
 **/
@Api(value = "ApiOrderAction", tags = "订单接口类")
@RestController
@RequestMapping(value = "/api/order")
public class ApiOrderAction {
    @Autowired
    private ShoppingGoodsCategoryService shoppingGoodsCategoryService;
    @Autowired
    private ShoppingGoodsService shoppingGoodsService;
    @ApiOperation(value = "获取商品类型列表", notes = "获取商品类型列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = ShoppingGoodsCategory.class)
    })
    @GetMapping(value = "/findShoppingGoodsType")
    public AjaxResult findShoppingGoodsType() {
        return null;
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        ShoppingGoodsCategory category = new ShoppingGoodsCategory();
        category.setShopId(user.getShopId());
        category.setName("家居产品");
        return AjaxResult.buildSuccessInstance(shoppingGoodsCategoryService.findChildNodesByName(category));
    }
    public AjaxResult findShoppingGoods() {
        return null;
    @ApiOperation(value = "获取商品列表", notes = "获取商品列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = ShoppingGoodsListVo.class)
    })
    @PostMapping(value = "/findShoppingGoods")
    public AjaxResult findShoppingGoods(@RequestBody @Validated ShoppingGoodsListDto shoppingGoodsListDto) {
        return AjaxResult.buildSuccessInstance(shoppingGoodsService.findShoppingGoodsListForApi(shoppingGoodsListDto), shoppingGoodsService.findShoppingGoodsListTotalForApi(shoppingGoodsListDto));
    }
    @PostMapping(value = "/createOrder")
zq-erp/src/main/java/com/matrix/system/app/dto/AddVipDto.java
@@ -4,6 +4,7 @@
import com.matrix.core.tools.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@@ -17,6 +18,7 @@
@ApiModel(value = "AddVipDto", description = "添加会员接收参数类")
public class AddVipDto {
    @Length(max = 10, min = 1)
    @NotBlank(message = "会员编号不能为空")
    @ApiModelProperty(value = "会员编号")
    private String vipNo;
zq-erp/src/main/java/com/matrix/system/app/dto/ShoppingGoodsListDto.java
New file
@@ -0,0 +1,71 @@
package com.matrix.system.app.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
 * @author wzy
 * @date 2020-12-23
 **/
@ApiModel(value = "ShoppingGoodsListDto", description = "商品列表接受类")
public class ShoppingGoodsListDto {
    @ApiModelProperty(value = "商品名称/编号/拼音")
    private String queryKey;
    @ApiModelProperty(value = "类型ID", example = "13")
    private Long cateId;
    @NotNull(message = "参数错误")
    @ApiModelProperty(value = "条数", example = "10")
    private Integer pageSize = 10;
    @NotNull(message = "参数错误")
    @ApiModelProperty(value = "第几页", example = "1")
    private Integer pageNum = 1;
    @ApiModelProperty(hidden = true)
    private Long shopId;
    public Long getShopId() {
        return shopId;
    }
    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }
    public String getQueryKey() {
        return queryKey;
    }
    public void setQueryKey(String queryKey) {
        this.queryKey = queryKey;
    }
    public Long getCateId() {
        return cateId;
    }
    public void setCateId(Long cateId) {
        this.cateId = cateId;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public Integer getPageNum() {
        return pageNum;
    }
    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/ShoppingGoodsListVo.java
New file
@@ -0,0 +1,102 @@
package com.matrix.system.app.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/**
 * @author wzy
 * @date 2020-12-23
 **/
@ApiModel(value = "ShoppingGoodsListVo", description = "商品列表返回类")
public class ShoppingGoodsListVo {
    @ApiModelProperty(value = "商品ID")
    private Long id;
    @ApiModelProperty(value = "商品编号")
    private String goodsCode;
    @ApiModelProperty(value = "商品名称")
    private String name;
    @ApiModelProperty(value = "商品价格")
    private BigDecimal price;
    @ApiModelProperty(value = "是否赠送")
    private String isPresent;
    @ApiModelProperty(value = "商品规格")
    private String unit;
    @ApiModelProperty(value = "计量单位")
    private String measure;
    @ApiModelProperty(value = "商品图片")
    private String img;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getGoodsCode() {
        return goodsCode;
    }
    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public BigDecimal getPrice() {
        return price;
    }
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    public String getIsPresent() {
        return isPresent;
    }
    public void setIsPresent(String isPresent) {
        this.isPresent = isPresent;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public String getMeasure() {
        return measure;
    }
    public void setMeasure(String measure) {
        this.measure = measure;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoDetailVo.java
@@ -19,6 +19,9 @@
    @ApiModelProperty(value = "会员ID")
    private Long id;
    @ApiModelProperty(value = "会员编号")
    private String vipNo;
    @ApiModelProperty(value = "会员姓名")
    private String vipName;
@@ -64,6 +67,14 @@
        this.labels = labels;
    }
    public String getVipNo() {
        return vipNo;
    }
    public void setVipNo(String vipNo) {
        this.vipNo = vipNo;
    }
    public Long getId() {
        return id;
    }
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsCategoryDao.java
@@ -35,4 +35,6 @@
    public int batchInsert(@Param("list")List<ShoppingGoodsCategory> shoppingGoodsCategoryList);
    List<ShoppingGoodsCategory> selectChildNodesByName(@Param("record") ShoppingGoodsCategory shoppingGoodsCategory);
}
zq-erp/src/main/java/com/matrix/system/hive/dao/ShoppingGoodsDao.java
@@ -1,6 +1,8 @@
package com.matrix.system.hive.dao;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.hive.bean.ShoppingGoods;
import org.apache.ibatis.annotations.Param;
@@ -83,4 +85,8 @@
     * @return
     */
    public ShoppingGoods selectVipCzGoods();
    List<ShoppingGoodsListVo> selectShoppingGoodsApiInPage(@Param("record") ShoppingGoodsListDto shoppingGoodsListDto, @Param("pageVo") PaginationVO pageVo);
    int selectShopppingGoodsAipTotal(@Param("record") ShoppingGoodsListDto shoppingGoodsListDto);
}
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsCategoryService.java
@@ -60,6 +60,6 @@
    public ShoppingGoodsCategory  findById(Long id);
       
    List<ShoppingGoodsCategory> findChildNodesByName(ShoppingGoodsCategory shoppingGoodsCategory);
  
}
zq-erp/src/main/java/com/matrix/system/hive/service/ShoppingGoodsService.java
@@ -1,6 +1,8 @@
package com.matrix.system.hive.service;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.plugin.util.BaseServices;
@@ -101,4 +103,8 @@
    public  ShoppingGoods findByCode(String goodsCode);
    Date calInvalidTime(ShoppingGoods shoppingGoods, Integer type, Date buyDate);
    List<ShoppingGoodsListVo> findShoppingGoodsListForApi(ShoppingGoodsListDto shoppingGoodsListDto);
    int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto);
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsCategoryServiceImpl.java
@@ -90,6 +90,9 @@
            }
        }
    }
    @Override
    public List<ShoppingGoodsCategory> findChildNodesByName(ShoppingGoodsCategory shoppingGoodsCategory) {
        return shoppingGoodsCategoryDao.selectChildNodesByName(shoppingGoodsCategory);
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/ShoppingGoodsServiceImpl.java
@@ -6,6 +6,8 @@
import com.matrix.core.tools.DateUtil;
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.ShoppingGoodsListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.dao.UtilDao;
import com.matrix.system.common.tools.ServiceUtil;
@@ -467,4 +469,24 @@
        }
        return target;
    }
    @Override
    public List<ShoppingGoodsListVo> findShoppingGoodsListForApi(ShoppingGoodsListDto shoppingGoodsListDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        shoppingGoodsListDto.setShopId(user.getShopId());
        PaginationVO pageVo = new PaginationVO();
        int offset = (shoppingGoodsListDto.getPageNum() - 1) + shoppingGoodsListDto.getPageSize();
        int limit = shoppingGoodsListDto.getPageSize();
        pageVo.setOffset(offset);
        pageVo.setLimit(limit);
        return shoppingGoodsDao.selectShoppingGoodsApiInPage(shoppingGoodsListDto, pageVo);
    }
    @Override
    public int findShoppingGoodsListTotalForApi(ShoppingGoodsListDto shoppingGoodsListDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        shoppingGoodsListDto.setShopId(user.getShopId());
        return shoppingGoodsDao.selectShopppingGoodsAipTotal(shoppingGoodsListDto);
    }
}
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsCategoryDao.xml
@@ -208,4 +208,17 @@
        </if>
        ORDER BY sequence
    </select>
    <select id="selectChildNodesByName" resultMap="ShoppingGoodsCategoryMap">
        select * from shopping_goods_category a
        inner join shopping_goods_category b on a.parent_id=b.id and b.name=#{record.name} and b.parent_id=0
        <where>
            <if test="record.shopId != null">
                and a.shop_id=#{record.shopId}
            </if>
            <if test="record.companyId != null">
                and a.company_id=#{record.companyId}
            </if>
        </where>
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml
@@ -1228,4 +1228,42 @@
    </select>
    <select id="selectShoppingGoodsApiInPage" resultType="com.matrix.system.app.vo.ShoppingGoodsListVo">
        select
            id id,
            code goodsCode,
            name name,
            seal_pice price,
            is_present isPresent,
            unit unit,
            measure measure
        from shopping_goods
        where 1=1
        <if test="record.queryKey != null and record.queryKey != ''">
            and (instr(name,#{record.queryKey}) or instr(code ,#{record.queryKey}) or instr(zjm ,#{record.queryKey}))
        </if>
        <if test="record.cateId!=null">
            and cate_id=#{record.cateId}
        </if>
        <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
            <if test="pageVo.sort !=null  and pageVo.order !=null">
                order by ${pageVo.sort} ${pageVo.order}
            </if>
            <if test="pageVo.offset >=0  and pageVo.limit >0">
                limit #{pageVo.offset},#{pageVo.limit}
            </if>
        </if>
    </select>
    <select id="selectShopppingGoodsAipTotal" resultType="java.lang.Integer">
        select count(1)
        from shopping_goods
        where 1=1
        <if test="record.queryKey != null and record.queryKey != ''">
            and (instr(name,#{record.queryKey}) or instr(code ,#{record.queryKey}) or instr(zjm ,#{record.queryKey}))
        </if>
        <if test="record.cateId!=null">
            and cate_id=#{record.cateId}
        </if>
    </select>
</mapper>