Browse Source

库存汇总

master
liupopo 2 years ago
parent
commit
cf87e68c4c
  1. 12
      docs/databases/table_create_report-inventory.sql
  2. 15
      supervise-customer-ui/src/api/supervise/gdinventorylog.js
  3. 109
      supervise-customer-ui/src/views/daydataupload/gdinventory/index.vue
  4. 4
      yxt-portal-ui/.env.development
  5. 4
      yxt-portal-ui/src/views/Home/Home.vue
  6. 4
      yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/resources/application.yml
  7. 4
      yxt_supervise/gateway/src/main/resources/application.yml
  8. 33
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/gdinventoryok/GdInventoryLog.java
  9. 15
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogMapper.java
  10. 32
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogRest.java
  11. 101
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogService.java
  12. 129
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayGather.java
  13. 133
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayStore.java
  14. 124
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayTobaccoStore.java
  15. 6
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventoryok/GdInventoryOkRest.java
  16. 49
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventoryok/GdInventoryOkService.java
  17. 2
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdsales/GdSalesRest.java
  18. 6
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application-devv.yml
  19. 3
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application-test.yml
  20. 4
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml
  21. BIN
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表模板.xlsx
  22. 6
      yxt_supervise/supervise-report/supervise-report-biz/pom.xml
  23. 2
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportcashedtoday/CsmCashReportCashedTodayMapper.java
  24. 2
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportsalesyesterday/CsmCashReportSalesYesterdayMapper.java
  25. 2
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportsalesyesterday/CsmCashReportSalesYesterdayService.java
  26. 127
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGather.java
  27. 79
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherMapper.java
  28. 77
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherService.java
  29. 133
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStore.java
  30. 25
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStoreMapper.java
  31. 31
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStoreService.java
  32. 124
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStore.java
  33. 25
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStoreMapper.java
  34. 31
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStoreService.java
  35. 25
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryService.java
  36. 30
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/reportInventoryRest.java
  37. 3
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/util/applet/WX_HttpsUtil.java
  38. 2
      yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application-devv.yml
  39. 4
      yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application-test.yml
  40. 4
      yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application.yml
  41. 4
      yxt_supervise/supervise-system/supervise-system-biz/src/main/resources/application.yml

12
docs/databases/table_create_report-inventory.sql

@ -9,6 +9,8 @@ CREATE TABLE `report_inventory_day_gather` (
`serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号', `serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号',
`reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间', `reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间',
`sort` int(11) DEFAULT 0 COMMENT '排序',
`storeType` VARCHAR(100) DEFAULT NULL COMMENT '仓库类型', `storeType` VARCHAR(100) DEFAULT NULL COMMENT '仓库类型',
`storeNumber` int(11) DEFAULT 1 COMMENT '仓库数量', `storeNumber` int(11) DEFAULT 1 COMMENT '仓库数量',
`productCountNumber` int(11) DEFAULT 1 COMMENT '品种数量', `productCountNumber` int(11) DEFAULT 1 COMMENT '品种数量',
@ -30,12 +32,13 @@ CREATE TABLE `report_inventory_day_store` (
`serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号', `serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号',
`reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间', `reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间',
`warehouseType` int(11) DEFAULT NULL COMMENT '仓库类型', `warehouseType` int(11) DEFAULT 2 COMMENT '仓库类型',
`storeCode` VARCHAR(100) DEFAULT NULL COMMENT '门店编号', `storeCode` VARCHAR(100) DEFAULT NULL COMMENT '门店编号',
`storeCodeName` VARCHAR(100) DEFAULT NULL COMMENT '[门店编号]门店名称', `storeCodeName` VARCHAR(100) DEFAULT NULL COMMENT '[门店编号]门店名称',
`productCountNumber` int(11) DEFAULT 1 COMMENT '数量', `productCountNumber` int(11) DEFAULT 0 COMMENT '品数量',
`productAmount` DOUBLE(12,2) DEFAULT 0 COMMENT '货值', `productAmount` DOUBLE(12,2) DEFAULT 0 COMMENT '货值',
`countAmount` double(12,2) DEFAULT NULL COMMENT '合计货值', `countAmount` double(12,2) DEFAULT NULL COMMENT '合计货值',
`countProductNumber` bigint(11) DEFAULT 0 COMMENT '合计品种数量',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='库存汇总表-仓库库存明细表'; ) ENGINE=InnoDB COMMENT='库存汇总表-仓库库存明细表';
@ -51,12 +54,13 @@ CREATE TABLE `report_inventory_day_tobacco_store` (
`serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号', `serialNumber` VARCHAR(100) DEFAULT NULL COMMENT '编号',
`reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间', `reportTime` VARCHAR(100) DEFAULT NULL COMMENT '上报时间',
`warehouseType` int(11) DEFAULT NULL COMMENT '仓库类型', `warehouseType` int(11) DEFAULT 2 COMMENT '仓库类型',
`storeCode` VARCHAR(100) DEFAULT NULL COMMENT '门店编号', `storeCode` VARCHAR(100) DEFAULT NULL COMMENT '门店编号',
`storeCodeName` VARCHAR(100) DEFAULT NULL COMMENT '[门店编号]门店名称', `storeCodeName` VARCHAR(100) DEFAULT NULL COMMENT '[门店编号]门店名称',
`productCountNumber` int(11) DEFAULT 1 COMMENT '品种数量', `productCountNumber` int(11) DEFAULT 0 COMMENT '品种数量',
`productAmount` DOUBLE(12,2) DEFAULT 0 COMMENT '货值', `productAmount` DOUBLE(12,2) DEFAULT 0 COMMENT '货值',
`countAmount` double(12,2) DEFAULT NULL COMMENT '合计货值', `countAmount` double(12,2) DEFAULT NULL COMMENT '合计货值',
`countProductNumber` bigint(11) DEFAULT 0 COMMENT '合计品种数量',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='库存汇总表-烟草仓库库存明细表'; ) ENGINE=InnoDB COMMENT='库存汇总表-烟草仓库库存明细表';

15
supervise-customer-ui/src/api/supervise/gdinventorylog.js

@ -55,5 +55,20 @@ export default {
method: 'post', method: 'post',
data: params data: params
}) })
},
// 创建某一天的库存报表
kcReport: function(params) {
return request({
baseURL: '/api/report',
url: '/reportinventory/kcReport',
params: params
})
},
// 创建某一天的库存报表
kcExcel: function(params) {
return request({
url: '/customer/v1/gdinventorylog/kcExcel',
params: params
})
} }
} }

