Explorar o código

Merge remote-tracking branch 'origin/master'

liulingchao %!s(int64=4) %!d(string=hai) anos
pai
achega
6491df27d7

+ 58 - 0
dgtly-api/src/main/java/com/dgtly/api/controller/SysCompanyController.java

@@ -0,0 +1,58 @@
+package com.dgtly.api.controller;
+
+import com.dgtly.common.annotation.ApiPassToken;
+import com.dgtly.common.core.controller.ApiBaseController;
+import com.dgtly.common.core.domain.AjaxResult;
+import com.dgtly.common.core.domain.ParameterObject;
+import com.dgtly.common.core.domain.ResultType;
+import com.dgtly.companyext.domain.CompanyExtInfo;
+import com.dgtly.companyext.service.ICompanyExtInfoService;
+import com.dgtly.goods.domain.GoodsInfo;
+import com.dgtly.system.domain.SysCompany;
+import com.dgtly.system.service.ISysCompanyService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/company/")
+@ApiPassToken/* 不用验证token  方法上可用*/
+public class SysCompanyController extends ApiBaseController {
+
+
+    @Autowired
+    private ISysCompanyService companyService;
+
+    @Autowired
+    private ICompanyExtInfoService companyExtInfoService;
+
+    @ApiOperation(value = "商家详情")
+    @ApiImplicitParam(name = "params" , paramType = "body")
+    @PostMapping("/details")
+    public Object detail(){
+        ParameterObject obj =  getParameterObject();
+        obj.checkParameterNotNull("id");
+        Long companyId = obj.getLong(" id");
+        CompanyExtInfo  companyExtInfo =  companyExtInfoService.selectCompanyExtInfoByCompanyId(companyId);
+        if(companyExtInfo!=null){
+            return AjaxResult.success(companyExtInfo);
+        }else{
+            return AjaxResult.error(ResultType.NUll);
+        }
+    }
+
+
+    @ApiOperation(value = "热门商家列表")
+    @ApiImplicitParam(name = "params" , paramType = "body")
+    @PostMapping("/hotlist")
+    public Object getHotList(){
+        List<SysCompany> goodsInfos =  companyService.selectCompanyHotList();
+        return AjaxResult.success().putKV("list",goodsInfos);
+    }
+
+}

+ 39 - 0
dgtly-goods/dgtly-goods-api/src/main/java/com/dgtly/goods/controller/GoodsInfoController.java

@@ -1,18 +1,26 @@
 package com.dgtly.goods.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.algorithms.Algorithm;
 import com.dgtly.common.annotation.ApiNoCheckSign;
 import com.dgtly.common.annotation.ApiPassToken;
 import com.dgtly.common.core.controller.ApiBaseController;
 import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
+import com.dgtly.common.core.domain.ResultType;
 import com.dgtly.goods.domain.GoodsInfo;
 import com.dgtly.goods.service.IGoodsInfoService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.Example;
+import io.swagger.annotations.ExampleProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 
 @RestController
@@ -24,12 +32,43 @@ public class GoodsInfoController extends ApiBaseController {
     @Autowired
     private IGoodsInfoService goodsInfoService;
 
+
+    @ApiOperation(value = "商品列表分页")
+    @ApiImplicitParam(name = "params" , paramType = "body")
     @PostMapping("/page")
     public Object getPasgeList(){
         ParameterObject obj =  getParameterObject();
         GoodsInfo gi = obj.parseBean(GoodsInfo.class);
+        if(gi==null){
+            gi = new GoodsInfo();
+        }
         startPage(obj);/*向分页传递 分页参数*/
+        gi.setPutawayFlag("1");
         List<GoodsInfo> goodsInfos =  goodsInfoService.selectGoodsInfoList(gi);
         return AjaxResult.success(getDataTable(goodsInfos));
     }
+
+
+    @ApiOperation(value = "热门商品列表")
+    @ApiImplicitParam(name = "params" , paramType = "body")
+    @PostMapping("/hotlist")
+    public Object getHotList(){
+        List<GoodsInfo> goodsInfos =  goodsInfoService.selectGoodsInfoHotList();
+        return AjaxResult.success().putKV("list",goodsInfos);
+    }
+
+    @ApiOperation(value = "商品详情")
+    @ApiImplicitParam(name = "params" , paramType = "body")
+    @PostMapping("/details")
+    public Object detail(){
+        ParameterObject obj =  getParameterObject();
+        obj.checkParameterNotNull("id");
+        Long id = obj.getLong("id");
+        GoodsInfo goodsInfo =  goodsInfoService.selectGoodsInfoById(id);
+        if(goodsInfo!=null){
+            return AjaxResult.success(goodsInfo);
+        }else{
+            return AjaxResult.error(ResultType.NUll);
+        }
+    }
 }

