|
@@ -13,6 +13,7 @@ import com.pj.project.tb_business.TbBusinessService;
|
|
|
|
|
|
import com.pj.project.tb_business_car.TbBusinessCar;
|
|
|
import com.pj.project.tb_business_car.TbBusinessCarService;
|
|
|
+import com.pj.utils.cache.RedisUtil;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -48,7 +49,7 @@ public class OpenService {
|
|
|
}
|
|
|
|
|
|
private void handlerIn(String carNo, String channel) {
|
|
|
- carNo=carNo.toUpperCase();
|
|
|
+ carNo = carNo.toUpperCase();
|
|
|
TbBusinessCar tbBusinessCar = tbBusinessCarService.findNotInCar(carNo);
|
|
|
Date now = new Date();
|
|
|
if (tbBusinessCar == null) {
|
|
@@ -84,6 +85,7 @@ public class OpenService {
|
|
|
if (dif > 0) {
|
|
|
tbBusinessCar.setPay(0);
|
|
|
tbBusinessCarService.updateById(tbBusinessCar);
|
|
|
+ RedisUtil.set(channel,carNo);
|
|
|
return ResultJson.error("请缴停车费" + dif + "元");
|
|
|
}
|
|
|
TbBusiness business = tbBusinessService.getById(businessId);
|
|
@@ -95,103 +97,6 @@ public class OpenService {
|
|
|
return ResultJson.success();
|
|
|
}
|
|
|
|
|
|
- private ResultJson handlerOutCar(CheckCarNumberBO checkCarNumberBO) {
|
|
|
- int inOrOut = checkCarNumberBO.getInOrOut();
|
|
|
- String carNo = checkCarNumberBO.getCarNumber();
|
|
|
- TbBusiness tbBusiness = tbBusinessService.findCarTheNewRecord(carNo, inOrOut);
|
|
|
- if (tbBusiness == null) {
|
|
|
- return ResultJson.error("无业务登记记录");
|
|
|
- }
|
|
|
- Date now = new Date();
|
|
|
- String channel = checkCarNumberBO.getChannelName();
|
|
|
- if (inOrOut == 1) {
|
|
|
- tbBusiness.setRealInTime(now).setInChannel(channel);
|
|
|
- if (StrUtil.isNotEmpty(tbBusiness.getChinaCarInChannel()) || tbBusiness.getChinaCarInTime() != null) {
|
|
|
- tbBusiness.setAdminConfirmIn(1);
|
|
|
- }
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
- BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), "订单号【" + tbBusiness.getNo() + "】,车辆【" + tbBusiness.getChinaCarNo() + "】已入场。" + DateUtil.now() + "。");
|
|
|
- BusinessMessageManager.set(tbBusiness.getCustomerId(), "您的订单号【" + tbBusiness.getNo() + "】,车辆【" + tbBusiness.getChinaCarNo() + "】已入场。" + DateUtil.now() + "。");
|
|
|
- return ResultJson.success();
|
|
|
- } else {
|
|
|
- if (tbBusiness.getAdminConfirmPay() == 0 && tbBusiness.getCustomerType() == 1) {
|
|
|
- return ResultJson.error("账单未确认支付");
|
|
|
- }
|
|
|
- if (tbBusiness.getConfirmInput() == 0 && tbBusiness.getCustomerType() == 2) {
|
|
|
- return ResultJson.error("账单未确认");
|
|
|
- }
|
|
|
- tbBusiness.setOutDayTime(now).setOutChannel(channel);
|
|
|
- if (StrUtil.isNotEmpty(tbBusiness.getChinaCarOutChannel())) {
|
|
|
- tbBusiness.setAdminConfirmOut(1);
|
|
|
- }
|
|
|
- tbBusinessService.calculationPartMoney("越南车", tbBusiness);
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
- BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), "订单号【" + tbBusiness.getNo() + "】,车辆【" + tbBusiness.getChinaCarNo() + "】已完成业务离场。" + DateUtil.now() + "。");
|
|
|
- BusinessMessageManager.set(tbBusiness.getCustomerId(), "您的订单号【" + tbBusiness.getNo() + "】,车辆" + tbBusiness.getChinaCarNo() + "已完成业务离场。" + DateUtil.now() + "。");
|
|
|
- return ResultJson.success();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- TimedCache<String, Integer> timedCache = CacheUtil.newTimedCache(1000000);
|
|
|
- TimedCache<String, Integer> inCache = CacheUtil.newTimedCache(1000000);
|
|
|
-
|
|
|
- private ResultJson handlerChinaCar(CheckCarNumberBO checkCarNumberBO) {
|
|
|
- String carNo = checkCarNumberBO.getCarNumber();
|
|
|
- int inOrOut = checkCarNumberBO.getInOrOut();
|
|
|
- TbBusiness cb = tbBusinessService.findByChinaCarNo(carNo, inOrOut);
|
|
|
- if (cb == null) {
|
|
|
- return ResultJson.error("未查询到相应业务");
|
|
|
- }
|
|
|
- int carNum = cb.getChinaCarNo().split(" ").length;
|
|
|
- String no = cb.getNo();
|
|
|
-
|
|
|
- Integer inCount = inCache.get(no);
|
|
|
- if (inCount == null) {
|
|
|
- inCount = 0;
|
|
|
- }
|
|
|
- Date now = new Date();
|
|
|
- String channel = checkCarNumberBO.getChannelName();
|
|
|
- if (checkCarNumberBO.getInOrOut() == 1) {
|
|
|
- inCount++;
|
|
|
- inCache.put(no, inCount);
|
|
|
- if (inCount == carNum) {
|
|
|
- cb.setChinaCarInTime(now).setChinaCarInChannel(channel);
|
|
|
- inCache.clear();
|
|
|
- }
|
|
|
- if (StrUtil.isNotEmpty(cb.getInChannel()) || cb.getRealInTime() != null) {
|
|
|
- cb.setAdminConfirmIn(1);
|
|
|
- }
|
|
|
- BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), "订单号【" + cb.getNo() + "】,车辆【" + cb.getChinaCarNo() + "】已入场。" + DateUtil.now() + "。");
|
|
|
- BusinessMessageManager.set(cb.getCustomerId(), "您的订单号【" + cb.getNo() + "】,车辆【" + cb.getChinaCarNo() + "】已入场。" + DateUtil.now() + "。");
|
|
|
- tbBusinessService.updateById(cb);
|
|
|
- return ResultJson.success();
|
|
|
- } else {
|
|
|
- //现结
|
|
|
- if (cb.getCustomerType() == 1 && cb.getAdminConfirmPay() == 0) {
|
|
|
- return ResultJson.error("账单未确认支付");
|
|
|
- }
|
|
|
- if (cb.getConfirmInput() == 0 && cb.getCustomerType() == 2) {
|
|
|
- return ResultJson.error("账单未确认");
|
|
|
- }
|
|
|
-
|
|
|
- Integer count = timedCache.get(no);
|
|
|
- if (count == null) {
|
|
|
- count = 0;
|
|
|
- }
|
|
|
- if (count == carNum) {
|
|
|
- cb.setAdminConfirmOut(1);
|
|
|
- cb.setChinaCarOutTime(now).setChinaCarOutChannel(channel);
|
|
|
- timedCache.clear();
|
|
|
- }
|
|
|
- count++;
|
|
|
- timedCache.put(no, count);
|
|
|
- tbBusinessService.calculationPartMoney("中国车", cb);
|
|
|
- tbBusinessService.updateById(cb);
|
|
|
- BusinessMessageManager.set(cb.getCustomerId(), "您的订单号【" + cb.getNo() + "】,车辆【" + cb.getChinaCarNo() + "】已完成业务离场");
|
|
|
- BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), "业务订单号【" + cb.getNo() + "】,车辆【" + cb.getChinaCarNo() + "】已完成业务离场");
|
|
|
- return ResultJson.success();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
}
|