Commit b2117733 authored by libin's avatar libin

Merge branch 'large_screen_display_feature' into dev

# Conflicts:
#	xx-order/xx-order-server/src/main/resources/mapper/BaseOrderMapper.xml
#	xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
parents 07fe56e6 c5544e9e
package com.github.wxiaoqi.security.admin.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;
@Transient
@JsonIgnore
private long memberNums;
}
package com.github.wxiaoqi.security.admin.vo;
import com.github.wxiaoqi.security.admin.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 String membershipRatio;
/**
* 用户统计
*/
private List<UserProfileDisplay> userProfileDisplays;
}
...@@ -13,7 +13,6 @@ import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo; ...@@ -13,7 +13,6 @@ import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo; import com.github.wxiaoqi.security.admin.vo.AppUserVo;
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.xxfc.platform.im.utils.BeanUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -229,4 +228,12 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -229,4 +228,12 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
} }
return null; return null;
} }
public List<AppUserDetail> findAllUsers() {
Example example = new Example(AppUserDetail.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isdel",0);
List<AppUserDetail> userDetails = mapper.selectByExample(example);
return CollectionUtils.isEmpty(userDetails)?Collections.emptyList():userDetails;
}
} }
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.UserProfileDisplay;
import com.github.wxiaoqi.security.admin.mapper.UserProfileDisplayMapper;
import com.github.wxiaoqi.security.admin.vo.UserProfileDisplayVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
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.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @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> {
/**
* 字典查询type
*/
@Value("${large.screen.type:LARGE_SCREEN_DISPLAY}")
private String largeScreenType;
/**
* 字典查询code
*/
@Value("${large.screen.member.code:LARGE_SCREEN_DISPLAY_EMEMBER_CONSTANT}")
private String largeScreenCode;
private final AppUserDetailBiz appUserDetailBiz;
private final ThirdFeign thirdFeign;
private static final Integer GUANG_DONG_CODE = 440000;
public UserProfileDisplayVo findUserProfileData() {
UserProfileDisplayVo userProfileDisplayVo = new UserProfileDisplayVo();
//1.查询固定数据
List<UserProfileDisplay> userProfileDisplays = mapper.selectAll();
//2.查询真实数据
List<AppUserDetail> appUserDetails = appUserDetailBiz.findAllUsers();
//3.包装数据
List<UserProfileDisplay> wrapUserProfileDisplays = wrapToUserProfileDisplay(appUserDetails);
if (CollectionUtils.isNotEmpty(wrapUserProfileDisplays)) {
wrapUserProfileDisplays = aggreationForUserProfileDisplayData(userProfileDisplays, wrapUserProfileDisplays);
}
//4.查询固定会员数
Dictionary dictionary = thirdFeign.findDictionaryByTypeAndCode(largeScreenType, largeScreenCode);
if (Objects.nonNull(dictionary) && StringUtils.hasText(dictionary.getDetail())) {
String memberNumStr = dictionary.getDetail();
long memberNums = Integer.valueOf(memberNumStr);
userProfileDisplayVo.setMembersNum(memberNums);
}
wrapUserProfileDisplay(wrapUserProfileDisplays, userProfileDisplayVo);
userProfileDisplayVo.setUserProfileDisplays(wrapUserProfileDisplays);
return userProfileDisplayVo;
}
private List<UserProfileDisplay> aggreationForUserProfileDisplayData(List<UserProfileDisplay> baseuserProfileDisplays, List<UserProfileDisplay> wrapUserProfileDisplays) {
Map<Integer, UserProfileDisplay> userProfileMap = wrapUserProfileDisplays.stream().collect(Collectors.toMap(UserProfileDisplay::getProvinceCode, Function.identity()));
for (UserProfileDisplay baseuserProfileDisplay : baseuserProfileDisplays) {
Integer provinceCode = baseuserProfileDisplay.getProvinceCode();
UserProfileDisplay userProfileDisplay = userProfileMap.get(provinceCode);
if (Objects.isNull(userProfileDisplay)) {
continue;
}
int userNums = baseuserProfileDisplay.getUsersNum() + userProfileDisplay.getUsersNum();
long memberNums = baseuserProfileDisplay.getMemberNums() + userProfileDisplay.getMemberNums();
baseuserProfileDisplay.setUsersNum(userNums);
baseuserProfileDisplay.setMemberNums(memberNums);
}
return baseuserProfileDisplays;
}
private UserProfileDisplayVo wrapUserProfileDisplay(List<UserProfileDisplay> userProfileDisplays, UserProfileDisplayVo userProfileDisplayVo) {
long membersNum = 0;
long usersNum = 0;
for (UserProfileDisplay userProfileDisplay : userProfileDisplays) {
usersNum = usersNum + userProfileDisplay.getUsersNum();
membersNum = membersNum + userProfileDisplay.getMemberNums();
}
membersNum = membersNum + userProfileDisplayVo.getMembersNum();
userProfileDisplayVo.setUsersNum(usersNum);
userProfileDisplayVo.setMembersNum(membersNum);
double ratio = membersNum / (usersNum * 1.0);
userProfileDisplayVo.setMembershipRatio(String.format("%.2f",ratio));
return userProfileDisplayVo;
}
private List<UserProfileDisplay> wrapToUserProfileDisplay(List<AppUserDetail> appUserDetails) {
List<UserProfileDisplay> userProfileDisplays = new ArrayList<>();
if (CollectionUtils.isEmpty(appUserDetails)) {
return userProfileDisplays;
}
Map<Integer, List<AppUserDetail>> appUserDetailMap = appUserDetails.stream().peek(x -> {
if (x.getProvinceCode() == null || x.getProvinceCode() == 0) {
x.setProvinceCode(GUANG_DONG_CODE);
}
}).collect(Collectors.groupingBy(AppUserDetail::getProvinceCode, Collectors.toList()));
UserProfileDisplay userProfileDisplay;
Set<Map.Entry<Integer, List<AppUserDetail>>> appUserDetailEntrySet = appUserDetailMap.entrySet();
for (Map.Entry<Integer, List<AppUserDetail>> appUserMapEntry : appUserDetailEntrySet) {
userProfileDisplay = new UserProfileDisplay();
Integer provinceCode = appUserMapEntry.getKey();
userProfileDisplay.setProvinceCode(provinceCode);
List<AppUserDetail> appUserDetailList = appUserMapEntry.getValue();
userProfileDisplay.setUsersNum(appUserDetailList.size());
long members = appUserDetailList.stream().filter(x -> Objects.equals(x.getIsMember(), 1)).count();
userProfileDisplay.setMemberNums(members);
userProfileDisplays.add(userProfileDisplay);
}
return userProfileDisplays;
}
}
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.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.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.UserProfileDisplayBiz;
import com.github.wxiaoqi.security.admin.vo.UserProfileDisplayVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
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.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 10:11
*/
@RestController
@RequestMapping("/large_screen/app/unauth")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LargeScreenDisplayUserController {
private final UserProfileDisplayBiz userProfileDisplayBiz;
/**
* 用户概况
*
* @return
*/
@GetMapping("/user_profile_display")
public ObjectRestResponse<UserProfileDisplayVo> findUserProfileData() {
UserProfileDisplayVo userProfileDisplayVo = userProfileDisplayBiz.findUserProfileData();
return ObjectRestResponse.succ(userProfileDisplayVo);
}
}
<?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.github.wxiaoqi.security.admin.mapper.UserProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.github.wxiaoqi.security.admin.entity.UserProfileDisplay" id="userProfileDisplayMap">
<result property="id" column="id"/>
<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
package com.xxfc.platform.order.bo;
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 BigDecimal baseOrderAmount = BigDecimal.ZERO;
/**
* 订单基础单量
*/
private int baseOrderNum;
/**
* 微信支付占比率
*/
private double wxPayRatio;
/**
* 支付宝支付占比率
*/
private double aliPayRatio;
/**
* 安卓终端支付占比率
*/
private double androidPayRatio;
/**
* ios终端支付占比率
*/
private double iosPayRatio;
}
package com.xxfc.platform.order.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:43
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "center_order_profile_display")
@Entity
public class CenterOrderProfileDisplay implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
/**
* 区域id
*/
@Column(name = "area_id")
private Integer areaId;
/**
* 区域名称
*/
@Column(name = "area_name")
private String areaName;
/**
* 区域订单金额
*/
@Column(name = "area_amount")
private BigDecimal areaAmount;
}
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;
/**
* 订单日期
*/
@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:小程序 3:公众号 4:ios
// */
// @Column(name = "pay_terminal")
// private Integer payTerminal;
// /**
// * 订单类型 1:租车 2:旅游 3:会员
// */
// @Column(name = "order_type")
// private Integer orderType;
}
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) ? payDate : DateUtil.beginOfDay(new Date(payTime));
}
public Integer getOrderNum() {
return Objects.isNull(orderNum) ? 1 : orderNum;
}
}
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 areaAmount = BigDecimal.ZERO;
/**
* 区域名称
*/
private String areaName;
/**
* 区域id
*/
private Integer areaId;
}
package com.xxfc.platform.order.pojo.vo;
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;
public OrderProfileDispayVo getOrderProfileDispayData() {
return Objects.isNull(orderProfileDispayData)?new OrderProfileDispayVo():orderProfileDispayData;
}
}
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 androidPayAmount = BigDecimal.ZERO;
/**
* ios支付金额
*/
private BigDecimal iosPayAmount = BigDecimal.ZERO;
/**
* 微信占比
*/
private String wxPayRatio;
/**
* 支付宝占比
*/
private String aliPayRatio;
/**
* 安卓支付占比
*/
private String androidPayRatio;
/**
* ios支付占比
*/
private String iosPayRatio;
}
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 orderPayProfileDisplay;
public List<CenterOrderProfileDisplayVo> getCenterOrderProfileDisplays() {
return CollectionUtils.isEmpty(centerOrderProfileDisplays) ? Collections.EMPTY_LIST : centerOrderProfileDisplays;
}
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);
}
}
package com.xxfc.platform.order.pojo.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
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;
/**
* 订单日期
*/
@JsonIgnore
private Date orderDate;
/**
* 订单金额
*/
private BigDecimal orderAmount = BigDecimal.ZERO;
/**
* 显示日期
*/
private String date;
}
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;
}
...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.biz; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
...@@ -32,6 +33,7 @@ import com.xxfc.platform.order.pojo.DedDetailDTO; ...@@ -32,6 +33,7 @@ import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.QueryCriteria; import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO; 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.MemberOrderBo;
import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO; import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderDTO; import com.xxfc.platform.order.pojo.dto.OrderDTO;
...@@ -926,7 +928,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -926,7 +928,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return userFeign; return userFeign;
} }
/**
/**
* 订单查询类 * 订单查询类
*/ */
@Data @Data
...@@ -980,5 +984,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -980,5 +984,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return PageInfo.of(achievements); return PageInfo.of(achievements);
} }
public List<BaseOrderDTO> findOrdersByDate(Date startDate, Date endDate) {
startDate = DateUtil.beginOfDay(startDate);
endDate = DateUtil.endOfDay(endDate);
long startTime = startDate.getTime();
long endTime = endDate.getTime();
List<BaseOrderDTO> baseOrderDTOS = mapper.findOrdersByDate(startDate,endDate,startTime,endTime);
return CollectionUtils.isEmpty(baseOrderDTOS)?Collections.emptyList():baseOrderDTOS;
}
} }
\ No newline at end of file
package com.xxfc.platform.order.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.CenterOrderProfileDisplay;
import com.xxfc.platform.order.mapper.CenterOrderProfileDisplayMapper;
import com.xxfc.platform.order.pojo.vo.CenterOrderProfileDisplayVo;
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.ArrayList;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:48
*/
@Transactional(rollbackFor = Exception.class)
@Service
@RequiredArgsConstructor(onConstructor =@__(@Autowired))
public class CenterOrderProfileDisplayBiz extends BaseBiz<CenterOrderProfileDisplayMapper, CenterOrderProfileDisplay> {
public List<CenterOrderProfileDisplayVo> findCenterOrderProfileDisplays(){
List<CenterOrderProfileDisplayVo> centerOrderProfileDisplayVos = new ArrayList<>();
List<CenterOrderProfileDisplay> centerOrderProfileDisplays = mapper.selectAll();
if (CollectionUtils.isEmpty(centerOrderProfileDisplays)){
return centerOrderProfileDisplayVos;
}
return JSON.parseObject(JSON.toJSONString(centerOrderProfileDisplays),new TypeReference<List<CenterOrderProfileDisplayVo>>(){});
}
}
package com.xxfc.platform.order.biz;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.util.CollectorsUtil;
import com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.OrderProfileDisplay;
import com.xxfc.platform.order.mapper.OrderProfileDisplayMapper;
import com.xxfc.platform.order.pojo.dto.BaseOrderDTO;
import com.xxfc.platform.order.pojo.vo.*;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Slf4j
@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 BaseOrderBiz baseOrderBiz;
private final VehicleFeign vehicleFeign;
private final CenterOrderProfileDisplayBiz centerOrderProfileDisplayBiz;
private final ThreadPoolTaskExecutor executor;
private static final Integer WX_PAY_STATE = 1;
private static final Integer ALI_PAY_STATE = 2;
private static final Integer APP_PAY_STATE = 1;
private static final Integer APPLET_PAY_STATE = 2;
private static final Integer WECHAT_OFFICIAL_ACCOUNT_PAY_STATE = 3;
private static final Integer IOS_PAY_STATE = 4;
/**
* @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<BaseOrderDTO> baseOrders = baseOrderBiz.findOrdersByDate(startDate, endDate);
//2.2查询固定数据
List<OrderProfileDisplay> orderProfileDisplays = findOrderProfileDisplayDataByDate(startDate, endDate);
CountDownLatch latch = new CountDownLatch(3);
//3. 十大运营中心订单数据
executor.execute(() -> {
try {
analyticStatisticsCenterOrder(baseOrders, orderProfileDispayVo);
} catch (Exception ex) {
log.error("十大运营中心订单统计失败【{}】", ex);
} finally {
latch.countDown();
}
});
//4.总的订单数据
executor.execute(() -> {
try {
analyticStatisticsOrderProfiles(baseOrders, orderProfileDisplays, orderProfileDispayVo);
} catch (Exception ex) {
log.error("总订单数据解析失败【{}】", ex);
} finally {
latch.countDown();
}
});
//5.支付方式|支付终端数据处理
LargeScreenDisplayConstantDataBo finalLargeScreenDisplayConstantDataBo = largeScreenDisplayConstantDataBo;
executor.execute(() -> {
try {
analyticStatisticsOrderPayWayProfiles(baseOrders, orderProfileDisplays, finalLargeScreenDisplayConstantDataBo,orderProfileDispayVo);
} catch (Exception ex) {
log.error("支付方式|支付终端数据处理失败【{}】", ex);
} finally {
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) {
log.error("统计出错:【{}】", e);
}
//1.基础金额 + 真实金额 基础订单量+真实订单量
long totalOrderNum = orderProfileDispayVo.getOrderNum() + largeScreenDisplayConstantDataBo.getBaseOrderNum();
BigDecimal totalOrderAmount = orderProfileDispayVo.getOrderAmount().add(largeScreenDisplayConstantDataBo.getBaseOrderAmount());
orderProfileDispayVo.setOrderAmount(totalOrderAmount);
orderProfileDispayVo.setOrderNum(totalOrderNum);
largeScreenDisplayDataVo.setOrderProfileDispayData(orderProfileDispayVo);
return largeScreenDisplayDataVo;
}
/**
* 支付方式|终端的统计
*
* @param orderProfileDispayVo
* @param largeScreenDisplayConstantDataBo
* @param baseOrders
* @return
*/
private OrderProfileDispayVo analyticStatisticsOrderPayWayProfiles(List<BaseOrderDTO> baseOrders,
List<OrderProfileDisplay> orderProfileDisplays,
LargeScreenDisplayConstantDataBo largeScreenDisplayConstantDataBo,
OrderProfileDispayVo orderProfileDispayVo) {
OrderPayProfileDispalyVo orderPayProfileDispalyVo = new OrderPayProfileDispalyVo();
BigDecimal orderAmountConstant = CollectionUtils.isEmpty(orderProfileDisplays) ? BigDecimal.ZERO :
orderProfileDisplays.stream().map(OrderProfileDisplay::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//1.支付方式统计
wrapToPayProfileWithPayWay(baseOrders, orderAmountConstant, largeScreenDisplayConstantDataBo, orderPayProfileDispalyVo);
//2.支付终端统计
wrapToPayProfileWithPayTerminal(baseOrders, orderAmountConstant, largeScreenDisplayConstantDataBo, orderPayProfileDispalyVo);
orderProfileDispayVo.setOrderPayProfileDisplay(orderPayProfileDispalyVo);
return orderProfileDispayVo;
}
/**
* 支付方式统计
*
* @param baseOrders
* @param orderAmountConstant
* @param orderPayProfileDispalyVo
* @return
*/
private OrderPayProfileDispalyVo wrapToPayProfileWithPayWay(List<BaseOrderDTO> baseOrders,
BigDecimal orderAmountConstant,
LargeScreenDisplayConstantDataBo largeScreenDisplayConstantDataBo,
OrderPayProfileDispalyVo orderPayProfileDispalyVo) {
Map<Integer, BigDecimal> payWayMap = CollectionUtils.isEmpty(baseOrders) ? Collections.EMPTY_MAP :
baseOrders.stream().collect(Collectors.groupingBy(BaseOrderDTO::getPayWay, CollectorsUtil.summingBigDecimal(BaseOrderDTO::getRealAmount)));
boolean isEmpty = payWayMap.isEmpty();
BigDecimal wxPayAmount = isEmpty ? BigDecimal.ZERO : payWayMap.get(WX_PAY_STATE) == null ? BigDecimal.ZERO : payWayMap.get(WX_PAY_STATE);
BigDecimal aliPayAmount = isEmpty ? BigDecimal.ZERO : payWayMap.get(ALI_PAY_STATE) == null ? BigDecimal.ZERO : payWayMap.get(ALI_PAY_STATE);
//基础金额 * 占比率
wxPayAmount = wxPayAmount.add(orderAmountConstant.multiply(new BigDecimal(String.valueOf(largeScreenDisplayConstantDataBo.getWxPayRatio()))));
aliPayAmount = aliPayAmount.add(orderAmountConstant.multiply(new BigDecimal(String.valueOf(largeScreenDisplayConstantDataBo.getAliPayRatio()))));
BigDecimal totalAmount = wxPayAmount.add(aliPayAmount);
String wxPayRatio = wxPayAmount.divide(totalAmount,2,BigDecimal.ROUND_HALF_UP).toString();
String aliPayRatio = aliPayAmount.divide(totalAmount,2,BigDecimal.ROUND_HALF_UP).toString();
orderPayProfileDispalyVo.setWxPayRatio(wxPayRatio);
orderPayProfileDispalyVo.setAliPayRatio(aliPayRatio);
orderPayProfileDispalyVo.setWxPayAmount(wxPayAmount.setScale(2));
orderPayProfileDispalyVo.setAliPayAmount(aliPayAmount.setScale(2));
return orderPayProfileDispalyVo;
}
/**
* 支付终端统计
*
* @param baseOrders
* @param orderPayProfileDispalyVo
* @return
*/
private OrderPayProfileDispalyVo wrapToPayProfileWithPayTerminal(List<BaseOrderDTO> baseOrders,
BigDecimal orderAmountConstant,
LargeScreenDisplayConstantDataBo largeScreenDisplayConstantDataBo,
OrderPayProfileDispalyVo orderPayProfileDispalyVo) {
Map<Integer, BigDecimal> payTerminalMap = CollectionUtils.isEmpty(baseOrders) ? Collections.EMPTY_MAP :
baseOrders.stream().collect(Collectors.groupingBy(BaseOrderDTO::getPayOrigin, CollectorsUtil.summingBigDecimal(BaseOrderDTO::getRealAmount)));
boolean isEmpty = payTerminalMap.isEmpty();
BigDecimal androidPayAmount = isEmpty ? BigDecimal.ZERO : payTerminalMap.get(APP_PAY_STATE) == null ? BigDecimal.ZERO : payTerminalMap.get(APP_PAY_STATE);
BigDecimal appletPayAmount = isEmpty ? BigDecimal.ZERO : payTerminalMap.get(APPLET_PAY_STATE) == null ? BigDecimal.ZERO : payTerminalMap.get(APPLET_PAY_STATE);
BigDecimal weChatOfficialAccountPayAmount = isEmpty ? BigDecimal.ZERO : payTerminalMap.get(WECHAT_OFFICIAL_ACCOUNT_PAY_STATE) == null ? BigDecimal.ZERO : payTerminalMap.get(WECHAT_OFFICIAL_ACCOUNT_PAY_STATE);
BigDecimal iosPayAmount = isEmpty ? BigDecimal.ZERO : payTerminalMap.get(IOS_PAY_STATE) == null ? BigDecimal.ZERO : payTerminalMap.get(IOS_PAY_STATE);
//applet 公众号 划为ios支付
iosPayAmount = iosPayAmount.add(appletPayAmount).add(weChatOfficialAccountPayAmount);
//基础金额 * 占比率
androidPayAmount = androidPayAmount.add(orderAmountConstant.multiply(new BigDecimal(String.valueOf(largeScreenDisplayConstantDataBo.getAndroidPayRatio()))));
iosPayAmount = iosPayAmount.add(orderAmountConstant.multiply(new BigDecimal(String.valueOf(largeScreenDisplayConstantDataBo.getIosPayRatio()))));
BigDecimal totalAmount = androidPayAmount.add(iosPayAmount);
String androidPayRatio = androidPayAmount.divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP).toString();
String iosPayRatio = iosPayAmount.divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP).toString();
orderPayProfileDispalyVo.setAndroidPayRatio(androidPayRatio);
orderPayProfileDispalyVo.setIosPayRatio(iosPayRatio);
orderPayProfileDispalyVo.setAndroidPayAmount(androidPayAmount.setScale(2));
orderPayProfileDispalyVo.setIosPayAmount(iosPayAmount.setScale(2));
return orderPayProfileDispalyVo;
}
/**
* 订单统计解析
*
* @param
* @param orderProfileDispayVo
* @return
*/
private OrderProfileDispayVo analyticStatisticsOrderProfiles(List<BaseOrderDTO> baseOrders,
List<OrderProfileDisplay> orderProfileDisplays,
OrderProfileDispayVo orderProfileDispayVo) {
//包装数据
List<BaseOrderDTO> baseOrderDTOS = wrapToBaseOrder(orderProfileDisplays);
baseOrderDTOS.addAll(baseOrders);
//1.真实数据按时间分组
Map<Date, BigDecimal> orderAmountMap = baseOrderDTOS.stream().collect(Collectors.groupingBy(BaseOrderDTO::getPayDate, CollectorsUtil.summingBigDecimal(BaseOrderDTO::getRealAmount)));
//2.某个时间段的订单统计
//2.1 订单金额
List<OrderProfileVo> orderProfileVos = createOrderProfiles(orderAmountMap);
//2.2 订单量
wrapBaseDateToOrderProfileDispay(baseOrders, orderProfileDispayVo);
//3.今日金额
Date date = DateUtil.beginOfDay(new Date()).toJdkDate();
BigDecimal todayOrderAmount = orderAmountMap == null ? BigDecimal.ZERO : orderAmountMap.get(date) == null ? BigDecimal.ZERO : orderAmountMap.get(date);
orderProfileDispayVo.setTodayOrderAmount(todayOrderAmount);
orderProfileDispayVo.setOrderProfiles(orderProfileVos);
return orderProfileDispayVo;
}
/**
* 包装基础数据 订单金额 与订单量
*
* @param orderProfileDispayVo
* @return
*/
private OrderProfileDispayVo wrapBaseDateToOrderProfileDispay(List<BaseOrderDTO> baseOrderDTOS, OrderProfileDispayVo orderProfileDispayVo) {
Map<Date, Long> orderNumMap = CollectionUtils.isEmpty(baseOrderDTOS) ? Collections.EMPTY_MAP :
baseOrderDTOS.stream().collect(Collectors.groupingBy(BaseOrderDTO::getPayDate, Collectors.counting()));
if (orderNumMap == null || orderNumMap.isEmpty()) {
return orderProfileDispayVo;
}
Date date = DateUtil.beginOfDay(new Date()).toJdkDate();
//今日订单量
long todayOrderNum = orderNumMap.get(date) == null ? 0 : orderNumMap.get(date);
orderProfileDispayVo.setTodayOrderNum(todayOrderNum);
return orderProfileDispayVo;
}
/**
* 组装对象
*
* @param orderAmountMap
* @return
*/
private List<OrderProfileVo> createOrderProfiles(Map<Date, BigDecimal> orderAmountMap) {
List<OrderProfileVo> orderProfileVos = new ArrayList<>();
if (orderAmountMap == null || orderAmountMap.isEmpty()) {
return orderProfileVos;
}
Set<Map.Entry<Date, BigDecimal>> orderAmountEntrySet = orderAmountMap.entrySet();
Iterator<Map.Entry<Date, BigDecimal>> orderAmountIterator = orderAmountEntrySet.iterator();
OrderProfileVo orderProfileVo;
while (orderAmountIterator.hasNext()) {
Map.Entry<Date, BigDecimal> orderAmountMapEntry = orderAmountIterator.next();
orderProfileVo = new OrderProfileVo();
orderProfileVo.setOrderDate(orderAmountMapEntry.getKey());
orderProfileVo.setOrderAmount(orderAmountMapEntry.getValue());
orderProfileVo.setDate(DateUtil.format(orderProfileVo.getOrderDate(),"MM.dd"));
orderProfileVos.add(orderProfileVo);
}
orderProfileVos.sort(Comparator.comparing(OrderProfileVo::getOrderDate));
return orderProfileVos;
}
/**
* 运营中心订单统计
*
* @param orderProfileDispayVo
* @return
*/
private OrderProfileDispayVo analyticStatisticsCenterOrder(List<BaseOrderDTO> baseOrders,
OrderProfileDispayVo orderProfileDispayVo) {
//根据公司id查询公司区域
Map<Integer,BranchCompanyAreaDTO> companyAreaDTOMap = new HashMap<>(100);
if (!CollectionUtils.isEmpty(baseOrders)){
List<Integer> companyIds = baseOrders.stream().map(BaseOrderDTO::getCompanyId).collect(Collectors.toList());
List<BranchCompanyAreaDTO> branchCompnays = vehicleFeign.findBranchCompnayAreaByIds(companyIds);
companyAreaDTOMap = branchCompnays.stream().collect(Collectors.toMap(BranchCompanyAreaDTO::getCompanyId, Function.identity()));
}
//筛选出租车订单
Map<Integer, BranchCompanyAreaDTO> finalCompanyAreaDTOMap = companyAreaDTOMap;
Map<Integer, BigDecimal> areaAmountMap = CollectionUtils.isEmpty(baseOrders) ? Collections.EMPTY_MAP :
baseOrders.stream().filter(x -> Objects.equals(x.getType(), OrderTypeEnum.RENT_VEHICLE.getCode()))
.peek(x->{
BranchCompanyAreaDTO branchCompanyAreaDTO = finalCompanyAreaDTOMap.get(x.getCompanyId());
x.setAreaId(branchCompanyAreaDTO.getAreaId());
})
.collect(Collectors.groupingBy(BaseOrderDTO::getAreaId, CollectorsUtil.summingBigDecimal(BaseOrderDTO::getRealAmount)));
List<CenterOrderProfileDisplayVo> centerOrderProfileDisplayVos = createCenterOrderProfileDisplay(areaAmountMap);
orderProfileDispayVo.setCenterOrderProfileDisplays(centerOrderProfileDisplayVos);
return orderProfileDispayVo;
}
/**
* 区域统计处理
*
* @param areaAmountMap
* @return
*/
private List<CenterOrderProfileDisplayVo> createCenterOrderProfileDisplay(Map<Integer, BigDecimal> areaAmountMap) {
List<CenterOrderProfileDisplayVo> centerOrderProfileDisplayVos = new ArrayList<>();
//查询全部区域
List<CenterOrderProfileDisplayVo> centerOrderProfileDisplays = centerOrderProfileDisplayBiz.findCenterOrderProfileDisplays();
for (CenterOrderProfileDisplayVo centerOrderProfileDisplay : centerOrderProfileDisplays) {
Integer areaId = centerOrderProfileDisplay.getAreaId();
BigDecimal areaAmount = areaAmountMap == null ? BigDecimal.ZERO : areaAmountMap.get(areaId) == null ? BigDecimal.ZERO : areaAmountMap.get(areaId);
areaAmount = areaAmount.add(centerOrderProfileDisplay.getAreaAmount());
centerOrderProfileDisplay.setAreaAmount(areaAmount);
centerOrderProfileDisplayVos.add(centerOrderProfileDisplay);
}
return centerOrderProfileDisplayVos;
}
/**
* 包装成baseOrder
*
* @param orderProfileDisplays
* @return
*/
private List<BaseOrderDTO> wrapToBaseOrder(List<OrderProfileDisplay> orderProfileDisplays) {
List<BaseOrderDTO> baseOrderDTOS = orderProfileDisplays.stream().map(x -> {
BaseOrderDTO baseOrderDTO = new BaseOrderDTO();
baseOrderDTO.setRealAmount(x.getOrderAmount());
baseOrderDTO.setPayDate(x.getOrderDate());
return baseOrderDTO;
}).collect(Collectors.toList());
return CollectionUtils.isEmpty(baseOrderDTOS) ? new ArrayList<>() : baseOrderDTOS;
}
/**
* 根据开始时间与结束时间查询
*
* @param startDate
* @param endDate
* @return
*/
public List<OrderProfileDisplay> findOrderProfileDisplayDataByDate(Date startDate, Date endDate) {
List<OrderProfileDisplay> orderProfileDisplays = mapper.findOrderProfileDisplayDatabyDate(startDate, endDate);
return CollectionUtils.isEmpty(orderProfileDisplays) ? Collections.emptyList() : orderProfileDisplays;
}
}
...@@ -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;
...@@ -530,4 +533,12 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -530,4 +533,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
...@@ -4,6 +4,7 @@ import com.xxfc.platform.order.entity.BaseOrder; ...@@ -4,6 +4,7 @@ import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.pojo.Achievement; import com.xxfc.platform.order.pojo.Achievement;
import com.xxfc.platform.order.pojo.QueryCriteria; import com.xxfc.platform.order.pojo.QueryCriteria;
import com.xxfc.platform.order.pojo.bg.BgOrderListVo; 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.MemberOrderBo;
import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO; import com.xxfc.platform.order.pojo.dto.MemberOrderFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderDTO; import com.xxfc.platform.order.pojo.dto.OrderDTO;
...@@ -51,4 +52,8 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> { ...@@ -51,4 +52,8 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
List<OrderDTO> selectBaeOrderByOrderIds(@Param("orderIds") List<Integer> orderIds); List<OrderDTO> selectBaeOrderByOrderIds(@Param("orderIds") List<Integer> orderIds);
List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria); List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria);
List<BaseOrderDTO> findOrdersByDate(@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime);
} }
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CenterOrderProfileDisplay;
import tk.mybatis.mapper.common.Mapper;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:49
*/
public interface CenterOrderProfileDisplayMapper extends Mapper<CenterOrderProfileDisplay> {
}
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
* @description
* @data 2019/12/24 17:05
*/
public interface OrderProfileDisplayMapper extends Mapper<OrderProfileDisplay> {
List<OrderProfileDisplay> findOrderProfileDisplayDatabyDate(@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}
...@@ -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.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.OrderProfileDisplayBiz;
import com.xxfc.platform.order.pojo.vo.LargeScreenDisplayDataVo;
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/app/unauth")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LargeScreenDisplayController {
private final OrderProfileDisplayBiz orderProfileDisplayBiz;
/**
* 基础数据 与 订单概况
*
* @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);
}
}
...@@ -3,6 +3,28 @@ ...@@ -3,6 +3,28 @@
<mapper namespace="com.xxfc.platform.order.mapper.BaseOrderMapper"> <mapper namespace="com.xxfc.platform.order.mapper.BaseOrderMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.BaseOrder" id="baseOrderMap">
<result property="id" column="id"/>
<result property="no" column="no"/>
<result property="type" column="type"/>
<result property="detailId" column="detail_id"/>
<result property="status" column="status"/>
<result property="productAmount" column="product_amount"/>
<result property="orderAmount" column="order_amount"/>
<result property="detailJson" column="detail_json"/>
<result property="thirdType" column="third_type"/>
<result property="outTradeNo" column="out_trade_no"/>
<result property="crtTime" column="crt_time"/>
<result property="crtUser" column="crt_user"/>
<result property="crtName" column="crt_name"/>
<result property="crtHost" column="crt_host"/>
<result property="updTime" column="upd_time"/>
<result property="updUser" column="upd_user"/>
<result property="updName" column="upd_name"/>
<result property="updHost" column="upd_host"/>
</resultMap>
<resultMap type="com.xxfc.platform.order.pojo.order.OrderPageVO" id="orderPageMap"> <resultMap type="com.xxfc.platform.order.pojo.order.OrderPageVO" id="orderPageMap">
<result javaType="Integer" column="type" property="type"></result> <result javaType="Integer" column="type" property="type"></result>
<discriminator javaType="Integer" column="type"> <discriminator javaType="Integer" column="type">
...@@ -68,9 +90,6 @@ ...@@ -68,9 +90,6 @@
<if test="type != null"> <if test="type != null">
and type = #{type} and type = #{type}
</if> </if>
<if test="invoiceStatus != null">
and invoice_status = #{invoiceStatus}
</if>
<if test="hasMemberRight != null"> <if test="hasMemberRight != null">
and has_member_right = #{hasMemberRight} and has_member_right = #{hasMemberRight}
</if> </if>
...@@ -132,9 +151,6 @@ ...@@ -132,9 +151,6 @@
<if test="no != null and no != '' "> <if test="no != null and no != '' ">
and no like CONCAT ("%", #{no}, "%") and no like CONCAT ("%", #{no}, "%")
</if> </if>
<if test="oneNo != null and oneNo != '' ">
and no =#{oneNo}
</if>
<if test="name != null"> <if test="name != null">
and b.name like CONCAT ("%", #{name}, "%") and b.name like CONCAT ("%", #{name}, "%")
</if> </if>
...@@ -276,7 +292,6 @@ ...@@ -276,7 +292,6 @@
order by crtTime desc order by crtTime desc
</select> </select>
<select id="getTourList" parameterType="Map" resultMap="orderPageMap"> <select id="getTourList" parameterType="Map" resultMap="orderPageMap">
select b.* select b.*
from base_order b from base_order b
...@@ -308,7 +323,7 @@ ...@@ -308,7 +323,7 @@
( (
( (
orv.start_time &gt; #{startTime} orv.start_time &gt; #{startTime}
AND orv.start_time &lt; #{endTime} AND orv.start_time &lt; #{startTime}
AND orv.end_time &gt; #{endTime} AND orv.end_time &gt; #{endTime}
) )
OR ( OR (
...@@ -317,7 +332,7 @@ ...@@ -317,7 +332,7 @@
) )
OR ( OR (
orv.start_time &lt; #{startTime} orv.start_time &lt; #{startTime}
AND orv.end_time &gt; #{startTime} AND orv.end_time &gt; #{endTime}
AND orv.end_time &lt; #{endTime} AND orv.end_time &lt; #{endTime}
) )
OR ( OR (
...@@ -420,20 +435,24 @@ ...@@ -420,20 +435,24 @@
</select> </select>
<select id="selectOrdersByTypeAndTime" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO"> <select id="selectOrdersByTypeAndTime" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO">
select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as `userId`,bo.parent_position_id as `postionId`, select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`, `userId`,bo.parent_position_id as `postionId`,
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`)
AS `companyId`,
orvd.deposit,orvd.cost_detail AS `costDetail` orvd.deposit,orvd.cost_detail AS `costDetail`
from (select * from `base_order` where 1=1 from (select * from `base_order` where 1=1
<if test="hasPay!=null"> <if test="hasPay!=null">
and `has_pay`=#{hasPay} and `has_pay`=#{hasPay}
</if> </if>
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types" and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and
item="type" `type` IN <foreach collection="types"
open="(" close=")" item="type"
separator=","> open="(" close=")"
separator=",">
#{type} #{type}
</foreach> ) AS `bo` </foreach> ) AS `bo`
LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail` from `order_rent_vehicle_detail`) AS `orvd` ON LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail` from `order_rent_vehicle_detail`) AS
`orvd` ON
orvd.order_id=bo.id orvd.order_id=bo.id
LEFT JOIN (select `order_id`,`start_company_id` from `order_tour_detail`) AS `otd` ON otd.order_id=bo.id LEFT JOIN (select `order_id`,`start_company_id` from `order_tour_detail`) AS `otd` ON otd.order_id=bo.id
LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON
...@@ -447,6 +466,7 @@ ...@@ -447,6 +466,7 @@
</foreach> </foreach>
</select> </select>
<select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria" <select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria"
resultType="com.xxfc.platform.order.pojo.Achievement"> resultType="com.xxfc.platform.order.pojo.Achievement">
select select
...@@ -478,4 +498,21 @@ ...@@ -478,4 +498,21 @@
order by crt_time DESC order by crt_time DESC
</select> </select>
<select id="findOrdersByDate" resultType="com.xxfc.platform.order.pojo.dto.BaseOrderDTO">
SELECT bo.*,orvd.start_company_id as `companyId`,orvd.`start_zone_id` as `areaId` FROM(
SELECT
`id`,
`type`,
`real_amount`,
`pay_way`,
`pay_origin`,
`pay_time`
FROM
`base_order`
WHERE
has_pay = 1 and `pay_time` BETWEEN #{startTime} AND #{endTime}
) as bo
left join order_rent_vehicle_detail as orvd on orvd.order_id=bo.id;
</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.CenterOrderProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.CenterOrderProfileDisplay" id="centerOrderProfileDisplayMap">
<result property="id" column="id"/>
<result property="areaId" column="area_id"/>
<result property="areaName" column="area_name"/>
<result property="areaAmount" column="area_amount"/>
</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.OrderProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.order.entity.OrderProfileDisplay" id="orderProfileDisplayMap">
<result property="id" column="id"/>
<result property="orderAmount" column="order_amount"/>
<result property="orderDate" column="order_date"/>
</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
...@@ -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>
...@@ -179,7 +185,7 @@ ...@@ -179,7 +185,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>
...@@ -229,7 +235,7 @@ ...@@ -229,7 +235,7 @@
SUM(`loss_specified_amount`) as `lossSpecifiedAmount`, SUM(`loss_specified_amount`) as `lossSpecifiedAmount`,
SUM(`late_fee_amount`) as `lateFeeAmount` SUM(`late_fee_amount`) as `lateFeeAmount`
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>
...@@ -467,4 +473,26 @@ ...@@ -467,4 +473,26 @@
`week_of_year` `week_of_year`
) as `ds` ) as `ds`
</select> </select>
<select id="findOrderReceivedStatisticsByDate" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
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> </mapper>
\ No newline at end of file
package com.xxfc.platform.vehicle.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:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "vehicle_profile_display")
public class VehicleProfileDisplay {
@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 = "vehicle_num")
private Integer vehicleNum;
}
...@@ -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;
...@@ -138,7 +139,7 @@ public interface VehicleFeign { ...@@ -138,7 +139,7 @@ public interface VehicleFeign {
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItem(); public RestResponse<List<AccompanyingItemVo>> listAccompanyingItem();
@GetMapping("/branchCompany/findByAreaId") @GetMapping("/branchCompany/findByAreaId")
List<Integer> findCompanyIdsByAreaId(@RequestParam(value = "areaId",required = false) Integer areaId); List<Integer> findCompanyIdsByAreaId(@RequestParam(value = "areaId") Integer areaId);
@GetMapping("/branchCompany/company") @GetMapping("/branchCompany/company")
Map<Integer, BranComanyLeaderVo> findCompanyLeaderMapByIds(@RequestParam(value = "companyIds") List<Integer> companyIds); Map<Integer, BranComanyLeaderVo> findCompanyLeaderMapByIds(@RequestParam(value = "companyIds") List<Integer> companyIds);
...@@ -211,6 +212,9 @@ public interface VehicleFeign { ...@@ -211,6 +212,9 @@ public interface VehicleFeign {
@GetMapping("/branchCompany/company_info") @GetMapping("/branchCompany/company_info")
Map<Integer, String> findCompanyMap(); Map<Integer, String> findCompanyMap();
/* @RequestMapping(value ="/branchCompany/{id}",method = RequestMethod.GET) @GetMapping("/area/areas")
RestResponse<BranchCompany> get(@PathVariable Integer id);*/ List<Area> findAllAreas();
@GetMapping("/branchCompany/compnays_area")
public List<BranchCompanyAreaDTO> findBranchCompnayAreaByIds(@RequestParam("companyIds") List<Integer> compnayIds);
} }
package com.xxfc.platform.vehicle.pojo.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 9:45
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LargeScreenDisplayCCTConstantDataBo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 公司数量
*/
private int companyNum;
/**
* 营地数量
*/
private int campsiteNum;
/**
* 旅游路线数量
*/
private int tourNum;
}
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 companyId;
private String companyName;
private Integer areaId;
}
package com.xxfc.platform.vehicle.pojo.vo;
import com.xxfc.platform.vehicle.pojo.bo.LargeScreenDisplayCCTConstantDataBo;
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/26 8:44
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LargeScreenDisplayBaseDataVo implements Serializable {
private static final long serialVersionUID = 1L;
private LargeScreenDisplayCCTConstantDataBo largeScreenDisplayCCTConstantDataBo;
private VehicleProfileDisplayVo vehicleProfileDisplayVo;
public LargeScreenDisplayCCTConstantDataBo getLargeScreenDisplayCCTConstantDataBo() {
return Objects.isNull(largeScreenDisplayCCTConstantDataBo)?new LargeScreenDisplayCCTConstantDataBo():largeScreenDisplayCCTConstantDataBo;
}
public VehicleProfileDisplayVo getVehicleProfileDisplayVo() {
return Objects.isNull(vehicleProfileDisplayVo)?new VehicleProfileDisplayVo():vehicleProfileDisplayVo;
}
}
package com.xxfc.platform.vehicle.pojo.vo;
import com.xxfc.platform.vehicle.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 List<VehicleProfileDisplay> vehicleProfileDisplays;
public List<VehicleProfileDisplay> getVehicleProfileDisplays() {
return CollectionUtils.isEmpty(vehicleProfileDisplays) ? Collections.EMPTY_LIST : vehicleProfileDisplays;
}
}
...@@ -8,10 +8,12 @@ import com.google.common.collect.Lists; ...@@ -8,10 +8,12 @@ import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Area; import com.xxfc.platform.vehicle.entity.Area;
import com.xxfc.platform.vehicle.mapper.AreaMapper; import com.xxfc.platform.vehicle.mapper.AreaMapper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -24,25 +26,27 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf ...@@ -24,25 +26,27 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
UserFeign userFeign; UserFeign userFeign;
@Override @Override
public UserFeign getUserFeign() {return userFeign;} public UserFeign getUserFeign() {
return userFeign;
}
public RestResponse<List<Area>> findAll() { public RestResponse<List<Area>> findAll() {
UserDTO userDTO = getAdminUserInfo(); UserDTO userDTO = getAdminUserInfo();
if(userDTO == null) { if (userDTO == null) {
return RestResponse.suc(); return RestResponse.suc();
} }
String ids = null; String ids = null;
if(DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据 if (DATA_ALL_FALSE.equals(userDTO.getDataAll())) { //不能获取全部数据
if(StringUtils.isNotBlank(userDTO.getDataZone())) { if (StringUtils.isNotBlank(userDTO.getDataZone())) {
ids = userDTO.getDataZone(); ids = userDTO.getDataZone();
} else { } else {
ids = userDTO.getZoneId() + ""; ids = userDTO.getZoneId() + "";
} }
if(ids.contains(",")) { if (ids.contains(",")) {
String[] array = ids.split(","); String[] array = ids.split(",");
List<Integer> list = Lists.newArrayList(); List<Integer> list = Lists.newArrayList();
for(int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
if(StringUtils.isNotBlank(array[i])) { if (StringUtils.isNotBlank(array[i])) {
list.add(Integer.parseInt(array[i])); list.add(Integer.parseInt(array[i]));
} }
} }
...@@ -50,7 +54,7 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf ...@@ -50,7 +54,7 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf
} else { } else {
Area area = mapper.selectByPrimaryKey(ids); Area area = mapper.selectByPrimaryKey(ids);
if (Objects.isNull(area)){ if (Objects.isNull(area)) {
return null; return null;
} }
List<Area> areas = Lists.newArrayList(); List<Area> areas = Lists.newArrayList();
...@@ -64,5 +68,8 @@ public class AreaBiz extends BaseBiz<AreaMapper, Area> implements UserRestInterf ...@@ -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,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;
...@@ -32,7 +33,6 @@ import com.xxfc.platform.vehicle.util.excel.ExcelImport; ...@@ -32,7 +33,6 @@ import com.xxfc.platform.vehicle.util.excel.ExcelImport;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.map.HashedMap; import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
...@@ -447,4 +447,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -447,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> findBranchCompanyAreaByIds(List<Integer> compnayIds) {
List<BranchCompanyAreaDTO> branchCompanyAreaDTOS = mapper.findBranchCompanyAreaByIds(compnayIds);
return CollectionUtils.isEmpty(branchCompanyAreaDTOS)?Collections.EMPTY_LIST:branchCompanyAreaDTOS;
}
} }
package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.VehicleProfileDisplay;
import com.xxfc.platform.vehicle.mapper.VehicleProfileDisplayMapper;
import com.xxfc.platform.vehicle.pojo.bo.LargeScreenDisplayCCTConstantDataBo;
import com.xxfc.platform.vehicle.pojo.vo.LargeScreenDisplayBaseDataVo;
import com.xxfc.platform.vehicle.pojo.vo.VehicleProfileDisplayVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Slf4j
@Transactional(rollbackFor = Exception.class)
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class VehicleProfileDisplayBiz extends BaseBiz<VehicleProfileDisplayMapper, VehicleProfileDisplay> {
/**
* 字典查询type
*/
@Value("${large.screen.type:LARGE_SCREEN_DISPLAY}")
private String largeScreenType;
/**
* 字典查询code
*/
@Value("${large.screen.cct.code:LARGE_SCREEN_DISPLAY_CCT_CONSTANT}")
private String largeScreenCode;
private final ThirdFeign thirdFeign;
public LargeScreenDisplayBaseDataVo findVehicleProfileDisplayData() {
LargeScreenDisplayBaseDataVo largeScreenDisplayBaseDataVo = new LargeScreenDisplayBaseDataVo();
VehicleProfileDisplayVo vehicleProfileDisplayVo = new VehicleProfileDisplayVo();
//1.查询全部固定数据
List<VehicleProfileDisplay> vehicleProfileDisplays = mapper.selectAll();
Dictionary dictionary = thirdFeign.findDictionaryByTypeAndCode(largeScreenType, largeScreenCode);
if (dictionary != null && StringUtils.hasText(dictionary.getDetail())) {
LargeScreenDisplayCCTConstantDataBo largeScreenDisplayConstantDataBo = JSON.parseObject(dictionary.getDetail(), LargeScreenDisplayCCTConstantDataBo.class);
largeScreenDisplayBaseDataVo.setLargeScreenDisplayCCTConstantDataBo(largeScreenDisplayConstantDataBo);
}
vehicleProfileDisplayVo.setVehicleProfileDisplays(vehicleProfileDisplays);
largeScreenDisplayBaseDataVo.setVehicleProfileDisplayVo(vehicleProfileDisplayVo);
return largeScreenDisplayBaseDataVo;
}
}
...@@ -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> findBranchCompanyAreaByIds(@Param("companyIds") List<Integer> compnayIds);
} }
\ No newline at end of file
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.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> {
}
...@@ -30,4 +30,9 @@ public class AreaController extends BaseController<AreaBiz, Area> { ...@@ -30,4 +30,9 @@ public class AreaController extends BaseController<AreaBiz, Area> {
} }
@GetMapping("/areas")
public List<Area> findAllAreas(){
return baseBiz.findAllAreas();
}
} }
...@@ -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,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -232,4 +229,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return baseBiz.selectCompanyMap(); return baseBiz.selectCompanyMap();
} }
@GetMapping("/compnays_area")
public List<BranchCompanyAreaDTO> findBranchCompnayAreaByIds(@RequestParam("companyIds") List<Integer> compnayIds){
return baseBiz.findBranchCompanyAreaByIds(compnayIds);
}
} }
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.biz.VehicleProfileDisplayBiz;
import com.xxfc.platform.vehicle.pojo.vo.LargeScreenDisplayBaseDataVo;
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.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 9:41
*/
@RestController
@RequestMapping("/large_screen/app/unauth")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LargeScreenDisplayCCTVehicleController {
private final VehicleProfileDisplayBiz vehicleProfileDisplayBiz;
/**
* 车辆概况
*
* @return
*/
@GetMapping("/base_cct_vehicle_profile_display")
public ObjectRestResponse<LargeScreenDisplayBaseDataVo> findLargeScreenDisplayData() {
LargeScreenDisplayBaseDataVo largeScreenDisplayBaseDataVo = vehicleProfileDisplayBiz.findVehicleProfileDisplayData();
return ObjectRestResponse.succ(largeScreenDisplayBaseDataVo);
}
}
...@@ -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,28 @@ ...@@ -84,17 +84,28 @@
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>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select>
<select id="findBranchCompanyAreaByIds"
resultType="com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO">
select `id` as `companyId`,`name` as `companyName`,`zone_id` as `areaId` from `branch_company`
<if test="companyIds != null and companyIds.size() != 0">
where `id` in
<foreach collection="companyIds" item="companyId" open="(" close=")" separator=",">
#{companyId}
</foreach>
</if> </if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select> </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.vehicle.mapper.VehicleProfileDisplayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.vehicle.entity.VehicleProfileDisplay" id="vehicleProfileDisplayMap">
<result property="id" column="id"/>
<result property="provinceName" column="province_name"/>
<result property="provinceCode" column="province_code"/>
<result property="vehicleNum" column="vehicle_num"/>
</resultMap>
</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