Commit f167aab1 authored by libin's avatar libin

大屏展示实体创建

parent 708f3f51
package com.xxfc.platform.order.bo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description 大屏展示的基础数据
* @data 2019/12/24 16:21
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LargeScreenDisplayConstantDataBo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 公司数量
*/
private int companyNum;
/**
* 营地数量
*/
private int campsiteNum;
/**
* 旅游路线数量
*/
private int tourNum;
/**
* 订单金额基础金额
*/
@JsonIgnore
private BigDecimal baseOrderAmount = BigDecimal.ZERO;
/**
* 订单基础单量
*/
@JsonIgnore
private int baseOrderNum;
}
package com.xxfc.platform.order.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description 订单概况
* @data 2019/12/24 16:33
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "order_profile_display")
public class OrderProfileDisplay {
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
/**
* 区域id
*/
@Column(name = "area_id")
private Integer areaId;
/**
* 区域名称
*/
@Column(name = "area_name")
private String areaName;
/**
* 订单日期
*/
@Column(name = "order_date")
private Date orderDate;
/**
* 订单金额
*/
@Column(name = "order_amount")
private BigDecimal orderAmount;
/**
* 订单量
*/
@Column(name = "order_num")
private Integer orderNum;
/**
* 支付方式 1:微信 2:支付宝
*/
@Column(name = "pay_way")
private Integer payWay;
/**
* 支付终端 1:app 2:ios
*/
@Column(name = "pay_terminal")
private Integer payTerminal;
/**
* 订单类型 1:租车 2:旅游 3:会员
*/
@Column(name = "order_type")
private Integer orderType;
}
package com.xxfc.platform.order.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 16:41
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "user_profile_display")
public class UserProfileDisplay {
@Id
@GeneratedValue(generator = "JDBC")
@JsonIgnore
private Integer id;
/**
* 省份code
*/
@Column(name = "province_code")
private Integer provinceCode;
/**
* 省份名
*/
@Column(name = "province_name")
private String provinceName;
/**
* 用户数
*/
@Column(name = "users_num")
private Integer usersNum;
/**
* 会员数
*/
@Column(name = "members_num")
private Integer membersNum;
}
package com.xxfc.platform.order.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
/**
* @author libin
* @version 1.0
* @description 车型概况
* @data 2019/12/24 16:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "vehicle_profile_display")
public class VehicleProfileDisplay {
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
/**
* 省份code
*/
@Column(name = "province_code")
private Integer provinceCode;
/**
* 省份名
*/
@Column(name = "province_name")
private String provinceName;
/**
* 出行中
*/
@Column(name = "travel_num")
private Integer travelNum;
/**
* 待出行
*/
@Column(name = "to_travel_num")
private Integer toTravelNum;
/**
* 保养中
*/
@Column(name = "maintenance_num")
private Integer maintenanceNum;
/**
* 维修中
*/
@Column(name = "in_maintenance_num")
private Integer inMaintenanceNum;
}
package com.xxfc.platform.order.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description 运营中心订单
* @data 2019/12/24 17:33
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CenterOrderProfileDisplayVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单金额
*/
private BigDecimal orderAmount = BigDecimal.ZERO;
/**
* 区域名称
*/
private String areaName;
/**
* 区域id
*/
private Integer areaId;
}
package com.xxfc.platform.order.pojo.vo;
import com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 9:21
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LargeScreenDisplayDataVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单相关数据
*/
private OrderProfileDispayVo orderProfileDispayData;
/**
* 常量数据
*/
private LargeScreenDisplayConstantDataBo largeScreenDisplayConstantData;
public OrderProfileDispayVo getOrderProfileDispayData() {
return Objects.isNull(orderProfileDispayData)?new OrderProfileDispayVo():orderProfileDispayData;
}
public LargeScreenDisplayConstantDataBo getLargeScreenDisplayConstantData() {
return Objects.isNull(largeScreenDisplayConstantData)?new LargeScreenDisplayConstantDataBo():largeScreenDisplayConstantData;
}
}
package com.xxfc.platform.order.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description 订单支付视图
* @data 2019/12/24 17:39
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderPayProfileDispalyVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 微信支付金额
*/
private BigDecimal wxPayAmount = BigDecimal.ZERO;
/**
* 支付宝支付金额
*/
private BigDecimal aliPayAmount = BigDecimal.ZERO;
/**
* app支付金额
*/
private BigDecimal appPayAmount = BigDecimal.ZERO;
/**
* ios支付金额
*/
private BigDecimal iosPayAmount = BigDecimal.ZERO;
}
package com.xxfc.platform.order.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description 订单概况视图
* @data 2019/12/24 17:41
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderProfileDispayVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 累计订单金额
*/
private BigDecimal orderAmount = BigDecimal.ZERO;
/**
* 累计订单量
*/
private long orderNum;
/**
* 今日订单金额
*/
private BigDecimal todayOrderAmount = BigDecimal.ZERO;
/**
* 今日订单量
*/
private long todayOrderNum;
/**
* 十大运营中心的租车订单统计
*/
private List<CenterOrderProfileDisplayVo> centerOrderProfileDisplays;
/**
* 某个时间段的订单统计
*/
private List<OrderProfileVo> orderProfiles;
/**
* 订单支付方式|终端
*/
private OrderPayProfileDispalyVo orderPayProfileDispal;
public List<CenterOrderProfileDisplayVo> getCenterOrderProfileDisplays() {
return CollectionUtils.isEmpty(centerOrderProfileDisplays) ? Collections.EMPTY_LIST : centerOrderProfileDisplays;
}
public OrderPayProfileDispalyVo getOrderPayProfileDispal() {
return Objects.isNull(orderPayProfileDispal) ? new OrderPayProfileDispalyVo() : orderPayProfileDispal;
}
public List<OrderProfileVo> getOrderProfiles() {
return CollectionUtils.isEmpty(orderProfiles) ? Collections.EMPTY_LIST : orderProfiles;
}
}
package com.xxfc.platform.order.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 9:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderProfileVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单日期
*/
private Date orderDate;
/**
* 订单金额
*/
private BigDecimal orderAmount = BigDecimal.ZERO;
}
package com.xxfc.platform.order.pojo.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 10:17
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderReceivedStatisticsBaseVo {
/**
* 年月日
*/
private Date date;
/**
* 订单总额
*/
private BigDecimal totalAmount;
/**
*租车订单总额
*/
private BigDecimal rentVehicleAmount;
/**
* 订单总量(包含押金,不计免赔)
*/
private Integer totalQuantity;
/**
* 租车订单量
*/
private Integer rentVehicleQuantity;
/**
* 支付方式 '1:微信公众号支付 2.支付宝即时到账,3,银联'
*/
private Integer payWay;
/***
* 分公司id
*/
private Integer companyId;
/**
* 分公司名称
*/
private String companyName;
}
package com.xxfc.platform.order.pojo.vo;
import com.xxfc.platform.order.entity.UserProfileDisplay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 9:43
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserProfileDisplayVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户数
*/
private long usersNum;
/**
* 会员数
*/
private long membersNum;
/**
* 会员占比数
*/
private int membershipRatio;
/**
* 用户统计
*/
private List<UserProfileDisplay> userProfileDisplays;
}
package com.xxfc.platform.order.pojo.vo;
import com.xxfc.platform.order.entity.VehicleProfileDisplay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 9:50
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VehicleProfileDisplayVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 出行中
*/
private long travelNum;
/**
* 待出行
*/
private long toTravelNum;
/**
* 保养中
*/
private long maintenanceNum;
/**
* 维修中
*/
private long inMaintenanceNum;
/**
* 每个省份车辆概况数据
*/
private List<VehicleProfileDisplay> vehicleProfileDisplays;
public List<VehicleProfileDisplay> getVehicleProfileDisplays() {
return CollectionUtils.isEmpty(vehicleProfileDisplays) ? Collections.EMPTY_LIST : vehicleProfileDisplays;
}
}
package com.xxfc.platform.order.biz;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo;
import com.xxfc.platform.order.entity.OrderProfileDisplay;
import com.xxfc.platform.order.mapper.OrderProfileDisplayMapper;
import com.xxfc.platform.order.pojo.vo.LargeScreenDisplayDataVo;
import com.xxfc.platform.order.pojo.vo.OrderProfileDispayVo;
import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsBaseVo;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Transactional(rollbackFor = Exception.class)
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, OrderProfileDisplay> {
/**
* 字典查询type
*/
@Value("large.screen.type:LARGE_SCREEN_DISPLAY")
private String largeScreenType;
/**
* 字典查询code
*/
@Value("large.screen.code:LARGE_SCREEN_DISPLAY_CONSTANT")
private String largeScreenCode;
private final ThirdFeign thirdFeign;
private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz;
private final VehicleFeign vehicleFeign;
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return
*/
public LargeScreenDisplayDataVo findLargeScreenDisplayDataByDate(Date startDate, Date endDate) {
LargeScreenDisplayDataVo largeScreenDisplayDataVo = new LargeScreenDisplayDataVo();
//创建订单常量数据对象
LargeScreenDisplayConstantDataBo largeScreenDisplayConstantDataBo = new LargeScreenDisplayConstantDataBo();
//创建订单数据统计对象
OrderProfileDispayVo orderProfileDispayVo = new OrderProfileDispayVo();
//1.查询基础常量数据
Dictionary largeScreenConstantDictionary = thirdFeign.findDictionaryByTypeAndCode(largeScreenType, largeScreenCode);
if (Objects.nonNull(largeScreenConstantDictionary) && StringUtils.hasText(largeScreenConstantDictionary.getDetail())){
largeScreenDisplayConstantDataBo = JSON.parseObject(largeScreenConstantDictionary.getDetail(), LargeScreenDisplayConstantDataBo.class);
}
//2.1查询订单统计数据
List<OrderReceivedStatisticsBaseVo> orderReceivedStatisticsBaseVos = orderReceivedStatisticsBiz.findOrderReceivedStatisticsByDate(startDate,endDate);
//2.2查询固定编者数据
//3.
largeScreenDisplayDataVo.setLargeScreenDisplayConstantData(largeScreenDisplayConstantDataBo);
largeScreenDisplayDataVo.setOrderProfileDispayData(orderProfileDispayVo);
return largeScreenDisplayDataVo;
}
}
...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.biz; ...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
...@@ -12,6 +14,7 @@ import com.xxfc.platform.order.entity.*; ...@@ -12,6 +14,7 @@ import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.OrderReceivedStatisticsMapper; import com.xxfc.platform.order.mapper.OrderReceivedStatisticsMapper;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO; import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsBaseVo;
import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo; import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -533,4 +536,12 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -533,4 +536,12 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
} }
public List<OrderReceivedStatisticsBaseVo> findOrderReceivedStatisticsByDate(Date startDate, Date endDate) {
List<OrderReceivedStatistics> orderReceivedStatisticsList = mapper.findOrderReceivedStatisticsByDate(startDate,endDate);
if (CollectionUtils.isEmpty(orderReceivedStatisticsList)){
return Collections.emptyList();
}
return JSON.parseObject(JSON.toJSONString(orderReceivedStatisticsList),new TypeReference<List<OrderReceivedStatisticsBaseVo>>(){});
}
} }
\ No newline at end of file
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.UserProfileDisplay;
import com.xxfc.platform.order.mapper.UserProfileDisplayMapper;
import com.xxfc.platform.order.pojo.vo.UserProfileDisplayVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Transactional(rollbackFor = Exception.class)
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserProfileDisplayBiz extends BaseBiz<UserProfileDisplayMapper, UserProfileDisplay> {
public UserProfileDisplayVo findUserProfileData() {
UserProfileDisplayVo userProfileDisplayVo = new UserProfileDisplayVo();
return userProfileDisplayVo;
}
}
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Transactional(rollbackFor = Exception.class)
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class VehicleProfileDisplayBiz extends BaseBiz<VehicleProfileDisplayMapper, VehicleProfileDisplay> {
public VehicleProfileDisplayVo findVehicleProfileDisplayData() {
VehicleProfileDisplayVo vehicleProfileDisplayVo = new VehicleProfileDisplayVo();
//todo
return vehicleProfileDisplayVo;
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderProfileDisplay;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:05
*/
public interface OrderProfileDisplayMapper extends Mapper<OrderProfileDisplay> {
}
...@@ -4,9 +4,11 @@ import com.xxfc.platform.order.bo.CompanyPerformanceBo; ...@@ -4,9 +4,11 @@ import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.order.entity.OrderReceivedStatistics; import com.xxfc.platform.order.entity.OrderReceivedStatistics;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO; import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.additional.insert.InsertListMapper; import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -31,4 +33,7 @@ public interface OrderReceivedStatisticsMapper extends Mapper<OrderReceivedStati ...@@ -31,4 +33,7 @@ public interface OrderReceivedStatisticsMapper extends Mapper<OrderReceivedStati
int selectCountByDate(CompanyPerformanceFindDTO companyPerformanceFindDTO); int selectCountByDate(CompanyPerformanceFindDTO companyPerformanceFindDTO);
int selectCountByMonth(CompanyPerformanceFindDTO companyPerformanceFindDTO); int selectCountByMonth(CompanyPerformanceFindDTO companyPerformanceFindDTO);
int selectCountByWeekOfYear(CompanyPerformanceFindDTO companyPerformanceFindDTO); int selectCountByWeekOfYear(CompanyPerformanceFindDTO companyPerformanceFindDTO);
List<OrderReceivedStatistics> findOrderReceivedStatisticsByDate(@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
} }
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.UserProfileDisplay;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:03
*/
public interface UserProfileDisplayMapper extends Mapper<UserProfileDisplay> {
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.VehicleProfileDisplay;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:05
*/
public interface VehicleProfileDisplayMapper extends Mapper<VehicleProfileDisplay> {
}
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.OrderProfileDisplayBiz;
import com.xxfc.platform.order.biz.UserProfileDisplayBiz;
import com.xxfc.platform.order.biz.VehicleProfileDisplayBiz;
import com.xxfc.platform.order.pojo.vo.LargeScreenDisplayDataVo;
import com.xxfc.platform.order.pojo.vo.UserProfileDisplayVo;
import com.xxfc.platform.order.pojo.vo.VehicleProfileDisplayVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 16:29
*/
@RestController
@RequestMapping("/large_screen_display")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LargeScreenDisplayController {
private final VehicleProfileDisplayBiz vehicleProfileDisplayBiz;
private final UserProfileDisplayBiz userProfileDisplayBiz;
private final OrderProfileDisplayBiz orderProfileDisplayBiz;
/**
* 车辆概况
*
* @return
*/
@GetMapping("/vehicle_profile_display")
public ObjectRestResponse<VehicleProfileDisplayVo> findLargeScreenDisplayData() {
VehicleProfileDisplayVo vehicleProfileDisplayVo = vehicleProfileDisplayBiz.findVehicleProfileDisplayData();
return ObjectRestResponse.succ(vehicleProfileDisplayVo);
}
/**
* 用户概况
*
* @return
*/
@GetMapping("/user_profile_display")
public ObjectRestResponse<UserProfileDisplayVo> findUserProfileData() {
UserProfileDisplayVo userProfileDisplayVo = userProfileDisplayBiz.findUserProfileData();
return ObjectRestResponse.succ(userProfileDisplayVo);
}
/**
* 基础数据 与 订单概况
*
* @param startDate
* @param endDate
* @return
*/
@GetMapping("/order_profile_display")
public ObjectRestResponse<LargeScreenDisplayDataVo> findLargeScreenDisplayData(@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate) {
LargeScreenDisplayDataVo largeScreenDisplayDataVo = orderProfileDisplayBiz.findLargeScreenDisplayDataByDate(startDate, endDate);
return ObjectRestResponse.succ(largeScreenDisplayDataVo);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.OrderProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.OrderProfileDisplay" id="orderProfileDisplayMap">
<result property="id" column="id"/>
<result property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/>
<result property="orderAmount" column="order_amount"/>
<result property="orderDate" column="order_date"/>
<result property="orderNum" column="order_num"/>
<result property="orderType" column="order_num"/>
<result property="payTerminal" column="pay_terminal"/>
<result property="payWay" column="pay_way"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<result property="depositAmount" column="deposit_amount"/> <result property="depositAmount" column="deposit_amount"/>
<result property="depositRefundAmount" column="deposit_refund_amount"/> <result property="depositRefundAmount" column="deposit_refund_amount"/>
<result property="extraAmount" column="extra_amount"/> <result property="extraAmount" column="extra_amount"/>
<result property="lateFeeAmount" column="late_fee_amount" /> <result property="lateFeeAmount" column="late_fee_amount"/>
<result property="lossSpecifiedAmount" column="loss_specified_amount" /> <result property="lossSpecifiedAmount" column="loss_specified_amount"/>
<result property="memberAmount" column="member_amount" /> <result property="memberAmount" column="member_amount"/>
<result property="travelAmount" column="travel_amount"/> <result property="travelAmount" column="travel_amount"/>
<result property="rentVehicleAmount" column="rent_vehicle_amount"/> <result property="rentVehicleAmount" column="rent_vehicle_amount"/>
<result property="noDeductibleAmount" column="no_deductible_amount"/> <result property="noDeductibleAmount" column="no_deductible_amount"/>
...@@ -31,8 +31,10 @@ ...@@ -31,8 +31,10 @@
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
</resultMap> </resultMap>
<select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsDateList"
select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as
`totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -56,12 +58,14 @@ ...@@ -56,12 +58,14 @@
`date` <= #{endDate} `date` <= #{endDate}
]]> ]]>
</if> </if>
group by `year`, `date` group by `year`, `date`
order by null order by null
</select> </select>
<select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsMonthList"
select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as
`totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -85,12 +89,14 @@ ...@@ -85,12 +89,14 @@
`date` <= #{endDate} `date` <= #{endDate}
]]> ]]>
</if> </if>
group by `year`, `month` group by `year`, `month`
order by null order by null
</select> </select>
<select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics"> <select id="selectOrderReceivedStatisticsWeekOfYearList"
select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1 resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`-`order_refund_amount`),0) as
`totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null"> <if test="orderState!=null">
and `has_pay`=#{orderState} and `has_pay`=#{orderState}
</if> </if>
...@@ -114,7 +120,7 @@ ...@@ -114,7 +120,7 @@
`date` <= #{endDate} `date` <= #{endDate}
]]> ]]>
</if> </if>
group by `year`, `week_of_year` group by `year`, `week_of_year`
order by null order by null
</select> </select>
...@@ -175,7 +181,7 @@ ...@@ -175,7 +181,7 @@
IFNULL(SUM( `arrival_num` ),0) AS `arrivalNum`, IFNULL(SUM( `arrival_num` ),0) AS `arrivalNum`,
IFNULL(SUM( `rent_num` ),0) AS `rentDays` IFNULL(SUM( `rent_num` ),0) AS `rentDays`
FROM FROM
`order_vehicle_service_statistics` WHERE 1=1 `order_vehicle_service_statistics` WHERE 1=1
<if test="companyId!=null"> <if test="companyId!=null">
AND `company_id`=#{companyId} AND `company_id`=#{companyId}
</if> </if>
...@@ -222,7 +228,7 @@ ...@@ -222,7 +228,7 @@
SUM(`no_deductible_amount` - `no_deductible_refund_amount`) as `noDeductibleAmount`, SUM(`no_deductible_amount` - `no_deductible_refund_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount` - `deposit_refund_amount`) as `depositAmount` SUM(`deposit_amount` - `deposit_refund_amount`) as `depositAmount`
FROM FROM
`order_received_statistics` WHERE `has_pay`=1 `order_received_statistics` WHERE `has_pay`=1
<if test="companyName!=null and companyName!=''"> <if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%') AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if> </if>
...@@ -455,4 +461,10 @@ ...@@ -455,4 +461,10 @@
`week_of_year` `week_of_year`
) as `ds` ) as `ds`
</select> </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>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.UserProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.UserProfileDisplay" id="userProfileDisplayMap">
<result property="id" column="id"/>
<result property="membersNum" column="travel_num"/>
<result property="provinceCode" column="province_code"/>
<result property="provinceName" column="province_name"/>
<result property="usersNum" column="users_num"/>
</resultMap>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.order.mapper.VehicleProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.VehicleProfileDisplay" id="vehicleProfileDisplayMap">
<result property="id" column="id"/>
<result property="provinceName" column="province_name"/>
<result property="provinceCode" column="province_code"/>
<result property="inMaintenanceNum" column="in_maintenance_num"/>
<result property="maintenanceNum" column="maintenance_num"/>
<result property="toTravelNum" column="to_travel_num"/>
<result property="travelNum" column="travel_num"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*; import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*; 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.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO; import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo; import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
...@@ -212,4 +213,7 @@ public interface VehicleFeign { ...@@ -212,4 +213,7 @@ public interface VehicleFeign {
@GetMapping("/branchCompany/company_info") @GetMapping("/branchCompany/company_info")
Map<Integer, String> findCompanyMap(); Map<Integer, String> findCompanyMap();
@GetMapping("/branchCompany/company_area")
List<BranchCompanyAreaDTO> findBranchCompanyAreas();
} }
package com.xxfc.platform.vehicle.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 11:09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BranchCompanyAreaDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer compnayId;
private String companyName;
private Integer areaId;
private String areaName;
}
...@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper; ...@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO; 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.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
...@@ -446,4 +447,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -446,4 +447,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
} }
return branchCompanies.stream().collect(Collectors.toMap(BranchCompany::getId,BranchCompany::getName)); 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,6 +2,7 @@ package com.xxfc.platform.vehicle.mapper; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.mapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -22,4 +23,7 @@ public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdLi ...@@ -22,4 +23,7 @@ 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") @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<JSONObject> getList();
List<BranchCompanyAreaDTO> findBranchCompanyAreas();
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; ...@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.AreaBiz; import com.xxfc.platform.vehicle.biz.AreaBiz;
import com.xxfc.platform.vehicle.biz.BranchCompanyBiz; import com.xxfc.platform.vehicle.biz.BranchCompanyBiz;
import com.xxfc.platform.vehicle.biz.VehicleBiz; import com.xxfc.platform.vehicle.biz.VehicleBiz;
...@@ -18,26 +19,22 @@ import com.xxfc.platform.vehicle.entity.BranchCompany; ...@@ -18,26 +19,22 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO; import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo; import com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo;
import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO; import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/branchCompany") @RequestMapping("/branchCompany")
...@@ -232,4 +229,8 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -232,4 +229,8 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return baseBiz.selectCompanyMap(); return baseBiz.selectCompanyMap();
} }
@GetMapping("/company_area")
public List<BranchCompanyAreaDTO> findBranchCompanyAreas(){
return baseBiz.findBranchCompanyAreas();
}
} }
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
<select id="findCompanyIdsByAreaId" resultType="integer"> <select id="findCompanyIdsByAreaId" resultType="integer">
select `id` from `branch_company` where `is_del`=0 select `id` from `branch_company` where `is_del`=0
<if test="areaId!=null"> <if test="areaId!=null">
and `zone_id`=#{areaId} and `zone_id`=#{areaId}
</if> </if>
</select> </select>
<select id="findBranchCompanys" resultType="com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO"> <select id="findBranchCompanys" resultType="com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO">
SELECT SELECT
...@@ -84,17 +84,21 @@ ...@@ -84,17 +84,21 @@
bc.latitude bc.latitude
FROM FROM
(SELECT * FROM `branch_company` WHERE `is_del`=0 AND `state`=1 (SELECT * FROM `branch_company` WHERE `is_del`=0 AND `state`=1
<if test="name !=null and name !='' "> <if test="name !=null and name !='' ">
and name like concat('%',#{name},'%') and name like concat('%',#{name},'%')
</if> </if>
) AS `bc` ) AS `bc`
INNER JOIN (SELECT * FROM `company_base` WHERE `is_del`=0 INNER JOIN (SELECT * FROM `company_base` WHERE `is_del`=0
<if test="provinceCode != null"> <if test="provinceCode != null">
AND `addr_province`=#{provinceCode} AND `addr_province`=#{provinceCode}
</if> </if>
<if test="cityCode != null"> <if test="cityCode != null">
AND `addr_city`=#{cityCode} AND `addr_city`=#{cityCode}
</if> </if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id ) 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> </select>
</mapper> </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