liupopo 2 years ago
parent
commit
4e8024e681
  1. 2
      docs/databases/data_modify/data_modify-gd_inventory_log.sql
  2. 2
      docs/databases/table_modify/table_modify-supervise_supplychain.sql
  3. 2
      supervise-customer-ui/.env.development
  4. 71
      supervise-customer-ui/src/views/daydataupload/gdinventory/index.vue
  5. 16
      yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/src/layout/components/Navbar.vue
  6. 2
      yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/src/settings.js
  7. 2
      yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/vue.config.js
  8. 5
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/gdinventorylog/GdInventoryLog.java
  9. 14
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventorylog/GdInventoryLogService.java
  10. 166
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/gdinventoryok/GdInventoryOkService.java
  11. 19
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/feign/report/ReportInventoryFeign.java
  12. 18
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml
  13. 4
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/application.yml
  14. 5
      yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/reportinventory/ReportInventoryDayGatherService.java
  15. 18
      yxt_supervise/supervise-report/supervise-report-biz/src/main/resources/application.yml

2
docs/databases/data_modify/data_modify-gd_inventory_log.sql

@ -0,0 +1,2 @@
update gd_inventory_log set outFilePath='test',state=4,fileUrl=CONCAT(CONCAT('http://8.130.39.13:7003/upload/kchzb/库存汇总表',orderDate),'.xlsx') where state=0 and orderDate is not null and orderDate<>''

2
docs/databases/table_modify/table_modify-supervise_supplychain.sql

@ -0,0 +1,2 @@
ALTER TABLE supervise_supplychain.gd_inventory_log ADD state int(11) default 0 COMMENT '当前状态:0:未上传;1:上传完成正导入数据库;2:导入完成创建报表;3:报表完成创建Excel;4:完成';
ALTER TABLE supervise_supplychain.gd_inventory_log ADD sid varchar(100) NULL;

2
supervise-customer-ui/.env.development

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

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

