修改上下班打卡逻辑
parent
54c939bb30
commit
158514632e
|
|
@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import com.cpxt.biz.domain.BizDriverClock;
|
||||
import com.cpxt.biz.service.IBizDriverClockService;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -84,7 +85,6 @@ public class BizDriverClockController extends BaseController
|
|||
/**
|
||||
* 修改司机打卡记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:clock:edit')")
|
||||
@Log(title = "司机打卡记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BizDriverClock bizDriverClock)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.cpxt.biz.domain.vo.BizCustomerRouteVo;
|
||||
import com.cpxt.biz.domain.vo.BizOrderVo;
|
||||
import com.cpxt.biz.domain.vo.BizOrderVoCustomer;
|
||||
import com.cpxt.common.constant.HttpStatus;
|
||||
|
|
@ -91,6 +92,7 @@ public class BizOrderController extends BaseController {
|
|||
ExcelUtil<BizOrderVo> util = new ExcelUtil<BizOrderVo>(BizOrderVo.class);
|
||||
util.importTemplateExcel(response, "订单数据");
|
||||
} else {
|
||||
|
||||
ExcelUtil<BizOrderVoCustomer> util = new ExcelUtil<BizOrderVoCustomer>(BizOrderVoCustomer.class);
|
||||
util.importTemplateExcel(response, "订单数据");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,9 @@ public class LargeScreenController extends BaseController {
|
|||
@Autowired
|
||||
private BizCustomerShopMapper bizCustomerShopMapper;
|
||||
|
||||
@Autowired
|
||||
private BizDriverClockMapper bizDriverClockMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerRouteMapper bizCustomerRouteMapper;
|
||||
|
||||
@Autowired
|
||||
private BizCustomerWarehouseMapper bizCustomerWarehouseMapper;
|
||||
|
||||
|
|
@ -92,20 +90,6 @@ public class LargeScreenController extends BaseController {
|
|||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机提醒
|
||||
*/
|
||||
@GetMapping("/driver/remind")
|
||||
public AjaxResult driverRemind()
|
||||
{
|
||||
List<BizDriverClock> bizDriverClockList = getBizDriverClockList(today);
|
||||
for (BizDriverClock bizDriverClock : bizDriverClockList) {
|
||||
bizDriverClock.setDriverName(bizDriverMapper.selectById(bizDriverClock.getDriverId()).getName());
|
||||
}
|
||||
largeScreenEntity.setBizDriverClockList(bizDriverClockList);
|
||||
return AjaxResult.success(largeScreenEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总体概览
|
||||
*/
|
||||
|
|
@ -302,13 +286,6 @@ public class LargeScreenController extends BaseController {
|
|||
return bizDriverMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
private List<BizDriverClock> getBizDriverClockList(String today) {
|
||||
LambdaQueryWrapper<BizDriverClock> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(BizDriverClock::getClockTime,today);
|
||||
queryWrapper.eq(BizDriverClock::getStatus,1);
|
||||
return bizDriverClockMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
private long getIncompleteOrder(String today) {
|
||||
LambdaQueryWrapper<BizOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(BizOrder::getCreateTime, today);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.cpxt.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cpxt.common.annotation.Anonymous;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -44,6 +47,16 @@ public class SysNoticeController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通知公告列表(不分页)
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/list2")
|
||||
public AjaxResult list2(SysNotice notice)
|
||||
{
|
||||
return AjaxResult.success(noticeService.selectNoticeList(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.cpxt.biz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
|
@ -8,6 +9,7 @@ import com.cpxt.common.annotation.Excel;
|
|||
import com.cpxt.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 司机对象 biz_driver
|
||||
|
|
@ -97,4 +99,7 @@ public class BizDriver
|
|||
/** 在线状态 1 在线 0 离线 */
|
||||
private Integer onlineStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BizDriverClock> bizDriverClockList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,29 +28,41 @@ public class BizDriverClock
|
|||
@Excel(name = "司机ID")
|
||||
private Long driverId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String driverName;
|
||||
|
||||
/** 打卡类型 上班 下班 */
|
||||
@Excel(name = "打卡类型 上班 下班")
|
||||
private Integer clockType;
|
||||
|
||||
/** 打卡时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date clockTime;
|
||||
|
||||
/** 打卡车辆 */
|
||||
@Excel(name = "打卡车辆")
|
||||
private Long clockCarId;
|
||||
private Long carId;
|
||||
|
||||
/** 打卡车牌号 */
|
||||
@Excel(name = "打卡车牌号")
|
||||
private String clockCarNo;
|
||||
private String carNo;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String driverName;
|
||||
|
||||
/** 上班打卡时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "上班打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onTime;
|
||||
|
||||
/** 打卡照片 */
|
||||
@Excel(name = "打卡照片")
|
||||
private String clockImg;
|
||||
@Excel(name = "上班打卡照片")
|
||||
private String onImg;
|
||||
|
||||
/** 上班打卡说明 */
|
||||
private String onRemark;
|
||||
|
||||
/** 下班打卡时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下班打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date offTime;
|
||||
|
||||
/** 下班打卡照片 */
|
||||
@Excel(name = "下班打卡照片")
|
||||
private String offImg;
|
||||
|
||||
/** 下班打卡说明 */
|
||||
private String offRemark;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
|
|
@ -64,6 +76,5 @@ public class BizDriverClock
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.cpxt.biz.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.cpxt.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路线对象 biz_customer_route
|
||||
*
|
||||
* @author YIN
|
||||
* @date 2024-12-16
|
||||
*/
|
||||
@Data
|
||||
public class BizCustomerRouteVo
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户ID */
|
||||
// @Excel(name = "客户ID")
|
||||
private Long customerId;
|
||||
|
||||
/** 客户名称 */
|
||||
// @Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 路线名称 */
|
||||
@Excel(name = "路线名称")
|
||||
private String name;
|
||||
|
||||
/** 状态 */
|
||||
// @Excel(name = "状态")
|
||||
private Integer status;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// @Excel(name = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
// @Excel(name = "更新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Long> shops;
|
||||
}
|
||||
|
|
@ -77,14 +77,14 @@ public class BizDriverClockServiceImpl implements IBizDriverClockService
|
|||
List<BizOrder> bizOrderList = bizOrderMapper.selectList(queryWrapper);
|
||||
if (bizOrderList.size() > 0){
|
||||
for (BizOrder bizOrder : bizOrderList) {
|
||||
bizOrder.setCarId(bizDriverClock.getClockCarId());
|
||||
bizOrder.setCarNo(bizDriverClock.getClockCarNo());
|
||||
bizOrder.setCarId(bizDriverClock.getCarId());
|
||||
bizOrder.setCarNo(bizDriverClock.getCarNo());
|
||||
bizOrderMapper.updateById(bizOrder);
|
||||
}
|
||||
}
|
||||
// 2、上班打卡修改司机的状态为在线 下班打卡修改司机的状态为离线
|
||||
// 2、上班打卡修改司机的状态为在线
|
||||
BizDriver bizDriver = bizDriverMapper.selectById(bizDriverClock.getDriverId());
|
||||
bizDriver.setOnlineStatus(bizDriverClock.getClockType());
|
||||
bizDriver.setOnlineStatus(1);
|
||||
bizDriverMapper.updateById(bizDriver);
|
||||
return bizDriverClockMapper.insert(bizDriverClock);
|
||||
}
|
||||
|
|
@ -96,8 +96,13 @@ public class BizDriverClockServiceImpl implements IBizDriverClockService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateBizDriverClock(BizDriverClock bizDriverClock)
|
||||
{
|
||||
// 同步修改司机的状态为离线
|
||||
BizDriver bizDriver = bizDriverMapper.selectById(bizDriverClock.getDriverId());
|
||||
bizDriver.setOnlineStatus(0);
|
||||
bizDriverMapper.updateById(bizDriver);
|
||||
return bizDriverClockMapper.updateById(bizDriverClock);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ 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.BizCustomerWarehouse;
|
||||
import com.cpxt.biz.domain.BizDriverClock;
|
||||
import com.cpxt.biz.mapper.BizDriverClockMapper;
|
||||
import com.cpxt.common.core.domain.entity.SysDept;
|
||||
import com.cpxt.common.core.domain.entity.SysUser;
|
||||
import com.cpxt.common.utils.DateUtils;
|
||||
|
|
@ -34,6 +36,9 @@ public class BizDriverServiceImpl implements IBizDriverService
|
|||
@Autowired
|
||||
private BizDriverMapper bizDriverMapper;
|
||||
|
||||
@Autowired
|
||||
private BizDriverClockMapper bizDriverClockMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
|
|
@ -65,7 +70,16 @@ public class BizDriverServiceImpl implements IBizDriverService
|
|||
public List<BizDriver> selectBizDriverList(BizDriver bizDriver)
|
||||
{
|
||||
LambdaQueryWrapper<BizDriver> queryWrapper = buildQueryWrapper(bizDriver);
|
||||
return bizDriverMapper.selectList(queryWrapper);
|
||||
List<BizDriver> bizDrivers = bizDriverMapper.selectList(queryWrapper);
|
||||
for (BizDriver driver : bizDrivers) {
|
||||
LambdaQueryWrapper<BizDriverClock> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(BizDriverClock::getDriverId,driver.getId());
|
||||
queryWrapper1.orderByDesc(BizDriverClock::getUpdateTime);
|
||||
queryWrapper1.last("limit 1");
|
||||
List<BizDriverClock> driverClockList = bizDriverClockMapper.selectList(queryWrapper1);
|
||||
driver.setBizDriverClockList(driverClockList);
|
||||
}
|
||||
return bizDrivers;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BizDriver> buildQueryWrapper(BizDriver bizDriver) {
|
||||
|
|
|
|||
|
|
@ -286,10 +286,12 @@ public class BizOrderServiceImpl implements IBizOrderService {
|
|||
queryWrapper.eq(BizOrder::getArriveLat, bizOrder.getArriveLat());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(bizOrder.getBeginTime())){
|
||||
queryWrapper.ge(BizOrder::getCreateTime,bizOrder.getBeginTime());
|
||||
String beginTime = bizOrder.getBeginTime() + " 00:00:00";
|
||||
queryWrapper.ge(BizOrder::getCreateTime,beginTime);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(bizOrder.getEndTime())){
|
||||
queryWrapper.le(BizOrder::getCreateTime,bizOrder.getEndTime());
|
||||
String endTime = bizOrder.getEndTime() + " 23:59:59";
|
||||
queryWrapper.le(BizOrder::getCreateTime,endTime);
|
||||
}
|
||||
queryWrapper.orderByDesc(BizOrder::getCreateTime);
|
||||
queryWrapper.eq(BizOrder::getStatus, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue