|
@@ -1,23 +1,16 @@
|
|
|
package com.pj.api.open.service;
|
|
|
|
|
|
-import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.pj.api.open.ResultJson;
|
|
|
import com.pj.api.open.bo.CheckCarNumberBO;
|
|
|
-import com.pj.current.config.PartConfig;
|
|
|
import com.pj.project.tb_business.TbBusiness;
|
|
|
import com.pj.project.tb_business.TbBusinessService;
|
|
|
-import com.pj.project.tb_car.TbCar;
|
|
|
-import com.pj.project.tb_car.TbCarService;
|
|
|
-import com.pj.project.tb_costomer.TbCostomer;
|
|
|
-import com.pj.project.tb_costomer.TbCostomerService;
|
|
|
+
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -26,10 +19,7 @@ import java.util.List;
|
|
|
public class OpenService {
|
|
|
@Resource
|
|
|
private TbBusinessService tbBusinessService;
|
|
|
- @Resource
|
|
|
- private TbCostomerService tbCostomerService;
|
|
|
- @Resource
|
|
|
- private TbCarService tbCarService;
|
|
|
+
|
|
|
private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
|
|
|
|
|
|
|
|
@@ -45,70 +35,70 @@ public class OpenService {
|
|
|
}
|
|
|
|
|
|
private ResultJson handlerOutCar(CheckCarNumberBO checkCarNumberBO) {
|
|
|
+ int inOrOut = checkCarNumberBO.getInOrOut();
|
|
|
String carNo = checkCarNumberBO.getCarNumber();
|
|
|
- TbBusiness tbBusiness = tbBusinessService.findCarTheNewRecord(carNo);
|
|
|
+ TbBusiness tbBusiness = tbBusinessService.findCarTheNewRecord(carNo,inOrOut);
|
|
|
if (tbBusiness == null) {
|
|
|
return ResultJson.error("无业务登记记录");
|
|
|
}
|
|
|
- Date outTime=tbBusiness.getOutDayTime();
|
|
|
Date now=new Date();
|
|
|
- if (outTime!=null&&Math.abs(outTime.getHours()-now.getHours())>10) {
|
|
|
- return ResultJson.error("无业务登记记录");
|
|
|
- }
|
|
|
- if (tbBusiness.getAdminConfirmPay() ==0) {
|
|
|
- return ResultJson.error("账单未支付");
|
|
|
- }
|
|
|
- int inOrOut = checkCarNumberBO.getInOrOut();
|
|
|
- TbCar car = tbCarService.findByCardNo(carNo);
|
|
|
- if (inOrOut == 1) {
|
|
|
- if (tbBusiness.getRealInDay() == null) {
|
|
|
- //入场
|
|
|
- tbBusiness.setRealInTime(now)
|
|
|
- .setInChannel(checkCarNumberBO.getChannelName());
|
|
|
- car.setLastInTime(now);
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
- return ResultJson.success();
|
|
|
- } else {
|
|
|
- return ResultJson.error("车辆已入场");
|
|
|
+ String channel=checkCarNumberBO.getChannelName();
|
|
|
+ if (inOrOut==1){
|
|
|
+ tbBusiness.setRealInTime(now).setInChannel(channel);
|
|
|
+ if (StrUtil.isNotEmpty(tbBusiness.getChinaCarInChannel())||tbBusiness.getChinaCarInTime()!=null){
|
|
|
+ tbBusiness.setAdminConfirmIn(1);
|
|
|
}
|
|
|
- } else {
|
|
|
- if (tbBusiness.getOutDayTime() == null) {
|
|
|
- TbCostomer tbCostomer = tbCostomerService.getById(tbBusiness.getCustomerId());
|
|
|
- car.setLastOutTime(now);
|
|
|
- tbCarService.updateById(car);
|
|
|
- tbBusiness.setOutChannel(checkCarNumberBO.getChannelName());
|
|
|
- handlerOut(tbBusiness);
|
|
|
- if (tbCostomer.getPayType() == 2) {
|
|
|
- return ResultJson.success();
|
|
|
- } else {
|
|
|
- if (tbBusiness.getPayStatus() != 3) {
|
|
|
- return ResultJson.error("车辆未缴费");
|
|
|
- }
|
|
|
- }
|
|
|
- return ResultJson.success();
|
|
|
- } else {
|
|
|
- return ResultJson.error("车辆已离场");
|
|
|
+ tbBusinessService.updateById(tbBusiness);
|
|
|
+ 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);
|
|
|
+ return ResultJson.success();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private ResultJson handlerChinaCar(CheckCarNumberBO checkCarNumberBO) {
|
|
|
String carNo = checkCarNumberBO.getCarNumber();
|
|
|
- TbBusiness cb = tbBusinessService.findByChinaCarNo(carNo);
|
|
|
+ int inOrOut=checkCarNumberBO.getInOrOut();
|
|
|
+ TbBusiness cb = tbBusinessService.findByChinaCarNo(carNo,inOrOut);
|
|
|
+ if (cb==null){
|
|
|
+ return ResultJson.error("未查询到相应业务");
|
|
|
+ }
|
|
|
Date now = new Date();
|
|
|
String channel = checkCarNumberBO.getChannelName();
|
|
|
- if (checkCarNumberBO.getInOrOut() == 1 && cb.getRealInTime() == null) {
|
|
|
+ if (checkCarNumberBO.getInOrOut() == 1) {
|
|
|
cb.setChinaCarInTime(now).setChinaCarInChannel(channel);
|
|
|
+ if (StrUtil.isNotEmpty(cb.getInChannel())||cb.getRealInTime()!=null){
|
|
|
+ cb.setAdminConfirmIn(1);
|
|
|
+ }
|
|
|
tbBusinessService.updateById(cb);
|
|
|
return ResultJson.success();
|
|
|
- }
|
|
|
- if (checkCarNumberBO.getInOrOut() == 2) {
|
|
|
+ }else {
|
|
|
+ //现结
|
|
|
+ if (cb.getCustomerType()==1&&cb.getAdminConfirmPay()==0){
|
|
|
+ return ResultJson.error("账单未确认支付");
|
|
|
+ }
|
|
|
+ if (cb.getConfirmInput()==0&&cb.getCustomerType()==2){
|
|
|
+ return ResultJson.error("账单未确认");
|
|
|
+ }
|
|
|
cb.setChinaCarOutTime(now).setChinaCarOutChannel(channel);
|
|
|
+ if (StrUtil.isNotEmpty(cb.getOutChannel())){
|
|
|
+ cb.setAdminConfirmOut(1);
|
|
|
+ }
|
|
|
tbBusinessService.calculationPartMoney("中国车", cb);
|
|
|
+ tbBusinessService.updateById(cb);
|
|
|
return ResultJson.success();
|
|
|
}
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
private void handlerOut(TbBusiness tbBusiness) {
|