Browse Source

标签添加及其他优化

dev
wangfukang 1 year ago
parent
commit
c7c61ed00f
  1. 16
      hiver-admin/test-output/test-report.html
  2. 6
      hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java
  3. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/PurchaseConstant.java
  4. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockLogConstant.java
  5. 42
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java
  6. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  7. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java
  8. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java
  9. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Purchase.java
  10. 39
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java
  11. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java
  12. 90
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/controller/LableController.java
  13. 114
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/controller/SaleLableController.java
  14. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/entity/Lable.java
  15. 22
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/entity/SaleLable.java
  16. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/mapper/LableMapper.java
  17. 31
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/mapper/SaleLableMapper.java
  18. 44
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/LableService.java
  19. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/SaleLableService.java
  20. 81
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/impl/LableServiceImpl.java
  21. 65
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/impl/SaleLableServiceImpl.java
  22. 26
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/vo/SaleLableVo.java
  23. 14
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java
  24. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/mapper/PurchaseOcrPictureMapper.java
  25. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/service/impl/PurchaseOcrPictureServiceImpl.java
  26. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java
  27. 95
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java
  28. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  29. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
  30. 33
      hiver-modules/hiver-mall/src/main/resources/mapper/LableMapper.xml
  31. 40
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml
  32. 27
      hiver-modules/hiver-mall/src/main/resources/mapper/SaleLableMapper.xml
  33. 83
      hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

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

@ -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">一月 22, 2025 18:29:49</span></a>
<a href="#"><span class="badge badge-primary">三月 07, 2025 14:48:44</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>18:29:50 下午</span> / <span>0.015 secs</span></p>
<p class="text-sm"><span>14:48:44 下午</span> / <span>0.017 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'>01.22.2025 18:29:50</span>
<span class='badge badge-danger'>01.22.2025 18:29:50</span>
<span class='badge badge-default'>0.015 secs</span>
<span class='badge badge-success'>03.07.2025 14:48:44</span>
<span class='badge badge-danger'>03.07.2025 14:48:44</span>
<span class='badge badge-default'>0.017 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>18:29:50</td>
<td>14:48:44</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>一月 22, 2025 18:29:49</h3>
<h3>三月 07, 2025 14:48:44</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>一月 22, 2025 18:29:50</h3>
<h3>三月 07, 2025 14:48:44</h3>
</div></div>
</div>
<div class="col-md-3">

6
hiver-core/src/main/java/cc/hiver/core/common/constant/SaleConstant.java

@ -54,4 +54,10 @@ public interface SaleConstant {
* 是否购买过0没买过1买过
*/
int[] IS_PURCHASED_BEFORE = {0, 1};
/**
* 是否配货:0:1
*/
int[] DISTRIBUTION_FLAG = {0, 1};
}

6
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/PurchaseConstant.java

@ -17,4 +17,10 @@ public interface PurchaseConstant {
*/
int[] OCR_STATUS = {0, 1,2};
/**
* 是否需要入库确认0不需要1需要
*/
int[] STORE_FLAG = {0, 1};
}

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/constant/StockLogConstant.java

@ -8,8 +8,8 @@ package cc.hiver.mall.common.constant;
public interface StockLogConstant {
/**
* 出入库类型0-入库1-出库;2-盘点
* 出入库类型0-入库1-出库;2-盘点;3-手动更新
*/
String[] CHANGE_TYPE = {"0","1","2"};
String[] CHANGE_TYPE = {"0","1","2","3"};
}

42
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SaleController.java

@ -247,6 +247,7 @@ public class SaleController {
}
sale.setDelFlag(CommonConstant.DEL_FLAG_FALSE);
sale.setStatus(SaleConstant.SALE_STATUS[4]);
sale.setDistributionFlag(SaleConstant.DISTRIBUTION_FLAG[0]);
saleService.save(sale);
// 只有退货,单独处理下客户欠款
}
@ -706,7 +707,7 @@ public class SaleController {
startTime = saleVO.getStartTime() == null ? dateText : saleVO.getStartTime();
if (StringUtils.isEmpty(saleVO.getEndTime())) {
// 为空,使用当前日期+1
endTime = DateUtil.addDay(dateText,1);
endTime = DateUtil.addDay(dateText, 1);
} else {
// 不为空,使用传参日期+1
endTime = DateUtil.addDay(saleVO.getEndTime(), 1);
@ -1385,4 +1386,43 @@ public class SaleController {
final List<BuyCountVo> count = saleService.buyCount(customerId, productIdList);
return new ResultUtil<List<BuyCountVo>>().setData(count);
}
/**
* 根据saleid更新配货状态的
* @author 王富康
* @date 2025/2/26
* @param saleId
* @param distributionFlag
* @return Result
*/
@RequestMapping(value = "/updateDistributionFlag", method = RequestMethod.POST)
@ApiOperation("根据saleid更新配货状态的")
public Result updateDistributionFlag(String saleId, String distributionFlag) {
if (StringUtils.isEmpty(saleId)) {
ResultUtil.error("订单id不能为空");
}
if (StringUtils.isEmpty(distributionFlag)) {
ResultUtil.error("配货标识不能为空");
}
saleService.updateDistributionFlag(saleId, distributionFlag);
return ResultUtil.success("更新成功!");
}
/**
* 更新打印次数+1
* @author 王富康
* @date 2025/2/26
* @param saleId
* @return Result
*/
@RequestMapping(value = "/updatePrintCount", method = RequestMethod.POST)
@ApiOperation("更新打印次数+1")
public Result updatePrintCount(String saleId) {
if (StringUtils.isEmpty(saleId)) {
ResultUtil.error("订单id不能为空");
}
saleService.updatePrintCount(saleId);
return ResultUtil.success("更新成功!");
}
}

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java

@ -307,6 +307,10 @@ public class ShopController {
if (shop.getPrintingMethod() != null) {
oldShop.setPrintingMethod(shop.getPrintingMethod());
}
if (shop.getStoreFlag() != null) {
oldShop.setStoreFlag(shop.getStoreFlag());
}
shopService.update(oldShop);
return ResultUtil.success("更新成功");
}

29
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/StockController.java

@ -3,7 +3,9 @@ package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.common.constant.StockLogConstant;
import cc.hiver.mall.entity.Stock;
import cc.hiver.mall.entity.StockLog;
import cc.hiver.mall.pojo.query.StockPageQuery;
import cc.hiver.mall.pojo.vo.ProductCategoryStockVo;
import cc.hiver.mall.pojo.vo.PurchaseVo;
@ -222,4 +224,31 @@ public class StockController {
return ResultUtil.error("删除失败!");
}
}
// 根据商品id及规格更新库存数
@RequestMapping(value = "/updateStockCount", method = RequestMethod.POST)
@ApiOperation("根据商品id及规格更新库存数")
public Result updateStockCount(String productId, String attributeList, int count) {
final Stock stock = stockService.getByProductIdAndAttributeList(productId, attributeList);
if (stock == null) {
return ResultUtil.error("库存不存在!");
}
int oldStockCount = stock.getStockCount();
stock.setStockCount(count);
stockService.updateById(stock);
// 记录库存变更记录
StockLog changeStockLog = new StockLog();
changeStockLog.setStock(oldStockCount);
changeStockLog.setProductId(productId);
changeStockLog.setAttributeList(attributeList);
// 入库
changeStockLog.setChangeType(StockLogConstant.CHANGE_TYPE[3]);
// 变换的数量
changeStockLog.setStockCount(count - oldStockCount);
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
changeStockLog.setShopId(shopId);
return ResultUtil.success("更新成功!");
}
}

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java

