Browse Source

多个接口 返回customerCategoryRule

dev
qiaohui 2 years ago
parent
commit
0762b83570
  1. 18
      hiver-admin/test-output/test-report.html
  2. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java
  3. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java
  4. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/StockLog.java
  5. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java
  6. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
  7. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java
  8. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
  9. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java
  10. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
  11. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  12. 12
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java

18
hiver-admin/test-output/test-report.html

@ -5,7 +5,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hiver测试报告</title>
<title>Hiver测试报告</title>
<link rel="apple-touch-icon" href="spark/logo.png">
<link rel="shortcut icon" href="spark/logo.png">
<link rel="stylesheet" href="spark/spark-style.css">
@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">九月 17, 2024 23:19:41</span></a>
<a href="#"><span class="badge badge-primary">九月 21, 2024 16:22:06</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>23:19:42 下午</span> / <span>0.018 secs</span></p>
<p class="text-sm"><span>16:22:06 下午</span> / <span>0.012 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,9 +92,9 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>09.17.2024 23:19:42</span>
<span class='badge badge-danger'>09.17.2024 23:19:42</span>
<span class='badge badge-default'>0.018 secs</span>
<span class='badge badge-success'>09.21.2024 16:22:06</span>
<span class='badge badge-danger'>09.21.2024 16:22:06</span>
<span class='badge badge-default'>0.012 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
</div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>23:19:42</td>
<td>16:22:06</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>九月 17, 2024 23:19:41</h3>
<h3>九月 21, 2024 16:22:06</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>九月 17, 2024 23:19:42</h3>
<h3>九月 21, 2024 16:22:06</h3>
</div></div>
</div>
<div class="col-md-3">

6
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java

@ -14,6 +14,7 @@ import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Transient;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -117,4 +118,9 @@ public class Product implements Serializable {
@ApiModelProperty(value = "客户分类价格规则")
private String customerCategoryRule;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "库存数量")
private Integer stockCount;
}

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java

@ -112,5 +112,10 @@ public class PurchaseDetail extends HiverBaseEntity {
@ApiModelProperty(value = "商品子图")
private List<ProductPicture> productPictures;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "客户分类价格规则")
private String customerCategoryRule;
private static final long serialVersionUID = 1L;
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/StockLog.java

@ -1,11 +1,13 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Transient;
import java.math.BigDecimal;
@Data
@ -49,5 +51,10 @@ public class StockLog extends HiverBaseEntity {
@ApiModelProperty(value = "识别图片id")
private String ocrPicturePath;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "库存数量")
private Integer stockCount;
private static final long serialVersionUID = 1L;
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SaleDetailDTO.java

