浏览代码

1.完成上传日志。
2.完成下发命令及上传结果。
3.乘客打卡增加上传人脸库编号。

zhengqiang 4 年之前
父节点
当前提交
443d6dc2fb

+ 6 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/PassengerDetailDTO.java

@@ -19,6 +19,12 @@ public class PassengerDetailDTO {
 
     private String id;
 
+    private String vehicleShiftId;
+
+    private Long vehicleLibId;
+
+    private Long vehiclePersonId;
+
     private String imageUrl;
 
     private String upStationId;

+ 3 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/entity/PassengerInfo.java

@@ -21,7 +21,9 @@ public class PassengerInfo {
     private String id;
     @ApiModelProperty(value = "车辆班次编号")
     private String vehicleShiftId;
-    @ApiModelProperty(value = "车辆人员设备编号")
+    @ApiModelProperty(value = "车辆人员库编号")
+    private Long vehicleLibId;
+    @ApiModelProperty(value = "车辆人员编号")
     private Long vehiclePersonId;
     @ApiModelProperty(value = "注册用户编号")
     private Long userId;

+ 1 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/PassengerInfoService.java

@@ -22,7 +22,7 @@ public interface PassengerInfoService {
 
 	List<PassengerInfo> findByPersonIdShiftIdStatus(Long personId,String shiftId,String status);
 
-    void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId,String personId) throws Exception;
+    void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId,Long libId,Long personId) throws Exception;
 
 	DriverBuyTicketDTO driverBuyTicket(PassengerInfo passengerInfo, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee, String payName,String paymentId) throws Exception;
 

+ 14 - 12
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java

@@ -116,11 +116,12 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
     }
 
     @Override
