TbBusinessService.java 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. package com.pj.project.tb_business;
  2. import java.math.BigDecimal;
  3. import java.time.LocalDate;
  4. import java.time.LocalDateTime;
  5. import java.time.LocalTime;
  6. import java.time.ZoneId;
  7. import java.time.format.DateTimeFormatter;
  8. import java.time.temporal.ChronoUnit;
  9. import java.util.*;
  10. import java.util.stream.Collectors;
  11. import cn.hutool.core.bean.BeanUtil;
  12. import cn.hutool.core.date.DateUtil;
  13. import cn.hutool.core.util.NumberUtil;
  14. import cn.hutool.core.util.RandomUtil;
  15. import cn.hutool.core.util.StrUtil;
  16. import cn.hutool.json.JSONUtil;
  17. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  18. import com.baomidou.mybatisplus.extension.service.IService;
  19. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  20. import com.pj.constants.UserTypeEnum;
  21. import com.pj.current.config.CarConfig;
  22. import com.pj.current.config.PartConfig;
  23. import com.pj.current.satoken.StpUserUtil;
  24. import com.pj.project.tb_business_car.TbBusinessCar;
  25. import com.pj.project.tb_business_car.TbBusinessCarService;
  26. import com.pj.project.tb_business_item.TbBusinessItem;
  27. import com.pj.project.tb_business_item.TbBusinessItemService;
  28. import com.pj.project.tb_business_people.TbBusinessPeople;
  29. import com.pj.project.tb_business_people.TbBusinessPeopleService;
  30. import com.pj.project.tb_car.TbCar;
  31. import com.pj.project.tb_car.TbCarService;
  32. import com.pj.project.tb_costomer.TbCostomer;
  33. import com.pj.project.tb_costomer.TbCostomerService;
  34. import com.pj.project.tb_declare.TbDeclare;
  35. import com.pj.project.tb_declare.TbDeclareService;
  36. import com.pj.project.tb_driver.TbDriver;
  37. import com.pj.project.tb_driver.TbDriverService;
  38. import com.pj.project.tb_goods.TbGoods;
  39. import com.pj.project.tb_goods.TbGoodsService;
  40. import com.pj.project.tb_item.TbItem;
  41. import com.pj.project.tb_item.TbItemService;
  42. import com.pj.project.tb_item_type.TbItemType;
  43. import com.pj.project.tb_item_type.TbItemTypeService;
  44. import com.pj.project.tb_notices.TbNoticesMapper;
  45. import com.pj.project.tb_notices.TbNoticesService;
  46. import com.pj.project.tb_pass_record.TbPassRecord;
  47. import com.pj.project.tb_pass_record.TbPassRecordService;
  48. import com.pj.project.tb_unit.TbUnit;
  49. import com.pj.project.tb_unit.TbUnitService;
  50. import com.pj.project4sp.admin.SpAdmin;
  51. import com.pj.project4sp.global.BusinessException;
  52. import com.pj.project4sp.role.SpRoleUtil;
  53. import com.pj.project4sp.role4permission.SpRolePermissionService;
  54. import com.pj.utils.so.SoMap;
  55. import org.aspectj.weaver.loadtime.Aj;
  56. import org.omg.CORBA.OBJ_ADAPTER;
  57. import org.springframework.beans.factory.annotation.Autowired;
  58. import org.springframework.beans.factory.annotation.Value;
  59. import org.springframework.context.annotation.Lazy;
  60. import org.springframework.scheduling.annotation.Async;
  61. import org.springframework.stereotype.Service;
  62. import com.pj.utils.sg.*;
  63. import org.springframework.transaction.annotation.Transactional;
  64. import javax.annotation.Resource;
  65. /**
  66. * Service: tb_business -- 入境登记
  67. *
  68. * @author qzy
  69. */
  70. @Service
  71. @Transactional
  72. public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness> implements IService<TbBusiness> {
  73. /**
  74. * 底层 Mapper 对象
  75. */
  76. @Autowired
  77. TbBusinessMapper tbBusinessMapper;
  78. @Resource
  79. private TbCarService tbCarService;
  80. @Resource
  81. private TbDriverService tbDriverService;
  82. @Resource
  83. private TbCostomerService tbCostomerService;
  84. @Resource
  85. private TbItemService tbItemService;
  86. @Resource
  87. private TbItemTypeService tbItemTypeService;
  88. @Resource
  89. private TbBusinessItemService tbBusinessItemService;
  90. @Resource
  91. TbUnitService tbUnitService;
  92. @Resource
  93. TbBusinessPeopleService tbBusinessPeopleService;
  94. @Resource
  95. private PartConfig partConfig;
  96. @Resource
  97. private CarConfig carConfig;
  98. @Resource
  99. private TbNoticesService tbNoticesService;
  100. @Resource
  101. TbBusinessCarService tbBusinessCarService;
  102. @Resource
  103. @Lazy
  104. TbDeclareService tbDeclareService;
  105. @Resource
  106. TbGoodsService tbGoodsService;
  107. public TbBusiness checkCarNo(String carNo) {
  108. QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
  109. ew.eq("card_no", carNo)
  110. .eq("admin_confirm_out", 0);
  111. return this.getOne(ew);
  112. }
  113. /**
  114. * 增
  115. */
  116. public AjaxJson addOrUpdate(TbBusiness t) {
  117. if (StrUtil.isNotEmpty(t.getId()) && StrUtil.isNotEmpty(t.getDeclareNo())) {
  118. TbBusiness db = this.getById(t.getId());
  119. if (!StrUtil.equals(db.getDeclareNo(), t.getDeclareNo())) {
  120. TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(db.getDeclareNo());
  121. if (tbDeclare != null) {
  122. tbDeclare.setBusinessId("");
  123. tbDeclareService.updateById(tbDeclare);
  124. }
  125. }
  126. }
  127. Double carSize = t.getCardSize();
  128. if (carSize != null && carSize > carConfig.getMaxLength()) {
  129. return AjaxJson.getError("车辆规格不能大于" + carConfig.getMaxLength());
  130. }
  131. Double netWeight = t.getNetWeight();
  132. if (netWeight != null && netWeight > carConfig.getMaxWeight()) {
  133. return AjaxJson.getError("车辆载重不能大于" + carConfig.getMaxWeight());
  134. }
  135. t.setCreateBy(StpUserUtil.getAdmin().getName());
  136. createCarUnit(t);
  137. String customerId = t.getCustomerId();
  138. TbCostomer tbCostomer = tbCostomerService.getById(customerId);
  139. t.setCustomerName(tbCostomer.getName()).setCustomerType(tbCostomer.getPayType());
  140. if (StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
  141. t.setConfirmInputBy(StpUserUtil.getAdmin().getName())
  142. .setConfirmInput(1)
  143. .setConfirmInputTime(new Date());
  144. }
  145. if (StrUtil.isEmpty(t.getId())) {
  146. t.setCreateTime(new Date());
  147. t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
  148. storeMsg(t.getCustomerId(), "新增一条业务数据:【" + t.getNo() + "】" + DateUtil.now() + "。");
  149. } else {
  150. storeMsg(t.getCustomerId(), "业务订单:【" + t.getNo() + "】数据发生更改," + DateUtil.now() + "。");
  151. }
  152. saveOrUpdate(t);
  153. createBusinessPeople(t);
  154. tbBusinessItemService.removeByBusinessId(t.getId());
  155. BigDecimal price = new BigDecimal(0);
  156. List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
  157. List<String> typeNames = new ArrayList<>();
  158. for (TbBusinessItem item : items) {
  159. Double num = NumberUtil.parseDouble(item.getNum());
  160. TbItem tbItem = tbItemService.getById(item.getItemId());
  161. price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
  162. TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
  163. String type = tbItemType.getName();
  164. typeNames.add(type);
  165. item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
  166. .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
  167. .setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
  168. .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice()));
  169. }
  170. List<TbBusinessCar> carList = JSONUtil.toList(t.getCarJson(), TbBusinessCar.class);
  171. String chinaCarNo = carList.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
  172. t.setChinaCarNo(StrUtil.isNotEmpty(chinaCarNo) ? chinaCarNo.toUpperCase() : "");
  173. carList.forEach(tbBusinessCar -> {
  174. String carNo = tbBusinessCar.getCarNo().toUpperCase();
  175. TbBusinessCar db = tbBusinessCarService.findByBusinessIdAndCarNo(t.getId(), carNo);
  176. if (db != null) {
  177. tbBusinessCar.setId(db.getId());
  178. }
  179. TbBusinessCar car = tbBusinessCarService.findInAndNoBusinessCar(carNo);
  180. if (car != null) {
  181. tbBusinessCar.setId(car.getId()).setRealInTime(car.getRealInTime());
  182. }
  183. tbBusinessCar.setBusinessId(t.getId());
  184. tbBusinessCar.setCarNo(carNo);
  185. tbBusinessCar.setBusinessId(t.getId()).setCustomerId(t.getCustomerId());
  186. });
  187. String yueCarNo = t.getCardNo().toUpperCase();
  188. TbBusinessCar yueCar = tbBusinessCarService.findInAndNoBusinessCar(yueCarNo);
  189. if (yueCar == null) {
  190. yueCar = tbBusinessCarService.findByBusinessIdAndCarNo(t.getId(), yueCarNo);
  191. if (yueCar == null) {
  192. yueCar = new TbBusinessCar();
  193. }
  194. }
  195. yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
  196. carList.add(yueCar);
  197. tbBusinessCarService.saveOrUpdateBatch(carList);
  198. BigDecimal initCarPartMoney = partConfig.getBasePrice();
  199. t.setItemPrice(price)
  200. .setTotalMoney(price.add(initCarPartMoney.multiply(new BigDecimal(carList.size()))))
  201. .setChinaPartMoney(initCarPartMoney.multiply(new BigDecimal(carList.size() - 1)))
  202. .setPartMoney(initCarPartMoney);
  203. this.saveOrUpdate(t);
  204. tbBusinessItemService.saveBatch(items);
  205. if (StrUtil.isNotEmpty(t.getDeclareNo())) {
  206. TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(t.getDeclareNo());
  207. tbDeclare.setBusinessId(t.getId());
  208. tbDeclareService.updateById(tbDeclare);
  209. }
  210. return AjaxJson.getSuccess();
  211. }
  212. public void storeMsg(String businessCustomerId, String content) {
  213. String currentCustomerId = StpUserUtil.getCustomerId();
  214. if (StrUtil.equals(currentCustomerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
  215. BusinessMessageManager.set(businessCustomerId, content);
  216. } else {
  217. BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), content);
  218. }
  219. }
  220. private void createBusinessPeople(TbBusiness t) {
  221. tbBusinessPeopleService.removeByBusinessId(t.getId());
  222. List<TbBusinessPeople> peopleList = JSONUtil.toList(t.getPeopleJson(), TbBusinessPeople.class);
  223. peopleList.forEach(tbBusinessPeople -> tbBusinessPeople.setBusinessId(t.getId()).setCreateTime(new Date()));
  224. tbBusinessPeopleService.saveBatch(peopleList);
  225. }
  226. private void createCarUnit(TbBusiness t) {
  227. TbUnit tbUnit = tbUnitService.findByUnit(t.getCardSize());
  228. if (tbUnit == null) {
  229. tbUnit = new TbUnit();
  230. tbUnit.setUnit(t.getCardSize() + "");
  231. tbUnitService.save(tbUnit);
  232. }
  233. }
  234. private TbDriver createDriver(TbBusiness business) {
  235. TbDriver tbDriver = tbDriverService.findByIdCardNo(business.getCardNo());
  236. if (tbDriver == null) {
  237. tbDriver = new TbDriver();
  238. tbDriver.setCreateTime(new Date()).setIdCard(business.getCardNo())
  239. .setName(business.getDriverName()).setPhone(business.getDriverPhone());
  240. tbDriverService.save(tbDriver);
  241. }
  242. return tbDriver;
  243. }
  244. private TbCar createCar(TbBusiness business) {
  245. String cardNo = business.getCardNo();
  246. TbCar tbCar = tbCarService.findByCardNo(cardNo);
  247. if (tbCar == null) {
  248. tbCar = new TbCar();
  249. }
  250. tbCar.setCardNo(cardNo)
  251. .setCardSize(business.getCardSize())
  252. .setCountryName(business.getCountryName())
  253. .setLastGoodsName(business.getGoodsName())
  254. .setLastNetWeight(business.getNetWeight());
  255. tbCarService.saveOrUpdate(tbCar);
  256. return tbCar;
  257. }
  258. /**
  259. * 查集合 - 根据条件(参数为空时代表忽略指定条件)
  260. */
  261. public List<TbBusiness> getList(SoMap so) {
  262. return tbBusinessMapper.getList(so);
  263. }
  264. public void pay(String id, String payTicket) {
  265. TbBusiness tbBusiness = this.getById(id);
  266. SpAdmin admin = StpUserUtil.getAdmin();
  267. tbBusiness.setPayStatus(2).setPayBy(admin.getName())
  268. .setPayBy(StpUserUtil.getAdmin().getName())
  269. .setPayTicket(payTicket)
  270. .setPayTime(new Date());
  271. if (StrUtil.equals(admin.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
  272. tbBusiness.setAdminConfirmPay(1).setPayStatus(3)
  273. .setAdminConfirmPayBy(admin.getName()).setAdminConfirmPayTime(new Date());
  274. }
  275. this.updateById(tbBusiness);
  276. storeMsg(tbBusiness.getCustomerId(), "业务订单【" + tbBusiness.getNo() + "】已支付" + DateUtil.now() + "。");
  277. //发送消息
  278. String text = "您的费用已支付,业务单号[" + tbBusiness.getNo() + "]";
  279. tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
  280. }
  281. public void confirm(List<String> ids) {
  282. ids.forEach(id -> {
  283. TbBusiness business = this.getById(id);
  284. business.setConfirmInput(1).setConfirmInputTime(new Date()).setConfirmInputBy(StpUserUtil.getAdmin().getName());
  285. this.updateById(business);
  286. storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认" + DateUtil.now() + "。");
  287. });
  288. }
  289. public void adminConfirmPay(List<String> ids, String ticket) {
  290. ids.forEach(id -> {
  291. TbBusiness business = this.getById(id);
  292. business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
  293. .setPayStatus(3).setPayTicket(ticket);
  294. this.updateById(business);
  295. storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认支付" + DateUtil.now() + "。");
  296. //发送消息
  297. String text = "您的费用已支付,业务单号[" + business.getNo() + "]";
  298. tbNoticesService.sendNotice(business.getId(), business.getNo(), business.getCustomerId(), text);
  299. });
  300. }
  301. public TbBusiness findCarTheNewRecord(String carNo, int inOrOut) {
  302. QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
  303. ew.eq("card_no", carNo);
  304. if (inOrOut == 1) {
  305. ew.eq("admin_confirm_in", 0).isNull("in_channel");
  306. } else {
  307. ew.eq("admin_confirm_out", 0).isNull("out_channel").isNotNull("real_in_time");
  308. }
  309. return getOne(ew);
  310. }
  311. @Deprecated
  312. public void adminConfirmIn(String id, String inChannel) {
  313. TbBusiness tbBusiness = this.getById(id);
  314. tbBusiness.setRealInTime(new Date()).setInChannel(inChannel);
  315. this.updateById(tbBusiness);
  316. //更新境外车入场记录
  317. //更新中国车入场记录
  318. //发送消息
  319. String text = "您的车辆已入场,业务单号[" + tbBusiness.getNo() + "]";
  320. tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
  321. }
  322. public void adminOut(String id, Date outDayTime, String outChannel, String carType) {
  323. TbBusiness tbBusiness = this.getById(id);
  324. tbBusiness.setOutDayTime(outDayTime).setOutChannel(outChannel);
  325. calculationPartMoney(carType, tbBusiness);
  326. this.updateById(tbBusiness);
  327. //更新境外车出场记录
  328. //更新中国车出场记录
  329. //发送消息
  330. String text = "您的车辆已离场,业务单号[" + tbBusiness.getNo() + "]";
  331. tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
  332. }
  333. @Async
  334. public void calculationPartMoney(String itemType, TbBusiness tbBusiness) {
  335. Date iTime = tbBusiness.getRealInTime();
  336. Date oTime = tbBusiness.getOutDayTime();
  337. if (itemType.contains("中国")) {
  338. iTime = tbBusiness.getChinaCarInTime();
  339. oTime = tbBusiness.getChinaCarOutTime();
  340. }
  341. BigDecimal price = calculationPartMoney(iTime, oTime);
  342. if (itemType.contains("中国")) {
  343. int len = tbBusiness.getCardNo().split(" ").length;
  344. tbBusiness.setChinaPartMoney(price.multiply(new BigDecimal(len)));
  345. } else {
  346. tbBusiness.setPartMoney(price);
  347. }
  348. tbBusiness.setTotalMoney(tbBusiness.getItemPrice().add(tbBusiness.getChinaPartMoney()).add(tbBusiness.getPartMoney()));
  349. }
  350. public BigDecimal calculationPartMoney(Date iTime, Date oTime) {
  351. LocalDateTime inDayTime = iTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
  352. LocalDateTime outDayTime = oTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
  353. long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
  354. BigDecimal zero = new BigDecimal("0");
  355. if (minutes < 0) {
  356. return zero;
  357. }
  358. long days = ChronoUnit.DAYS.between(inDayTime.toLocalDate(), outDayTime.toLocalDate());
  359. long hour = ChronoUnit.HOURS.between(inDayTime, outDayTime);
  360. BigDecimal basePrice = partConfig.getBasePrice();
  361. BigDecimal extraPrice = partConfig.getExtraPrice();
  362. return basePrice.add(basePrice.multiply(new BigDecimal(hour / 24))).add(new BigDecimal(days).multiply(extraPrice));
  363. }
  364. /**
  365. * @param carNo
  366. * @param inOrOut 1入 2出
  367. * @return
  368. */
  369. public TbBusiness findByChinaCarNo(String carNo, int inOrOut) {
  370. QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
  371. ew.like("china_car_no", carNo);
  372. if (inOrOut == 1) {
  373. ew.eq("admin_confirm_in", 0).isNull("china_car_in_channel");
  374. } else {
  375. ew.eq("admin_confirm_out", 0)
  376. .isNull("china_car_out_channel")
  377. .isNotNull("china_car_in_time");
  378. }
  379. return this.getOne(ew);
  380. }
  381. public TbBusiness finByNo(String no) {
  382. QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
  383. ew.eq("no", no);
  384. return getOne(ew);
  385. }
  386. public Map<String, Object> getBusinessMoney(String carId, String state) {
  387. Map<String, Object> result = new HashMap<>();
  388. TbBusinessCar car = tbBusinessCarService.getById(carId);
  389. String businessId = car.getBusinessId();
  390. result.put("businessId", businessId);
  391. List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(businessId);
  392. Date now = new Date();
  393. List<Map<String, Object>> carsList = new ArrayList<>();
  394. for (TbBusinessCar tbBusinessCar : cars) {
  395. double partMoney = tbBusinessCar.getBasePartMoney().doubleValue();
  396. if (!StrUtil.equals("STATE", state)) {
  397. Date inTime = tbBusinessCar.getRealInTime();
  398. if (inTime != null) {
  399. BigDecimal price = this.calculationPartMoney(inTime, now);
  400. BigDecimal money = tbBusinessCar.getMoney();
  401. BigDecimal basePrice = tbBusinessCar.getBasePartMoney();
  402. partMoney = money == null ? price.subtract(basePrice).doubleValue() : price.subtract(money).doubleValue();
  403. } else {
  404. partMoney = 0D;
  405. }
  406. }
  407. Map<String, Object> carMap = new HashMap<>();
  408. carMap.put("price", partMoney);
  409. carMap.put("id", tbBusinessCar.getId());
  410. carMap.put("carNo", tbBusinessCar.getCarNo());
  411. carMap.put("pay",tbBusinessCar.getPay());
  412. carsList.add(carMap);
  413. }
  414. result.put("carList", carsList);
  415. TbBusiness tbBusiness = this.getById(businessId);
  416. if (tbBusiness != null && tbBusiness.getPayStatus() != TbBusiness.PayStatus.HAS_PAY_CONFIRM.getCode()) {
  417. List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
  418. result.put("itemsPrice", tbBusiness.getItemPrice());
  419. result.put("businessId", businessId);
  420. List<Map<String, Object>> itemList = new ArrayList<>();
  421. for (TbBusinessItem item : items) {
  422. Map<String, Object> itemMap = new HashMap<>();
  423. itemMap.put("id", item.getId());
  424. itemMap.put("name", item.getItemName());
  425. itemMap.put("price", item.getItemPrice());
  426. itemMap.put("pay", item.getPayStatus());
  427. itemList.add(itemMap);
  428. }
  429. result.put("itemList", itemList);
  430. }
  431. return result;
  432. }
  433. public void uploadReport(TbBusiness tbBusiness) {
  434. this.updateById(tbBusiness);
  435. List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(tbBusiness.getId());
  436. cars.forEach(tbBusinessCar -> tbBusinessCar.setIsLock(0));
  437. tbBusinessCarService.updateBatchById(cars);
  438. }
  439. }