+ 7 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/mapper/GoodsInfoMapper.java

@@ -58,4 +58,11 @@ public interface GoodsInfoMapper
      * @return 结果
      */
     public int deleteGoodsInfoByIds(String[] ids);
+
+    /**
+     * 查询热门商品
+     *
+     * @return 结果
+     */
+    public List<GoodsInfo> selectGoodsInfoHotList();
 }

+ 8 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/service/IGoodsInfoService.java

@@ -58,4 +58,12 @@ public interface IGoodsInfoService
      * @return 结果
      */
     public int deleteGoodsInfoById(Long id);
+
+    /**
+     * 查询热门商品
+     *
+     * @param
+     * @return 结果
+     */
+    public List<GoodsInfo> selectGoodsInfoHotList();
 }

+ 10 - 0
dgtly-goods/dgtly-goods-common/src/main/java/com/dgtly/goods/service/impl/GoodsInfoServiceImpl.java

@@ -134,4 +134,14 @@ public class GoodsInfoServiceImpl implements IGoodsInfoService
     {
         return goodsInfoMapper.deleteGoodsInfoById(id);
     }
+
+    /**
+     * 查询热门商品
+     *
+     * @return 结果
+     */
+    @Override
+    public List<GoodsInfo> selectGoodsInfoHotList() {
+        return goodsInfoMapper.selectGoodsInfoHotList();
+    }
 }

+ 20 - 6
dgtly-goods/dgtly-goods-common/src/main/resources/mapper/goods/GoodsInfoMapper.xml

@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <resultMap type="GoodsAttribute" id="GoodsAttributeResult">
-        <result property="id"    column="id"    />
+        <result property="id"    column="goods_attribute_id"    />
         <result property="goodsId"    column="goods_id"    />
         <result property="attributeId"    column="attribute_id"    />
         <result property="attributeName"    column="attributeName"    />
@@ -41,12 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="value"    column="value"    />
     </resultMap>
     <resultMap type="GoodsColor" id="GoodsColorResult">
-        <result property="id"    column="id"    />
+        <result property="id"    column="goods_color_id"    />
         <result property="goodsId"    column="goods_id"    />
         <result property="color"    column="color"    />
     </resultMap>
     <resultMap type="GoodsSize" id="GoodsSizeResult">
-        <result property="id"    column="id"    />
+        <result property="id"    column="goods_size_id"    />
         <result property="goodsId"    column="goods_id"    />
         <result property="size"    column="size"    />
     </resultMap>
