大屏接口调整
parent
c2d417a50e
commit
fd9bbc1ab0
|
|
@ -14,6 +14,7 @@ import com.cpxt.common.utils.DateUtils;
|
|||
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.math.BigDecimal;
|
||||
|
|
@ -46,9 +47,18 @@ public class LargeScreenController extends BaseController {
|
|||
@Autowired
|
||||
private BizCustomerShopMapper bizCustomerShopMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerRouteShopMapper bizCustomerRouteShopMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerShopStateMapper bizCustomerShopStateMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerRouteMapper bizCustomerRouteMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerRouteStateMapper bizCustomerRouteStateMapper;
|
||||
|
||||
@Autowired
|
||||
private StatCarMapper statCarMapper;
|
||||
|
||||
|
|
@ -233,6 +243,70 @@ public class LargeScreenController extends BaseController {
|
|||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有路线信息
|
||||
*/
|
||||
@GetMapping("/route/list")
|
||||
public AjaxResult routeList()
|
||||
{
|
||||
LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCustomerRoute::getStatus,1);
|
||||
List<BizCustomerRoute> bizCustomerRoutes = bizCustomerRouteMapper.selectList(queryWrapper);
|
||||
for (BizCustomerRoute bizCustomerRoute : bizCustomerRoutes) {
|
||||
LambdaQueryWrapper<BizCustomerRouteState> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(BizCustomerRouteState::getRouteId,bizCustomerRoute.getId());
|
||||
BizCustomerRouteState bizCustomerRouteState = bizCustomerRouteStateMapper.selectOne(queryWrapper1);
|
||||
bizCustomerRouteState.setFinishRate(commonComputeRatio(bizCustomerRouteState.getFinishOrders(),bizCustomerRouteState.getTodayOrders()));
|
||||
bizCustomerRoute.setBizCustomerRouteState(bizCustomerRouteState);
|
||||
}
|
||||
|
||||
largeScreenEntity.setRouteList(bizCustomerRoutes);
|
||||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询路线下的店铺信息以及店铺状态
|
||||
*/
|
||||
@GetMapping("/route/shop/list")
|
||||
public AjaxResult routeShopList(@RequestParam Integer routeId)
|
||||
{
|
||||
LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCustomerRoute::getId,routeId);
|
||||
queryWrapper.eq(BizCustomerRoute::getStatus,1);
|
||||
BizCustomerRoute bizCustomerRoute = bizCustomerRouteMapper.selectOne(queryWrapper);
|
||||
LambdaQueryWrapper<BizCustomerRouteShop> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(BizCustomerRouteShop::getRouteId,bizCustomerRoute.getId());
|
||||
List<BizCustomerRouteShop> bizCustomerRouteShops = bizCustomerRouteShopMapper.selectList(queryWrapper1);
|
||||
List<Long> shopIdList = bizCustomerRouteShops.stream().map(BizCustomerRouteShop::getShopId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<BizCustomerShop> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(BizCustomerShop::getId,shopIdList);
|
||||
List<BizCustomerShop> bizCustomerShops = bizCustomerShopMapper.selectList(queryWrapper2);
|
||||
for (BizCustomerShop bizCustomerShop : bizCustomerShops) {
|
||||
LambdaQueryWrapper<BizCustomerShopState> queryWrapper3 = new LambdaQueryWrapper<>();
|
||||
queryWrapper3.eq(BizCustomerShopState::getShopId,bizCustomerShop.getId());
|
||||
BizCustomerShopState bizCustomerShopState = bizCustomerShopStateMapper.selectOne(queryWrapper3);
|
||||
if (bizCustomerShopState != null){
|
||||
bizCustomerShop.setIsFinish(bizCustomerShopState.getIsFinish());
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper4 = new LambdaQueryWrapper<>();
|
||||
queryWrapper4.eq(BizOrder::getOrderSn,bizCustomerShopState.getCurrentOrder());
|
||||
BizOrder bizOrder = bizOrderMapper.selectOne(queryWrapper4);
|
||||
if (bizOrder != null){
|
||||
bizCustomerShop.setCurrentOrder(bizOrder.getOrderSn());
|
||||
bizCustomerShop.setCarNo(bizOrder.getCarNo());
|
||||
bizCustomerShop.setDriveName(bizOrder.getDriverName());
|
||||
bizCustomerShop.setCopilotName(bizOrder.getCopilotName());
|
||||
bizCustomerShop.setStartTime(bizOrder.getStartTime());
|
||||
bizCustomerShop.setArriveImg(bizOrder.getArriveImg());
|
||||
}
|
||||
}
|
||||
}
|
||||
bizCustomerRoute.setShopList(bizCustomerShops);
|
||||
largeScreenEntity.setBizCustomerRoute(bizCustomerRoute);
|
||||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 地区分布情况
|
||||
*/
|
||||
|
|
@ -272,6 +346,7 @@ public class LargeScreenController extends BaseController {
|
|||
queryWrapper.eq(BizCustomerRoute::getStatus, 1);
|
||||
return bizCustomerRouteMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
private long getWarehouse(){
|
||||
LambdaQueryWrapper<BizCustomerWarehouse> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCustomerWarehouse::getStatus, 1);
|
||||
|
|
@ -351,4 +426,5 @@ public class LargeScreenController extends BaseController {
|
|||
}
|
||||
return 0d;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,15 @@ public class StatDriverController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机统计
|
||||
*/
|
||||
@GetMapping("/statics")
|
||||
public AjaxResult statics(StatDriver statDriver)
|
||||
{
|
||||
return AjaxResult.success(statDriverService.statics(statDriver));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出司机统计列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -56,4 +56,10 @@ public class BizCustomerRoute
|
|||
|
||||
@TableField(exist = false)
|
||||
private List<Long> shops;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BizCustomerShop> shopList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BizCustomerRouteState bizCustomerRouteState;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,12 @@ public class BizCustomerRouteState implements Serializable {
|
|||
*/
|
||||
private Integer finishOrders;
|
||||
|
||||
/**
|
||||
* 完成率
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double finishRate;
|
||||
|
||||
/**
|
||||
* 平均配送时长(秒)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.cpxt.biz.domain;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
|
@ -76,4 +77,51 @@ public class BizCustomerShop
|
|||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 当前订单
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String currentOrder;
|
||||
|
||||
/**
|
||||
* 配送车辆
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String carNo;
|
||||
|
||||
/**
|
||||
* 主驾司机名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String driveName;
|
||||
|
||||
/**
|
||||
* 副驾司机名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String copilotName;
|
||||
|
||||
/**
|
||||
* 配送时间
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 现场照片
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String arriveImg;
|
||||
|
||||
/**
|
||||
* 完成状态
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer isFinish;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,14 @@ public class LargeScreenEntity
|
|||
*/
|
||||
private Map<String,Object> areaOverview;
|
||||
|
||||
/**
|
||||
* 路线信息
|
||||
*/
|
||||
private List<BizCustomerRoute> routeList;
|
||||
|
||||
/**
|
||||
* 路线下的店铺信息
|
||||
*/
|
||||
private BizCustomerRoute bizCustomerRoute;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,7 @@ public interface StatDriverMapper extends BaseMapper<StatDriver>
|
|||
|
||||
@Select("select t.sumo from (SELECT driver_name,SUM(odometer) sumo FROM `stat_driver` where stat_date >= #{startTime} and stat_date <= #{endTime} GROUP BY driver_name ORDER BY sumo desc limit 5) t")
|
||||
List<Double> selectOdometerTop5Odometer(@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||
|
||||
@Select("SELECT driver_name,SUM(odometer) as odometer,SUM(order_count) as order_count,SUM(online_time) as online_time FROM stat_driver WHERE driver_id = ${driverId}")
|
||||
Map selectSum(Long driverId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.cpxt.biz.service;
|
||||
|
||||
import com.cpxt.biz.domain.StatDriver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 司机统计Service接口
|
||||
|
|
@ -59,4 +59,7 @@ public interface IStatDriverService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteStatDriverById(Long id);
|
||||
|
||||
Map<String,Map<String,Object>> statics(StatDriver statDriver);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,12 +80,12 @@ public class BizCarStateServiceImpl implements IBizCarStateService
|
|||
LambdaQueryWrapper<BizCarState> queryWrapper = buildQueryWrapper(bizCarState);
|
||||
List<BizCarState> bizCarStateList = bizCarStateMapper.selectList(queryWrapper);
|
||||
for (BizCarState carState : bizCarStateList) {
|
||||
Date gpsTime = carState.getGpsTime();
|
||||
// Date gpsTime = carState.getGpsTime();
|
||||
String carNo = carState.getCarNo();
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(BizOrder::getCarNo,carNo);
|
||||
queryWrapper1.in(BizOrder::getOrderStatus,"1","2");
|
||||
queryWrapper1.le(BizOrder::getUpdateTime,gpsTime);
|
||||
// queryWrapper1.le(BizOrder::getUpdateTime,gpsTime);
|
||||
queryWrapper1.orderByDesc(BizOrder::getUpdateTime);
|
||||
queryWrapper1.last("limit 1");
|
||||
BizOrder bizOrder = bizOrderMapper.selectOne(queryWrapper1);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package com.cpxt.biz.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cpxt.biz.domain.StatDriver;
|
||||
import com.cpxt.biz.mapper.StatDriverMapper;
|
||||
import com.cpxt.biz.service.IStatDriverService;
|
||||
import com.cpxt.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -94,4 +95,28 @@ public class StatDriverServiceImpl implements IStatDriverService
|
|||
{
|
||||
return statDriverMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Map<String,Object>> statics(StatDriver statDriver) {
|
||||
String statDate = DateUtil.format(new Date(), DateUtils.YYYY_MM_DD);
|
||||
LambdaQueryWrapper<StatDriver> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StatDriver::getDriverId,statDriver.getDriverId());
|
||||
queryWrapper.eq(StatDriver::getStatDate,statDate);
|
||||
StatDriver driver = statDriverMapper.selectOne(queryWrapper);
|
||||
Map<String,Object> today = new HashMap<>();
|
||||
today.put("driverName",driver.getDriverName());
|
||||
today.put("odometer",driver.getOdometer());
|
||||
today.put("orderCount",driver.getOrderCount());
|
||||
today.put("onlineTime",driver.getOnlineTime());
|
||||
Map<String,Map<String,Object>> result = new HashMap<>();
|
||||
Map map = statDriverMapper.selectSum(statDriver.getDriverId());
|
||||
Map<String,Object> sum = new HashMap<>();
|
||||
today.put("driverName",map.get("driver_name"));
|
||||
today.put("odometer",map.get("odometer"));
|
||||
today.put("orderCount",map.get("order_count"));
|
||||
today.put("onlineTime",map.get("online_time"));
|
||||
result.put("today",today);
|
||||
result.put("sum",sum);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,16 @@ public class SysNotice extends BaseEntity
|
|||
/** 公告状态(0正常 1关闭) */
|
||||
private String status;
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
private String startTime;
|
||||
|
||||
public Long getNoticeId()
|
||||
{
|
||||
return noticeId;
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="noticeTitle != null and noticeTitle != ''">
|
||||
AND notice_title like concat('%', #{noticeTitle}, '%')
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND update_time >= #{startTime}
|
||||
</if>
|
||||
<if test="noticeType != null and noticeType != ''">
|
||||
AND notice_type = #{noticeType}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
AND create_by like concat('%', #{createBy}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue