From 827e8587912d4b575521cfb9f1fd6ae56b67feb7 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Thu, 8 Aug 2024 23:27:28 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=84=E7=A7=8D=E4=BC=98=E5=8C=96=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/resources/application.yml | 3 +-
hiver-admin/test-output/test-report.html | 16 ++--
.../mall/controller/StockController.java | 29 +++++-
.../cc/hiver/mall/dao/mapper/SaleMapper.java | 1 +
.../mall/debt/controller/DebtController.java | 15 +++-
.../cc/hiver/mall/debt/mapper/DebtMapper.java | 3 +
.../hiver/mall/debt/service/DebtService.java | 3 +
.../debt/service/impl/DebtServiceImpl.java | 6 ++
.../cc/hiver/mall/debt/vo/DebtOfShopVo.java | 19 ++++
.../java/cc/hiver/mall/pojo/vo/SaleVO.java | 2 +
.../impl/PurchaseOcrPictureServiceImpl.java | 16 ++++
.../mall/service/mybatis/StockService.java | 43 ++++++---
.../SalesCalculateServiceImpl.java | 6 ++
.../serviceimpl/mybatis/StockServiceImpl.java | 90 +++++++++++--------
.../java/cc/hiver/mall/utils/AliOcrUtil.java | 4 +-
.../src/main/resources/mapper/DebtMapper.xml | 18 ++++
.../main/resources/mapper/ProductMapper.xml | 2 +-
.../resources/mapper/PurchaseDetailMapper.xml | 17 ++--
.../main/resources/mapper/PurchaseMapper.xml | 11 ++-
.../src/main/resources/mapper/SaleMapper.xml | 15 +++-
20 files changed, 241 insertions(+), 78 deletions(-)
create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/vo/DebtOfShopVo.java
diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml
index 5350c274..ea40127b 100644
--- a/hiver-admin/src/main/resources/application.yml
+++ b/hiver-admin/src/main/resources/application.yml
@@ -335,7 +335,8 @@ ignored:
# 根据店铺id获取店铺二维码信息
- /hiver/app/shop/getshopIconById
-# # 临时增加
+ # 临时增加
+ - /hiver/app/debt/getAllDebtByShopId
# 限流及黑名单不拦截的路径
limitUrls:
- /**/*.js
diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html
index 41886bb1..ab7ee4c4 100644
--- a/hiver-admin/test-output/test-report.html
+++ b/hiver-admin/test-output/test-report.html
@@ -35,7 +35,7 @@
Hiver
- 04, 2024 18:32:59
+ 08, 2024 23:26:15
@@ -84,7 +84,7 @@
passTest
-
18:32:59 / 0.026 secs
+
23:26:16 / 0.016 secs
@@ -92,9 +92,9 @@
#test-id=1
passTest
-
08.04.2024 18:32:59
-
08.04.2024 18:32:59
-
0.026 secs
+
08.08.2024 23:26:16
+
08.08.2024 23:26:16
+
0.016 secs
@@ -104,7 +104,7 @@
| Pass |
- 18:32:59 |
+ 23:26:16 |
Test passed
|
@@ -128,13 +128,13 @@
Started
-
04, 2024 18:32:59
+
08, 2024 23:26:15
Ended
-
04, 2024 18:32:59
+
08, 2024 23:26:16
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java
index 4fa99c25..ce087896 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java
@@ -180,16 +180,39 @@ public class StockController {
/**
* 获取店铺所有达到库存预警的商品信息
- * @author 王富康
- * @date 2024/3/18
+ *
* @param stockPageQuery
* @return Result
+ * @author 王富康
+ * @date 2024/3/18
*/
@RequestMapping(value = "/getTailWarnProduct", method = RequestMethod.POST)
@ApiOperation(value = "获取店铺所有达到库存预警的商品信息")
- public Result getTailWarnProduct(StockPageQuery stockPageQuery){
+ public Result getTailWarnProduct(StockPageQuery stockPageQuery) {
final List
checkStockList = stockService.getTailWarnProduct(stockPageQuery);
return new ResultUtil>().setData(checkStockList);
}
+ /**
+ * 删除库存(真删除)
+ *
+ * @param id
+ * @return Result
+ * @author 王富康
+ * @date 2024/8/8
+ */
+ @RequestMapping(value = "/deleteStockById", method = RequestMethod.POST)
+ @ApiOperation("删除库存(真删除)")
+ public Result deleteStockById(String id) {
+ // 供应商名称
+ if (StringUtils.isEmpty(id)) {
+ return ResultUtil.error("id不能为空!");
+ }
+ try {
+ stockService.deleteStockById(id);
+ return ResultUtil.success("删除成功!");
+ } catch (Exception e) {
+ return ResultUtil.error("删除失败!");
+ }
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
index 736fd3dc..f94480d0 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
@@ -114,4 +114,5 @@ public interface SaleMapper extends BaseMapper {
*/
Page customerSaleDetail(Page page,@Param("salePageQuery") SalePageQuery salePageQuery);
+ int queryTotalJCount(@Param("shopId") String shopId,@Param("startTime") String startTime, @Param("endTime") String endTime);
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java
index e7977218..3f24789b 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/controller/DebtController.java
@@ -4,6 +4,7 @@ import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.debt.entity.Debt;
import cc.hiver.mall.debt.service.DebtService;
+import cc.hiver.mall.debt.vo.DebtOfShopVo;
import cc.hiver.mall.debt.vo.QueryDebtVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@@ -100,5 +101,17 @@ public class DebtController {
return new ResultUtil<>().setData(saveOrUpdateDebt);
}
-
+ /**
+ * 查询指定店铺的所有欠款客户/供应商数量及欠款金额
+ * @author 王富康
+ * @date 2024/8/8
+ * @param queryDebtVo
+ * @return Result
+ */
+ @RequestMapping(value = "/getAllDebtByShopId", method = RequestMethod.POST)
+ @ApiOperation("查询指定店铺的所有欠款客户/供应商数量及欠款金额")
+ public Result getAllDebtByShopId(@RequestBody QueryDebtVo queryDebtVo) {
+ final DebtOfShopVo debtByShopId = debtService.getAllDebtByShopId(queryDebtVo);
+ return new ResultUtil<>().setData(debtByShopId);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
index 7ceb9181..b2ff6382 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/mapper/DebtMapper.java
@@ -1,6 +1,7 @@
package cc.hiver.mall.debt.mapper;
import cc.hiver.mall.debt.entity.Debt;
+import cc.hiver.mall.debt.vo.DebtOfShopVo;
import cc.hiver.mall.debt.vo.QueryDebtVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,4 +15,6 @@ public interface DebtMapper extends BaseMapper {
Debt selectByUserId(@Param("shopId")String shopId, @Param("userId") String userId);
List getDebtByUserIds(@Param("userIds") List userIds);
+
+ DebtOfShopVo getAllDebtByShopId(@Param("queryDebtVo") QueryDebtVo queryDebtVo);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
index a8c48a78..2fe68044 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/DebtService.java
@@ -1,6 +1,7 @@
package cc.hiver.mall.debt.service;
import cc.hiver.mall.debt.entity.Debt;
+import cc.hiver.mall.debt.vo.DebtOfShopVo;
import cc.hiver.mall.debt.vo.QueryDebtVo;
import cc.hiver.mall.entity.Purchase;
import cc.hiver.mall.pojo.dto.SaleQueryDTO;
@@ -78,4 +79,6 @@ public interface DebtService extends IService {
Debt selectByUserId(String shopId, String userId);
Debt recharge(Debt debt);
+
+ DebtOfShopVo getAllDebtByShopId(QueryDebtVo queryDebtVo);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
index ad84c1e3..070ab4b8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/service/impl/DebtServiceImpl.java
@@ -7,6 +7,7 @@ import cc.hiver.mall.debt.constant.DebtConstant;
import cc.hiver.mall.debt.entity.Debt;
import cc.hiver.mall.debt.mapper.DebtMapper;
import cc.hiver.mall.debt.service.DebtService;
+import cc.hiver.mall.debt.vo.DebtOfShopVo;
import cc.hiver.mall.debt.vo.QueryDebtVo;
import cc.hiver.mall.entity.Customer;
import cc.hiver.mall.entity.DealingsRecord;
@@ -328,4 +329,9 @@ public class DebtServiceImpl extends ServiceImpl implements De
dealingsRecordService.save(dealingsRecord);
return debt;
}
+
+ @Override
+ public DebtOfShopVo getAllDebtByShopId(QueryDebtVo queryDebtVo) {
+ return debtMapper.getAllDebtByShopId(queryDebtVo);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/vo/DebtOfShopVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/vo/DebtOfShopVo.java
new file mode 100644
index 00000000..c8c400cf
--- /dev/null
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/debt/vo/DebtOfShopVo.java
@@ -0,0 +1,19 @@
+package cc.hiver.mall.debt.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class DebtOfShopVo {
+
+ /**
+ * 欠款人数
+ * */
+ private Integer personCount;
+
+ /**
+ * 欠款金额
+ * */
+ private BigDecimal amountOwed;
+}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java
index 49e9a095..0dc4fbe8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java
@@ -75,4 +75,6 @@ public class SaleVO implements Serializable {
"2:需要根据前台传递的status查询列表:6:待配货列表;7挂单列表")
private String fromWhere;
+ @ApiModelProperty(value = "删除标识")
+ String delFlag;
}
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
index 2ba08616..38865108 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
@@ -221,6 +221,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
productSn = CommonUtil.getProductSn(productSn);
final String productName = object.getString("productName");
final String priceStr = object.getString("price");
+
BigDecimal price = BigDecimal.ZERO;
// 使用正则表达式提取数字部分
final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?");
@@ -231,7 +232,15 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
price = new BigDecimal(numericPart);
}
+ final String wholesalePriceStr = object.getString("wholesalePrice");
+ BigDecimal wholesalePrice = BigDecimal.ZERO;
+ final Matcher wholesalePriceMatcher = pattern.matcher(wholesalePriceStr);
+ if (wholesalePriceMatcher.find()) {
+ // 获取匹配到的数字字符串并转换为BigDecimal
+ final String numericPart = wholesalePriceMatcher.group();
+ wholesalePrice = new BigDecimal(numericPart);
+ }
final String attributeList = object.getString("attributeList");
final JSONArray attributeListJsonArray = JSON.parseArray(attributeList);
// 根据货号去查询商品,如果
@@ -264,6 +273,12 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
}else{
purchaseDetail.setPurchasePrice(price);
}
+ // ai语音入库旧商品 如果通义千问返回的价格为0,返回当前批发价 ,批发价:wholesalePrice
+ if (wholesalePrice.compareTo(BigDecimal.ZERO) == 0) {
+ purchaseDetail.setWholesalePrice(product.getWholesalePrice());
+ }else{
+ purchaseDetail.setWholesalePrice(wholesalePrice);
+ }
purchaseDetail.setAttrId(product.getAttrId());
final List stockLogList = new ArrayList<>();
@@ -383,6 +398,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
purchaseDetail.setProductName(productName);
purchaseDetail.setProductSn(productSn);
purchaseDetail.setPurchasePrice(price);
+ purchaseDetail.setWholesalePrice(wholesalePrice);
purchaseDetail.setProductCount(0);
// 获取默认分类
final ProductCategoryVo defaultCategory = productCategoryService.getDefaultCategory(shopId);
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
index 2282ef2e..1b2e90b2 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockService.java
@@ -19,30 +19,33 @@ public interface StockService extends IService {
/**
* 待入库入库,维护价格等相关信息
- * @author 王富康
- * @date 2023/11/21
+ *
* @param purchaseVo
* @return Result
+ * @author 王富康
+ * @date 2023/11/21
*/
Result putInPrice(PurchaseVo purchaseVo);
/**
* 获取某店铺的库存管理顶部信息
+ *
+ * @return ShopStockVo
* @author 王富康
* @date 2023/11/21
- * @return ShopStockVo
*/
ShopStockVo getShopStock();
/**
* 获取该店的库存信息
+ *
+ * @return List
* @author 王富康
* @date 2023/11/21
- * @return List
*/
List stockListOfShop();
- String productCount(String productId,String attributeList);
+ String productCount(String productId, String attributeList);
List getlistByAttributeList(String id, String attributeList);
@@ -52,10 +55,11 @@ public interface StockService extends IService {
/**
* 根据商品id获取该商品所有规格的库存信息
- * @author 王富康
- * @date 2024/4/17
+ *
* @param productId 商品id
* @return List
+ * @author 王富康
+ * @date 2024/4/17
*/
List getProductStock(String productId);
@@ -65,35 +69,48 @@ public interface StockService extends IService {
/**
* 根据商品属性id获取商品的库存数
- * @author 王富康
- * @date 2024/7/6
+ *
* @param attrId
* @return List
+ * @author 王富康
+ * @date 2024/7/6
*/
List getProductStockByAttrId(String attrId);
/**
* 根据商品id批量删除库存
+ *
+ * @param productIds
* @author 王富康
* @date 2024/7/27
- * @param productIds
*/
void batchDeleteStockByProductIds(String productIds);
/**
* 根据入库记录减掉库存数
+ *
+ * @param stockLogList
* @author 王富康
* @date 2024/7/27
- * @param stockLogList
*/
void batchReduceStockByLog(List stockLogList);
/**
* 获取某些商品均色均码的库存数
- * @author 王富康
- * @date 2024/8/4
+ *
* @param productIdList
* @return List
+ * @author 王富康
+ * @date 2024/8/4
*/
List getDefaultStockCount(List productIdList);
+
+ /**
+ * 删除库存(真删除)
+ *
+ * @param id
+ * @author 王富康
+ * @date 2024/8/8
+ */
+ void deleteStockById(String id);
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java
index aafd4faf..9ce8a748 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SalesCalculateServiceImpl.java
@@ -178,6 +178,12 @@ public class SalesCalculateServiceImpl implements SalesCalculateService {
// 获取今日实收分别从哪几个渠道收入的
final List totalAlreadyEarnDetailMap = saleMapper.queryTotalAlreadyEarnDetail(shopId,startTime,endTime);
saleAllVO.setTotalAlreadyEarnDetail(totalAlreadyEarnDetailMap);
+
+ // 20240805 增加需要加一个今日销售总件数:查sale表的prodect_count总和 状态delflag=0;status=4的
+
+ //获取今日实收
+ final int totalJCount = saleMapper.queryTotalJCount(shopId,startTime,endTime);
+ saleAllVO.setTotalJCount(totalJCount);
return saleAllVO;
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
index 7d2b0e59..f67c40b6 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
@@ -384,15 +384,15 @@ public class StockServiceImpl extends ServiceImpl implements
purchase.setUpdateBy(user.getId());
// 入库时间,约定前台肯定传
final Date purchaseTime = purchase.getPurchaseTime();
- if(purchaseTime == null){
+ if (purchaseTime == null) {
// 如果前台没有传入库时间,就存当前时间,这里应该不会进入
purchase.setPurchaseTime(new Date());
- }else{
+ } else {
// 前台传的是不带时分秒的,如果是今天,那么使用当前时间,否则使用前台传的时间
- if(DateUtil.isSameDay(new Date(),purchaseTime)){
+ if (DateUtil.isSameDay(new Date(), purchaseTime)) {
purchase.setCreateTime(new Date());
purchase.setPurchaseTime(new Date());
- }else{
+ } else {
// 因为现在对账单或者是列表排序等都是根据creTime去排序和展示的,所以这里createTime 为入库时间,前台传,PurchaseTime为入库单创建时间
purchase.setCreateTime(purchaseTime);
purchase.setPurchaseTime(new Date());
@@ -596,7 +596,7 @@ public class StockServiceImpl extends ServiceImpl implements
for (Stock stock : stockList) {
final Product product = productMap.get(stock.getProductId());
- if(!productMap.containsKey(stock.getProductId())){
+ if (!productMap.containsKey(stock.getProductId())) {
// 如果没有商品信息那么就进行下一个循环,暂时不计算该商品的采购价及其他信息
continue;
}
@@ -657,23 +657,23 @@ public class StockServiceImpl extends ServiceImpl implements
stockPageQuery.setShopId(shopId);
final List records = stockMapper.getTailWarnProduct(stockPageQuery);
// final List records = result.getRecords();
- final Map stringStockProductVoMap = new HashMap<>();
+ final Map stringStockProductVoMap = new HashMap<>();
for (Stock record : records) {
final String productId = record.getProductId();
final Integer stockCount = record.getStockCount();
- final Integer productStockCount = record.getStockCount() < 0?0:record.getStockCount();
+ final Integer productStockCount = record.getStockCount() < 0 ? 0 : record.getStockCount();
//存在,增加规格信息
final StockAttributeVo stockAttributeVo = new StockAttributeVo();
stockAttributeVo.setAttributeList(record.getAttributeList());
stockAttributeVo.setStockCount(stockCount);
- if(stringStockProductVoMap.containsKey(productId)){
+ if (stringStockProductVoMap.containsKey(productId)) {
final Integer count = stringStockProductVoMap.get(productId).getStockCount();
// 计算商品的总库存
- stringStockProductVoMap.get(productId).setStockCount(count+productStockCount);
+ stringStockProductVoMap.get(productId).setStockCount(count + productStockCount);
// 增加规格信息
stringStockProductVoMap.get(productId).getStockAttributeVoList().add(stockAttributeVo);
- }else{
+ } else {
// 不存在,先增加商品信息
final StockProductVo stockProductVo = new StockProductVo();
stockProductVo.setProductName(record.getProductName());
@@ -686,7 +686,7 @@ public class StockServiceImpl extends ServiceImpl implements
final List stockAttributeVoList = new ArrayList<>();
stockAttributeVoList.add(stockAttributeVo);
stockProductVo.setStockAttributeVoList(stockAttributeVoList);
- stringStockProductVoMap.put(productId,stockProductVo);
+ stringStockProductVoMap.put(productId, stockProductVo);
}
}
final List stockProductVos = new ArrayList<>(stringStockProductVoMap.values());
@@ -708,18 +708,18 @@ public class StockServiceImpl extends ServiceImpl implements
purchase.setShopId(shopId);
// 入库时间,约定前台肯定传
Date purchaseTime = purchase.getPurchaseTime();
- log.debug("入库时间前台传的是==="+DateUtil.COMMON_FULL.getDateText(purchaseTime));
- if(purchaseTime == null){
+ log.debug("入库时间前台传的是===" + DateUtil.COMMON_FULL.getDateText(purchaseTime));
+ if (purchaseTime == null) {
// 如果前台没有传入库时间,就存当前时间,这里应该不会进入
purchase.setPurchaseTime(new Date());
- }else{
+ } else {
// 前台传的是不带时分秒的,如果是今天,那么使用当前时间,否则使用前台传的时间
- log.debug("是否是同一天==="+DateUtil.COMMON_FULL.getDateText(purchaseTime)+"===="+DateUtil.COMMON_FULL.getDateText(new Date())+"====="+DateUtil.isSameDay(new Date(),purchaseTime));
- if(DateUtil.isSameDay(new Date(),purchaseTime)){
+ log.debug("是否是同一天===" + DateUtil.COMMON_FULL.getDateText(purchaseTime) + "====" + DateUtil.COMMON_FULL.getDateText(new Date()) + "=====" + DateUtil.isSameDay(new Date(), purchaseTime));
+ if (DateUtil.isSameDay(new Date(), purchaseTime)) {
purchase.setCreateTime(new Date());
purchase.setPurchaseTime(new Date());
purchaseTime = new Date();
- }else{
+ } else {
// 因为现在对账单或者是列表排序等都是根据creTime去排序和展示的,所以这里createTime 为入库时间,前台传,PurchaseTime为入库单创建时间
purchase.setCreateTime(purchaseTime);
purchase.setPurchaseTime(new Date());
@@ -729,10 +729,10 @@ public class StockServiceImpl extends ServiceImpl implements
// 语音入库没有入库id
String purchaseId = purchase.getId();
boolean insertFlag = true;
- if (StringUtils.isEmpty(purchaseId)){
+ if (StringUtils.isEmpty(purchaseId)) {
purchaseId = SnowFlakeUtil.nextId().toString();
purchase.setId(purchaseId);
- }else{
+ } else {
insertFlag = false;
}
@@ -758,7 +758,7 @@ public class StockServiceImpl extends ServiceImpl implements
productCategoryVo.setShopId("spfl");
// 需要新增的
final Map> attributeValueMap = new HashMap<>();
- if(StringUtils.isEmpty(productId)){
+ if (StringUtils.isEmpty(productId)) {
// 新增商品
final Product product = new Product();
product.setCreateBy(user.getId());
@@ -792,7 +792,7 @@ public class StockServiceImpl extends ServiceImpl implements
// 填充前台传过来的数据
purchaseDetail.setProductId(product.getId());
// 新增商品图片子图
- if(purchaseDetail.getProductPictures() != null ){
+ if (purchaseDetail.getProductPictures() != null) {
for (ProductPicture productPicture : purchaseDetail.getProductPictures()) {
productPicture.setProductId(product.getId());
}
@@ -856,14 +856,14 @@ public class StockServiceImpl extends ServiceImpl implements
// productCategoryService.batchSaveCategoryOfShop(productCategoryVo);
product.setAttrId(s);
- }else{
+ } else {
// 旧商品,更新批发价和零售价
productIdList.add(productId);
}
}
// todo 在这里批量新增一下,下边的查询能查询到么?
productService.saveBatch(addProductList);
- if(!addProductPictureList.isEmpty()){
+ if (!addProductPictureList.isEmpty()) {
productPictureService.batchSaveProductPicture(addProductPictureList);
}
@@ -876,7 +876,7 @@ public class StockServiceImpl extends ServiceImpl implements
}
// 获取需要新增的规格及属性集合
// 获取需要新增的规格信息
- final Map>> stringListMap = new HashMap<>();
+ final Map>> stringListMap = new HashMap<>();
for (PurchaseDetail purchaseDetail : purchaseDetails) {
// 获取商品信息
final Product product = productMap.get(purchaseDetail.getProductId());
@@ -884,7 +884,7 @@ public class StockServiceImpl extends ServiceImpl implements
purchaseDetail.setShopId(shopId);
purchaseDetail.setPurchaseId(purchaseId);
// 设置一些商品信息
- purchaseDetail.setProductName(product.getProductName());
+ // purchaseDetail.setProductName(product.getProductName());
purchaseDetail.setUnit(product.getUnit());
purchaseDetail.setCategoryId(product.getCategoryId());
purchaseDetail.setAttrId(product.getAttrId());
@@ -960,6 +960,8 @@ public class StockServiceImpl extends ServiceImpl implements
product.setWholesalePrice(purchaseDetail.getWholesalePrice());
// 更新商品的图片
product.setProductPicture(purchaseDetail.getProductPicture());
+ // 更新商品的名称
+ product.setProductName(purchaseDetail.getProductName());
updateProductList.add(product);
// 先计算平均采购价、再更新库存数,否则会有问题。
@@ -1056,24 +1058,24 @@ public class StockServiceImpl extends ServiceImpl implements
} else {
// 暂不支持其他规格
}
- if(stringListMap.containsKey(attrId)){
+ if (stringListMap.containsKey(attrId)) {
final Map> stringListMap1 = stringListMap.get(attrId);
- if(stringListMap1.containsKey(key)){
+ if (stringListMap1.containsKey(key)) {
final List stringList = stringListMap1.get(key);
- if(!stringList.contains(value)){
+ if (!stringList.contains(value)) {
stringList.add(value);
}
- }else {
+ } else {
final List stringList = new ArrayList<>();
stringList.add(value);
stringListMap1.put(key, stringList);
}
- }else{
- final Map> attributeListMap = new HashMap<>();
+ } else {
+ final Map> attributeListMap = new HashMap<>();
final List stringList = new ArrayList<>();
stringList.add(value);
- attributeListMap.put(key,stringList);
- stringListMap.put(attrId,attributeListMap);
+ attributeListMap.put(key, stringList);
+ stringListMap.put(attrId, attributeListMap);
}
}
}
@@ -1111,9 +1113,9 @@ public class StockServiceImpl extends ServiceImpl implements
}
}
productCategoryVo.setProductAttributeOfAddVos(productAttributeOfAddVos);
- productCategoryService.batchSaveCategoryAndAttributeOfAi(productCategoryAiVos);
+ productCategoryService.batchSaveCategoryAndAttributeOfAi(productCategoryAiVos);
// 更新店铺分类库
- productCategoryService.batchSaveCategoryOfShop(productCategoryVo);
+ productCategoryService.batchSaveCategoryOfShop(productCategoryVo);
// 更新那些未入库就进行销售销售详情、库存履历、库存表的采购价
saleDetailService.putInUpdatePurchasePrice(purchaseDetails);
@@ -1121,13 +1123,13 @@ public class StockServiceImpl extends ServiceImpl implements
//3.登记采购单主表和采购单明细表
// log.debug("保存前的入库时间==="+DateUtil.COMMON_FULL.getDateText(purchase.getCreateTime())+"===="+DateUtil.COMMON_FULL.getDateText(purchase.getPurchaseTime()));
final boolean saveOrUpdateFlag;
- if(insertFlag){
+ if (insertFlag) {
saveOrUpdateFlag = purchaseService.insert(purchase);
// 不知道为什么保存不上creTime,这里再更新下两个时间
purchase.setCreateTime(purchaseTime);
purchase.setPurchaseTime(new Date());
purchaseService.updateById(purchase);
- }else{
+ } else {
saveOrUpdateFlag = purchaseService.updateById(purchase);
}
if (saveOrUpdateFlag) {
@@ -1162,7 +1164,7 @@ public class StockServiceImpl extends ServiceImpl implements
@Override
public Stock getByProductIdAndAttributeList(String productId, String attributeList) {
- return stockMapper.getByProductIdAndAttributeList(productId,attributeList);
+ return stockMapper.getByProductIdAndAttributeList(productId, attributeList);
}
@Override
@@ -1186,4 +1188,16 @@ public class StockServiceImpl extends ServiceImpl implements
public List getDefaultStockCount(List productIdList) {
return stockMapper.getDefaultStockCount(productIdList);
}
+
+ /**
+ * 删除库存(真删除)
+ *
+ * @param id
+ * @author 王富康
+ * @date 2024/8/8
+ */
+ @Override
+ public void deleteStockById(String id) {
+ stockMapper.deleteById(id);
+ }
}
diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
index b23b6d2c..81b07fe8 100644
--- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
+++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
@@ -888,8 +888,8 @@ public class AliOcrUtil {
final Message systemMsg =
Message.builder().role(Role.SYSTEM.getValue()).content("You are a helpful assistant.").build();
// questionMsg += "请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"price\":\"单价\",\"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}] }]。以下是几点要求: 1.“货号”两个字和\"名称\"两个字中间的内容代表productSn的值,如果没有名称则“货号”两个字和颜色中间的内容代表productSn的值,productSn可能包含\"新\"、\"退\"、\"旧\"、\"换\"、\"补\"。2.\"SYYS色\"代表“所有颜色”,\"color\"字段返回“SYYS色”。 3.\"SYCM码\"代表“所有尺码”,\"size\"字段返回“SYCM码”。4.如果没有名称,productName字段返回\"\"。5.只输出JSON数据即可,不用返回字段描述和解析过程。";
- questionMsg += "你是一个服装行业库管专家,请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}], \"price\":\"单价\" }],\n" +
- "1.如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。\n" +
+ questionMsg += "你是一个服装行业库管专家,请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}], \"price\":\"单价\" , \"wholesalePrice\":\"批发价\" }],\n" +
+ "1.如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" +
"2.如果没有识别到\"productSn\"的内容,则\"productSn\"赋值\"\"。\n" +
"3.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" +
"4.如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
index 366c2a40..2c009c10 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/DebtMapper.xml
@@ -51,4 +51,22 @@
#{listItem}
+
+
\ No newline at end of file
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
index c83c9ac1..471d3a51 100644
--- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
+++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
@@ -619,7 +619,7 @@
#{queryParams.sortField} #{queryParams.sort} ,
- t.in_storage_status asc, t.del_flag desc,t.create_time desc
+ t.in_storage_status asc, t.del_flag desc,t.create_time desc, id