@@ -67,8 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectGoodsInfoList" parameterType="GoodsInfo" resultMap="GoodsInfoResult">
-        select gi.id, gi.name, gi.company_id, gi.type_id, gi.price, gi.cover, gi.slideshow, gi.des, gi.delivery, gi.produced_time, gi.produced_address,
-        gi.warehouse_address, gi.weight,gi.putaway_flag, gi.del_flag, gi.create_time, gi.create_by, gi.update_time, gi.update_by, gi.remark,
+        select gi.id, gi.name, gi.company_id, gi.type_id, gi.price, gi.cover, gi.slideshow, gi.create_time, gi.create_by, gi.update_time, gi.update_by, gi.remark,
+        gi.putaway_flag,gi.weight,gi.produced_time,
         gt.name typeName,sc.company_name companyName
         from goods_info gi
         left join goods_type gt on gt.id =gi.type_id
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             gi.del_flag = "0"
             <if test="name != null  and name != ''"> and gi.name like concat('%', #{name}, '%')</if>
             <if test="companyId != null "> and gi.company_id = #{companyId}</if>
-            <if test="typeId != null "> and gi.type_id = #{typeId}</if>
+            <if test="typeId != null "> and find_in_set(#{typeId},gt.ancestors) </if>
             <if test="price != null "> and gi.price = #{price}</if>
             <if test="cover != null  and cover != ''"> and gi.cover = #{cover}</if>
             <if test="slideshow != null  and slideshow != ''"> and gi.slideshow = #{slideshow}</if>
@@ -182,5 +182,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectGoodsInfoHotList" parameterType="GoodsInfo" resultMap="GoodsInfoResult">
+        select gi.id, gi.name, gi.company_id, gi.type_id, gi.price, gi.cover, gi.slideshow, gi.create_time, gi.create_by, gi.update_time, gi.update_by, gi.remark,
+        gi.putaway_flag,gi.weight,gi.produced_time,
+        gt.name typeName,sc.company_name companyName
+        from goods_info gi
+        left join goods_type gt on gt.id =gi.type_id
+        left join sys_company sc on sc.id =gi.company_id
+        where
+            gi.del_flag = "0"
+            and gi.putaway_flag = "1"
+        order by gi.create_time
+        limit 0,10
+    </select>
     
 </mapper>

+ 8 - 0
dgtly-system/src/main/java/com/dgtly/companyext/mapper/CompanyExtInfoMapper.java

@@ -19,6 +19,14 @@ public interface CompanyExtInfoMapper
      */
     public CompanyExtInfo selectCompanyExtInfoById(Long id);
 
+    /**
+     * 查询商户扩展信息
+     *
+     * @param companyId 商户ID
+     * @return 商户扩展信息
+     */
+    public CompanyExtInfo selectCompanyExtInfoByCompanyId(Long companyId);
+
     /**
      * 查询商户扩展信息列表
      * 

+ 8 - 0
dgtly-system/src/main/java/com/dgtly/companyext/service/ICompanyExtInfoService.java

@@ -58,4 +58,12 @@ public interface ICompanyExtInfoService
      * @return 结果
      */
     public int deleteCompanyExtInfoById(Long id);
+
+    /**
+     * 查询商户扩展信息
+     *
+     * @param companyId 商户ID
+     * @return 商户扩展信息
+     */
+    public CompanyExtInfo selectCompanyExtInfoByCompanyId(Long companyId);
 }

+ 11 - 0
dgtly-system/src/main/java/com/dgtly/companyext/service/impl/CompanyExtInfoServiceImpl.java

@@ -94,4 +94,15 @@ public class CompanyExtInfoServiceImpl implements ICompanyExtInfoService
     {
         return companyExtInfoMapper.deleteCompanyExtInfoById(id);
     }
+
+    /**
+     * 查询商户扩展信息
+     *
+     * @param companyId 商户ID
+     * @return 商户扩展信息
+     */
+    @Override
+    public CompanyExtInfo selectCompanyExtInfoByCompanyId(Long companyId) {
+        return companyExtInfoMapper.selectCompanyExtInfoByCompanyId(companyId);
+    }
 }

+ 12 - 0
dgtly-system/src/main/java/com/dgtly/system/domain/SysCompany.java

@@ -1,5 +1,6 @@
 package com.dgtly.system.domain;
 
+import com.dgtly.companyext.domain.CompanyExtInfo;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.dgtly.common.annotation.Excel;
@@ -28,6 +29,17 @@ public class SysCompany extends BaseEntity
 
     private Timestamp createTime;//创建时间
 
+    public CompanyExtInfo getCompanyExtInfo() {
+        return companyExtInfo;
+    }
+
+    public void setCompanyExtInfo(CompanyExtInfo companyExtInfo) {
+        this.companyExtInfo = companyExtInfo;
+    }
+
+    /** 商家信息扩展表*/
+    private CompanyExtInfo companyExtInfo;
+
     public Integer getStatus() {
         return status;
     }

