|
|
|
@ -17,14 +17,22 @@
|
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import com.logpm.distribution.entity.DistributionServiceLogEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockArticleService; |
|
|
|
|
import com.logpm.distribution.vo.DistributionServiceLogVO; |
|
|
|
|
import com.logpm.distribution.excel.DistributionServiceLogExcel; |
|
|
|
|
import com.logpm.distribution.mapper.DistributionServiceLogMapper; |
|
|
|
|
import com.logpm.distribution.service.IDistributionServiceLogService; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -34,8 +42,12 @@ import java.util.List;
|
|
|
|
|
* @since 2023-06-14 |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class DistributionServiceLogServiceImpl extends BaseServiceImpl<DistributionServiceLogMapper, DistributionServiceLogEntity> implements IDistributionServiceLogService { |
|
|
|
|
|
|
|
|
|
private final IDistributionStockArticleService distributionStockArticleService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionServiceLogVO> selectDistributionServiceLogPage(IPage<DistributionServiceLogVO> page, DistributionServiceLogVO distributionServiceLog) { |
|
|
|
|
return page.setRecords(baseMapper.selectDistributionServiceLogPage(page, distributionServiceLog)); |
|
|
|
@ -51,4 +63,27 @@ public class DistributionServiceLogServiceImpl extends BaseServiceImpl<Distribut
|
|
|
|
|
return distributionServiceLogList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Boolean OwnSaveOrUpdate(DistributionServiceLogEntity distributionServiceLog) { |
|
|
|
|
String[] split = distributionServiceLog.getStockArticleId().split(","); |
|
|
|
|
List<DistributionServiceLogEntity> list = new ArrayList<>(); |
|
|
|
|
List<DistributionStockArticleEntity> entityList = new ArrayList<>(); |
|
|
|
|
for (String s : split) { |
|
|
|
|
DistributionServiceLogEntity distributionServiceLogEntity = new DistributionServiceLogEntity(); |
|
|
|
|
BeanUtils.copyProperties(distributionServiceLog,distributionServiceLogEntity); |
|
|
|
|
distributionServiceLogEntity.setStockArticleId(s); |
|
|
|
|
list.add(distributionServiceLogEntity); |
|
|
|
|
DistributionStockArticleEntity distributionStockArticle = new DistributionStockArticleEntity(); |
|
|
|
|
distributionStockArticle.setId(Long.parseLong(s)); |
|
|
|
|
distributionStockArticle.setTypeService(distributionServiceLog.getTypeService()); |
|
|
|
|
distributionStockArticle.setRate(distributionServiceLog.getCost()); |
|
|
|
|
entityList.add(distributionStockArticle); |
|
|
|
|
} |
|
|
|
|
//添加记录
|
|
|
|
|
this.saveBatch(list); |
|
|
|
|
//修改订单服务状态
|
|
|
|
|
return distributionStockArticleService.saveOrUpdateBatch(entityList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|