|
|
|
@ -5,7 +5,9 @@ import cc.hiver.core.common.constant.SaleConstant; |
|
|
|
import cc.hiver.core.common.utils.SecurityUtil; |
|
|
|
import cc.hiver.core.common.utils.StringUtils; |
|
|
|
import cc.hiver.core.common.utils.ThreadPoolUtil; |
|
|
|
import cc.hiver.core.entity.LogiticsCompany; |
|
|
|
import cc.hiver.core.entity.User; |
|
|
|
import cc.hiver.core.service.LogiticsCompanyService; |
|
|
|
import cc.hiver.mall.common.constant.StockConstant; |
|
|
|
import cc.hiver.mall.config.thread.AiSaleThread; |
|
|
|
import cc.hiver.mall.dao.mapper.SaleMapper; |
|
|
|
@ -19,6 +21,7 @@ import cc.hiver.mall.pojo.vo.*; |
|
|
|
import cc.hiver.mall.saleaimsg.constant.SaleAiMsgConstant; |
|
|
|
import cc.hiver.mall.saleaimsg.entity.SaleAiMsg; |
|
|
|
import cc.hiver.mall.saleaimsg.service.SaleAiMsgService; |
|
|
|
import cc.hiver.mall.service.OrderService; |
|
|
|
import cc.hiver.mall.service.mybatis.*; |
|
|
|
import cc.hiver.mall.utils.AliOcrUtil; |
|
|
|
import cc.hiver.mall.utils.DateUtil; |
|
|
|
@ -83,6 +86,12 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
@Autowired |
|
|
|
private SaleAiMsgService saleAiMsgService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LogiticsCompanyService logiticsCompanyService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OrderService orderService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void editPayPrice(String id, BigDecimal price, String dealingsWay) { |
|
|
|
// 修改采购单、实付、未付金额
|
|
|
|
@ -495,8 +504,8 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
public Page<SaleNoWorkerVO> getSaleByCompanyId(SalePageQuery salePageQuery) { |
|
|
|
final Page<SaleNoWorkerVO> page = new Page<>(salePageQuery.getPageNum(), salePageQuery.getPageSize()); |
|
|
|
//结束时间-1天
|
|
|
|
if(StringUtils.isNotEmpty(salePageQuery.getEndDate())){ |
|
|
|
String endDate = DateUtil.addDay(salePageQuery.getEndDate(), 1); |
|
|
|
if (StringUtils.isNotEmpty(salePageQuery.getEndDate())) { |
|
|
|
final String endDate = DateUtil.addDay(salePageQuery.getEndDate(), 1); |
|
|
|
salePageQuery.setEndDate(endDate); |
|
|
|
} |
|
|
|
final Page<SaleNoWorkerVO> saleNoWorkerVOPage = saleMapper.getSaleByCompanyId(page, salePageQuery); |
|
|
|
@ -509,7 +518,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
saleMapper.companyGetSale(saleId); |
|
|
|
final Sale sale = saleMapper.selectById(saleId); |
|
|
|
// 处理返佣
|
|
|
|
deductLogService.updateRebateAmount("", sale.getTransCompany(), sale.getShopId(), saleId); |
|
|
|
deductLogService.updateRebateAmount("", sale.getTransCompany(), sale.getShopId(), saleId, sale.getTransportType()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -561,7 +570,7 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject buyAi(String aiMsg) { |
|
|
|
JSONObject returnJsonObject = new JSONObject(); |
|
|
|
final JSONObject returnJsonObject = new JSONObject(); |
|
|
|
// 叉转X 文本纠错 使用正则表达式替换单个或多个连续的“叉”字符
|
|
|
|
aiMsg = replaceAllX(aiMsg); |
|
|
|
final List<SaleDetailDTO> saleDetailDTOS = new ArrayList<>(); |
|
|
|
@ -744,8 +753,8 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
} catch (InputRequiredException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
returnJsonObject.put("data",saleDetailDTOS); |
|
|
|
returnJsonObject.put("aiNotRecognition",String.join(";", aiNotRecognitionList)); |
|
|
|
returnJsonObject.put("data", saleDetailDTOS); |
|
|
|
returnJsonObject.put("aiNotRecognition", String.join(";", aiNotRecognitionList)); |
|
|
|
return returnJsonObject; |
|
|
|
} |
|
|
|
|
|
|
|
@ -759,6 +768,35 @@ public class SaleServiceImpl extends ServiceImpl<SaleMapper, Sale> implements Sa |
|
|
|
saleMapper.updateStatus(id, status); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 物流公司转单 |
|
|
|
* |
|
|
|
* @param saleId 订单id |
|
|
|
* @param companyId 物流公司id |
|
|
|
* @return Result |
|
|
|
* @author 王富康 |
|
|
|
* @date 2024/4/27 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void changeCompany(String saleId, String companyId) { |
|
|
|
// 更新sale表trans_company、company_name、company_phone字段
|
|
|
|
final Sale sale = saleMapper.selectById(saleId); |
|
|
|
final String modeOfService = sale.getModeOfService(); |
|
|
|
final LogiticsCompany logiticsCompany = logiticsCompanyService.findById(companyId); |
|
|
|
final String mobile = logiticsCompany.getMobile(); |
|
|
|
final String companyName = logiticsCompany.getCompanyName(); |
|
|
|
sale.setCompanyPhone(mobile); |
|
|
|
sale.setTransCompany(companyId); |
|
|
|
sale.setCompanyName(companyName); |
|
|
|
// 选平台配送:把order表也一并更新trans_company、company_name、transCompanyPhone字段
|
|
|
|
if (SaleConstant.MODE_OF_SERVICE[0].equals(modeOfService)) { |
|
|
|
// 更新订单表
|
|
|
|
orderService.changeCompany(saleId, companyId, mobile, companyName); |
|
|
|
|
|
|
|
} |
|
|
|
saleMapper.updateById(sale); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 使用正则表达式替换输入字符串中连续的“叉”字符为相应数量的“X”字符。 |
|
|
|
* |
|
|
|
|