@ -35,7 +35,11 @@
<el-table-column prop="errRowNum" label="烟草商品数" align="center" width="200" />
<el-table-column label="操作" wid align="center">
<template slot-scope="scope">
<el-button type="text" @click="toRelevancy(scope.row)">下载库存日报表</el-button>
<div v-if="scope.row.state==1"><el-tag type="info">正在导入数据库...</el-tag><el-button type="text" icon="el-icon-refresh" style="margin-left: 5px;" @click="loadList()"></el-button></div>
<div v-else-if="scope.row.state==2"><el-tag type="warning">正在创建报表...</el-tag><el-button type="text" icon="el-icon-refresh" style="margin-left: 5px;" @click="loadList()"></el-button></div>
<div v-else-if="scope.row.state==3"><el-tag type="success">正在生成Excel...</el-tag><el-button type="text" icon="el-icon-refresh" style="margin-left: 5px;" @click="loadList()"></el-button></div>
<el-button v-else-if="scope.row.state==4&&scope.row.fileUrl.length>1" type="text" @click="toDownload(scope.row)">下载库存日报表</el-button>
<div v-else>没有报表文件</div>
</template>
</el-table-column>
</el-table>
@ -247,33 +251,46 @@
console.log('222', resp)
const rdata = resp.data
const _this = this
_this.fullscreenloading.text = '数据导入完成,正在生成报表~'
this.fileList = []
_this.uploadResultMesssage = '共导入数据:' + rdata.allNum + ' 条;普通商品数据:' + rdata.validNum + ' 条;烟草商品数据:' + rdata.errRowNum + ' 条;用时:' + rdata.durations + ' 毫秒。'
const param = {
orderDate: rdata.orderDate
}
req.kcReport(param)
.then(res => {
console.log('333', res)
_this.fullscreenloading.text = '报表数据完成,创建Excel文件'
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
_this.uploadResultMesssage = '文件上传完成,正在进行数据整理~'
_this.loadList()
setTimeout(function() {
_this.dialogClose()
}, 3000)
// _this.fullscreenloading.text = '~'
// this.fileList = []
// _this.uploadResultMesssage = '' + rdata.allNum + ' ' + rdata.validNum + ' ' + rdata.errRowNum + ' ' + rdata.durations + ' '
// const param = {
// orderDate: rdata.orderDate
// }
// req.kcReport(param)
// .then(res => {
// console.log('333', res)
// _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 => {
if (this.fullscreenloading) this.fullscreenloading.close()
this.fullscreenloading = null
})
// 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 => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// })
},
toDownload(row) {
console.log('lll', row)
if (row.fileUrl) {
window.open(row.fileUrl, '_blank')
}
},
doDownloadHz() {
window.open(this.hzFilePath, '_blank')

16
yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/src/layout/components/Navbar.vue

@ -1,17 +1,17 @@
<template>
<div>
<div class="navbar">
<p class="breadcrumb-container"><img src="@/assets/loginImg/logo.png" style="width: 45px;height: 45px;margin-right: 10px;"/>汇融云贷后监管平台</p>
<!-- <h3 class="breadcrumb-container">汇融银行供应链贷后监管平台</h3> -->
<p class="breadcrumb-container"><img src="@/assets/loginImg/logo.png" style="width: 45px;height: 45px;margin-right: 10px;">汇融云贷后监管平台</p>
<!-- <h3 class="breadcrumb-container">汇融银行供应链贷后监管平台</h3> -->
<div class="right-menu">
<!-- <p>{{Orgname}} {{departmentName}} 欢迎, {{name}}</p>-->
<p>欢迎您{{name}}</p>
<!-- <p>{{Orgname}} {{departmentName}} 欢迎, {{name}}</p>-->
<p>欢迎您{{ name }}</p>
<img src="@/assets/images/info.png">
<!-- <img src="@/assets/images/dy.png" @click="logout"> -->
<span class="backToHome" @click="logout"><i class="el-icon-back"></i>返回首页</span>
<span class="backToHome" @click="logout"><i class="el-icon-back" />返回首页</span>
</div>
</div>
<el-footer class="footer" height="40px">Copyright © {{ year }} 汇融云贷后监管平台 All Rights Reserved</el-footer>
<el-footer class="footer" height="40px">Copyright © {{ year }} 汇融云贷后监管平台 All Rights Reserved</el-footer>
</div>
</template>
@ -22,8 +22,8 @@
Orgname: '',
departmentName: '',
name: '',
year:'',
pNameAndDepartmentNameAndPostName:''
year: '',
pNameAndDepartmentNameAndPostName: ''
}
},
mounted() {

2
yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/src/settings.js

@ -1,6 +1,6 @@
module.exports = {
title: '汇融云眼后监管平台',
title: '汇融云眼后监管平台',
/**
* @type {boolean} true | false

2
yxt-supervise-dbcenter/yxt-supervise-dbcenter-ui/vue.config.js

@ -6,7 +6,7 @@ function resolve(dir) {
return path.join(__dirname, dir)
}
const name = defaultSettings.title || '汇融云贷后监管平台' // page title
const name = defaultSettings.title || '汇融云贷后监管平台' // page title
// 如果端口设置为80,
// 使用管理员权限执行命令行。

5
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/gdinventorylog/GdInventoryLog.java

@ -1,5 +1,7 @@
package com.yxt.supervise.customer.api.gdinventorylog;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yxt.common.core.domain.EntityWithId;
@ -34,4 +36,7 @@ public class GdInventoryLog extends EntityWithId {
private long durations; // 程序运行时长/
private int errRowNum; // 出错的条数/
private String orderDate; // 单据日期
private String sid = IdUtil.fastSimpleUUID();
private int state = 0;
}

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

@ -58,6 +58,7 @@ public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdI
}
public GdInventoryLog buildExcelById(String logsid) {
long millis = System.currentTimeMillis();
GdInventoryLog gdInventoryLog = baseMapper.selectById(logsid);
if (gdInventoryLog == null)
return null;
@ -90,6 +91,8 @@ public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdI
writer.writeCellValue(3, y, map.getProductAmount());
}
writer.writeCellValue(0, countRow, "合计");
writer.writeCellValue(1, countRow, "");
writer.writeCellValue(2, countRow, "");
writer.writeCellValue(3, countRow, gather.getCountAmount());
}
@ -130,11 +133,20 @@ public class GdInventoryLogService extends ServiceImpl<GdInventoryLogMapper, GdI
writer.flush();
writer.close();
gdInventoryLog.setFileFullPath(tfile);
gdInventoryLog.setOutFilePath(tfile);
gdInventoryLog.setFileUrl(url);
gdInventoryLog.setState(4);
gdInventoryLog.setRemarks(gdInventoryLog.getRemarks() + ";创建Excel用时:" + (System.currentTimeMillis() - millis));
baseMapper.updateById(gdInventoryLog);
return gdInventoryLog;
}
public GdInventoryLog fetchByFileFullPath(String fp) {
QueryWrapper<GdInventoryLog> qw = new QueryWrapper<>();
qw.eq("fileFullPath", fp);
return baseMapper.selectOne(qw);
}
}

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

@ -3,9 +3,11 @@ package com.yxt.supervise.customer.biz.gdinventoryok;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.poi.excel.sax.handler.RowHandler;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
@ -20,7 +22,10 @@ import com.yxt.common.core.result.FileUploadResult;
import com.yxt.common.core.result.ResultBean;
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.GdInventoryOk;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryOkExcelVo;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryOkQuery;
import com.yxt.supervise.customer.api.gdinventoryok.GdInventoryOkVo;
import com.yxt.supervise.customer.api.gdinventoryyc.GdInventoryYc;
import com.yxt.supervise.customer.biz.gdinventorylog.GdInventoryLogService;
import com.yxt.supervise.customer.biz.gdinventorylogerr.GdInventoryLogErrService;
@ -28,12 +33,15 @@ import com.yxt.supervise.customer.biz.gdinventoryyc.GdInventoryYcService;
import com.yxt.supervise.customer.biz.gdrescategoryprod.GdRescategoryProdService;
import com.yxt.supervise.customer.biz.storeindex.StoreIndexService;
import com.yxt.supervise.customer.biz.storeinfo.StoreInfoService;
import com.yxt.supervise.customer.feign.report.ReportInventoryFeign;
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.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
@ -64,6 +72,9 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
@Autowired
private GdInventoryLogErrService gdInventoryLogErrService;
@Resource
private ReportInventoryFeign reportInventoryFeign;
public void clearData() {
baseMapper.clearData();
}
@ -141,17 +152,162 @@ public class GdInventoryOkService extends MybatisBaseService<GdInventoryOkMapper
String filePath = fub.getData().getFilePath();
String fp = fileUploadComponent.getUploadPath() + filePath;
long millis = System.currentTimeMillis();
// long millis = System.currentTimeMillis();
baseMapper.clearData();
gdInventoryYcService.clearData();
GdInventoryLog gdlog = new GdInventoryLog(fp);
gdlog.setOrderDate("3000-01-01");
gdlog.setState(1);
gdInventoryLogService.save(gdlog);
ThreadUtil.execute(() -> asyncRead2Db(fp));
// ExcelUtil.read07BySax(fp, -1, createRowHandler(gdlog));
// System.out.println("用时:" + (System.currentTimeMillis() - millis));
// gdlog.setDurations(System.currentTimeMillis() - millis);
return gdlog;
}
private void asyncRead2Db(String fp) {
GdInventoryLog gdlog = gdInventoryLogService.fetchByFileFullPath(fp);
long millis = System.currentTimeMillis();
ExcelReaderBuilder read = EasyExcel.read(fp, GdInventoryOk.class, createReadListener(gdlog));
read.sheet().doRead();
// System.out.println("用时:" + (System.currentTimeMillis() - millis));
gdlog.setDurations(System.currentTimeMillis() - millis);
gdInventoryLogService.save(gdlog);
gdlog.setState(2);
gdInventoryLogService.updateById(gdlog);
return gdlog;
millis = System.currentTimeMillis();
ResultBean r = reportInventoryFeign.kcReport(gdlog.getOrderDate());
gdlog.setState(3);
gdlog.setRemarks(gdlog.getRemarks() + ";创建报表用时:" + (System.currentTimeMillis() - millis));
gdInventoryLogService.updateById(gdlog);
gdInventoryLogService.buildExcelById(gdlog.getIdStr());
}
private RowHandler createRowHandler(GdInventoryLog gdlog) {
return new RowHandler() {
private List<GdInventoryOk> toInsertList = new ArrayList<>();
private List<GdInventoryYc> toInsertListYc = new ArrayList<>();
private int x = 0, y = 0, z = 0, errnum = 0;
private int num = 0, numyc = 0;
private String odate = null;
private Map<String, Object> readMapFromRow(List<Object> r) {
Map<String, Object> map = new HashMap<>();
map.put("orgCode", r.get(0));// 企业组织机构代码证
map.put("warehouseCode", "" + r.get(1));// 仓库/门店编号
map.put("warehouseName", r.get(2)); // 仓库/门店名称
map.put("prodCode", "" + r.get(7)); // 商品编码
map.put("prodBarCode", r.get(8));// 商品条码
map.put("prodName", r.get(9)); // 商品名称
map.put("warehouseType", r.get(10)); // 仓库类型
map.put("prodNum", r.get(11)); // 商品数量
map.put("prodValue", r.get(12)); // 商品货值
map.put("suppliderName", r.get(13)); // 供应商
map.put("datadate", r.get(14)); // 数据日期
map.put("typeCode", r.get(3)); // 类别编号
map.put("typeName", r.get(4)); // 类别名称
map.put("typeOne", r.get(5)); // 一级类别名称
map.put("typeTwo", r.get(6)); // 二级类别名称
return map;
}
private boolean checkYcProd(String typeCode) {
if (StrUtil.isBlank(typeCode))
return false;
if (typeCode.length() < 4)
return false;
String subCode = typeCode.substring(0, 4);
return "0811".equals(subCode) || "0813".equals(subCode) || "0815".equals(subCode);
}
@Override
public void handle(int sheetIndex, long rowIndex, List<Object> r) {
String typeCode = "" + r.get(3);
if (rowIndex > 0 && StringUtils.isNotBlank(typeCode)) {
String prodCode = "" + r.get(7);
String warehouseCode = "" + r.get(1);
if (StrUtil.isBlank(odate)) {
odate = "" + r.get(14);
gdlog.setOrderDate(odate);
}
// System.out.println(",X:" + x + ",prodCode:" + prodCode);
if (checkYcProd(typeCode)) {
GdInventoryYc yc = new GdInventoryYc();
Map<String, Object> map = readMapFromRow(r);
try {
BeanUtil.fillBeanWithMap(map, yc, true);
toInsertListYc.add(yc);
z++;
} catch (Exception e) {
errnum++;
e.printStackTrace();
}
if (990 == numyc) {
gdInventoryYcService.saveBatch(toInsertListYc);
numyc = 0;
toInsertListYc.clear();
} else {
numyc++;
}
} else {
GdInventoryOk ok = new GdInventoryOk();
Map<String, Object> map = readMapFromRow(r);
try {
BeanUtil.fillBeanWithMap(map, ok, true);
toInsertList.add(ok);
y++;
} catch (Exception e) {
errnum++;
e.printStackTrace();
}
if (990 == num) {
GdInventoryOkService.this.saveBatch(toInsertList);
num = 0;
toInsertList.clear();
} else {
num++;
}
}
x++;
// System.out.println(",X:" + x + ",Y:" + y);
}
}
@Override
public void handleCell(int sheetIndex, long rowIndex, int cellIndex, Object value, CellStyle xssfCellStyle) {
RowHandler.super.handleCell(sheetIndex, rowIndex, cellIndex, value, xssfCellStyle);
}
@Override
public void doAfterAllAnalysed() {
if (toInsertList != null && !toInsertList.isEmpty()) {
GdInventoryOkService.this.saveBatch(toInsertList);
}
if (toInsertListYc != null && !toInsertListYc.isEmpty()) {
gdInventoryYcService.saveBatch(toInsertListYc);
}
gdlog.setAllNum(x);
gdlog.setValidNum(y);
gdlog.setErrRowNum(z);
RowHandler.super.doAfterAllAnalysed();
}
};
}
private ReadListener<GdInventoryOk> createReadListener(GdInventoryLog gdlog) {

19
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/feign/report/ReportInventoryFeign.java

@ -0,0 +1,19 @@
package com.yxt.supervise.customer.feign.report;
import com.yxt.common.core.result.ResultBean;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(
contextId = "supervise-report-ReportInventory",
name = "supervise-report",
path = "/reportinventory")
public interface ReportInventoryFeign {
@GetMapping("/kcReport")
public ResultBean kcReport(@RequestParam("orderDate") String orderDate);
}

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

@ -13,8 +13,8 @@ spring:
# brokers: localhost:9092 #kafka的网络位置
# auto-create-topics: true
profiles:
active: devv
# active: test
# active: devv
active: test
messages:
# 国际化资源文件路径
basename: i18n/messages
@ -61,6 +61,20 @@ logging:
demojar:
mapper: DEBUG
#hystrix的超时时间
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000

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

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

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

@ -17,8 +17,9 @@ public class ReportInventoryDayGatherService extends ServiceImpl<ReportInventory
List<ReportInventoryDayGather> whInList = new ArrayList<>();
double countAmount = 0.0;
String serialNumber = "" + System.currentTimeMillis();
String reportTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm");
Date currentDateTime = new Date();
String serialNumber = DateUtil.format(currentDateTime, "yyyyMMddHHmmssSSS");
String reportTime = DateUtil.format(currentDateTime, "yyyy-MM-dd HH:mm");
List<Map<String, String>> whList = baseMapper.warehouseList();
for (Map<String, String> map : whList) {

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

@ -15,8 +15,8 @@ spring:
# brokers: localhost:9092 #kafka的网络位置
# auto-create-topics: true
profiles:
active: devv
# active: test
# active: devv
active: test
messages:
# 国际化资源文件路径
basename: i18n/messages
@ -54,6 +54,20 @@ mybatis-plus:
call-setters-on-nulls: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#hystrix的超时时间
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
thread:
timeoutInMilliseconds: 60000
#ribbon的超时时间
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000

Loading…
Cancel
Save