Commit da07d810 authored by zhangzc's avatar zhangzc

添加司机轨迹采集上传功能

parent c61f8e61
package com.esv.freight.app.feign;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.feign.DriverTrackInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/05/28 09:25
* @version:1.0
*/
@FeignClient(value = "freight-track-service")
public interface TrackInterface {
/**
* 司机轨迹上传
* @param jsonArray
* @return
*/
@PostMapping(value = "/track/driver/add")
JSONObject add(JSONArray jsonArray);
}
......@@ -138,7 +138,7 @@ public class DriverAccountController {
if (AccountConstants.AUDIT_STATUS_CHECK_SUCCESS.equals(driverAccountInfoPojo.getAuditStatus())) {
// 校验帐号状态:1-正常、2-停用
if (AccountConstants.ACCOUNT_STATUS_BLOCK.equals(driverAccountInfoPojo.getAccountStatus())) {
return EResponse.error(1003, "帐号已停用");
return EResponse.error(1004, "帐号已停用");
}
}
......@@ -179,7 +179,7 @@ public class DriverAccountController {
if (AccountConstants.AUDIT_STATUS_CHECK_SUCCESS.equals(driverAccountInfoPojo.getAuditStatus())) {
// 校验帐号状态:1-正常、2-停用
if (AccountConstants.ACCOUNT_STATUS_BLOCK.equals(driverAccountInfoPojo.getAccountStatus())) {
return EResponse.error(1004, "帐号已停用");
return EResponse.error(1003, "帐号已停用");
}
}
......
......@@ -35,12 +35,10 @@ import java.util.List;
@Validated
public class DeliveryAddressController {
private AppLoginService appLoginService;
private DeliveryAddressInterface deliveryAddressInterface;
@Autowired
public DeliveryAddressController(DeliveryAddressInterface deliveryAddressInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public DeliveryAddressController(DeliveryAddressInterface deliveryAddressInterface) {
this.deliveryAddressInterface = deliveryAddressInterface;
}
......
......@@ -37,12 +37,10 @@ import java.util.List;
@Validated
public class ReceiveAddressController {
private AppLoginService appLoginService;
private ReceiveAddressInterface receiveAddressInterface;
@Autowired
public ReceiveAddressController(ReceiveAddressInterface receiveAddressInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public ReceiveAddressController(ReceiveAddressInterface receiveAddressInterface) {
this.receiveAddressInterface = receiveAddressInterface;
}
......
......@@ -39,12 +39,10 @@ import java.util.List;
@Validated
public class GrabController {
private AppLoginService appLoginService;
private TmsGrabInterface tmsGrabInterface;
@Autowired
public GrabController(TmsGrabInterface tmsGrabInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public GrabController(TmsGrabInterface tmsGrabInterface) {
this.tmsGrabInterface = tmsGrabInterface;
}
......
package com.esv.freight.app.module.map.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.feign.TrackInterface;
import com.esv.freight.app.module.map.form.DriverTrackForm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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 javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
/**
* @description: 司机APP轨迹Controller
* @project: freight-app-service
* @name: com.esv.freight.app.module.map.controller.DriverTrackController
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/05/28 09:20
* @version:1.0
*/
@RestController
@RequestMapping("/map/track/driver")
@Slf4j
@Validated
public class DriverTrackController {
private TrackInterface trackInterface;
@Autowired
public DriverTrackController(TrackInterface trackInterface) {
this.trackInterface = trackInterface;
}
@PostMapping("/upload")
public EResponse upload(@RequestBody @Valid List<DriverTrackForm> driverTrackFormList) {
// 调用获取货主发货地址列表接口
JSONArray jsonArray = new JSONArray();
for(DriverTrackForm driverTrackForm : driverTrackFormList) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("time", driverTrackForm.getTime());
jsonObject.put("driverId", driverTrackForm.getDriverId());
jsonObject.put("lng", driverTrackForm.getLng());
jsonObject.put("lat", driverTrackForm.getLat());
jsonArray.add(jsonObject);
}
JSONObject result = trackInterface.add(jsonArray);
log.info(result.toJSONString());
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
return EResponse.ok();
}
}
package com.esv.freight.app.module.map.form;
import com.esv.freight.app.common.util.DateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.map.form.DriverTrackForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/05/28 09:15
* @version:1.0
*/
@Data
public class DriverTrackForm implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "参数时间不能为空")
@JsonFormat(pattern = DateUtils.DATE_FORMAT0)
private Long time;
@NotNull(message = "参数司机ID不能为空")
private Long driverId;
@NotNull(message = "参数经度不能为空")
private BigDecimal lng;
@NotNull(message = "参数纬度不能为空")
private BigDecimal lat;
}
......@@ -40,12 +40,10 @@ import java.util.List;
@Validated
public class OrderController {
private AppLoginService appLoginService;
private TmsOrderInterface tmsInterface;
@Autowired
public OrderController(TmsOrderInterface tmsInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public OrderController(TmsOrderInterface tmsInterface) {
this.tmsInterface = tmsInterface;
}
......
......@@ -39,13 +39,11 @@ import java.util.List;
@Validated
public class VehicleController {
private AppLoginService appLoginService;
private VehicleInterface vehicleInterface;
private DriverVehicleInterface driverVehicleInterface;
@Autowired
public VehicleController(DriverVehicleInterface driverVehicleInterface, VehicleInterface vehicleInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public VehicleController(DriverVehicleInterface driverVehicleInterface, VehicleInterface vehicleInterface) {
this.vehicleInterface = vehicleInterface;
this.driverVehicleInterface = driverVehicleInterface;
}
......
......@@ -37,53 +37,53 @@ public class VehicleForm {
* 车牌号
*/
@Length(min = 7, max = 8, message = "参数licenseNumber长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数licenseNumber不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数licenseNumber不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String licenseNumber;
/**
* 牌照类型(字典表):1-大型汽车号牌、2-小型汽车号牌、3-其他号牌
*/
@Range(min = 1, max = 3, message = "参数licenseType不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数licenseType不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数licenseType不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer licenseType;
/**
* 车牌颜色(字典表):1-蓝色、2-黄色、3-黑色、4-白色、5-绿色、6-农黄色、7-农绿色、8-黄绿色、9-渐变绿、0-其他
*/
@Range(min = 0, max = 9, message = "参数licenseColor不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数licenseColor不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数licenseColor不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer licenseColor;
/**
* 车辆类型(字典表)
*/
@NotNull(message = "参数vehicleType不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleType不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleType;
/**
* 二级车辆类型(字典表)
*/
@NotNull(message = "参数vehicleType2不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleType2不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleType2;
/**
* 车辆长度(单位毫米)
*/
@Range(min = 1000, max = 50000, message = "参数vehicleLength不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleLength不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleLength不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleLength;
/**
* 车辆宽度(单位毫米)
*/
@Range(min = 1000, max = 5000, message = "参数vehicleWidth不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleWidth不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleWidth不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleWidth;
/**
* 车辆高度(单位毫米)
*/
@Range(min = 1000, max = 5000, message = "参数vehicleHeight不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleHeight不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleHeight不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleHeight;
/**
* 车辆所属(字典表):1-自有车、2-外协车
*/
@Range(min = 1, max = 2, message = "参数vehicleBelong不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数vehicleBelong不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数vehicleBelong不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer vehicleBelong;
/**
* 年审日期
......@@ -94,20 +94,20 @@ public class VehicleForm {
* 能源类型(字典表):1-汽油、2-柴油、3-电、4-混合油、5-天然气、6-液化石油气、7-甲醇、8-乙醇、9-太阳能、10-混合动力、0-其他
*/
@Range(min = 0, max = 10, message = "参数energyType不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数energyType不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数energyType不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private Integer energyType;
/**
* 行驶证档案编号
*/
@Length(max = 20, message = "参数vehicleLicenseNumber长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleLicenseNumber不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleLicenseNumber不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleLicenseNumber;
/**
* 核定载质量(吨)
*/
@DecimalMax(value = "9999.99", message = "参数loadCapacity不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@DecimalMin(value = "1.00", message = "参数loadCapacity不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotNull(message = "参数loadCapacity不能为空", groups = {ValidatorInsert.class})
@NotNull(message = "参数loadCapacity不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private BigDecimal loadCapacity;
/**
* 总质量(吨)
......@@ -125,13 +125,13 @@ public class VehicleForm {
* 车辆所有人
*/
@Length(max = 20, message = "参数vehicleOwner长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleOwner不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleOwner不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleOwner;
/**
* 车辆所有人代码:企业-统一社会信用代码,个人-身份证号码
*/
@Length(max = 20, message = "参数vehicleOwnerCode长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleOwnerCode不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleOwnerCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleOwnerCode;
/**
* 使用性质
......@@ -192,19 +192,19 @@ public class VehicleForm {
* 车籍地-省份代码
*/
@Length(max = 6, message = "参数vehicleProvinceCode长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleProvinceCode不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleProvinceCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleProvinceCode;
/**
* 车籍地-市代码
*/
@Length(max = 6, message = "参数vehicleCityCode长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleCityCode不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleCityCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleCityCode;
/**
* 车籍地-区县代码
*/
@Length(max = 6, message = "参数vehicleDistrictCode长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleDistrictCode不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleDistrictCode不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleDistrictCode;
/**
* 是否开通ETC:1-已开通、2-未开通、3-未知
......@@ -225,19 +225,19 @@ public class VehicleForm {
* 行驶证正面URL
*/
@Length(max = 200, message = "参数vehicleLicenseFrontUrl长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleLicenseFrontUrl不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleLicenseFrontUrl不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleLicenseFrontUrl;
/**
* 行驶证背面URL
*/
@Length(max = 200, message = "参数vehicleLicenseBackUrl长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数vehicleLicenseBackUrl不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数vehicleLicenseBackUrl不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String vehicleLicenseBackUrl;
/**
* 道路运输证正面URL
*/
@Length(max = 200, message = "参数roadCertificateFrontUrl长度不合法", groups = {ValidatorInsert.class, ValidatorUpdate.class})
@NotBlank(message = "参数roadCertificateFrontUrl不能为空", groups = {ValidatorInsert.class})
@NotBlank(message = "参数roadCertificateFrontUrl不能为空", groups = {ValidatorInsert.class, ValidatorUpdate.class})
private String roadCertificateFrontUrl;
/**
* 挂靠声明URL
......
......@@ -42,12 +42,10 @@ import java.util.List;
@Validated
public class DriverWaybillController {
private AppLoginService appLoginService;
private TmsWaybillInterface tmsWaybillInterface;
@Autowired
public DriverWaybillController(TmsWaybillInterface tmsWaybillInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public DriverWaybillController(TmsWaybillInterface tmsWaybillInterface) {
this.tmsWaybillInterface = tmsWaybillInterface;
}
......
......@@ -42,12 +42,10 @@ import java.util.List;
@Validated
public class OwnerWaybillController {
private AppLoginService appLoginService;
private TmsWaybillInterface tmsWaybillInterface;
@Autowired
public OwnerWaybillController(TmsWaybillInterface tmsWaybillInterface, AppLoginService appLoginService) {
this.appLoginService = appLoginService;
public OwnerWaybillController(TmsWaybillInterface tmsWaybillInterface) {
this.tmsWaybillInterface = tmsWaybillInterface;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment