|
@@ -0,0 +1,81 @@
|
|
|
+package com.jpsoft.prices.modules.base.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.prices.modules.base.dto.InvoiceQuotesDTO;
|
|
|
+import com.jpsoft.prices.modules.base.entity.Company;
|
|
|
+import com.jpsoft.prices.modules.base.entity.Invoice;
|
|
|
+import com.jpsoft.prices.modules.base.entity.InvoiceInfo;
|
|
|
+import com.jpsoft.prices.modules.base.service.CompanyService;
|
|
|
+import com.jpsoft.prices.modules.base.service.InvoiceInfoService;
|
|
|
+import com.jpsoft.prices.modules.base.service.InvoiceService;
|
|
|
+import com.jpsoft.prices.modules.common.dto.MessageResult;
|
|
|
+import com.jpsoft.prices.modules.common.dto.Sort;
|
|
|
+import com.jpsoft.prices.modules.common.utils.PojoUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/base/invoiceQuotes")
|
|
|
+@Api(description = "invoiceQuotes")
|
|
|
+public class InvoiceQuotesController {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CompanyService companyService;
|
|
|
+ @Autowired
|
|
|
+ private InvoiceService invoiceService;
|
|
|
+ @Autowired
|
|
|
+ private InvoiceInfoService invoiceInfoService;
|
|
|
+
|
|
|
+ @ApiOperation(value="基于物流公司的报价单比对")
|
|
|
+ @RequestMapping(value = "quotesList",method = RequestMethod.POST)
|
|
|
+ public MessageResult<List> quotesList(String invoiceId){
|
|
|
+ MessageResult<List> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ Invoice invoice = invoiceService.get(invoiceId);
|
|
|
+
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+ if (StringUtils.isNotEmpty(invoice.getDestinationId())) {
|
|
|
+ searchParams.put("destinationId", "%" + invoice.getDestinationId() + "%");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("name_", "asc"));
|
|
|
+
|
|
|
+ List<InvoiceQuotesDTO> list = new ArrayList<>();
|
|
|
+ Page<Company> page = companyService.pageSearch(searchParams, 1, 100, false, sortList);
|
|
|
+ for (Company company : page.getResult()) {
|
|
|
+ List<InvoiceInfo> infoList = invoiceInfoService.findByInvoice(invoiceId);
|
|
|
+
|
|
|
+ InvoiceQuotesDTO dto = new InvoiceQuotesDTO();
|
|
|
+ dto.setCompanyName(company.getName());
|
|
|
+ dto.setNumbers(infoList.size());
|
|
|
+ dto.setTransportFee(new BigDecimal(0));
|
|
|
+ dto.setDeliveryFee(new BigDecimal(0));
|
|
|
+ dto.setStorageFee(new BigDecimal(0));
|
|
|
+ dto.setInsureFee(new BigDecimal(0));
|
|
|
+ dto.setTaxFee(new BigDecimal(0));
|
|
|
+ dto.setTotalFee(new BigDecimal(0));
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(list);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+}
|