| | |
| | | wrapper.eq("customer_id",id); |
| | | wrapper.eq("status",1); |
| | | List<CustomerReceive> list = iCustomerReceiveService.list(wrapper); |
| | | for (CustomerReceive customerReceive : list) { |
| | | if(StrUtil.isBlank(customerReceive.getPhone())){ |
| | | customerReceive.setPhone(" "); |
| | | } |
| | | } |
| | | customer.setReceives(list); |
| | | return new ResultUtil<Customer>().setData(customer); |
| | | } |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByPage", method = RequestMethod.GET) |
| | | @ApiOperation(value = "" + |
| | | "") |
| | | public Result<IPage<Customer>> getByPage(String areaSectionId,String name,PageVo page) { |
| | | @ApiOperation(value = "") |
| | | public Result<IPage<Customer>> getByPage(String areaSectionId,String customerName,PageVo page) { |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | if (!StrUtil.isEmpty(areaSectionId)) |
| | | wrapper.eq("area_section_id",areaSectionId); |
| | | if (!StrUtil.isEmpty(name)) |
| | | wrapper.like("name","%"+name+"%"); |
| | | if (!StrUtil.isEmpty(customerName)) |
| | | wrapper.like("name", "%" + customerName + "%"); |
| | | IPage<Customer> data = iCustomerService.page(PageUtil.initMpPage(page),wrapper); |
| | | return new ResultUtil<IPage<Customer>>().setData(data); |
| | | } |
| | |
| | | public Result<Customer> saveOrUpdate(Customer customer) { |
| | | |
| | | if (iCustomerService.saveOrUpdate(customer)) { |
| | | |
| | | if(StrUtil.isNotEmpty(customer.getLinker())){ |
| | | QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("customer_id",customer.getId()); |
| | | wrapper.eq("name",customer.getLinker()); |
| | | CustomerReceive one = iCustomerReceiveService.getOne(wrapper); |
| | | if(one==null){ |
| | | one = new CustomerReceive(); |
| | | one.setCustomerId(customer.getId()); |
| | | one.setFstatus(0); |
| | | one.setStatus(1); |
| | | one.setName(customer.getLinker()); |
| | | one.setPhone(customer.getPhone()); |
| | | iCustomerReceiveService.saveOrUpdate(one); |
| | | } |
| | | } |
| | | return new ResultUtil<Customer>().setData(customer); |
| | | } |
| | | return new ResultUtil<Customer>().setErrorMsg("操作失败"); |
| | |
| | | if(StrUtil.isNotEmpty(lng)){ |
| | | customer.setLng(lng); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将定位信息填写完整"); |
| | | } |
| | | if(StrUtil.isNotEmpty(lat)){ |
| | | customer.setLat(lat); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将定位信息填写完整"); |
| | | } |
| | | |
| | | QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("lng",lng); |
| | | wrapper.eq("lat",lat); |
| | | List<Customer> list = iCustomerService.list(wrapper); |
| | | if(list.size()>0){ |
| | | for(Customer c:list){ |
| | | c.setLikeCusotmerId(customerId); |
| | | iCustomerService.saveOrUpdate(c); |
| | | } |
| | | //customer.setLikeCusotmerId(list.get(0).getId()); |
| | | } |
| | | |
| | | |
| | | if(StrUtil.isNotEmpty(address)){ |
| | | customer.setRegisteredAddress(address); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将位置信息填写完整"); |
| | | } |
| | | if(StrUtil.isNotEmpty(headImg)){ |
| | | customer.setHeadImg(headImg); |
| | | }else{ |
| | | return ResultUtil.error("请将信息填写完整"); |
| | | return ResultUtil.error("请将门头照信息填写完整"); |
| | | } |
| | | customer.setKstatus(2); |
| | | if (iCustomerService.saveOrUpdate(customer)) { |