+ 6 - 0
dgtly-system/src/main/java/com/dgtly/system/mapper/SysCompanyMapper.java

@@ -58,4 +58,10 @@ public interface SysCompanyMapper
      * @return 结果
      */
     public int deleteSysCompanyByIds(String[] ids);
+    /**
+     * 查询热门商家列表
+     * @param
+     * @return
+     */
+    public List<SysCompany> selectCompanyHotList();
 }

+ 9 - 0
dgtly-system/src/main/java/com/dgtly/system/service/ISysCompanyService.java

@@ -76,4 +76,13 @@ public interface ISysCompanyService
      * @return
      */
     public List<Ztree> selectSysCompanyTree(SysCompany sysCompany);
+
+    /**
+     * 查询热门商家列表
+     * @param
+     * @return
+     */
+    public List<SysCompany> selectCompanyHotList();
+
+
 }

+ 10 - 0
dgtly-system/src/main/java/com/dgtly/system/service/impl/SysCompanyServiceImpl.java

@@ -159,6 +159,16 @@ public class SysCompanyServiceImpl implements ISysCompanyService
         return initZtree(companies);
     }
 
+    /**
+     * 查询热门商家列表
+     * @param
+     * @return
+     */
+    @Override
+    public List<SysCompany> selectCompanyHotList() {
+        return sysCompanyMapper.selectCompanyHotList();
+    }
+
     public List<Ztree> initZtree(List<SysCompany> companies)
     {
 

+ 4 - 0
dgtly-system/src/main/resources/mapper/companyext/CompanyExtInfoMapper.xml

@@ -57,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCompanyExtInfoVo"/>
         where id = #{id}
     </select>
+    <select id="selectCompanyExtInfoByCompanyId" parameterType="Long" resultMap="CompanyExtInfoResult">
+        <include refid="selectCompanyExtInfoVo"/>
+        where company_id = #{companyId}
+    </select>
         
     <insert id="insertCompanyExtInfo" parameterType="CompanyExtInfo" useGeneratedKeys="true" keyProperty="id">
         insert into company_ext_info

+ 33 - 0
dgtly-system/src/main/resources/mapper/system/SysCompanyMapper.xml

@@ -8,6 +8,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="companyName"    column="company_name"    />
         <result property="status"    column="status"    />
+        <collection property="companyExtInfo" resultMap="CompanyExtInfoResult" />
+    </resultMap>
+
+    <resultMap type="CompanyExtInfo" id="CompanyExtInfoResult">
+        <result property="companyId"    column="company_id"    />
+        <result property="companyName"    column="company_name"    />
+        <result property="companyType"    column="company_type"    />
+        <result property="detailAddress"    column="detail_address"    />
+        <result property="longitude"    column="longitude"    />
+        <result property="latitude"    column="latitude"    />
+        <result property="legalPerson"    column="legal_person"    />
+        <result property="contactNumber"    column="contact_number"    />
+        <result property="establishDate"    column="establish_date"    />
+        <result property="unifiedSocialCreditCode"    column="unified_social_credit_code"    />
+        <result property="businessLicenseUrl"    column="business_license_url"    />
+        <result property="defaultImgUrl"    column="default_img_url"    />
+        <result property="propagandaImgUrl"    column="propaganda_img_url"    />
+        <result property="companyIntroduce"    column="company_introduce"    />
+        <result property="versionNum"    column="version_num"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
     </resultMap>
 
     <sql id="selectSysCompanyVo">
@@ -55,5 +79,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+
+    <select id="selectCompanyHotList" parameterType="Long" resultMap="SysCompanyResult">
+        select sc.id, sc.company_name,sc.status,sc.create_time,
+        cei.default_img_url,
+        from sys_company sc
+        left join company_ext_info cei on sc.id = cei.company_id
+        where sc.id != 1
+    </select>
     
 </mapper>