
14 changed files with 618 additions and 224 deletions
@ -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; // 数据日期
|
|||
} |
@ -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(); |
|||
} |
@ -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); |
|||
} |
|||
} |
Binary file not shown.
Loading…
Reference in new issue