diff --git a/docs/databases/table_create_gf.sql b/docs/databases/table_create_gf.sql index e69de29..1b0edf4 100644 --- a/docs/databases/table_create_gf.sql +++ b/docs/databases/table_create_gf.sql @@ -0,0 +1,92 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 50741 + Source Host : localhost:3306 + Source Schema : yxt_supervise_gf + + Target Server Type : MySQL + Target Server Version : 50741 + File Encoding : 65001 + + Date: 13/07/2023 17:49:30 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for in_stock +-- ---------------------------- +DROP TABLE IF EXISTS `in_stock`; +CREATE TABLE `in_stock` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', + `materiel_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料名称', + `brand_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '品牌', + `materiel_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料编号', + `batch_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '批次号', + `materiel_group_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料组', + `num` int(64) NULL DEFAULT NULL COMMENT '本次操作数量', + `price` double(10, 2) NULL DEFAULT NULL COMMENT '单价', + `actual_price` double(10, 2) NULL DEFAULT NULL COMMENT '批次总金额', + `unit` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料单位', + `admin_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '经办人', + `storehouse_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库名称', + `happen_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '申请时间', + `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型', + `type_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型明文', + `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核状态', + `orig_num` int(255) NULL DEFAULT NULL COMMENT '原数量', + `new_num` int(255) NULL DEFAULT NULL COMMENT '更新后的数量', + `create_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间', + `source_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '来源名称', + `source_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '来源类型', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '货物入库明细表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for inventory +-- ---------------------------- +DROP TABLE IF EXISTS `inventory`; +CREATE TABLE `inventory` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', + `num` int(255) NULL DEFAULT NULL COMMENT '库存数量', + `storehouse_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库编码', + `materiel_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料id', + `materiel_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料编码', + `materiel_group` int(64) NULL DEFAULT NULL COMMENT '物料组id', + `brand_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料品牌', + `materiel_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料名称', + `price` double(255, 0) NULL DEFAULT NULL COMMENT '物料单价(成本价)', + `update_time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后更新时间', + `materiel_group_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料组明文', + `update_time_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最后更新时间明文', + `storehouse_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库名称', + `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '添加时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '库存记录表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for out_stock +-- ---------------------------- +DROP TABLE IF EXISTS `out_stock`; +CREATE TABLE `out_stock` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '货物出库明细表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for warehouse information +-- ---------------------------- +DROP TABLE IF EXISTS `warehouse information`; +CREATE TABLE `warehouse information` ( + `id` int(1) NOT NULL AUTO_INCREMENT COMMENT 'id', + `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库代码', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库名称', + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '仓库地址', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仓库信息表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/warehouseinformation/WarehouseInformation.java b/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/warehouseinformation/WarehouseInformation.java new file mode 100644 index 0000000..8306ded --- /dev/null +++ b/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/warehouseinformation/WarehouseInformation.java @@ -0,0 +1,24 @@ +package com.yxt.supervise.gf.api.warehouseinformation; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-07-14-9:35 + */ +@Data +@ApiModel(value = "仓库信息表") +@TableName("warehouse_information") +public class WarehouseInformation { + @ApiModelProperty("id") + private Integer id; + @ApiModelProperty("仓库代码") + private String code; + @ApiModelProperty("仓库名称") + private String name; + @ApiModelProperty("仓库地址") + private String address; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/inventory/InventoryService.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/inventory/InventoryService.java index e3cbb3f..4d4a345 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/inventory/InventoryService.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/inventory/InventoryService.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.sun.org.apache.bcel.internal.generic.NEW; import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; @@ -26,10 +27,12 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; +import java.math.BigDecimal; import java.net.URLEncoder; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * @author feikefei @@ -69,47 +72,215 @@ public class InventoryService extends ServiceImpl { * @throws Exception */ public void exportExcel(HttpServletResponse response, List list) throws Exception { - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); + Date date = new Date(); XSSFWorkbook wb = new XSSFWorkbook(); - //标题行抽出字段 - String[] head = {"序号","库存数量","仓库编码", "物料id", "物料编码", "物料组id", "物料品牌", "物料名称", "物料单价(成本价)", "最后更新时间", "物料组明文", "最后更新时间明文", "仓库名称"}; - - //设置sheet名称,并创建新的sheet对象 - Sheet stuSheet = wb.createSheet(); + Map> listMap = list.stream().collect(Collectors.groupingBy(it -> it.getStorehouse_name())); + List> listMap1 = new ArrayList<>();//存储汇总数据 + for (Map.Entry> stringListEntry : listMap.entrySet()) { + Map map = new HashMap<>(); + //标题行抽出字段 + String[] head = {"序号","库存数量","仓库编码", "物料id", "物料编码", "物料组id", "物料品牌", "物料名称", "物料单价(成本价)", "最后更新时间", "物料组明文", "最后更新时间明文", "仓库名称","货值"}; + //设置sheet名称,并创建新的sheet对象 + Sheet stuSheet = wb.createSheet(stringListEntry.getKey()); + //合并单元格 + Row headRow = stuSheet.createRow(0); //第一行为头 + Font head1 = wb.createFont(); + head1.setFontHeightInPoints((short) 25); + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFont(head1); + cellStyle.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,head.length-1); + Cell cell1 = headRow.createCell(0); + cell1.setCellStyle(cellStyle); + cell1.setCellValue(stringListEntry.getKey() + "("+ sdf1.format(date) +")"); + stuSheet.addMergedRegion(callRangeAddress); + //设置表头字体大小 + Font font1 = wb.createFont(); + font1.setFontHeightInPoints((short) 16); + //获取表头行 + Row titleRow = stuSheet.createRow(1); + //创建单元格,设置style居中,字体,单元格大小等 + CellStyle style = wb.createCellStyle(); + style.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + style.setAlignment(HorizontalAlignment.CENTER); + style.setShrinkToFit(true); //自动伸缩 + style.setFont(font1); + Cell cell = null; + //把已经写好的标题行写入excel文件中 + for (int i = 0; i < head.length; i++) { + cell = titleRow.createCell(i); + cell.setCellValue(head[i]); + cell.setCellStyle(style); + } + //把从数据库中取得的数据一一写入excel文件中 + Row row = null; + Cell cell2 = null; + Double count = 0.0; + Integer numCount = 0; + CellStyle dataStyle = wb.createCellStyle(); + dataStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + dataStyle.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + for (int i = 0; i < stringListEntry.getValue().size(); i++) { + //创建list.size()行数据 + row = stuSheet.createRow(i + 2); + //把值一一写进单元格里 + //设置第一列为自动递增的序号 + cell2 = row.createCell(0); + cell2.setCellValue(i + 1); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(1); + cell2.setCellValue(stringListEntry.getValue().get(i).getNum()); + numCount+=Integer.parseInt(stringListEntry.getValue().get(i).getNum()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(2); + cell2.setCellValue(stringListEntry.getValue().get(i).getStorehouse_code()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(3); + cell2.setCellValue(stringListEntry.getValue().get(i).getMateriel_id()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(4); + cell2.setCellValue(stringListEntry.getValue().get(i).getMateriel_no()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(5); + cell2.setCellValue(stringListEntry.getValue().get(i).getMateriel_group()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(6); + cell2.setCellValue(stringListEntry.getValue().get(i).getBrand_name()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(7); + cell2.setCellValue(stringListEntry.getValue().get(i).getMateriel_name()); + cell2.setCellStyle(dataStyle); + Double price = stringListEntry.getValue().get(i).getPrice(); + if (price == null){ + price = 0.0; + } + cell2 = row.createCell(8); + cell2.setCellValue(price); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(9); + cell2.setCellValue(stringListEntry.getValue().get(i).getUpdate_time()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(10); + cell2.setCellValue(stringListEntry.getValue().get(i).getMateriel_group_text()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(11); + cell2.setCellValue(stringListEntry.getValue().get(i).getUpdate_time_text()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(12); + cell2.setCellValue(stringListEntry.getValue().get(i).getStorehouse_name()); + cell2.setCellStyle(dataStyle); + Double i1 = Integer.parseInt(stringListEntry.getValue().get(i).getNum()) * price; + cell2 = row.createCell(13); + cell2.setCellValue(i1); + cell2.setCellStyle(dataStyle); + count+=i1; + } + Font font = wb.createFont(); + font.setFontHeightInPoints((short) 14); + Row row1 = stuSheet.createRow(stringListEntry.getValue().size()+2); + CellStyle style11 = wb.createCellStyle(); + style11.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + style11.setAlignment(HorizontalAlignment.CENTER); + style11.setFont(font); + Cell cell11 = row1.createCell(0); + cell11.setCellStyle(style11); + cell11.setCellValue("合计"); + cell11 = row1.createCell(13); + cell11.setCellStyle(style11); + cell11.setCellValue(count); + map.put("name",stringListEntry.getKey()); + map.put("numCount",numCount); + map.put("count",count); + listMap1.add(map); + //设置单元格宽度自适应,在此基础上把宽度调至1.5倍 + for (int i = 0; i < head.length; i++) { + stuSheet.autoSizeColumn(i, true); + stuSheet.setColumnWidth(i, stuSheet.getColumnWidth(i) * 15 / 10); + } + } + //汇总工作簿 + String[] collectHead = {"序号","仓库名称","物料数量","货值"}; + Sheet stuSheet = wb.createSheet("汇总"); + Row headRow = stuSheet.createRow(0); //第一行为头 + Font head1 = wb.createFont(); + head1.setFontHeightInPoints((short) 25); + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFont(head1); + cellStyle.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + CellRangeAddress callRangeAddress = new CellRangeAddress(0,0,0,collectHead.length-1); + Cell cell1 = headRow.createCell(0); + cell1.setCellStyle(cellStyle); + cell1.setCellValue("库存汇总"); + stuSheet.addMergedRegion(callRangeAddress); + //设置表头字体大小 + Font font1 = wb.createFont(); + font1.setFontHeightInPoints((short) 16); //获取表头行 - Row titleRow = stuSheet.createRow(0); - //创建单元格,设置style居中,字体,单元格大小等 + Row titleRow = stuSheet.createRow(1); CellStyle style = wb.createCellStyle(); + Font font = wb.createFont(); + font.setFontHeightInPoints((short) 16); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setAlignment(HorizontalAlignment.CENTER); + style.setShrinkToFit(true); //自动伸缩 + style.setFont(font); Cell cell = null; //把已经写好的标题行写入excel文件中 - for (int i = 0; i < head.length; i++) { + for (int i = 0; i < collectHead.length; i++) { cell = titleRow.createCell(i); - cell.setCellValue(head[i]); + cell.setCellValue(collectHead[i]); cell.setCellStyle(style); } //把从数据库中取得的数据一一写入excel文件中 Row row = null; - for (int i = 0; i < list.size(); i++) { + Cell cell2 = null; + Double count = 0.0; + CellStyle dataStyle = wb.createCellStyle(); + dataStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + dataStyle.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + Integer numSum = 0; + Double countSum = 0.0; + for (int i = 0; i < listMap1.size(); i++) { //创建list.size()行数据 - row = stuSheet.createRow(i + 1); + row = stuSheet.createRow(i + 2); //把值一一写进单元格里 //设置第一列为自动递增的序号 - row.createCell(0).setCellValue(i + 1); - row.createCell(1).setCellValue(list.get(i).getNum()); - row.createCell(2).setCellValue(list.get(i).getStorehouse_code()); - row.createCell(3).setCellValue(list.get(i).getMateriel_id()); - row.createCell(4).setCellValue(list.get(i).getMateriel_no()); - row.createCell(5).setCellValue(list.get(i).getMateriel_group()); - row.createCell(6).setCellValue(list.get(i).getBrand_name()); - row.createCell(7).setCellValue(list.get(i).getMateriel_name()); - row.createCell(8).setCellValue(list.get(i).getPrice()); - row.createCell(9).setCellValue(list.get(i).getUpdate_time()); - row.createCell(10).setCellValue(list.get(i).getMateriel_group_text()); - row.createCell(11).setCellValue(list.get(i).getUpdate_time_text()); - row.createCell(12).setCellValue(list.get(i).getStorehouse_name()); + cell2 = row.createCell(0); + cell2.setCellValue(i + 1); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(1); + cell2.setCellValue(listMap1.get(i).get("name").toString()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(2); + cell2.setCellValue(listMap1.get(i).get("numCount").toString()); + numSum+=Integer.parseInt(listMap1.get(i).get("numCount").toString()); + cell2.setCellStyle(dataStyle); + cell2 = row.createCell(3); + DecimalFormat df = new DecimalFormat("#0.00"); + cell2.setCellValue(df.format(listMap1.get(i).get("count"))); + countSum+=Double.parseDouble(df.format(listMap1.get(i).get("count"))); + cell2.setCellStyle(dataStyle); } + font.setFontHeightInPoints((short) 14); + Row row1 = stuSheet.createRow(listMap1.size()+2); + CellStyle style11 = wb.createCellStyle(); + style11.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + style11.setAlignment(HorizontalAlignment.CENTER); + style11.setFont(font); + Cell cell11 = row1.createCell(0); + cell11.setCellStyle(style11); + cell11.setCellValue("合计"); + cell11 = row1.createCell(2); + cell11.setCellStyle(style11); + cell11.setCellValue(numSum); + cell11 = row1.createCell(3); + cell11.setCellStyle(style11); + cell11.setCellValue(countSum); //设置单元格宽度自适应,在此基础上把宽度调至1.5倍 - for (int i = 0; i < head.length; i++) { + for (int i = 0; i < collectHead.length; i++) { stuSheet.autoSizeColumn(i, true); stuSheet.setColumnWidth(i, stuSheet.getColumnWidth(i) * 15 / 10); } @@ -117,7 +288,7 @@ public class InventoryService extends ServiceImpl { if (!file.exists()) { file.mkdirs(); } - //设置文件名 + //设置文件名 String fileName = sdf1.format(new Date()) + "库存记录" + ".xlsx"; String savePath = filePath + File.separator + fileName; //下载 diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationMapper.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationMapper.java new file mode 100644 index 0000000..1e7932a --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationMapper.java @@ -0,0 +1,19 @@ +package com.yxt.supervise.gf.biz.warehouseinformation; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yxt.supervise.gf.api.warehouseinformation.WarehouseInformation; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @author feikefei + * @create 2023-07-14-10:13 + */ +@Mapper +public interface WarehouseInformationMapper extends BaseMapper { + + @Select("select * from warehouse_information") + List selectWarehouseInformation(); +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationRest.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationRest.java new file mode 100644 index 0000000..bd4eb59 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationRest.java @@ -0,0 +1,28 @@ +package com.yxt.supervise.gf.biz.warehouseinformation; + +import com.yxt.common.core.result.ResultBean; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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.RestController; + +/** + * @author feikefei + * @create 2023-07-14-10:10 + */ +@Api(value = "仓库信息表") +@RestController +@RequestMapping("gf/warehouse") +public class WarehouseInformationRest { + + @Autowired + private WarehouseInformationService warehouseInformationService; + + @ApiOperation("查询仓库信息") + @GetMapping("/select") + public ResultBean selectWarehouseInformation(){ + return warehouseInformationService.selectWarehouseInformation(); + } +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationService.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationService.java new file mode 100644 index 0000000..56de1f3 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/warehouseinformation/WarehouseInformationService.java @@ -0,0 +1,22 @@ +package com.yxt.supervise.gf.biz.warehouseinformation; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yxt.common.core.result.ResultBean; +import com.yxt.supervise.gf.api.warehouseinformation.WarehouseInformation; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author feikefei + * @create 2023-07-14-10:12 + */ +@Service +public class WarehouseInformationService extends ServiceImpl { + + public ResultBean selectWarehouseInformation(){ + ResultBean rb = ResultBean.fireFail(); + List list = baseMapper.selectWarehouseInformation(); + return rb.success().setData(list); + } +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java index 19d5327..156eaf9 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShHttp.java @@ -23,12 +23,14 @@ public class ShHttp { "ViAOV+KoptwY2MCNSRLKYE4pCA2BCit7nr3EqNZRqqhKaOE44iyv45zCFrllx3nn" + "wF3X/l+rR4G7Vc7HZwiqKF3RXl9PqmTLJkzhdpAdQX/Kr3SRRHsv/DzKjAZr/2jK" + "rQIDAQAB"; - private static final String RSA_KEY = "sJI8PuGweKztQ6nLgp3dqcwljdKGFjPBD3XyUqCFsVG8rYhAIbD2AkNIKaefbjOB"; +// private static final String RSA_KEY = "sJI8PuGweKztQ6nLgp3dqcwljdKGFjPBD3XyUqCFsVG8rYhAIbD2AkNIKaefbjOB";//测试key + private static final String RSA_KEY = "dshigFSuey3iugsEUfghscwljdKGFjPBD3XyUqCFsVG8rYhAIbD2AkNIKaefbjOB";//正式key private static final String RSA_KEY_MD5 = SecureUtil.md5(RSA_KEY); private static final RSA RSA_OBJ = new RSA(null, RSA_PUBLIC_KEY); // private static String baseUrl = "http://hf-service.tiefaos.com"; - private static String baseUrl = "http://hf.lx-obj.top"; +// private static String baseUrl = "http://hf.lx-obj.top";//测试服务器 + private static String baseUrl = "https://hf-service.shanhainengyuan.com";//正式服务器 public static String doGet(String apiUrl, Map params) { String url = baseUrl + apiUrl; diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java index a5e1c76..609d831 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java @@ -138,9 +138,12 @@ public class ShRequester { * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse> **/ public static BaseResponse> getApi$system$inventory$index(InventoryIndex reqParams){ - Map param = null; - if (reqParams != null) + Map param = new HashMap<>(); + if (reqParams != null){ param = BeanUtil.beanToMap(reqParams); + } + param.put("page",1); + param.put("limit",2000); BaseResponse> resp = new BaseResponse<>(); BaseResponseListObj respObj = new BaseResponseListObj<>(); String s = ShHttp.doGet(inventory$index, param); diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/Inventory.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/Inventory.java index 17d2962..118d2d9 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/Inventory.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/Inventory.java @@ -28,7 +28,7 @@ public class Inventory { @ApiModelProperty("物料名称") private String materiel_name;//"铝线3*95+1-50mm" @ApiModelProperty("物料单价(成本价)") - private String price;//"0.00" + private Double price;//"0.00" @ApiModelProperty("最后更新时间") private String update_time;//1684723525 @ApiModelProperty("物料组明文")