Commit b1cafa25 authored by libin's avatar libin

大屏订单概况统计与车辆概况统计

parent 78da90c8
package com.xxfc.platform.order.pojo.dto;
import cn.hutool.core.date.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 14:53
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseOrderDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单类型 1:租车 2:旅游 3:会员
*/
private Integer type;
/**
* 实际支付金额
*/
private BigDecimal realAmount;
/**
* 公司id(租车的出发公司)
*/
private Integer companyId;
/**
* 支付方式
*/
private Integer payWay;
/**
* 支付终端
*/
private Integer payOrigin;
/**
* 支付时间
*/
private Long payTime;
/**
* 支付时间转化日期
*/
private Date payDate;
/**
* 区域id
*/
private Integer areaId;
/**
* 订单量
*/
private Integer orderNum;
public Date getPayDate() {
return Objects.isNull(payTime) ? null : DateUtil.beginOfDay(new Date(payTime));
}
public Integer getOrderNum() {
return Objects.isNull(orderNum) ? 1 : orderNum;
}
}
......@@ -34,4 +34,12 @@ public class OrderPayProfileDispalyVo implements Serializable {
* ios支付金额
*/
private BigDecimal iosPayAmount = BigDecimal.ZERO;
/**
* 小程序支付金额
*/
private BigDecimal appletPayAmount = BigDecimal.ZERO;
/**
* 公众号支付金额
*/
private BigDecimal weChatOfficialAccountPayAmount = BigDecimal.ZERO;
}
......@@ -55,11 +55,15 @@ public class OrderProfileDispayVo implements Serializable {
return CollectionUtils.isEmpty(centerOrderProfileDisplays) ? Collections.EMPTY_LIST : centerOrderProfileDisplays;
}
public OrderPayProfileDispalyVo getOrderPayProfileDispal() {
public OrderPayProfileDispalyVo getOrderPayProfileDisplay() {
return Objects.isNull(orderPayProfileDisplay) ? new OrderPayProfileDispalyVo() : orderPayProfileDisplay;
}
public List<OrderProfileVo> getOrderProfiles() {
return CollectionUtils.isEmpty(orderProfiles) ? Collections.EMPTY_LIST : orderProfiles;
}
public BigDecimal getOrderAmount() {
return CollectionUtils.isEmpty(orderProfiles)?BigDecimal.ZERO:orderProfiles.stream().map(OrderProfileVo::getOrderAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
}
}
......@@ -32,6 +32,7 @@ import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.dto.BaseOrderDTO;
import com.xxfc.platform.order.pojo.dto.MemberOrderBo;
import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
......@@ -912,7 +913,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return userFeign;
}
/**
/**
* 订单查询类
*/
@Data
......@@ -966,5 +969,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return PageInfo.of(achievements);
}
public List<BaseOrderDTO> findOrdersByDate(Date startDate, Date endDate) {
List<BaseOrderDTO> baseOrderDTOS = mapper.findOrdersByDate(startDate,endDate);
return CollectionUtils.isEmpty(baseOrderDTOS)?Collections.emptyList():baseOrderDTOS;
}
}
\ No newline at end of file
......@@ -5,10 +5,13 @@ import com.xxfc.platform.order.entity.VehicleProfileDisplay;
import com.xxfc.platform.order.mapper.VehicleProfileDisplayMapper;
import com.xxfc.platform.order.pojo.vo.VehicleProfileDisplayVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author libin
* @version 1.0
......@@ -22,7 +25,25 @@ public class VehicleProfileDisplayBiz extends BaseBiz<VehicleProfileDisplayMappe
public VehicleProfileDisplayVo findVehicleProfileDisplayData() {
VehicleProfileDisplayVo vehicleProfileDisplayVo = new VehicleProfileDisplayVo();
//todo
//1.查询全部固定数据
List<VehicleProfileDisplay> vehicleProfileDisplays = mapper.selectAll();
if (CollectionUtils.isEmpty(vehicleProfileDisplays)) {
return vehicleProfileDisplayVo;
}
long travelNum = 0;
long toTravelNum = 0;
long maintenanceNum = 0;
long inMaintenanceNum = 0;
for (VehicleProfileDisplay vehicleProfileDisplay : vehicleProfileDisplays) {
travelNum = +vehicleProfileDisplay.getTravelNum();
toTravelNum = +vehicleProfileDisplay.getToTravelNum();
maintenanceNum = +vehicleProfileDisplay.getMaintenanceNum();
inMaintenanceNum = +vehicleProfileDisplay.getInMaintenanceNum();
}
vehicleProfileDisplayVo.setTravelNum(travelNum);
vehicleProfileDisplayVo.setToTravelNum(toTravelNum);
vehicleProfileDisplayVo.setMaintenanceNum(maintenanceNum);
vehicleProfileDisplayVo.setInMaintenanceNum(inMaintenanceNum);
return vehicleProfileDisplayVo;
}
}
......@@ -4,6 +4,7 @@ import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.pojo.Achievement;
import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.bg.BgOrderListVo;
import com.xxfc.platform.order.pojo.dto.BaseOrderDTO;
import com.xxfc.platform.order.pojo.dto.MemberOrderBo;
import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
......@@ -51,4 +52,6 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
List<OrderDTO> selectBaeOrderByOrderIds(@Param("orderIds") List<Integer> orderIds);
List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria);
List<BaseOrderDTO> findOrdersByDate(@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderProfileDisplay;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
/**
* @author libin
* @version 1.0
......@@ -9,4 +14,6 @@ import tk.mybatis.mapper.common.Mapper;
* @data 2019/12/24 17:05
*/
public interface OrderProfileDisplayMapper extends Mapper<OrderProfileDisplay> {
List<OrderProfileDisplay> findOrderProfileDisplayDatabyDate(@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}
......@@ -494,4 +494,8 @@
order by crt_time DESC
</select>
<select id="findOrdersByDate" resultType="com.xxfc.platform.order.pojo.dto.BaseOrderDTO">
</select>
</mapper>
\ No newline at end of file
......@@ -15,4 +15,8 @@
<result property="payTerminal" column="pay_terminal"/>
<result property="payWay" column="pay_way"/>
</resultMap>
<select id="findOrderProfileDisplayDatabyDate" resultMap="orderProfileDisplayMap">
select * from `order_profile_display` where `order_date` between #{startDate} and #{endDate}
</select>
</mapper>
\ No newline at end of file
......@@ -463,8 +463,24 @@
</select>
<select id="findOrderReceivedStatisticsByDate" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `date`,(`total_amount`+`deposit_amount`+`no_deductible_amount`) as `totalAmount`,`total_quantity` as `totalQuantity`,(`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`) as `rentVehicleAmount`,`rent_vehicle_quantity` as `rentVehicleQuantity`,
`company_id` as `companyId`,`pay_way` as `payWay`,`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1
and `date` between #{startDate} and #{endDate}
select
`company_id` as `companyId`,`date`,
sum((`total_amount`+`deposit_amount`+`no_deductible_amount`)) as `totalAmount`,
sum(`total_quantity`) as `totalQuantity`,
sum((`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`)) as `rentVehicleAmount`,
sum(`rent_vehicle_quantity`) as `rentVehicleQuantity`,
`pay_way` as `payWay`,
`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1 and `pay_way`=1
and `date` between #{startDate} and #{endDate} group by `company_id`,`date`
union all
select
`company_id` as `companyId`,`date`,
sum((`total_amount`+`deposit_amount`+`no_deductible_amount`)) as `totalAmount`,
sum(`total_quantity`) as `totalQuantity`,
sum((`rent_vehicle_amount`+`deposit_amount`+`no_deductible_amount`)) as `rentVehicleAmount`,
sum(`rent_vehicle_quantity`) as `rentVehicleQuantity`,
`pay_way` as `payWay`,
`company_name` as `companyName` from `order_received_statistics` where `has_pay`=1 and `pay_way`=2
and `date` between #{startDate} and #{endDate} group by `company_id`,`date`
</select>
</mapper>
\ No newline at end of file
......@@ -6,7 +6,6 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
......@@ -214,6 +213,6 @@ public interface VehicleFeign {
@GetMapping("/branchCompany/company_info")
Map<Integer, String> findCompanyMap();
@GetMapping("/branchCompany/company_area")
List<BranchCompanyAreaDTO> findBranchCompanyAreas();
@GetMapping("/area/areas")
List<Area> findAllAreas();
}
......@@ -8,10 +8,12 @@ import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.mapper.AreaMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
......@@ -24,25 +26,27 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
UserFeign userFeign;
@Override
public UserFeign getUserFeign() {return userFeign;}
public UserFeign getUserFeign() {
return userFeign;
}
public RestResponse<List<Area>> findAll() {
UserDTO userDTO = getAdminUserInfo();
if(userDTO == null) {
if (userDTO == null) {
return RestResponse.suc();
}
String ids = null;
if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
if(StringUtils.isNotBlank(userDTO.getDataZone())) {
if (DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
if (StringUtils.isNotBlank(userDTO.getDataZone())) {
ids = userDTO.getDataZone();
} else {
ids = userDTO.getZoneId() + "";
}
if(ids.contains(",")) {
if (ids.contains(",")) {
String[] array = ids.split(",");
List<Integer> list = Lists.newArrayList();
for(int i = 0; i < array.length; i++) {
if(StringUtils.isNotBlank(array[i])) {
for (int i = 0; i < array.length; i++) {
if (StringUtils.isNotBlank(array[i])) {
list.add(Integer.parseInt(array[i]));
}
}
......@@ -50,7 +54,7 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
} else {
Area area = mapper.selectByPrimaryKey(ids);
if (Objects.isNull(area)){
if (Objects.isNull(area)) {
return null;
}
List<Area> areas = Lists.newArrayList();
......@@ -64,5 +68,8 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
}
public List<Area> findAllAreas() {
List<Area> areas = mapper.selectAll();
return CollectionUtils.isEmpty(areas) ? Collections.emptyList() : areas;
}
}
......@@ -24,7 +24,6 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
......@@ -33,7 +32,6 @@ import com.xxfc.platform.vehicle.util.excel.ExcelImport;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
......@@ -448,8 +446,4 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return branchCompanies.stream().collect(Collectors.toMap(BranchCompany::getId,BranchCompany::getName));
}
public List<BranchCompanyAreaDTO> findBranchCompanyAreas() {
List<BranchCompanyAreaDTO> branchCompanyAreaDTOS = mapper.findBranchCompanyAreas();
return CollectionUtils.isEmpty(branchCompanyAreaDTOS)?Collections.emptyList():branchCompanyAreaDTOS;
}
}
......@@ -2,7 +2,6 @@ package com.xxfc.platform.vehicle.mapper;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -24,6 +23,5 @@ public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdLi
@Select("SELECT `code`,count(id) cd FROM `vehicle` WHERE is_del=0 and number_plate LIKE '%测试%' GROUP BY code HAVING cd>=2")
List<JSONObject> getList();
List<BranchCompanyAreaDTO> findBranchCompanyAreas();
}
\ No newline at end of file
......@@ -30,4 +30,9 @@ public class AreaController extends BaseController<AreaBiz, Area> {
}
@GetMapping("/areas")
public List<Area> findAllAreas(){
return baseBiz.findAllAreas();
}
}
......@@ -19,7 +19,6 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
......@@ -229,8 +228,4 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return baseBiz.selectCompanyMap();
}
@GetMapping("/company_area")
public List<BranchCompanyAreaDTO> findBranchCompanyAreas(){
return baseBiz.findBranchCompanyAreas();
}
}
......@@ -97,8 +97,4 @@
</if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select>
<select id="findBranchCompanyAreas" resultType="com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO">
select `id` as `compnayId`,`name` as `companyName`,`zone_id` as `areaId`,`area`.name as `areaName` from `branch_company` as `bc` inner join `area` on bc.zone_id=area.id
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment