|
@@ -18,10 +18,7 @@ import org.bouncycastle.crypto.signers.ECDSASigner;
|
|
|
import org.joda.time.DateTime;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestAttribute;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.*;
|
|
@@ -146,19 +143,21 @@ public class DriverApiController {
|
|
|
@ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
@ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
})
|
|
|
- public MessageResult<Map> driverAttendance(String driverId, String photoBase64Data, String recordTime, String token, @RequestAttribute String subject) {
|
|
|
- MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
+ public MessageResult<DriverRecordInfo> driverAttendance(String driverId, String photoBase64Data, String recordTime, String token, @RequestAttribute String subject) {
|
|
|
+ MessageResult<DriverRecordInfo> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
-
|
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
|
+
|
|
|
if (vehicleInfo == null){
|
|
|
throw new Exception("当前车辆不存在");
|
|
|
}
|
|
|
+
|
|
|
DriverInfo driverInfo = driverInfoService.get(driverId);
|
|
|
if (driverInfo == null){
|
|
|
throw new Exception("当前司机不存在");
|
|
|
}
|
|
|
+
|
|
|
String retFileUrl = OSSUtil.uploadBase64(photoBase64Data,driverInfo.getName()+".jpg",ossConfig);
|
|
|
// String retFileUrl = OSSUtil.upload(ossConfig, "/faceImage", driverInfo.getName(), photoFile.getInputStream());
|
|
|
DriverRecordInfo driverRecordInfo = new DriverRecordInfo();
|
|
@@ -173,8 +172,7 @@ public class DriverApiController {
|
|
|
driverRecordInfo.setCreateTime(new Date());
|
|
|
driverRecordInfoService.insert(driverRecordInfo);
|
|
|
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("driverRecordInfo",driverRecordInfo);
|
|
|
+ messageResult.setData(driverRecordInfo);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
|
} catch (Exception ex) {
|
|
@@ -185,6 +183,32 @@ public class DriverApiController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("findLastAttendanceRecord")
|
|
|
+ @ApiOperation(value="查询司机今日最后考勤打卡")
|
|
|
+ public MessageResult<DriverRecordInfo> findLastAttendanceRecord(@RequestAttribute String subject,Long driverId){
|
|
|
+ MessageResult<DriverRecordInfo> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
|
|
|
+
|
|
|
+ Date startTime = DateTime.now().withTimeAtStartOfDay().toDate();
|
|
|
+
|
|
|
+ DriverRecordInfo driverRecordInfo = driverRecordInfoService.findLastAttendanceRecord(driverId,vehicleInfo.getLicensePlateNumber(),startTime);
|
|
|
+
|
|
|
+ //todo 填写具体代码
|
|
|
+ messageResult.setData(driverRecordInfo);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@PostMapping("busRouteInfo")
|
|
|
@ApiOperation(value = "车辆线路信息")
|