|
@@ -27,6 +27,8 @@ import com.pj.api.wx.service.WxService;
|
|
|
import com.pj.constants.UserTypeEnum;
|
|
|
import com.pj.constants.business.CarEnum;
|
|
|
import com.pj.constants.business.GoodsEnum;
|
|
|
+import com.pj.constants.business.OAResultEnum;
|
|
|
+import com.pj.constants.business.PayEnum;
|
|
|
import com.pj.current.config.*;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.project.oa.bo.OAResultBO;
|
|
@@ -176,119 +178,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 增
|
|
|
- */
|
|
|
- public AjaxJson addOrUpdate(TbBusiness t) {
|
|
|
- t.setBusinessType(TbBusiness.BusinessType.HOLD_CAR.getCode());
|
|
|
- if (StrUtil.isEmpty(t.getDeclareNo())) {
|
|
|
- throw new BusinessException("请选择申报单");
|
|
|
- }
|
|
|
- if (StrUtil.isNotEmpty(t.getId()) && StrUtil.isNotEmpty(t.getDeclareNo())) {
|
|
|
- TbBusiness db = this.getById(t.getId());
|
|
|
- if (!StrUtil.equals(db.getDeclareNo(), t.getDeclareNo())) {
|
|
|
- TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(db.getDeclareNo());
|
|
|
- if (tbDeclare != null) {
|
|
|
- tbDeclare.setBusinessId("");
|
|
|
- tbDeclareService.updateById(tbDeclare);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Double carSize = t.getCardSize();
|
|
|
- if (carSize != null && carSize > carConfig.getMaxLength()) {
|
|
|
- return AjaxJson.getError("车辆规格不能大于" + carConfig.getMaxLength());
|
|
|
- }
|
|
|
- Double netWeight = t.getNetWeight();
|
|
|
- if (netWeight != null && netWeight > carConfig.getMaxWeight()) {
|
|
|
- return AjaxJson.getError("车辆载重不能大于" + carConfig.getMaxWeight());
|
|
|
- }
|
|
|
- SpAdmin spAdmin = StpUserUtil.getAdmin();
|
|
|
- String createName = StrUtil.isEmpty(spAdmin.getNickname()) ? spAdmin.getName() : spAdmin.getNickname();
|
|
|
- t.setCreateBy(createName);
|
|
|
- createCarUnit(t);
|
|
|
- String customerId = t.getCustomerId();
|
|
|
- TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
- t.setCustomerName(tbCostomer.getName()).setCustomerType(tbCostomer.getPayType());
|
|
|
- if (StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- t.setConfirmInputBy(StpUserUtil.getAdmin().getName())
|
|
|
- .setConfirmInput(1)
|
|
|
- .setConfirmInputTime(new Date());
|
|
|
- }
|
|
|
- if (StrUtil.isEmpty(t.getId())) {
|
|
|
- t.setCreateTime(new Date());
|
|
|
- t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
|
|
|
- storeMsg(t.getCustomerId(), "新增一条业务数据:【" + t.getNo() + "】" + DateUtil.now() + "。");
|
|
|
- } else {
|
|
|
- storeMsg(t.getCustomerId(), "业务订单:【" + t.getNo() + "】数据发生更改," + DateUtil.now() + "。");
|
|
|
- }
|
|
|
- saveOrUpdate(t);
|
|
|
- createBusinessPeople(t);
|
|
|
- tbBusinessItemService.removeByBusinessId(t.getId());
|
|
|
- BigDecimal price = new BigDecimal(0);
|
|
|
- List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
|
|
|
- int index = 1;
|
|
|
- for (TbBusinessItem item : items) {
|
|
|
- Double num = NumberUtil.parseDouble(item.getNum());
|
|
|
- TbItem tbItem = tbItemService.getById(item.getItemId());
|
|
|
- String typeId = tbItem.getTypeId();
|
|
|
- price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
|
|
|
- TbItemType tbItemType = tbItemTypeService.getById(typeId);
|
|
|
- item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode()).setBusinessType(tbItem.getBusinessType())
|
|
|
- .setPayType(tbItem.getPayType()).setPayTypeName(tbItem.getPayTypeName())
|
|
|
- .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
|
|
|
- .setTaxRate(NumberUtil.div(tbItem.getTaxRate().doubleValue(), 100D, 2))
|
|
|
- .setItemTypeId(typeId).setItemTypeName(tbItemType.getName()).setBusinessType(tbItemType.getBusinessType())
|
|
|
- .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice())).setCreateTime(new Date())
|
|
|
- .setNo(t.getNo() + "0" + index);
|
|
|
- tbBusinessItemService.save(item);
|
|
|
|
|
|
- index++;
|
|
|
- }
|
|
|
- List<TbBusinessCar> carList = JSONUtil.toList(t.getCarJson(), TbBusinessCar.class);
|
|
|
- String chinaCarNo = carList.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
|
|
|
- t.setChinaCarNo(StrUtil.isNotEmpty(chinaCarNo) ? chinaCarNo.toUpperCase() : "");
|
|
|
- carList.forEach(tbBusinessCar -> {
|
|
|
- tbBusinessCar.setIsLock(0);
|
|
|
- String carNo = tbBusinessCar.getCarNo().toUpperCase();
|
|
|
-
|
|
|
- TbBusinessCar car = tbBusinessCarService.findInAndNoBusinessCar(carNo);
|
|
|
- if (car != null) {
|
|
|
- tbBusinessCar.setId(car.getId()).setRealInTime(car.getRealInTime()).setIsLock(car.getIsLock());
|
|
|
- }
|
|
|
- TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
|
- tbBusinessCar.setBusinessId(t.getId());
|
|
|
- tbBusinessCar.setCarNo(carNo).setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时");
|
|
|
- tbBusinessCar.setBusinessId(t.getId()).setCustomerId(t.getCustomerId());
|
|
|
- if (StrUtil.isEmpty(tbBusinessCar.getNo())) {
|
|
|
- tbBusinessCar.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- String yueCarNo = t.getCardNo().toUpperCase();
|
|
|
- TbBusinessCar yueCar = tbBusinessCarService.findInAndNoBusinessCar(yueCarNo);
|
|
|
-
|
|
|
-
|
|
|
- if (yueCar == null) {
|
|
|
- yueCar = new TbBusinessCar();
|
|
|
- yueCar.setIsLock(0);
|
|
|
- }
|
|
|
-
|
|
|
- yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
|
|
|
- if (StrUtil.isEmpty(yueCar.getNo())) {
|
|
|
- yueCar.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
|
|
|
- }
|
|
|
- carList.add(yueCar);
|
|
|
- tbBusinessCarService.saveOrUpdateBatch(carList);
|
|
|
- t.setItemPrice(price)
|
|
|
- .setTotalMoney(price);
|
|
|
- this.saveOrUpdate(t);
|
|
|
- if (StrUtil.isNotEmpty(t.getDeclareNo())) {
|
|
|
- TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(t.getDeclareNo());
|
|
|
- tbDeclare.setBusinessId(t.getId());
|
|
|
- tbDeclareService.updateById(tbDeclare);
|
|
|
- }
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
|
|
|
public void storeMsg(String businessCustomerId, String content) {
|
|
|
String currentCustomerId = StpUserUtil.getCustomerId();
|
|
@@ -742,7 +632,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
tbBusinessCar.setPay(1).setPayTime(payTime)
|
|
|
.setPayType(CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType());
|
|
|
- if (payType == TbBusiness.PayType.PER_PAY.getCode()) {
|
|
|
+ if (payType == PayEnum.PayType.PER_PAY.getCode()) {
|
|
|
TbDeductionBind deductionBind = tbDeductionBindService.getBindCarByPlate(carNo);
|
|
|
if (deductionBind != null) {
|
|
|
plate = carNo;
|
|
@@ -753,7 +643,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
BigDecimal itemPrice = db.getItemPrice();
|
|
|
BigDecimal money = itemPrice.add(partMoney);
|
|
|
String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(4);
|
|
|
- if (payType == TbBusiness.PayType.PER_PAY.getCode()) {
|
|
|
+ if (payType == PayEnum.PayType.PER_PAY.getCode()) {
|
|
|
if (bind == null) {
|
|
|
throw new AjaxError("车辆未绑定预支付款,无法完成收费");
|
|
|
}
|
|
@@ -770,26 +660,26 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (partMoney.doubleValue() > 0 && !priceBOList.isEmpty()) {
|
|
|
//车辆的扣费记录
|
|
|
List<TbFeeDetails> parkFeeDetailsList = tbFeeDetailsService.chargeParkFee(
|
|
|
- priceBOList, null, null, payTime, TbBusiness.PayType.PER_PAY);
|
|
|
+ priceBOList, null, null, payTime, PayEnum.PayType.PER_PAY);
|
|
|
automaticPay.createTbDeductionRecord(parkFeeDetailsList, tbAccount, plate, bind.getCustomerName(), no);
|
|
|
}
|
|
|
//生成收费明细
|
|
|
List<TbFeeDetails> tbFeeDetailsList = tbFeeDetailsService.chargeBusinessFee(
|
|
|
- items, null, null, payTime, TbBusiness.PayType.PER_PAY);
|
|
|
+ items, null, null, payTime, PayEnum.PayType.PER_PAY);
|
|
|
//生成扣费记录
|
|
|
automaticPay.createTbDeductionRecord(tbFeeDetailsList, tbAccount, plate, bind.getCustomerName(), no);
|
|
|
automaticPay.unbindRun(plate);
|
|
|
- }else if (payType == TbBusiness.PayType.OFF_LINE_PAY.getCode()){
|
|
|
+ }else if (payType == PayEnum.PayType.OFF_LINE_PAY.getCode()){
|
|
|
//车辆的扣费记录
|
|
|
if (partMoney.doubleValue() > 0){
|
|
|
tbFeeDetailsService.chargeParkFee(
|
|
|
- priceBOList, null, null, payTime, TbBusiness.PayType.OFF_LINE_PAY);
|
|
|
+ priceBOList, null, null, payTime, PayEnum.PayType.OFF_LINE_PAY);
|
|
|
}
|
|
|
//生成收费明细
|
|
|
tbFeeDetailsService.chargeBusinessFee(
|
|
|
- items, null, null, payTime, TbBusiness.PayType.OFF_LINE_PAY);
|
|
|
+ items, null, null, payTime, PayEnum.PayType.OFF_LINE_PAY);
|
|
|
}
|
|
|
- db.setPayStatus(TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode())
|
|
|
+ db.setPayStatus(PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode())
|
|
|
.setPayMoney(db.getItemPrice())
|
|
|
.setPayType(payType).setPayChannelType(payChannelType)
|
|
|
.setTransactionId(transactionId)
|
|
@@ -974,7 +864,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
Integer vietnamCarPay = tbGoods.getVietnamCarPay();
|
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
|
- if (TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() != dbBusiness.getPayStatus()) {
|
|
|
+ if (PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() != dbBusiness.getPayStatus()) {
|
|
|
tbBusinessItemService.removeByBusinessId(id);
|
|
|
BigDecimal price = new BigDecimal("0");
|
|
|
String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
|
|
@@ -1196,7 +1086,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.setSupplementBy(errorBusinessBO.getSupplementBy())
|
|
|
.setSupplementTime(new Date())
|
|
|
.setSupplementReason(errorBusinessBO.getSupplementReason());
|
|
|
- if (TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus()) {
|
|
|
+ if (PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus()) {
|
|
|
tbBusiness.setPayMoney(tbBusiness.getItemPrice())
|
|
|
.setPayTime(errorBusinessBO.getPayTime());
|
|
|
items.forEach(item -> item.setPayTime(errorBusinessBO.getPayTime()).setPayStatus(1));
|
|
@@ -1265,7 +1155,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (StrUtil.isEmpty(fdId)) {
|
|
|
throw new BusinessException("流程发起失败");
|
|
|
}
|
|
|
- tbBusiness.setSendOa(1).setOaResult(TbBusiness.OAResultEnum.JUDGE_ING.getCode())
|
|
|
+ tbBusiness.setSendOa(1).setOaResult(OAResultEnum.JUDGE_ING.getCode())
|
|
|
.setSendTime(new Date()).setSendBy(sendBy)
|
|
|
.setOaFdId(fdId);
|
|
|
this.updateById(tbBusiness);
|
|
@@ -1357,7 +1247,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.setOperatingOutlay(tbBusiness.getItemPrice().toString()).setAmount(tbBusiness.getItemPrice())
|
|
|
.setPaymentTime(tbBusiness.getPayTime() == null ? "" : DateUtil.format(tbBusiness.getPayTime(), "yyyy-MM-dd HH:mm:ss")).setCargoOwner(tbBusiness.getOwner()).setOperationNo(tbBusiness.getNo())
|
|
|
.setRecordingTime(DateUtil.format(tbBusiness.getCreateTime(), "yyyy-MM-dd HH:mm:ss")).setRecorder(tbBusiness.getCreateBy())
|
|
|
- .setIsPay(TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == tbBusiness.getPayStatus() ? "已支付" : "未支付");
|
|
|
+ .setIsPay(PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() == tbBusiness.getPayStatus() ? "已支付" : "未支付");
|
|
|
return JSONUtil.parseObj(formValuesBO);
|
|
|
}
|
|
|
|
|
@@ -1425,7 +1315,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (tbCostomer != null) {
|
|
|
tbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
|
|
|
}
|
|
|
- boolean businessIsPay = TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus();
|
|
|
+ boolean businessIsPay =PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() == errorBusinessBO.getPayStatus();
|
|
|
Date businessPayTime = errorBusinessBO.getPayTime();
|
|
|
|
|
|
BigDecimal price = new BigDecimal("0");
|
|
@@ -1545,7 +1435,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (dbBusiness == null) {
|
|
|
throw new BusinessException("记录不存在");
|
|
|
}
|
|
|
- if (!(dbBusiness.getSendOa() == 0 || TbBusiness.OAResultEnum.NO_PASS.getCode().equals(dbBusiness.getOaResult()))) {
|
|
|
+ if (!(dbBusiness.getSendOa() == 0 || OAResultEnum.NO_PASS.getCode().equals(dbBusiness.getOaResult()))) {
|
|
|
throw new BusinessException("业务单正在审核,无法修改");
|
|
|
}
|
|
|
List<TbItem> tbItems = errorBusinessBO.getItems();
|
|
@@ -1595,11 +1485,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}).
|
|
|
collect(Collectors.toList());
|
|
|
if (!priceBOList.isEmpty()) {
|
|
|
- tbFeeDetailsService.chargeParkFee(priceBOList, transactionId, outTradeNo, payTime, TbBusiness.PayType.OFF_LINE_PAY);//添加cars的收费明细
|
|
|
+ tbFeeDetailsService.chargeParkFee(priceBOList, transactionId, outTradeNo, payTime, PayEnum.PayType.OFF_LINE_PAY);//添加cars的收费明细
|
|
|
}
|
|
|
- if (tbBusiness.getPayStatus() == TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()) {
|
|
|
+ if (tbBusiness.getPayStatus() == PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode()) {
|
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
|
|
|
- tbFeeDetailsService.chargeBusinessFee(items, transactionId, outTradeNo, payTime, TbBusiness.PayType.OFF_LINE_PAY);//添加items的收费明细
|
|
|
+ tbFeeDetailsService.chargeBusinessFee(items, transactionId, outTradeNo, payTime, PayEnum.PayType.OFF_LINE_PAY);//添加items的收费明细
|
|
|
}
|
|
|
|
|
|
}
|