Browse Source

Merge remote-tracking branch 'origin/master'

master
yunuo970428 2 years ago
parent
commit
592497b2f9
  1. 8
      base-ui/src/api/kucun/kucun.js
  2. 22
      base-ui/src/views/kucun/kcxxcx/index.vue
  3. 4
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageGdMapper.java
  4. 4
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageGdService.java
  5. 5
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageMapper.java
  6. 7
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java
  7. 7
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryRest.java
  8. 97
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryService.java
  9. 59
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYc.java
  10. 65
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcMapper.java
  11. 140
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcService.java
  12. 106
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storeinfo/StoreInfoService.java
  13. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/application-devv.yml
  14. BIN
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/resources/xlsx-tmpl/库存汇总表-烟草.xlsx

8
base-ui/src/api/kucun/kucun.js

@ -9,6 +9,14 @@ export function kchz(data) {
})
}
// 条件查询
export function kchzyc(data) {
return request({
url: '/kucun/kchzyc',
method: 'get',
data: data
})
}
// 条件查询
export function downloadhz(parm) {
return request({
url: '/kucun/downloadhz',

22
base-ui/src/views/kucun/kcxxcx/index.vue

@ -32,7 +32,10 @@
<h3>库存汇总数据</h3>
<el-card class="box-card">
<div>{{ hzResultMesssage }}</div>
<div><el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载汇总文件</el-button></div>
<div>
<el-button :disabled="!hzFilePath" size="small" type="primary" @click="doDownloadHz">下载汇总文件</el-button>
<el-button :disabled="!ychzFilePath" size="small" type="primary" @click="doDownloadHzYc">下载烟草汇总文件</el-button>
</div>
</el-card>
</div>
</el-card>
@ -40,7 +43,7 @@
</template>
<script>
import { kchz } from '@/api/kucun/kucun'
import { kchz, kchzyc } from '@/api/kucun/kucun'
export default {
name: 'KucunKcxxcxIndex',
// components: { },
@ -52,6 +55,7 @@ export default {
uploadResultMesssage: '',
hzResultMesssage: '',
hzFilePath: '',
ychzFilePath: '',
fullscreenloading: null
}
},
@ -119,6 +123,17 @@ export default {
if (this.fullscreenloading) this.fullscreenloading.close()
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() {
window.open(this.hzFilePath, '_blank')
@ -136,6 +151,9 @@ export default {
// .catch(e => {
// console.log(e)
// })
},
doDownloadHzYc() {
window.open(this.ychzFilePath, '_blank')
}
}
}

4
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageGdMapper.java

@ -26,6 +26,7 @@
package com.yxt.supervise.portal.biz.gdinstorage;
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;
@ -57,4 +58,7 @@ public interface GdInstorageGdMapper extends BaseMapper<GdInstorageGd> {
" and colb1 IN (SELECT CODE FROM store_index WHERE TYPE='连锁外加盟(销配结算)') " +
" and colh7 in (select prodCode from gd_rescategory_prod) ")
double jmdRkmxdValOfDay(@Param("orderDate") String orderDate);
@Delete("delete from gd_instorage_gd where orderDate=#{orderDate} ")
void clearByOrderDate(@Param("orderDate") String orderDate);
}

4
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageGdService.java

@ -155,4 +155,8 @@ public class GdInstorageGdService extends ServiceImpl<GdInstorageGdMapper, GdIns
return url;
}
public void clearByOrderDate(String orderDate) {
baseMapper.clearByOrderDate(orderDate);
}
}

5
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageMapper.java

