| | |
| | | private CarInsuranceMapper carInsuranceMapper; |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | |
| | | }).start(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/update1") |
| | | @ResponseBody |
| | | public Object update1(TCar tCar,String bindDriverId) { |
| | |
| | | if(bindDriverId==null){ |
| | | bindDriverId=""; |
| | | } |
| | | List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("carId", tCar.getId()).ne("flag", 3)); |
| | | for (TDriver tDriver : tDrivers) { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", tDriver.getId()).eq("state", 1)); |
| | | if(null != driverWork){ |
| | | return new ErrorTip(500, tDriver.getName() + "司机正在上班中,不能取消授权"); |
| | | }else{ |
| | | tDriver.setCarId(null); |
| | | driverService.updateAllColumnById(tDriver); |
| | | } |
| | | } |
| | | obj.setBindDriverId(bindDriverId); |
| | | tCarService.updateById(obj); |
| | | return SUCCESS_TIP; |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.DriverWork; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface DriverWorkMapper extends BaseMapper<DriverWork> { |
| | | |
| | | |
| | | /** |
| | | * 获取司机最新上班数据(还未下班的) |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | DriverWork queryNewWork(@Param("driverId") Integer driverId, @Param("type") Integer type, |
| | | @Param("state") Integer state); |
| | | |
| | | |
| | | /** |
| | | * 获取在线时间大于time的数据,且当前为在线状态 |
| | | * @param type |
| | | * @param time 小时 |
| | | * @return |
| | | */ |
| | | List<DriverWork> query(@Param("type") Integer type, @Param("time") Integer time); |
| | | } |
New 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.stylefeng.guns.modular.system.dao.DriverWorkMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.DriverWork"> |
| | | <id column="id" property="id" /> |
| | | <result column="driverId" property="driverId" /> |
| | | <result column="startTime" property="startTime" /> |
| | | <result column="endTime" property="endTime" /> |
| | | <result column="type" property="type" /> |
| | | <result column="state" property="state" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryNewWork" resultType="DriverWork"> |
| | | select |
| | | id as id, |
| | | driverId as driverId, |
| | | startTime as startTime, |
| | | endTime as endTime, |
| | | `type` as `type`, |
| | | state as state |
| | | from t_driver_work where 1 = 1 |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | <if test="null != type"> |
| | | and type like CONCAT('%', #{type}, '%') |
| | | </if> |
| | | <if test="null != state"> |
| | | and state = #{state} |
| | | </if> |
| | | order by startTime desc limit 0,1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="query" resultType="DriverWork"> |
| | | select |
| | | id as id, |
| | | driverId as driverId, |
| | | startTime as startTime, |
| | | endTime as endTime, |
| | | `type` as `type`, |
| | | state as state |
| | | from t_driver_work where `type` like CONCAT('%', #{type}, '%') |
| | | and (unix_timestamp(if(endTime is null , now(), endTime))) - |
| | | unix_timestamp(IF((DATE_FORMAT(now(), '%Y-%m-%d') != DATE_FORMAT(startTime, '%Y-%m-%d')), STR_TO_DATE(CONCAT(DATE_FORMAT(now(), '%Y-%m-%d'),' ','00:00:00'), '%Y-%m-%d %H:%i:%s'), startTime)) > (#{time} * 60 * 60) |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * 司机上下班记录 |
| | | */ |
| | | @TableName("t_driver_work") |
| | | public class DriverWork { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 上班时间 |
| | | */ |
| | | @TableField("startTime") |
| | | private Date startTime; |
| | | /** |
| | | * 下班时间 |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | */ |
| | | @TableField("type") |
| | | private String type; |
| | | /** |
| | | * 上下班状态(1=上班,2=下班) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "DriverWork{" + |
| | | "id=" + id + |
| | | ", driverId=" + driverId + |
| | | ", startTime=" + startTime + |
| | | ", endTime=" + endTime + |
| | | ", type=" + type + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.DriverWork; |
| | | |
| | | public interface IDriverWorkService extends IService<DriverWork> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.DriverWorkMapper; |
| | | import com.stylefeng.guns.modular.system.model.DriverWork; |
| | | import com.stylefeng.guns.modular.system.service.IDriverWorkService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class DriverWorkServiceImpl extends ServiceImpl<DriverWorkMapper, DriverWork> implements IDriverWorkService { |
| | | } |
| | |
| | | } |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tCar/update1", function(data){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.TCar.table.refresh(); |
| | | TCarInfoDlg.close(); |
| | | if(200 == data.code){ |
| | | Feng.success("修改成功!"); |
| | | window.parent.TCar.table.refresh(); |
| | | TCarInfoDlg.close(); |
| | | }else{ |
| | | Feng.error(data.message); |
| | | } |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |