
41 changed files with 1355 additions and 170 deletions
@ -1,33 +0,0 @@ |
|||
package com.yxt.supervise.customer.api.gdinventoryok; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
@TableName("gd_inventory_log") |
|||
public class GdInventoryLog extends EntityWithId { |
|||
|
|||
public GdInventoryLog() { |
|||
} |
|||
|
|||
public GdInventoryLog(String fileFullPath) { |
|||
this.fileFullPath = fileFullPath; |
|||
} |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime = new Date(); // 记录创建时间/
|
|||
private String remarks; // 备注说明/
|
|||
private String fileFullPath; // 文件完整路径/
|
|||
private String outFilePath; // 汇总文件路径
|
|||
// private String outfile; //输出文件名
|
|||
private String fileUrl; //文件下载地址
|
|||
private int allNum; // 总记录数/
|
|||
private int validNum; // 有效记录数/
|
|||
private long durations; // 程序运行时长/
|
|||
private int errRowNum; // 出错的条数/
|
|||
private String orderDate; // 单据日期
|
|||
} |
@ -0,0 +1,129 @@ |
|||
package com.yxt.supervise.customer.biz.gdinventorylog; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@TableName("report_inventory_day_gather") |
|||
public class ReportInventoryDayGather extends EntityWithId { |
|||
|
|||
public ReportInventoryDayGather() { |
|||
} |
|||
|
|||
public ReportInventoryDayGather(String storeType) { |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
public ReportInventoryDayGather(String orderDate, String serialNumber, String reportTime, String storeType) { |
|||
this.orderDate = orderDate; |
|||
this.serialNumber = serialNumber; |
|||
this.reportTime = reportTime; |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks; // 备注说明
|
|||
private String orderDate; // 单据日期
|
|||
private String serialNumber; // 编号
|
|||
private String reportTime; // 上报时间
|
|||
private int sort = 0; // 排序
|
|||
private String storeType; // 仓库类型
|
|||
private int storeNumber = 1; // 仓库数量
|
|||
private int productCountNumber = 1; // 品种数量
|
|||
private double productAmount; // 货值
|
|||
private double countAmount; // 合计货值
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getSort() { |
|||
return sort; |
|||
} |
|||
|
|||
public void setSort(int sort) { |
|||
this.sort = sort; |
|||
} |
|||
|
|||
public String getStoreType() { |
|||
return storeType; |
|||
} |
|||
|
|||
public void setStoreType(String storeType) { |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
public int getStoreNumber() { |
|||
return storeNumber; |
|||
} |
|||
|
|||
public void setStoreNumber(int storeNumber) { |
|||
this.storeNumber = storeNumber; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
} |
@ -0,0 +1,133 @@ |
|||
package com.yxt.supervise.customer.biz.gdinventorylog; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
@TableName("report_inventory_day_store") |
|||
public class ReportInventoryDayStore extends EntityWithId { |
|||
public ReportInventoryDayStore() { |
|||
} |
|||
|
|||
public ReportInventoryDayStore(String orderDate, String storeCode, String storeCodeName) { |
|||
this.orderDate = orderDate; |
|||
this.storeCode = storeCode; |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks; // 备注说明',
|
|||
private String orderDate; // 单据日期',
|
|||
private String serialNumber; // 编号',
|
|||
private String reportTime; // 上报时间',
|
|||
private int warehouseType = 2; // 仓库类型',
|
|||
private String storeCode; // 门店编号',
|
|||
private String storeCodeName; // [门店编号]门店名称',
|
|||
private int productCountNumber; // 品种数量',
|
|||
private double productAmount; // 货值',
|
|||
private double countAmount; // 合计货值',
|
|||
private long countProductNumber; // 合计品种数量',
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getWarehouseType() { |
|||
return warehouseType; |
|||
} |
|||
|
|||
public void setWarehouseType(int warehouseType) { |
|||
this.warehouseType = warehouseType; |
|||
} |
|||
|
|||
public String getStoreCode() { |
|||
return storeCode; |
|||
} |
|||
|
|||
public void setStoreCode(String storeCode) { |
|||
this.storeCode = storeCode; |
|||
} |
|||
|
|||
public String getStoreCodeName() { |
|||
return storeCodeName; |
|||
} |
|||
|
|||
public void setStoreCodeName(String storeCodeName) { |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
|
|||
public long getCountProductNumber() { |
|||
return countProductNumber; |
|||
} |
|||
|
|||
public void setCountProductNumber(long countProductNumber) { |
|||
this.countProductNumber = countProductNumber; |
|||
} |
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.yxt.supervise.customer.biz.gdinventorylog; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@TableName("report_inventory_day_tobacco_store") |
|||
public class ReportInventoryDayTobaccoStore extends EntityWithId { |
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks ; // 备注说明
|
|||
private String orderDate ; // 单据日期
|
|||
private String serialNumber ; // 编号
|
|||
private String reportTime ; // 上报时间
|
|||
private int warehouseType=2; // 仓库类型
|
|||
private String storeCode ; // 门店编号
|
|||
private String storeCodeName ; // [门店编号]门店名称
|
|||
private int productCountNumber; // 品种数量
|
|||
private double productAmount; // 货值
|
|||
private double countAmount; // 合计货值
|
|||
private long countProductNumber; // 合计品种数量
|
|||
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getWarehouseType() { |
|||
return warehouseType; |
|||
} |
|||
|
|||
public void setWarehouseType(int warehouseType) { |
|||
this.warehouseType = warehouseType; |
|||
} |
|||
|
|||
public String getStoreCode() { |
|||
return storeCode; |
|||
} |
|||
|
|||
public void setStoreCode(String storeCode) { |
|||
this.storeCode = storeCode; |
|||
} |
|||
|
|||
public String getStoreCodeName() { |
|||
return storeCodeName; |
|||
} |
|||
|
|||
public void setStoreCodeName(String storeCodeName) { |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
|
|||
public long getCountProductNumber() { |
|||
return countProductNumber; |
|||
} |
|||
|
|||
public void setCountProductNumber(long countProductNumber) { |
|||
this.countProductNumber = countProductNumber; |
|||
} |
|||
} |
Binary file not shown.
@ -1,4 +1,129 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
public class ReportInventoryDayGather { |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@TableName("report_inventory_day_gather") |
|||
public class ReportInventoryDayGather extends EntityWithId { |
|||
|
|||
public ReportInventoryDayGather() { |
|||
} |
|||
|
|||
public ReportInventoryDayGather(String storeType) { |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
public ReportInventoryDayGather(String orderDate, String serialNumber, String reportTime, String storeType) { |
|||
this.orderDate = orderDate; |
|||
this.serialNumber = serialNumber; |
|||
this.reportTime = reportTime; |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks; // 备注说明
|
|||
private String orderDate; // 单据日期
|
|||
private String serialNumber; // 编号
|
|||
private String reportTime; // 上报时间
|
|||
private int sort = 0; // 排序
|
|||
private String storeType; // 仓库类型
|
|||
private int storeNumber = 1; // 仓库数量
|
|||
private int productCountNumber = 1; // 品种数量
|
|||
private double productAmount; // 货值
|
|||
private double countAmount; // 合计货值
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getSort() { |
|||
return sort; |
|||
} |
|||
|
|||
public void setSort(int sort) { |
|||
this.sort = sort; |
|||
} |
|||
|
|||
public String getStoreType() { |
|||
return storeType; |
|||
} |
|||
|
|||
public void setStoreType(String storeType) { |
|||
this.storeType = storeType; |
|||
} |
|||
|
|||
public int getStoreNumber() { |
|||
return storeNumber; |
|||
} |
|||
|
|||
public void setStoreNumber(int storeNumber) { |
|||
this.storeNumber = storeNumber; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,79 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Delete; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Mapper |
|||
public interface ReportInventoryDayGatherMapper extends BaseMapper<ReportInventoryDayGather> { |
|||
|
|||
@Delete("delete from report_inventory_day_gather where orderDate=#{orderDate} ") |
|||
void clearDay(@Param("orderDate") String orderDate); |
|||
|
|||
@Select("select " + |
|||
" warehouseCode, " + |
|||
" max(warehouseName) warehouseName " + |
|||
"from gd_inventory_ok gio where warehouseType=1 " + |
|||
"group by warehouseCode ") |
|||
List<Map<String, String>> warehouseList(); |
|||
|
|||
@Select("select count(1) from ( " + |
|||
"select " + |
|||
" prodCode " + |
|||
"from gd_inventory_ok gio where warehouseCode=#{warehouseCode} " + |
|||
"group by prodCode " + |
|||
") t ") |
|||
int whProduct(@Param("warehouseCode") String warehouseCode); |
|||
|
|||
@Select("select " + |
|||
" sum(prodValue) " + |
|||
"from gd_inventory_ok gio where warehouseCode=#{warehouseCode} ") |
|||
double whAmount(@Param("warehouseCode") String warehouseCode); |
|||
|
|||
@Select("select count(1) from ( " + |
|||
"select " + |
|||
" warehouseCode " + |
|||
"from gd_inventory_ok gio where warehouseType=2 " + |
|||
"group by warehouseCode " + |
|||
") t ") |
|||
int countStoreNumber(); |
|||
|
|||
@Select("select count(1) from ( " + |
|||
"select " + |
|||
" prodCode " + |
|||
"from gd_inventory_ok gio where warehouseType=2 " + |
|||
"group by prodCode " + |
|||
") t") |
|||
int countProductCountNumber(); |
|||
|
|||
@Select("select " + |
|||
" sum(prodValue) " + |
|||
"from gd_inventory_ok gio where warehouseType=2") |
|||
double countProductAmount(); |
|||
|
|||
@Select("select count(1) from ( " + |
|||
"select " + |
|||
" warehouseCode " + |
|||
"from gd_inventory_yc giy where warehouseType=2 " + |
|||
"group by warehouseCode " + |
|||
") t") |
|||
int countStoreNumberYc(); |
|||
|
|||
@Select("select count(1) from ( " + |
|||
"select " + |
|||
" prodCode " + |
|||
"from gd_inventory_yc giy where warehouseType=2 " + |
|||
"group by prodCode " + |
|||
") t") |
|||
int countProductCountNumberYc(); |
|||
|
|||
@Select("select " + |
|||
" sum(prodValue) " + |
|||
"from gd_inventory_yc giy where warehouseType=2 ") |
|||
double countProductAmountYc(); |
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class ReportInventoryDayGatherService extends ServiceImpl<ReportInventoryDayGatherMapper, ReportInventoryDayGather> { |
|||
public void clearAndBuildOfDay(String orderDate) { |
|||
baseMapper.clearDay(orderDate); |
|||
|
|||
List<ReportInventoryDayGather> whInList = new ArrayList<>(); |
|||
|
|||
double countAmount = 0.0; |
|||
String serialNumber = "" + System.currentTimeMillis(); |
|||
String reportTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"); |
|||
|
|||
List<Map<String, String>> whList = baseMapper.warehouseList(); |
|||
for (Map<String, String> map : whList) { |
|||
String warehouseCode = map.get("warehouseCode"); |
|||
String warehouseName = map.get("warehouseName"); |
|||
String type = "[" + warehouseCode + "]" + warehouseName; |
|||
ReportInventoryDayGather ridg = new ReportInventoryDayGather(orderDate, serialNumber, reportTime, type); |
|||
if ("112".equals(warehouseCode)) |
|||
ridg.setSort(9); |
|||
else if ("101".equals(warehouseCode)) |
|||
ridg.setSort(8); |
|||
else |
|||
ridg.setSort(7); |
|||
|
|||
int productCountNumber = baseMapper.whProduct(warehouseCode); |
|||
ridg.setProductCountNumber(productCountNumber); |
|||
|
|||
double productAmount = baseMapper.whAmount(warehouseCode); |
|||
ridg.setProductAmount(productAmount); |
|||
countAmount = countAmount + productAmount; |
|||
|
|||
whInList.add(ridg); |
|||
} |
|||
String type1 = "36524集团门店仓"; |
|||
ReportInventoryDayGather ridg1 = new ReportInventoryDayGather(orderDate, serialNumber, reportTime, type1); |
|||
ridg1.setSort(2); |
|||
int storeNumber = baseMapper.countStoreNumber(); |
|||
ridg1.setStoreNumber(storeNumber); |
|||
int productCountNumber = baseMapper.countProductCountNumber(); |
|||
ridg1.setProductCountNumber(productCountNumber); |
|||
double productAmount = baseMapper.countProductAmount(); |
|||
ridg1.setProductAmount(productAmount); |
|||
countAmount = countAmount + productAmount; |
|||
|
|||
whInList.add(ridg1); |
|||
|
|||
String typeYc = "36524集团门店仓"; |
|||
ReportInventoryDayGather ridgYc = new ReportInventoryDayGather(orderDate, serialNumber, reportTime, typeYc); |
|||
ridgYc.setSort(1); |
|||
int storeNumberYc = baseMapper.countStoreNumberYc(); |
|||
ridgYc.setStoreNumber(storeNumberYc); |
|||
int productCountNumberYc = baseMapper.countProductCountNumberYc(); |
|||
ridgYc.setProductCountNumber(productCountNumberYc); |
|||
double productAmountYc = baseMapper.countProductAmountYc(); |
|||
ridgYc.setProductAmount(productAmountYc); |
|||
countAmount = countAmount + productAmountYc; |
|||
|
|||
whInList.add(ridgYc); |
|||
|
|||
for (ReportInventoryDayGather ri : whInList) { |
|||
ri.setCountAmount(countAmount); |
|||
} |
|||
|
|||
super.saveBatch(whInList); |
|||
} |
|||
} |
@ -0,0 +1,133 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
|
|||
@TableName("report_inventory_day_store") |
|||
public class ReportInventoryDayStore extends EntityWithId { |
|||
public ReportInventoryDayStore() { |
|||
} |
|||
|
|||
public ReportInventoryDayStore(String orderDate, String storeCode, String storeCodeName) { |
|||
this.orderDate = orderDate; |
|||
this.storeCode = storeCode; |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks; // 备注说明',
|
|||
private String orderDate; // 单据日期',
|
|||
private String serialNumber; // 编号',
|
|||
private String reportTime; // 上报时间',
|
|||
private int warehouseType = 2; // 仓库类型',
|
|||
private String storeCode; // 门店编号',
|
|||
private String storeCodeName; // [门店编号]门店名称',
|
|||
private int productCountNumber; // 品种数量',
|
|||
private double productAmount; // 货值',
|
|||
private double countAmount; // 合计货值',
|
|||
private long countProductNumber; // 合计品种数量',
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getWarehouseType() { |
|||
return warehouseType; |
|||
} |
|||
|
|||
public void setWarehouseType(int warehouseType) { |
|||
this.warehouseType = warehouseType; |
|||
} |
|||
|
|||
public String getStoreCode() { |
|||
return storeCode; |
|||
} |
|||
|
|||
public void setStoreCode(String storeCode) { |
|||
this.storeCode = storeCode; |
|||
} |
|||
|
|||
public String getStoreCodeName() { |
|||
return storeCodeName; |
|||
} |
|||
|
|||
public void setStoreCodeName(String storeCodeName) { |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
|
|||
public long getCountProductNumber() { |
|||
return countProductNumber; |
|||
} |
|||
|
|||
public void setCountProductNumber(long countProductNumber) { |
|||
this.countProductNumber = countProductNumber; |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Delete; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface ReportInventoryDayStoreMapper extends BaseMapper<ReportInventoryDayStore> { |
|||
|
|||
@Delete("delete from report_inventory_day_store where orderDate=#{orderDate} ") |
|||
void clearDay(@Param("orderDate") String orderDate); |
|||
|
|||
@Select("select " + |
|||
" warehouseCode storeCode, " + |
|||
" max(warehouseName) storeCodeName, " + |
|||
" sum(prodNum) productCountNumber, " + |
|||
" sum(prodValue) productAmount " + |
|||
"from gd_inventory_ok gio where warehouseType=2 " + |
|||
"group by warehouseCode ") |
|||
List<ReportInventoryDayStore> listCountStore(); |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class ReportInventoryDayStoreService extends ServiceImpl<ReportInventoryDayStoreMapper, ReportInventoryDayStore> { |
|||
public void clearAndBuildOfDay(String orderDate) { |
|||
baseMapper.clearDay(orderDate); |
|||
|
|||
List<ReportInventoryDayStore> list = baseMapper.listCountStore(); |
|||
|
|||
double countAmount = 0.0; // 合计货值',
|
|||
long countProductNumber = 0; //合计品种数量',
|
|||
|
|||
for (ReportInventoryDayStore rid : list) { |
|||
rid.setOrderDate(orderDate); |
|||
countAmount = countAmount + rid.getProductAmount(); |
|||
countProductNumber = countProductNumber + rid.getProductCountNumber(); |
|||
} |
|||
for (ReportInventoryDayStore rid : list) { |
|||
rid.setCountAmount(countAmount); |
|||
rid.setCountProductNumber(countProductNumber); |
|||
} |
|||
|
|||
super.saveBatch(list); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@TableName("report_inventory_day_tobacco_store") |
|||
public class ReportInventoryDayTobaccoStore extends EntityWithId { |
|||
@JsonFormat( |
|||
pattern = "yyyy-MM-dd HH:mm:ss", |
|||
timezone = "GMT+8" |
|||
) |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
private String remarks ; // 备注说明
|
|||
private String orderDate ; // 单据日期
|
|||
private String serialNumber ; // 编号
|
|||
private String reportTime ; // 上报时间
|
|||
private int warehouseType=2; // 仓库类型
|
|||
private String storeCode ; // 门店编号
|
|||
private String storeCodeName ; // [门店编号]门店名称
|
|||
private int productCountNumber; // 品种数量
|
|||
private double productAmount; // 货值
|
|||
private double countAmount; // 合计货值
|
|||
private long countProductNumber; // 合计品种数量
|
|||
|
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getRemarks() { |
|||
return remarks; |
|||
} |
|||
|
|||
public void setRemarks(String remarks) { |
|||
this.remarks = remarks; |
|||
} |
|||
|
|||
public String getOrderDate() { |
|||
return orderDate; |
|||
} |
|||
|
|||
public void setOrderDate(String orderDate) { |
|||
this.orderDate = orderDate; |
|||
} |
|||
|
|||
public String getSerialNumber() { |
|||
return serialNumber; |
|||
} |
|||
|
|||
public void setSerialNumber(String serialNumber) { |
|||
this.serialNumber = serialNumber; |
|||
} |
|||
|
|||
public String getReportTime() { |
|||
return reportTime; |
|||
} |
|||
|
|||
public void setReportTime(String reportTime) { |
|||
this.reportTime = reportTime; |
|||
} |
|||
|
|||
public int getWarehouseType() { |
|||
return warehouseType; |
|||
} |
|||
|
|||
public void setWarehouseType(int warehouseType) { |
|||
this.warehouseType = warehouseType; |
|||
} |
|||
|
|||
public String getStoreCode() { |
|||
return storeCode; |
|||
} |
|||
|
|||
public void setStoreCode(String storeCode) { |
|||
this.storeCode = storeCode; |
|||
} |
|||
|
|||
public String getStoreCodeName() { |
|||
return storeCodeName; |
|||
} |
|||
|
|||
public void setStoreCodeName(String storeCodeName) { |
|||
this.storeCodeName = storeCodeName; |
|||
} |
|||
|
|||
public int getProductCountNumber() { |
|||
return productCountNumber; |
|||
} |
|||
|
|||
public void setProductCountNumber(int productCountNumber) { |
|||
this.productCountNumber = productCountNumber; |
|||
} |
|||
|
|||
public double getProductAmount() { |
|||
return productAmount; |
|||
} |
|||
|
|||
public void setProductAmount(double productAmount) { |
|||
this.productAmount = productAmount; |
|||
} |
|||
|
|||
public double getCountAmount() { |
|||
return countAmount; |
|||
} |
|||
|
|||
public void setCountAmount(double countAmount) { |
|||
this.countAmount = countAmount; |
|||
} |
|||
|
|||
public long getCountProductNumber() { |
|||
return countProductNumber; |
|||
} |
|||
|
|||
public void setCountProductNumber(long countProductNumber) { |
|||
this.countProductNumber = countProductNumber; |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Delete; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface ReportInventoryDayTobaccoStoreMapper extends BaseMapper<ReportInventoryDayTobaccoStore> { |
|||
|
|||
@Delete("delete from report_inventory_day_tobacco_store where orderDate=#{orderDate} ") |
|||
void clearDay(@Param("orderDate") String orderDate); |
|||
|
|||
@Select("select " + |
|||
" warehouseCode storeCode, " + |
|||
" max(warehouseName) storeCodeName, " + |
|||
" sum(prodNum) productCountNumber, " + |
|||
" sum(prodValue) productAmount " + |
|||
"from gd_inventory_yc giy where warehouseType=2 " + |
|||
"group by warehouseCode ") |
|||
List<ReportInventoryDayTobaccoStore> listCountStore(); |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class ReportInventoryDayTobaccoStoreService extends ServiceImpl<ReportInventoryDayTobaccoStoreMapper,ReportInventoryDayTobaccoStore> { |
|||
public void clearAndBuildOfDay(String orderDate) { |
|||
|
|||
baseMapper.clearDay(orderDate); |
|||
|
|||
List<ReportInventoryDayTobaccoStore> list = baseMapper.listCountStore(); |
|||
|
|||
double countAmount = 0.0; // 合计货值',
|
|||
long countProductNumber = 0; //合计品种数量',
|
|||
|
|||
for (ReportInventoryDayTobaccoStore rid : list) { |
|||
rid.setOrderDate(orderDate); |
|||
countAmount = countAmount + rid.getProductAmount(); |
|||
countProductNumber = countProductNumber + rid.getProductCountNumber(); |
|||
} |
|||
for (ReportInventoryDayTobaccoStore rid : list) { |
|||
rid.setCountAmount(countAmount); |
|||
rid.setCountProductNumber(countProductNumber); |
|||
} |
|||
|
|||
super.saveBatch(list); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class ReportInventoryService { |
|||
|
|||
@Autowired |
|||
private ReportInventoryDayGatherService reportInventoryDayGatherService; |
|||
@Autowired |
|||
private ReportInventoryDayStoreService reportInventoryDayStoreService; |
|||
@Autowired |
|||
private ReportInventoryDayTobaccoStoreService reportInventoryDayTobaccoStoreService; |
|||
|
|||
|
|||
public void buildInventoryReportByDay(String orderDate) { |
|||
reportInventoryDayGatherService.clearAndBuildOfDay(orderDate); |
|||
reportInventoryDayStoreService.clearAndBuildOfDay(orderDate); |
|||
reportInventoryDayTobaccoStoreService.clearAndBuildOfDay(orderDate); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.yxt.supervise.report.biz.reportinventory; |
|||
|
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController("com.yxt.supervise.report.biz.reportinventory.reportInventoryRest") |
|||
@RequestMapping("/reportinventory") |
|||
public class reportInventoryRest { |
|||
|
|||
@Autowired |
|||
private ReportInventoryService reportInventoryService; |
|||
|
|||
@GetMapping("/kcReport") |
|||
public ResultBean kcReport(@RequestParam("orderDate") String orderDate) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
if(StringUtils.isBlank(orderDate)){ |
|||
return rb.setMsg("数据日期不可为空"); |
|||
} |
|||
if(10!=orderDate.length()) |
|||
return rb.setMsg("数据日期格式不正确"); |
|||
|
|||
reportInventoryService.buildInventoryReportByDay(orderDate); |
|||
return rb.success(); |
|||
} |
|||
} |
Loading…
Reference in new issue