Commit 66cad7eb authored by libin's avatar libin

Merge branch 'large_screen_display_feature'

# Conflicts:
#	xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
parents 2db71db4 6a9f4f7b
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;
}
...@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo; ...@@ -12,7 +12,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;
...@@ -222,4 +221,17 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -222,4 +221,17 @@ 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;
}
public List<AppUserDetail> findAllUserDetailWithNoProinceCode() {
List<AppUserDetail> appUserDetails = mapper.selectAllWithNoProviinceCode();
return CollectionUtils.isEmpty(appUserDetails)?Collections.EMPTY_LIST:appUserDetails;
}
}
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.jobhandler;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.xxfc.platform.universal.dto.RegionDTO;
import com.xxfc.platform.universal.feign.RegionFeign;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/27 11:14
*/
@JobHandler(value = "ipAnalyticalJobHandler")
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
//@RefreshScope
public class IPJobHandler extends IJobHandler {
private final RestTemplate restTemplate;
private final RegionFeign regionFeign;
private final AppUserDetailBiz appUserDetailBiz;
private static final Integer PROVINCECODE = 440000;
@Value("${ip.analytical.appId:xcjtqjromfuvjjtt}")
private String appId;
@Value("${ip.analytical.secret:bzNRK3FUR2d3WGc0MmhKWGZINm5MQT09}")
private String secret;
@Override
public ReturnT<String> execute(String s) throws Exception {
List<AppUserDetail> appUserDetails = appUserDetailBiz.findAllUserDetailWithNoProinceCode();
for (AppUserDetail appUserDetail : appUserDetails) {
String crtHost = appUserDetail.getCrtHost();
if (log.isDebugEnabled()) {
log.debug("解析的地址:【{}】", crtHost + "---time===" + System.currentTimeMillis() / 1000L);
}
try {
analyticalIPByWebSiteAndIPAddress(IPAddress.BASE_IP_PARSING_URL2, crtHost, appUserDetail);
} catch (Exception e) {
try {
analyticalIPByWebSiteAndIPAddress(IPAddress.BASE_IP_PARSING_URL1, crtHost, appUserDetail);
} catch (Exception ex) {
appUserDetail.setProvinceCode(PROVINCECODE);
log.error("解析地址失败:【{}】", ex.getMessage());
}
}
appUserDetailBiz.updateSelectiveByIdRe(appUserDetail);
}
return ReturnT.SUCCESS;
}
private void analyticalIPByWebSiteAndIPAddress(String url, String crtHost, AppUserDetail appUserDetail) {
String ipAddress = restTemplate.getForObject(String.format("%s%s&app_id=%s&app_secret=%s", url, crtHost,appId,secret), String.class);
String data = JSONObject.parseObject(ipAddress).getString(IPAddress.BASE_DATA);
JSONObject ipJsonObject = JSONObject.parseObject(data);
String cityName = ipJsonObject.getString(IPAddress.CITY_NAME);
RegionDTO regionDTO = regionFeign.getRegionByCityName(StringUtils.isEmpty(cityName) ? "东莞" : cityName);
if (null != regionDTO) {
appUserDetail.setProvinceCode(Integer.valueOf(String.valueOf(regionDTO.getParentId())));
appUserDetail.setCityCode(Integer.valueOf(String.valueOf(regionDTO.getId())));
}else{
if (StringUtils.isNotEmpty(cityName)){
appUserDetail.setProvinceCode(Integer.valueOf(ipJsonObject.get(IPAddress.RPOINCE_ID).toString()));
appUserDetail.setCityCode(Integer.valueOf(ipJsonObject.get(IPAddress.CITY_ID).toString()));
}
}
}
/**
* @author libin
* @version 1.0.0
* @dec ip 解析返回的地址信息
*/
private static class IPAddress {
public static final String BASE_IP_PARSING_URL1 = "http://ip.taobao.com/service/getIpInfo.php?ip=";
public static final String BASE_IP_PARSING_URL2 = "https://www.mxnzp.com/api/ip/aim_ip?ip=";
public static final String BASE_DATA = "data";
public static final String CITY_NAME = "city";
public static final String RPOINCE_ID="provinceId";
public static final String CITY_ID="cityId";
}
}
...@@ -35,4 +35,7 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> { ...@@ -35,4 +35,7 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
List<UserStaffBo> findAllStaffsByCompanyIdAndPostionId(StaffStatisticsFindDTO staffStatisticsFindDTO); List<UserStaffBo> findAllStaffsByCompanyIdAndPostionId(StaffStatisticsFindDTO staffStatisticsFindDTO);
AppUserVo getUser(Integer userId); AppUserVo getUser(Integer userId);
List<AppUserDetail> selectAllWithNoProviinceCode();
} }
\ No newline at end of file
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);
}
}
...@@ -26,7 +26,6 @@ import com.github.wxiaoqi.security.common.util.process.SystemConfig; ...@@ -26,7 +26,6 @@ import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.im.feign.ImFeign; import com.xxfc.platform.im.feign.ImFeign;
import com.xxfc.platform.universal.dto.RegionDTO;
import com.xxfc.platform.universal.dto.SmsTemplateDTO; import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.MQSenderFeign; import com.xxfc.platform.universal.feign.MQSenderFeign;
import com.xxfc.platform.universal.feign.RegionFeign; import com.xxfc.platform.universal.feign.RegionFeign;
...@@ -1208,55 +1207,6 @@ public class AppPermissionService { ...@@ -1208,55 +1207,6 @@ public class AppPermissionService {
} }
} }
/**
* ip地址 信息解析
*
* @param appUserDetail
*/
public void setCreateIPInfo(AppUserDetail appUserDetail) {
String crtHost = appUserDetail.getCrtHost();
if (log.isDebugEnabled()) {
log.debug("解析的地址:【{}】", crtHost+"---time==="+System.currentTimeMillis()/1000L);
}
try {
analyticalIPByWebSiteAndIPAddress(IPAddress.BASE_IP_PARSING_URL2, crtHost, appUserDetail);
} catch (Exception e) {
try {
analyticalIPByWebSiteAndIPAddress(IPAddress.BASE_IP_PARSING_URL1, crtHost, appUserDetail);
} catch (Exception ex) {
log.error("解析地址失败:【{}】", ex.getMessage());
}
}
}
private void analyticalIPByWebSiteAndIPAddress(String url, String crtHost, AppUserDetail appUserDetail) {
String ipAddress = restTemplate.getForObject(String.format("%s%s", url, crtHost), String.class);
log.debug("解析的调用网站后:【{}】", crtHost+"---time==="+System.currentTimeMillis()/1000L);
String data = JSONObject.parseObject(ipAddress).getString(IPAddress.BASE_DATA);
JSONObject ipJsonObject = JSONObject.parseObject(data);
String cityName = ipJsonObject.getString(IPAddress.CITY_NAME);
RegionDTO regionDTO = regionFeign.getRegionByCityName(StringUtils.isEmpty(cityName) ? "东莞" : cityName);
log.debug("解析的调用服务后:【{}】", crtHost+"---time==="+System.currentTimeMillis()/1000L);
if (null != regionDTO) {
appUserDetail.setProvinceCode(Integer.valueOf(String.valueOf(regionDTO.getParentId())));
appUserDetail.setCityCode(Integer.valueOf(String.valueOf(regionDTO.getId())));
}
}
/**
* @author libin
* @version 1.0.0
* @dec ip 解析返回的地址信息
*/
private static class IPAddress {
public static final String BASE_IP_PARSING_URL1 = "http://ip.taobao.com/service/getIpInfo.php?ip=";
public static final String BASE_IP_PARSING_URL2 = "https://www.mxnzp.com/api/ip/aim_ip?ip=";
public static final String BASE_DATA = "data";
public static final String CITY_NAME = "city";
}
//修改手机号码 //修改手机号码
public ObjectRestResponse updUsername(Integer userId,String username,String mobileCode){ public ObjectRestResponse updUsername(Integer userId,String username,String mobileCode){
if (StringUtils.isBlank(username)||StringUtils.isBlank(mobileCode)||userId==0||userId==null){ if (StringUtils.isBlank(username)||StringUtils.isBlank(mobileCode)||userId==0||userId==null){
......
...@@ -328,4 +328,9 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id= ...@@ -328,4 +328,9 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
on d.userid = l.id on d.userid = l.id
where l.id = #{userId} limit 1 where l.id = #{userId} limit 1
</select> </select>
<select id="selectAllWithNoProviinceCode"
resultType="com.github.wxiaoqi.security.admin.entity.AppUserDetail">
select `id`,`crt_host` from `app_user_detail` where crt_host is not null and ( province_code = 0 or province_code is null)
</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.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 long baseTodayOrderNum;
/**
* 当日基础金额
*/
private BigDecimal baseTodayOrderAmount = BigDecimal.ZERO;
/**
* 微信支付占比率
*/
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;
...@@ -912,7 +914,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -912,7 +914,9 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return userFeign; return userFeign;
} }
/**
/**
* 订单查询类 * 订单查询类
*/ */
@Data @Data
...@@ -966,5 +970,12 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -966,5 +970,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>>(){});
}
}
...@@ -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
...@@ -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);
}
}
...@@ -116,14 +116,14 @@ ...@@ -116,14 +116,14 @@
<select id="listOrder" parameterType="Map" resultMap="orderListMap"> <select id="listOrder" parameterType="Map" resultMap="orderListMap">
select b.* select b.*
<if test="type==1"> <if test="type==1">
,i.detail as carArticlesJson ,i.detail as carArticlesJson
</if> </if>
from base_order b from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
LEFT JOIN order_tour_detail t on t.order_id = b.id LEFT JOIN order_tour_detail t on t.order_id = b.id
LEFT JOIN order_member_detail m on m.order_id = b.id LEFT JOIN order_member_detail m on m.order_id = b.id
<if test="type==1"> <if test="type==1">
LEFT JOIN (select * from order_item where type = 104) i on b.id = i.order_id LEFT JOIN (select * from order_item where type = 104) i on b.id = i.order_id
</if> </if>
<where> <where>
<if test="crtUser != null"> <if test="crtUser != null">
...@@ -372,7 +372,7 @@ ...@@ -372,7 +372,7 @@
</select> </select>
<select id="findMemberOrders" resultType="com.xxfc.platform.order.pojo.dto.MemberOrderBo"> <select id="findMemberOrders" resultType="com.xxfc.platform.order.pojo.dto.MemberOrderBo">
select bo.*,omd.member_level AS `memberLevel` from ( select bo.*,omd.member_level AS `memberLevel` from (
SELECT SELECT
`id`, `id`,
`no` AS `orderNo`, `no` AS `orderNo`,
...@@ -426,29 +426,33 @@ ...@@ -426,29 +426,33 @@
</foreach> </foreach>
</if> </if>
) AS `bo` ) AS `bo`
INNER JOIN (select * from `order_member_detail` where 1=1 INNER JOIN (select * from `order_member_detail` where 1=1
<if test="level!=null"> <if test="level!=null">
and `member_level`=#{level} and `member_level`=#{level}
</if> </if>
) AS `omd` ON omd.order_id=bo.id ) AS `omd` ON omd.order_id=bo.id
ORDER BY bo.`creatTime` DESC ORDER BY bo.`creatTime` DESC
</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
...@@ -466,7 +470,8 @@ ...@@ -466,7 +470,8 @@
<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
crt_time,no,type,order_amount,real_amount,realname,username,parentRealname,positionName,parentUsername,companyName,pay_way,company_id,(order_amount-real_amount) as favorablePrice crt_time,no,type,order_amount,real_amount,realname,username,parentRealname,positionName,parentUsername,companyName,pay_way,company_id,(order_amount-real_amount)
as favorablePrice
from order_user_position_company from order_user_position_company
<where> <where>
<if test="startDate != null"> <if test="startDate != null">
...@@ -494,4 +499,21 @@ ...@@ -494,4 +499,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>
...@@ -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,26 @@ ...@@ -455,4 +461,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;
...@@ -213,6 +214,9 @@ public interface VehicleFeign { ...@@ -213,6 +214,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;
...@@ -446,4 +446,9 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -446,4 +446,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