1
This commit is contained in:
@@ -17,7 +17,9 @@ import com.ruoyi.common.core.controller.BaseController;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.jarvis.domain.ErpProduct;
|
import com.ruoyi.jarvis.domain.ErpProduct;
|
||||||
|
import com.ruoyi.jarvis.domain.ErpProductExportRow;
|
||||||
import com.ruoyi.jarvis.service.IErpProductService;
|
import com.ruoyi.jarvis.service.IErpProductService;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
@@ -55,8 +57,10 @@ public class ErpProductController extends BaseController
|
|||||||
public AjaxResult export(ErpProduct erpProduct)
|
public AjaxResult export(ErpProduct erpProduct)
|
||||||
{
|
{
|
||||||
List<ErpProduct> list = erpProductService.selectErpProductList(erpProduct);
|
List<ErpProduct> list = erpProductService.selectErpProductList(erpProduct);
|
||||||
ExcelUtil<ErpProduct> util = new ExcelUtil<ErpProduct>(ErpProduct.class);
|
String batchAt = DateUtils.getTime();
|
||||||
return util.exportExcel(list, "闲鱼商品数据");
|
List<ErpProductExportRow> rows = ErpProductExportRow.fromList(list, batchAt);
|
||||||
|
ExcelUtil<ErpProductExportRow> util = new ExcelUtil<ErpProductExportRow>(ErpProductExportRow.class);
|
||||||
|
return util.exportExcel(rows, "闲鱼商品_AI明细");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,478 @@
|
|||||||
|
package com.ruoyi.jarvis.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 闲鱼商品导出专用行(字段偏多,便于给 AI / 离线分析使用)
|
||||||
|
*/
|
||||||
|
public class ErpProductExportRow implements Serializable
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Excel(name = "导出批次时间", width = 22, sort = 1)
|
||||||
|
private String exportBatchAt;
|
||||||
|
|
||||||
|
@Excel(name = "本表主键ID", sort = 2)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Excel(name = "管家商品ID", sort = 3)
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Excel(name = "管家商品ID文本", width = 22, sort = 4)
|
||||||
|
private String productIdText;
|
||||||
|
|
||||||
|
@Excel(name = "商品标题", width = 45, sort = 5)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Excel(name = "主图URL", width = 55, sort = 6)
|
||||||
|
private String mainImage;
|
||||||
|
|
||||||
|
@Excel(name = "价格_分_原始整数", sort = 7)
|
||||||
|
private Long priceFen;
|
||||||
|
|
||||||
|
@Excel(name = "价格_元_可读", sort = 8)
|
||||||
|
private String priceYuan;
|
||||||
|
|
||||||
|
@Excel(name = "库存", sort = 9)
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
@Excel(name = "商品状态_码", sort = 10)
|
||||||
|
private Integer productStatusCode;
|
||||||
|
|
||||||
|
@Excel(name = "商品状态_说明", width = 14, sort = 11)
|
||||||
|
private String productStatusLabel;
|
||||||
|
|
||||||
|
@Excel(name = "销售状态_码", sort = 12)
|
||||||
|
private Integer saleStatusCode;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼会员名", width = 18, sort = 13)
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Excel(name = "ERP应用appid", width = 22, sort = 14)
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
@Excel(name = "商品链接", width = 55, sort = 15)
|
||||||
|
private String productUrl;
|
||||||
|
|
||||||
|
@Excel(name = "上架时间_unix秒", width = 18, sort = 16)
|
||||||
|
private Long onlineTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "上架时间_可读", width = 22, sort = 17)
|
||||||
|
private String onlineTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "下架时间_unix秒", width = 18, sort = 18)
|
||||||
|
private Long offlineTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "下架时间_可读", width = 22, sort = 19)
|
||||||
|
private String offlineTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "售出时间_unix秒", width = 18, sort = 20)
|
||||||
|
private Long soldTimeUnix;
|
||||||
|
|
||||||
|
@Excel(name = "售出时间_可读", width = 22, sort = 21)
|
||||||
|
private String soldTimeReadable;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼创建_unix秒", width = 18, sort = 22)
|
||||||
|
private Long createTimeXyUnix;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼创建_可读", width = 22, sort = 23)
|
||||||
|
private String createTimeXyReadable;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼更新_unix秒", width = 18, sort = 24)
|
||||||
|
private Long updateTimeXyUnix;
|
||||||
|
|
||||||
|
@Excel(name = "闲鱼更新_可读", width = 22, sort = 25)
|
||||||
|
private String updateTimeXyReadable;
|
||||||
|
|
||||||
|
@Excel(name = "备注_本表", width = 30, sort = 26)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Excel(name = "库创建时间", width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 27)
|
||||||
|
private Date dbCreateTime;
|
||||||
|
|
||||||
|
@Excel(name = "库更新时间", width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 28)
|
||||||
|
private Date dbUpdateTime;
|
||||||
|
|
||||||
|
public static List<ErpProductExportRow> fromList(List<ErpProduct> list, String exportBatchAt)
|
||||||
|
{
|
||||||
|
List<ErpProductExportRow> rows = new ArrayList<>(list.size());
|
||||||
|
for (ErpProduct p : list)
|
||||||
|
{
|
||||||
|
rows.add(from(p, exportBatchAt));
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ErpProductExportRow from(ErpProduct p, String exportBatchAt)
|
||||||
|
{
|
||||||
|
ErpProductExportRow r = new ErpProductExportRow();
|
||||||
|
r.setExportBatchAt(exportBatchAt != null ? exportBatchAt : "");
|
||||||
|
if (p == null)
|
||||||
|
{
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
r.setId(p.getId());
|
||||||
|
r.setProductId(p.getProductId());
|
||||||
|
r.setProductIdText(p.getProductId() != null ? String.valueOf(p.getProductId()) : "");
|
||||||
|
r.setTitle(p.getTitle());
|
||||||
|
r.setMainImage(p.getMainImage());
|
||||||
|
r.setPriceFen(p.getPrice());
|
||||||
|
if (p.getPrice() != null)
|
||||||
|
{
|
||||||
|
r.setPriceYuan(BigDecimal.valueOf(p.getPrice()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).toPlainString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r.setPriceYuan("");
|
||||||
|
}
|
||||||
|
r.setStock(p.getStock());
|
||||||
|
r.setProductStatusCode(p.getProductStatus());
|
||||||
|
r.setProductStatusLabel(productStatusLabel(p.getProductStatus()));
|
||||||
|
r.setSaleStatusCode(p.getSaleStatus());
|
||||||
|
r.setUserName(p.getUserName());
|
||||||
|
r.setAppid(p.getAppid());
|
||||||
|
r.setProductUrl(p.getProductUrl());
|
||||||
|
|
||||||
|
r.setOnlineTimeUnix(p.getOnlineTime());
|
||||||
|
r.setOnlineTimeReadable(formatUnixSeconds(p.getOnlineTime()));
|
||||||
|
r.setOfflineTimeUnix(p.getOfflineTime());
|
||||||
|
r.setOfflineTimeReadable(formatUnixSeconds(p.getOfflineTime()));
|
||||||
|
r.setSoldTimeUnix(p.getSoldTime());
|
||||||
|
r.setSoldTimeReadable(formatUnixSeconds(p.getSoldTime()));
|
||||||
|
r.setCreateTimeXyUnix(p.getCreateTimeXy());
|
||||||
|
r.setCreateTimeXyReadable(formatUnixSeconds(p.getCreateTimeXy()));
|
||||||
|
r.setUpdateTimeXyUnix(p.getUpdateTimeXy());
|
||||||
|
r.setUpdateTimeXyReadable(formatUnixSeconds(p.getUpdateTimeXy()));
|
||||||
|
|
||||||
|
r.setRemark(p.getRemark());
|
||||||
|
r.setDbCreateTime(p.getCreateTime());
|
||||||
|
r.setDbUpdateTime(p.getUpdateTime());
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatUnixSeconds(Long unixSeconds)
|
||||||
|
{
|
||||||
|
if (unixSeconds == null || unixSeconds <= 0)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date(unixSeconds * 1000L));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String productStatusLabel(Integer status)
|
||||||
|
{
|
||||||
|
if (status == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
return "删除";
|
||||||
|
case 10:
|
||||||
|
return "其它(10)";
|
||||||
|
case 21:
|
||||||
|
return "待发布";
|
||||||
|
case 22:
|
||||||
|
return "销售中";
|
||||||
|
case 23:
|
||||||
|
return "已售罄";
|
||||||
|
case 31:
|
||||||
|
return "手动下架";
|
||||||
|
case 33:
|
||||||
|
return "售出下架";
|
||||||
|
case 36:
|
||||||
|
return "自动下架";
|
||||||
|
default:
|
||||||
|
return "未知(" + status + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExportBatchAt()
|
||||||
|
{
|
||||||
|
return exportBatchAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExportBatchAt(String exportBatchAt)
|
||||||
|
{
|
||||||
|
this.exportBatchAt = exportBatchAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProductId()
|
||||||
|
{
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Long productId)
|
||||||
|
{
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductIdText()
|
||||||
|
{
|
||||||
|
return productIdText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductIdText(String productIdText)
|
||||||
|
{
|
||||||
|
this.productIdText = productIdText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainImage()
|
||||||
|
{
|
||||||
|
return mainImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainImage(String mainImage)
|
||||||
|
{
|
||||||
|
this.mainImage = mainImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPriceFen()
|
||||||
|
{
|
||||||
|
return priceFen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceFen(Long priceFen)
|
||||||
|
{
|
||||||
|
this.priceFen = priceFen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceYuan()
|
||||||
|
{
|
||||||
|
return priceYuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceYuan(String priceYuan)
|
||||||
|
{
|
||||||
|
this.priceYuan = priceYuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStock()
|
||||||
|
{
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStock(Integer stock)
|
||||||
|
{
|
||||||
|
this.stock = stock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductStatusCode()
|
||||||
|
{
|
||||||
|
return productStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductStatusCode(Integer productStatusCode)
|
||||||
|
{
|
||||||
|
this.productStatusCode = productStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductStatusLabel()
|
||||||
|
{
|
||||||
|
return productStatusLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductStatusLabel(String productStatusLabel)
|
||||||
|
{
|
||||||
|
this.productStatusLabel = productStatusLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSaleStatusCode()
|
||||||
|
{
|
||||||
|
return saleStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleStatusCode(Integer saleStatusCode)
|
||||||
|
{
|
||||||
|
this.saleStatusCode = saleStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName)
|
||||||
|
{
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppid()
|
||||||
|
{
|
||||||
|
return appid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppid(String appid)
|
||||||
|
{
|
||||||
|
this.appid = appid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductUrl()
|
||||||
|
{
|
||||||
|
return productUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductUrl(String productUrl)
|
||||||
|
{
|
||||||
|
this.productUrl = productUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOnlineTimeUnix()
|
||||||
|
{
|
||||||
|
return onlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnlineTimeUnix(Long onlineTimeUnix)
|
||||||
|
{
|
||||||
|
this.onlineTimeUnix = onlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOnlineTimeReadable()
|
||||||
|
{
|
||||||
|
return onlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnlineTimeReadable(String onlineTimeReadable)
|
||||||
|
{
|
||||||
|
this.onlineTimeReadable = onlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getOfflineTimeUnix()
|
||||||
|
{
|
||||||
|
return offlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOfflineTimeUnix(Long offlineTimeUnix)
|
||||||
|
{
|
||||||
|
this.offlineTimeUnix = offlineTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOfflineTimeReadable()
|
||||||
|
{
|
||||||
|
return offlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOfflineTimeReadable(String offlineTimeReadable)
|
||||||
|
{
|
||||||
|
this.offlineTimeReadable = offlineTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSoldTimeUnix()
|
||||||
|
{
|
||||||
|
return soldTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoldTimeUnix(Long soldTimeUnix)
|
||||||
|
{
|
||||||
|
this.soldTimeUnix = soldTimeUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSoldTimeReadable()
|
||||||
|
{
|
||||||
|
return soldTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoldTimeReadable(String soldTimeReadable)
|
||||||
|
{
|
||||||
|
this.soldTimeReadable = soldTimeReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreateTimeXyUnix()
|
||||||
|
{
|
||||||
|
return createTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTimeXyUnix(Long createTimeXyUnix)
|
||||||
|
{
|
||||||
|
this.createTimeXyUnix = createTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateTimeXyReadable()
|
||||||
|
{
|
||||||
|
return createTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTimeXyReadable(String createTimeXyReadable)
|
||||||
|
{
|
||||||
|
this.createTimeXyReadable = createTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdateTimeXyUnix()
|
||||||
|
{
|
||||||
|
return updateTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTimeXyUnix(Long updateTimeXyUnix)
|
||||||
|
{
|
||||||
|
this.updateTimeXyUnix = updateTimeXyUnix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdateTimeXyReadable()
|
||||||
|
{
|
||||||
|
return updateTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTimeXyReadable(String updateTimeXyReadable)
|
||||||
|
{
|
||||||
|
this.updateTimeXyReadable = updateTimeXyReadable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark()
|
||||||
|
{
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark)
|
||||||
|
{
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDbCreateTime()
|
||||||
|
{
|
||||||
|
return dbCreateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbCreateTime(Date dbCreateTime)
|
||||||
|
{
|
||||||
|
this.dbCreateTime = dbCreateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDbUpdateTime()
|
||||||
|
{
|
||||||
|
return dbUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDbUpdateTime(Date dbUpdateTime)
|
||||||
|
{
|
||||||
|
this.dbUpdateTime = dbUpdateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user