-    public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime, String stationId, String personId) throws Exception {
+    public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime,
+                              String stationId,Long libId, Long personId) throws Exception {
         Date recordDate = DateUtil.parse(recordTime, "yyyy-MM-dd HH:mm:ss");
 
         //查询是否有已上车的乘客记录
-        List<PassengerInfo> passengerInfoList = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "1");
+        List<PassengerInfo> passengerInfoList = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "1");
 
         if (passengerInfoList.size() > 0) {
             PassengerInfo passengerInfo = passengerInfoList.get(0);
@@ -130,12 +131,13 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
             update(passengerInfo);
         } else {
             //查询此班次是否有已下车的记录
-            List<PassengerInfo> passengerInfoList1 = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "2");
+            List<PassengerInfo> passengerInfoList1 = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "2");
             if (passengerInfoList1.size() == 0) {
                 PassengerInfo passengerInfo = new PassengerInfo();
                 passengerInfo.setId(UUID.randomUUID().toString());
                 passengerInfo.setVehicleShiftId(shiftInfo.getId());
-                passengerInfo.setVehiclePersonId(Long.parseLong(personId));
+                passengerInfo.setVehicleLibId(libId);
+                passengerInfo.setVehiclePersonId(personId);
                 passengerInfo.setUpTime(recordDate);
                 passengerInfo.setUpStationId(stationId);
                 passengerInfo.setStatus("1");
@@ -146,7 +148,7 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
                     passengerInfo.setImageUrl(retFileUrl);
                 } else {
                     //如果没有上车记录,但有已下车记录,则读取之前记录的头像信息
-                    List<PassengerInfo> downList = findByPersonIdShiftIdStatus(Long.parseLong(personId), shiftInfo.getId(), "2");
+                    List<PassengerInfo> downList = findByPersonIdShiftIdStatus(personId, shiftInfo.getId(), "2");
 
                     if (downList.size() > 0) {
                         passengerInfo.setImageUrl(downList.get(0).getImageUrl());
@@ -155,13 +157,13 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
 
                 insert(passengerInfo);
 
-                String groupId = CommonUtil.getProvinceNum(vehicleInfo.getLicensePlateNumber()) + StrUtil.sub(vehicleInfo.getLicensePlateNumber(), 1, 10);
-
-                if (StringUtils.isNotEmpty(groupId)) {
-                    //将图片上传到百度AI人脸识别,  userInfo 1:司机,2:乘客
-                    baiduService.faceUserAdd(retFileUrl, groupId, personId, "2");
-                }
-
+                //暂时不进行服务端人脸比对
+//                String groupId = CommonUtil.getProvinceNum(vehicleInfo.getLicensePlateNumber()) + StrUtil.sub(vehicleInfo.getLicensePlateNumber(), 1, 10);
+//
+//                if (StringUtils.isNotEmpty(groupId)) {
+//                    //将图片上传到百度AI人脸识别,  userInfo 1:司机,2:乘客
+//                    baiduService.faceUserAdd(retFileUrl, groupId, String.valueOf(personId), "2");
+//                }
             } else {
                 PassengerInfo passengerInfo = passengerInfoList1.get(0);
                 passengerInfo.setStatus("1");

+ 130 - 0
common/src/main/resources/mapper/bus/DeviceCmdInfo.xml

@@ -0,0 +1,130 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.bus.modules.bus.dao.DeviceCmdInfoDAO">
+    <resultMap id="DeviceCmdInfoMap" type="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        <id property="id" column="id_"/>
+        <result property="licensePlateNumber" column="license_plate_number"/>
+        <result property="deviceIP" column="device_ip"/>
+        <result property="url" column="url_"/>
+        <result property="method" column="method_"/>
+        <result property="requestBody" column="request_body"/>
+        <result property="responseText" column="response_text"/>
+        <result property="responseCode" column="response_code"/>
+        <result property="status" column="status_"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into bus_device_cmd_info
+	    (id_,license_plate_number,device_ip,url_,method_,request_body,response_text,response_code,status_,create_time,create_by,update_time,update_by,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{licensePlateNumber,jdbcType=VARCHAR}
+,#{deviceIP,jdbcType=VARCHAR}
+,#{url,jdbcType=VARCHAR}
+,#{method,jdbcType=VARCHAR}
+,#{requestBody,jdbcType=VARCHAR}
+,#{responseText,jdbcType=VARCHAR}
+,#{responseCode,jdbcType= NUMERIC }
+,#{status,jdbcType= NUMERIC }
+,#{createTime,jdbcType= TIMESTAMP }
+,#{createBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_device_cmd_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo">
+        update bus_device_cmd_info
+        <set>
+            <if test="licensePlateNumber!=null">
+                license_plate_number=#{licensePlateNumber,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceIP!=null">
+                device_ip=#{deviceIP,jdbcType=VARCHAR},
+            </if>
+            <if test="url!=null">
+                url_=#{url,jdbcType=VARCHAR},
+            </if>
+            <if test="method!=null">
+                method_=#{method,jdbcType=VARCHAR},
+            </if>
+            <if test="requestBody!=null">
+                request_body=#{requestBody,jdbcType=VARCHAR},
+            </if>
+            <if test="responseText!=null">
+                response_text=#{responseText,jdbcType=VARCHAR},
+            </if>
+            <if test="responseCode!=null">
+                response_code=#{responseCode,jdbcType= NUMERIC },
+            </if>
+            <if test="status!=null">
+                status_=#{status,jdbcType= NUMERIC },
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="DeviceCmdInfoMap">
+        select
+        id_,license_plate_number,device_ip,url_,method_,request_body,response_text,response_code,status_,create_time,create_by,update_time,update_by,del_flag
+        from bus_device_cmd_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_device_cmd_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="DeviceCmdInfoMap">
+        select * from bus_device_cmd_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DeviceCmdInfoMap">
+        <![CDATA[
+			select * from bus_device_cmd_info
+		]]>
+        <where>
+            <if test="searchParams.id != null">
+                and ID_ like #{searchParams.id}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+    <select id="findByLicensePlateNumber" resultMap="DeviceCmdInfoMap">
+        select * from bus_device_cmd_info
+        where license_plate_number = #{licensePlateNumber}
+        and del_flag=0
+        and status_=0
+        order by create_time asc
+        limit ${limit}
+    </select>
+</mapper>

+ 109 - 0
common/src/main/resources/mapper/bus/DeviceLogInfo.xml

@@ -0,0 +1,109 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.bus.modules.bus.dao.DeviceLogInfoDAO">
+    <resultMap id="DeviceLogInfoMap" type="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        <id property="id" column="id_"/>
+        <result property="licensePlateNumber" column="license_plate_number"/>
+        <result property="deviceIP" column="device_ip"/>
+        <result property="tag" column="tag_"/>
+        <result property="content" column="content_"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="recordTime" column="record_time"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
+		insert into bus_device_log_info
+	    (id_,license_plate_number,device_ip,tag_,content_,create_by,create_time,update_by,update_time,del_flag,record_time)
+		values
+		(
+            #{id,jdbcType=VARCHAR}
+            ,#{licensePlateNumber,jdbcType=VARCHAR}
+            ,#{deviceIP,jdbcType=VARCHAR}
+            ,#{tag,jdbcType=VARCHAR}
+            ,#{content,jdbcType=VARCHAR}
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{createTime,jdbcType= TIMESTAMP }
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{updateTime,jdbcType= TIMESTAMP }
+            ,#{delFlag,jdbcType= NUMERIC }
+            ,#{recordTime,jdbcType= TIMESTAMP }
+		)
+	]]>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_device_log_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.DeviceLogInfo">
+        update bus_device_log_info
+        <set>
+            <if test="licensePlateNumber!=null">
+                license_plate_number=#{licensePlateNumber,jdbcType=VARCHAR},
+            </if>
+            <if test="deviceIP!=null">
+                device_ip=#{deviceIP,jdbcType=VARCHAR},
+            </if>
+            <if test="tag!=null">
+                tag_=#{tag,jdbcType=VARCHAR},
+            </if>
+            <if test="content!=null">
+                content_=#{content,jdbcType=VARCHAR},
+            </if>
+            <if test="recordTime!=null">
+                record_time=#{recordTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="DeviceLogInfoMap">
+        select
+        id_,license_plate_number,device_ip,tag_,content_,create_by,create_time,
+        update_by,update_time,del_flag,record_time
+        from
+        bus_device_log_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_device_log_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="DeviceLogInfoMap">
+        select * from bus_device_log_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DeviceLogInfoMap">
+        <![CDATA[
+			select * from bus_device_log_info
+		]]>
+        <where>
+            <if test="searchParams.id != null">
+                and ID_ like #{searchParams.id}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
+</mapper>

+ 179 - 173
common/src/main/resources/mapper/bus/PassengerInfo.xml

@@ -1,137 +1,143 @@
 <?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">
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.bus.modules.bus.dao.PassengerInfoDAO">
-	<resultMap id="PassengerInfoMap" type="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-		<id property="id" column="id_" />
-			<result property="vehicleShiftId" column="vehicle_shift_id" />
-			<result property="vehiclePersonId" column="vehicle_person_id" />
-			<result property="userId" column="user_id" />
-			<result property="imageUrl" column="image_url" />
-			<result property="upTime" column="up_time" />
-			<result property="downTime" column="down_time" />
-			<result property="upStationId" column="up_station_id" />
-			<result property="downStationId" column="down_station_id" />
-			<result property="upStationName" column="up_station_name"/>
-			<result property="downStationName" column="down_station_name"/>
-			<result property="status" column="status_" />
-			<result property="payStatus" column="pay_status" />
-			<result property="createBy" column="create_by" />
-			<result property="createTime" column="create_time" />
-			<result property="updateBy" column="update_by" />
-			<result property="updateTime" column="update_time" />
-			<result property="delFlag" column="del_flag" />
-			<result property="userName" column="user_name" />
-			<result property="ticketUpStationId" column="ticket_up_station_id"/>
-			<result property="ticketDownStationId" column="ticket_down_station_id"/>
-			<result property="ticketUpStationName" column="ticket_up_station_name"/>
-			<result property="ticketDownStationName" column="ticket_down_station_name"/>
-			</resultMap>
-	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="PassengerInfoMap" type="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        <id property="id" column="id_"/>
+        <result property="vehicleShiftId" column="vehicle_shift_id"/>
+        <result property="vehicleLibId" column="vehicle_lib_id"/>
+        <result property="vehiclePersonId" column="vehicle_person_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="imageUrl" column="image_url"/>
+        <result property="upTime" column="up_time"/>
+        <result property="downTime" column="down_time"/>
+        <result property="upStationId" column="up_station_id"/>
+        <result property="downStationId" column="down_station_id"/>
+        <result property="upStationName" column="up_station_name"/>
+        <result property="downStationName" column="down_station_name"/>
+        <result property="status" column="status_"/>
+        <result property="payStatus" column="pay_status"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="userName" column="user_name"/>
+        <result property="ticketUpStationId" column="ticket_up_station_id"/>
+        <result property="ticketDownStationId" column="ticket_down_station_id"/>
+        <result property="ticketUpStationName" column="ticket_up_station_name"/>
+        <result property="ticketDownStationName" column="ticket_down_station_name"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into bus_passenger_info
-	    (id_,vehicle_shift_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag,ticket_up_station_id,ticket_down_station_id)
+	    (id_,vehicle_shift_id,vehicle_lib_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,
+	    down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag,ticket_up_station_id,ticket_down_station_id)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{vehicleShiftId,jdbcType=VARCHAR}
-,#{vehiclePersonId,jdbcType= NUMERIC }
-,#{userId,jdbcType= NUMERIC }
-,#{imageUrl,jdbcType=VARCHAR}
-,#{upTime,jdbcType= TIMESTAMP }
-,#{downTime,jdbcType= TIMESTAMP }
-,#{upStationId,jdbcType=VARCHAR}
-,#{downStationId,jdbcType=VARCHAR}
-,#{status,jdbcType=VARCHAR}
-,#{payStatus,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
-,#{ticketUpStationId,jdbcType=VARCHAR}
-,#{ticketDownStationId,jdbcType=VARCHAR}
+			#{id,jdbcType=VARCHAR}
+			,#{vehicleShiftId,jdbcType=VARCHAR}
+			,#{vehicleLibId,jdbcType= NUMERIC}
+			,#{vehiclePersonId,jdbcType= NUMERIC}
+			,#{userId,jdbcType= NUMERIC}
+			,#{imageUrl,jdbcType=VARCHAR}
+			,#{upTime,jdbcType= TIMESTAMP }
+			,#{downTime,jdbcType= TIMESTAMP }
+			,#{upStationId,jdbcType=VARCHAR}
+			,#{downStationId,jdbcType=VARCHAR}
+			,#{status,jdbcType=VARCHAR}
+			,#{payStatus,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
+			,#{ticketUpStationId,jdbcType=VARCHAR}
+			,#{ticketDownStationId,jdbcType=VARCHAR}
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from bus_passenger_info where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
-		update bus_passenger_info
-		<set>
-				<if test="vehicleShiftId!=null">
-		vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
-		</if>
-				<if test="vehiclePersonId!=null">
-		vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
-		</if>
-				<if test="userId!=null">
-		user_id=#{userId,jdbcType= NUMERIC },
-		</if>
-				<if test="imageUrl!=null">
-		image_url=#{imageUrl,jdbcType=VARCHAR},
-		</if>
-				<if test="upTime!=null">
-		up_time=#{upTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="downTime!=null">
-		down_time=#{downTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="upStationId!=null">
-		up_station_id=#{upStationId,jdbcType=VARCHAR},
-		</if>
-				<if test="downStationId!=null">
-		down_station_id=#{downStationId,jdbcType=VARCHAR},
-		</if>
-				<if test="status!=null">
-		status_=#{status,jdbcType=VARCHAR},
-		</if>
-				<if test="payStatus!=null">
-		pay_status=#{payStatus,jdbcType=VARCHAR},
-		</if>
-				<if test="createBy!=null">
-		create_by=#{createBy,jdbcType=VARCHAR},
-		</if>
-				<if test="createTime!=null">
-		create_time=#{createTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="updateBy!=null">
-		update_by=#{updateBy,jdbcType=VARCHAR},
-		</if>
-				<if test="updateTime!=null">
-		update_time=#{updateTime,jdbcType= TIMESTAMP },
-		</if>
-				<if test="delFlag!=null">
-		del_flag=#{delFlag,jdbcType= NUMERIC },
-		</if>
-			<if test="ticketUpStationId!=null">
-				ticket_up_station_id=#{ticketUpStationId,jdbcType=VARCHAR},
-			</if>
-			<if test="ticketDownStationId!=null">
-				ticket_down_station_id=#{ticketDownStationId,jdbcType=VARCHAR},
-			</if>
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from bus_passenger_info where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
+        update bus_passenger_info
+        <set>
+            <if test="vehicleShiftId!=null">
+                vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
+            </if>
+            <if test="vehicleLibId!=null">
+                vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
+            </if>
+            <if test="vehiclePersonId!=null">
+                vehicle_person_id=#{vehiclePersonId,jdbcType= NUMERIC },
+            </if>
+            <if test="userId!=null">
+                user_id=#{userId,jdbcType= NUMERIC },
+            </if>
+            <if test="imageUrl!=null">
+                image_url=#{imageUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="upTime!=null">
+                up_time=#{upTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="downTime!=null">
+                down_time=#{downTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="upStationId!=null">
+                up_station_id=#{upStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="downStationId!=null">
+                down_station_id=#{downStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="status!=null">
+                status_=#{status,jdbcType=VARCHAR},
+            </if>
+            <if test="payStatus!=null">
+                pay_status=#{payStatus,jdbcType=VARCHAR},
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime!=null">
+                create_time=#{createTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime!=null">
+                update_time=#{updateTime,jdbcType= TIMESTAMP },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+            <if test="ticketUpStationId!=null">
+                ticket_up_station_id=#{ticketUpStationId,jdbcType=VARCHAR},
+            </if>
+            <if test="ticketDownStationId!=null">
+                ticket_down_station_id=#{ticketDownStationId,jdbcType=VARCHAR},
+            </if>
 
-		</set>
-	where id_=#{id}
-	</update>
-	<select id="get" parameterType="string" resultMap="PassengerInfoMap">
-		select * from bus_passenger_info where id_=#{0}
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from bus_passenger_info where id_=#{0}
-	</select>
-	<select id="list" resultMap="PassengerInfoMap">
-		select * from bus_passenger_info
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="PassengerInfoMap">
-		<![CDATA[
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="PassengerInfoMap">
+        select * from bus_passenger_info where id_=#{0}
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from bus_passenger_info where id_=#{0}
+    </select>
+    <select id="list" resultMap="PassengerInfoMap">
+        select * from bus_passenger_info
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="PassengerInfoMap">
+        <![CDATA[
 			SELECT
 				a.*,
 				b.name_ AS user_name,
@@ -147,61 +153,61 @@
 				LEFT JOIN bus_station_info e ON a.ticket_up_station_id = e.id_
 				LEFT JOIN bus_station_info f ON a.ticket_down_station_id = f.id_
 		]]>
-		<where>
-			a.del_flag = 0
-			<if test="searchParams.id != null">
-				and a.ID_ like #{searchParams.id}
-			</if>
-			<if test="searchParams.vehiclePersonId != null">
-				and a.vehicle_person_id = #{searchParams.vehiclePersonId}
-			</if>
-			<if test="searchParams.userId != null">
-				and a.user_id = #{searchParams.userId
-			</if>
-			<if test="searchParams.userName != null">
-				and b.name_ like #{searchParams.userName}
-			</if>
-			<if test="searchParams.payStatus != null">
-				and a.pay_status = #{searchParams.payStatus}
-			</if>
-			<if test="searchParams.vehicleShiftId != null">
-				and a.vehicle_shift_id = #{searchParams.vehicleShiftId}
-			</if>
-			<if test="searchParams.status != null">
-				and a.status_ = #{searchParams.status}
-			</if>
-			<if test="searchParams.statusList != null">
-				and a.status_ in
-				<foreach collection="searchParams.statusList" item="status" open="(" separator="," close=")">
-					#{status}
-				</foreach>
-			</if>
-			<if test="searchParams.notPayStatus != null">
-				and a.pay_status != #{searchParams.notPayStatus}
-			</if>
-			<if test="searchParams.downStationId != null">
-				and a.down_station_id = #{searchParams.downStationId}
-			</if>
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
+        <where>
+            a.del_flag = 0
+            <if test="searchParams.id != null">
+                and a.ID_ like #{searchParams.id}
+            </if>
+            <if test="searchParams.vehiclePersonId != null">
+                and a.vehicle_person_id = #{searchParams.vehiclePersonId}
+            </if>
+            <if test="searchParams.userId != null">
+                and a.user_id = #{searchParams.userId
+            </if>
+            <if test="searchParams.userName != null">
+                and b.name_ like #{searchParams.userName}
+            </if>
+            <if test="searchParams.payStatus != null">
+                and a.pay_status = #{searchParams.payStatus}
+            </if>
+            <if test="searchParams.vehicleShiftId != null">
+                and a.vehicle_shift_id = #{searchParams.vehicleShiftId}
+            </if>
+            <if test="searchParams.status != null">
+                and a.status_ = #{searchParams.status}
+            </if>
+            <if test="searchParams.statusList != null">
+                and a.status_ in
+                <foreach collection="searchParams.statusList" item="status" open="(" separator="," close=")">
+                    #{status}
+                </foreach>
+            </if>
+            <if test="searchParams.notPayStatus != null">
+                and a.pay_status != #{searchParams.notPayStatus}
+            </if>
+            <if test="searchParams.downStationId != null">
+                and a.down_station_id = #{searchParams.downStationId}
+            </if>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
 
-	<select id="findByPersonIdShiftIdStatus" resultMap="PassengerInfoMap">
-		<![CDATA[
+    <select id="findByPersonIdShiftIdStatus" resultMap="PassengerInfoMap">
+        <![CDATA[
 		select * from bus_passenger_info
 		where del_flag = 0
 		and vehicle_person_id = #{personId}
 		and vehicle_shift_id = #{shiftId}
 		]]>
-		<if test="status!=null">
-			and status_ = #{status}
-		</if>
-	</select>
+        <if test="status!=null">
+            and status_ = #{status}
+        </if>
+    </select>
 
-	<select id="findByShiftStatusPayStatusNotTicketDown" resultMap="PassengerInfoMap">
-		<![CDATA[
+    <select id="findByShiftStatusPayStatusNotTicketDown" resultMap="PassengerInfoMap">
+        <![CDATA[
 		select  * from bus_passenger_info
 		where del_flag = 0
 		and vehicle_shift_id = #{shiftId}
@@ -209,5 +215,5 @@
 		and pay_status = #{payStatus}
 		and ticket_down_station_id <> #{ticketDownStationId}
 		]]>
-	</select>
+    </select>
 </mapper>

+ 1 - 1
common/src/main/resources/mapper/sys/DataDictionary.xml

@@ -202,10 +202,10 @@
     </select>
     <select id="findByName" resultMap="DataDictionaryMap">
         <![CDATA[
-
         select * from sys_data_dictionary
         where del_flag = 0
         and name_ = #{0}
+        limit 1
         ]]>
     </select>
 </mapper>

+ 1 - 0
web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java

@@ -75,6 +75,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/passengerApi/routeDetail")
 				.excludePathPatterns("/aliPay/**")
 				.excludePathPatterns("/wxPay/**")
+				.excludePathPatterns("/bus/deviceCmdApi/queryPadLatestVersion")
 				;
 	}
 }

+ 126 - 0
web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceCmdApiController.java

@@ -0,0 +1,126 @@
+package com.jpsoft.bus.modules.device.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.jpsoft.bus.modules.bus.entity.DeviceCmdInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceCmdInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.sys.entity.DataDictionary;
+import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/bus/deviceCmdApi")
+@Slf4j
+public class DeviceCmdApiController {
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private DeviceCmdInfoService deviceCmdInfoService;
+
+    @GetMapping("queryPadLatestVersion")
+    @ApiOperation(value="查询平板app最新版本")
+    public MessageResult<Map> queryLatestVersion(){
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+             DataDictionary dd  = dataDictionaryService.findByName("平板app版本");
+
+             Map<String,String> data = new HashMap<>();
+
+             data.put("version", dd.getValue());
+             data.put("versionCode", dd.getExpand1());
+             data.put("url", dd.getExpand2());
+
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("downloadCommand")
+    @ApiOperation(value="下载设备待执行命令")
+    public MessageResult<List> downloadCommand(@RequestBody JSONObject requestBody){
+        MessageResult<List> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            int limit = requestBody.getInteger("limit");
+
+             if (limit>100){
+                 limit = 100;
+             }
+
+             List<DeviceCmdInfo> data = deviceCmdInfoService.findByLicensePlateNumber(licensePlateNumber,limit);
+
+            //todo 填写具体代码
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("uploadCommandExecuteResult")
+    @ApiOperation(value="上传命令执行结果")
+    public MessageResult<String> uploadCommandExecuteResult(@RequestBody JSONObject requestBody){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            JSONArray resultList = requestBody.getJSONArray("resultList");
+
+            for (int i=0;i<resultList.size();i++) {
+                JSONObject result = resultList.getJSONObject(i);
+
+                String id = result.getString("id");
+                int responseCode = result.getInteger("responseCode");
+                String responseText = result.getString("responseText");
+
+                DeviceCmdInfo deviceCmdInfo = deviceCmdInfoService.get(id);
+                deviceCmdInfo.setResponseCode(responseCode);
+                deviceCmdInfo.setResponseText(responseText);
+                deviceCmdInfo.setStatus(1); //已执行
+                deviceCmdInfo.setUpdateTime(new Date());
+
+                deviceCmdInfoService.update(deviceCmdInfo);
+            }
+
+            String data = "ok";
+
+            //todo 填写具体代码
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+}

+ 73 - 0
web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceLogApiController.java

@@ -0,0 +1,73 @@
+package com.jpsoft.bus.modules.device.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.jpsoft.bus.modules.bus.entity.DeviceLogInfo;
+import com.jpsoft.bus.modules.bus.service.DeviceLogInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import java.util.Date;
+import java.util.UUID;
+
+@RestController
+@RequestMapping("/bus/deviceLogApi")
+@Slf4j
+public class DeviceLogApiController {
+    @Autowired
+    private DeviceLogInfoService deviceLogInfoService;
+
+    @PostMapping("uploadLog")
+    @ApiOperation(value="上传日志")
+    public MessageResult<String> uploadLog(@RequestBody JSONObject requestBody){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            String licensePlateNumber = requestBody.getString("licensePlateNumber");
+            JSONArray logList = requestBody.getJSONArray("logList");
+
+            for (int i=0;i<logList.size();i++){
+                JSONObject logJson = logList.getJSONObject(i);
+
+                String deviceIP = logJson.getString("deviceIP");
+                String tag = logJson.getString("tag");
+                String content = logJson.getString("content");
+
+                Date recordTime = new Date();
+
+                if(logJson.getLong("createTime")!=null) {
+                    recordTime = new Date(logJson.getLong("createTime"));
+                }
+
+                DeviceLogInfo deviceLogInfo = new DeviceLogInfo();
+                deviceLogInfo.setId(UUID.randomUUID().toString());
+                deviceLogInfo.setLicensePlateNumber(licensePlateNumber);
+                deviceLogInfo.setDeviceIP(deviceIP);
+                deviceLogInfo.setTag(tag);
+                deviceLogInfo.setContent(content);
+                deviceLogInfo.setRecordTime(recordTime);
+                deviceLogInfo.setDelFlag(false);
+                deviceLogInfo.setCreateTime(new Date());
+
+                deviceLogInfoService.insert(deviceLogInfo);
+            }
+
+            //todo 填写具体代码
+            messageResult.setData("ok");
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+}

+ 10 - 4
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -447,7 +447,8 @@ public class DriverApiController {
                 throw new Exception("车辆没有相关班次信息");
             }
 
-            List<PassengerInfo> passengerInfos = passengerInfoService.findByPersonIdShiftIdStatus(personId,shiftInfoList.get(0).getId(),null);
+            //在已上车乘客中查询
+            List<PassengerInfo> passengerInfos = passengerInfoService.findByPersonIdShiftIdStatus(personId,shiftInfoList.get(0).getId(),"1");
 
             if (passengerInfos.size()>0){
                 messageResult.setData(data);
@@ -473,7 +474,8 @@ public class DriverApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
-            String personId = requestBody.getString("personId");
+            Long libId = requestBody.getLong("libId");
+            Long personId = requestBody.getLong("personId");
             String photoBase64Data = requestBody.getString("photoBase64Data");
             String recordTime = requestBody.getString("recordTime");
 
@@ -505,14 +507,15 @@ public class DriverApiController {
                 //记录时间往后偏移1min
                 Date time = DateUtil.parse(recordTime,"yyyy-MM-dd HH:mm:ss");
                 Date offsetTime = DateUtil.offsetMinute(time,-1);
+
                 //查询gps记录表中此时间段间的记录
                 GpsDataInfo gpsDataInfo = gpsDataInfoService.findByDeviceNoAndCreateTime(vehicleInfo.getGpsDeviceNo(),time,offsetTime);
+
                 if (gpsDataInfo != null && StringUtils.isNotBlank(gpsDataInfo.getStationId())){
                     currentStationId = gpsDataInfo.getStationId();
                 }
 
-
-                passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId, personId);
+                passengerInfoService.passengerFace(vehicleInfo, shiftInfo, retFileUrl, recordTime, currentStationId,libId, personId);
                 messageResult.setResult(true);
                 messageResult.setCode(200);
             }
@@ -638,6 +641,9 @@ public class DriverApiController {
             List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
 
             passengerDetailDTO.setId(id);
+            passengerDetailDTO.setVehicleShiftId(passengerInfo.getVehicleShiftId());
+            passengerDetailDTO.setVehicleLibId(passengerInfo.getVehicleLibId());
+            passengerDetailDTO.setVehiclePersonId(passengerInfo.getVehiclePersonId());
             passengerDetailDTO.setImageUrl(passengerInfo.getImageUrl());
             passengerDetailDTO.setUpTime(passengerInfo.getUpTime());
             passengerDetailDTO.setUpStationId(passengerInfo.getUpStationId());