|
@@ -459,11 +459,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
//客户名称
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerName())) {
|
|
|
- wrapper.like("cu.name", dto.getCustomerName());
|
|
|
+ wrapper.like("t1.name", dto.getCustomerName());
|
|
|
}
|
|
|
//业务员
|
|
|
if (StringUtils.isNotEmpty(dto.getUserName())) {
|
|
|
- wrapper.like("us1.nick_name", dto.getUserName());
|
|
|
+ wrapper.like("t1.nick_name", dto.getUserName());
|
|
|
}
|
|
|
//销售合同编号
|
|
|
if (StringUtils.isNotEmpty(dto.getContractCode())) {
|
|
@@ -478,6 +478,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
//是否结清过滤
|
|
|
wrapper.eq("t1", Contract::getIsSettled, dto.getIsSettled());
|
|
|
+
|
|
|
+ //是否亏损过滤
|
|
|
+ Integer isLoss = dto.getIsLoss();
|
|
|
+ if (ObjectUtil.isNotEmpty(isLoss)) {
|
|
|
+ if (Objects.equals(isLoss, 1)) {
|
|
|
+ wrapper.apply("(t1.amount*t1.rate)<t1.sumPurchaseContractMoney");
|
|
|
+ } else {
|
|
|
+ wrapper.apply("(t1.amount*t1.rate)>=t1.sumPurchaseContractMoney");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return wrapper;
|
|
|
}
|
|
|
|
|
@@ -504,6 +515,21 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
//计数历史毛利率图
|
|
|
setGrossProfitInfoList(list);
|
|
|
|
|
|
+ //添加采购列表
|
|
|
+ List<Long> ids = list.stream().map(ContractBudgetVo::getContractId).collect(Collectors.toList());
|
|
|
+ Map<Long, List<EhsdPurchase>> map = ehsdPurchaseService.mapKGroup(EhsdPurchase::getDataResourceId,
|
|
|
+ q -> q.in(EhsdPurchase::getDataResourceId, ids).in(EhsdPurchase::getStatus, 12, 30, 60));
|
|
|
+ list.forEach(item -> item.setPurchasesList(map.get(item.getContractId())));
|
|
|
+
|
|
|
+ for (ContractBudgetVo contractBudgetVo : list) {
|
|
|
+ //赋值采购列表
|
|
|
+ contractBudgetVo.setPurchasesList(map.get(contractBudgetVo.getContractId()));
|
|
|
+// //赋值是否亏损
|
|
|
+// BigDecimal ehsdSumAmount = contractBudgetVo.getEhsdSumAmount();
|
|
|
+// ehsdSumAmount = ObjectUtil.isEmpty(ehsdSumAmount)?BigDecimal.ZERO:ehsdSumAmount;
|
|
|
+// contractBudgetVo.setIsLoss(contractBudgetVo.getRmbContractAmount().compareTo(ehsdSumAmount)<0?1:0);
|
|
|
+ }
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -531,6 +557,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
if (ObjectUtil.isNotEmpty(contract)) {
|
|
|
oldContractId = contract.getOldContractId();
|
|
|
arr.add(contract);
|
|
|
+ } else {
|
|
|
+ oldContractId = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -867,11 +895,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
//客户名称
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerName())) {
|
|
|
- wrapper.like("cu.name", dto.getCustomerName());
|
|
|
+ wrapper.like("t1.name", dto.getCustomerName());
|
|
|
}
|
|
|
//业务员
|
|
|
if (StringUtils.isNotEmpty(dto.getUserName())) {
|
|
|
- wrapper.like("us1.nick_name", dto.getUserName());
|
|
|
+ wrapper.like("t1.nick_name", dto.getUserName());
|
|
|
}
|
|
|
//销售合同编号
|
|
|
if (StringUtils.isNotEmpty(dto.getContractCode())) {
|
|
@@ -887,6 +915,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
//是否结清过滤
|
|
|
wrapper.eq("t1", Contract::getIsSettled, dto.getIsSettled());
|
|
|
|
|
|
+ //是否亏损过滤
|
|
|
+ Integer isLoss = dto.getIsLoss();
|
|
|
+ if (ObjectUtil.isNotEmpty(isLoss)) {
|
|
|
+ if (Objects.equals(isLoss, 1)) {
|
|
|
+ wrapper.apply("(t1.amount*t1.rate)<t1.sumPurchaseContractMoney");
|
|
|
+ } else {
|
|
|
+ wrapper.apply("(t1.amount*t1.rate)>=t1.sumPurchaseContractMoney");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Page<ContractBudgetVo> page = this.baseMapper.getProfitClearingPage(dto.getPage(), wrapper);
|
|
|
List<ContractBudgetVo> list = page.getRecords();
|
|
|
if (ObjectUtil.isEmpty(list)) {
|
|
@@ -965,6 +1003,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
}
|
|
|
v.setGrossRate(grossRate);
|
|
|
}
|
|
|
+
|
|
|
+ //赋值采购列表
|
|
|
+ v.setPurchasesList(purchaseMap.get(v.getContractId()));
|
|
|
}
|
|
|
return page;
|
|
|
}
|