109
supervise-customer-ui/src/views/daydataupload/gdinventory/index.vue

@ -85,7 +85,7 @@
<div>{{ hzResultMesssage }}</div> <div>{{ hzResultMesssage }}</div>
<div> <div>
<el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载库存汇总文件</el-button> <el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载库存汇总文件</el-button>
<!-- <el-button :disabled="!ychzFilePath" size="small" type="primary" @click="doDownloadHzYc">下载烟草汇总文件</el-button> --> <!-- <el-button :disabled="!ychzFilePath" size="small" type="primary" @click="doDownloadHzYc">下载烟草汇总文件</el-button> -->
</div> </div>
</el-card> </el-card>
</div> </div>
@ -99,6 +99,7 @@
import Pagination from '@/components/pagination' import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye' import pageye from '@/components/pagination/pageye'
import req from '@/api/supervise/gdinventorylog' import req from '@/api/supervise/gdinventorylog'
export default { export default {
name: 'DaydatauploadGdinventoryLog', name: 'DaydatauploadGdinventoryLog',
components: { components: {
@ -123,22 +124,22 @@
}, },
tableLoading: false, tableLoading: false,
dataList: [], dataList: [],
btnList: [ btnList: [{
{ type: 'primary',
type: 'primary', size: 'small',
size: 'small', icon: 'upload',
icon: 'upload', btnKey: 'showUploadXlsx',
btnKey: 'showUploadXlsx', btnLabel: '上传库存信息'
btnLabel: '上传库存信息' },
}, {
{ type: 'info',
type: 'info', size: 'small',
size: 'small', icon: 'cross',
icon: 'cross', btnKey: 'doClose',
btnKey: 'doClose', btnLabel: '关闭'
btnLabel: '关闭' }
}], ],
dialogVisible: false, dialogVisible: false,
updateAction: '/api/customer' + '/v1/gdinventoryok/uploadGdData', updateAction: '/api/customer' + '/v1/gdinventoryok/uploadGdData',
name: '库存数据导入', name: '库存数据导入',
fileList: [], fileList: [],
@ -207,19 +208,19 @@
console.log('GdinventoryLog-loadList-ee:', e) console.log('GdinventoryLog-loadList-ee:', e)
}) })
}, },
doClose() { doClose() {
this.$store.dispatch('tagsView/delView', this.$route) this.$store.dispatch('tagsView/delView', this.$route)
this.$router.go(-1) this.$router.go(-1)
}, },
showUploadXlsx() { showUploadXlsx() {
this.dialogVisible = true this.dialogVisible = true
}, },
dialogClose() { dialogClose() {
this.currentLog = {} this.currentLog = {}
this.fileList = [] this.fileList = []
this.filecandown = true this.filecandown = true
this.dialogVisible = false this.dialogVisible = false
}, },
// //
handleReturn() { handleReturn() {
this.$router.go(-1) this.$router.go(-1)
@ -246,31 +247,33 @@
console.log('222', resp) console.log('222', resp)
const rdata = resp.data const rdata = resp.data
const _this = this const _this = this
_this.fullscreenloading.text = '数据导入完成,进行汇总' _this.fullscreenloading.text = '数据导入完成,正在生成报表~'
this.fileList = []
_this.uploadResultMesssage = '共导入数据:' + rdata.allNum + ' 条;普通商品数据:' + rdata.validNum + ' 条;烟草商品数据:' + rdata.errRowNum + ' 条;用时:' + rdata.durations + ' 毫秒。' _this.uploadResultMesssage = '共导入数据:' + rdata.allNum + ' 条;普通商品数据:' + rdata.validNum + ' 条;烟草商品数据:' + rdata.errRowNum + ' 条;用时:' + rdata.durations + ' 毫秒。'
const param = {
kchz() orderDate: rdata.orderDate
}
req.kcReport(param)
.then(res => { .then(res => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
console.log('333', res) console.log('333', res)
_this.hzFilePath = res.data _this.fullscreenloading.text = '报表数据完成,创建Excel文件'
req.kcExcel({ logid: rdata.id })
.then(res => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
console.log('444', res)
_this.hzFilePath = res.data.fileUrl
})
.catch(e => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
})
}) })
.catch(e => { .catch(e => {
if (this.fullscreenloading) this.fullscreenloading.close() if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null this.fullscreenloading = null
}) })
// kchzyc()
// .then(res => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// console.log('444', res)
// _this.ychzFilePath = res.data
// })
// .catch(e => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// })
}, },
doDownloadHz() { doDownloadHz() {
window.open(this.hzFilePath, '_blank') window.open(this.hzFilePath, '_blank')
@ -291,18 +294,6 @@
}, },
doDownloadHzYc() { doDownloadHzYc() {
window.open(this.ychzFilePath, '_blank') window.open(this.ychzFilePath, '_blank')
},
resetCache() {
resetAllCache()
.then(res => {
this.$message({
message: '缓存数据已重置!',
type: 'success'
})
})
.catch(e => {
console.log('resetAllCache', e)
})
} }
} }
} }

