From 5ba50d43ea3384a606ab16501633797297a78de3 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期五, 12 九月 2025 10:31:08 +0800 Subject: [PATCH] 供应商erp --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 53 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java index 5c1c855..175acf9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java @@ -181,6 +181,23 @@ @PostMapping(value = "/saveDataInfo") public R<Boolean> saveDataInfo(@RequestBody @Valid TErpGoodsInfoSaveDto dto) { SysUser user = tokenService.getLoginUser().getUser(); + Integer roleType = user.getRoleType(); + String clinicSupplierId=null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + clinicSupplierId = crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + clinicSupplierId =crmClinic.getId(); + } + TErpGoods goods = erpGoodsService.getById(dto.getId()); BeanUtils.copyProperties(dto,goods); if(goods.getMaintenanceInterval()!=null){ @@ -195,7 +212,7 @@ if (tErpSupplierWarehousingBatch.getWarehousingNumber()-sum>0) { // 生成保养单 TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); - tErpMaintenanceReminder.setClinicSupplierId(user.getUserId().toString()); + tErpMaintenanceReminder.setClinicSupplierId(clinicSupplierId); tErpMaintenanceReminder.setMaintenanceType(1); tErpMaintenanceReminder.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); Integer day = Integer.valueOf(goods.getMaintenanceInterval()); @@ -228,6 +245,23 @@ public void listExport(@RequestBody TErpGoodsQuery query) { SysUser user = tokenService.getLoginUser().getUser(); + + Integer roleType = user.getRoleType(); + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + query.setSupplierClinicId(crmSupplier.getId()); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + query.setSupplierClinicId(crmClinic.getId()); + } + List<TErpGoodsVO> pageList = erpGoodsService.listExport(query,user); Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TErpGoodsVO.class, pageList); HttpServletResponse response = WebUtils.response(); @@ -274,10 +308,26 @@ if (collect.size() != carAnnuallyImportExcels.size()) { return AjaxResult.error("导入数据中商品标识码重复"); } + Integer roleType = user.getRoleType(); for (TErpGoodsExcel erpGoodsExcel : carAnnuallyImportExcels) { TErpGoods goods = new TErpGoods(); - goods.setSupplierClinicId(user.getUserId().toString()); - goods.setGoodsSource(1); + + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + goods.setSupplierClinicId(crmSupplier.getId()); + goods.setGoodsSource(1); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + goods.setSupplierClinicId(crmClinic.getId()); + goods.setGoodsSource(2); + } // 判空 if(erpGoodsExcel.getGoodsName()==null || erpGoodsExcel.getGoodsName().isEmpty()){ -- Gitblit v1.7.1