订单处理
parent
45a402437f
commit
40022006d2
|
|
@ -174,4 +174,24 @@ public class BizOrderController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(bizOrderService.deleteBizOrderByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 去配送
|
||||
*/
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/goDelivery")
|
||||
public AjaxResult goDelivery(@RequestBody Map map) {
|
||||
|
||||
return toAjax(bizOrderService.goDelivery(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 已到达
|
||||
*/
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/arrived")
|
||||
public AjaxResult arrived(@RequestBody Map map) {
|
||||
return toAjax(bizOrderService.arrived(map));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ public class LargeScreenController extends BaseController {
|
|||
@Autowired
|
||||
private BizDriverClockMapper bizDriverClockMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerRouteMapper bizCustomerRouteMapper;
|
||||
@Autowired
|
||||
private BizCustomerWarehouseMapper bizCustomerWarehouseMapper;
|
||||
|
||||
private final String today = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
|
||||
private final LargeScreenEntity largeScreenEntity = new LargeScreenEntity();
|
||||
|
|
@ -112,11 +117,15 @@ public class LargeScreenController extends BaseController {
|
|||
long customer = getCustomer();
|
||||
long shop = getShop();
|
||||
long order = getOrder();
|
||||
long route = getRoute();
|
||||
long warehouse = getWarehouse();
|
||||
largeScreenEntity.setOnDutyDriver(onDutyDriver);
|
||||
largeScreenEntity.setOnDutyCar(onDutyCar);
|
||||
largeScreenEntity.setCustomer(customer);
|
||||
largeScreenEntity.setShop(shop);
|
||||
largeScreenEntity.setOrder(order);
|
||||
largeScreenEntity.setRoute(route);
|
||||
largeScreenEntity.setWarehouse(warehouse);
|
||||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
|
|
@ -173,8 +182,8 @@ public class LargeScreenController extends BaseController {
|
|||
queryWrapper.eq(BizOrder::getStatus,1);
|
||||
queryWrapper.ne(BizOrder::getOrderStatus,"4");
|
||||
queryWrapper.and(wq -> wq.eq(BizOrder::getDriverName,driverName).or().eq(BizOrder::getCopilotName,driverName));
|
||||
queryWrapper.ge(BizOrder::getUpdateTime,startTime);
|
||||
queryWrapper.le(BizOrder::getUpdateTime,endTime);
|
||||
queryWrapper.ge(BizOrder::getCreateTime,startTime);
|
||||
queryWrapper.le(BizOrder::getCreateTime,endTime);
|
||||
Long aLong = bizOrderMapper.selectCount(queryWrapper);
|
||||
map.put(driverName,aLong);
|
||||
}
|
||||
|
|
@ -212,8 +221,8 @@ public class LargeScreenController extends BaseController {
|
|||
queryWrapper.eq(BizOrder::getStatus,1);
|
||||
queryWrapper.ne(BizOrder::getOrderStatus,"3");
|
||||
queryWrapper.and(wq -> wq.eq(BizOrder::getDriverName,driverName).or().eq(BizOrder::getCopilotName,driverName));
|
||||
queryWrapper.ge(BizOrder::getUpdateTime,startTime);
|
||||
queryWrapper.le(BizOrder::getUpdateTime,endTime);
|
||||
queryWrapper.ge(BizOrder::getCreateTime,startTime);
|
||||
queryWrapper.le(BizOrder::getCreateTime,endTime);
|
||||
Double distance = bizOrderMapper.selectSumDistance(queryWrapper);
|
||||
if (distance == null){
|
||||
map.put(driverName, (double) 0);
|
||||
|
|
@ -270,6 +279,17 @@ public class LargeScreenController extends BaseController {
|
|||
return bizCustomerMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
private long getRoute(){
|
||||
LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCustomerRoute::getStatus, 1);
|
||||
return bizCustomerRouteMapper.selectCount(queryWrapper);
|
||||
}
|
||||
private long getWarehouse(){
|
||||
LambdaQueryWrapper<BizCustomerWarehouse> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCustomerWarehouse::getStatus, 1);
|
||||
return bizCustomerWarehouseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
private long getOnDutyCar() {
|
||||
LambdaQueryWrapper<BizCar> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizCar::getStatus,1);
|
||||
|
|
@ -291,7 +311,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
private long getIncompleteOrder(String today) {
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(BizOrder::getUpdateTime, today);
|
||||
queryWrapper.like(BizOrder::getCreateTime, today);
|
||||
queryWrapper.in(BizOrder::getOrderStatus,"1","2");
|
||||
queryWrapper.eq(BizOrder::getStatus,1);
|
||||
return bizOrderMapper.selectCount(queryWrapper);
|
||||
|
|
@ -299,7 +319,7 @@ public class LargeScreenController extends BaseController {
|
|||
|
||||
private long getCompletedOrder(String today) {
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(BizOrder::getUpdateTime,today);
|
||||
queryWrapper.like(BizOrder::getCreateTime,today);
|
||||
queryWrapper.eq(BizOrder::getOrderStatus,"3");
|
||||
queryWrapper.eq(BizOrder::getStatus,1);
|
||||
return bizOrderMapper.selectCount(queryWrapper);
|
||||
|
|
|
|||
|
|
@ -26,4 +26,5 @@ public class SysIndexController
|
|||
{
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,8 +216,8 @@ public class BizOrder
|
|||
private String cancelReason;
|
||||
|
||||
/** 取消时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date cancelTime;
|
||||
|
||||
/** 支付类型 寄付,到付,月结 */
|
||||
|
|
@ -237,8 +237,8 @@ public class BizOrder
|
|||
private Integer payStatus;
|
||||
|
||||
/** 支付时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date payTime;
|
||||
|
||||
/** 状态 */
|
||||
|
|
@ -246,19 +246,23 @@ public class BizOrder
|
|||
private Integer status;
|
||||
|
||||
/** 开始配送时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始配送时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开始配送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 到达时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "到达时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "到达时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date arriveTime;
|
||||
|
||||
/** 到达备注 */
|
||||
@Excel(name = "到达备注")
|
||||
private String arriveRemark;
|
||||
|
||||
/** 现场图片 */
|
||||
@Excel(name = "现场图片")
|
||||
private String arriveImg;
|
||||
|
||||
/** 到达经度 */
|
||||
@Excel(name = "到达经度")
|
||||
private BigDecimal arriveLng;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,12 @@ public class LargeScreenEntity
|
|||
// 配送订单
|
||||
private long order;
|
||||
|
||||
// 配送路线
|
||||
private long route;
|
||||
|
||||
// 仓库
|
||||
private long warehouse;
|
||||
|
||||
|
||||
/**
|
||||
* 订单配送情况
|
||||
|
|
|
|||
|
|
@ -73,4 +73,7 @@ public interface IBizOrderService
|
|||
Page<BizOrder> selectBizOrderPageByDriver(String orderStatus,int pageNum, int pageSize);
|
||||
|
||||
public void insertBizOrderSub(Map map);
|
||||
|
||||
public int goDelivery(Map map);
|
||||
public int arrived(Map map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,11 +61,15 @@ public class BizCustomerShopServiceImpl implements IBizCustomerShopService
|
|||
public List<BizCustomerShop> selectBizCustomerShopList(BizCustomerShop bizCustomerShop)
|
||||
{
|
||||
LambdaQueryWrapper<BizCustomerShop> queryWrapper = buildQueryWrapper(bizCustomerShop);
|
||||
|
||||
return bizCustomerShopMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BizCustomerShop> buildQueryWrapper(BizCustomerShop bizCustomerShop) {
|
||||
LambdaQueryWrapper<BizCustomerShop> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtil.isNotEmpty(bizCustomerShop.getCustomerId())){
|
||||
queryWrapper.eq(BizCustomerShop::getCustomerId, bizCustomerShop.getCustomerId());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(bizCustomerShop.getCustomerName())){
|
||||
queryWrapper.like(BizCustomerShop::getCustomerName, bizCustomerShop.getCustomerName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ public class BizDriverServiceImpl implements IBizDriverService
|
|||
sysUser.setSex(bizDriver.getGender());
|
||||
sysUser.setAvatar(bizDriver.getPhoto());
|
||||
sysUser.setPassword(bizDriver.getPhone().substring(7,11)); // 18756576807
|
||||
sysUser.setAvatar(bizDriver.getPhoto());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.cpxt.biz.domain.vo.BizOrderVo;
|
|||
import com.cpxt.biz.domain.vo.BizOrderVoCustomer;
|
||||
import com.cpxt.biz.mapper.*;
|
||||
import com.cpxt.common.exception.ServiceException;
|
||||
import com.cpxt.common.utils.Helper;
|
||||
import com.cpxt.common.utils.PositionUtil;
|
||||
import com.cpxt.common.utils.SecurityUtils;
|
||||
import com.cpxt.common.utils.StringUtils;
|
||||
|
|
@ -673,4 +674,48 @@ public class BizOrderServiceImpl implements IBizOrderService {
|
|||
}
|
||||
bizOrder.setOrderSn(orderSn);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int goDelivery(Map map){
|
||||
BizDriver bizDriver = bizDriverMapper.selectByUserId(SecurityUtils.getUserId());
|
||||
Long orderId = Helper.FLong(map.get("id"));
|
||||
Long driverId = Helper.FLong(map.get("driverId"));
|
||||
BizOrder order = bizOrderMapper.selectById(orderId);
|
||||
Long warehouseId = order.getWarehouseId();
|
||||
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BizOrder::getStatus,1);
|
||||
queryWrapper.eq(BizOrder::getOrderStatus, 1);
|
||||
queryWrapper.eq(BizOrder::getWarehouseId, warehouseId);
|
||||
queryWrapper.and(wq -> wq.eq(BizOrder::getDriverId,bizDriver.getId()).or().eq(BizOrder::getCopilotId,bizDriver.getId()));
|
||||
int num = 0;
|
||||
List<BizOrder> list = bizOrderMapper.selectList(queryWrapper);
|
||||
for (BizOrder item : list) {
|
||||
BizOrder uorder = new BizOrder();
|
||||
uorder.setId(item.getId());
|
||||
uorder.setOrderSn(item.getOrderSn());
|
||||
uorder.setOrderStatus("2");
|
||||
uorder.setStartTime(new Date());
|
||||
num += bizOrderMapper.updateById(uorder);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
@Override
|
||||
public int arrived(Map map){
|
||||
Long orderId = Helper.FLong(map.get("id"));
|
||||
String img = Helper.NStr(map.get("img"));
|
||||
String remark = Helper.NStr(map.get("remark"));
|
||||
double lat = Helper.FDouble(map.get("lat"));
|
||||
double lng = Helper.FDouble(map.get("lng"));
|
||||
|
||||
BizDriver bizDriver = bizDriverMapper.selectByUserId(SecurityUtils.getUserId());
|
||||
BizOrder order = bizOrderMapper.selectById(orderId);
|
||||
order.setArriveLat(new BigDecimal(lat));
|
||||
order.setArriveLng(new BigDecimal(lng));
|
||||
order.setArriveImg(img);
|
||||
order.setArriveRemark(remark);
|
||||
order.setArriveTime(new Date());
|
||||
return bizOrderMapper.updateById(order);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.awt.*;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.cpxt.biz.domain.BizOrder;
|
||||
|
|
@ -47,7 +48,9 @@ public class BizOrderSubServiceImpl implements IBizOrderSubService
|
|||
public List<BizOrderSub> selectBizOrderSubList(BizOrderSub bizOrderSub)
|
||||
{
|
||||
LambdaQueryWrapper<BizOrderSub> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(bizOrderSub.getOrderSn())) {
|
||||
queryWrapper.like(BizOrderSub::getOrderSn, bizOrderSub.getOrderSn());
|
||||
}
|
||||
return bizOrderSubMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue