|
@@ -170,8 +170,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
if (netWeight != null && netWeight > carConfig.getMaxWeight()) {
|
|
if (netWeight != null && netWeight > carConfig.getMaxWeight()) {
|
|
return AjaxJson.getError("车辆载重不能大于" + carConfig.getMaxWeight());
|
|
return AjaxJson.getError("车辆载重不能大于" + carConfig.getMaxWeight());
|
|
}
|
|
}
|
|
- SpAdmin spAdmin= StpUserUtil.getAdmin();
|
|
|
|
- String createName=StrUtil.isEmpty(spAdmin.getNickname())?spAdmin.getName():spAdmin.getNickname();
|
|
|
|
|
|
+ SpAdmin spAdmin = StpUserUtil.getAdmin();
|
|
|
|
+ String createName = StrUtil.isEmpty(spAdmin.getNickname()) ? spAdmin.getName() : spAdmin.getNickname();
|
|
t.setCreateBy(createName);
|
|
t.setCreateBy(createName);
|
|
createCarUnit(t);
|
|
createCarUnit(t);
|
|
String customerId = t.getCustomerId();
|
|
String customerId = t.getCustomerId();
|
|
@@ -236,10 +236,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
TbBusinessCar yueCar = tbBusinessCarService.findInAndNoBusinessCar(yueCarNo);
|
|
TbBusinessCar yueCar = tbBusinessCarService.findInAndNoBusinessCar(yueCarNo);
|
|
|
|
|
|
|
|
|
|
- if (yueCar == null) {
|
|
|
|
- yueCar = new TbBusinessCar();
|
|
|
|
- yueCar.setIsLock(0);
|
|
|
|
- }
|
|
|
|
|
|
+ if (yueCar == null) {
|
|
|
|
+ yueCar = new TbBusinessCar();
|
|
|
|
+ yueCar.setIsLock(0);
|
|
|
|
+ }
|
|
|
|
|
|
yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
|
|
yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
|
|
if (StrUtil.isEmpty(yueCar.getNo())) {
|
|
if (StrUtil.isEmpty(yueCar.getNo())) {
|
|
@@ -355,13 +355,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
//合作伙伴创建+是否下单后付款
|
|
//合作伙伴创建+是否下单后付款
|
|
if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
|
|
if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
|
|
String customerId = business.getCreateByCustomerId();
|
|
String customerId = business.getCreateByCustomerId();
|
|
- List<String> customerType=new ArrayList<>();
|
|
|
|
|
|
+ List<String> customerType = new ArrayList<>();
|
|
TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
- if (tbCostomer!=null){
|
|
|
|
- customerType = StrUtil.splitTrim(tbCostomer.getType(),",");
|
|
|
|
|
|
+ if (tbCostomer != null) {
|
|
|
|
+ customerType = StrUtil.splitTrim(tbCostomer.getType(), ",");
|
|
}
|
|
}
|
|
if (customerType.contains(businessType)) {
|
|
if (customerType.contains(businessType)) {
|
|
- StaticLog.error("订单自动确认======================="+id);
|
|
|
|
|
|
+ StaticLog.error("订单自动确认=======================" + id);
|
|
MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), "系统自动确认",
|
|
MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), "系统自动确认",
|
|
DateUtil.now(),
|
|
DateUtil.now(),
|
|
business.getGoodsName() + "(" + item.getItemTypeName() + item.getItemName() + "-" + carNoStr + ")");
|
|
business.getGoodsName() + "(" + item.getItemTypeName() + item.getItemName() + "-" + carNoStr + ")");
|
|
@@ -376,7 +376,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
wxService.sendTemplateMsg(wxConfig.getBusinessConfirmTemplate(), openId, msgDataBO, detailUrl);
|
|
wxService.sendTemplateMsg(wxConfig.getBusinessConfirmTemplate(), openId, msgDataBO, detailUrl);
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- StaticLog.error("正常流程======================="+id);
|
|
|
|
|
|
+ StaticLog.error("正常流程=======================" + id);
|
|
String remark = "车牌:";
|
|
String remark = "车牌:";
|
|
String carNo = business.getCardNo();
|
|
String carNo = business.getCardNo();
|
|
String chinaCarNo = business.getChinaCarNo();
|
|
String chinaCarNo = business.getChinaCarNo();
|
|
@@ -458,7 +458,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
public Map<String, Object> getBusinessMoney(String businessCarId, String state) {
|
|
public Map<String, Object> getBusinessMoney(String businessCarId, String state) {
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|
|
List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
|
|
List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
|
|
- businessList=businessList.stream().filter(tbBusiness -> 3 > tbBusiness.getPayStatus()).collect(Collectors.toList());
|
|
|
|
|
|
+ businessList = businessList.stream().filter(tbBusiness -> 3 > tbBusiness.getPayStatus()).collect(Collectors.toList());
|
|
Set<TbBusinessCar> cars = new HashSet<>();
|
|
Set<TbBusinessCar> cars = new HashSet<>();
|
|
//越南车是否需要支付
|
|
//越南车是否需要支付
|
|
int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
@@ -499,9 +499,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
BigDecimal partMoney = new BigDecimal("0");
|
|
BigDecimal partMoney = new BigDecimal("0");
|
|
- String carType=tbBusinessCar.getCarType();
|
|
|
|
- if (StrUtil.isEmpty(carType)){
|
|
|
|
- carType=TbItem.ItemTypeEnum.EMPTY_TYPE.getType();
|
|
|
|
|
|
+ String carType = tbBusinessCar.getCarType();
|
|
|
|
+ if (StrUtil.isEmpty(carType)) {
|
|
|
|
+ carType = TbItem.ItemTypeEnum.EMPTY_TYPE.getType();
|
|
}
|
|
}
|
|
if (inTime != null && tbBusinessCar.getRealOutTime() == null) {
|
|
if (inTime != null && tbBusinessCar.getRealOutTime() == null) {
|
|
if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getPayTime() != null) {
|
|
if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getPayTime() != null) {
|
|
@@ -523,7 +523,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
partMoney = new BigDecimal("0");
|
|
partMoney = new BigDecimal("0");
|
|
}
|
|
}
|
|
//中国车,是否免费
|
|
//中国车,是否免费
|
|
- if (TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType)&& chinaCarPay == 0) {
|
|
|
|
|
|
+ if (TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType) && chinaCarPay == 0) {
|
|
partMoney = new BigDecimal("0");
|
|
partMoney = new BigDecimal("0");
|
|
}
|
|
}
|
|
Map<String, Object> carMap = new HashMap<>();
|
|
Map<String, Object> carMap = new HashMap<>();
|
|
@@ -718,9 +718,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
for (TbBusinessCar car : cars) {
|
|
for (TbBusinessCar car : cars) {
|
|
String carNo = car.getCarNo().trim().toUpperCase();
|
|
String carNo = car.getCarNo().trim().toUpperCase();
|
|
- String carType=car.getCarType();
|
|
|
|
- if (StrUtil.isEmpty(carType)){
|
|
|
|
- throw new BusinessException(carNo+"类型不能为空");
|
|
|
|
|
|
+ String carType = car.getCarType();
|
|
|
|
+ if (StrUtil.isEmpty(carType)) {
|
|
|
|
+ throw new BusinessException(carNo + "类型不能为空");
|
|
}
|
|
}
|
|
List<TbBusinessCar> notOutRecords = tbBusinessCarService.findNotOutCar(carNo);
|
|
List<TbBusinessCar> notOutRecords = tbBusinessCarService.findNotOutCar(carNo);
|
|
if (notOutRecords.size() > 1) {
|
|
if (notOutRecords.size() > 1) {
|
|
@@ -737,7 +737,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), tbBusiness.getId(), carNo);
|
|
checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), tbBusiness.getId(), carNo);
|
|
}
|
|
}
|
|
db.setPayType(TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
|
|
db.setPayType(TbBusinessCar.PayTypeEnum.NO_PAY_TYPE.getType());
|
|
- if ((TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType)&& chinaCarPay == 0) || (TbItem.ItemTypeEnum.WEIGHT_TYPE.getType().equals(carType)&& vietnamCarPay == 0)) {
|
|
|
|
|
|
+ if ((TbItem.ItemTypeEnum.EMPTY_TYPE.getType().equals(carType) && chinaCarPay == 0) || (TbItem.ItemTypeEnum.WEIGHT_TYPE.getType().equals(carType) && vietnamCarPay == 0)) {
|
|
db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
|
|
}
|
|
}
|
|
TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
@@ -787,9 +787,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
if (cars.isEmpty()) {
|
|
if (cars.isEmpty()) {
|
|
throw new BusinessException("作业车辆不能为空");
|
|
throw new BusinessException("作业车辆不能为空");
|
|
}
|
|
}
|
|
- if (TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()!=dbBusiness.getPayStatus()) {
|
|
|
|
- tbBusinessItemService.removeByBusinessId(id);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
List<RelationBusinessCar> relationBusinessCars = relationBusinessCarService.findByBusinessId(id);
|
|
List<RelationBusinessCar> relationBusinessCars = relationBusinessCarService.findByBusinessId(id);
|
|
List<String> businessCarIds = cars.stream().filter(tbBusinessCar -> StrUtil.isNotEmpty(tbBusinessCar.getId()))
|
|
List<String> businessCarIds = cars.stream().filter(tbBusinessCar -> StrUtil.isNotEmpty(tbBusinessCar.getId()))
|
|
@@ -805,35 +803,38 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
Integer chinaCarPay = tbGoods.getChinaCarPay();
|
|
Integer chinaCarPay = tbGoods.getChinaCarPay();
|
|
Integer vietnamCarPay = tbGoods.getVietnamCarPay();
|
|
Integer vietnamCarPay = tbGoods.getVietnamCarPay();
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
- BigDecimal price = new BigDecimal("0");
|
|
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
- String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
|
|
|
|
- int index = 1;
|
|
|
|
- for (TbItem tbItem : tbItems) {
|
|
|
|
- TbItem db = tbItemService.getById(tbItem.getId());
|
|
|
|
- TbBusinessItem item = new TbBusinessItem();
|
|
|
|
- int num = tbItem.getNum();
|
|
|
|
- TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
|
|
|
|
- BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
|
|
|
|
- item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
|
- .setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
|
|
|
|
- item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId()).setBusinessId(dbBusiness.getId())
|
|
|
|
- .setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
|
|
|
|
- .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
|
|
|
|
- .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
|
|
|
|
- price = price.add(itemTotalPrice);
|
|
|
|
- itemList.add(item);
|
|
|
|
- index++;
|
|
|
|
|
|
+ if (TbBusiness.PayStatus.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);
|
|
|
|
+ int index = 1;
|
|
|
|
+ for (TbItem tbItem : tbItems) {
|
|
|
|
+ TbItem db = tbItemService.getById(tbItem.getId());
|
|
|
|
+ TbBusinessItem item = new TbBusinessItem();
|
|
|
|
+ int num = tbItem.getNum();
|
|
|
|
+ TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
|
|
|
|
+ BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
|
|
|
|
+ item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
|
+ .setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
|
|
|
|
+ item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId()).setBusinessId(dbBusiness.getId())
|
|
|
|
+ .setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
|
|
|
|
+ .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
|
|
|
|
+ .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
|
|
|
|
+ price = price.add(itemTotalPrice);
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ dbBusiness.setItemPrice(price).setTotalMoney(price);
|
|
|
|
+ tbBusinessItemService.saveBatch(itemList);
|
|
}
|
|
}
|
|
- dbBusiness.setItemPrice(price).setTotalMoney(price);
|
|
|
|
- tbBusinessItemService.saveBatch(itemList);
|
|
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
String businessCarId = tbBusinessCar.getId();
|
|
String businessCarId = tbBusinessCar.getId();
|
|
String carNo = tbBusinessCar.getCarNo();
|
|
String carNo = tbBusinessCar.getCarNo();
|
|
for (TbBusinessItem item : itemList) {
|
|
for (TbBusinessItem item : itemList) {
|
|
checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), dbBusiness.getId(), carNo);
|
|
checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), dbBusiness.getId(), carNo);
|
|
}
|
|
}
|
|
- String carType=tbBusinessCar.getCarType();
|
|
|
|
|
|
+ String carType = tbBusinessCar.getCarType();
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
//原来已存在的
|
|
//原来已存在的
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
@@ -900,9 +901,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
}
|
|
}
|
|
dbBusiness.setCardSize(otherBusinessBO.getCarSize()).setNetWeight(otherBusinessBO.getNetWeight())
|
|
dbBusiness.setCardSize(otherBusinessBO.getCarSize()).setNetWeight(otherBusinessBO.getNetWeight())
|
|
.setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
|
|
.setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
|
|
- .setNo(no).setGoodsId(otherBusinessBO.getGoodsId()).setOwner(otherBusinessBO.getOwner())
|
|
|
|
|
|
+ .setGoodsId(otherBusinessBO.getGoodsId()).setOwner(otherBusinessBO.getOwner())
|
|
.setDeclareNo(declareNo).setCardNo(otherBusinessBO.getCardNo());
|
|
.setDeclareNo(declareNo).setCardNo(otherBusinessBO.getCardNo());
|
|
- dbBusiness.setItemPrice(price).setTotalMoney(price);
|
|
|
|
dbBusiness.setChinaCarNo(otherBusinessBO.getChinaCarNo());
|
|
dbBusiness.setChinaCarNo(otherBusinessBO.getChinaCarNo());
|
|
this.updateById(dbBusiness);
|
|
this.updateById(dbBusiness);
|
|
}
|
|
}
|
|
@@ -986,7 +986,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
public List<TbBusiness> getPay(String day) {
|
|
public List<TbBusiness> getPay(String day) {
|
|
QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
|
|
QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
|
|
- ew.eq("date_format(pay_time,'%Y-%m-%d')",day).orderByDesc("id");
|
|
|
|
|
|
+ ew.eq("date_format(pay_time,'%Y-%m-%d')", day).orderByDesc("id");
|
|
return this.list(ew);
|
|
return this.list(ew);
|
|
}
|
|
}
|
|
}
|
|
}
|