@ -73,6 +73,9 @@ public class SaleDetailDTO implements Serializable {
@ApiModelProperty(value = "商品子图")
private List<ProductPicture> productPictures;
@ApiModelProperty(value = "客户分类价格规则")
private String customerCategoryRule;
private static final long serialVersionUID = 1L;

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java

@ -113,4 +113,8 @@ public class ProductPageVO {
@ApiModelProperty(value = "商品总销量")
private Integer totalSold;
@ApiModelProperty(value = "客户价格规则")
private String customerCategoryRule;
}

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java

@ -85,6 +85,6 @@ public class ProductVo extends HiverBaseEntity {
@ApiModelProperty(value = "商品子图")
private List<ProductPicture> productPictures;
@ApiModelProperty(value = "客户价格规则")
private String customerCategoryRule;
}

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java

@ -264,6 +264,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
purchaseDetail.setProductSn(product.getProductSn());
purchaseDetail.setProductCount(0);
purchaseDetail.setSupplierName(product.getSupplierName());
purchaseDetail.setCustomerCategoryRule(product.getCustomerCategoryRule());
// ai语音入库旧商品 如果通义千问返回的价格为0,返回当前采购价 ,采购价:purchasePrice
if (price.compareTo(BigDecimal.ZERO) == 0) {
purchaseDetail.setPurchasePrice(product.getPurchasePrice());
@ -338,6 +339,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
final String attribute = "{\"颜色\":\"" + productAttributeValueVo.getValue() + "\",\"尺码\":\"" + attributeValueVo.getValue() + "\"}";
stockLog.setAttributeList(attribute);
stockLog.setProductCount(productCount);
stockLog.setStockCount(stockMap.getOrDefault(attribute, null));
purchaseDetail.setProductCount(purchaseDetail.getProductCount() + productCount);
stockLogList.add(stockLog);
}
@ -352,6 +354,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
final String attribute = "{\"颜色\":\"" + productAttributeValueVo.getValue() + "\",\"尺码\":\"" + size + "\"}";
stockLog.setAttributeList(attribute);
stockLog.setProductCount(productCount);
stockLog.setStockCount(stockMap.getOrDefault(attribute, null));
purchaseDetail.setProductCount(purchaseDetail.getProductCount() + productCount);
stockLogList.add(stockLog);
}
@ -365,6 +368,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
final String attribute = "{\"颜色\":\"" + color + "\",\"尺码\":\"" + attributeValueVo.getValue() + "\"}";
stockLog.setAttributeList(attribute);
stockLog.setProductCount(productCount);
stockLog.setStockCount(stockMap.getOrDefault(attribute, null));
purchaseDetail.setProductCount(purchaseDetail.getProductCount() + productCount);
stockLogList.add(stockLog);
}
@ -376,6 +380,7 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
final String attribute = "{\"颜色\":\"" + color + "\",\"尺码\":\"" + size + "\"}";
stockLog.setAttributeList(attribute);
stockLog.setProductCount(productCount);
stockLog.setStockCount(stockMap.getOrDefault(attribute, null));
purchaseDetail.setProductCount(purchaseDetail.getProductCount() + productCount);
stockLogList.add(stockLog);

1
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java

@ -176,6 +176,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
purchaseDetail.setPrice(product.getPrice());
purchaseDetail.setWholesalePrice(product.getWholesalePrice());
purchaseDetail.setPurchasePrice(product.getPurchasePrice());
purchaseDetail.setCustomerCategoryRule(product.getCustomerCategoryRule());
}
}
purchaseVo.setPurchaseDetails(purchaseDetails);

1
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java

