|
@@ -1671,19 +1671,42 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String, Object> getHeadCustomerStatistics() {
|
|
|
+ public Map<String, Object> getHeadCustomerStatistics(ContractSelectDto dto) {
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("sumAmount",BigDecimal.ZERO);
|
|
|
map.put("sumArrivalAmount",BigDecimal.ZERO);
|
|
|
map.put("sumQuantity",BigDecimal.ZERO);
|
|
|
map.put("list",new ArrayList<>());
|
|
|
+
|
|
|
List<Long> authIdList = customerService.getAuthIdList();
|
|
|
- List<ContractVo> list;
|
|
|
- if(CollectionUtils.isNotEmpty(authIdList)){
|
|
|
- list = baseMapper.getCustomerMoney(authIdList);
|
|
|
- }else{
|
|
|
- list = baseMapper.getCustomerMoney(null);
|
|
|
+ if (authIdList.size() == 0) {
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ IWrapper<Contract> wrapper = getWrapper();
|
|
|
+ wrapper.in("t1", Contract::getBuyCorporationId, authIdList);
|
|
|
+ wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
|
|
|
+ wrapper.ne("t1",Contract::getIsShow,1);
|
|
|
+ wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
+ if (StringUtils.isNotEmpty(dto.getStatus())) {
|
|
|
+ wrapper.eq("t1", Contract::getStatus, dto.getStatus());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(dto.getSellCorporationId())) {
|
|
|
+ wrapper.eq("t1", Contract::getSellCorporationId, dto.getSellCorporationId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(dto.getRefundStatusNew())) {
|
|
|
+ wrapper.in("t1.refundStatusNew", Arrays.asList(dto.getRefundStatusNew().split(",")));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
+ wrapper.keyword(dto.getKeyword(), new SqlField("t1", Contract::getCode));
|
|
|
}
|
|
|
+ //根据客户id关联
|
|
|
+ wrapper.eq(ContractVo::getBuyCorporationId, dto.getCustomerId());
|
|
|
+ //过滤合同类型
|
|
|
+ wrapper.eq("t1.contract_type", dto.getContractType());
|
|
|
+ wrapper.groupBy("t1.sell_corporation_id");
|
|
|
+ List<ContractVo> list;
|
|
|
+ list = baseMapper.getCustomerMoney(wrapper);
|
|
|
+
|
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
|
BigDecimal sumAmount = list.stream().map(ContractVo::getSumAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
|
|
|
BigDecimal sumQuantity = list.stream().map(ContractVo::getSumQuantity).reduce(BigDecimal.ZERO,BigDecimal::add);
|