| | |
| | | package com.consum.base.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.TemplateExportParams; |
| | | import cn.hutool.core.util.ReflectUtil; |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.CodeGeneratorEnum; |
| | | import com.consum.base.core.CodeGeneratorService; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.pojo.LWhFormProcureExtend; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsParams; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParams; |
| | | import com.consum.base.service.*; |
| | | import com.consum.model.po.*; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.pojo.response.FormProcureVO; |
| | | import com.consum.base.pojo.response.FromProcureTemplateInfoVO; |
| | | import com.consum.base.pojo.response.GoodsModelVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureExtendVO; |
| | | import com.consum.base.pojo.response.LWhFormProcureGoodsVO; |
| | | import com.consum.base.service.BaseGoodsTemplateServiceImpl; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LOrgSupplierServiceImpl; |
| | | import com.consum.base.service.LWhFormProcureCoreService; |
| | | import com.consum.base.service.LWhFormProcureGoodsService; |
| | | import com.consum.base.service.LWhFormProcureService; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.model.po.BaseGoodsTemplate; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LOrgSupplier; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.consum.model.po.LWhFormProcureGoods; |
| | | import com.consum.model.po.LWhProcureModel; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import com.walker.web.ResponseValue; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @ClassName LWhFormProcureController |
| | | * @Author cy |
| | | * @Date 2023/10/27 |
| | | * @Description |
| | | * @Version 1.0 |
| | | **/ |
| | | @Api(value = "仓库表单采购", tags = "仓库表单采购") |
| | | @RestController |
| | | @RequestMapping("/pc/whForm/procure") |
| | | public class LWhFormProcureController extends BaseController { |
| | | |
| | | @Resource |
| | | private LWhFormProcureService lWhFormProcureService; |
| | | @Resource |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Resource |
| | | private FinSysTenantServiceImpl finSysTenantService; |
| | | @Resource |
| | | private CodeGeneratorService codeGeneratorService; |
| | | @Resource |
| | |
| | | private BaseGoodsTemplateServiceImpl baseGoodsTemplateService; |
| | | @Resource |
| | | private LWhProcureModelService lWhProcureModelService; |
| | | @Resource |
| | | private LOrgSupplierServiceImpl lOrgSupplierService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | | */ |
| | | @PostMapping("/add") |
| | | public ResponseValue add(@RequestBody LWhFormProcureParam param) { |
| | | public ResponseValue add() { |
| | | LWhFormProcureParam param = CommonUtil.getObjFromReqBody(LWhFormProcureParam.class); |
| | | LWhFormProcureParam param2 = new LWhFormProcureParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | return this.add(param); |
| | | } |
| | | |
| | | private ResponseValue add(LWhFormProcureParam param) { |
| | | Long warehouseId = param.getWarehouseId(); |
| | | if (param.getWarehouseId() == null) { |
| | | return ResponseValue.error("仓库ID不能为空"); |
| | | } |
| | | BaseWarehouse baseWarehouse = baseWarehouseService.getById(warehouseId); |
| | | // 只能添加本机构仓库的进货单 |
| | | //?????? |
| | | // |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String tenantId = sysTenantUser.getTenantId(); |
| | | String tenantName = sysTenantUser.getTenantName(); |
| | | |
| | | List<LWhFormProcureGoodsParams> procureGoods = param.getProcureGoods(); |
| | | List<LWhFormProcureGoodsInfoParam> procureGoods = param.getProcureGoods(); |
| | | if (CollectionUtils.isEmpty(procureGoods)) { |
| | | return ResponseValue.error("采购单不能为空"); |
| | | } |
| | |
| | | if (whFormProcureId == null) { |
| | | whFormProcureId = NumberGenerator.getLongSequenceNumber(); |
| | | } |
| | | long procureTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); |
| | | long procureTime = Long.valueOf(param.getProcureTime()); |
| | | |
| | | Set<String> supplierList = new HashSet<>(); |
| | | |
| | | ArrayList<LWhFormProcureGoods> procureGoodList = new ArrayList<>(); |
| | | ArrayList<LWhProcureModel> whProcureModeLlist = new ArrayList<>(); |
| | | ArrayList<LWhProcureModel> procureModelList = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < procureGoods.size(); i++) { |
| | | LWhFormProcureGoodsParams procureGoodT = procureGoods.get(i); |
| | | LWhFormProcureGoodsInfoParam procureGoodT = procureGoods.get(i); |
| | | Long baseCategoryId = procureGoodT.getBaseCategoryId(); |
| | | Long baseGoodsTemplateId = procureGoodT.getBaseGoodsTemplateId(); |
| | | String supplier = procureGoodT.getSupplier(); |
| | | List<LWhProcureModelParams> models = procureGoodT.getModels(); |
| | | // 判断当前供应商是否已存在 |
| | | if (!supplierList.contains(supplier) && !lOrgSupplierService.supplierIsContain(tenantId, supplier)) { |
| | | supplierList.add(supplier); |
| | | } |
| | | |
| | | List<LWhProcureModelParam> models = procureGoodT.getModels(); |
| | | if (CollectionUtils.isEmpty(models)) { |
| | | return ResponseValue.error("采购单不能为空"); |
| | | } |
| | |
| | | procureGood.setWhFormProcureId(whFormProcureId); |
| | | procureGood.setBaseCategoryId(baseCategoryId); |
| | | procureGood.setBaseGoodsTemplateId(baseGoodsTemplateId); |
| | | procureGood.setGoodsTemplateName(null); |
| | | // TODO 物品历史版本 |
| | | procureGood.setGoodsTemplateName(procureGoodT.getGoodsTemplateName()); |
| | | procureGood.setSupplier(supplier); |
| | | procureGood.setSort(i); |
| | | for (LWhProcureModelParams modelT : models) { |
| | | for (LWhProcureModelParam modelT : models) { |
| | | Integer counts = modelT.getCounts(); |
| | | if (counts == null || counts <= 0) { |
| | | return ResponseValue.error("型号的采购数量只能为正整数"); |
| | |
| | | if (tempGoodsInfo == null) { |
| | | return ResponseValue.error("采购的价型号未找到"); |
| | | } |
| | | String modelName = (String) tempGoodsInfo.get("modelname"); |
| | | // 查询型号库存 |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, (short) 1, null); |
| | | int goodsModelNum = lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | LWhProcureModel model = new LWhProcureModel(); |
| | | model.setId(NumberGenerator.getLongSequenceNumber()); |
| | | model.setFromProcureGoodsId(fromProcureGoodsId); |
| | | model.setBusinessType(WhBusinessEnum.CAIGOU.getValue() + 0); |
| | | model.setBusinessId(whFormProcureId); |
| | | model.setBaseGoodsModelsId(baseGoodsModelsId); |
| | | model.setBaseGoodsModelsName(modelName); |
| | | model.setPrice(price); |
| | | model.setCounts(counts); |
| | | model.setWorehouseCount(goodsModelNum); |
| | | model.setSupplier(supplier); |
| | | whProcureModeLlist.add(model); |
| | | model.setTotalAmount(price * counts); |
| | | procureModelList.add(model); |
| | | } |
| | | procureGoodList.add(procureGood); |
| | | } |
| | | lWhFormProcureGoodsService.insertBatch(procureGoodList); |
| | | lWhProcureModelService.insertBatch(whProcureModeLlist); |
| | | lWhProcureModelService.insertBatch(procureModelList); |
| | | |
| | | // 插入 采购单物品【L_WH_FORM_PROCURE_GOODS】 |
| | | LWhFormProcure lWhFormProcure = new LWhFormProcure(); |
| | | lWhFormProcure.setId(whFormProcureId); |
| | | lWhFormProcure.setBusinessFormCode(codeGeneratorService.createCodeByPrefix(CodeGeneratorEnum.Procure_Warehouse.getValue(), 10)); |
| | | lWhFormProcure.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Procure_Warehouse)); |
| | | lWhFormProcure.setWarehouseId(warehouseId); |
| | | lWhFormProcure.setWarehouseName(baseWarehouse.getWarehouseName()); |
| | | lWhFormProcure.setBuyerId(currentUser.getId()); |
| | |
| | | lWhFormProcure.setAgencyId(baseWarehouse.getAgencyId()); |
| | | lWhFormProcure.setAgencyName(baseWarehouse.getAgencyName()); |
| | | int result = lWhFormProcureService.insert(lWhFormProcure); |
| | | if (result > 0) return ResponseValue.success(1); |
| | | |
| | | supplierList.forEach(supplier -> { |
| | | LOrgSupplier lOrgSupplier = new LOrgSupplier(); |
| | | lOrgSupplier.setId(NumberGenerator.getLongSequenceNumber()); |
| | | lOrgSupplier.setAgencyId(tenantId); |
| | | lOrgSupplier.setAgencyName(tenantName); |
| | | lOrgSupplier.setSupplier(supplier); |
| | | lOrgSupplierService.insert(lOrgSupplier); |
| | | }); |
| | | if (result > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | | return ResponseValue.error("新增失败!"); |
| | | } |
| | | |
| | | /** |
| | | * @Description 列表查询 |
| | | */ |
| | | @ApiOperation(value = "采购单列表查询", notes = "采购单列表查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "param", value = "采购查询条件", required = true, dataType = "FormProcureQryDto", paramType = "query") |
| | | }) |
| | | @GetMapping("/list") |
| | | public ResponseValue queryFormProcureList(LWhFormProcureParam param) { |
| | | public ResponseValue queryFormProcureList() { |
| | | FormProcureQry param = CommonUtil.getObjFromReq(FormProcureQry.class); |
| | | FormProcureQry param2 = new FormProcureQry(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | FinSysTenantUser sysInfo = getSysInfo(); |
| | | /*当前登录人只能看到自己机构下的列表*/ |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String tenantId = sysInfo.getTenantId(); |
| | | if (param.getAgencyId() == null) { |
| | | param.setAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | PageUtil genericPager = lWhFormProcureService.queryFormProcureList(param); |
| | | List<LWhFormProcure> data = genericPager.getDatas(); |
| | | ArrayList<FormProcureVO> result = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(data)) { |
| | | data.forEach(item -> { |
| | | |
| | | //只能查询本级 及以下机构的进货单 |
| | | //?????? |
| | | FormProcureVO fromProcureVO = new FormProcureVO(); |
| | | BeanUtils.copyProperties(item, fromProcureVO); |
| | | List<FromProcureTemplateInfoVO> procureTemplateInfoList = Lists.newArrayList(); |
| | | |
| | | GenericPager genericPager = lWhFormProcureService.queryFormProcureList(param); |
| | | List<LWhFormProcure> datas = genericPager.getDatas(); |
| | | ArrayList<LWhFormProcureExtend> newDatas = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(datas)) { |
| | | datas.forEach(item -> { |
| | | // 查询型号数量 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setBusinessType(1); |
| | | lWhProcureModel.setBusinessId(item.getId()); |
| | | List<LWhProcureModel> models = lWhProcureModelService.select(lWhProcureModel); |
| | | LWhFormProcureExtend formProcureExtend = new LWhFormProcureExtend(); |
| | | BeanUtils.copyProperties(item, formProcureExtend); |
| | | formProcureExtend.setModels(models); |
| | | newDatas.add(formProcureExtend); |
| | | String sql = "select fpg.id,BASE_CATEGORY_ID ,BASE_GOODS_TEMPLATE_ID ,GOODS_TEMPLATE_NAME ,sum(counts) count " |
| | | + "from L_WH_FORM_PROCURE_GOODS fpg left join L_WH_PROCURE_MODEL pm on fpg.id = pm.FROM_PROCURE_GOODS_ID " |
| | | + "where fpg.WH_FORM_PROCURE_ID =:id group by pm.FROM_PROCURE_GOODS_ID"; |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("id", item.getId()); |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | for (Map<String, Object> map : procureModelList) { |
| | | FromProcureTemplateInfoVO procureTemplateInfoVO = MapUtils.convertMapToObj(map, FromProcureTemplateInfoVO.class); |
| | | procureTemplateInfoList.add(procureTemplateInfoVO); |
| | | } |
| | | fromProcureVO.setFromProcureTemplateInfoList(procureTemplateInfoList); |
| | | |
| | | result.add(fromProcureVO); |
| | | }); |
| | | } |
| | | try { |
| | | Field fieldDatas = GenericPager.class.getDeclaredField("datas"); |
| | | fieldDatas.setAccessible(true); |
| | | fieldDatas.set(genericPager, newDatas); |
| | | // fieldDatas.setAccessible(true); |
| | | // fieldDatas.set(genericPager, result); |
| | | ReflectUtil.setFieldValue(genericPager, fieldDatas, result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // genericPager.setDatas(newDatas); |
| | | genericPager.setDatas(result); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | | |
| | |
| | | * @Description 编辑 |
| | | */ |
| | | @PostMapping("/edit") |
| | | public ResponseValue edit(@RequestBody LWhFormProcureParam param) { |
| | | public ResponseValue edit() { |
| | | LWhFormProcureParam param = CommonUtil.getObjFromReqBody(LWhFormProcureParam.class); |
| | | LWhFormProcureParam param2 = new LWhFormProcureParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | ResponseValue delFlag = delById(param.getId()); |
| | | if (delFlag.getCode() == ResponseValue.CODE_SUCCESS) { |
| | | return this.add(param); |
| | |
| | | return ResponseValue.error("采购单id为空"); |
| | | } |
| | | LWhFormProcure lWhFormProcure = lWhFormProcureService.get(new LWhFormProcure(id)); |
| | | LWhFormProcureExtend formProcureExtend = new LWhFormProcureExtend(); |
| | | BeanUtils.copyProperties(lWhFormProcure, formProcureExtend); |
| | | if (lWhFormProcure == null) { |
| | | return ResponseValue.error("采购单不存在"); |
| | | } |
| | | LWhFormProcureExtendVO lWhFormProcureExtendVO = new LWhFormProcureExtendVO(); |
| | | BeanUtils.copyProperties(lWhFormProcure, lWhFormProcureExtendVO); |
| | | |
| | | // 物品 |
| | | LWhFormProcureGoods lWhFormProcureGoods = new LWhFormProcureGoods(); |
| | | lWhFormProcureGoods.setWhFormProcureId(id); |
| | | List<LWhFormProcureGoods> formProcureGoods = lWhFormProcureGoodsService.select(lWhFormProcureGoods); |
| | | |
| | | Field fieldModels = null; |
| | | try { |
| | | fieldModels = LWhFormProcureGoodsParams.class.getDeclaredField("models"); |
| | | } catch (NoSuchFieldException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | fieldModels.setAccessible(true); |
| | | ArrayList<LWhFormProcureGoodsParams> procureGoodsParams = new ArrayList<>(); |
| | | // Field fieldModels = null; |
| | | // try { |
| | | // fieldModels = LWhFormProcureGoodsVO.class.getDeclaredField("models"); |
| | | // } catch (NoSuchFieldException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // fieldModels.setAccessible(true); |
| | | ArrayList<LWhFormProcureGoodsVO> procureGoodsVOList = new ArrayList<>(); |
| | | for (LWhFormProcureGoods formProcureGood : formProcureGoods) { |
| | | LWhFormProcureGoodsParams lWhFormProcureGoodsParams = new LWhFormProcureGoodsParams(); |
| | | BeanUtils.copyProperties(formProcureGood, lWhFormProcureGoodsParams); |
| | | LWhFormProcureGoodsVO lWhFormProcureGoodsVO = new LWhFormProcureGoodsVO(); |
| | | BeanUtils.copyProperties(formProcureGood, lWhFormProcureGoodsVO); |
| | | |
| | | Long baseGoodsTemplateId = formProcureGood.getBaseGoodsTemplateId(); |
| | | BaseGoodsTemplate queryEntity = new BaseGoodsTemplate(); |
| | | queryEntity.setId(baseGoodsTemplateId); |
| | | BaseGoodsTemplate baseGoodsTemplate = baseGoodsTemplateService.get(queryEntity); |
| | | lWhFormProcureGoodsVO.setBaseCategoryName(baseGoodsTemplate.getCategoryName()); |
| | | // 查询型号数量 |
| | | LWhProcureModel lWhProcureModel = new LWhProcureModel(); |
| | | lWhProcureModel.setFromProcureGoodsId(formProcureGood.getId()); |
| | | List<LWhProcureModel> models = lWhProcureModelService.select(lWhProcureModel); |
| | | fieldModels.set(lWhFormProcureGoodsParams, models); |
| | | procureGoodsParams.add(lWhFormProcureGoodsParams); |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | paramMap.put("formProcureGoodId", formProcureGood.getId()); |
| | | String sql = "SELECT\n" + "pm.BASE_GOODS_MODELS_ID,pm.BASE_GOODS_MODELS_NAME,pm.PRICE,pm.COUNTS,pm.WOREHOUSE_COUNT,bgm.unit " + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | | + "\tLEFT JOIN base_goods_models bgm on pm.BASE_GOODS_MODELS_ID = bgm.id where pm.FROM_PROCURE_GOODS_ID =:formProcureGoodId"; |
| | | List<Map<String, Object>> procureModelList = lWhProcureModelService.select(sql, paramMap, new MapperUtil()); |
| | | List<GoodsModelVO> goodsModelVOList = Lists.newArrayList(); |
| | | procureModelList.forEach(item -> { |
| | | GoodsModelVO goodsModelVO = MapUtils.convertMapToObj(item, GoodsModelVO.class); |
| | | goodsModelVOList.add(goodsModelVO); |
| | | }); |
| | | // fieldModels.set(lWhFormProcureGoodsVO, goodsModelVOList); |
| | | ReflectUtil.setFieldValue(lWhFormProcureGoodsVO, "models", goodsModelVOList); |
| | | |
| | | procureGoodsVOList.add(lWhFormProcureGoodsVO); |
| | | } |
| | | formProcureExtend.setProcureGoods(procureGoodsParams); |
| | | return ResponseValue.success("查询成功!", formProcureExtend); |
| | | lWhFormProcureExtendVO.setProcureGoods(procureGoodsVOList); |
| | | return ResponseValue.success("查询成功!", lWhFormProcureExtendVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "采购单明细查询", notes = "采购单明细查询") |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "采购单明细查询", required = true, dataType = "FormProcureQryDto", paramType = "query")}) |
| | | @GetMapping("detail/list") |
| | | public ResponseValue queryFormProcureDetailList() { |
| | | FormProcureQry formProcureQry = CommonUtil.getObjFromReq(FormProcureQry.class); |
| | | FormProcureQry param2 = new FormProcureQry(); |
| | | CommonUtil.copyProperties(formProcureQry, param2); |
| | | formProcureQry = param2; |
| | | |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | |
| | | GenericPager genericPager = lWhFormProcureService.queryFormProcureDetailList(formProcureQry); |
| | | return ResponseValue.success(genericPager); |
| | | } |
| | | |
| | | @ApiOperation(value = "采购单导出", notes = "采购单导出") |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/采购入库单.xlsx"); |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | | |
| | | Map<String, Object> map = lWhFormProcureService.getExportList(id, userName); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | throw new RuntimeException("数据为空"); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("采购入库单.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | } |
| | | } |