Просмотр исходного кода

[需求][新增]:店铺导出使用统一接口

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
af50e2157f
6 измененных файлов: 189 добавлений и 12 удалений
  1. +12
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxShop.java
  2. +111
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxShopVo.java
  3. +2
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/ExcelService.java
  5. +13
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  6. +50
    -7
      mallinkService/src/main/resources/mapper/WxShopMapper.xml

+ 12
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxShop.java Просмотреть файл

@@ -1,5 +1,7 @@
package com.iformall.domain.po;

import cn.afterturn.easypoi.excel.annotation.Excel;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -52,14 +54,22 @@ public class WxShop implements Serializable {
/*租户ID**/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId;

@io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType")
@Excel(name="类型",width = 20,orderNum = "1",
replace = {"商铺_null", "固定点位_1", "临时促销点位_2", "宣传点位_3","ATM点位_4","仓库点位_5","其他点位_6"})
private Integer pointType;
/*商铺编号**/
@io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber")
@Excel(name="商铺号/多径点位号",width = 20,orderNum = "2")
private String shopNumber;
/*建筑面积**/
@io.swagger.annotations.ApiModelProperty(value="建筑面积",name="buildArea")
@Excel(name="建筑面积(㎡)",width = 20,orderNum = "5")
private String buildArea;
/*经营面积**/
@io.swagger.annotations.ApiModelProperty(value="经营面积",name="operationArea")
@Excel(name="计租面积(㎡)",width = 20,orderNum = "6")
private String operationArea;
/*楼座号**/
@io.swagger.annotations.ApiModelProperty(value="楼座号",name="building")
@@ -69,6 +79,7 @@ public class WxShop implements Serializable {
private Long floor;
/*状态(0:未出租, 1:已出租)**/
@io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status")
@Excel(name="租赁状态",width = 20,orderNum = "7",replace = {"未出租_0","已出租_1"})
private Integer status;
/*店铺相对位置x**/
@io.swagger.annotations.ApiModelProperty(value="店铺相对位置x",name="x")
@@ -107,8 +118,7 @@ public class WxShop implements Serializable {
@io.swagger.annotations.ApiModelProperty(value = "类型", name = "type")
private Integer type;

@io.swagger.annotations.ApiModelProperty(value = "点位类型", name = "pointType")
private Integer pointType;


@io.swagger.annotations.ApiModelProperty(value = "备注", name = "comments")
private String comments;


+ 111
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxShopVo.java Просмотреть файл

@@ -0,0 +1,111 @@
package com.iformall.domain.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.iformall.domain.po.WxShop;


public class WxShopVo extends WxShop {
private static final long serialVersionUID = 6687964942922444531L;


@io.swagger.annotations.ApiModelProperty(value="楼座",name="buildingName")
@Excel(name="楼座",width = 20,orderNum = "3")
private String buildingName;
/**楼层号**/
@io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName")
@Excel(name="楼层",width = 20,orderNum = "4")
private String floorName;


@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
private Long merchantId;

@Excel(name="租赁商户",width = 20,orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName")
private String merchantName;

/*联系方式**/
@io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone")
@Excel(name="负责人电话",width = 20,orderNum = "12")
private String linkPhone;

@io.swagger.annotations.ApiModelProperty(value="联系人",name="linkPerson")
@Excel(name="负责人",width = 20,orderNum = "11")
private String linkPerson;

@io.swagger.annotations.ApiModelProperty(value="品牌",name="brandName")
@Excel(name="品牌",width = 20,orderNum = "10")
private String brandName;

@io.swagger.annotations.ApiModelProperty(value="经营业态",name="business")
@Excel(name="经营业态",width = 20,orderNum = "9")
private String business;

public String getBuildingName() {
return buildingName;
}

public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}

public String getFloorName() {
return floorName;
}

public void setFloorName(String floorName) {
this.floorName = floorName;
}

public Long getMerchantId() {
return merchantId;
}

public void setMerchantId(Long merchantId) {
this.merchantId = merchantId;
}

public String getMerchantName() {
return merchantName;
}

public void setMerchantName(String merchantName) {
this.merchantName = merchantName;
}

@Override
public String getLinkPhone() {
return linkPhone;
}

@Override
public void setLinkPhone(String linkPhone) {
this.linkPhone = linkPhone;
}

@Override
public String getLinkPerson() {
return linkPerson;
}

@Override
public void setLinkPerson(String linkPerson) {
this.linkPerson = linkPerson;
}

public String getBrandName() {
return brandName;
}

public void setBrandName(String brandName) {
this.brandName = brandName;
}

public String getBusiness() {
return business;
}

public void setBusiness(String business) {
this.business = business;
}
}

+ 2
- 1
mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.vo.WxShopVo;

import java.util.List;
import java.util.Map;
@@ -26,5 +27,5 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> {

int hasShopNumber(WxShop wxShop);

List<Map<String,Object>> findListWithMerchantMap(WxShop record);
List<WxShopVo> findListWithMerchantMap(WxShop record);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/ExcelService.java Просмотреть файл

@@ -58,7 +58,7 @@ public class ExcelService {
{
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
if (workbook != null);
downLoadExcel(fileName, response, workbook);
downLoadExcel(fileName, response, workbook);
}

private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook)


+ 13
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java Просмотреть файл

@@ -8,10 +8,12 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchantShop;
import com.iformall.domain.po.WxShop;
import com.iformall.domain.vo.WxShopVo;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxMerchantShopMapper;
import com.iformall.mapper.WxShopMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxShopService;
import com.iformall.utils.Constant;
import com.iformall.utils.DownFileUtil;
@@ -41,6 +43,9 @@ public class WxShopServiceImpl implements WxShopService {
@Autowired
WxMerchantShopMapper wxMerchantShopMapper;

@Autowired
ExcelService excelService;

@Override
public PageInfo<WxShop> listAsPage(WxShop record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findList(record));
@@ -132,6 +137,13 @@ public class WxShopServiceImpl implements WxShopService {
return pageInfo;
}

public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) {
List<WxShopVo> list = wxShopMapper.findListWithMerchantMap(wxShop);
String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表";
excelService.exportExcel(list,null, name, WxShopVo.class,name+".xls",response);
}

/*
@Override
public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) {
List<Map<String,Object>> shopList = wxShopMapper.findListWithMerchantMap(wxShop);
@@ -258,6 +270,6 @@ public class WxShopServiceImpl implements WxShopService {
e.printStackTrace();
}
}
*/

}

+ 50
- 7
mallinkService/src/main/resources/mapper/WxShopMapper.xml Просмотреть файл

@@ -148,6 +148,7 @@
<include refid="dynamicWhereConditions"/>
</select>


<select id="findListMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">

select s.id,s.shop_number shopNumber,s.build_area buildArea,
@@ -266,13 +267,55 @@
</select>


<select id="findListWithMerchantMap" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap">
select s.id,s.shop_number shopNumber,s.build_area buildArea,
s.img_url imgUrl,s.operation_area operationArea,
s.status,b.building_name building,f.floor_name floor,m.`name` merchantName,m.id merchantId,
m.link_person linkPerson,m.link_phone linkPhone,s.manager,s.manager_phone managerPhone,
s.type,s.point_type pointType,s.addr,s.email,
brand.name brand,m.link_person,m.link_phone,bus.title

<resultMap id="VoResultMap" type="com.iformall.domain.vo.WxShopVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
<result column="build_area" jdbcType="VARCHAR" property="buildArea"/>
<result column="operation_area" jdbcType="VARCHAR" property="operationArea"/>
<result column="building" jdbcType="BIGINT" property="building"/>
<result column="floor" jdbcType="BIGINT" property="floor"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="x" jdbcType="DECIMAL" property="x"/>
<result column="y" jdbcType="DECIMAL" property="y"/>
<result column="addr" jdbcType="VARCHAR" property="addr"/>
<result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/>
<result column="longitude" jdbcType="DECIMAL" property="longitude"/>
<result column="latitude" jdbcType="DECIMAL" property="latitude"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="img_url" jdbcType="VARCHAR" property="imgUrl"/>
<result column="manager" jdbcType="VARCHAR" property="manager"/>
<result column="manager_phone" jdbcType="VARCHAR" property="managerPhone"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="point_type" jdbcType="INTEGER" property="pointType"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
<result column="email" property="email"/>

<result column="building_name" jdbcType="VARCHAR" property="buildingName"/>
<result column="floor_name" jdbcType="VARCHAR" property="floorName"/>


<result column="merchantId" jdbcType="VARCHAR" property="merchantId"/>
<result column="merchantName" jdbcType="VARCHAR" property="merchantName"/>
<result column="link_phone" jdbcType="VARCHAR" property="linkPhone"/>
<result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>

<result column="business" jdbcType="VARCHAR" property="business"/>

<result column="brandName" jdbcType="VARCHAR" property="brandName"/>

</resultMap>


<select id="findListWithMerchantMap" parameterType="com.iformall.domain.vo.WxShopVo" resultMap="VoResultMap">
select
s.id,s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,s.manager,s.manager_phone,s.addr,s.email,s.type,s.point_type,
b.building_name,f.floor_name,
m.id merchantId,m.name merchantName,m.link_person,m.link_phone,
brand.name brandName,
bus.title business
from wx_shop s left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0
left join wx_merchant m on ms.merchant_id=m.id
left join wx_mall_building b on s.building=b.id


Загрузка…
Отмена
Сохранить