|
@@ -454,7 +454,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
|
|
|
wrapper.ne("t1", Contract::getIsShow, 1);
|
|
|
- wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
+ wrapper.in("t1.status", 10, 30, 60);
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
@@ -462,12 +462,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
wrapper.eq("t1", Contract::getCreateUser, dto.getUserId());
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
- wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"));
|
|
|
+ wrapper.keyword(dto.getKeyword(), new SqlField("t1.code"), new SqlField("t1.customerName"));
|
|
|
}
|
|
|
|
|
|
//客户名称
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerName())) {
|
|
|
- wrapper.like("t1.name", dto.getCustomerName());
|
|
|
+ wrapper.like("t1.customerName", dto.getCustomerName());
|
|
|
}
|
|
|
//业务员
|
|
|
if (StringUtils.isNotEmpty(dto.getUserName())) {
|
|
@@ -989,7 +989,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
wrapper.orderByDesc("t1", Contract::getCreateTime);
|
|
|
wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
|
|
|
wrapper.ne("t1", Contract::getIsShow, 1);
|
|
|
- wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
|
|
|
+ wrapper.in("t1.status", 10, 30, 60);
|
|
|
if (StringUtils.isNotEmpty(dto.getCustomerId())) {
|
|
|
wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
|
|
|
}
|
|
@@ -1378,40 +1378,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
*/
|
|
|
@Override
|
|
|
public Map<String, Object> salesStatistics(ContractDto dto) {
|
|
|
- //添加查询条件
|
|
|
- QueryWrapper<Contract> query = Wrappers.<Contract>query();
|
|
|
- selectTime(query, dto);
|
|
|
- query.select("sum(amount) amount");
|
|
|
-
|
|
|
- //查询销售额
|
|
|
- Contract contract = baseMapper.selectOne(query);
|
|
|
- query.clear();
|
|
|
- //查询订单数
|
|
|
- selectTime(query, dto);
|
|
|
-
|
|
|
- Long count = baseMapper.selectCount(query);
|
|
|
-
|
|
|
- //查询下单的客户人数
|
|
|
- query.clear();
|
|
|
- selectTime(query, dto);
|
|
|
- query.select("count(DISTINCT(buy_corporation_id)) count");
|
|
|
- Contract contract1 = baseMapper.selectOne(query);
|
|
|
-
|
|
|
+ QueryWrapper<Contract> query = Wrappers.query();
|
|
|
+ query.ge("c.create_time", dto.getBeginTime());
|
|
|
+ query.le("c.create_time", dto.getEndTime());
|
|
|
+ query.in("c.status", 10, 30, 60);
|
|
|
+ ContractVo contractVo = baseMapper.salesAnalysis(query);
|
|
|
//存放销售统计数据
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
//初始化数据
|
|
|
- map.put("amount", new BigDecimal(0));
|
|
|
- map.put("contractCount", count);
|
|
|
- map.put("customerCount", new BigDecimal(0));
|
|
|
-
|
|
|
- //赋值
|
|
|
- if (ObjectUtil.isNotEmpty(contract)) {
|
|
|
- map.put("amount", contract.getAmount());
|
|
|
- }
|
|
|
-
|
|
|
- if (ObjectUtil.isNotEmpty(contract1)) {
|
|
|
- map.put("customerCount", contract1.getCount());
|
|
|
- }
|
|
|
+ map.put("amount", contractVo.getAmountCNY());
|
|
|
+ map.put("contractCount", contractVo.getContractCount());
|
|
|
+ map.put("customerCount", contractVo.getCustomerCount());
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -1421,10 +1398,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public List<ContractDto> countrySalesStatistics(ContractDto dto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ query.ge("cc.create_time", dto.getBeginTime());
|
|
|
+ query.le("cc.create_time", dto.getEndTime());
|
|
|
+ query.in("cc.status", 10, 30, 60);
|
|
|
query.groupBy("cc.buy_country_id");
|
|
|
- query.orderByDesc("amount");
|
|
|
+ query.orderByDesc("amount * rate");
|
|
|
//查询销售国家统计信息
|
|
|
List<ContractDto> contractDtoList = baseMapper.countrySalesStatistics(query);
|
|
|
return contractDtoList;
|
|
@@ -1436,10 +1414,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public List<ContractDto> customSalesStatistics(ContractDto dto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ query.ge("cc.create_time", dto.getBeginTime());
|
|
|
+ query.le("cc.create_time", dto.getEndTime());
|
|
|
+ query.in("cc.status", 10, 30, 60);
|
|
|
query.groupBy("cc.buy_corporation_id");
|
|
|
- query.orderByDesc("amount");
|
|
|
+ query.orderByDesc("amount * rate");
|
|
|
//查询销售国家统计信息
|
|
|
List<ContractDto> contractDtoList = baseMapper.customSalesStatistics(query);
|
|
|
return contractDtoList;
|
|
@@ -1451,10 +1430,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public List<ContractDto> salesmanSalesStatistics(ContractDto dto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(cc.create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ query.ge("cc.create_time", dto.getBeginTime());
|
|
|
+ query.le("cc.create_time", dto.getEndTime());
|
|
|
+ query.in("cc.status", 10, 30, 60);
|
|
|
query.groupBy("cc.create_user");
|
|
|
- query.orderByDesc("amount");
|
|
|
+ query.orderByDesc("amount * rate");
|
|
|
//查询销售国家统计信息
|
|
|
List<ContractDto> contractDtoList = baseMapper.salesmanSalesStatistics(query);
|
|
|
return contractDtoList;
|
|
@@ -1466,8 +1446,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public List<ContractDto> productSalesStatistics(ContractDto dto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(cp.create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(cp.create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ query.ge("c.create_time", dto.getBeginTime());
|
|
|
+ query.le("c.create_time", dto.getEndTime());
|
|
|
+ query.in("c.status", 10, 30, 60);
|
|
|
query.groupBy("cp.product_id");
|
|
|
query.orderByDesc("amount");
|
|
|
//查询销售国家统计信息
|
|
@@ -1481,8 +1462,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public List<ContractDto> salesVolumeStatistics(ContractDto dto) {
|
|
|
QueryWrapper<Object> query = Wrappers.query();
|
|
|
- query.ge("DATE_FORMAT(cp.create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(cp.create_time,'%Y-%m')", dto.getEndTime());
|
|
|
+ query.ge("c.create_time", dto.getBeginTime());
|
|
|
+ query.le("c.create_time", dto.getEndTime());
|
|
|
+ query.in("c.status", 10, 30, 60);
|
|
|
query.groupBy("cp.product_id");
|
|
|
query.orderByDesc("quantity");
|
|
|
//查询销售商品统计信息
|
|
@@ -2057,12 +2039,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
contractPdfInfoVo.setBeneficiaryAddress(contract.getBeneficiaryAddress());
|
|
|
}
|
|
|
|
|
|
- // 添加时间的查询条件
|
|
|
- private void selectTime(QueryWrapper<Contract> query, ContractDto dto) {
|
|
|
- query.ge("DATE_FORMAT(create_time,'%Y-%m')", dto.getBeginTime());
|
|
|
- query.le("DATE_FORMAT(create_time,'%Y-%m')", dto.getEndTime());
|
|
|
- }
|
|
|
-
|
|
|
private void setAreaId(ContractDto contractDto) {
|
|
|
|
|
|
SetCustomizeAreaId setCustomizeAreaId1 = new SetCustomizeAreaId() {
|