diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java index 6874569cb..5fc5f1875 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java @@ -2,7 +2,7 @@ package com.iformall.controller.invest; import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; -import com.iformall.domain.dto.InvestCustomerDto; +import com.iformall.domain.dto.InvestDemandDto; import com.iformall.domain.vo.invest.InvestDemandVo; import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageResult; @@ -42,7 +42,7 @@ public class InvestDemandController extends InvestBaseController { @SystemServiceLog @ApiOperation(value = "分页列表接口") @GetMapping("/list") - public InvestResultData> list(InvestPageQuery params) { + public InvestResultData> list(InvestPageQuery params) { return execute(params, p -> investBizService.queryPageDemand(p)); } @@ -61,7 +61,7 @@ public class InvestDemandController extends InvestBaseController { */ @SystemServiceLog @PostMapping("/save") - public InvestResultData save(@RequestBody InvestCustomerDto investDemand) { + public InvestResultData save(@RequestBody InvestDemandDto investDemand) { return execute(investDemand, p -> investBizService.saveCustomerAndDemand(p)); } @@ -70,7 +70,7 @@ public class InvestDemandController extends InvestBaseController { */ @SystemServiceLog @PostMapping("/update") - public InvestResultData update(@RequestBody InvestCustomerDto customerDto) { + public InvestResultData update(@RequestBody InvestDemandDto customerDto) { return execute(customerDto, p -> investBizService.updateCustomerAndDemand(p)); } diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/InvestCustomerDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/InvestCustomerDto.java deleted file mode 100644 index 1bb9560c8..000000000 --- a/mallinkService/src/main/java/com/iformall/domain/dto/InvestCustomerDto.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.iformall.domain.dto; - -import com.iformall.common.LogColumn; -import com.iformall.domain.po.invest.InvestCustomerEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = true) -public class InvestCustomerDto extends InvestCustomerEntity { - - /** - * 负责人 - */ - @io.swagger.annotations.ApiModelProperty(value = "招商负责人", name = "owner") - @LogColumn - private Long owner; - - @io.swagger.annotations.ApiModelProperty(value = "demandId", name = "demandId") - private Long demandId; - - /** - * 客户意向 - */ - @io.swagger.annotations.ApiModelProperty(value = "客户意向", name = "intent", - example = "\"{\"rent_area\":100,\"opening_time\": \"2019-09-03\"}\"") - @LogColumn(COLUMN_TYPE) - private String intent; -} diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/InvestDemandDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/InvestDemandDto.java new file mode 100644 index 000000000..60fc2827c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/dto/InvestDemandDto.java @@ -0,0 +1,14 @@ +package com.iformall.domain.dto; + +import com.iformall.domain.po.invest.InvestCustomerEntity; +import com.iformall.domain.po.invest.InvestDemandEntity; +import lombok.Data; + +@Data +public class InvestDemandDto { + + @io.swagger.annotations.ApiModelProperty(value = "客户信息", name = "客户信息") + private InvestCustomerEntity customer ; + @io.swagger.annotations.ApiModelProperty(value = "客户需求", name = "客户需求") + private InvestDemandEntity demand ; +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java index f0ce0abda..dfb170c25 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestFollowRecordEntity.java @@ -33,14 +33,14 @@ public class InvestFollowRecordEntity extends InvestBaseEntity { /** * 洽谈内容 */ - @io.swagger.annotations.ApiModelProperty(value = "洽谈内容", name = "content",example = "\"{" + + @io.swagger.annotations.ApiModelProperty(value = "洽谈内容", name = "content",example = "{" + "\"date\": \"2019-09-03\"," + " \"address\": \"北京三里屯\"," + " \"text\": \"今天约了王老板,目标要签订框架协议\"," + " \"document\": [\"url1\",\"url2\"]," + " \"member\": [id1,id2,id3]," + " \"negotiationType\": 1" + - "}\"") + "}") private String content; /** * 跟踪类型:0-招商任务;1-客户需求 diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestOperateRecordEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestOperateRecordEntity.java index c9f0c303e..163b57ae8 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestOperateRecordEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestOperateRecordEntity.java @@ -46,7 +46,7 @@ public class InvestOperateRecordEntity extends InvestBaseEntity { /** * 更新内容 */ - @io.swagger.annotations.ApiModelProperty(value = "更新前", name = "content",example = "\"[{\"after\": \"13366183866\", \"before\": \"15811234999\", \"column\": \"phone\"}]\"") + @io.swagger.annotations.ApiModelProperty(value = "更新前", name = "content",example = "[{\"after\": \"13366183866\", \"before\": \"15811234999\", \"column\": \"phone\"}]") private String content; @JsonIgnore diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestRemindEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestRemindEntity.java index dc60b6020..0135fddfe 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestRemindEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestRemindEntity.java @@ -28,12 +28,12 @@ public class InvestRemindEntity extends InvestBaseEntity { * 提醒内容 */ - @io.swagger.annotations.ApiModelProperty(value = "提醒内容", name = "content",example = "\"" + + @io.swagger.annotations.ApiModelProperty(value = "提醒内容", name = "content",example = "{" + - "\"text\": \"今天约了王老板,要求签订框架协议\"," + - " \"customerId\": 222222," + + "\"text\": \"今天约了王老板,要求签订框架协议\"," + + " \"customerId\": 222222," + " \"negotiationType\": 2" + - "}\"") + "}") private String content; /** * 提醒时间 diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java index 1a6d7d97b..f3d23e067 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java @@ -49,10 +49,10 @@ public class InvestTaskEntity extends InvestBaseEntity { /** * 任务设定条件 */ - @io.swagger.annotations.ApiModelProperty(value = "任务设定条件", name = "content",example = "\"{" + + @io.swagger.annotations.ApiModelProperty(value = "任务设定条件", name = "content",example = "{" + "\"business\": 1," + " \"lastDate\": \"2018-10-01 12:18:48\",\"contractId\":222222222222" + - "}\"") + "}") private String content; /** diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBaseService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBaseService.java index b34875aed..c8ab0b78e 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBaseService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBaseService.java @@ -1,5 +1,6 @@ package com.iformall.service.invest; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageResult; @@ -16,6 +17,8 @@ public interface InvestBaseService { InvestPageResult queryPage(InvestPageQuery params) ; + InvestPageResult queryPage(InvestPageQuery params, LambdaQueryWrapper queryWrapper) ; + T getByIdNotNull(Serializable id); } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java index 3b2e14b51..48cc24755 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -1,9 +1,8 @@ package com.iformall.service.invest; -import com.iformall.domain.dto.InvestCustomerDto; +import com.iformall.domain.dto.InvestDemandDto; import com.iformall.domain.dto.InvestTaskDto; import com.iformall.domain.po.invest.InvestFollowRecordEntity; -import com.iformall.domain.po.invest.InvestTaskEntity; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.vo.invest.*; @@ -11,7 +10,7 @@ import java.util.List; public interface InvestBizService { - InvestPageResult queryPageDemand(InvestPageQuery params); + InvestPageResult queryPageDemand(InvestPageQuery params); InvestPageResult queryPageTask(InvestPageQuery params); @@ -19,9 +18,9 @@ public interface InvestBizService { List queryUserList() ; - boolean saveCustomerAndDemand(InvestCustomerDto customerDemandDto) ; + boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; - boolean updateCustomerAndDemand(InvestCustomerDto customerDto) ; + boolean updateCustomerAndDemand(InvestDemandDto customerDto) ; InvestDemandVo findDemandById(Long id) ; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java index a36cd0384..206d691c9 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBaseServiceImpl.java @@ -3,6 +3,7 @@ package com.iformall.service.invest.impl; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -40,12 +41,19 @@ public class InvestBaseServiceImpl, T> extends ServiceIm @Override public InvestPageResult queryPage(InvestPageQuery params) { + return this.queryPage(params, null); + } + + @Override + public InvestPageResult queryPage(InvestPageQuery params, LambdaQueryWrapper queryWrapper) { InvestHelper.notNull(params); //1、分页信息 Page queryPage = buildQueryPage(params); //2、查询数据 T queryParams = params.getQueryData(); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(queryParams); + if (Objects.isNull(queryWrapper)) { + queryWrapper = new LambdaQueryWrapper<>(queryParams); + } IPage resultPage = this.page(queryPage, queryWrapper); InvestPageResult investPage = new InvestPageResult<>(); 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 c9cb05805..7f358c490 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 @@ -3,8 +3,7 @@ package com.iformall.service.invest.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.iformall.domain.dto.InvestCustomerDto; +import com.iformall.domain.dto.InvestDemandDto; import com.iformall.domain.dto.InvestTaskDto; import com.iformall.domain.po.*; import com.iformall.domain.po.invest.InvestCustomerEntity; @@ -48,19 +47,22 @@ public class InvestBizServiceImpl implements InvestBizService { private MallUserInfoService userInfoService; @Override - public InvestPageResult queryPageDemand(InvestPageQuery params) { - InvestCustomerDto queryParams = params.getQueryData(); - InvestDemandEntity queryDemand = null; - if (Objects.nonNull(queryParams)) { - queryDemand = new InvestDemandEntity(); - queryDemand.setOwner(queryParams.getOwner()); - } - InvestPageResult demandPage = demandService.queryPage(new InvestPageQuery<>(queryDemand)); + public InvestPageResult queryPageDemand(InvestPageQuery params) { + InvestHelper.notNull(params); + InvestDemandDto queryParams = params.getQueryData(); InvestPageResult investPage = new InvestPageResult<>(); + InvestPageResult customerPage = customerService.queryPage( + new InvestPageQuery<>(Objects.isNull(queryParams) ? null : queryParams.getCustomer())); + if (CollectionUtils.isEmpty(customerPage.getRecords())) { + return investPage; + } + LambdaQueryWrapper queryWrapperDemand = new LambdaQueryWrapper<>(); + queryWrapperDemand.in(InvestDemandEntity::getCustomerId, customerPage.getRecords().stream().map(InvestCustomerEntity::getId).collect(Collectors.toList())); + InvestPageResult demandPage = demandService.queryPage(new InvestPageQuery<>(Objects.isNull(queryParams) ? null : queryParams.getDemand()), queryWrapperDemand); if (CollectionUtils.isEmpty(demandPage.getRecords())) { return investPage; } - List resultList = getTargeInfoList(demandPage, queryParams); + List resultList = getTargeInfoList(demandPage, customerPage.getRecords()); BeanUtils.copyProperties(demandPage, investPage); investPage.setRecords(resultList); return investPage; @@ -151,44 +153,30 @@ public class InvestBizServiceImpl implements InvestBizService { @Transactional(rollbackFor = Exception.class) @Override - public boolean saveCustomerAndDemand(InvestCustomerDto customerDto) { - InvestHelper.notNull(customerDto); - InvestCustomerEntity customerEntityDB = customerService.getById(customerDto.getId()); + public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { + InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); + InvestCustomerEntity customerEntityDB = customerService.getById(demandDto.getCustomer().getId()); if (Objects.isNull(customerEntityDB)) { - customerService.save(customerDto); + customerEntityDB = demandDto.getCustomer(); + customerService.save(customerEntityDB); } else { - customerService.updateById(customerDto); + customerService.updateById(demandDto.getCustomer()); } - InvestDemandEntity demandEntity = new InvestDemandEntity(); - setValDmand(customerDto, demandEntity); + InvestDemandEntity demandEntity = demandDto.getDemand(); + demandEntity.setCustomerId(customerEntityDB.getId()); return demandService.save(demandEntity); } @Transactional(rollbackFor = Exception.class) @Override - public boolean updateCustomerAndDemand(InvestCustomerDto customerDto) { - InvestHelper.notNull(customerDto, customerDto.getDemandId()); - InvestDemandEntity demandEntity = demandService.getByIdNotNull(customerDto.getDemandId()); - InvestCustomerEntity customerEntity = new InvestCustomerEntity(); - customerDto.setId(demandEntity.getCustomerId()); - BeanUtils.copyProperties(customerDto, customerEntity); - customerService.updateById(customerEntity); - setValDmand(customerDto, demandEntity); + public boolean updateCustomerAndDemand(InvestDemandDto demandDto) { + InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); + customerService.updateById(demandDto.getCustomer()); + InvestDemandEntity demandEntity = demandDto.getDemand() ; + demandEntity.setCustomerId(demandDto.getCustomer().getId()); return demandService.updateById(demandEntity); } - private void setValDmand(InvestCustomerDto customerDto, InvestDemandEntity demandEntity) { - if (Objects.isNull(demandEntity)) { - demandEntity = new InvestDemandEntity(); - } - demandEntity.setCustomerId(customerDto.getId()); - demandEntity.setId(customerDto.getDemandId()); - demandEntity.setIntent(customerDto.getIntent()); - if (Objects.nonNull(customerDto.getOwner())) { - demandEntity.setOwner(customerDto.getOwner()); - } - } - @Override public InvestDemandVo findDemandById(Long id) { InvestDemandEntity demandEntity = demandService.getByIdNotNull(id); @@ -267,12 +255,8 @@ public class InvestBizServiceImpl implements InvestBizService { return ownerInfo; } - private List getTargeInfoList(InvestPageResult demandPage, InvestCustomerEntity queryCustomer) { + private List getTargeInfoList(InvestPageResult demandPage, List customers) { List demandList = demandPage.getRecords(); - //2、客户信息 - LambdaQueryWrapper customerWrapper = new LambdaQueryWrapper<>(queryCustomer); - customerWrapper.in(InvestCustomerEntity::getId, demandList.stream().map(InvestDemandEntity::getCustomerId)); - Collection customers = customerService.list(new QueryWrapper<>(queryCustomer)); Map customersMap = getCustomerMap(customers); //3、目标信息