diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java index 9c461f97..50b417c9 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java @@ -113,21 +113,20 @@ public class OrderController extends BaseController { @GetMapping("/imgs") - public String orderImgs(Long orderId, ModelMap mmap){ + public String orderImgs(Long orderId, ModelMap mmap) { mmap.put("orderId", orderId); return "order/imgs"; } @PostMapping("/imgs/list") @ResponseBody - public TableDataInfo list(GoodsImgs goodsImgs) - { + public TableDataInfo list(GoodsImgs goodsImgs) { List details = orderDetailService.selectByOrderMasterId(Long.valueOf(goodsImgs.getRemark())); List ids = details.stream().map(OrderDetail::getId).collect(Collectors.toList()); goodsImgs.setRemark(null); goodsImgs.setRemarks(ids); goodsImgs.setImgType(ImgType.FINISH_IMG.getId()); - List list = goodsImgsService.qryGoodsImgs(goodsImgs); + List list = goodsImgsService.qryGoodsImgs(goodsImgs); return getDataTable(list); } @@ -180,7 +179,7 @@ public class OrderController extends BaseController { public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request) { // 判断传递价格是否有小数 - if (new BigDecimal(request.getPrice().intValue()).compareTo(request.getPrice())!=0){ + if (new BigDecimal(request.getPrice().intValue()).compareTo(request.getPrice()) != 0) { return AjaxResult.error("后台发单金额不能含有小数!"); } @@ -281,12 +280,12 @@ public class OrderController extends BaseController { orderMaster.setStreetId(request.getStreetId()); orderMaster.setStreetName(customerAddress.getStreetName()); - if("01".equalsIgnoreCase(orderMaster.getConsultMode())){ + if ("01".equalsIgnoreCase(orderMaster.getConsultMode())) { orderMaster.setOrderMode("02"); orderMaster.setPayMode("01"); } // 存在登陆用户的情况下 - if(getSysUser() != null){ + if (getSysUser() != null) { orderMaster.setCreateBy(getSysUser().getUserId().toString()); } // 服务时间 @@ -499,7 +498,7 @@ public class OrderController extends BaseController { // 预约时间 paramsNew.put("time4", com.ghy.common.utils.DateUtils.parseDateToStr("yyyy年MM月dd日 HH:mm", om.getExpectTimeStart())); // 非自己承接的订单需要通知 - logger.info("主订单师傅{},派单师傅{}", om.getWorkerId(),request.getWorkerId()); + logger.info("主订单师傅{},派单师傅{}", om.getWorkerId(), request.getWorkerId()); if (!om.getWorkerId().equals(request.getWorkerId())) { WechatMsgUtils.sendWeChatMsg(WechatMsgUtils.getToken(), acceptWorker.getWxOpenId(), WxMsgEnum.NORMAL_ORDER, paramsNew); } @@ -559,11 +558,11 @@ public class OrderController extends BaseController { orderMaster.setInsuranceId(appOrderRequest.getInsuranceId()); //处理新增订单的地址 - CustomerAddress customerAddress=customerAddressService.selectByCustomerAddressId(appOrderRequest.getAddressId()); - SysArea sysArea=sysAreaService.selectById(customerAddress.getStreetId()); - String addressSysArea=sysArea.getMergerName(); + CustomerAddress customerAddress = customerAddressService.selectByCustomerAddressId(appOrderRequest.getAddressId()); + SysArea sysArea = sysAreaService.selectById(customerAddress.getStreetId()); + String addressSysArea = sysArea.getMergerName(); String[] array = addressSysArea.split(","); - logger.info("下单后的地址信息{}",array); + logger.info("下单后的地址信息{}", array); orderMaster.setProvinceId(customerAddress.getProvinceId()); orderMaster.setCityId(customerAddress.getCityId()); orderMaster.setCountryId(customerAddress.getCountryId()); @@ -584,9 +583,9 @@ public class OrderController extends BaseController { BigDecimal insuranceMoney = BigDecimal.ZERO; // 保险金额 - if(appOrderRequest.getInsuranceId() != null){ + if (appOrderRequest.getInsuranceId() != null) { InsuranceManager manager = insuranceManagerService.selectInsuranceManagerById(appOrderRequest.getInsuranceId()); - if(manager != null){ + if (manager != null) { payMoney = payMoney.add(manager.getInsuranceAmount()); insuranceMoney = insuranceMoney.add(manager.getInsuranceAmount()); orderMaster.setInsuranceId(manager.getId()); @@ -697,9 +696,9 @@ public class OrderController extends BaseController { Long customerPlaceId = customer.getCustomerPlace(); Long parentCustomerPlaceId = customer.getParentCustomerPlace(); Long reparentCustomerPlaceId = null; - if(customer.getParentCustomerPlace() != null){ - Customer parentPlaceCustomer =customerService.selectByCustomerId(customer.getParentCustomerPlace()); - if(parentPlaceCustomer != null){ + if (customer.getParentCustomerPlace() != null) { + Customer parentPlaceCustomer = customerService.selectByCustomerId(customer.getParentCustomerPlace()); + if (parentPlaceCustomer != null) { reparentCustomerPlaceId = parentPlaceCustomer.getCustomerPlace(); } } @@ -722,7 +721,7 @@ public class OrderController extends BaseController { // 剩余服务金额 serverMoney = serverMoney.subtract(twoMoney); - }else if(customerPlaceId != null){ + } else if (customerPlaceId != null) { // 二级没有,且三级有 FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(), financialMaster.getId(), financialMaster.getCode(), twoMoney, FinancialDetailType.PLACE_FEE.getCode(), customerPlaceId); @@ -733,7 +732,7 @@ public class OrderController extends BaseController { } // 最上级分,没有则给下级,再没有再给下级 - if(reparentCustomerPlaceId != null){ + if (reparentCustomerPlaceId != null) { // 平台分销 FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(), financialMaster.getId(), financialMaster.getCode(), oneMoney, FinancialDetailType.PLACE_FEE.getCode(), reparentCustomerPlaceId); @@ -741,7 +740,7 @@ public class OrderController extends BaseController { // 剩余服务金额 serverMoney = serverMoney.subtract(oneMoney); - }else if(parentCustomerPlaceId != null){ + } else if (parentCustomerPlaceId != null) { // 平台分销 FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(), financialMaster.getId(), financialMaster.getCode(), oneMoney, FinancialDetailType.PLACE_FEE.getCode(), parentCustomerPlaceId); @@ -749,7 +748,7 @@ public class OrderController extends BaseController { // 剩余服务金额 serverMoney = serverMoney.subtract(oneMoney); - }else if(customerPlaceId != null){ + } else if (customerPlaceId != null) { // 平台分销 FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(), financialMaster.getId(), financialMaster.getCode(), oneMoney, FinancialDetailType.PLACE_FEE.getCode(), customerPlaceId); @@ -971,7 +970,7 @@ public class OrderController extends BaseController { OrderMaster param = new OrderMaster(); param.setWorkerId(orderListRequest.getWorkerId()); List allOrderMaster = orderMasterService.selectOrderMasterList(param); - if(CollectionUtils.isNotEmpty(allOrderMaster)){ + if (CollectionUtils.isNotEmpty(allOrderMaster)) { OrderDetail countParam = new OrderDetail(); countParam.setMasterIds(allOrderMaster.stream().map(OrderMaster::getId).collect(Collectors.toList())); List orderDetails = orderDetailService.selectOrderDetailList(countParam); @@ -1097,7 +1096,7 @@ public class OrderController extends BaseController { // } // orderListResponses.addAll(filteredMasterList); // } else { - orderListResponses.addAll(masterList); + orderListResponses.addAll(masterList); // } // 查询新订单列表根据创建时间倒叙排列,查询其他根据更新时间倒序排列 @@ -1148,9 +1147,9 @@ public class OrderController extends BaseController { break; } } - long count = detailAfterListOfMasters.stream().filter(x->(x.getAfterTimeout()!=null && x.getAfterTimeout() == 1)).count(); + long count = detailAfterListOfMasters.stream().filter(x -> (x.getAfterTimeout() != null && x.getAfterTimeout() == 1)).count(); if (isKeep) { - if(count > 0){ + if (count > 0) { master.setAfterTimeout(1); } filteredMasterList.add(master); @@ -1246,9 +1245,9 @@ public class OrderController extends BaseController { // 地址信息 CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId()); SysArea sysArea; - if(customerAddress.getStreetId()!=null){ + if (customerAddress.getStreetId() != null) { sysArea = sysAreaService.selectById(customerAddress.getStreetId()); - }else { + } else { sysArea = sysAreaService.selectById(customerAddress.getCountryId()); } String completeAddress = sysArea.getMergerName().replaceAll(",", "") + customerAddress.getAddress(); @@ -1343,7 +1342,7 @@ public class OrderController extends BaseController { if (worker != null) { // 师傅实名信息 workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId()); - workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getSurname()+workerRealInfo.getName(); + workerName = workerRealInfo == null ? worker.getName() : workerRealInfo.getSurname() + workerRealInfo.getName(); } // 消费者信息 @@ -1368,9 +1367,9 @@ public class OrderController extends BaseController { // 地址信息 CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); SysArea sysArea; - if(customerAddress.getStreetId()!=null){ + if (customerAddress.getStreetId() != null) { sysArea = sysAreaService.selectById(customerAddress.getStreetId()); - }else { + } else { sysArea = sysAreaService.selectById(customerAddress.getCountryId()); } String completeAddress = sysArea.getMergerName().replaceAll(",", "") + customerAddress.getAddress(); @@ -1458,7 +1457,7 @@ public class OrderController extends BaseController { OrderDetail masterIdsParam = new OrderDetail(); masterIdsParam.setMasterIds(orderMasterIds); List orderDetailsList = orderDetailService.selectOrderDetailList(masterIdsParam); - Map> orderMasterIdsMap = orderDetailsList.stream().collect(Collectors.groupingBy(OrderDetail::getOrderMasterId)); + Map> orderMasterIdsMap = orderDetailsList.stream().collect(Collectors.groupingBy(OrderDetail::getOrderMasterId)); // -- 都是同一个师傅的,师傅信息 Worker worker = orderMaster.getWorkerId() != null ? workerService.selectById(orderMaster.getWorkerId()) : null; @@ -1468,7 +1467,7 @@ public class OrderController extends BaseController { List standardList = new ArrayList<>(); // 查询所有子单 List orderDetails = orderMasterIdsMap.get(master.getId()); - if(CollectionUtils.isEmpty(orderDetails)){ + if (CollectionUtils.isEmpty(orderDetails)) { orderDetails = new ArrayList<>(); } List orderDetailIds = orderDetails.stream().map(OrderDetail::getId).collect(Collectors.toList()); @@ -1481,27 +1480,27 @@ public class OrderController extends BaseController { Goods goods = goodsService.selectById(goodsStandard.getGoodsId()); // 填充商品三级类目 - if(goods.getDeptGoodsCategoryId() != null){ + if (goods.getDeptGoodsCategoryId() != null) { Long categoryId = null; // 前端发单和后台派单 - if(com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode())||"01".equals(orderMaster.getConsultMode())){ + if (com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode()) || "01".equals(orderMaster.getConsultMode())) { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(goods.getDeptGoodsCategoryId()); - if(deptGoodsCategory != null){ + if (deptGoodsCategory != null) { categoryId = deptGoodsCategory.getGoodsCategoryId(); } - }else { + } else { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goods.getDeptGoodsCategoryId()); - if(deptGoodsCategory != null){ + if (deptGoodsCategory != null) { categoryId = deptGoodsCategory.getGoodsCategoryId(); } } - if(categoryId != null){ + if (categoryId != null) { GoodsCategory one = goodsCategoryService.selectById(categoryId); - if(one != null && one.getParentCategoryId() != null){ + if (one != null && one.getParentCategoryId() != null) { GoodsCategory two = goodsCategoryService.selectById(one.getParentCategoryId()); - if(two != null && two.getParentCategoryId() != null){ + if (two != null && two.getParentCategoryId() != null) { GoodsCategory three = goodsCategoryService.selectById(two.getParentCategoryId()); - if(three != null){ + if (three != null) { goods.setGoodsName(three.getGoodsCategoryName() + "-" + two.getGoodsCategoryName() + "-" + one.getGoodsCategoryName()); @@ -1526,9 +1525,9 @@ public class OrderController extends BaseController { // 地址信息 CustomerAddress customerAddress = addressService.selectByCustomerAddressId(master.getAddressId()); SysArea sysArea; - if(customerAddress.getStreetId()!=null){ + if (customerAddress.getStreetId() != null) { sysArea = sysAreaService.selectById(customerAddress.getStreetId()); - }else { + } else { sysArea = sysAreaService.selectById(customerAddress.getCountryId()); } String completeAddress = sysArea.getMergerName().replaceAll(",", "") + customerAddress.getAddress(); @@ -1586,12 +1585,27 @@ public class OrderController extends BaseController { orderListResponse.setIsCall(master.getIsCall()); orderListResponse.setConsultMode(master.getConsultMode()); orderListResponse.setInsuranceId(master.getInsuranceId()); - if(master.getInsuranceId() != null){ + if (master.getInsuranceId() != null) { InsuranceManager manager = insuranceManagerService.selectInsuranceManagerById(master.getInsuranceId()); - if(manager != null){ + if (manager != null) { orderListResponse.setInsuranceManager(manager); } } + String addressSysArea = sysArea.getMergerName(); + String[] array = addressSysArea.split(","); + logger.info("所有的地址列表{}", array); + orderListResponse.setProvinceName(array[0]); + orderListResponse.setCityName(array[1]); + orderListResponse.setCountryName(array[2]); + orderListResponse.setStreetName(array[3]); + orderListResponse.setProvinceId(customerAddress.getProvinceId()); + orderListResponse.setCityId(customerAddress.getCityId()); + orderListResponse.setCountryId(customerAddress.getCountryId()); + orderListResponse.setStreetId(orderMaster.getStreetId()); + orderListResponse.setAddress(customerAddress.getAddress()); + orderListResponse.setPhone(customerAddress.getPhone()); + orderListResponse.setName(customerAddress.getName()); + orderListResponses.add(orderListResponse); } @@ -1621,27 +1635,27 @@ public class OrderController extends BaseController { Goods goods = goodsService.selectById(orderMaster.getGoodsId()); // 填充商品三级类目 - if(goods.getDeptGoodsCategoryId() != null){ + if (goods.getDeptGoodsCategoryId() != null) { Long categoryId = null; // 前端发单和后台派单 - if(com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode())){ + if (com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode())) { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(goods.getDeptGoodsCategoryId()); - if(deptGoodsCategory != null){ + if (deptGoodsCategory != null) { categoryId = deptGoodsCategory.getGoodsCategoryId(); } - }else { + } else { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goods.getDeptGoodsCategoryId()); - if(deptGoodsCategory != null){ + if (deptGoodsCategory != null) { categoryId = deptGoodsCategory.getGoodsCategoryId(); } } - if(categoryId != null){ + if (categoryId != null) { GoodsCategory one = goodsCategoryService.selectById(categoryId); - if(one != null && one.getParentCategoryId() != null){ + if (one != null && one.getParentCategoryId() != null) { GoodsCategory two = goodsCategoryService.selectById(one.getParentCategoryId()); - if(two != null && two.getParentCategoryId() != null){ + if (two != null && two.getParentCategoryId() != null) { GoodsCategory three = goodsCategoryService.selectById(two.getParentCategoryId()); - if(three != null){ + if (three != null) { goods.setGoodsName(three.getGoodsCategoryName() + "-" + two.getGoodsCategoryName() + "-" + one.getGoodsCategoryName()); @@ -1661,9 +1675,9 @@ public class OrderController extends BaseController { // 地址信息 CustomerAddress customerAddress = addressService.selectByCustomerAddressId(orderMaster.getAddressId()); SysArea sysArea; - if(customerAddress.getStreetId()!=null){ + if (customerAddress.getStreetId() != null) { sysArea = sysAreaService.selectById(customerAddress.getStreetId()); - }else { + } else { sysArea = sysAreaService.selectById(customerAddress.getCountryId()); } String completeAddress = sysArea.getMergerName().replaceAll(",", "") + customerAddress.getAddress(); @@ -1734,9 +1748,9 @@ public class OrderController extends BaseController { orderListResponse.setUpdateTime(detail.getUpdateTime()); orderListResponse.setConsultMode(orderMaster.getConsultMode()); orderListResponse.setInsuranceId(orderMaster.getInsuranceId()); - if(orderMaster.getInsuranceId() != null){ + if (orderMaster.getInsuranceId() != null) { InsuranceManager manager = insuranceManagerService.selectInsuranceManagerById(orderMaster.getInsuranceId()); - if(manager != null){ + if (manager != null) { orderListResponse.setInsuranceManager(manager); } }