@ -692,6 +692,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
saleDetailDTO.setCategoryId(categoryId);
saleDetailDTO.setPrice(product.getPrice());
saleDetailDTO.setPurchasePrice(product.getPurchasePrice());
saleDetailDTO.setCustomerCategoryRule(product.getCustomerCategoryRule());
// 如果通义千问返回了批发价,那么就使用通义千问返回的批发价
if (wholesalePrice.compareTo(BigDecimal.ZERO) > 0) {
saleDetailDTO.setWholesalePrice(wholesalePrice);

9
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -28,6 +28,7 @@ import cc.hiver.mall.purchasereturn.service.PurchaseReturnService;
import cc.hiver.mall.purchasereturn.vo.PurchaseReturnVo;
import cc.hiver.mall.service.mybatis.*;
import cc.hiver.mall.utils.DateUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -500,6 +501,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
// 设置商品的批发价和零售价
product.setPrice(purchaseDetail.getLsPrice());
product.setWholesalePrice(purchaseDetail.getWholesalePrice());
product.setCustomerCategoryRule(purchaseDetail.getCustomerCategoryRule());
// 保存商品供应商信息
updateProductList.add(product);
@ -811,6 +813,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
product.setPrintBarcode(purchaseDetail.getPrintBarcode());
product.setTailWarn(purchaseDetail.getTailWarn());
product.setInStorageStatus(PurchaseConstant.IN_STORAGE_STATUS[1]);
product.setCustomerCategoryRule(purchaseDetail.getCustomerCategoryRule());
addProductList.add(product);
// 放到要查询的id中
productIdList.add(product.getId());
@ -998,6 +1001,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
product.setProductPicture(purchaseDetail.getProductPicture());
// 更新商品的名称
product.setProductName(purchaseDetail.getProductName());
product.setCustomerCategoryRule(purchaseDetail.getCustomerCategoryRule());
updateProductList.add(product);
// 先计算平均采购价、再更新库存数,否则会有问题。
@ -1184,8 +1188,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
if (stockLogService.saveBatch(stockLogAddList)) {
// 更新商品信息
productService.saveOrUpdateBatch(updateProductList);
// 更新供应商欠款信息机欠款记录
// 更新供应商欠款信息及欠款记录
//如果没有采购价 并且是普通用户的话,不保存记录
// if(CollectionUtil.isNotEmpty(purchaseVo.getPurchaseDetails()) && purchaseVo.getPurchaseDetails().get(0).getPurchasePrice() == null && !user.getType().equals(UserConstant.USER_TYPE_NORMAL)) {
debtService.purchaseToDebt(purchase);
// }
return ResultUtil.success("添加成功");
} else {
return ResultUtil.error("添加入库单商品规格信息失败");

12
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java

@ -839,7 +839,7 @@ public class AliOcrUtil {
//questionMsg += "请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}] }]。以下是几点要求: 1.“货号”两个字和颜色中间的内容代表productSn,productSn可能包含\"新\"、\"退\"、\"旧\"、\"换\"、\"补\"。 2.\"SYYS色\"代表“所有颜色”,\"color\"字段返回“SYYS色”。 3.\"SYCM码\"代表“所有尺码”,\"size\"字段返回“SYCM码”。 4.只输出JSON数据即可,不用返回字段描述和解析过程。";
questionMsg += "你是一个服装行业库管专家,请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}] , \"wholesalePrice\":\"价格\"}],\n" +
"1.productSn的返回值中去掉颜色,尺码等信息,\n" +
"2.如果没有识别到\"color\"的内容,则\"color\"赋值“均色”。如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回1条JSON数据即可。\n" +
"2.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”。如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回1条JSON数据即可。\n" +
"3.如果指令内容中有\"SYYS色\"则\"color\"字段返回“SYYS色”即可,如果指令内容中有\"SYCM码\"则\"size\"字段返回“SYCM码”即可,没有则忽略。\n" +
"4.如果指令中有“各N件”,则每个尺码数量返回N。\n" +
"5.如果指令中尺码是?码到?码,请完整返回跨度内所有尺码JSON。\n" +
@ -851,10 +851,10 @@ public class AliOcrUtil {
msgManager.add(userMsg);
stopWatch.start("开始回答");
final QwenParam param =
QwenParam.builder().model("qwen2-72b-instruct").messages(msgManager.get())
QwenParam.builder().model("qwen-turbo-0919").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.seed(1234)
.temperature(0.85F)
.temperature(0.7F)
.topP(0.8)
.repetitionPenalty(1.0F)
.build();
@ -894,7 +894,7 @@ public class AliOcrUtil {
"1.如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" +
"2.如果没有识别到\"productSn\"的内容,则\"productSn\"赋值\"\"。\n" +
"3.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" +
"4.如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +
"4.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +
"5.如果指令中有“各N件”,则每个尺码数量返回N。\n" +
"6.如果指令中尺码是?码到?码,请结合服装鞋帽尺码规则完整返回跨度内所有尺码JSON。\n" +
"7.返回的JSON数据不用换行,以最快的速度返回!\n" +
@ -903,10 +903,10 @@ public class AliOcrUtil {
msgManager.add(systemMsg);
msgManager.add(userMsg);
final QwenParam param =
QwenParam.builder().model("qwen2-72b-instruct").messages(msgManager.get())
QwenParam.builder().model("qwen-turbo-0919").messages(msgManager.get())
.resultFormat(QwenParam.ResultFormat.MESSAGE)
.seed(1234)
.temperature(0.85F)
.temperature(0.7F)
.topP(0.8)
.repetitionPenalty(1.0F)
.build();

Loading…
Cancel
Save