@ -156,4 +156,21 @@ public interface SaleMapper extends BaseMapper<Sale> {
CustomerDataVo getSalePrice(@Param("customerPageQuery")CustomerPageQuery customerPageQuery);
List<ProductDataVo> getSaleCount(@Param("customerPageQuery")CustomerPageQuery customerPageQuery);
/**
* 根据saleid更新配货状态的
* @author 王富康
* @date 2025/2/26
* @param saleId
* @param distributionFlag
*/
void updateDistributionFlag(@Param("saleId") String saleId,@Param("distributionFlag") String distributionFlag);
/**
* 更新打印次数+1
* @author 王富康
* @date 2025/2/26
* @param saleId
*/
void updatePrintCount(@Param("saleId") String saleId);
}

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Purchase.java

@ -100,6 +100,9 @@ public class Purchase {
@ApiModelProperty(value = "余额抵扣")
private BigDecimal balanceDeductionAmount;
@ApiModelProperty(value = "是否需要入库确认:0:不需要;1:需要(数据库默认为0)")
private int storeFlag;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "起始日期")

39
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Sale.java

@ -1,6 +1,7 @@
package cc.hiver.mall.entity;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import cc.hiver.mall.lable.vo.SaleLableVo;
import cc.hiver.mall.pojo.dto.SaleDetailDTO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@ -95,7 +96,7 @@ public class Sale implements Serializable {
* 03退货待送达
* 04待确认退货
* 4已完成
*
* <p>
* 分享页提交订单6待配货
* 挂单页提交订单7挂单
*/
@ -132,49 +133,49 @@ public class Sale implements Serializable {
@ApiModelProperty(value = "下单总件数")
private int productCount;
@ApiModelProperty(value="备注")
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value="挂单名称")
@ApiModelProperty(value = "挂单名称")
private String saleName;
@ApiModelProperty(value="其他费用")
@ApiModelProperty(value = "其他费用")
private BigDecimal otherExpense;
@ApiModelProperty(value="配送方式 0-平台配送 1-自送 2-物流自提")
@ApiModelProperty(value = "配送方式 0-平台配送 1-自送 2-物流自提")
private String modeOfService;
@ApiModelProperty(value="是否是AI的标识:0:不是AI;1:是(AI未识别), 2(AI识别成功),3(AI识别失败")
@ApiModelProperty(value = "是否是AI的标识:0:不是AI;1:是(AI未识别), 2(AI识别成功),3(AI识别失败")
private String aiFlag;
@ApiModelProperty(value="AI识别的结果")
@ApiModelProperty(value = "AI识别的结果")
private String aiResult;
@ApiModelProperty(value="AI未识别的商品及规格总结")
@ApiModelProperty(value = "AI未识别的商品及规格总结")
private String aiNotRecognition;
@Transient
@TableField(exist = false)
@ApiModelProperty(value="商品详情")
@ApiModelProperty(value = "商品详情")
private List<SaleDetailDTO> saleDetailDTOList;
@Transient
@TableField(exist = false)
@ApiModelProperty(value="退款数量")
@ApiModelProperty(value = "退款数量")
private int returnSaleProductCount;
@Transient
@TableField(exist = false)
@ApiModelProperty(value="退款总金额")
@ApiModelProperty(value = "退款总金额")
private BigDecimal returnSaleTotalAmount;
@ApiModelProperty(value="欠款抵扣金额")
@ApiModelProperty(value = "欠款抵扣金额")
private BigDecimal debtDeductionAmount;
@ApiModelProperty(value="销售抵扣金额")
@ApiModelProperty(value = "销售抵扣金额")
private BigDecimal saleDeductionAmount;
@ApiModelProperty(value="余额抵扣金额")
@ApiModelProperty(value = "余额抵扣金额")
private BigDecimal balanceDeductionAmount;
@Transient
@ -182,6 +183,16 @@ public class Sale implements Serializable {
@ApiModelProperty(value = "上次欠款")
private BigDecimal lastDebtAmount;
@ApiModelProperty(value = "打印次数")
private int printCount;
@ApiModelProperty(value = "是否配货:0:否;1:是")
private int distributionFlag;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "标签列表")
private List<SaleLableVo> lableList;
private static final long serialVersionUID = 1L;

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java

@ -130,4 +130,7 @@ public class Shop extends HiverBaseEntity {
@ApiModelProperty(value = "打印方式")
private String printingMethod;
@ApiModelProperty(value = "是否需要入库确认:0:不需要;1:需要(数据库默认为0)")
private String storeFlag;
}

90
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/controller/LableController.java

@ -0,0 +1,90 @@
package cc.hiver.mall.lable.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.lable.entity.Lable;
import cc.hiver.mall.lable.service.LableService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 标签控制层
*
* @author 王富康
* @date 2025/2/26
*/
@Slf4j
@RestController
@Api(tags = "标签控制层")
@RequestMapping("/hiver/app/lable/")
public class LableController {
@Autowired
private LableService lableService;
/**
* 新增/编辑标签
*
* @param lable
* @return Result
* @author 王富康
* @date 2025/2/26
*/
@RequestMapping(value = "/saveOrEditLable", method = RequestMethod.POST)
public Result saveLable(@RequestBody(required = false) Lable lable) {
try {
lable = lableService.saveLable(lable);
} catch (Exception e) {
log.error("新增标签失败", e);
return ResultUtil.error("新增标签失败!");
}
return new ResultUtil<>().setData(lable);
}
/**
* 删除标签真删除
*
* @param id
* @return Result
* @author 王富康
* @date 2025/2/26
*/
@RequestMapping(value = "/deleteLable", method = RequestMethod.POST)
public Result deleteLable(String id) {
try {
lableService.removeById(id);
} catch (Exception e) {
log.error("删除标签失败", e);
return ResultUtil.error("删除标签失败!");
}
return ResultUtil.success("删除标签成功!");
}
/**
* 查询店铺下所有标签
* @author 王富康
* @date 2025/2/26
* @param shopId
* @return Result
*/
@RequestMapping(value = "/getLableListByShopId", method = RequestMethod.POST)
public Result getLableListByShopId(String shopId) {
try {
List<Lable> lableList = lableService.getLableListByShopId(shopId);
return new ResultUtil<>().setData(lableList);
} catch (Exception e) {
log.error("查询店铺下所有标签失败", e);
return ResultUtil.error("查询店铺下所有标签失败!");
}
}
}

114
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/controller/SaleLableController.java

@ -0,0 +1,114 @@
package cc.hiver.mall.lable.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.lable.entity.SaleLable;
import cc.hiver.mall.lable.service.SaleLableService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.transaction.Transactional;
/**
* 订单-标签关联表控制层
*
* @author 王富康
* @date 2025/2/26
*/
@Slf4j
@RestController
@Api(tags = "订单-标签关联表控制层")
@RequestMapping("/hiver/app/saleLable/")
public class SaleLableController {
@Autowired
private SaleLableService saleLableService;
/**
* 新增/编辑订单-标签关联
*
* @param saleLable
* @return Result
* @author 王富康
* @date 2025/2/26
*/
@RequestMapping(value = "/saveOrEditSaleLable", method = RequestMethod.POST)
public Result saveOrEditSaleLable(@RequestBody(required = false) SaleLable saleLable) {
try {
saleLable = saleLableService.saveOrEditSaleLable(saleLable);
} catch (Exception e) {
log.error("新增订单-标签关联失败", e);
return ResultUtil.error("新增订单-标签关联失败!");
}
return new ResultUtil<>().setData(saleLable);
}
/**
* 删除订单-标签关联真删除
*
* @param id
* @return Result
* @author 王富康
* @date 2025/2/26
*/
@RequestMapping(value = "/deleteSaleLable", method = RequestMethod.POST)
public Result deleteLable(String id) {
try {
saleLableService.removeById(id);
} catch (Exception e) {
log.error("删除订单-标签关联失败", e);
return ResultUtil.error("删除订单-标签关联失败!");
}
return ResultUtil.success("删除订单-标签关联成功!");
}
@RequestMapping(value = "/deleteBySaleId", method = RequestMethod.POST)
public Result deleteBySaleId(String saleId) {
if(StringUtils.isEmpty(saleId)){
return ResultUtil.error("订单id不能为空!");
}
try {
saleLableService.deleteBySaleId(saleId);
} catch (Exception e) {
log.error("删除订单-标签关联失败", e);
return ResultUtil.error("删除订单-标签关联失败!");
}
return ResultUtil.success("删除订单-标签关联成功!");
}
/**
* 订单关联标签
*
* @param saleId
* @param lableIds
* @return
*/
@Transactional
@RequestMapping(value = "/batchSaveSaleLable", method = RequestMethod.POST)
public Result batchSaveSaleLable(String saleId, String lableIds) {
if(StringUtils.isEmpty(saleId)){
return ResultUtil.error("订单id不能为空!");
}
if(StringUtils.isEmpty(lableIds)){
return ResultUtil.error("标签id不能为空!");
}
try {
// 先删,后增
saleLableService.deleteBySaleId(saleId);
saleLableService.batchSaveSaleLable(saleId, lableIds);
} catch (Exception e) {
log.error("关联失败", e);
return ResultUtil.error("关联失败!");
}
return ResultUtil.success("关联成功!");
}
}

33
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/entity/Lable.java

@ -0,0 +1,33 @@
package cc.hiver.mall.lable.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Id;
@Data
@ApiModel(value = "标签表")
@TableName(value = "t_lable", autoResultMap = true)
public class Lable {
@Id
@TableId
@ApiModelProperty(value = "唯一标识")
private String id;
@ApiModelProperty(value = "店铺id")
private String shopId;
@ApiModelProperty(value = "店铺名称")
private String shopName;
@ApiModelProperty(value = "标签内容")
private String lableContent;
@ApiModelProperty(value = "标签颜色")
private String lableColor;
}

22
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/entity/SaleLable.java

@ -0,0 +1,22 @@
package cc.hiver.mall.lable.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Id;
@Data
public class SaleLable {
@Id
@TableId
@ApiModelProperty(value = "唯一标识")
private String id;
@ApiModelProperty(value = "订单id")
private String saleId;
@ApiModelProperty(value = "标签id")
private String lableId;
}

33
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/mapper/LableMapper.java

@ -0,0 +1,33 @@
package cc.hiver.mall.lable.mapper;
import cc.hiver.mall.lable.entity.Lable;
import cc.hiver.mall.lable.vo.SaleLableVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LableMapper extends BaseMapper<Lable> {
/**
* 根据saleId获取标签信息
*
* @param saleIdList
* @return List<SaleLableVo>
* @author 王富康
* @date 2025/2/26
*/
List<SaleLableVo> getLableListBySaleIdList(@Param("saleIdList") List<String> saleIdList);
/**
* 查询店铺下所有标签
*
* @param shopId
* @return List<Lable>
* @author 王富康
* @date 2025/2/26
*/
List<Lable> getLableListByShopId(@Param("shopId") String shopId);
}

31
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/mapper/SaleLableMapper.java

@ -0,0 +1,31 @@
package cc.hiver.mall.lable.mapper;
import cc.hiver.mall.lable.entity.SaleLable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface SaleLableMapper extends BaseMapper<SaleLable> {
/**
* 根据订单id删除订单-标签关联
*
* @param saleId
* @author 王富康
* @date 2025/2/28
*/
void deleteBySaleId(@Param("saleId") String saleId);
/**
* 批量新增关联关系
*
* @param saleLables
* @return boolean
* @author 王富康
* @date 2025/2/28
*/
boolean batchSaveSaleLable(@Param("saleLables") List<SaleLable> saleLables);
}

44
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/LableService.java

@ -0,0 +1,44 @@
package cc.hiver.mall.lable.service;
import cc.hiver.mall.lable.entity.Lable;
import cc.hiver.mall.lable.vo.SaleLableVo;
import java.util.List;
public interface LableService {
/**
* 新增/编辑标签
* @author 王富康
* @date 2025/2/26
* @param lable
* @return Lable
*/
Lable saveLable(Lable lable);
/**
* 删除标签真删除
* @author 王富康
* @date 2025/2/26
* @param id
*/
void removeById(String id);
/**
* 根据saleId获取标签信息
* @author 王富康
* @date 2025/2/26
* @param saleIdList
* @return List<SaleLableVo>
*/
List<SaleLableVo> getLableListBySaleIdList(List<String> saleIdList);
/**
* 查询店铺下所有标签
* @author 王富康
* @date 2025/2/26
* @param shopId
* @return List<Lable>
*/
List<Lable> getLableListByShopId(String shopId);
}

15
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/SaleLableService.java

@ -0,0 +1,15 @@
package cc.hiver.mall.lable.service;
import cc.hiver.mall.lable.entity.SaleLable;
public interface SaleLableService {
SaleLable saveOrEditSaleLable(SaleLable saleLable);
void removeById(String id);
void deleteBySaleId(String saleId);
// 批量新增关联
boolean batchSaveSaleLable(String saleId, String lableIds);
}

81
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/impl/LableServiceImpl.java

@ -0,0 +1,81 @@
package cc.hiver.mall.lable.service.impl;
import cc.hiver.mall.lable.entity.Lable;
import cc.hiver.mall.lable.mapper.LableMapper;
import cc.hiver.mall.lable.service.LableService;
import cc.hiver.mall.lable.vo.SaleLableVo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
@Service
public class LableServiceImpl extends ServiceImpl<LableMapper, Lable> implements LableService {
@Autowired
private LableMapper lableMapper;
/**
* 新增/编辑标签
*
* @param lable
* @return Lable
* @author 王富康
* @date 2025/2/26
*/
@Override
public Lable saveLable(Lable lable) {
final String id = lable.getId();
if (StringUtils.isEmpty(id)) {
// 新增
final String uuid = UUID.randomUUID().toString();
lable.setId(uuid);
lableMapper.insert(lable);
} else {
// 修改
lableMapper.updateById(lable);
}
return lable;
}
/**
* 删除标签真删除
*
* @param id
* @author 王富康
* @date 2025/2/26
*/
@Override
public void removeById(String id) {
lableMapper.deleteById(id);
}
/**
* 根据saleId获取标签信息
*
* @param saleIdList
* @return List<SaleLableVo>
* @author 王富康
* @date 2025/2/26
*/
@Override
public List<SaleLableVo> getLableListBySaleIdList(List<String> saleIdList) {
return lableMapper.getLableListBySaleIdList(saleIdList);
}
/**
* 查询店铺下所有标签
*
* @param shopId
* @return List<Lable>
* @author 王富康
* @date 2025/2/26
*/
@Override
public List<Lable> getLableListByShopId(String shopId) {
return lableMapper.getLableListByShopId(shopId);
}
}

65
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/service/impl/SaleLableServiceImpl.java

@ -0,0 +1,65 @@
package cc.hiver.mall.lable.service.impl;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import cc.hiver.mall.lable.entity.SaleLable;
import cc.hiver.mall.lable.mapper.SaleLableMapper;
import cc.hiver.mall.lable.service.SaleLableService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@Service
public class SaleLableServiceImpl extends ServiceImpl<SaleLableMapper, SaleLable> implements SaleLableService {
@Autowired
private SaleLableMapper saleLableMapper;
@Override
public SaleLable saveOrEditSaleLable(SaleLable saleLable) {
final String id = saleLable.getId();
if (StringUtils.isEmpty(id)) {
// 新增
final String uuid = UUID.randomUUID().toString();
saleLable.setId(uuid);
saleLableMapper.insert(saleLable);
} else {
// 修改
saleLableMapper.updateById(saleLable);
}
return saleLable;
}
@Override
public void removeById(String id) {
saleLableMapper.deleteById(id);
}
@Override
public void deleteBySaleId(String saleId) {
saleLableMapper.deleteBySaleId(saleId);
}
@Override
public boolean batchSaveSaleLable(String saleId, String lableIds) {
// lableIds根据逗号分隔,然后组成List
final String[] split = lableIds.split(",");
final List<String> lableList = new ArrayList<>();
Collections.addAll(lableList, split);
final List<SaleLable> saleLables = new ArrayList<>();
for (String s : split) {
final SaleLable saleLable = new SaleLable();
saleLable.setId(String.valueOf(SnowFlakeUtil.nextId()));
saleLable.setSaleId(saleId);
saleLable.setLableId(s);
saleLables.add(saleLable);
}
return saleLableMapper.batchSaveSaleLable(saleLables);
}
}

26
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/lable/vo/SaleLableVo.java

@ -0,0 +1,26 @@
package cc.hiver.mall.lable.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class SaleLableVo {
@ApiModelProperty(value = "唯一标识")
private String id;
@ApiModelProperty(value = "销售单id")
private String saleId;
@ApiModelProperty(value = "店铺id")
private String shopId;
@ApiModelProperty(value = "店铺名称")
private String shopName;
@ApiModelProperty(value = "标签内容")
private String lableContent;
@ApiModelProperty(value = "标签颜色")
private String lableColor;
}

14
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SaleVO.java

@ -43,13 +43,13 @@ public class SaleVO extends HiverBasePageQuery implements Serializable {
private PageVo pageVo;
@ApiModelProperty(value = "开始时间")
String startTime;
private String startTime;
@ApiModelProperty(value = "结束时间")
String endTime;
private String endTime;
@ApiModelProperty(value = "查询条件")
String searchStr;
private String searchStr;
/**
* 订单状态开单
@ -77,8 +77,14 @@ public class SaleVO extends HiverBasePageQuery implements Serializable {
private String fromWhere;
@ApiModelProperty(value = "删除标识")
String delFlag;
private String delFlag;
@ApiModelProperty(value = "客户id(如果传了这,需要查询客户的购买数量)")
private String customerId;
@ApiModelProperty(value = "传0就是根据开单时间倒叙,传1就是正序")
private String timeOrder;
@ApiModelProperty(value = "是否配货:0:否;1:是")
private String distributionFlag;
}

1
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/purchaseocr/mapper/PurchaseOcrPictureMapper.java

@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PurchaseOcrPictureMapper extends BaseMapper<PurchaseOcrPicture> {
void batchSave(@Param("purchaseOcrPictureList") List<PurchaseOcrPicture> purchaseOcrPictureList);
void batchUpdate(@Param("purchaseOcrPictureList") List<PurchaseOcrPicture> purchaseOcrPictureAddList);

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

@ -231,15 +231,23 @@ 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 String purchasePriceStr = object.getString("purchasePrice");
BigDecimal purchasePrice = BigDecimal.ZERO;
// 使用正则表达式提取数字部分
final Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?");
final Matcher matcher = pattern.matcher(priceStr);
final Matcher matcher = pattern.matcher(purchasePriceStr);
if (matcher.find()) {
// 获取匹配到的数字字符串并转换为BigDecimal
final String numericPart = matcher.group();
purchasePrice = new BigDecimal(numericPart);
}
final String priceStr = object.getString("price");
BigDecimal price = BigDecimal.ZERO;
final Matcher priceMatcher = pattern.matcher(priceStr);
if (priceMatcher.find()) {
// 获取匹配到的数字字符串并转换为BigDecimal
final String numericPart = priceMatcher.group();
price = new BigDecimal(numericPart);
}
@ -280,18 +288,24 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
purchaseDetail.setProductName(product.getProductName());
purchaseDetail.setShopId(product.getShopId());
purchaseDetail.setCategoryId(categoryId);
purchaseDetail.setPrice(product.getPrice());
purchaseDetail.setWholesalePrice(product.getWholesalePrice());
// purchaseDetail.setPrice(product.getPrice());
// purchaseDetail.setWholesalePrice(product.getWholesalePrice());
purchaseDetail.setProductPicture(product.getProductPicture());
purchaseDetail.setProductSn(product.getProductSn());
purchaseDetail.setProductCount(0);
purchaseDetail.setSupplierName(product.getSupplierName());
purchaseDetail.setCustomerCategoryRule(product.getCustomerCategoryRule());
// ai语音入库旧商品 如果通义千问返回的价格为0,返回当前采购价 ,采购价:purchasePrice
if (price.compareTo(BigDecimal.ZERO) == 0) {
if (purchasePrice.compareTo(BigDecimal.ZERO) == 0) {
purchaseDetail.setPurchasePrice(product.getPurchasePrice());
} else {
purchaseDetail.setPurchasePrice(price);
purchaseDetail.setPurchasePrice(purchasePrice);
}
// ai语音入库旧商品 如果通义千问返回的价格为0,返回当前零售价 ,零售价:price
if (price.compareTo(BigDecimal.ZERO) == 0) {
purchaseDetail.setPrice(product.getPrice());
} else {
purchaseDetail.setPrice(price);
}
// ai语音入库旧商品 如果通义千问返回的价格为0,返回当前批发价 ,批发价:wholesalePrice
if (wholesalePrice.compareTo(BigDecimal.ZERO) == 0) {
@ -434,7 +448,8 @@ public class PurchaseOcrPictureServiceImpl implements PurchaseOcrPictureService
purchaseDetail.setId(StringUtils.isEmpty(productSn) ? productName : productSn);
purchaseDetail.setProductName(productName);
purchaseDetail.setProductSn(productSn);
purchaseDetail.setPurchasePrice(price);
purchaseDetail.setPrice(price);
purchaseDetail.setPurchasePrice(purchasePrice);
purchaseDetail.setWholesalePrice(wholesalePrice);
purchaseDetail.setProductCount(0);
// 获取默认分类

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/SaleService.java

@ -168,4 +168,21 @@ public interface SaleService extends IService<Sale> {
* @return CustomerDataVo
*/
CustomerDataVo getCustomerSaleInfo(CustomerPageQuery customerPageQuery);
/**
* 根据saleid更新配货状态的
* @author 王富康
* @date 2025/2/26
* @param saleId
* @param distributionFlag
*/
void updateDistributionFlag(String saleId, String distributionFlag);
/**
* 更新打印次数+1
* @author 王富康
* @date 2025/2/26
* @param saleId
*/
void updatePrintCount(String saleId);
}

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

@ -22,6 +22,8 @@ import cc.hiver.mall.debt.entity.Debt;
import cc.hiver.mall.debt.service.DebtService;
import cc.hiver.mall.deductlog.service.DeductLogService;
import cc.hiver.mall.entity.*;
import cc.hiver.mall.lable.service.LableService;
import cc.hiver.mall.lable.vo.SaleLableVo;
import cc.hiver.mall.pojo.dto.*;
import cc.hiver.mall.pojo.query.CustomerPageQuery;
import cc.hiver.mall.pojo.query.SalePageQuery;
@ -122,6 +124,9 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
@Autowired
private ReturnDetailService returnDetailService;
@Autowired
private LableService lableService;
@Override
public void editPayPrice(String id, BigDecimal price, String dealingsWay) {
// 修改采购单、实付、未付金额
@ -252,14 +257,40 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
for (BuyCountVo buyCountVo : buyCount) {
buyCountMap.put(buyCountVo.getProductId(), buyCountVo.getBuyCount());
}
if(sale != null && sale.getSaleDetailDTOList() != null){
if (sale != null && sale.getSaleDetailDTOList() != null) {
for (SaleDetailDTO saleDetailDTO : sale.getSaleDetailDTOList()) {
String productId = saleDetailDTO.getProductId();
final String productId = saleDetailDTO.getProductId();
saleDetailDTO.setBuyCount(buyCountMap.getOrDefault(productId, 0));
}
}
}
// 获取saleId
final List<String> saleIdList = new ArrayList<>();
for (Sale sale : saleList.getRecords()) {
saleIdList.add(sale.getId());
}
// 根据saleId获取标签信息
if (!saleIdList.isEmpty()) {
final List<SaleLableVo> lableList = lableService.getLableListBySaleIdList(saleIdList);
// 根据saleId分组为map
final Map<String, List<SaleLableVo>> lableMap = new HashMap<>();
for (SaleLableVo saleLableVo : lableList) {
if (lableMap.containsKey(saleLableVo.getSaleId())) {
lableMap.get(saleLableVo.getSaleId()).add(saleLableVo);
} else {
final List<SaleLableVo> saleLableVoList = new ArrayList<>();
saleLableVoList.add(saleLableVo);
lableMap.put(saleLableVo.getSaleId(), saleLableVoList);
}
}
// 放入返回数据中
for (Sale sale : saleList.getRecords()) {
if (lableMap.containsKey(sale.getId())) {
sale.setLableList(lableMap.get(sale.getId()));
}
}
}
return saleList;
}
@ -435,10 +466,10 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
}
List<CustomerBuySaleVo> customerBuySaleVoList = new ArrayList<>();
// 获取历次销售单的信息。
if(StringUtils.isNotEmpty(userId)){
if (StringUtils.isNotEmpty(userId)) {
customerBuySaleVoList = saleMapper.getByUserId(userId);
}
if(StringUtils.isNotEmpty(createBy)){
if (StringUtils.isNotEmpty(createBy)) {
customerBuySaleVoList = saleMapper.getByCreUserId(createBy);
}
final Map<String, CustomerBuySaleVo> customerBuySaleVoMap = new HashMap<>();
@ -447,7 +478,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
}
if (!productIds.isEmpty()) {
// 获取商品各规格售卖的数量
final List<CustomerBuyProductDetailLogVo> customerBuyProductDetailLogVos = saleMapper.getCustomerBuyProductLogDetailLog(userId,createBy, salePageQuery.getShopId(), productIds, salePageQuery.getStartDate(), salePageQuery.getEndDate());
final List<CustomerBuyProductDetailLogVo> customerBuyProductDetailLogVos = saleMapper.getCustomerBuyProductLogDetailLog(userId, createBy, salePageQuery.getShopId(), productIds, salePageQuery.getStartDate(), salePageQuery.getEndDate());
// 进行数据封装Map<商品id,Map<销售单id,商品明细>>
final Map<String, Map<String, List<CustomerBuyProductDetailLogVo>>> allMap = new HashMap<>();
@ -663,7 +694,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
}
@Override
public JSONObject buyAi(String aiMsg, String customerId,String singleProductId) {
public JSONObject buyAi(String aiMsg, String customerId, String singleProductId) {
final JSONObject returnJsonObject = new JSONObject();
// 叉转X 文本纠错 使用正则表达式替换单个或多个连续的“叉”字符
aiMsg = replaceAllX(aiMsg);
@ -676,7 +707,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
final String resultContent = jsonObject.get("resultContent").toString();
final JSONArray json = JSON.parseArray(resultContent);
// 旧商品的id集合
List<String> oldProductIdList = new ArrayList<>();
final List<String> oldProductIdList = new ArrayList<>();
for (int i = 0; i < json.size(); i++) {
final JSONObject object = json.getJSONObject(i);
String productSn = object.getString("productSn");
@ -697,14 +728,14 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
// 定义一个map,货号为key,purchaseDetail 为value
final Map<String, PurchaseDetail> purchaseDetailMap = new HashMap<>();
// 根据货号去查询商品,如果
final List<Product> byProductSn = productService.getByProductSn(productSn, shopId,"");
final List<Product> byProductSn = productService.getByProductSn(productSn, shopId, "");
if (StringUtils.isNotEmpty(singleProductId) || (byProductSn != null && !byProductSn.isEmpty())) {
// 原则上一个店铺一个货号对应一个商品,这里如果查到了,直接拿第一个。
Product product = new Product();
if(!byProductSn.isEmpty()){
if (!byProductSn.isEmpty()) {
product = byProductSn.get(0);
}
if(StringUtils.isNotEmpty(singleProductId)){
if (StringUtils.isNotEmpty(singleProductId)) {
// 20240928 app/sale/buyAi接口加个参数productId,如果传值了,查规格库存数的时候就查这款商品的
product = productService.getById(singleProductId);
}
@ -892,9 +923,9 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
}
// 如果客户id不为空,那么就查询商品的购买记录
if(StringUtils.isNotEmpty(customerId)){
if (StringUtils.isNotEmpty(customerId)) {
// 获取客户的购买次数
final List<BuyCountVo> buyCount = buyCount(customerId,oldProductIdList);
final List<BuyCountVo> buyCount = buyCount(customerId, oldProductIdList);
// 封装为Map
final Map<String, Integer> buyCountMap = new HashMap<>();
for (BuyCountVo buyCountVo : buyCount) {
@ -1319,34 +1350,35 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
*/
@Override
public List<BuyCountVo> buyCount(String customerId, List<String> productIdList) {
if(StringUtils.isEmpty(customerId) || productIdList.isEmpty()){
if (StringUtils.isEmpty(customerId) || productIdList.isEmpty()) {
return new ArrayList<>();
}
return saleMapper.buyCount(customerId,productIdList);
return saleMapper.buyCount(customerId, productIdList);
}
/**
* 查询客户 拿货总金额商品总款数总件数
* @author 王富康
* @date 2024/10/24
*
* @param customerPageQuery
* @return CustomerDataVo
* @author 王富康
* @date 2024/10/24
*/
@Override
public CustomerDataVo getCustomerSaleInfo(CustomerPageQuery customerPageQuery) {
final CustomerDataVo customerDataVo = new CustomerDataVo();
// 查询客户 拿货(总金额)商品总款数
final CustomerDataVo salePrice = saleMapper.getSalePrice(customerPageQuery);
if(salePrice != null){
if (salePrice != null) {
customerDataVo.setSalePrice(salePrice.getSalePrice());
}else{
} else {
customerDataVo.setSalePrice("0.00");
}
// 查询客户 总件数
List<ProductDataVo> saleCount = saleMapper.getSaleCount(customerPageQuery);
if(saleCount == null ){
if (saleCount == null) {
saleCount = new ArrayList<>();
}
customerDataVo.setSaleCount(saleCount.size());
@ -1354,6 +1386,31 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa
return customerDataVo;
}
/**
* 根据saleid更新配货状态的
*
* @param saleId
* @param distributionFlag
* @author 王富康
* @date 2025/2/26
*/
@Override
public void updateDistributionFlag(String saleId, String distributionFlag) {
saleMapper.updateDistributionFlag(saleId, distributionFlag);
}
/**
* 打印次数更新+1
*
* @param saleId
* @author 王富康
* @date 2025/2/26
*/
@Override
public void updatePrintCount(String saleId) {
saleMapper.updatePrintCount(saleId);
}
/**
* 使用正则表达式替换输入字符串中连续的字符为相应数量的X字符
*

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

@ -1188,6 +1188,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
// 更新那些未入库就进行销售销售详情、库存履历、库存表的采购价
saleDetailService.putInUpdatePurchasePrice(purchaseDetails);
// 入库单加一个字段:是否确认入库(app/stock/putInPriceOfAi)这个接口设置为待确认
purchase.setStoreFlag(PurchaseConstant.STORE_FLAG[0]);
//3.登记采购单主表和采购单明细表
// log.debug("保存前的入库时间==="+DateUtil.COMMON_FULL.getDateText(purchase.getCreateTime())+"===="+DateUtil.COMMON_FULL.getDateText(purchase.getPurchaseTime()));
final boolean saveOrUpdateFlag;

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

@ -891,8 +891,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\":\"单价\" , \"wholesalePrice\":\"批发价\" }]\n" +
"1.如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" +
questionMsg += "你是一个服装行业库管专家,请帮我把所有内容封装为JSON,json格式为:[{ \"productSn\": \"货号\", \"productName\": \"名称\" , \"attributeList\": [{\"color\":\"颜色\",\"size\":\"尺码\",\"productCount\": \"数量\"}], \"purchasePrice\":\"单价\" , \"price\":\"零售价\" , \"wholesalePrice\":\"批发价\" }]\n" +
"1.如果没有识别到\"purchasePrice\"的内容,则\"purchasePrice\"赋值\"0\"。如果没有识别到\"price\"的内容,则\"price\"赋值\"0\"。如果没有识别到\"wholesalePrice\"的内容,则\"wholesalePrice\"赋值\"0\"。\n" +
"2.如果没有识别到\"productSn\"的内容,则\"productSn\"赋值\"\"。\n" +
"3.如果没有识别到\"productName\"的内容,则\"productName\"使用\"productSn\"的值填充。\n" +
"4.如果识别到多种颜色,按不同颜色拆分返回。如果没有识别到\"color\"的内容,则\"color\"赋值“均色”,如果没有识别到\"size\"的内容,则\"size\"赋值“均码”,返回一条JSON数据即可。\n" +

33
hiver-modules/hiver-mall/src/main/resources/mapper/LableMapper.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.lable.mapper.LableMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.lable.entity.Lable">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="lable_content" jdbcType="VARCHAR" property="lableContent" />
<result column="lable_color" jdbcType="VARCHAR" property="lableColor" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, shop_name, lable_content, lable_color
</sql>
<select id="getLableListBySaleIdList" resultType="cc.hiver.mall.lable.vo.SaleLableVo">
select
tl.id, tl.shop_id, tl.shop_name, tl.lable_content, tl.lable_color,tsl.sale_id
from t_lable tl
left join t_sale_lable tsl
on tl.id = tsl.lable_id
where tsl.sale_id in
<foreach close=")" collection="saleIdList" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</select>
<select id="getLableListByShopId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from t_lable
where shop_id = #{shopId,jdbcType=VARCHAR}
</select>
</mapper>

40
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseMapper.xml

@ -21,6 +21,7 @@
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="balance_deduction_amount" jdbcType="DECIMAL" property="balanceDeductionAmount" />
<result column="purchase_time" jdbcType="TIMESTAMP" property="purchaseTime" />
<result column="store_flag" jdbcType="INTEGER" property="storeFlag" />
</resultMap>
<resultMap id="DebtResultMap" type="cc.hiver.mall.pojo.dto.DebtSupplier">
@ -90,7 +91,7 @@
<sql id="Base_Column_List">
id, create_by,create_by_name, create_time, del_flag, update_by, update_time, supplier_id,supplier_name, shop_id,
total_amount, should_pay, already_pay, no_pay,other_pay, in_storage_status,remark, balance_deduction_amount,
purchase_time
purchase_time,store_flag
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.PurchaseExample" resultMap="BaseResultMap">
select
@ -126,13 +127,13 @@
insert into t_purchase (id, create_by, create_by_name, create_time,
del_flag, update_by, update_time,
supplier_id,supplier_name, shop_id, total_amount,
should_pay, already_pay, no_pay,other_pay, in_storage_status,remark, balance_deduction_amount,purchase_time
should_pay, already_pay, no_pay,other_pay, in_storage_status,remark, balance_deduction_amount,purchase_time,store_flag
)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{supplierId,jdbcType=VARCHAR},#{supplierName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
#{shouldPay,jdbcType=DECIMAL}, #{alreadyPay,jdbcType=DECIMAL}, #{noPay,jdbcType=DECIMAL}, #{otherPay,jdbcType=DECIMAL}, #{inStorageStatus,jdbcType=INTEGER},
#{remark,jdbcType=VARCHAR}, #{balanceDeductionAmount,jdbcType=DECIMAL},#{purchaseTime,jdbcType=TIMESTAMP}
#{remark,jdbcType=VARCHAR}, #{balanceDeductionAmount,jdbcType=DECIMAL},#{purchaseTime,jdbcType=TIMESTAMP},#{storeFlag,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Purchase">
@ -195,6 +196,9 @@
<if test="purchaseTime != null">
purchase_time,
</if>
<if test="storeFlag != null">
store_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -239,6 +243,24 @@
<if test="noPay != null">
#{noPay,jdbcType=DECIMAL},
</if>
<if test="otherPay != null">
#{otherPay,jdbcType=DECIMAL},
</if>
<if test="inStorageStatus != null">
#{inStorageStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="balanceDeductionAmount != null">
#{balanceDeductionAmount,jdbcType=DECIMAL},
</if>
<if test="purchaseTime != null">
#{purchaseTime,jdbcType=TIMESTAMP},
</if>
<if test="storeFlag != null">
#{storeFlag,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cc.hiver.mall.entity.PurchaseExample" resultType="java.lang.Long">
@ -307,6 +329,9 @@
<if test="record.purchaseTime != null">
purchase_time = #{record.purchaseTime,jdbcType=TIMESTAMP},
</if>
<if test="record.storeFlag != null">
store_flag = #{record.storeFlag,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -332,7 +357,8 @@
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
remark = #{record.remark,jdbcType=VARCHAR},
balance_deduction_amount = #{record.balanceDeductionAmount,jdbcType=DECIMAL},
purchase_time = #{record.purchaseTime,jdbcType=TIMESTAMP}
purchase_time = #{record.purchaseTime,jdbcType=TIMESTAMP},
store_flag = #{record.storeFlag,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -394,6 +420,9 @@
<if test="purchaseTime != null">
purchase_time = #{purchaseTime,jdbcType=TIMESTAMP},
</if>
<if test="storeFlag != null">
store_flag = #{storeFlag,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -416,7 +445,8 @@
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=INTEGER},
balance_deduction_amount = #{balanceDeductionAmount,jdbcType=DECIMAL},
purchase_time = #{purchaseTime,jdbcType=TIMESTAMP}
purchase_time = #{purchaseTime,jdbcType=TIMESTAMP},
store_flag = #{storeFlag,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>

27
hiver-modules/hiver-mall/src/main/resources/mapper/SaleLableMapper.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.lable.mapper.SaleLableMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.lable.entity.SaleLable">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="sale_id" jdbcType="VARCHAR" property="saleId" />
<result column="lable_id" jdbcType="VARCHAR" property="lableId" />
</resultMap>
<sql id="Base_Column_List">
id, sale_id, lable_id
</sql>
<delete id="deleteBySaleId" parameterType="java.lang.String">
delete
from t_sale_lable
where sale_id = #{saleId,jdbcType=VARCHAR}
</delete>
<insert id="batchSaveSaleLable" parameterType="java.util.List">
insert into t_sale_lable (id, sale_id, lable_id) values
<foreach item="saleLable" collection="saleLables" index="index" separator=",">
(#{saleLable.id,jdbcType=VARCHAR},#{saleLable.saleId,jdbcType=VARCHAR},
#{saleLable.lableId,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>

83
hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml

@ -45,6 +45,8 @@
<result column="ai_flag" jdbcType="INTEGER" property="aiFlag" />
<result column="ai_result" jdbcType="VARCHAR" property="aiResult" />
<result column="ai_not_recognition" jdbcType="VARCHAR" property="aiNotRecognition" />
<result column="print_count" jdbcType="INTEGER" property="printCount" />
<result column="distribution_flag" jdbcType="VARCHAR" property="distributionFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -107,7 +109,7 @@
<sql id="Base_Column_List">
id, create_by, create_by_name, create_time, del_flag, update_by, update_by_name, update_time, user_id, user_name, shop_id, shop_name, total_amount, discount,
discount_amount, real_amount, debt_deduction_amount, sale_deduction_amount, balance_deduction_amount, already_earn, no_earn, pay_status,pay_type, status, other_expense, transport_type, share_address, receive_address, province, city, area,
trans_company, company_name, product_count, remark, sale_name, company_phone, create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition
trans_company, company_name, product_count, remark, sale_name, company_phone, create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition,print_count,distribution_flag
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.SaleExample" resultMap="BaseResultMap">
@ -148,7 +150,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
already_earn, no_earn, pay_status,pay_type,
status, transport_type, share_address,
receive_address, province, city,
area,sale_name,remark,other_expense,trans_company,company_name,company_phone,product_count,create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition)
area,sale_name,remark,other_expense,trans_company,company_name,company_phone,product_count,create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition,print_count,distribution_flag)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},#{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR},#{updateByName,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{userId,jdbcType=VARCHAR},#{userName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},#{shopName,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
@ -160,7 +162,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
#{area,jdbcType=VARCHAR}, #{saleName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{otherExpense,jdbcType=VARCHAR},#{transCompany,jdbcType=VARCHAR},#{companyName,jdbcType=VARCHAR},#{companyPhone,jdbcType=VARCHAR},
#{productCount,jdbcType=INTEGER},#{createByPhone,jdbcType=VARCHAR},#{modeOfService,jdbcType=VARCHAR},
#{aiFlag,jdbcType=VARCHAR},#{aiResult,jdbcType=VARCHAR},#{aiNotRecognition,jdbcType=VARCHAR})
#{aiFlag,jdbcType=VARCHAR},#{aiResult,jdbcType=VARCHAR},#{aiNotRecognition,jdbcType=VARCHAR},#{printCount,jdbcType=INTEGER},#{distributionFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Sale">
insert into t_sale
@ -276,6 +278,12 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test="aiNotRecognition != null">
ai_not_recognition,
</if>
<if test="printCount != null">
print_count,
</if>
<if test="distributionFlag != null">
distribution_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -386,6 +394,12 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test="aiNotRecognition != null">
#{aiNotRecognition,jdbcType=VARCHAR},
</if>
<if test="printCount != null">
#{printCount,jdbcType=INTEGER},
</if>
<if test="distributionFlag != null">
#{distributionFlag,jdbcType=VARCHAR},
</if>
</trim>
</insert>
@ -509,6 +523,12 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test="record.aiNotRecognition != null">
ai_not_recognition = #{record.aiNotRecognition,jdbcType=VARCHAR},
</if>
<if test="record.printCount != null">
print_count = #{record.printCount,jdbcType=INTEGER},
</if>
<if test="record.distributionFlag != null">
distribution_flag = #{record.distributionFlag,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -552,7 +572,9 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
mode_of_service = #{record.modeOfService,jdbcType=VARCHAR},
ai_flag = #{record.aiFlag,jdbcType=INTEGER},
ai_result = #{record.aiResult,jdbcType=VARCHAR},
ai_not_recognition = #{record.aiNotRecognition,jdbcType=VARCHAR}
ai_not_recognition = #{record.aiNotRecognition,jdbcType=VARCHAR},
print_count = #{record.printCount,jdbcType=INTEGER},
distribution_flag = #{record.distributionFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -668,6 +690,12 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test="aiNotRecognition != null">
ai_not_recognition = #{aiNotRecognition,jdbcType=VARCHAR},
</if>
<if test="printCount != null">
print_count = #{printCount,jdbcType=INTEGER},
</if>
<if test="distributionFlag != null">
distribution_flag = #{distributionFlag,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -708,7 +736,9 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
mode_of_service = #{modeOfService,jdbcType=VARCHAR},
ai_flag = #{aiFlag,jdbcType=INTEGER},
ai_result = #{aiResult,jdbcType=VARCHAR},
ai_not_recognition = #{aiNotRecognition,jdbcType=VARCHAR}
ai_not_recognition = #{aiNotRecognition,jdbcType=VARCHAR},
print_count = #{printCount,jdbcType=INTEGER},
distribution_flag = #{distributionFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="saleSumAndCount" parameterType="cc.hiver.mall.entity.SaleExample" resultType="cc.hiver.mall.pojo.vo.SaleAllVO">
@ -754,7 +784,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
ts.shop_id,ts.shop_name,ts.total_amount,ts.discount,ts.discount_amount,ts.real_amount,ts.debt_deduction_amount,ts.sale_deduction_amount,ts.balance_deduction_amount ,ts.already_earn,ts.no_earn,ts.pay_status,
ts.pay_type,ts.status,ts.other_expense,ts.transport_type,ts.share_address,ts.receive_address,ts.province,ts.city,ts.area,
ts.trans_company,ts.company_name,ts.product_count,ts.remark,ts.sale_name,ts.company_phone,ts.create_by_phone,ts.mode_of_service,
ts.ai_flag,ts.ai_result,ts.ai_not_recognition,
ts.ai_flag,ts.ai_result,ts.ai_not_recognition,ts.print_count,ts.distribution_flag,
ss.return_sale_product_count,ss.return_sale_amount
from
t_sale ts
@ -822,7 +852,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
ts.sale_deduction_amount,ts.balance_deduction_amount ,ts.already_earn,ts.no_earn,ts.pay_status,ts.pay_type,ts.status,
ts.other_expense,ts.transport_type,ts.share_address,ts.receive_address,ts.province,ts.city,ts.area,
ts.trans_company,ts.company_name,ts.product_count,ts.remark,ts.sale_name,ts.company_phone,ts.create_by_phone,ts.mode_of_service,
ts.ai_flag,ts.ai_result,ts.ai_not_recognition,
ts.ai_flag,ts.ai_result,ts.ai_not_recognition,ts.print_count,ts.distribution_flag,
trs.return_sale_total_amount ,trs.return_sale_product_count,
tdr.last_debt_amount
FROM
@ -858,7 +888,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
</if>
)
</if>
<if test='saleVO.fromWhere=="2"'>
<if test='saleVO.fromWhere=="2" and saleVO.status != null '>
and ts.status = #{saleVO.status}
</if>
</if>
@ -872,7 +902,7 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test='saleVO.status != null and saleVO.status.trim() neq ""'>
and ts.status = #{saleVO.status}
</if>
<if test='saleVO.transportType!=null'>
<if test='saleVO.transportType!=null' >
and ts.transport_type = #{saleVO.transportType}
</if>
<if test='saleVO.userId!=null'>
@ -882,13 +912,32 @@ trans_company, company_name, product_count, remark, sale_name, company_phone, cr
<if test='saleVO.startTime!=null'>
and ts.create_time BETWEEN #{saleVO.startTime} AND #{saleVO.endTime}
</if>
<if test='saleVO.distributionFlag!=null'>
and ts.distribution_flag = #{saleVO.distributionFlag}
</if>
<if test='saleVO.searchStr!=null'>
and (ts.user_name like concat('%',#{saleVO.searchStr},'%')
or ts.create_by_name like concat('%',#{saleVO.searchStr},'%')
or ts.id like concat('%',#{saleVO.searchStr},'%'))
</if>
</where>
order by ts.create_time desc
<if test='saleVO.timeOrder != null'>
<choose>
<when test='saleVO.timeOrder == "0"'>
order by ts.create_time desc
</when>
<when test='saleVO.timeOrder == "1"'>
order by ts.create_time asc
</when>
<!-- 可以在这里添加更多的when分支来处理其他情况 -->
<otherwise>
order by ts.create_time desc <!-- 默认降序 -->
</otherwise>
</choose>
</if>
<if test='saleVO.timeOrder == null'>
order by ts.create_time desc <!-- 默认情况 -->
</if>
</select>
<select id="getCustomerBuyProductLog" resultType="cc.hiver.mall.pojo.vo.CustomerBuyProductLogVo">
@ -1453,4 +1502,18 @@ GROUP BY
GROUP BY
dd.product_id
</select>
<update id="updateDistributionFlag" >
update t_sale
set
distribution_flag = #{distributionFlag,jdbcType=VARCHAR}
where id = #{saleId,jdbcType=VARCHAR}
</update>
<update id="updatePrintCount" >
update t_sale
set
print_count = COALESCE(print_count, 0) + 1
where id = #{saleId,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save