diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index 0d920def..045b50ca 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -387,6 +387,7 @@ service_facilities as serviceFacilities, img_id as imgId, remark as remark, + ifnull(barrier_gate_id,0) as barrierGateType, ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968, 2) AS distance from xhpc_charging_station diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java index 937e8a36..9f4626eb 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcAppUserController.java @@ -21,6 +21,7 @@ import com.xhpc.common.core.web.page.TableDataInfo; import com.xhpc.common.log.annotation.Log; import com.xhpc.common.log.enums.BusinessType; import com.xhpc.common.redis.service.RedisService; +import com.xhpc.user.domain.XhpcUserVehicle; import com.xhpc.user.service.IXhpcAppUserUserService; import com.xhpc.user.service.IXhpcUserVehicleService; import com.xhpc.user.util.WechatDecryptDataUtil; @@ -590,10 +591,15 @@ public class XhpcAppUserController extends BaseController { } - //获取用户车牌号 + @ApiOperation("获取用户车牌号") @GetMapping("/getXhpcUserVehicleMessage") public R getXhpcUserVehicleMessage(Long userId, Integer source){ return xhpcUserVehicleService.getXhpcUserVehicleMessage(userId, source); } + @ApiOperation("添加车牌号") + @PostMapping("/addUserVehicle") + public R addUserVehicle(@RequestBody XhpcUserVehicle xhpcUserVehicle){ + return xhpcUserVehicleService.addUserVehicle(xhpcUserVehicle); + } } diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcBarrierGateLog.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcBarrierGateLog.java new file mode 100644 index 00000000..1d31dc5b --- /dev/null +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/controller/XhpcBarrierGateLog.java @@ -0,0 +1,40 @@ +package com.xhpc.user.controller; + +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.user.domain.XhpcUserVehicle; +import io.swagger.annotations.ApiOperation; +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.Map; + +/** + * 道闸日志 + */ +@RestController +@RequestMapping("/app/barrierGateLog") +public class XhpcBarrierGateLog extends BaseController { + + + @ApiOperation("添加车辆出站信息") + @PostMapping("/massage") + public R massage(@RequestBody Map map){ + + if(map.get("plateNo") ==null || "".equals(map.get("plateNo").toString())){ + return R.fail(40003,"车牌号为空"); + } + if(map.get("inTime") ==null || "".equals(map.get("inTime").toString())){ + return R.fail(40003,"进场为空"); + } + if(map.get("outTime") ==null || "".equals(map.get("outTime").toString())){ + return R.fail(40003,"出场为空"); + } + + return R.ok(null,"数据已接受"); + } + + +} diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserVehicleMapper.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserVehicleMapper.java index 7414da43..afc80727 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserVehicleMapper.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/mapper/XhpcUserVehicleMapper.java @@ -13,7 +13,7 @@ import java.util.Map; public interface XhpcUserVehicleMapper { - void deleteUserVehicle(@Param("userId") Long userId,@Param("vehicleId") Long vehicleId); + void deleteUserVehicle(@Param("userId") Long userId,@Param("vehicleId") Long vehicleId,@Param("source")Integer source); void addUserVehicle(XhpcUserVehicle xhpcUserVehicle); diff --git a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserVehicleServiceImpl.java b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserVehicleServiceImpl.java index 9ac7eca8..db50afae 100644 --- a/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserVehicleServiceImpl.java +++ b/xhpc-modules/xhpc-user/src/main/java/com/xhpc/user/service/impl/XhpcUserVehicleServiceImpl.java @@ -33,11 +33,11 @@ public class XhpcUserVehicleServiceImpl extends BaseService implements IXhpcUser @Override public R addUserVehicle(XhpcUserVehicle xhpcUserVehicle) { //标记该用户其他车牌号为空 - xhpcUserVehicleMapper.deleteUserVehicle(xhpcUserVehicle.getAppUserId(),xhpcUserVehicle.getVehicleId()); if(xhpcUserVehicle.getVehicleId() !=null){ - xhpcUserVehicleMapper.addUserVehicle(xhpcUserVehicle); - }else{ xhpcUserVehicleMapper.updateUserVehicle(xhpcUserVehicle); + }else{ + xhpcUserVehicleMapper.deleteUserVehicle(xhpcUserVehicle.getAppUserId(),xhpcUserVehicle.getVehicleId(),xhpcUserVehicle.getSource()); + xhpcUserVehicleMapper.addUserVehicle(xhpcUserVehicle); } return R.ok(); } diff --git a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml index 299da382..33c3b053 100644 --- a/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml +++ b/xhpc-modules/xhpc-user/src/main/resources/mapper/XhpcUserVehicleMapper.xml @@ -21,7 +21,7 @@ - update xhpc_user_vehicle set del_flag =1 where app_user_id=#{userId} + update xhpc_user_vehicle set del_flag =1 where app_user_id=#{userId} and source=#{source} and vehicle_id !=#{vehicleId} @@ -51,7 +51,7 @@ and (xau.phone like CONCAT('%',#{phone},'%') or xcop.phone like CONCAT('%',#{phone},'%') or - xcup.phone like CONCAT('%',#{phone},'%') or + xcup.phone like CONCAT('%',#{phone},'%') ) @@ -68,14 +68,11 @@ UPDATE xhpc_user_vehicle - vehicle_id = #{appUserId}, + app_user_id = #{appUserId}, + source =#{source}, + charging_station_id =#{chargingStationId}, vehicle_name = #{vehicleName}, type = #{type}, - del_flag = #{delFlag}, - create_by = #{createBy}, - create_time = #{createTime}, - update_by = #{updateBy}, - update_time = #{updateTime}, remark = #{remark} WHERE vehicle_id = #{vehicleId} @@ -85,26 +82,31 @@ keyProperty="vehicleId"> insert into xhpc_user_vehicle( app_user_id, + source, + charging_station_id, vehicle_name, type, del_flag, create_by, - create_time, update_by, update_time, remark, tenant_id, - )values( + create_time + ) + values( #{appUserId}, + #{source}, + #{chargingStationId}, #{vehicleName}, #{type}, #{delFlag}, #{createBy}, - #{createTime}, #{updateBy}, #{updateTime}, #{remark}, #{tenantId}, + sysdate() )