| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.approve.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo; |
| | | import com.ruoyi.approve.bean.vo.ApproveProcessVO; |
| | | import com.ruoyi.basic.dto.CustomerPrivatePoolDto; |
| | | import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.uuid.UUID; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | |
| | | import com.ruoyi.sales.pojo.SalesQuotationProduct; |
| | | import com.ruoyi.sales.service.SalesQuotationProductService; |
| | | import com.ruoyi.sales.service.SalesQuotationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @RequiredArgsConstructor |
| | | public class SalesQuotationServiceImpl extends ServiceImpl<SalesQuotationMapper, SalesQuotation> implements SalesQuotationService { |
| | | @Autowired |
| | | private SalesQuotationMapper salesQuotationMapper; |
| | | @Autowired |
| | | private SalesQuotationProductMapper salesQuotationProductMapper; |
| | | @Autowired |
| | | private SalesQuotationProductService salesQuotationProductService; |
| | | private final SalesQuotationProductMapper salesQuotationProductMapper; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final SalesQuotationProductService salesQuotationProductService; |
| | | |
| | | @Autowired |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | private final ApproveProcessServiceImpl approveProcessService; |
| | | private final CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesQuotationDto> listPage(Page page, SalesQuotationDto salesQuotationDto) { |
| | | IPage<SalesQuotationDto> salesQuotationDtoIPage = salesQuotationMapper.listPage(page, salesQuotationDto); |
| | |
| | | public boolean add(SalesQuotationDto salesQuotationDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SalesQuotation salesQuotation = new SalesQuotation(); |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | | String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT"); |
| | | CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(Long.valueOf(salesQuotationDto.getCustomer())); |
| | | if (ObjectUtils.isNotEmpty(customerPrivatePoolDto)) { |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | | salesQuotation.setCustomer(customerPrivatePoolDto.getCustomerName()); |
| | | } |
| | | String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT","quotation_no"); |
| | | salesQuotation.setQuotationNo(quotationNo); |
| | | salesQuotation.setStatus("待审批"); |
| | | salesQuotationMapper.insert(salesQuotation); |
| | |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | }catch (Exception e){ |
| | | log.error("SalesQuotationServiceImpl error:{}", e); |
| | | throw new RuntimeException("审批失败"); |
| | | throw new RuntimeException("审批失败"); |
| | | } |
| | | return true; |
| | | } |