@ -26,7 +26,9 @@
package com.yxt.supervise.portal.biz.gdinstorage;
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;
/**
* Project: yxt_supervise <br/>
@ -43,4 +45,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GdInstorageMapper extends BaseMapper<GdInstorage> {
@Delete("delete from gd_instorage where orderDate=#{orderDate} ")
void clearByOrderDate(@Param("orderDate") String orderDate);
}

7
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageService.java

@ -221,9 +221,13 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
@Override
public void doAfterAllAnalysed() {
if (toInsertListGd != null && !toInsertListGd.isEmpty()) {
GdInstorageGd gdInstorageGd = toInsertListGd.get(0);
gdInstorageGdService.clearByOrderDate(gdInstorageGd.getOrderDate());
gdInstorageGdService.saveBatch(toInsertListGd);
}
if (toInsertList != null && !toInsertList.isEmpty()) {
GdInstorage gdInstorage = toInsertList.get(0);
GdInstorageService.this.clearByOrderDate(gdInstorage.getOrderDate());
GdInstorageService.this.saveBatch(toInsertList);
}
if (errList != null && !errList.isEmpty()) {
@ -248,4 +252,7 @@ public class GdInstorageService extends ServiceImpl<GdInstorageMapper, GdInstora
PagerVo<GdInstorage> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public void clearByOrderDate(String orderDate) {
baseMapper.clearByOrderDate(orderDate);
}
}

7
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryRest.java

@ -59,6 +59,8 @@ public class GdInventoryRest {
private GdInventoryService gdInventoryService;
@Autowired
private GdInventoryOkService gdInventoryOkService;
@Autowired
private GdInventoryYcService gdInventoryYcService;
@GetMapping("/implgd")
public ResultBean implInventory() {
@ -81,6 +83,11 @@ public class GdInventoryRest {
return gdInventoryOkService.kchz();
}
@GetMapping("/kchzyc")
public ResultBean kchzyc() {
return gdInventoryYcService.kchzyc();
}
@GetMapping("/downloadhz")
public void downloadhz(HttpServletResponse response, @RequestParam("filepath") String filepath) throws IOException {
System.out.println("XXXX: " + filepath);

97
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryService.java

@ -37,6 +37,7 @@ import com.yxt.common.base.config.component.FileUploadComponent;
import com.yxt.common.core.result.FileUploadResult;
import com.yxt.common.core.result.ResultBean;
import com.yxt.supervise.portal.biz.storeindex.StoreIndexService;
import com.yxt.supervise.portal.biz.storeinfo.StoreInfoService;
import com.yxt.supervise.portal.extexcel.CsvTool;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.factory.annotation.Autowired;
@ -76,6 +77,10 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
private GdInventoryLogService gdInventoryLogService;
@Autowired
private GdInventoryLogErrService gdInventoryLogErrService;
@Autowired
private GdInventoryYcService gdInventoryYcService;
@Autowired
private StoreInfoService storeInfoService;
public void doCheck() {
@ -289,11 +294,44 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
return new RowHandler() {
private List<GdInventoryOk> toInsertList = new ArrayList<>();
private List<GdInventoryYc> toInsertListYc = new ArrayList<>();
private List<GdInventoryLogErr> errList = new ArrayList<>();
private int x = 0, y = 0, errnum = 0;
private int num = 0;
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(3)); // 商品编码
map.put("prodBarCode", r.get(4));// 商品条码
map.put("prodName", r.get(5)); // 商品名称
map.put("warehouseType", r.get(6)); // 仓库类型
map.put("prodNum", r.get(7)); // 商品数量
map.put("prodValue", r.get(8)); // 商品货值
map.put("suppliderName", r.get(9)); // 供应商
map.put("datadate", r.get(10)); // 数据日期
return map;
}
private GdInventoryLogErr createErrorInfo(List<Object> r, String errInfo) {
GdInventoryLogErr gile = new GdInventoryLogErr();
gile.setRowNum(x + 1);
gile.setErrInfo(errInfo);
gile.setFileFullPath(gdlog.getFileFullPath());
gile.setRowContent(JSONUtil.toJsonStr(r));
gile.setProdCode("" + r.get(3));
gile.setProdName("" + r.get(5));
gile.setProdNum("" + r.get(7));
gile.setProdValue("" + r.get(8));
gile.setSupplierCode("");
gile.setSupplierName("" + r.get(9));
gile.setOrderDate(odate);
return gile;
}
@Override
public void handle(int sheetIndex, long rowIndex, List<Object> r) {
if (rowIndex > 0) {
@ -307,18 +345,7 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
if (gdRescategoryProdService.containsCode(prodCode) && storeIndexService.containsCodeWithOneNoJmd(warehouseCode)) {
GdInventoryOk ok = new GdInventoryOk();
Map<String, Object> map = new HashMap<>();
map.put("orgCode", r.get(0));// 企业组织机构代码证
map.put("warehouseCode", warehouseCode);// 仓库/门店编号
map.put("warehouseName", r.get(2)); // 仓库/门店名称
map.put("prodCode", prodCode); // 商品编码
map.put("prodBarCode", r.get(4));// 商品条码
map.put("prodName", r.get(5)); // 商品名称
map.put("warehouseType", r.get(6)); // 仓库类型
map.put("prodNum", r.get(7)); // 商品数量
map.put("prodValue", r.get(8)); // 商品货值
map.put("suppliderName", r.get(9)); // 供应商
map.put("datadate", r.get(10)); // 数据日期
Map<String, Object> map = readMapFromRow(r);
try {
BeanUtil.fillBeanWithMap(map, ok, true);
@ -326,22 +353,11 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
y++;
} catch (Exception e) {
errnum++;
GdInventoryLogErr gile = new GdInventoryLogErr();
gile.setRowNum(x + 1);
gile.setErrInfo(e.getMessage());
gile.setFileFullPath(gdlog.getFileFullPath());
gile.setRowContent(JSONUtil.toJsonStr(r));
gile.setProdCode(prodCode);
gile.setProdName(""+r.get(5));
gile.setProdNum(""+r.get(7));
gile.setProdValue(""+r.get(8));
gile.setSupplierCode("");
gile.setSupplierName(""+r.get(9));
gile.setOrderDate(odate);
GdInventoryLogErr gile = createErrorInfo(r, e.getMessage());
errList.add(gile);
}
if (999 == num) {
if (990 == num) {
gdInventoryOkService.saveBatch(toInsertList);
num = 0;
toInsertList.clear();
@ -349,6 +365,29 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
num++;
}
}
if ("0811".equals(prodCode.substring(0, 4)) && storeInfoService.containsCodeOfYc(warehouseCode)) {
GdInventoryYc yc = new GdInventoryYc();
Map<String, Object> map = readMapFromRow(r);
try {
BeanUtil.fillBeanWithMap(map, yc, true);
toInsertListYc.add(yc);
z++;
} catch (Exception e) {
errnum++;
GdInventoryLogErr gile = createErrorInfo(r, e.getMessage());
errList.add(gile);
}
if (990 == numyc) {
gdInventoryYcService.saveBatch(toInsertListYc);
numyc = 0;
toInsertListYc.clear();
} else {
numyc++;
}
}
x++;
// System.out.println(",X:" + x + ",Y:" + y);
}
@ -364,6 +403,9 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
if (toInsertList != null && !toInsertList.isEmpty()) {
gdInventoryOkService.saveBatch(toInsertList);
}
if (toInsertListYc != null && !toInsertListYc.isEmpty()) {
gdInventoryYcService.saveBatch(toInsertListYc);
}
if (errList != null && !errList.isEmpty()) {
gdInventoryLogErrService.saveBatch(errList);
}
@ -385,6 +427,7 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento
long millis = System.currentTimeMillis();
gdInventoryOkService.clearData();
gdInventoryYcService.clearData();
GdInventoryLog gdlog = new GdInventoryLog(fp);
ExcelUtil.read07BySax(fp, -1, createRowHandler(gdlog));
// System.out.println("用时:" + (System.currentTimeMillis() - millis));

59
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYc.java

@ -0,0 +1,59 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yxt.common.core.domain.EntityWithId;
import lombok.Data;
/**
* Project: yxt_supervise <br/>
* File: GdInventoryYc.java <br/>
* Class: com.yxt.supervise.portal.biz.gdinventory.GdInventoryYc <br/>
* Description: <描述类的功能>. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2022/12/29 10:22 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@Data
@TableName("gd_inventory_yc")
public class GdInventoryYc extends EntityWithId {
private String orgCode; // 企业组织机构代码证
private String warehouseCode; // 仓库/门店编号
private String warehouseName; // 仓库/门店名称
private String prodCode; // 商品编码
private String prodBarCode; // 商品条码
private String prodName; // 商品名称
private int warehouseType; // 仓库类型
private int prodNum; // 商品数量
private double prodValue; // 商品货值
private String suppliderName; // 供应商
private String datadate; // 数据日期
}

65
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcMapper.java

@ -0,0 +1,65 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.supervise.portal.biz.gdinventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* Project: yxt_supervise <br/>
* File: GdInventoryYcMapper.java <br/>
* Class: com.yxt.supervise.portal.biz.gdinventory.GdInventoryYcMapper <br/>
* Description: <描述类的功能>. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2022/12/29 10:23 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@Mapper
public interface GdInventoryYcMapper extends BaseMapper<GdInventoryYc> {
@Delete("delete from gd_inventory_yc where 1=1")
void clearData();
@Select("select IFNULL(count(1),0) FROM (SELECT DISTINCT prodCode from gd_inventory_yc) t ")
int countProd2();
@Select("select IFNULL(sum(prodValue),0) from gd_inventory_yc")
double countVal2();
@Select("select warehouseName,warehouseType,IFNULL(count(1),0) as coun,IFNULL(sum(prodValue),0) as su from gd_inventory_yc gio group by warehouseName,warehouseType order by warehouseType")
List<Map<String, Object>> listOfWarehouse();
@Select("select warehouseCode, warehouseName, warehouseType, prodCode, prodBarCode, prodName, prodNum, prodValue from gd_inventory_yc order by warehouseType")
List<Map<String, Object>> listOfProd();
}

140
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryYcService.java

@ -0,0 +1,140 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.supervise.portal.biz.gdinventory;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Project: yxt_supervise <br/>
* File: GdInventoryYcService.java <br/>
* Class: com.yxt.supervise.portal.biz.gdinventory.GdInventoryYcService <br/>
* Description: <描述类的功能>. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2022/12/29 10:24 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@Service
public class GdInventoryYcService extends ServiceImpl<GdInventoryYcMapper, GdInventoryYc> {
@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.xlsxtmplyc:static/upload/}")
private String xlsxtmplPath;
public void clearData() {
baseMapper.clearData();
}
public ResultBean kchzyc() {
ResultBean rb = ResultBean.fireFail();
int prod2 = baseMapper.countProd2();
double val2 = baseMapper.countVal2();
Date curDate = new Date();
String timestr = DateUtil.format(curDate, "yyyyMMddHHmmssSSS");
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd");
String datefmt1 = DateUtil.format(curDate, "yyyy-MM-dd HH:mm");
String datefmt2 = DateUtil.format(curDate, "yyyy/MM/dd HH:mm");
// URL resource = ResourceUtil.getResource("xlsx-tmpl/库存汇总表.xlsx");
String xlsxpath = xlsxtmplPath + "库存汇总表-烟草.xlsx";
File srcFile = FileUtil.file(xlsxpath);
String tfile = "kchzb/库存汇总表-烟草" + dfmt + ".xlsx";
String url = urlPrefix + tfile;
String toFileName = uploadPath + tfile;
File file = FileUtil.file(toFileName);
// FileUtil.copy(FileUtil.file(resource), file, true);
FileUtil.copy(srcFile, file, true);
ExcelWriter writer = ExcelUtil.getWriter(file);
writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(3, 1, datefmt1);
writer.writeCellValue(2, 3, prod2);
writer.writeCellValue(3, 3, val2);
// writer.flush();
// writer.close();
List<Map<String, Object>> list = baseMapper.listOfWarehouse();
// writer = ExcelUtil.getWriter(file);
writer.setSheet(1);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(3, 1, datefmt1);
int size = list.size();
int countRow = size + 3;
for (int y = 3; y < countRow; y++) {
Map<String, Object> map = list.get(y - 3);
writer.writeCellValue(0, y, map.get("warehouseName"));
writer.writeCellValue(1, y, map.get("warehouseType"));
writer.writeCellValue(2, y, map.get("coun"));
writer.writeCellValue(3, y, map.get("su"));
}
writer.writeCellValue(0, countRow, "合计");
// writer.flush();
// writer.close();
List<Map<String, Object>> listp = baseMapper.listOfProd();
// writer = ExcelUtil.getWriter(file);
writer.setSheet(2);
writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(6, 1, datefmt2);
int sizep = listp.size();
int countRowp = sizep + 3;
for (int y = 3; y < countRowp; y++) {
Map<String, Object> map = listp.get(y - 3);
writer.writeCellValue(0, y, map.get("warehouseCode"));
writer.writeCellValue(1, y, map.get("warehouseName"));
writer.writeCellValue(2, y, map.get("warehouseType"));
writer.writeCellValue(3, y, map.get("prodCode"));
writer.writeCellValue(4, y, map.get("prodBarCode"));
writer.writeCellValue(5, y, map.get("prodName"));
writer.writeCellValue(6, y, map.get("prodNum"));
writer.writeCellValue(7, y, map.get("prodValue"));
}
writer.flush();
writer.close();
return rb.success().setData(url);
}
}

106
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storeinfo/StoreInfoService.java

@ -30,14 +30,13 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.supervise.portal.api.salesdata.SalesData;
import com.yxt.supervise.portal.api.storeinfo.*;
import com.yxt.supervise.portal.biz.storeindex.StoreIndex;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import org.apache.poi.hssf.usermodel.HSSFCell;
@ -84,7 +83,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
return p;
}
public void saveOrUpdateDto(StoreInfoDto dto){
public void saveOrUpdateDto(StoreInfoDto dto) {
String dtoSid = dto.getSid();
if (StringUtils.isBlank(dtoSid)) {
this.insertByDto(dto);
@ -93,13 +92,13 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
this.updateByDto(dto);
}
public void insertByDto(StoreInfoDto dto){
public void insertByDto(StoreInfoDto dto) {
StoreInfo entity = new StoreInfo();
BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.insert(entity);
}
public void updateByDto(StoreInfoDto dto){
public void updateByDto(StoreInfoDto dto) {
String dtoSid = dto.getSid();
if (StringUtils.isBlank(dtoSid)) {
return;
@ -109,7 +108,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
baseMapper.updateById(entity);
}
public StoreInfoDetailsVo fetchDetailsVoBySid(String sid){
public StoreInfoDetailsVo fetchDetailsVoBySid(String sid) {
StoreInfo entity = fetchBySid(sid);
StoreInfoDetailsVo vo = new StoreInfoDetailsVo();
BeanUtil.copyProperties(entity, vo);
@ -119,6 +118,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
public StoreInfo selectByCode(String storeCode) {
return baseMapper.selectByCode(storeCode);
}
public void readBrandPeriodSorXls1(InputStream is, String sid) {
HSSFWorkbook hssfWorkbook = null;
try {
@ -126,30 +126,30 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
} catch (IOException e) {
e.printStackTrace();
}
List<String> lisss=new ArrayList<>();
List<String> lisss2=new ArrayList<>();
List<String> lisss = new ArrayList<>();
List<String> lisss2 = new ArrayList<>();
HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(0);
// 循环行Row
for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
StoreInfo sd=new StoreInfo();
StoreInfo sd = new StoreInfo();
HSSFRow hssfRow = hssfSheet.getRow(rowNum);
int i = 0;
try{
if(rowNum>=1){
for ( ; i < hssfRow.getLastCellNum(); i++) {
try {
if (rowNum >= 1) {
for (; i < hssfRow.getLastCellNum(); i++) {
HSSFCell brandIdHSSFCell = hssfRow.getCell(i);
if(brandIdHSSFCell!=null){
if (brandIdHSSFCell != null) {
if (i == 1) {//代码
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
StoreInfo storeInfo = baseMapper.selectByCode(value);
if(storeInfo!=null){
sd=storeInfo;
if (storeInfo != null) {
sd = storeInfo;
// sd.setIsJoin("1");
sd.setIsSjz("1");
}else{
} else {
sd.setCode(value);
}
}
@ -158,8 +158,8 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
if(value.indexOf("]")>=0){
value = value.trim();
if (value.indexOf("]") >= 0) {
String[] split = value.split("]");
value = split[1];
}
@ -170,7 +170,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setType(value);
}
}
@ -178,7 +178,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setContacts(value);
}
}
@ -186,33 +186,33 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setTelephone(value);
}
}
if (i == 6) {//地址信息1
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setAddress(value);
}
if (i == 7) {//经度
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setLongitude(value);
}
if (i == 8) {//纬度
brandIdHSSFCell.setCellType(CellType.STRING);
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setLatitude(value);
}
if (i == 9) {//配货价
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setProductPrice(value);
}
}
@ -220,7 +220,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setRegion(value);
}
}
@ -228,7 +228,7 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setProgramme(value);
}
}
@ -236,24 +236,24 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
brandIdHSSFCell.setCellType(CellType.STRING);
if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
String value = brandIdHSSFCell.getStringCellValue();
value=value.trim();
value = value.trim();
sd.setGroupCode(value);
}
}
}else{
System.err.println("rowNum="+rowNum+",i="+i+",value=null");
} else {
System.err.println("rowNum=" + rowNum + ",i=" + i + ",value=null");
}
}
}
}catch(Exception e){
} catch (Exception e) {
e.printStackTrace();
System.err.println("i="+i+",value=null");
System.err.println("i=" + i + ",value=null");
}
lisss.add(rowNum+"");
if(sd.getId()!=null&&sd.getId()!=0){
lisss.add(rowNum + "");
if (sd.getId() != null && sd.getId() != 0) {
baseMapper.updateById(sd);
}else{
} else {
baseMapper.insert(sd);
}
@ -273,4 +273,38 @@ public class StoreInfoService extends MybatisBaseService<StoreInfoMapper, StoreI
public StoreInfo selectByCodeAndLimit(String storeCode) {
return baseMapper.selectByCodeAndLimit(storeCode);
}
private static List<String> cacheCodeListOfYc = null; //烟草门店的门店编号列表
public void clearCacheCodeListOfYc() {
cacheCodeListOfYc = null;
}
public boolean containsCodeOfYc(String code) {
if (StringUtils.isBlank(code))
return false;
if (cacheCodeListOfYc == null)
cacheCodeListOfYc = listCodeOfYc();
return cacheCodeListOfYc.contains(code.trim());
}
/**
* 烟草门店列表
*
* @return
*/
public List<StoreInfo> listOfYc() {
QueryWrapper<StoreInfo> qw = new QueryWrapper<>();
qw.ne("isycjyfw", "1");
List<StoreInfo> list = super.list(qw);
return list;
}
private List<String> listCodeOfYc() {
List<String> res = new ArrayList<>();
List<StoreInfo> list = listOfYc();
list.forEach(entity -> res.add(entity.getCode().trim()));
return res;
}
}

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

@ -22,7 +22,7 @@ spring:
timeout: 0 # 连接超时时间(毫秒)
image:
xlsxtmpl: D:/webapps/supervise/xlsx-tmpl/
xlsxtmpl: D:/works/projects/javaee/yxtgit/supervise/yxt_supervise/supervise-portal/supervise-portal-biz/target/classes/xlsx-tmpl/
upload:
path: D:/works/projects/javaee/yxtgit/supervise/yxt_supervise/supervise-portal/supervise-portal-biz/target/classes/static/upload/
url:

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

Binary file not shown.
Loading…
Cancel
Save