From 47b3dc73a5b9274815a3e3fa631ad911453c84ad Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 05 九月 2025 14:26:12 +0800 Subject: [PATCH] crm --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java | 33 +++++++++++++++++++++++++-------- 1 files changed, 25 insertions(+), 8 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 a009823..a146dcc 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 @@ -6,22 +6,20 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.dto.TErpGoodsAddDto; -import com.ruoyi.system.dto.TErpGoodsUpdateStatus; +import com.ruoyi.system.dto.TErpGoodsInfoSaveDto; import com.ruoyi.system.dto.TErpGoodsUpdateStatusDto; import com.ruoyi.system.model.TErpGoods; import com.ruoyi.system.query.TErpGoodsQuery; -import com.ruoyi.system.query.TErpIssueReportingQuery; -import com.ruoyi.system.service.TCrmClinicService; -import com.ruoyi.system.service.TCrmSupplierService; import com.ruoyi.system.service.TErpGoodsService; -import com.ruoyi.system.service.TErpIssueReportingService; import com.ruoyi.system.vo.TErpGoodsVO; -import com.ruoyi.system.vo.TErpIssueReportingVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; /** * <p> @@ -63,11 +61,13 @@ @ApiOperation(value = "供应商添加商品") @PostMapping(value = "/add") public R<Boolean> add(@Validated @RequestBody TErpGoodsAddDto dto) { - if (erpGoodsService.isExit(dto.getGoodsIdCode())) { + SysUser user = tokenService.getLoginUser().getUser(); + if (erpGoodsService.isExit(dto.getGoodsIdCode(), dto.getQuasiNumber())) { return R.fail("erp商品已存在"); } TErpGoods goods = new TErpGoods(); - goods.setSupplierId(user.getClinicId()); + goods.setSupplierClinicId(user.getUserId().toString()); + goods.setCreateId(user.getUserId().toString()); goods.setGoodsIdCode(dto.getGoodsIdCode()); goods.setQuasiNumber(dto.getQuasiNumber()); goods.setManufacturer(dto.getManufacturer()); @@ -101,5 +101,22 @@ boolean b = erpGoodsService.updateById(goods); return R.ok(b); } + + @ApiOperation(value = "供应商完善商品") + @PostMapping(value = "/saveDataInfo") + public R<Boolean> saveDataInfo(@RequestBody @Valid TErpGoodsInfoSaveDto dto) { + TErpGoods goods = erpGoodsService.getById(dto.getId()); + BeanUtils.copyProperties(dto,goods); + return R.ok(erpGoodsService.updateById(goods)); + } + + @ApiOperation(value = "供应商商品详情") + @GetMapping(value = "/detail/{id}") + public R<TErpGoods> detail( @PathVariable String id) { + TErpGoods goods = erpGoodsService.getById(id); + return R.ok(goods); + } + + } -- Gitblit v1.7.1