4
yxt-portal-ui/.env.development

@ -5,5 +5,5 @@ ENV = 'development'
VUE_APP_BASE_API = '/api' VUE_APP_BASE_API = '/api'
## 配置测试和本地开发时的 接口地址 ## 配置测试和本地开发时的 接口地址
# VUE_APP_URL = "http://127.0.0.1:8112" VUE_APP_URL = "http://127.0.0.1:8112"
VUE_APP_URL = "http://8.130.39.13:8112" # VUE_APP_URL = "http://8.130.39.13:8112"

4
yxt-portal-ui/src/views/Home/Home.vue

@ -440,8 +440,8 @@
if (index === 11) { if (index === 11) {
window.open('/#/index', '_blank') window.open('/#/index', '_blank')
} else if (index === 0) { } else if (index === 0) {
// window.open('http://127.0.0.1:9531/#/' + '?token=' + getStorage(), '_blank') window.open('http://127.0.0.1:9531/#/' + '?token=' + getStorage(), '_blank')
window.open('http://jianguan.yyundong.com/customer/#/' + '?token=' + getStorage(), '_blank') // window.open('http://jianguan.yyundong.com/customer/#/' + '?token=' + getStorage(), '_blank')
} else if (index === 1) { } else if (index === 1) {
// window.open('http://192.168.3.8:9531#/' + '?token=' + getStorage(), '_blank') // window.open('http://192.168.3.8:9531#/' + '?token=' + getStorage(), '_blank')
window.open('http://jianguan.yyundong.com/report/#/' + '?token=' + getStorage(), '_blank') window.open('http://jianguan.yyundong.com/report/#/' + '?token=' + getStorage(), '_blank')

4
yxt-supervise-cyf/yxt-supervise-cyf-biz/src/main/resources/application.yml

@ -2,8 +2,8 @@ spring:
application: application:
name: yxt-supervise-cyf name: yxt-supervise-cyf
profiles: profiles:
active: devv # active: devv
# active: test active: test
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages

4
yxt_supervise/gateway/src/main/resources/application.yml

@ -12,8 +12,8 @@ spring:
application: application:
name: gateway-server name: gateway-server
profiles: profiles:
# active: devv active: devv
active: test # active: test
cloud: cloud:
gateway: gateway:
routes: routes:

33
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/gdinventoryok/GdInventoryLog.java

@ -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; // 单据日期
}

15
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogMapper.java

@ -2,11 +2,13 @@ package com.yxt.supervise.customer.biz.gdinventorylog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxt.supervise.customer.api.gdinstoragelog.GdInstorageLog; import com.yxt.supervise.customer.api.gdinstoragelog.GdInstorageLog;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryLog; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* @author wangpengfei * @author wangpengfei
* @date 2023/3/29 13:57 * @date 2023/3/29 13:57
@ -14,5 +16,14 @@ import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface GdInventoryLogMapper extends BaseMapper<GdInventoryLog> { public interface GdInventoryLogMapper extends BaseMapper<GdInventoryLog> {
@Select("select * from gd_inventory_log where orderDate=#{orderDate}") @Select("select * from gd_inventory_log where orderDate=#{orderDate}")
public GdInstorageLog getLogByOrderDate(@Param("oderDate") String orderDate); public GdInstorageLog getLogByOrderDate(@Param("orderDate") String orderDate);
@Select("select * from report_inventory_day_gather where orderDate=#{orderDate} order by sort desc")
List<ReportInventoryDayGather> reportInventoryDayGather(@Param("orderDate") String orderDate);
@Select("select * from report_inventory_day_store where orderDate=#{orderDate} ")
List<ReportInventoryDayStore> reportInventoryDayStore(@Param("orderDate") String orderDate);
@Select("select * from report_inventory_day_tobacco_store where orderDate=#{orderDate} ")
List<ReportInventoryDayTobaccoStore> reportInventoryDayTobaccoStore(@Param("orderDate") String orderDate);
} }

32
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogRest.java

@ -1,28 +1,15 @@
package com.yxt.supervise.customer.biz.gdinventorylog; package com.yxt.supervise.customer.biz.gdinventorylog;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdinstoragegd.*;
import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLogQuery; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLogQuery;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryLog; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import com.yxt.supervise.customer.api.gdsales.GdSales;
import com.yxt.supervise.customer.api.gdsales.GdSalesQuery;
import com.yxt.supervise.customer.api.gdsales.GdSalesVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/** /**
* @author wangpengfei * @author wangpengfei
@ -43,4 +30,17 @@ public class GdInventoryLogRest {
IPage<GdInventoryLog> pv = gdInventoryLogService.listPage(pq); IPage<GdInventoryLog> pv = gdInventoryLogService.listPage(pq);
return rb.success().setData(pv); return rb.success().setData(pv);
} }
@GetMapping("/kcExcel")
public ResultBean<GdInventoryLog> kcExcel(@RequestParam("logid") String logid) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(logid)) {
return rb.setMsg("上传日志SID不可为空");
}
GdInventoryLog log = gdInventoryLogService.buildExcelById(logid);
if (log == null)
return rb.setMsg("未得到上传日志");
return rb.success().setData(log);
}
} }

101
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogService.java

@ -1,6 +1,9 @@
package com.yxt.supervise.customer.biz.gdinventorylog; package com.yxt.supervise.customer.biz.gdinventorylog;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -8,10 +11,16 @@ import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.supervise.customer.api.gdinstoragelog.GdInstorageLog; import com.yxt.supervise.customer.api.gdinstoragelog.GdInstorageLog;
import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLogQuery; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLogQuery;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryLog; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* @author wangpengfei * @author wangpengfei
* @date 2023/3/29 14:00 * @date 2023/3/29 14:00
@ -19,6 +28,14 @@ import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@Service @Service
public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdInventoryLog> { public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdInventoryLog> {
@Value("${image.upload.path:static/upload/}")
private String uploadPath;
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
private String urlPrefix;
@Value("${image.xlsxtmpl:static/upload/}")
private String xlsxtmplPath;
public GdInstorageLog getLogByOrderDate(String orderDate) { public GdInstorageLog getLogByOrderDate(String orderDate) {
//GdRukuQuery query = pq.getParams(); //GdRukuQuery query = pq.getParams();
return baseMapper.getLogByOrderDate(orderDate); return baseMapper.getLogByOrderDate(orderDate);
@ -33,11 +50,91 @@ public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdI
if (StrUtil.isNotBlank(params.getDataDateEnd())) { if (StrUtil.isNotBlank(params.getDataDateEnd())) {
qw.le("orderDate", params.getDataDateEnd()); qw.le("orderDate", params.getDataDateEnd());
} }
qw.orderByDesc("orderDate","createTime"); qw.orderByDesc("orderDate", "createTime");
IPage<GdInventoryLog> iPage = PagerUtil.queryToPage(pq); IPage<GdInventoryLog> iPage = PagerUtil.queryToPage(pq);
IPage<GdInventoryLog> page = baseMapper.selectPage(iPage, qw); IPage<GdInventoryLog> page = baseMapper.selectPage(iPage, qw);
return page; return page;
} }
public GdInventoryLog buildExcelById(String logsid) {
GdInventoryLog gdInventoryLog = baseMapper.selectById(logsid);
if (gdInventoryLog == null)
return null;
String orderDate = gdInventoryLog.getOrderDate();
String xlsxpath = xlsxtmplPath + "库存汇总表模板.xlsx";
File srcFile = FileUtil.file(xlsxpath);
String tfile = "kchzb/库存汇总表" + orderDate + ".xlsx";
String url = urlPrefix + tfile;
String toFileName = uploadPath + tfile;
File file = FileUtil.file(toFileName);
FileUtil.copy(srcFile, file, true);
ExcelWriter writer = ExcelUtil.getWriter(file);
List<ReportInventoryDayGather> gatherList = baseMapper.reportInventoryDayGather(orderDate);
if (gatherList != null && !gatherList.isEmpty()) {
ReportInventoryDayGather gather = gatherList.get(0);
// 库存汇总日报表
writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:" + gather.getSerialNumber());
writer.writeCellValue(3, 1, gather.getReportTime());
int countRow = gatherList.size() + 3;
for (int y = 3; y < countRow; y++) {
ReportInventoryDayGather map = gatherList.get(y - 3);
writer.writeCellValue(0, y, map.getStoreType());
writer.writeCellValue(1, y, map.getStoreNumber());
writer.writeCellValue(2, y, map.getProductCountNumber());
writer.writeCellValue(3, y, map.getProductAmount());
}
writer.writeCellValue(0, countRow, "合计");
writer.writeCellValue(3, countRow, gather.getCountAmount());
}
List<ReportInventoryDayStore> storeList = baseMapper.reportInventoryDayStore(orderDate);
if (storeList != null && !storeList.isEmpty()) {
ReportInventoryDayStore store = storeList.get(0);
// 仓库库存明细表
writer.setSheet(1);
int countRow = storeList.size() + 1;
for (int y = 1; y < countRow; y++) {
ReportInventoryDayStore map = storeList.get(y - 1);
writer.writeCellValue(0, y, map.getStoreCodeName());
writer.writeCellValue(1, y, map.getProductCountNumber());
writer.writeCellValue(2, y, map.getProductAmount());
}
writer.writeCellValue(0, countRow, "总计");
writer.writeCellValue(1, countRow, store.getCountProductNumber());
writer.writeCellValue(2, countRow, store.getCountAmount());
}
List<ReportInventoryDayTobaccoStore> ycList = baseMapper.reportInventoryDayTobaccoStore(orderDate);
if (ycList != null && !ycList.isEmpty()) {
ReportInventoryDayTobaccoStore store = ycList.get(0);
// 烟草仓库库存明细表
writer.setSheet(2);
int countRow = ycList.size() + 1;
for (int y = 1; y < countRow; y++) {
ReportInventoryDayTobaccoStore map = ycList.get(y - 1);
writer.writeCellValue(0, y, map.getStoreCodeName());
writer.writeCellValue(1, y, map.getProductCountNumber());
writer.writeCellValue(2, y, map.getProductAmount());
}
writer.writeCellValue(0, countRow, "总计");
writer.writeCellValue(1, countRow, store.getCountProductNumber());
writer.writeCellValue(2, countRow, store.getCountAmount());
}
writer.flush();
writer.close();
gdInventoryLog.setFileFullPath(tfile);
gdInventoryLog.setFileUrl(url);
baseMapper.updateById(gdInventoryLog);
return gdInventoryLog;
}
} }

129
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayGather.java

@ -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;
}
}

133
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayStore.java

@ -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;
}
}

124
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/ReportInventoryDayTobaccoStore.java

@ -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;
}
}

6
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventoryok/GdInventoryOkRest.java

@ -4,17 +4,13 @@ import com.alibaba.excel.EasyExcel;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import com.yxt.supervise.customer.api.gdinventoryok.*; import com.yxt.supervise.customer.api.gdinventoryok.*;
import com.yxt.supervise.customer.api.gdsales.GdSales;
import com.yxt.supervise.customer.api.gdsales.GdSalesExcelVo;
import com.yxt.supervise.customer.api.gdsales.GdSalesQuery;
import com.yxt.supervise.customer.api.gdsales.GdSalesVo;
import com.yxt.supervise.customer.biz.gdinstoragegd.GdInstorageGdService; import com.yxt.supervise.customer.biz.gdinstoragegd.GdInstorageGdService;
import com.yxt.supervise.customer.biz.gdinstoragelog.GdInstorageLogService; import com.yxt.supervise.customer.biz.gdinstoragelog.GdInstorageLogService;
import com.yxt.supervise.customer.biz.gdinventorylog.GdInventoryLogService; import com.yxt.supervise.customer.biz.gdinventorylog.GdInventoryLogService;
import com.yxt.supervise.customer.biz.gdinventoryyc.GdInventoryYcService; import com.yxt.supervise.customer.biz.gdinventoryyc.GdInventoryYcService;
import com.yxt.supervise.customer.biz.gdsaleslog.GdSalesLogService; import com.yxt.supervise.customer.biz.gdsaleslog.GdSalesLogService;
//import com.yxt.supervise.customer.kafka.messageproducer.MessageProducerRest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

49
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventoryok/GdInventoryOkService.java

@ -1,19 +1,15 @@
package com.yxt.supervise.customer.biz.gdinventoryok; package com.yxt.supervise.customer.biz.gdinventoryok;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.sax.handler.RowHandler;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.builder.ExcelReaderBuilder; import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.excel.read.listener.ReadListener; import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.base.config.component.FileUploadComponent;
@ -23,31 +19,22 @@ import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.FileUploadResult; import com.yxt.common.core.result.FileUploadResult;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdinventorylogerr.GdInventoryLogErr; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import com.yxt.supervise.customer.api.gdinventoryok.*; import com.yxt.supervise.customer.api.gdinventoryok.*;
import com.yxt.supervise.customer.api.gdinventoryyc.GdInventoryYc; import com.yxt.supervise.customer.api.gdinventoryyc.GdInventoryYc;
import com.yxt.supervise.customer.api.gdsales.GdSales;
import com.yxt.supervise.customer.api.gdsales.GdSalesExcelVo;
import com.yxt.supervise.customer.api.gdsales.GdSalesQuery;
import com.yxt.supervise.customer.api.gdsales.GdSalesVo;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisition;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionPro;
import com.yxt.supervise.customer.biz.gdinventorylog.GdInventoryLogService; import com.yxt.supervise.customer.biz.gdinventorylog.GdInventoryLogService;
import com.yxt.supervise.customer.biz.gdinventorylogerr.GdInventoryLogErrService; import com.yxt.supervise.customer.biz.gdinventorylogerr.GdInventoryLogErrService;
import com.yxt.supervise.customer.biz.gdinventoryyc.GdInventoryYcService; import com.yxt.supervise.customer.biz.gdinventoryyc.GdInventoryYcService;
import com.yxt.supervise.customer.biz.gdrescategoryprod.GdRescategoryProdService; import com.yxt.supervise.customer.biz.gdrescategoryprod.GdRescategoryProdService;
import com.yxt.supervise.customer.biz.storeindex.StoreIndexService; import com.yxt.supervise.customer.biz.storeindex.StoreIndexService;
import com.yxt.supervise.customer.biz.storeinfo.StoreInfoService; import com.yxt.supervise.customer.biz.storeinfo.StoreInfoService;
import com.yxt.supervise.customer.tools.StrTool;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
/** /**
@ -156,7 +143,7 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
baseMapper.clearData(); baseMapper.clearData();
// gdInventoryYcService.clearData(); gdInventoryYcService.clearData();
GdInventoryLog gdlog = new GdInventoryLog(fp); GdInventoryLog gdlog = new GdInventoryLog(fp);
ExcelReaderBuilder read = EasyExcel.read(fp, GdInventoryOk.class, createReadListener(gdlog)); ExcelReaderBuilder read = EasyExcel.read(fp, GdInventoryOk.class, createReadListener(gdlog));
read.sheet().doRead(); read.sheet().doRead();
@ -175,6 +162,7 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
private String odate = null; private String odate = null;
private static final int BATCH_COUNT = 900; private static final int BATCH_COUNT = 900;
private List<GdInventoryOk> toInsertList = new ArrayList<>(); private List<GdInventoryOk> toInsertList = new ArrayList<>();
private List<GdInventoryYc> toInsertListYc = new ArrayList<>();
private boolean checkYcProd(String typeCode) { private boolean checkYcProd(String typeCode) {
if (StrUtil.isBlank(typeCode)) if (StrUtil.isBlank(typeCode))
@ -184,6 +172,7 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
String subCode = typeCode.substring(0, 4); String subCode = typeCode.substring(0, 4);
return "0811".equals(subCode) || "0813".equals(subCode) || "0815".equals(subCode); return "0811".equals(subCode) || "0813".equals(subCode) || "0815".equals(subCode);
} }
@Override @Override
public void invoke(GdInventoryOk obj, AnalysisContext analysisContext) { public void invoke(GdInventoryOk obj, AnalysisContext analysisContext) {
if (StringUtils.isNotBlank(obj.getWarehouseCode())) { if (StringUtils.isNotBlank(obj.getWarehouseCode())) {
@ -192,18 +181,25 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
odate = obj.getDataDate(); odate = obj.getDataDate();
gdlog.setOrderDate(odate); gdlog.setOrderDate(odate);
} }
if(checkYcProd(obj.getTypeCode())){ if (checkYcProd(obj.getTypeCode())) {
y++; y++;
}else{ GdInventoryYc objYc = new GdInventoryYc();
BeanUtil.copyProperties(obj, objYc);
toInsertListYc.add(objYc);
if (toInsertListYc.size() >= BATCH_COUNT) {
gdInventoryYcService.saveBatch(toInsertListYc);
// 存储完成清理 list
toInsertListYc.clear();
}
} else {
z++; z++;
} toInsertList.add(obj);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
toInsertList.add(obj); if (toInsertList.size() >= BATCH_COUNT) {
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM GdInventoryOkService.this.saveBatch(toInsertList);
if (toInsertList.size() >= BATCH_COUNT) { // 存储完成清理 list
GdInventoryOkService.this.saveBatch(toInsertList); toInsertList.clear();
// 存储完成清理 list }
toInsertList.clear();;
} }
} }
} }
@ -214,6 +210,9 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
if (toInsertList != null && !toInsertList.isEmpty()) { if (toInsertList != null && !toInsertList.isEmpty()) {
GdInventoryOkService.this.saveBatch(toInsertList); GdInventoryOkService.this.saveBatch(toInsertList);
} }
if (toInsertListYc != null && !toInsertListYc.isEmpty()) {
gdInventoryYcService.saveBatch(toInsertListYc);
}
gdlog.setAllNum(x); gdlog.setAllNum(x);
gdlog.setValidNum(z); gdlog.setValidNum(z);
gdlog.setErrRowNum(y); gdlog.setErrRowNum(y);

2
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdsales/GdSalesRest.java

@ -11,7 +11,7 @@ import com.yxt.common.base.utils.ExportExcelUtils;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryLog; import com.yxt.supervise.customer.api.gdinventorylog.GdInventoryLog;
import com.yxt.supervise.customer.api.gdsales.*; import com.yxt.supervise.customer.api.gdsales.*;
import com.yxt.supervise.customer.api.gdsaleslog.GdSalesLog; import com.yxt.supervise.customer.api.gdsaleslog.GdSalesLog;
import com.yxt.supervise.customer.biz.gdinstoragegd.GdInstorageGdService; import com.yxt.supervise.customer.biz.gdinstoragegd.GdInstorageGdService;

6
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application-devv.yml

@ -22,10 +22,10 @@ spring:
timeout: 0 # 连接超时时间(毫秒) timeout: 0 # 连接超时时间(毫秒)
image: image:
xlsxtmpl: D:/works/projects/yxt/yxtgit/supervise/yxt_supervise/supervise-portal/supervise-portal-biz/target/classes/xlsx-tmpl/ xlsxtmpl: D:/works/projects/yxt/yxtgit/supervise/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/
upload: upload:
path: D:/works/projects/yxt/yxtgit/supervise/yxt_supervise/supervise-portal/supervise-portal-biz/target/classes/static/upload/ path: D:/works/projects/yxt/yxtgit/supervise/yxt_supervise/supervise-customer/supervise-customer-biz/target/classes/static/upload/
url: url:
prefix: http://127.0.0.1:7003/upload/ prefix: http://127.0.0.1:7005/upload/

3
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application-test.yml

@ -22,9 +22,12 @@ spring:
timeout: 0 # 连接超时时间(毫秒) timeout: 0 # 连接超时时间(毫秒)
image: image:
xlsxtmpl: D:/webapps/supervise/xlsx-tmpl/
upload: upload:
path: D:/webapps/supervise/static/upload/ path: D:/webapps/supervise/static/upload/
url: url:
prefix: http://8.130.39.13:7003/upload/ prefix: http://8.130.39.13:7003/upload/
login:
path: D:\\images\\pic-click

4
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml

@ -13,8 +13,8 @@ spring:
# brokers: localhost:9092 #kafka的网络位置 # brokers: localhost:9092 #kafka的网络位置
# auto-create-topics: true # auto-create-topics: true
profiles: profiles:
active: devv # active: devv
# active: test active: test
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages

BIN
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表模板.xlsx

Binary file not shown.

6
yxt_supervise/supervise-report/supervise-report-biz/pom.xml

@ -86,6 +86,12 @@
<artifactId>fastcsv</artifactId> <artifactId>fastcsv</artifactId>
<version>2.2.1</version> <version>2.2.1</version>
</dependency> </dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<classifier>jdk15</classifier>
<version>2.4</version>
</dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>--> <!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-stream-binder-kafka</artifactId>--> <!-- <artifactId>spring-cloud-stream-binder-kafka</artifactId>-->

2
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportcashedtoday/CsmCashReportCashedTodayMapper.java

@ -2,10 +2,12 @@ package com.yxt.supervise.report.biz.csmcashreportcashedtoday;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxt.supervise.report.api.csmcashreportcashedtoday.CsmCashReportCashedToday; import com.yxt.supervise.report.api.csmcashreportcashedtoday.CsmCashReportCashedToday;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author wangpengfei * @author wangpengfei
* @date 2023/6/21 10:56 * @date 2023/6/21 10:56
*/ */
@Mapper
public interface CsmCashReportCashedTodayMapper extends BaseMapper<CsmCashReportCashedToday> { public interface CsmCashReportCashedTodayMapper extends BaseMapper<CsmCashReportCashedToday> {
} }

2
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportsalesyesterday/CsmCashReportSalesYesterdayMapper.java

@ -2,10 +2,12 @@ package com.yxt.supervise.report.biz.csmcashreportsalesyesterday;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxt.supervise.report.api.csmcashreportsalesyesterday.CsmCashReportSalesYesterday; import com.yxt.supervise.report.api.csmcashreportsalesyesterday.CsmCashReportSalesYesterday;
import org.apache.ibatis.annotations.Mapper;
/** /**
* @author wangpengfei * @author wangpengfei
* @date 2023/6/21 10:57 * @date 2023/6/21 10:57
*/ */
@Mapper
public interface CsmCashReportSalesYesterdayMapper extends BaseMapper<CsmCashReportSalesYesterday> { public interface CsmCashReportSalesYesterdayMapper extends BaseMapper<CsmCashReportSalesYesterday> {
} }

2
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/csmcashreportsalesyesterday/CsmCashReportSalesYesterdayService.java

@ -5,11 +5,13 @@ import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.supervise.report.api.csmcashreportcashedtoday.CsmCashReportCashedTodayDto; import com.yxt.supervise.report.api.csmcashreportcashedtoday.CsmCashReportCashedTodayDto;
import com.yxt.supervise.report.api.csmcashreportsalesyesterday.CsmCashReportSalesYesterday; import com.yxt.supervise.report.api.csmcashreportsalesyesterday.CsmCashReportSalesYesterday;
import org.springframework.stereotype.Service;
/** /**
* @author wangpengfei * @author wangpengfei
* @date 2023/6/21 10:57 * @date 2023/6/21 10:57
*/ */
@Service
public class CsmCashReportSalesYesterdayService extends MybatisBaseService<CsmCashReportSalesYesterdayMapper, CsmCashReportSalesYesterday> { public class CsmCashReportSalesYesterdayService extends MybatisBaseService<CsmCashReportSalesYesterdayMapper, CsmCashReportSalesYesterday> {
public ResultBean save(CsmCashReportCashedTodayDto dto) { public ResultBean save(CsmCashReportCashedTodayDto dto) {
ResultBean rb=new ResultBean(); ResultBean rb=new ResultBean();

127
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGather.java

@ -1,4 +1,129 @@
package com.yxt.supervise.report.biz.reportinventory; 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;
}
} }

79
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherMapper.java

@ -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();
}

77
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherService.java

@ -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);
}
}

