|
@@ -323,7 +323,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
wrapper.eq("t1", Contract::getSellCorporationId, dto.getSellCorporationId());
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(dto.getRefundStatusNew())) {
|
|
|
- wrapper.in("t1.refund_status", Arrays.asList(dto.getRefundStatusNew().split(",")));
|
|
|
+ wrapper.in("t1.refundStatusNew", Arrays.asList(dto.getRefundStatusNew().split(",")));
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(dto.getUserId())) {
|
|
|
wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
|
|
@@ -849,22 +849,26 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Object> salesStatistics(ContractDto dto) {
|
|
|
+ List<Long> authIdList = customerService.getAuthIdList();
|
|
|
+ if(CollectionUtils.isEmpty(authIdList)){
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+
|
|
|
//添加查询条件
|
|
|
QueryWrapper<Contract> query = Wrappers.<Contract>query();
|
|
|
- selectTime(query, dto);
|
|
|
- query.select("sum(amount) amount");
|
|
|
-
|
|
|
+ selectTime(query, dto,authIdList);
|
|
|
+ query.select("sum(amount*rate) amount");
|
|
|
//查询销售额
|
|
|
Contract contract = baseMapper.selectOne(query);
|
|
|
query.clear();
|
|
|
//查询订单数
|
|
|
- selectTime(query, dto);
|
|
|
+ selectTime(query, dto,authIdList);
|
|
|
|
|
|
Long count = baseMapper.selectCount(query);
|
|
|
|
|
|
//查询下单的客户人数
|
|
|
query.clear();
|
|
|
- selectTime(query, dto);
|
|
|
+ selectTime(query, dto,authIdList);
|
|
|
query.select("count(DISTINCT(buy_corporation_id)) count");
|
|
|
Contract contract1 = baseMapper.selectOne(query);
|
|
|
|
|
@@ -877,7 +881,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
//赋值
|
|
|
if (ObjectUtil.isNotEmpty(contract)) {
|
|
|
- map.put("amount", contract.getAmount());
|
|
|
+ map.put("amount", contract.getAmount().setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(contract1)) {
|
|
@@ -1461,7 +1465,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
}
|
|
|
|
|
|
// 添加时间的查询条件
|
|
|
- private void selectTime(QueryWrapper<Contract> query, ContractDto dto) {
|
|
|
+ private void selectTime(QueryWrapper<Contract> query, ContractDto dto,List<Long> authIdList) {
|
|
|
+ query.in("buy_corporation_id", authIdList);
|
|
|
+ query.eq("is_change", "0");//列表只展示未变更得数据
|
|
|
+ query.ne("is_show", 1);
|
|
|
+ query.between("status", FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
query.ge("DATE_FORMAT(create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
query.le("DATE_FORMAT(create_time,'%Y-%m')", dto.getEndTime());
|
|
|
}
|