From 14f55cd77189bae10627277a2a3dab9cec5fcada Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 14 十月 2025 18:43:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java | 57 +++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java | 27 +
ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java | 6
ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml | 11
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsQuery.java | 3
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java | 2
ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierOutboundGoods.java | 3
ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml | 6
ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextVO.java | 11
ruoyi-system/src/main/java/com/ruoyi/system/vo/ExchangeGoodsRecordDetailVo.java | 54 +++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java | 207 +++++++++++++-
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java | 83 +++++
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml | 47 ++
ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpMaintenanceReminderListVo.java | 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java | 5
ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextThreeVO.java | 33 ++
ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java | 4
ruoyi-system/src/main/java/com/ruoyi/system/dto/DetailProcurementSendDto.java | 19 +
ruoyi-system/src/main/java/com/ruoyi/system/dto/ExchangeGoodsDto.java | 21 +
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java | 181 ++++++------
ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml | 3
ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml | 27 +
ruoyi-system/src/main/java/com/ruoyi/system/query/ExchangeGoodsRecordQuery.java | 11
ruoyi-system/src/main/java/com/ruoyi/system/service/TSysGoodsService.java | 7
24 files changed, 662 insertions(+), 171 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
index 3164da2..2060448 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
@@ -11,6 +11,7 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.dto.AddProcurementDto;
+import com.ruoyi.system.dto.DetailProcurementSendDto;
import com.ruoyi.system.dto.UpdateStatusProcurementDto;
import com.ruoyi.system.dto.UpdateStatusProcurementLastDto;
import com.ruoyi.system.model.*;
@@ -63,13 +64,14 @@
private final TCrmBranchService crmBranchService;
private final TCrmSalespersonService crmSalespersonService;
private final TErpProcurementCommissionService erpProcurementCommissionService;
+ private final TCrmWarehouseService crmWarehouseService;
@Autowired
public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService, TCrmClinicService crmClinicService, TErpProcurementGoodsService erpProcurementGoodsService
, TErpGoodsService erpGoodsService, TErpClinicWarehousingService erpClinicWarehousingService, TErpClinicWarehousingBatchService erpClinicWarehousingBatchService,
- TCrmSupplierService crmSupplierService, TErpMaintenanceReminderService erpMaintenanceReminderService, TSysOtherConfigService sysOtherConfigService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService, TCrmSalespersonService crmSalespersonService, TErpProcurementCommissionService erpProcurementCommissionService) {
+ TCrmSupplierService crmSupplierService, TErpMaintenanceReminderService erpMaintenanceReminderService, TSysOtherConfigService sysOtherConfigService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService, TCrmSalespersonService crmSalespersonService, TErpProcurementCommissionService erpProcurementCommissionService, TCrmWarehouseService crmWarehouseService) {
this.erpProcurementService = erpProcurementService;
this.tokenService = tokenService;
this.crmClinicService = crmClinicService;
@@ -85,6 +87,8 @@
this.crmBranchService = crmBranchService;
this.crmSalespersonService = crmSalespersonService;
this.erpProcurementCommissionService = erpProcurementCommissionService;
+
+ this.crmWarehouseService = crmWarehouseService;
}
@@ -184,19 +188,22 @@
@ApiOperation(value = "采购详情--发货(仓库角色)")
- @PostMapping(value = "/detailProcurementSend/{id}")
- public R<?> detailProcurementSend(@PathVariable String id) {
+ @PostMapping(value = "/detailProcurementSend")
+ public R<?> detailProcurementSend(@RequestBody DetailProcurementSendDto 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())
+ List<String> clinicSupplierId=null;
+ if(roleType == 6){
+
+ TCrmWarehouse warehouse = crmWarehouseService.getOne(Wrappers.lambdaQuery(TCrmWarehouse.class)
+ .eq(TCrmWarehouse::getUserId, user.getUserId())
.last("LIMIT 1"));
- clinicSupplierId=crmSupplier.getId();
+
+ // 供应商
+ clinicSupplierId = crmSupplierService.list(Wrappers.lambdaQuery(TCrmSupplier.class)
+ .eq(TCrmSupplier::getWarehouseId, warehouse.getId())).stream().map(TCrmSupplier::getId).collect(Collectors.toList());
}
- erpProcurementService.detailProcurementSend(clinicSupplierId, user, id);
+ erpProcurementService.detailProcurementSend(clinicSupplierId, user, dto.getId(),dto.getLogisticsNumber());
return R.ok();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
index 88cc9c4..c1db0bb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderController.java
@@ -447,6 +447,11 @@
// 先退分账 在退订单
// 查出采购单 算出价格 下单 算出应该分佣金额 应该分给谁
TErpProcurement erpProcurement = erpProcurementService.getById(id);
+ if(erpProcurement.getStatus()==2){
+ erpProcurement.setStatus(6);
+ erpProcurementService.updateById(erpProcurement);
+ return R.ok("操作成功");
+ }
// 还未分账成功不能退款
if(erpProcurement.getStatus()==null || erpProcurement.getStatus()!=1){
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
index 14a8778..8f28916 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
@@ -6,21 +6,29 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.BaseModel;
+import com.ruoyi.common.core.domain.BasePage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.dto.ExchangeGoodsDto;
import com.ruoyi.system.dto.TErpGoodsUpdateStatusDto;
import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.ExchangeGoodsRecordQuery;
import com.ruoyi.system.query.TSysGoodsExchangeQuery;
import com.ruoyi.system.query.TSysGoodsQuery;
import com.ruoyi.system.service.*;
+import com.ruoyi.system.vo.ExchangeGoodsRecordDetailVo;
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.web.bind.annotation.*;
import javax.validation.Valid;
+import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -40,21 +48,28 @@
private final TokenService tokenService;
private final TCrmSupplierService crmSupplierService;
private final TSysGoodsExchangeService sysGoodsExchangeService;
+ private final TCrmClinicService crmClinicService;
+ private final TCrmClinicPointsService crmClinicPointsService;
+ private final TCrmChangePointsService crmChangePointsService;
@Autowired
- public TSysGoodsController(TokenService tokenService, TSysGoodsService sysGoodsService, TCrmSupplierService crmSupplierService, TSysGoodsExchangeService sysGoodsExchangeService) {
+ public TSysGoodsController(TokenService tokenService, TSysGoodsService sysGoodsService, TCrmSupplierService crmSupplierService, TSysGoodsExchangeService sysGoodsExchangeService, TCrmClinicService crmClinicService, TCrmClinicPointsService crmClinicPointsService, TCrmChangePointsService crmChangePointsService) {
this.sysGoodsService = sysGoodsService;
this.tokenService = tokenService;
this.crmSupplierService = crmSupplierService;
this.sysGoodsExchangeService = sysGoodsExchangeService;
+ this.crmClinicService = crmClinicService;
+ this.crmClinicPointsService = crmClinicPointsService;
+
+ this.crmChangePointsService = crmChangePointsService;
}
/**
* 获取积分商品列表
*/
- @ApiOperation(value = "获取积分商品列表")
+ @ApiOperation(value = "获取积分商品列表--供应商")
@PostMapping(value = "/pageList")
public R<PageInfo<TSysGoods>> pageList(@RequestBody TSysGoodsQuery query) {
@@ -92,8 +107,7 @@
}
-
- @ApiOperation(value = "添加积分商品")
+ @ApiOperation(value = "添加积分商品--供应商")
@PostMapping(value = "/add")
public R<String> add(@RequestBody TSysGoods goods) {
SysUser user = tokenService.getLoginUser().getUser();
@@ -110,7 +124,7 @@
return R.ok();
}
- @ApiOperation(value = "编辑积分商品")
+ @ApiOperation(value = "编辑积分商品--供应商")
@PostMapping(value = "/update")
public R<String> update(@RequestBody TSysGoods goods) {
SysUser user = tokenService.getLoginUser().getUser();
@@ -118,7 +132,7 @@
List<TSysGoodsExchange> list = sysGoodsExchangeService.list(new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, goods.getId()));
int sum = list.stream().mapToInt(TSysGoodsExchange::getGoodsCount).sum();
- if(goods.getGoodsTotal()< sum){
+ if (goods.getGoodsTotal() < sum) {
return R.fail("商品总数不能小于已兑换数量");
}
if (roleType == 4) {
@@ -134,8 +148,7 @@
}
-
- @ApiOperation(value = "删除积分商品")
+ @ApiOperation(value = "删除积分商品--供应商")
@DeleteMapping(value = "/delete/{id}")
public R<String> delete(@PathVariable String id) {
SysUser user = tokenService.getLoginUser().getUser();
@@ -146,9 +159,9 @@
.eq(TCrmSupplier::getUserId, user.getUserId())
.last("LIMIT 1"));
TSysGoods goods = sysGoodsService.getById(id);
- if(goods.getSupplierId().equals(crmSupplier.getId())){
+ if (goods.getSupplierId().equals(crmSupplier.getId())) {
sysGoodsService.removeById(id);
- }else {
+ } else {
return R.fail("没有权限");
}
}
@@ -156,7 +169,7 @@
}
- @ApiOperation(value = "积分商品 上下架")
+ @ApiOperation(value = "积分商品 上下架--供应商")
@PostMapping(value = "/updateStatus")
public R<String> updateStatus(@RequestBody @Valid TErpGoodsUpdateStatusDto dto) {
SysUser user = tokenService.getLoginUser().getUser();
@@ -167,10 +180,10 @@
.eq(TCrmSupplier::getUserId, user.getUserId())
.last("LIMIT 1"));
TSysGoods goods = sysGoodsService.getById(dto.getId());
- if(goods.getSupplierId().equals(crmSupplier.getId())){
+ if (goods.getSupplierId().equals(crmSupplier.getId())) {
goods.setStatus(dto.getState());
sysGoodsService.updateById(goods);
- }else {
+ } else {
return R.fail("没有权限");
}
}
@@ -179,18 +192,18 @@
// 获取兑换记录
- @ApiOperation(value = "获取兑换记录")
+ @ApiOperation(value = "获取兑换记录--供应商")
@PostMapping(value = "/getExchangeRecord")
public R<PageInfo<TSysGoodsExchange>> getExchangeRecord(@RequestBody @Valid TSysGoodsExchangeQuery query) {
PageInfo<TSysGoodsExchange> page = new PageInfo<>(query.getPageNum(), query.getPageSize());
LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, query.getId());
- if(query.getClinicName()!=null && !query.getClinicName().isEmpty()){
+ if (query.getClinicName() != null && !query.getClinicName().isEmpty()) {
wrapper.like(TSysGoodsExchange::getClinicName, query.getClinicName());
}
- if(query.getTime()!=null && !query.getTime().isEmpty()){
- wrapper.between(TSysGoodsExchange::getCreateTime, query.getTime().split(" - ")[0]+ " 00:00:00", query.getTime().split(" - ")[1]+ " 23:59:59");
+ if (query.getTime() != null && !query.getTime().isEmpty()) {
+ wrapper.between(TSysGoodsExchange::getCreateTime, query.getTime().split(" - ")[0] + " 00:00:00", query.getTime().split(" - ")[1] + " 23:59:59");
}
- if(query.getStatus()!=null){
+ if (query.getStatus() != null) {
wrapper.eq(TSysGoodsExchange::getStatus, query.getStatus());
}
wrapper.orderByDesc(BaseModel::getCreateTime);
@@ -199,11 +212,11 @@
}
// 获取兑换记录
- @ApiOperation(value = "发货")
+ @ApiOperation(value = "发货--供应商")
@PostMapping(value = "/sendGoods")
public R<?> sendGoods(@RequestBody @Valid TSysGoodsExchange exchange) {
TSysGoodsExchange exchange1 = sysGoodsExchangeService.getById(exchange.getId());
- if(exchange1.getStatus()==2){
+ if (exchange1.getStatus() == 2) {
return R.fail("该订单已发货");
}
exchange1.setStatus(2);
@@ -212,5 +225,159 @@
return R.ok();
}
+
+ /**
+ * 获取积分商品列表
+ */
+ @ApiOperation(value = "获取积分商品列表--诊所")
+ @PostMapping(value = "/pageListClinic")
+ public R<HashMap<String, Object>> pageListClinic(@RequestBody TSysGoodsQuery query) {
+ PageInfo<TSysGoods> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+ LambdaQueryWrapper<TSysGoods> tSysGoodsLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ tSysGoodsLambdaQueryWrapper.eq(TSysGoods::getStatus, 1);
+ if (query.getGoodsName() != null && !query.getGoodsName().isEmpty()) {
+ tSysGoodsLambdaQueryWrapper.like(TSysGoods::getGoodsName, query.getGoodsName());
+ }
+ tSysGoodsLambdaQueryWrapper.orderByDesc(BaseModel::getCreateTime);
+
+ Page<TSysGoods> page = sysGoodsService.page(pageInfo, tSysGoodsLambdaQueryWrapper);
+ List<TSysGoods> records = page.getRecords();
+ if (!records.isEmpty()) {
+ List<TSysGoodsExchange> list = sysGoodsExchangeService.list(new LambdaQueryWrapper<TSysGoodsExchange>().in(TSysGoodsExchange::getGoodsId, records.stream().map(TSysGoods::getId).collect(Collectors.toList())));
+ records.forEach(item -> {
+ item.setExchangeQuantity(list.stream().filter(item1 -> item1.getGoodsId().equals(item.getId())).mapToInt(TSysGoodsExchange::getGoodsCount).sum());
+ item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity());
+ });
+ }
+ pageInfo.setRecords(records);
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("data", pageInfo);
+
+ // 获取我的可用积分
+ map.put("total", sysGoodsService.count(tSysGoodsLambdaQueryWrapper));
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if (roleType == 5) {
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ List<TCrmClinicPoints> list = crmClinicPointsService.list(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points"));
+ map.put("myPoints", list.stream().mapToInt(item -> item.getPoints() - item.getUsePoints()).sum());
+ }
+ return R.ok(map);
+ }
+
+ /**
+ * 获取积分商品详情
+ */
+ @ApiOperation(value = "获取积分商品列表--详情")
+ @GetMapping(value = "/detail/{id}")
+ public R<TSysGoods> detail(@PathVariable String id) {
+ TSysGoods goods = sysGoodsService.getById(id);
+ return R.ok(goods);
+ }
+
+
+ /**
+ * 兑换商品
+ */
+ @ApiOperation(value = "兑换商品--诊所")
+ @PostMapping(value = "/exchangeGoods")
+ public R<?> exchangeGoods(@RequestBody @Valid ExchangeGoodsDto dto) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if (roleType == 5) {
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ sysGoodsService.exchangeGoods(crmClinic, dto);
+ return R.ok();
+ }
+ return R.fail("请选择正确的角色");
+ }
+
+
+ /**
+ * 兑换商品记录
+ */
+ @ApiOperation(value = "兑换商品记录--诊所")
+ @PostMapping(value = "/exchangeGoodsRecord")
+ public R<?> exchangeGoodsRecord(@RequestBody ExchangeGoodsRecordQuery query) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if (roleType == 5) {
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+
+ LambdaQueryWrapper<TSysGoodsExchange> eq = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getClinicId, crmClinic.getId());
+ if (query.getName() != null && !query.getName().isEmpty()) {
+ eq.like(TSysGoodsExchange::getGoodsName, query.getName());
+ }
+ eq.orderByDesc(BaseModel::getCreateTime);
+
+
+ PageInfo<TSysGoodsExchange> page = sysGoodsExchangeService.page(new PageInfo<>(query.getPageNum(), query.getPageSize()), eq);
+ return R.ok(page);
+ }
+ return R.fail("请选择正确的角色");
+ }
+
+ /**
+ * 兑换商品记录
+ */
+ @ApiOperation(value = "兑换商品记录详情--诊所")
+ @GetMapping(value = "/exchangeGoodsRecordDetail/{id}")
+ public R<ExchangeGoodsRecordDetailVo> exchangeGoodsRecord(@PathVariable String id) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if (roleType == 5) {
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ TSysGoodsExchange exchangeServiceById = sysGoodsExchangeService.getById(id);
+ if (exchangeServiceById.getClinicId().equals(crmClinic.getId())) {
+ ExchangeGoodsRecordDetailVo vo = new ExchangeGoodsRecordDetailVo();
+ BeanUtils.copyProperties(exchangeServiceById, vo);
+
+ String goodsId = vo.getGoodsId();
+ TSysGoods sysGoods = sysGoodsService.getById(goodsId);
+ vo.setGoodsDetail(sysGoods.getGoodsDetail());
+ vo.setGoodsCover(sysGoods.getGoodsCover());
+
+
+ return R.ok(vo);
+ }
+ }
+ return R.fail("请选择正确的角色");
+ }
+
+
+ /**
+ * 兑换商品记录
+ */
+ @ApiOperation(value = "积分变更记录--诊所")
+ @PostMapping(value = "/pointsRecordDetail")
+ public R<PageInfo<TCrmChangePoints>> pointsRecordDetail(@RequestBody BasePage page) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if (roleType == 5) {
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+
+ PageInfo<TCrmChangePoints> page1 = crmChangePointsService.page(new PageInfo<>(page.getPageNum(), page.getPageSize()), new LambdaQueryWrapper<TCrmChangePoints>().eq(TCrmChangePoints::getBranchSalespersonId, crmClinic.getId()).eq(TCrmChangePoints::getUserType, 3).orderByDesc(BaseModel::getCreateTime));
+
+ return R.ok(page1);
+ }
+ return R.fail("请选择正确的角色");
+ }
+
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/dto/DetailProcurementSendDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/dto/DetailProcurementSendDto.java
new file mode 100644
index 0000000..4fc6054
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/dto/DetailProcurementSendDto.java
@@ -0,0 +1,19 @@
+package com.ruoyi.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@ApiModel("仓库发货dto")
+public class DetailProcurementSendDto {
+ @ApiModelProperty("id")
+ @NotBlank(message = "id不能为空")
+ private String id;
+
+ @ApiModelProperty("物流单号")
+ @NotBlank(message = "物流单号不能为空")
+ private String logisticsNumber;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/dto/ExchangeGoodsDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/dto/ExchangeGoodsDto.java
new file mode 100644
index 0000000..7057e61
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/dto/ExchangeGoodsDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.system.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+
+@Data
+@ApiModel("诊所兑换商品dto")
+public class ExchangeGoodsDto {
+ @ApiModelProperty("商品id")
+ @NotBlank(message = "商品id不能为空")
+ private String goodsId;
+
+ @ApiModelProperty("数量")
+ @NotNull(message = "数量不能为空")
+ private Integer count;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java
index 0eadac6..8376d8c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java
@@ -28,7 +28,7 @@
List<TErpGoodsVO> inventoryNotEnoughList(@Param("user") SysUser user);
- List<TErpProcurementVo> pageListWarehouse(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") String supplierClinicId);
+ List<TErpProcurementVo> pageListWarehouse(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") List<String> supplierClinicId);
List<SupplierThirtyProcurementStatisticsVO> supplierThirtyProcurementStatistics(@Param("supplierAndClinicId")String supplierAndClinicId,
@Param("startTime")String startTime,
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierOutboundGoods.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierOutboundGoods.java
index 0f16e36..128d29d 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierOutboundGoods.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierOutboundGoods.java
@@ -51,5 +51,8 @@
@TableField("total_price")
private BigDecimal totalPrice;
+ @ApiModelProperty(value = "采购商品id")
+ @TableField("procurement_goods_id")
+ private String procurementGoodsId;
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
index 1d5adde..8e34475 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
@@ -63,4 +63,8 @@
@TableField("logistics_number")
private String logisticsNumber;
+ @ApiModelProperty(value = "诊所id")
+ @TableField("clinic_id")
+ private String clinicId;
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/ExchangeGoodsRecordQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/ExchangeGoodsRecordQuery.java
new file mode 100644
index 0000000..ac18377
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/ExchangeGoodsRecordQuery.java
@@ -0,0 +1,11 @@
+package com.ruoyi.system.query;
+
+import com.ruoyi.common.core.domain.BasePage;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("诊所兑换记录Query")
+public class ExchangeGoodsRecordQuery extends BasePage {
+ private String name;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsQuery.java
index 10f81ec..a55369f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsQuery.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsQuery.java
@@ -10,6 +10,9 @@
@ApiModel(value = "erp商品库存信息查询参数query")
public class TErpGoodsQuery extends BasePage {
+ @ApiModelProperty(value = "供应商名称")
+ private String supplierName;
+
@ApiModelProperty(value = "商品名称")
private String goodsName;
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java
index dffc65a..5a96425 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpProcurementService.java
@@ -12,6 +12,7 @@
import javax.validation.Valid;
import java.math.BigDecimal;
+import java.math.BigDecimal;
import java.util.List;
/**
@@ -41,8 +42,7 @@
DetailProcurementVO detailProcurement(String clinicSupplierId, SysUser user, String id);
- void detailProcurementSend(String clinicSupplierId, SysUser user, String id);
-
+ void detailProcurementSend(List<String> clinicSupplierId, SysUser user, String id,String logisticsNumber);
/**
* 供应商采购统计
* @param supplierAndClinicId
@@ -50,7 +50,7 @@
* @param endTime
* @return
*/
- List<SupplierThirtyProcurementStatisticsVO> supplierThirtyProcurementStatistics(String supplierAndClinicId, String startTime, String endTime,Integer roleType);
+ List<SupplierThirtyProcurementStatisticsVO> supplierThirtyProcurementStatistics(String supplierAndClinicId, String startTime, String endTime, Integer roleType);
/**
* 供应商30天采购金额统计
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TSysGoodsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TSysGoodsService.java
index c8f8ca7..6573d6f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TSysGoodsService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TSysGoodsService.java
@@ -1,7 +1,11 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.system.dto.ExchangeGoodsDto;
+import com.ruoyi.system.model.TCrmClinic;
import com.ruoyi.system.model.TSysGoods;
+
+import javax.validation.Valid;
/**
* <p>
@@ -13,4 +17,7 @@
*/
public interface TSysGoodsService extends IService<TSysGoods> {
+ void exchangeGoods(TCrmClinic crmClinic, ExchangeGoodsDto dto);
+
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
index 742bfa3..587e81a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -80,30 +80,29 @@
public PageInfo<PageInventoryListVo> pageInventoryList(TErpInventoryQuery query, SysUser user) {
Integer roleType = user.getRoleType();
String supplierClinicId = null;
- if(roleType == 5){
+ if (roleType == 5) {
// 诊所
TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class)
.eq(TCrmClinic::getUserId, user.getUserId())
.last("LIMIT 1"));
- supplierClinicId =crmClinic.getId();
+ supplierClinicId = crmClinic.getId();
}
- String sTime=null;
- String eTime =null;
- if(query.getTime()!=null && !query.getTime().isEmpty()){
+ String sTime = null;
+ String eTime = null;
+ if (query.getTime() != null && !query.getTime().isEmpty()) {
String[] split = query.getTime().split(" - ");
sTime = split[0] + " 00:00:00";
eTime = split[1] + " 23:59:59";
}
PageInfo<PageInventoryListVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
- List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo,query,user,sTime,eTime,supplierClinicId);
- if(list.isEmpty()){
+ List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo, query, user, sTime, eTime, supplierClinicId);
+ if (list.isEmpty()) {
return pageInfo;
}
-
List<String> collect = list.stream().map(PageInventoryListVo::getId).collect(Collectors.toList());
- List<TErpClinicInventoryGoods> tErpSupplierInventoryGoods = erpClinicInventoryGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicInventoryGoods>().in(TErpClinicInventoryGoods::getInventoryId,collect));
+ List<TErpClinicInventoryGoods> tErpSupplierInventoryGoods = erpClinicInventoryGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicInventoryGoods>().in(TErpClinicInventoryGoods::getInventoryId, collect));
for (PageInventoryListVo pageInventoryListVo : list) {
// 盘盈
BigDecimal add = BigDecimal.ZERO;
@@ -114,9 +113,9 @@
for (TErpClinicInventoryGoods tErpSupplierInventoryGoods1 : tErpSupplierInventoryGoodsList) {
- if(tErpSupplierInventoryGoods1!=null){
+ if (tErpSupplierInventoryGoods1 != null) {
// 盘盈 查入库
- if(tErpSupplierInventoryGoods1.getInventoryType()==1){
+ if (tErpSupplierInventoryGoods1.getInventoryType() == 1) {
TErpClinicWarehousingBatch tErpSupplierWarehousing = erpClinicWarehousingBatchMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingBatchId());
// List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getWarehousingId, tErpSupplierWarehousing.getId()));
// int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpSupplierWarehousingBatch::getWarehousingNumber).sum();
@@ -125,7 +124,7 @@
int count = tErpSupplierInventoryGoods1.getInventoryCount() - tErpSupplierInventoryGoods1.getDamagedCount();
BigDecimal multiply = tErpSupplierWarehousing.getSalesAmount().multiply(new BigDecimal(count));
add = add.add(multiply);
- }else {
+ } else {
// 盘亏 查出库
TErpClinicOutbound tErpSupplierOutbound = erpClinicOutboundMapper.selectById(tErpSupplierInventoryGoods1.getWarehousingId());
@@ -161,20 +160,20 @@
ArrayList<InventoryDetailVo> inventoryDetailVos = new ArrayList<>();
List<TErpClinicInventoryGoods> tErpSupplierInventoryGoods = erpClinicInventoryGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicInventoryGoods>().eq(TErpClinicInventoryGoods::getInventoryId, id));
- if(tErpSupplierInventoryGoods!=null && !tErpSupplierInventoryGoods.isEmpty()){
+ if (tErpSupplierInventoryGoods != null && !tErpSupplierInventoryGoods.isEmpty()) {
for (TErpClinicInventoryGoods tErpSupplierInventoryGood : tErpSupplierInventoryGoods) {
InventoryDetailVo inventoryDetailVo = new InventoryDetailVo();
- if(tErpSupplierInventoryGood.getInventoryType()==1){
+ if (tErpSupplierInventoryGood.getInventoryType() == 1) {
TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
String goodsId = tErpSupplierInventoryGood.getGoodsId();
TErpGoods goods = erpGoodsMapper.selectById(goodsId);
- if(goods.getGoodsSource()==1){
+ if (goods.getGoodsSource() == 1) {
TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
- if(supplier!=null){
+ if (supplier != null) {
inventoryDetailVo.setSupplierName(supplier.getSupplierName());
}
- }else {
+ } else {
inventoryDetailVo.setSupplierName(goods.getSupplierName());
}
@@ -188,10 +187,10 @@
List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber()));
int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpClinicWarehousingBatch::getWarehousingNumber).sum();
List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpClinicWarehousingBatch::getId).collect(Collectors.toList());
- if(!collect.isEmpty()){
+ if (!collect.isEmpty()) {
List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, collect));
int sum1 = tErpSupplierOutboundGoods.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
- sum = sum-sum1;
+ sum = sum - sum1;
}
// sum = 剩余库存
@@ -199,7 +198,7 @@
inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount());
inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType());
inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount());
- }else {
+ } else {
TErpClinicOutbound tErpSupplierOutbound = erpClinicOutboundMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, tErpSupplierOutbound.getId()));
for (TErpClinicOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) {
@@ -207,12 +206,12 @@
TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(warehousingId);
String goodsId = tErpSupplierInventoryGood.getGoodsId();
TErpGoods goods = erpGoodsMapper.selectById(goodsId);
- if(goods.getGoodsSource()==1){
+ if (goods.getGoodsSource() == 1) {
TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
- if(supplier!=null){
+ if (supplier != null) {
inventoryDetailVo.setSupplierName(supplier.getSupplierName());
}
- }else {
+ } else {
inventoryDetailVo.setSupplierName(goods.getSupplierName());
}
@@ -229,10 +228,10 @@
List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getId, outboundGoods.getWarehousingBatchId()));
int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpClinicWarehousingBatch::getWarehousingNumber).sum();
List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpClinicWarehousingBatch::getId).collect(Collectors.toList());
- if(!collect.isEmpty()){
+ if (!collect.isEmpty()) {
List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods1 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().in(TErpClinicOutboundGoods::getWarehousingBatchId, collect));
int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
- sum = sum-sum1;
+ sum = sum - sum1;
}
// sum = 剩余库存
@@ -256,17 +255,16 @@
}
-
@Override
public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) {
Integer roleType = user.getRoleType();
String supplierClinicId = null;
- if(roleType == 5){
+ if (roleType == 5) {
// 诊所
TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class)
.eq(TCrmClinic::getUserId, user.getUserId())
.last("LIMIT 1"));
- supplierClinicId =crmClinic.getId();
+ supplierClinicId = crmClinic.getId();
}
// 获取当前时间后9个月的时间
LocalDateTime nineMonthLater = LocalDateTime.now().plusMonths(9);
@@ -274,21 +272,20 @@
PageInfo<ValidityPeriodWarningVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
-
- return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater,supplierClinicId);
+ return this.baseMapper.validityPeriodWarning(pageInfo, query, user, nineMonthLater, supplierClinicId);
}
@Override
public PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user) {
PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
- List<TErpGoodsVO> list = this.baseMapper.pageList(query,pageInfo,user);
- if(list.isEmpty()){
+ List<TErpGoodsVO> list = this.baseMapper.pageList(query, pageInfo, user);
+ if (list.isEmpty()) {
return pageInfo;
}
List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList());
- if(!typeIds.isEmpty()){
+ if (!typeIds.isEmpty()) {
List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds);
for (TErpGoodsVO tErpGoodsVO : list) {
typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName()));
@@ -298,16 +295,17 @@
pageInfo.setRecords(list);
return pageInfo;
}
+
@Override
public List<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user) {
- List<TErpGoodsVO> list = this.baseMapper.pageList1(query,user);
- if(list.isEmpty()){
+ List<TErpGoodsVO> list = this.baseMapper.pageList1(query, user);
+ if (list.isEmpty()) {
return list;
}
List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList());
- if(!typeIds.isEmpty()){
+ if (!typeIds.isEmpty()) {
List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds);
for (TErpGoodsVO tErpGoodsVO : list) {
typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName()));
@@ -320,16 +318,16 @@
@Override
public PageInfo<TErpClinicWarehousePageListVO> warehousePageList(TClinicWarehouseQuery query, SysUser user, String supplierClinicId) {
String time = query.getTime();
- String sTime =null;
+ String sTime = null;
String eTime = null;
- if(time!=null && !time.isEmpty()){
+ if (time != null && !time.isEmpty()) {
String[] split = time.split(" - ");
sTime = split[0] + " 00:00:00";
eTime = split[1] + " 23:59:59";
}
PageInfo<TErpClinicWarehousePageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
- List<TErpClinicWarehousePageListVO> list = this.baseMapper.warehousePageList(query,pageInfo,user,supplierClinicId,sTime,eTime);
- if(list.isEmpty()){
+ List<TErpClinicWarehousePageListVO> list = this.baseMapper.warehousePageList(query, pageInfo, user, supplierClinicId, sTime, eTime);
+ if (list.isEmpty()) {
return pageInfo;
}
List<String> collect = list.stream().map(TErpClinicWarehousePageListVO::getId).collect(Collectors.toList());
@@ -346,15 +344,15 @@
@Override
public PageInfo<TErpClinicOutboundPageListVO> outboundPageList(TClinicOutboundQuery query, SysUser user, String supplierClinicId) {
String time = query.getTime();
- String sTime =null;
+ String sTime = null;
String eTime = null;
- if(time!=null && !time.isEmpty()){
+ if (time != null && !time.isEmpty()) {
String[] split = time.split(" - ");
sTime = split[0] + " 00:00:00";
eTime = split[1] + " 23:59:59";
}
PageInfo<TErpClinicOutboundPageListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
- List<TErpClinicOutboundPageListVO> list = this.baseMapper.outboundPageList(query,pageInfo,user,supplierClinicId,sTime,eTime);
+ List<TErpClinicOutboundPageListVO> list = this.baseMapper.outboundPageList(query, pageInfo, user, supplierClinicId, sTime, eTime);
pageInfo.setRecords(list);
return pageInfo;
}
@@ -366,53 +364,58 @@
// Map<String, List<clinicWarehouseGoodsDto>> collect = dtos.stream().collect(Collectors.groupingBy(clinicWarehouseGoodsDto::getSupplierId));
// for (Map.Entry<String, List<clinicWarehouseGoodsDto>> stringListEntry : collect.entrySet()) {
- TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing();
- tErpClinicWarehousing.setClinicId(supplierClinicId);
- tErpClinicWarehousing.setCreateId(user.getUserId().toString());
- tErpClinicWarehousing.setWarehouseNo("G"+ DateUtils.dateTimeNow());
- tErpClinicWarehousing.setCreateTime(LocalDateTime.now());
- tErpClinicWarehousing.setType(3);
- tErpClinicWarehousing.setStatus(dtos.getStatus());
- this.save(tErpClinicWarehousing);
+ TErpClinicWarehousing tErpClinicWarehousing = new TErpClinicWarehousing();
+ tErpClinicWarehousing.setClinicId(supplierClinicId);
+ tErpClinicWarehousing.setCreateId(user.getUserId().toString());
+ tErpClinicWarehousing.setWarehouseNo("G" + DateUtils.dateTimeNow());
+ tErpClinicWarehousing.setCreateTime(LocalDateTime.now());
+ tErpClinicWarehousing.setType(3);
+ tErpClinicWarehousing.setStatus(dtos.getStatus());
+ this.save(tErpClinicWarehousing);
- BigDecimal totalPrice = new BigDecimal(0);
- for (clinicWarehouseGoodsDto dto : dtos.getDtos()) {
- TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch();
- tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId());
- tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount());
- tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber());
- tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay());
- tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay());
- tErpClinicWarehousingBatch.setGoodsId(dto.getId());
- TErpGoods goods = erpGoodsMapper.selectById(dto.getId());
- tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName());
- tErpClinicWarehousingBatch.setQuasiNumber(goods.getQuasiNumber());
- tErpClinicWarehousingBatch.setUnitAmount(dto.getUnitAmount());
- tErpClinicWarehousingBatch.setSalesAmount(dto.getSalesAmount());
- if(dto.getSalesAmount()==null){
- tErpClinicWarehousingBatch.setSalesAmount(goods.getClinicPurchasePrice());
- }
- tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount());
- erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch);
-
-
- if(goods.getMaintenanceInterval()!=null && !goods.getMaintenanceInterval().isEmpty()){
- TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
- tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId);
- tErpMaintenanceReminder.setMaintenanceType(2);
- tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId());
- Integer day = Integer.valueOf(goods.getMaintenanceInterval());
- // 当前时间+day天
- LocalDateTime time1 = LocalDateTime.now().plusDays(day);
- tErpMaintenanceReminder.setMaintenanceTime(time1);
- erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder);
- }
-
-
- totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount())));
+ BigDecimal totalPrice = new BigDecimal(0);
+ ArrayList<String> names = new ArrayList<>();
+ for (clinicWarehouseGoodsDto dto : dtos.getDtos()) {
+ TErpClinicWarehousingBatch tErpClinicWarehousingBatch = new TErpClinicWarehousingBatch();
+ tErpClinicWarehousingBatch.setWarehousingId(tErpClinicWarehousing.getId());
+ tErpClinicWarehousingBatch.setWarehousingNumber(dto.getPurchaseCount());
+ tErpClinicWarehousingBatch.setBatchNumber(dto.getBatchNumber());
+ tErpClinicWarehousingBatch.setProductionDate(dto.getProductionDate().atStartOfDay());
+ tErpClinicWarehousingBatch.setExpiryDate(dto.getExpiryDate().atStartOfDay());
+ tErpClinicWarehousingBatch.setGoodsId(dto.getId());
+ TErpGoods goods = erpGoodsMapper.selectById(dto.getId());
+ String supplierName = goods.getSupplierName();
+ names.add(supplierName);
+ tErpClinicWarehousingBatch.setGoodsName(goods.getGoodsName());
+ tErpClinicWarehousingBatch.setQuasiNumber(goods.getQuasiNumber());
+ tErpClinicWarehousingBatch.setUnitAmount(dto.getUnitAmount());
+ tErpClinicWarehousingBatch.setSalesAmount(dto.getSalesAmount());
+ if (dto.getSalesAmount() == null) {
+ tErpClinicWarehousingBatch.setSalesAmount(goods.getClinicPurchasePrice());
}
- tErpClinicWarehousing.setTotalPrice(totalPrice);
- this.updateById(tErpClinicWarehousing);
+ tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount());
+ erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch);
+
+
+ if (goods.getMaintenanceInterval() != null && !goods.getMaintenanceInterval().isEmpty()) {
+ TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
+ tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId);
+ tErpMaintenanceReminder.setMaintenanceType(2);
+ tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId());
+ Integer day = Integer.valueOf(goods.getMaintenanceInterval());
+ // 当前时间+day天
+ LocalDateTime time1 = LocalDateTime.now().plusDays(day);
+ tErpMaintenanceReminder.setMaintenanceTime(time1);
+ erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder);
+ }
+
+
+ totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount())));
+ }
+ tErpClinicWarehousing.setTotalPrice(totalPrice);
+ String name = names.stream().collect(Collectors.joining(","));
+ tErpClinicWarehousing.setSupplierName(name);
+ this.updateById(tErpClinicWarehousing);
// }
@@ -423,7 +426,7 @@
TErpClinicOutbound tErpClinicOutbound = new TErpClinicOutbound();
tErpClinicOutbound.setClinicId(supplierClinicId);
tErpClinicOutbound.setCreateId(user.getUserId().toString());
- tErpClinicOutbound.setOutboundNumber("G"+ DateUtils.dateTimeNow());
+ tErpClinicOutbound.setOutboundNumber("G" + DateUtils.dateTimeNow());
tErpClinicOutbound.setCreateTime(LocalDateTime.now());
tErpClinicOutbound.setOutboundType(dto.getOutboundType());
tErpClinicOutbound.setTotalMoney(dto.getTotalPrice());
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
index 3456362..0ff98fd 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -44,6 +44,7 @@
import java.math.RoundingMode;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -99,6 +100,8 @@
@Resource
private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper;
+ @Resource
+ private TCrmWarehouseMapper crmWarehouseMapper;
@Override
public PageInfo<TErpProcurementVo> pageList(TErpProcurementQuery query, SysUser user) {
@@ -168,15 +171,15 @@
Integer roleType = user.getRoleType();
- String supplierClinicId = null;
+ List<String> supplierClinicId = null;
if (roleType == 6) {
- // 供应商
- TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class)
- .eq(TCrmSupplier::getUserId, user.getUserId())
+
+ TCrmWarehouse warehouse = crmWarehouseMapper.selectOne(Wrappers.lambdaQuery(TCrmWarehouse.class)
+ .eq(TCrmWarehouse::getUserId, user.getUserId())
.last("LIMIT 1"));
- supplierClinicId = crmSupplier.getId();
-
-
+ // 供应商
+ supplierClinicId = crmSupplierMapper.selectList(Wrappers.lambdaQuery(TCrmSupplier.class)
+ .eq(TCrmSupplier::getWarehouseId, warehouse.getId())).stream().map(TCrmSupplier::getId).collect(Collectors.toList());
String sTime = null;
String eTime = null;
if (query.getTime() != null && !query.getTime().isEmpty()) {
@@ -377,7 +380,7 @@
BigDecimal all = BigDecimal.ZERO;
for (AddProcurementDto addProcurementDto : value) {
- BigDecimal multiply = addProcurementDto.getSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount()));
+ BigDecimal multiply = addProcurementDto.getGoodsSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount()));
all = all.add(multiply);
}
tErpProcurement.setPayMoney(all);
@@ -404,7 +407,9 @@
tErpProcurementGoods.setQuasiNumber(goods.getQuasiNumber());
TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
- tErpProcurementGoods.setUnitName(tErpGoodsUnit.getUnitName());
+ if(tErpGoodsUnit!=null){
+ tErpProcurementGoods.setUnitName(tErpGoodsUnit.getUnitName());
+ }
tErpProcurementGoods.setPurchasePrice(dto.getGoodsSalesAmount());
tErpProcurementGoods.setSalesAmount(dto.getSalesAmount());
tErpProcurementGoods.setTotalPrice(dto.getGoodsSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount())));
@@ -460,6 +465,25 @@
detailProcurementNextVO.setTotalPrice(tErpProcurement.getPayMoney());
detailProcurementNextVO.setId(tErpProcurementGoods.getId());
detailProcurementNextVO.setPurchasePrice(tErpProcurementGoods.getPurchasePrice());
+
+ List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getProcurementGoodsId, tErpProcurementGoods.getId()));
+ if(!tErpSupplierOutboundGoods.isEmpty()){
+ ArrayList<DetailProcurementNextThreeVO> detailProcurementNextThreeVOS = new ArrayList<>();
+ List<String> collect = tErpSupplierOutboundGoods.stream().map(TErpSupplierOutboundGoods::getWarehousingBatchId).collect(Collectors.toList());
+ List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectBatchIds(collect);
+ for (TErpSupplierOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) {
+ List<TErpSupplierWarehousingBatch> collect1 = tErpSupplierWarehousingBatches.stream().filter(e -> e.getId().equals(tErpSupplierOutboundGood.getWarehousingBatchId())).collect(Collectors.toList());
+ for (TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch : collect1) {
+ DetailProcurementNextThreeVO detailProcurementNextThreeVO = new DetailProcurementNextThreeVO();
+ detailProcurementNextThreeVO.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
+ detailProcurementNextThreeVO.setProductionDate(tErpSupplierWarehousingBatch.getProductionDate());
+ detailProcurementNextThreeVO.setExpirationDate(tErpSupplierWarehousingBatch.getExpiryDate());
+ detailProcurementNextThreeVO.setNum(tErpSupplierOutboundGood.getOutboundCount());
+ detailProcurementNextThreeVOS.add(detailProcurementNextThreeVO);
+ }
+ }
+ detailProcurementNextVO.setDetailProcurementNextThreeVOS(detailProcurementNextThreeVOS);
+ }
detailProcurementNextVOS.add(detailProcurementNextVO);
}
detailProcurementVO.setList(detailProcurementNextVOS);
@@ -468,11 +492,11 @@
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
- public void detailProcurementSend(String clinicSupplierId, SysUser user, String id) {
+ public void detailProcurementSend(List<String> clinicSupplierId, SysUser user, String id,String logisticsNumber) {
// 查出这个采购的下级商品
List<TErpProcurementGoods> list = erpProcurementGoodsService.list(new QueryWrapper<TErpProcurementGoods>().eq("procurement_id", id));
List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>()
- .eq(TErpSupplierWarehousing::getSupplierId, clinicSupplierId).in(TErpSupplierWarehousing::getGoodsId, list.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toList()))
+ .in(TErpSupplierWarehousing::getSupplierId, clinicSupplierId).in(TErpSupplierWarehousing::getGoodsId, list.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toList()))
.orderByAsc(BaseModel::getCreateTime));
if(tErpSupplierWarehousings.isEmpty()){
@@ -516,7 +540,7 @@
if(count>=purchaseCount){
// 添加出库记录
TErpSupplierOutbound tErpSupplierOutbound= new TErpSupplierOutbound();
- tErpSupplierOutbound.setSupplierId(clinicSupplierId);
+ tErpSupplierOutbound.setSupplierId(tErpSupplierWarehousing.getSupplierId());
tErpSupplierOutbound.setWarehouseId(tErpSupplierWarehousing.getWarehouseId());
tErpSupplierOutbound.setOutboundType(7);
//TODO 确定这个是采购价还是销售价格
@@ -530,6 +554,7 @@
tErpSupplierOutboundGoods.setWarehousingBatchId(warehousingBatch.getId());
tErpSupplierOutboundGoods.setOutboundCount(purchaseCount);
tErpSupplierOutboundGoods.setTotalPrice(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount)));
+ tErpSupplierOutboundGoods.setProcurementGoodsId(tErpProcurementGoods.getId());
erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
continue outer;
}
@@ -538,7 +563,7 @@
purchaseCount = purchaseCount - count;
// 添加出库记录
TErpSupplierOutbound tErpSupplierOutbound= new TErpSupplierOutbound();
- tErpSupplierOutbound.setSupplierId(clinicSupplierId);
+ tErpSupplierOutbound.setSupplierId(tErpSupplierWarehousing.getSupplierId());
tErpSupplierOutbound.setWarehouseId(tErpSupplierWarehousing.getWarehouseId());
tErpSupplierOutbound.setOutboundType(7);
//TODO 确定这个是采购价还是销售价格
@@ -552,6 +577,7 @@
tErpSupplierOutboundGoods.setWarehousingBatchId(warehousingBatch.getId());
tErpSupplierOutboundGoods.setOutboundCount(purchaseCount);
tErpSupplierOutboundGoods.setTotalPrice(tErpProcurementGoods.getPurchasePrice().multiply(new BigDecimal(purchaseCount)));
+ tErpSupplierOutboundGoods.setProcurementGoodsId(tErpProcurementGoods.getId());
erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
}
@@ -564,6 +590,11 @@
}
+ TErpProcurement byId = this.getById(id);
+ byId.setStatus(4);
+ byId.setSendTime(LocalDateTime.now());
+ byId.setLogisticsNumber(logisticsNumber);
+ this.updateById(byId);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
index 968616e..ae9dcc0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
@@ -1,10 +1,22 @@
package com.ruoyi.system.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.system.dto.ExchangeGoodsDto;
+import com.ruoyi.system.mapper.TCrmChangePointsMapper;
+import com.ruoyi.system.mapper.TCrmClinicPointsMapper;
+import com.ruoyi.system.mapper.TSysGoodsExchangeMapper;
import com.ruoyi.system.mapper.TSysGoodsMapper;
-import com.ruoyi.system.model.TSysGoods;
+import com.ruoyi.system.model.*;
import com.ruoyi.system.service.TSysGoodsService;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
/**
* <p>
@@ -17,4 +29,73 @@
@Service
public class TSysGoodsServiceImpl extends ServiceImpl<TSysGoodsMapper, TSysGoods> implements TSysGoodsService {
+ @Resource
+ private TSysGoodsExchangeMapper sysGoodsExchangeMapper;
+
+ @Resource
+ private TCrmClinicPointsMapper crmClinicPointsMapper;
+
+ @Resource
+ private TCrmChangePointsMapper crmChangePointsMapper;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void exchangeGoods(TCrmClinic crmClinic, ExchangeGoodsDto dto) {
+ // 盘点库存是否足够 判断积分是否足够 减积分 记录积分变更 添加购买记录
+ TSysGoods tSysGoods = this.getById(dto.getGoodsId());
+ int needPoints = tSysGoods.getRequiredPoints().intValue() * dto.getCount();
+
+ // 判断已经购买的了多少
+ List<TSysGoodsExchange> list = sysGoodsExchangeMapper.selectList(new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, dto.getGoodsId()));
+ int sum = list.stream().mapToInt(TSysGoodsExchange::getGoodsCount).sum();
+ if(sum+dto.getCount()>tSysGoods.getGoodsTotal()){
+ throw new RuntimeException("商品库存不足");
+ }
+ if(sum+dto.getCount()>tSysGoods.getConvertibleQuantity()){
+ throw new RuntimeException("可兑换数量不足");
+ }
+ List<TCrmClinicPoints> points = crmClinicPointsMapper.selectList(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points").orderByAsc(TCrmClinicPoints::getCreateTime));
+ // 可用积分
+ int userPoints = points.stream().mapToInt(item -> item.getPoints() - item.getUsePoints()).sum();
+ if(userPoints<needPoints){
+ throw new RuntimeException("积分不足");
+ }
+
+ for (TCrmClinicPoints point : points) {
+ if(needPoints==0){
+ break;
+ }
+ if(point.getPoints()-point.getUsePoints()>=needPoints){
+ point.setUsePoints(point.getUsePoints()+needPoints);
+ crmClinicPointsMapper.updateById(point);
+ needPoints = 0;
+ }else {
+ point.setUsePoints(point.getPoints());
+ crmClinicPointsMapper.updateById(point);
+ needPoints= needPoints - (point.getPoints() - point.getUsePoints());
+ }
+ }
+
+ // 添加兑换记录
+ TSysGoodsExchange exchange = new TSysGoodsExchange();
+ exchange.setClinicName(crmClinic.getClinicName());
+ exchange.setGoodsName(tSysGoods.getGoodsName());
+ exchange.setGoodsId(tSysGoods.getId());
+ exchange.setGoodsCount(dto.getCount());
+ exchange.setUsePoints(tSysGoods.getRequiredPoints().intValue() * dto.getCount());
+ exchange.setExchangeTime(LocalDateTime.now());
+ exchange.setClinicId(crmClinic.getId());
+ sysGoodsExchangeMapper.insert(exchange);
+
+ // 记录
+ TCrmChangePoints tCrmChangePoints = new TCrmChangePoints();
+ tCrmChangePoints.setBranchSalespersonId(crmClinic.getId());
+ tCrmChangePoints.setExchangeId(exchange.getId());
+ tCrmChangePoints.setUserType(3);
+ tCrmChangePoints.setChangeType(2);
+ tCrmChangePoints.setChangeReason(2);
+ tCrmChangePoints.setChangeValue(exchange.getUsePoints());
+ crmChangePointsMapper.insert(tCrmChangePoints);
+
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextThreeVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextThreeVO.java
new file mode 100644
index 0000000..5cee04d
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextThreeVO.java
@@ -0,0 +1,33 @@
+package com.ruoyi.system.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(value = "诊所采购详情三级Vo")
+public class DetailProcurementNextThreeVO {
+
+ @ApiModelProperty(value = "批次号")
+ private String batchNumber;
+
+ @ApiModelProperty(value = "生产日期")
+ private LocalDateTime productionDate;
+
+ @ApiModelProperty(value = "有效期")
+ private LocalDateTime expirationDate;
+
+
+ @ApiModelProperty(value = "入库数量")
+ private Integer num;
+
+
+
+
+
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextVO.java
index 0d8bf9e..8ba6e5c 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/DetailProcurementNextVO.java
@@ -8,6 +8,7 @@
import java.math.BigDecimal;
import java.time.LocalDateTime;
+import java.util.List;
@Data
@ApiModel(value = "诊所采购详情二级Vo")
@@ -25,14 +26,14 @@
@ApiModelProperty(value = "国药准字号")
private String quasiNumber;
+ @ApiModelProperty(value = "数量")
+ private Integer num;
+
@ApiModelProperty(value = "单位")
private String packingUnitName;
@ApiModelProperty(value = "售价")
private BigDecimal salesAmount;
-
- @ApiModelProperty(value = "数量")
- private Integer num;
@ApiModelProperty(value = "状态")
private BigDecimal totalPrice=BigDecimal.ZERO;
@@ -47,6 +48,10 @@
private BigDecimal purchasePrice;
+ @ApiModelProperty(value = "采购三级")
+ private List<DetailProcurementNextThreeVO> detailProcurementNextThreeVOS;
+
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/ExchangeGoodsRecordDetailVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ExchangeGoodsRecordDetailVo.java
new file mode 100644
index 0000000..9a301c9
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/ExchangeGoodsRecordDetailVo.java
@@ -0,0 +1,54 @@
+package com.ruoyi.system.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel("兑换记录详情")
+public class ExchangeGoodsRecordDetailVo {
+ @TableId(value = "id", type = IdType.ASSIGN_ID)
+ private String id;
+
+ @ApiModelProperty(value = "诊所名称")
+ private String clinicName;
+
+ @ApiModelProperty(value = "商品名称")
+ private String goodsName;
+
+ @ApiModelProperty(value = "商品id")
+ private String goodsId;
+
+ @ApiModelProperty(value = "商品数量")
+ private Integer goodsCount;
+
+ @ApiModelProperty(value = "使用积分")
+ private Integer usePoints;
+
+ @ApiModelProperty(value = "兑换时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime exchangeTime;
+
+ @ApiModelProperty(value = "状态 1=未发货 2=已发货")
+ private Integer status;
+
+ @ApiModelProperty(value = "物流单号")
+ private String logisticsNumber;
+
+ @ApiModelProperty(value = "诊所id")
+ private String clinicId;
+
+ @ApiModelProperty(value = "封面")
+ private String goodsCover;
+
+ @ApiModelProperty(value = "商品详情")
+ private String goodsDetail;
+
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpMaintenanceReminderListVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpMaintenanceReminderListVo.java
index bcc0e17..86908b0 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpMaintenanceReminderListVo.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/TErpMaintenanceReminderListVo.java
@@ -41,6 +41,11 @@
private LocalDateTime maintenanceTime;
+ @ApiModelProperty(value = "维护完成时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime successTime;
+
+
@ApiModelProperty(value = "状态 1=未维护 2=已维护")
private Integer status;
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
index 3d21851..c7365d5 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -123,19 +123,20 @@
<select id="warehousePageList" resultType="com.ruoyi.system.vo.TErpClinicWarehousePageListVO">
select t1.id,t1.warehouse_no,
- case when t1.type =1 then t2.supplier_name else t4.supplier_name end as supplierName,
+ case when t1.type =1 then t2.supplier_name else t1.supplier_name end as supplierName,
t3.procurement_code,
case when t1.type =1 then t3.pay_money else t1.total_price end as allTotalPrice,
t1.create_time warehouseTime,t1.type
- from t_erp_clinic_warehousing t1 left join t_erp_procurement t3 on t1.procurement_id = t3.id
+ from t_erp_clinic_warehousing t1
+ left join t_erp_procurement t3 on t1.procurement_id = t3.id
left join t_crm_supplier t2 on t3.supplier_id = t2.id and t1.type =1
- left join t_crm_supplier t4 on t1.supplier_id = t4.id and t1.type !=1
- where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId}
+
+ where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId} and t1.status =2
<if test="query.warehouseNo != null and query.warehouseNo != ''">
and t1.warehouse_no like concat('%',#{query.warehouseNo},'%')
</if>
<if test="query.supplierName != null and query.supplierName != ''">
- and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t4.supplier_name like concat('%',#{query.supplierName},'%'))
+ and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t1.supplier_name like concat('%',#{query.supplierName},'%'))
</if>
<if test="sTime != null">
and t1.create_time between #{sTime} and #{eTime}
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
index f7dc8c2..7984714 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -53,33 +53,58 @@
storage,supplier_name
</sql>
+
+
<select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO">
select
- <include refid="Base_Column_List"/>
- from t_erp_goods where disabled = 0
- <if test="query.goodsName != null and query.goodsName != ''">
- and goods_name like concat('%',#{query.goodsName},'%')
+ t1.id
+ , t1.supplier_clinic_id, t1.goods_source, t1.goods_name, t1.goods_id_code, t1.quasi_number, t1.manufacturer, t1.formulation_spec, t1.packing_spec, t1.type_id, t1.goods_yards, t1.maintenance_interval, t1.maintenance_interval_unit, t1.low_purchase_quantity, t1.low_unit_id, t1.is_prescription_drug, t1.goods_spec, t1.warning_inventory, t1.sales_amount, t1.packing_unit_id, t1.instructions_use, t1.side_effect, t1.clinic_purchase_price, t1.platform_commission_price, t1.create_time, t1.update_time, t1.create_by, t1.`state`, t1.update_by, t1.disabled,
+ t1.simplified_code,
+ t1.dosage_form,
+ t1.usage_classification,
+ t1.product_brand,
+ t1.place_of_origin,
+ t1.ingredient,
+ t1.trait,
+ t1.indication,
+ t1.taboo,
+ t1.precautions,
+ t1.interaction,
+ t1.storage,
+ case t1.goods_source
+ when 1 then t2.supplier_name
+ when 2 then t1.supplier_name
+ end as supplierName
+ from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id where t1.disabled = 0
+ <if test="query.supplierName != null and query.supplierName != ''">
+ and (t1.supplier_name like concat('%',#{query.supplierName},'%') or t2.supplier_name like concat('%',#{query.supplierName},'%'))
</if>
+ <if test="query.goodsName != null and query.goodsName != ''">
+ and t1.goods_name like concat('%',#{query.goodsName},'%')
+ </if>
+
<if test="query.goodsIdCode != null and query.goodsIdCode != ''">
- and goods_id_code like concat('%',#{query.goodsIdCode},'%')
+ and t1.goods_id_code like concat('%',#{query.goodsIdCode},'%')
</if>
<if test="query.typeId != null and query.typeId != ''">
- and type_id = #{query.typeId}
+ and t1.type_id = #{query.typeId}
</if>
<if test="query.quasiNumber != null and query.quasiNumber != ''">
- and quasi_number like concat('%',#{query.quasiNumber},'%')
+ and t1.quasi_number like concat('%',#{query.quasiNumber},'%')
</if>
<if test="query.state != null ">
- and state = #{query.state}
+ and t1.state = #{query.state}
</if>
<if test="user.roleType != null and user.roleType == 4 ">
- and goods_source =1 and supplier_clinic_id = #{query.supplierClinicId}
+ and t1.goods_source =1 and t1.supplier_clinic_id = #{query.supplierClinicId}
</if>
<if test="user.roleType != null and user.roleType == 5 ">
- and ( (goods_source =2 and supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId},clinic_ids) and state =1))
+ and ( ( t1.goods_source =2 and t1.supplier_clinic_id = #{query.supplierClinicId} ) or (FIND_IN_SET(#{query.supplierClinicId}, t1.clinic_ids) and t1.state =1))
</if>
- order by create_time desc
+ order by t1.create_time desc
</select>
+
+
<select id="listExport" resultType="com.ruoyi.system.vo.TErpGoodsVO">
select
<include refid="Base_Column_List"/>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml
index d4b980c..5958ae7 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml
@@ -31,7 +31,8 @@
t1.maintenance_person_id,
t1.maintenance_time,
t1.`status`,
- t3.warehouse_no
+ t3.warehouse_no,
+ t1.success_time as successTime
from t_erp_maintenance_reminder t1
LEFT JOIN t_erp_supplier_warehousing_batch t2 on t1.warehousing_batch_id = t2.id
left join t_erp_supplier_warehousing t3 on t2.warehousing_id = t3.id
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
index bd30f4f..a63da13 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
@@ -61,6 +61,7 @@
and t1.create_time between #{sTime} and #{eTime}
</if>
group by t1.id
+ order by t1.create_time desc
</select>
<select id="inventoryNotEnoughList" resultType="com.ruoyi.system.vo.TErpGoodsVO">
@@ -89,7 +90,10 @@
t1.status
from t_erp_procurement t1
left JOIN t_crm_clinic t2 on t1.clinic_id = t2.id
- where t1.disabled = 0 and t1.status in(3,4,5) and t1.supplier_id =#{supplierClinicId}
+ where t1.disabled = 0 and t1.status in(3,4,5) and t1.supplier_id in
+ <foreach collection="supplierClinicId" close=")" item="id" separator="," open="(" >
+ #{id}
+ </foreach>
<if test="query.procurementCode != null and query.procurementCode != ''">
and t1.procurement_code = #{query.procurementCode}
</if>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
index fbe6173..87eebc7 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
@@ -108,21 +108,20 @@
<select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo">
- select t2.warehouse_id,t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName,
- case
- when t3.id is null then t1.warehousing_number
- else t1.warehousing_number -t3.outbound_count
- end as num
+ select * from (select t2.warehouse_id,t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number,
+ t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName,
+ case
+ when t3.id is null then t1.warehousing_number
+ else t1.warehousing_number -t3.outbound_count
+ end as num,t3.id as ogid
from t_erp_supplier_warehousing_batch t1
- left join t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
- LEFT JOIN t_erp_supplier_outbound_goods t3 on t3.warehousing_batch_id = t1.id
- LEFT JOIN t_erp_goods t4 on t2.goods_id = t4.id
- left join t_erp_goods_type t5 on t4.type_id = t5.id
+ left join t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
+ LEFT JOIN t_erp_supplier_outbound_goods t3 on t3.warehousing_batch_id = t1.id
+ LEFT JOIN t_erp_goods t4 on t2.goods_id = t4.id
+ left join t_erp_goods_type t5 on t4.type_id = t5.id
left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id
where #{time} > t1.expiry_date
- and (t1.warehousing_number - t3.outbound_count > 0 or t3.id is null)
- <if test="user.roleType !=null and user.roleType ==4">
- and t2.supplier_id =#{supplierClinicId}
+ <if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId}
</if>
<if test="query.name != null and query.name != ''">
and t4.goods_name like concat('%',#{query.goodsName},'%')
@@ -136,7 +135,9 @@
<if test="query.typeId != null and query.typeId != ''">
and t4.type_id = #{query.typeId}
</if>
- order by t1.expiry_date
+ group by t1.id
+ ) as o where (o.num > 0 or o.ogid is null)
+ order by o.expiry_date
</select>
<select id="pageInventoryList" resultType="com.ruoyi.system.vo.PageInventoryListVo">
--
Gitblit v1.7.1