|
@@ -59,6 +59,7 @@ import com.pj.project.tb_pass_record.TbPassRecordService;
|
|
|
import com.pj.project.tb_unit.TbUnit;
|
|
|
import com.pj.project.tb_unit.TbUnitService;
|
|
|
import com.pj.project4sp.admin.SpAdmin;
|
|
|
+import com.pj.project4sp.admin.SpAdminService;
|
|
|
import com.pj.project4sp.global.BusinessException;
|
|
|
import com.pj.project4sp.role.SpRoleUtil;
|
|
|
import com.pj.project4sp.role4permission.SpRolePermissionService;
|
|
@@ -131,6 +132,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
WxService wxService;
|
|
|
@Resource
|
|
|
MyConfig myConfig;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SpAdminService spAdminService;
|
|
|
+
|
|
|
+
|
|
|
private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
|
|
|
|
|
|
|
|
@@ -344,31 +350,53 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.setConfirmInputTime(new Date())
|
|
|
.setConfirmInputBy(StpUserUtil.getAdmin().getName());
|
|
|
this.updateById(business);
|
|
|
+ List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(business.getId());
|
|
|
+ if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType())) {
|
|
|
+ cars = Collections.singletonList(tbBusinessCarService.getById(business.getBusinessCarId()));
|
|
|
+ }
|
|
|
+ String carNoStr = cars.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
|
|
|
storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认" + DateUtil.now() + "。");
|
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);
|
|
|
items.forEach(item -> {
|
|
|
String businessType = item.getBusinessType();
|
|
|
if (!StrUtil.equals(businessType, TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
|
|
|
- String remark = "车牌:";
|
|
|
- String carNo = business.getCardNo();
|
|
|
- String chinaCarNo = business.getChinaCarNo();
|
|
|
- if (StrUtil.isNotEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
|
|
|
- remark += carNo + "、" + chinaCarNo;
|
|
|
- }
|
|
|
- if (StrUtil.isEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
|
|
|
- remark += chinaCarNo;
|
|
|
- }
|
|
|
- if (StrUtil.isNotEmpty(carNo) && StrUtil.isEmpty(chinaCarNo)) {
|
|
|
- remark += carNo;
|
|
|
- }
|
|
|
- MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), item.getItemTypeName(), item.getItemName(), business.getGoodsName(), DateUtil.now(), remark);
|
|
|
- StrUtil.splitTrim(businessType, ",").forEach(type -> {
|
|
|
- List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(type);
|
|
|
+ String customerId = business.getCustomerId();
|
|
|
+ TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
+ String customerType = tbCostomer.getType();
|
|
|
+ if (StrUtil.equals(businessType, customerType)) {
|
|
|
+ MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), "系统自动确认",
|
|
|
+ DateUtil.now(),
|
|
|
+ business.getGoodsName() + "(" + item.getItemTypeName() + item.getItemName() + "-" + carNoStr + ")");
|
|
|
+ List<SpAdmin> spAdminList = spAdminService.findByCustomerId(customerId);
|
|
|
+ Date now = new Date();
|
|
|
+ item.setPickCustomerId(customerId).setPickCustomerName(tbCostomer.getName()).setPickTime(now)
|
|
|
+ .setConfirm(1).setConfirmTime(now);
|
|
|
+ tbBusinessItemService.updateById(item);
|
|
|
+ spAdminList.stream().map(SpAdmin::getOpenid).forEach(openId -> {
|
|
|
+ String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId() + "&openid=" + openId;
|
|
|
+ wxService.sendTemplateMsg(wxConfig.getBusinessConfirmTemplate(), openId, msgDataBO, detailUrl);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ String remark = "车牌:";
|
|
|
+ String carNo = business.getCardNo();
|
|
|
+ String chinaCarNo = business.getChinaCarNo();
|
|
|
+ if (StrUtil.isNotEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
|
|
|
+ remark += carNo + "、" + chinaCarNo;
|
|
|
+ }
|
|
|
+ if (StrUtil.isEmpty(carNo) && StrUtil.isNotEmpty(chinaCarNo)) {
|
|
|
+ remark += chinaCarNo;
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotEmpty(carNo) && StrUtil.isEmpty(chinaCarNo)) {
|
|
|
+ remark += carNo;
|
|
|
+ }
|
|
|
+ MsgDataBO msgDataBO = new MsgDataBO("订单号:" + item.getNo(), item.getItemTypeName(),
|
|
|
+ item.getItemName(), business.getGoodsName(), DateUtil.now(), remark);
|
|
|
+ List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(businessType);
|
|
|
openidList.forEach(openid -> {
|
|
|
String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId() + "&openid=" + openid;
|
|
|
wxService.sendTemplateMsg(wxConfig.getBusinessNoticeTemplate(), openid, msgDataBO, detailUrl);
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -497,22 +525,23 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
TbBusinessCar car = tbBusinessCarService.getById(carId);
|
|
|
String businessId = car.getBusinessId();
|
|
|
- result.put("type", car.getBusinessType());
|
|
|
+ Integer businessType=car.getBusinessType();
|
|
|
+ result.put("type",businessType);
|
|
|
List<TbBusinessCar> cars = new ArrayList<>();
|
|
|
List<TbBusinessItem> items = new ArrayList<>();
|
|
|
cars.add(car);
|
|
|
//其他业务
|
|
|
- if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(car.getBusinessType())) {
|
|
|
+ if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(businessType)) {
|
|
|
List<TbBusiness> businesses = this.findOtherBusinessByCarId(carId);
|
|
|
- businesses=businesses.stream()
|
|
|
- .filter(tbBusiness -> tbBusiness.getAdminConfirmInput()==1&&tbBusiness.getPayMoney().doubleValue()<tbBusiness.getTotalMoney().doubleValue())
|
|
|
+ businesses = businesses.stream()
|
|
|
+ .filter(tbBusiness -> tbBusiness.getAdminConfirmInput() == 1 && tbBusiness.getPayMoney().doubleValue() < tbBusiness.getTotalMoney().doubleValue())
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> businessIdList = businesses.stream().map(TbBusiness::getId).collect(Collectors.toList());
|
|
|
- if (!businessIdList.isEmpty()){
|
|
|
+ if (!businessIdList.isEmpty()) {
|
|
|
items = tbBusinessItemService.findByBusinessIdList(businessIdList);
|
|
|
businessId = String.join(",", businessIdList);
|
|
|
}
|
|
|
- } else if (TbBusiness.BusinessType.HOLD_CAR.getCode().equals(car.getBusinessType())) {
|
|
|
+ } else if (TbBusiness.BusinessType.HOLD_CAR.getCode().equals(businessType)) {
|
|
|
cars = tbBusinessCarService.findByBusinessId(businessId);
|
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
|
if (tbBusiness.getPayStatus() != TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()) {
|
|
@@ -540,13 +569,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
partMoney = new BigDecimal("0");
|
|
|
}
|
|
|
}
|
|
|
- //越南车
|
|
|
- if (!CAR_LIST.contains(carNo)) {
|
|
|
- TbBusiness tbBusiness = this.getById(businessId);
|
|
|
- //整车业务免费
|
|
|
- if (tbBusiness != null && Objects.equals(tbBusiness.getBusinessType(), TbBusiness.BusinessType.HOLD_CAR.getCode())) {
|
|
|
- partMoney = new BigDecimal("0");
|
|
|
- }
|
|
|
+ //越南车牌,整车业务免停车费
|
|
|
+ if (!CAR_LIST.contains(carNo)&&TbBusiness.BusinessType.HOLD_CAR.getCode().equals(businessType)) {
|
|
|
+ partMoney = new BigDecimal("0");
|
|
|
}
|
|
|
Map<String, Object> carMap = new HashMap<>();
|
|
|
carMap.put("price", partMoney);
|