diff --git a/jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/system/controller/CardApplicationCustomersController.java b/jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/system/controller/CardApplicationCustomersController.java index b35e89e..d048fa0 100644 --- a/jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/system/controller/CardApplicationCustomersController.java +++ b/jeecg-boot-module/jeecg-module-service/src/main/java/org/jeecg/modules/system/controller/CardApplicationCustomersController.java @@ -1,10 +1,7 @@ package org.jeecg.modules.system.controller; import java.math.BigDecimal; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -13,6 +10,7 @@ import cn.hutool.core.date.DateUtil; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; @@ -26,9 +24,12 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.system.dto.CardApplicationCustomersUpdateDTO; +import org.jeecg.modules.system.dto.CardDeliveryPersonDTO; import org.jeecg.modules.system.entity.CardApplicationCustomers; import org.jeecg.modules.system.entity.CardDeliveryPerson; import org.jeecg.modules.system.service.ICardApplicationCustomersService; +import org.jeecg.modules.system.service.ICardDeliveryPersonService; +import org.jeecg.modules.system.vo.AreaCardDeliveryPersonVO; import org.jeecg.modules.system.vo.CardApplicationCustomersVO; import org.jeecg.modules.system.vo.CardDeliveryPersonVO; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -39,6 +40,7 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.repository.query.Param; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -62,6 +64,9 @@ @Autowired private ICardApplicationCustomersService cardApplicationCustomersService; + @Autowired + private ICardDeliveryPersonService cardDeliveryPersonService; + /** * 分页列表查询 * @@ -205,4 +210,38 @@ cardApplicationCustomersService.updateById(entry); return Result.OK("派单成功!"); } + + /** + * 获取指定区域的送卡人列表 + */ + @GetMapping(value = "/getAreaCardDeliveryPersonList") + public Result> getAreaCardDeliveryPersonList(@RequestParam(value = "province") String province, + @RequestParam(value = "city") String city, + @RequestParam(value = "area") String area, + @RequestParam(value = "address") String address) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isNotBlank(province)){ + queryWrapper.eq("province", province); + } + if (StringUtils.isNotBlank(city)){ + queryWrapper.eq("city", city); + } + if (StringUtils.isNotBlank(area)){ + queryWrapper.eq("area", area); + } + if (StringUtils.isNotBlank(address)){ + queryWrapper.like("address",address); + } + List list = cardDeliveryPersonService.list(queryWrapper); + List voList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty( list)){ + voList = list.stream().map(record -> { + AreaCardDeliveryPersonVO vo = new AreaCardDeliveryPersonVO(); + vo.setId(record.getId()); + vo.setName(record.getName()); + return vo; + }).collect(Collectors.toList()); + } + return Result.OK(voList); + } }