|
@@ -26,6 +26,7 @@ import com.fjhx.sale.entity.documents.po.DocumentsPdf;
|
|
|
import com.fjhx.sale.entity.documents.po.DocumentsProduct;
|
|
|
import com.fjhx.sale.entity.documents.po.DocumentsTransport;
|
|
|
import com.fjhx.sale.entity.documents.vo.DocumentsVo;
|
|
|
+import com.fjhx.sale.entity.pack.po.Pack;
|
|
|
import com.fjhx.sale.entity.pack.po.PackDetail;
|
|
|
import com.fjhx.sale.entity.pack.po.PackDetailGoods;
|
|
|
import com.fjhx.sale.entity.pack.po.PackShipment;
|
|
@@ -36,10 +37,7 @@ import com.fjhx.sale.service.documents.DocumentsPdfService;
|
|
|
import com.fjhx.sale.service.documents.DocumentsProductService;
|
|
|
import com.fjhx.sale.service.documents.DocumentsService;
|
|
|
import com.fjhx.sale.service.documents.DocumentsTransportService;
|
|
|
-import com.fjhx.sale.service.pack.PackDetailGoodsService;
|
|
|
-import com.fjhx.sale.service.pack.PackDetailProductService;
|
|
|
-import com.fjhx.sale.service.pack.PackDetailService;
|
|
|
-import com.fjhx.sale.service.pack.PackShipmentService;
|
|
|
+import com.fjhx.sale.service.pack.*;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
@@ -50,6 +48,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -101,6 +100,8 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
|
|
|
@Autowired
|
|
|
private FlowExampleService flowExampleService;
|
|
|
+ @Autowired
|
|
|
+ private PackService packService;
|
|
|
|
|
|
private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy", Locale.ENGLISH);
|
|
|
|
|
@@ -110,7 +111,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
@Override
|
|
|
public Page<DocumentsVo> getPage(DocumentsSelectDto dto) {
|
|
|
IWrapper<Documents> wrapper = getWrapper();
|
|
|
- wrapper.orderByDesc("d",Documents::getCreateTime);
|
|
|
+ wrapper.orderByDesc("d", Documents::getCreateTime);
|
|
|
if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
//归属公司
|
|
|
List<Long> corporationIds = corporationService.listObject(Corporation::getId, q -> q.like(Corporation::getName, dto.getKeyword()));
|
|
@@ -212,7 +213,8 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
ContractVo contractVo = BeanUtil.toBean(contract, ContractVo.class);
|
|
|
setContractArea(contractVo);
|
|
|
//查询收费项目
|
|
|
- List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().eq(ContractProject::getContractId, contractVo.getId()));
|
|
|
+// List<ContractProject> contractProjectList = contractProjectService.list(Wrappers.<ContractProject>query().lambda().eq(ContractProject::getContractId, contractVo.getId()));
|
|
|
+ List<ContractProject> contractProjectList = new ArrayList<>();
|
|
|
//查询买方
|
|
|
Customer customer = customerService.getById(contractVo.getBuyCorporationId());
|
|
|
//查询卖方
|
|
@@ -253,6 +255,25 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
sumRoughWeight = packDetailList.stream().map(PackDetail::getRoughWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
sumNetWeight = packDetailList.stream().map(PackDetail::getNetWeight).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
sumBomVolume = packDetailList.stream().map(PackDetail::getBomVolume).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
+ //查询收费项目
|
|
|
+ String packDetailId = Arrays.asList(packShipment.getPackDetailIds().split(",")).get(0);
|
|
|
+ PackDetail packDetail = packDetailService.getById(packDetailId);
|
|
|
+ Pack pack = packService.getById(packDetail.getPackId());
|
|
|
+ List<String> contractIds = Arrays.asList(pack.getContractIds().split(","));//获取装箱的所有合同id
|
|
|
+ List<ContractProject> contractProjectLists = contractProjectService.list(Wrappers.<ContractProject>query().lambda().in(ContractProject::getContractId, contractIds));
|
|
|
+ //合并同名收费项目
|
|
|
+ Map<String, ContractProject> contractProjectMap = new ConcurrentHashMap<>();
|
|
|
+ for (ContractProject project : contractProjectLists) {
|
|
|
+ ContractProject contractProject = contractProjectMap.getOrDefault(project.getPayName(), new ContractProject());
|
|
|
+ if (ObjectUtil.isEmpty(contractProject.getAmount())) {
|
|
|
+ contractProject.setAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ contractProject.setAmount(contractProject.getAmount().add(project.getAmount()));
|
|
|
+ contractProject.setPayName(project.getPayName());
|
|
|
+ contractProjectMap.put(project.getPayName(), contractProject);
|
|
|
+ }
|
|
|
+ contractProjectList = contractProjectMap.values().stream().collect(Collectors.toList());
|
|
|
}
|
|
|
map.put("contract", contractVo);//合同信息
|
|
|
map.put("date", sdf.format(contractVo.getCreateTime()));//日期
|
|
@@ -437,6 +458,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
|
|
|
/**
|
|
|
* 获取合同数据
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
@@ -459,12 +481,12 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
|
|
|
contractVo.getSellCityId()
|
|
|
);
|
|
|
Map<Long, String> areaMap = CustomizeAreaUtil.getAreaMapByIds(areaIdList);
|
|
|
- contractVo.setBuyCountryName(areaMap.getOrDefault(contractVo.getBuyCountryId(),contractVo.getBuyCountryName()));
|
|
|
- contractVo.setBuyProvinceName(areaMap.getOrDefault(contractVo.getBuyProvinceId(),contractVo.getBuyProvinceName()));
|
|
|
- contractVo.setBuyCityName(areaMap.getOrDefault(contractVo.getBuyCityId(),contractVo.getBuyCityName()));
|
|
|
- contractVo.setSellCountryName(areaMap.getOrDefault(contractVo.getSellCountryId(),contractVo.getSellCountryName()));
|
|
|
- contractVo.setSellProvinceName(areaMap.getOrDefault(contractVo.getSellProvinceId(),contractVo.getSellProvinceName()));
|
|
|
- contractVo.setSellCityName(areaMap.getOrDefault(contractVo.getSellCityId(),contractVo.getSellCityName()));
|
|
|
+ contractVo.setBuyCountryName(areaMap.getOrDefault(contractVo.getBuyCountryId(), contractVo.getBuyCountryName()));
|
|
|
+ contractVo.setBuyProvinceName(areaMap.getOrDefault(contractVo.getBuyProvinceId(), contractVo.getBuyProvinceName()));
|
|
|
+ contractVo.setBuyCityName(areaMap.getOrDefault(contractVo.getBuyCityId(), contractVo.getBuyCityName()));
|
|
|
+ contractVo.setSellCountryName(areaMap.getOrDefault(contractVo.getSellCountryId(), contractVo.getSellCountryName()));
|
|
|
+ contractVo.setSellProvinceName(areaMap.getOrDefault(contractVo.getSellProvinceId(), contractVo.getSellProvinceName()));
|
|
|
+ contractVo.setSellCityName(areaMap.getOrDefault(contractVo.getSellCityId(), contractVo.getSellCityName()));
|
|
|
}
|
|
|
|
|
|
/**
|