diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java index fc568a618..1a46eb50b 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java @@ -1,9 +1,13 @@ package com.iformall.controller.invest; import java.util.Arrays; -import java.util.List; + +import com.iformall.common.ErrorCode; +import com.iformall.common.InvestResultData; import com.iformall.common.ResultData; import com.iformall.domain.po.InvestFollowRecordEntity; +import com.iformall.domain.vo.invest.InvestPage; +import com.iformall.exception.MallinkException; import com.iformall.service.invest.InvestFollowRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -33,17 +37,24 @@ public class InvestFollowRecordController { */ @ApiOperation("分页列表接口") @GetMapping("/list") - public ResultData list(@RequestBody InvestFollowRecordEntity params){ - List page = investFollowRecordService.queryPage(params); - - return new ResultData(page); + public InvestResultData> list(InvestFollowRecordEntity params) { + try { + InvestPage page = investFollowRecordService.queryPage(params); + return new InvestResultData(page); + } catch (MallinkException e) { + log.error("list error", e); + return new InvestResultData(e.getErrorCode(), e.getMessage()); + } catch (Exception e) { + log.error("list error", e); + return new InvestResultData(ErrorCode.SYS_BEAN_EMPTY_PROPERTY_ERROR); + } } /** * 信息 */ - @GetMapping("/info/{id}") + //@GetMapping("/info/{id}") public ResultData info(@PathVariable("id") Long id){ InvestFollowRecordEntity investFollowRecord = investFollowRecordService.getById(id); @@ -63,7 +74,7 @@ public class InvestFollowRecordController { /** * 修改 */ - @PostMapping("/update") + //@PostMapping("/update") public ResultData update(@RequestBody InvestFollowRecordEntity investFollowRecord){ investFollowRecordService.updateById(investFollowRecord); @@ -73,7 +84,7 @@ public class InvestFollowRecordController { /** * 删除 */ - @GetMapping("/delete") + //@GetMapping("/delete") public ResultData delete(@RequestBody Long[] ids){ investFollowRecordService.removeByIds(Arrays.asList(ids)); diff --git a/mallinkAdmin/src/test/java/com/iformall/service/test/InvestTests.java b/mallinkAdmin/src/test/java/com/iformall/service/test/InvestTests.java index c25bba605..758ed8161 100644 --- a/mallinkAdmin/src/test/java/com/iformall/service/test/InvestTests.java +++ b/mallinkAdmin/src/test/java/com/iformall/service/test/InvestTests.java @@ -282,7 +282,7 @@ public class InvestTests { @Test public void pager() throws Exception { InvestDemandEntity demandQuery = new InvestDemandEntity(); - demandQuery.setPageIndex(1); + demandQuery.setPageNum(1); demandQuery.setPageSize(10); InvestPage page = demandService.queryPage(demandQuery); log.debug("page : {}", objectMapper().writeValueAsString(page)); diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 8c34b6973..af024bfa6 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -523,8 +523,11 @@ public enum ErrorCode{ // 业态 52999 end // 招商管理 53000 begin - CUSTOMER_NOT_FOUND(53000, "客户信息不存在"), + INVEST_CUSTOMER_NOT_FOUND(53000, "客户信息不存在"), + INVEST_UNKNOW_ERRROR(53000, "客户信息不存在"), // 招商管理 53999 end + + /** * 首页浮屠广告 */ diff --git a/mallinkService/src/main/java/com/iformall/domain/po/BaseInvestEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/BaseInvestEntity.java index d4a492036..3900aa373 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/BaseInvestEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/BaseInvestEntity.java @@ -63,10 +63,10 @@ public class BaseInvestEntity implements Serializable { @TableField(exist = false) private List ascs; - @io.swagger.annotations.ApiModelProperty(value = "当前页", name = "pageIndex",example = "1") + @io.swagger.annotations.ApiModelProperty(value = "当前页", name = "pageNum",example = "1") @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @TableField(exist = false) - private Integer pageIndex; + private Integer pageNum; @io.swagger.annotations.ApiModelProperty(value = "每页数据", name = "pageSize",example = "10") @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestFollowRecordService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestFollowRecordService.java index b9a7bedbe..6db4c527b 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestFollowRecordService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestFollowRecordService.java @@ -2,9 +2,7 @@ package com.iformall.service.invest; import com.baomidou.mybatisplus.extension.service.IService; import com.iformall.domain.po.InvestFollowRecordEntity; - -import java.util.List; -import java.util.Map; +import com.iformall.domain.vo.invest.InvestPage; /** * 跟踪记录 @@ -15,6 +13,6 @@ import java.util.Map; */ public interface InvestFollowRecordService extends IService { - List queryPage(InvestFollowRecordEntity params); + InvestPage queryPage(InvestFollowRecordEntity params); } 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 edfd9ff56..352bc42f3 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java @@ -12,10 +12,7 @@ import com.iformall.service.WxShopService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; -import java.lang.reflect.Field; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -91,7 +88,7 @@ public class InvestHelper { public static void checkCustomerExit(InvestCustomerService customerService, Long id) { InvestCustomerEntity customerEntity = customerService.getById(id); if (Objects.isNull(customerEntity)) { - throw new MallinkException(ErrorCode.CUSTOMER_NOT_FOUND.getCode(), id + ErrorCode.CUSTOMER_NOT_FOUND.getMessage()); + throw new MallinkException(ErrorCode.INVEST_CUSTOMER_NOT_FOUND.getCode(), id + ErrorCode.INVEST_CUSTOMER_NOT_FOUND.getMessage()); } } @@ -108,7 +105,7 @@ public class InvestHelper { public static Page buildQueryPage(BaseInvestEntity entity) { Page page = new Page(); - page.setCurrent(entity.getPageIndex()); + page.setCurrent(entity.getPageNum()); page.setSize(entity.getPageSize()); page.setAscs(entity.getAscs()); page.setDescs(entity.getDescs()); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java index e55a10093..947d8af7c 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java @@ -63,14 +63,14 @@ public class InvestDemandServiceImpl extends ServiceImpl brandMap = brands.stream().collect(Collectors.toMap(WxBrand::getId, brand -> brand)); List resultList = new ArrayList<>(); - for (InvestDemandEntity demandEntity : demandList) { - InvestCustomerEntity customer = customersMap.get(demandEntity.getCustomerId()); - WxShop shop = shopsMap.get(demandEntity.getTargetId()); + 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(buildCustomerDemandVo(demandEntity, customer, brand, shop)); + resultList.add(buildResultItem(item, customer, brand, shop)); } BeanUtils.copyProperties(demandPage, investPage); @@ -112,18 +112,18 @@ public class InvestDemandServiceImpl extends ServiceImpl implements InvestFollowRecordService { + @Autowired + private InvestDemandService demandService ; + @Autowired + private InvestTaskService taskService ; + @Override - public List queryPage(InvestFollowRecordEntity params) { - return this.list() ; + public InvestPage queryPage(InvestFollowRecordEntity params) { + InvestHelper.checkAllNotNull(params); + Page page = InvestHelper.buildQueryPage(params); + InvestPage investPage = new InvestPage<>(); + IPage records = this.page(page) ; + BeanUtils.copyProperties(records, investPage); + return investPage; } @TableLog @@ -42,4 +64,15 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop)); List resultList = new ArrayList<>(); - for (InvestTaskEntity demandEntity : taskList) { - WxShop shop = shopsMap.get(demandEntity.getTargetId()); - resultList.add(InvestTaskVo.builder().targetInfo(shop).build()); + for (InvestTaskEntity item : taskList) { + WxShop shop = shopsMap.get(item.getTargetId()); + resultList.add(buildResultItem(item, shop)); } BeanUtils.copyProperties(taskPage, investPage); @@ -60,6 +61,14 @@ public class InvestTaskServiceImpl extends ServiceImpl