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 b431ebe6e..a82d5357e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java @@ -39,6 +39,10 @@ public class InvestBaseController extends BaseController { } catch (MallinkException e) { log.error("execute error", e); return new InvestResultData(e.getErrorCode(), e.getMessage()); + } catch (NullPointerException e) { + ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ; + log.error("execute error", errorCode.getMessage()); + return new InvestResultData(errorCode); } catch (Exception e) { log.error("execute error", e); return new InvestResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage()); 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 41df735fd..02566d3e4 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java @@ -3,8 +3,8 @@ package com.iformall.controller.invest; import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; import com.iformall.domain.po.invest.InvestFollowRecordEntity; +import com.iformall.domain.vo.invest.InvestFollowQuery; import com.iformall.domain.vo.invest.InvestFollowRecordVo; -import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageResult; import com.iformall.service.invest.InvestBizService; import com.iformall.service.invest.InvestFollowRecordService; @@ -41,7 +41,7 @@ public class InvestFollowRecordController extends InvestBaseController { @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") - public InvestResultData> list(InvestPageQuery params) { + public InvestResultData> list(InvestFollowQuery params) { return execute(params, p -> bizService.queryPageFollowRecord(p)); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java index 0810d0c29..6641d8114 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java @@ -5,6 +5,8 @@ import com.iformall.common.InvestResultData; import com.iformall.domain.po.invest.InvestRemindEntity; import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageResult; +import com.iformall.domain.vo.invest.InvestRemindVo; +import com.iformall.service.invest.InvestBizService; import com.iformall.service.invest.InvestRemindService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -32,6 +34,8 @@ import java.util.Arrays; public class InvestRemindController extends InvestBaseController { @Autowired private InvestRemindService investRemindService; + @Autowired + private InvestBizService bizService; /** * 分页列表 @@ -39,8 +43,8 @@ public class InvestRemindController extends InvestBaseController { @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") - public InvestResultData> list(InvestPageQuery params) { - return execute(params, p -> investRemindService.queryPage(p)); + public InvestResultData> list(InvestPageQuery params) { + return execute(params, p -> bizService.queryPageRemind(p)); } @@ -50,7 +54,7 @@ public class InvestRemindController extends InvestBaseController { @SystemServiceLog @GetMapping("/info/{id}") public InvestResultData info(@PathVariable("id") Long id) { - return execute(id, p -> investRemindService.getByIdNotNull(p)); + return execute(id, p -> bizService.findRemindById(p)); } /** diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java index 0e63af5be..b54e23d1a 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandQuery.java @@ -28,6 +28,6 @@ public class InvestDemandQuery extends InvestPageQuery { * 负责人 */ @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") - private Long owner; + private Long demandOwner; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestFollowQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestFollowQuery.java new file mode 100644 index 000000000..d9fcce846 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestFollowQuery.java @@ -0,0 +1,22 @@ +package com.iformall.domain.vo.invest; + +import com.iformall.enums.EnumFollowType; +import com.iformall.enums.EnumTaskStatus; +import lombok.Data; + +@Data +public class InvestFollowQuery extends InvestPageQuery { + + /** + * 跟踪类型:0-招商任务;1-客户需求 + */ + @io.swagger.annotations.ApiModelProperty(value = "跟踪类型:0-招商任务;1-客户需求", name = "type") + private EnumFollowType type; + + /** + * 跟踪类型的主键ID + */ + @io.swagger.annotations.ApiModelProperty(value = "跟踪类型的主键ID", name = "followId") + private Long followId; + +} 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 f60c81e22..25cce57f8 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 @@ -9,7 +9,7 @@ public class InvestTaskQuery extends InvestPageQuery { @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") private String shopNumber; - @io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status") + @io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="shopStatus") private Integer shopStatus; /** * 经营业态 @@ -20,13 +20,13 @@ public class InvestTaskQuery extends InvestPageQuery { /** * 负责人 */ - @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") + @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "taskOwner") private String taskOwner; /** * 任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成 */ - @io.swagger.annotations.ApiModelProperty(value = "任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成", name = "status") + @io.swagger.annotations.ApiModelProperty(value = "任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成", name = "taskStatus") private EnumTaskStatus taskStatus; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java b/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java index 147e228d3..3373848fb 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java @@ -1,6 +1,7 @@ package com.iformall.enums; import com.baomidou.mybatisplus.annotation.EnumValue; +import com.fasterxml.jackson.annotation.JsonValue; /** * 拜访方式:0-拜访;1-来访;2-电话;3-短信、微信或其它 @@ -30,6 +31,7 @@ public enum EnumNegotiationType { this.info = info; } + @JsonValue public Integer getCode() { return code; } 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 f75f5beed..c946a683c 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -1,8 +1,6 @@ package com.iformall.service.invest; import com.iformall.domain.dto.InvestDemandDto; -import com.iformall.domain.dto.InvestTaskDto; -import com.iformall.domain.po.invest.InvestFollowRecordEntity; import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.invest.InvestRemindEntity; import com.iformall.domain.vo.invest.*; @@ -15,7 +13,7 @@ public interface InvestBizService { InvestPageResult queryPageTask(InvestTaskQuery params); - InvestPageResult queryPageFollowRecord(InvestPageQuery params); + InvestPageResult queryPageFollowRecord(InvestFollowQuery params); InvestPageResult queryPageRemind(InvestPageQuery params); @@ -29,6 +27,8 @@ public interface InvestBizService { InvestTaskVo findTaskById(Long id) ; + InvestRemindVo findRemindById(Long id) ; + InvestFollowRecordVo findFollowRecordById(Long id) ; 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 9573788fb..d0f0f041a 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 @@ -90,9 +90,9 @@ public class InvestBizServiceImpl implements InvestBizService { } InvestDemandEntity demandEntity = null; - if (ObjectUtils.anyNotNull(params.getOwner())) { + if (ObjectUtils.anyNotNull(params.getDemandOwner())) { demandEntity = new InvestDemandEntity(); - demandEntity.setOwner(params.getOwner()); + demandEntity.setOwner(params.getDemandOwner()); } @@ -171,8 +171,14 @@ public class InvestBizServiceImpl implements InvestBizService { } @Override - public InvestPageResult queryPageFollowRecord(InvestPageQuery params) { - InvestPageResult recordPage = followRecordService.queryPage(params); + public InvestPageResult queryPageFollowRecord(InvestFollowQuery params) { + InvestHelper.notNull(params); + InvestFollowRecordEntity followRecordEntity = new InvestFollowRecordEntity(); + followRecordEntity.setFollowId(params.getFollowId()); + followRecordEntity.setType(params.getType()); + InvestPageQuery pageQuery = buildPageQuery(params, followRecordEntity); + + InvestPageResult recordPage = followRecordService.queryPage(pageQuery); InvestPageResult investPage = new InvestPageResult<>(); if (CollectionUtils.isEmpty(recordPage.getRecords())) { @@ -211,18 +217,9 @@ public class InvestBizServiceImpl implements InvestBizService { return investPage; } Collection recordList = recordPage.getRecords(); - Collection resultList = Collections.emptyList(); + Collection resultList = new ArrayList<>(Collections.emptyList()); for (InvestRemindEntity investRemindEntity : recordList) { - InvestRemindVo remindVo = new InvestRemindVo(); - BeanUtils.copyProperties(investRemindEntity, remindVo); - HashMap contentMap = JSON.parseObject(investRemindEntity.getContent(), HashMap.class); - if (MapUtils.isNotEmpty(contentMap)) { - Object customerId = contentMap.get(InvestRemindEntity.KEY_CUSTOMER); - remindVo.setCustomerId(Objects.isNull(customerId) ? null : Long.parseLong((String) customerId)); - Object negotiationType = contentMap.get(InvestRemindEntity.KEY_NEGOTIATIONTYPE); - remindVo.setNegotiationType(EnumNegotiationType.getEnum(Integer.valueOf((String) negotiationType))); - } - resultList.add(remindVo); + resultList.add(buildRemindItem(investRemindEntity)); } //2、用户信息 @@ -312,6 +309,21 @@ public class InvestBizServiceImpl implements InvestBizService { return buildTaskItem(taskEntity, shop, usersMap); } + @Override + public InvestRemindVo findRemindById(Long id) { + InvestRemindEntity remindEntity = remindService.getByIdNotNull(id); + InvestRemindVo remindVo = buildRemindItem(remindEntity); + + InvestCustomerEntity customerEntity = customerService.getByIdNotNull(remindVo.getCustomerId()); + if (Objects.nonNull(customerEntity)) { + remindVo.setCustomer(customerEntity); + remindVo.setBrand(brandService.getById(customerEntity.getBrandId())); + } + remindVo.setOwnerInfo(userInfoService.getById(remindEntity.getOwner())); + + return remindVo; + } + @Override public InvestFollowRecordVo findFollowRecordById(Long id) { InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); @@ -353,6 +365,20 @@ public class InvestBizServiceImpl implements InvestBizService { return resultItemVo; } + + private InvestRemindVo buildRemindItem(InvestRemindEntity remindEntity) { + InvestRemindVo remindVo = new InvestRemindVo(); + BeanUtils.copyProperties(remindEntity, remindVo); + HashMap contentMap = JSON.parseObject(remindEntity.getContent(), HashMap.class); + if (MapUtils.isNotEmpty(contentMap)) { + Object customerId = contentMap.get(InvestRemindEntity.KEY_CUSTOMER); + remindVo.setCustomerId(Objects.isNull(customerId) ? null : Long.parseLong((String) customerId)); + Object negotiationType = contentMap.get(InvestRemindEntity.KEY_NEGOTIATIONTYPE); + remindVo.setNegotiationType(EnumNegotiationType.getEnum(Integer.valueOf((String) negotiationType))); + } + return remindVo; + } + private List getMallUserInfos(Object userJson, Map usersMap) { List ownerInfo = Lists.newArrayList(); JSONArray ownerList; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java index 4038fc415..0ad3c0f59 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java @@ -3,6 +3,8 @@ package com.iformall.service.invest.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.iformall.common.ErrorCode; import com.iformall.domain.po.invest.InvestFollowRecordEntity; +import com.iformall.domain.vo.invest.InvestPageQuery; +import com.iformall.domain.vo.invest.InvestPageResult; import com.iformall.domain.vo.invest.InvestUserContext; import com.iformall.enums.EnumFollowType; import com.iformall.mapper.InvestFollowRecordDao; @@ -23,6 +25,15 @@ public class InvestFollowRecordServiceImpl extends InvestBaseServiceImpl queryPage(InvestPageQuery params) { + InvestFollowRecordEntity queryData = params.getQueryData(); + InvestHelper.notNull(queryData); + InvestHelper.notNull(queryData.getFollowId(), "followId"); + InvestHelper.notNull(queryData.getType(), "type"); + return super.queryPage(params); + } + @Override public boolean save(InvestFollowRecordEntity entity) { entity.setOperator(InvestUserContext.getUserId());