133
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStore.java

@ -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;
}
}

25
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStoreMapper.java

@ -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();
}

31
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayStoreService.java

@ -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);
}
}

124
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStore.java

@ -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;
}
}

25
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStoreMapper.java

@ -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();
}

31
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayTobaccoStoreService.java

@ -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);
}
}

25
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryService.java

@ -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);
}
}

30
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/reportInventoryRest.java

@ -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();
}
}

3
yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/util/applet/WX_HttpsUtil.java

@ -1,7 +1,6 @@
package com.yxt.supervise.report.biz.util.applet; package com.yxt.supervise.report.biz.util.applet;
import com.yxt.supervise.report.biz.util.MyX509TrustManager;
import com.yxt.supervise.customer.biz.util.MyX509TrustManager;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

2
yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application-devv.yml

@ -3,7 +3,7 @@ spring:
hikari: hikari:
max-lifetime: 500000 max-lifetime: 500000
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/supervise_report?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true url: jdbc:mysql://127.0.0.1:3306/supervise_supplychain?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
username: root username: root
password: root password: root
cloud: cloud:

4
yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application-test.yml

@ -1,8 +1,8 @@
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://122.14.222.186:3306/supervise_crm?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true # url: jdbc:mysql://122.14.222.186:3306/supervise_report?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
url: jdbc:mysql://127.0.0.1:3306/supervise_report?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true url: jdbc:mysql://127.0.0.1:3306/supervise_supplychain?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
username: root username: root
password: 1LAiGz$t1*Iw password: 1LAiGz$t1*Iw
cloud: cloud:

4
yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application.yml

@ -15,8 +15,8 @@ spring:
# brokers: localhost:9092 #kafka的网络位置 # brokers: localhost:9092 #kafka的网络位置
# auto-create-topics: true # auto-create-topics: true
profiles: profiles:
active: devv # active: devv
# active: test active: test
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages

4
yxt_supervise/supervise-system/supervise-system-biz/src/main/resources/application.yml

@ -2,8 +2,8 @@ spring:
application: application:
name: supervise-system name: supervise-system
profiles: profiles:
# active: devv active: devv
active: test # active: test
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages

Loading…
Cancel
Save