diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java index 6b2dc9a21..1ab166601 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java @@ -62,7 +62,7 @@ public class InvestBaseController extends BaseController { @Override public void setAsText(String text) { try { - setValue(InvestHelper.codeOf(clz, Integer.parseInt(text))); + setValue(InvestHelper.codeOf(clz, text)); } catch (Exception NumberFormatException) { setValue(InvestHelper.valueOf(clz, text)); } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java index 25cce57f8..7c909b84f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java @@ -20,7 +20,7 @@ public class InvestTaskQuery extends InvestPageQuery { /** * 负责人 */ - @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "taskOwner") + @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "taskOwner" ,example = "id") private String taskOwner; /** diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java index 535e05e43..7e6accb13 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java @@ -118,7 +118,11 @@ public class InvestHelper { } @SuppressWarnings("unchecked") - public static > T codeOf(Class enumType, int code) { + public static > T codeOf(Class enumType, String value) { + if (StringUtils.isEmpty(value)) { + return null; + } + int code = Integer.parseInt(value); try { Method method = enumType.getDeclaredMethod("getEnum", Integer.class); Object rs = method.invoke(null, code); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index 47bd4c6a8..c6555bad4 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -61,21 +61,17 @@ public class InvestBizServiceImpl implements InvestBizService { InvestPageResult investPage = new InvestPageResult<>(); LambdaQueryWrapper queryWrapperDemand = null; - if (Objects.nonNull(customerParams)) { - Collection customers = customerService.list(new QueryWrapper<>(customerParams)); - if (CollectionUtils.isEmpty(customers)) { - return investPage; - } - queryWrapperDemand = new LambdaQueryWrapper<>(); - queryWrapperDemand.in(InvestDemandEntity::getCustomerId, getIds(customers, InvestCustomerEntity::getId)); - } - - InvestPageResult demandPage = demandService.queryPage(buildPageQuery(params, demandParams), queryWrapperDemand); - if (CollectionUtils.isEmpty(demandPage.getRecords())) { + InvestPageResult customers = customerService.queryPage(buildPageQuery(params, customerParams)); + if (CollectionUtils.isEmpty(customers.getRecords())) { return investPage; } - List resultList = getTargeInfoList(demandPage); - BeanUtils.copyProperties(demandPage, investPage); + queryWrapperDemand = new LambdaQueryWrapper<>(demandParams); + queryWrapperDemand.in(InvestDemandEntity::getCustomerId, getIds(customers.getRecords(), InvestCustomerEntity::getId)); + + List demandList = demandService.list(queryWrapperDemand); + + List resultList = getTargeInfoList(demandList, customers.getRecords()); + BeanUtils.copyProperties(customers, investPage); investPage.setRecords(resultList); return investPage; } @@ -395,10 +391,8 @@ public class InvestBizServiceImpl implements InvestBizService { return ownerInfo; } - private List getTargeInfoList(InvestPageResult demandPage) { - Collection demandList = demandPage.getRecords(); - Collection customers = customerService.listByIds(getIds(demandList, InvestDemandEntity::getCustomerId)); - Map customersMap = getMap(customers, InvestCustomerEntity::getId); + private List getTargeInfoList(List demandList, Collection customers) { + Map demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); //3、目标信息 Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); @@ -410,14 +404,11 @@ public class InvestBizServiceImpl implements InvestBizService { Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); List resultList = new ArrayList<>(); - for (InvestDemandEntity item : demandList) { - InvestCustomerEntity customer = customersMap.get(item.getCustomerId()); - WxShop shop = shopsMap.get(item.getTargetId()); - WxBrand brand = null; - if (Objects.nonNull(customer)) { - brand = brandMap.get(customer.getBrandId()); - } - resultList.add(buildDemindItem(item, customer, brand, shop, usersMap)); + for (InvestCustomerEntity item : customers) { + InvestDemandEntity demandItem = demindsMap.get(item.getId()); + WxShop shop = shopsMap.get(demandItem.getTargetId()); + WxBrand brand = brandMap.get(item.getBrandId()); + resultList.add(buildDemindItem(demandItem, item, brand, shop, usersMap)); } return resultList; }