diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java index dd8b1304..e2cb9914 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java @@ -1,6 +1,8 @@ package com.ghy.web.controller.customer; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import com.ghy.common.enums.PlaceStatus; import com.ghy.common.utils.CacheUtils; @@ -11,6 +13,7 @@ import com.ghy.customer.service.CustomerService; import com.ghy.worker.domain.Worker; import com.ghy.worker.domain.WorkerBank; import com.ghy.worker.domain.WorkerCertification; +import org.apache.commons.collections.CollectionUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -63,6 +66,20 @@ public class CustomerPlaceController extends BaseController return getDataTable(list); } + @PostMapping("/app/myCustomerPlace") + @ResponseBody + public AjaxResult myCustomerPlace(@RequestBody CustomerPlace customerPlace){ + Customer param = new Customer(); + param.setCustomerPlace(customerPlace.getCustomerId()); + param.setPlaceStatus(1); + List customerList = customerService.getCustomerList(param); + List ids = customerList.stream().map(Customer::getCustomerId).collect(Collectors.toList()); + if(!CollectionUtils.isNotEmpty(ids)){ + return AjaxResult.success(new ArrayList<>()); + } + return AjaxResult.success(customerPlaceService.getByCustomerIds(ids)); + } + /** * App查询分销申请列表 */ @@ -168,6 +185,13 @@ public class CustomerPlaceController extends BaseController return toAjax(customerPlaceService.updateCustomerPlace(customerPlace)); } + @PostMapping("/app/edit") + @ResponseBody + public AjaxResult appEdit(@RequestBody CustomerPlace customerPlace) + { + return toAjax(customerPlaceService.updateCustomerPlace(customerPlace)); + } + /** * 删除分销申请 */ diff --git a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java index 2dc0cd80..a53b69c1 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java +++ b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java @@ -42,6 +42,16 @@ public class CustomerPlace extends BaseEntity private String subType; + private String customerLogoUrl; + + public String getCustomerLogoUrl() { + return customerLogoUrl; + } + + public void setCustomerLogoUrl(String customerLogoUrl) { + this.customerLogoUrl = customerLogoUrl; + } + public void setId(String id) { this.id = id; diff --git a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java index 2921b91d..be9d14ef 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java +++ b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java @@ -20,6 +20,8 @@ public interface CustomerPlaceMapper */ public CustomerPlace selectCustomerPlaceById(String id); + public List getByCustomerIds(@Param("ids") List ids); + /** * 查询分销申请列表 * diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java index 7195f957..a1f6e97b 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java @@ -2,6 +2,7 @@ package com.ghy.customer.service; import java.util.List; import com.ghy.customer.domain.CustomerPlace; +import org.apache.ibatis.annotations.Param; /** * 分销申请Service接口 @@ -19,6 +20,8 @@ public interface ICustomerPlaceService */ public CustomerPlace selectCustomerPlaceById(String id); + public List getByCustomerIds(List ids); + /** * 查询分销申请列表 * diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java index 31f14085..441e963f 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java @@ -1,6 +1,8 @@ package com.ghy.customer.service.impl; import java.util.List; import com.ghy.common.utils.DateUtils; +import com.ghy.customer.domain.Customer; +import com.ghy.customer.service.CustomerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ghy.customer.mapper.CustomerPlaceMapper; @@ -20,6 +22,9 @@ public class CustomerPlaceServiceImpl implements ICustomerPlaceService @Autowired private CustomerPlaceMapper customerPlaceMapper; + @Autowired + private CustomerService customerService; + /** * 查询分销申请 * @@ -32,6 +37,16 @@ public class CustomerPlaceServiceImpl implements ICustomerPlaceService return customerPlaceMapper.selectCustomerPlaceById(id); } + @Override + public List getByCustomerIds(List ids) { + List byCustomerIds = customerPlaceMapper.getByCustomerIds(ids); + byCustomerIds.forEach(customerPlace -> { + Customer customer = customerService.selectByCustomerId(customerPlace.getCustomerId()); + customerPlace.setCustomerLogoUrl(customer.getCustomerLogoUrl()); + }); + return byCustomerIds; + } + /** * 查询分销申请列表 * diff --git a/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml b/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml index 75bf25f7..29a8862c 100644 --- a/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml +++ b/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml @@ -22,6 +22,20 @@ select id, name, customer_id, phone, city, status, create_by, create_time, update_by, update_time, remark from customer_place + + +