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 7ae065a69..b431ebe6e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java @@ -5,7 +5,9 @@ import com.iformall.common.ErrorCode; import com.iformall.common.InvestResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.vo.invest.InvestUserContext; +import com.iformall.enums.EnumCustomerRatingType; import com.iformall.enums.EnumCustomerType; +import com.iformall.enums.EnumTaskStatus; import com.iformall.exception.MallinkException; import com.iformall.service.invest.InvestHelper; import lombok.extern.slf4j.Slf4j; @@ -24,6 +26,8 @@ public class InvestBaseController extends BaseController { public void InitBinder(WebDataBinder dataBinder) { super.InitBinder(dataBinder); registerEnumEditor(dataBinder, EnumCustomerType.class, "customerType") ; + registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ; + registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ; } public InvestResultData execute(T params, Function function) { @@ -43,11 +47,6 @@ public class InvestBaseController extends BaseController { } } - public R convert(T params, Function function) { - InvestHelper.notNull(params); - return function.apply(params); - } - private > void registerEnumEditor(WebDataBinder binder, Class clz, String propertyName) { binder.registerCustomEditor(clz, propertyName, newEnumEditor(clz)); } 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 cec76a7ef..6259e2efd 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java @@ -3,18 +3,14 @@ package com.iformall.controller.invest; import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; import com.iformall.domain.dto.InvestDemandDto; -import com.iformall.domain.po.invest.InvestCustomerEntity; -import com.iformall.domain.po.invest.InvestDemandEntity; import com.iformall.domain.vo.invest.InvestDemandQuery; import com.iformall.domain.vo.invest.InvestDemandVo; -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.InvestDemandService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -47,7 +43,7 @@ public class InvestDemandController extends InvestBaseController { @ApiOperation(value = "分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestDemandQuery params) { - return execute(convert(params, this::doConvert), p -> investBizService.queryPageDemand(p)); + return execute(params, p -> investBizService.queryPageDemand(p)); } /** @@ -84,23 +80,4 @@ public class InvestDemandController extends InvestBaseController { public InvestResultData delete(@RequestBody Long[] ids) { return execute(ids, p -> investDemandService.removeByIds(Arrays.asList(p))); } - - private InvestPageQuery doConvert(InvestDemandQuery params) { - InvestCustomerEntity customerEntity = new InvestCustomerEntity(); - customerEntity.setId(params.getCustomerId()); - customerEntity.setType(params.getCustomerType()); - customerEntity.setBusinessId(params.getBusinessId()); - - InvestDemandEntity demandEntity = new InvestDemandEntity(); - demandEntity.setOwner(params.getOwner()); - - InvestDemandDto demandDto = new InvestDemandDto(); - demandDto.setCustomer(customerEntity); - demandDto.setDemand(demandEntity); - InvestPageQuery pageQuery = new InvestPageQuery<>(); - BeanUtils.copyProperties(params, pageQuery); - pageQuery.setQueryData(demandDto); - return pageQuery; - } - } 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 739c03d55..41df735fd 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestFollowRecordController.java @@ -1,5 +1,6 @@ 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.InvestFollowRecordVo; @@ -37,6 +38,7 @@ public class InvestFollowRecordController extends InvestBaseController { /** * 分页列表 */ + @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestPageQuery params) { @@ -47,6 +49,7 @@ public class InvestFollowRecordController extends InvestBaseController { /** * 信息 */ + @SystemServiceLog @GetMapping("/info/{id}") public InvestResultData info(@PathVariable("id") Long id){ return execute(id, p -> bizService.findFollowRecordById(p)); @@ -55,6 +58,7 @@ public class InvestFollowRecordController extends InvestBaseController { /** * 保存 */ + @SystemServiceLog @PostMapping("/save") public InvestResultData save(@RequestBody InvestFollowRecordEntity investFollowRecord){ return execute(investFollowRecord, p -> investFollowRecordService.save(p)); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java index 573b8ac99..492c329ad 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestOperateRecordController.java @@ -1,5 +1,6 @@ package com.iformall.controller.invest; +import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; import com.iformall.domain.po.invest.InvestOperateRecordEntity; import com.iformall.domain.vo.invest.InvestPageQuery; @@ -33,6 +34,7 @@ public class InvestOperateRecordController extends InvestBaseController { /** * 分页列表 */ + @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestPageQuery params) { @@ -51,6 +53,7 @@ public class InvestOperateRecordController extends InvestBaseController { /** * 保存 */ + @SystemServiceLog //@PostMapping("/save") public InvestResultData save(@RequestBody InvestOperateRecordEntity investOperateRecord){ return execute(investOperateRecord, p -> investOperateRecordService.save(p)); @@ -59,6 +62,7 @@ public class InvestOperateRecordController extends InvestBaseController { /** * 修改 */ + @SystemServiceLog //@PostMapping("/update") public InvestResultData update(@RequestBody InvestOperateRecordEntity investOperateRecord){ return execute(investOperateRecord, p -> investOperateRecordService.updateById(p)); @@ -67,6 +71,7 @@ public class InvestOperateRecordController extends InvestBaseController { /** * 删除 */ + @SystemServiceLog //@GetMapping("/delete") public InvestResultData delete(@RequestBody Long[] ids){ return execute(ids, p -> investOperateRecordService.removeByIds(Arrays.asList(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 50cd857f7..0810d0c29 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java @@ -1,5 +1,6 @@ package com.iformall.controller.invest; +import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; import com.iformall.domain.po.invest.InvestRemindEntity; import com.iformall.domain.vo.invest.InvestPageQuery; @@ -35,6 +36,7 @@ public class InvestRemindController extends InvestBaseController { /** * 分页列表 */ + @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") public InvestResultData> list(InvestPageQuery params) { @@ -45,6 +47,7 @@ public class InvestRemindController extends InvestBaseController { /** * 信息 */ + @SystemServiceLog @GetMapping("/info/{id}") public InvestResultData info(@PathVariable("id") Long id) { return execute(id, p -> investRemindService.getByIdNotNull(p)); @@ -54,6 +57,7 @@ public class InvestRemindController extends InvestBaseController { * 保存 */ //@RequiresPermissions("investFollowRecordEdit") + @SystemServiceLog @PostMapping("/save") public InvestResultData save(@RequestBody InvestRemindEntity investRemind) { return execute(investRemind, p -> investRemindService.save(p)); @@ -62,6 +66,7 @@ public class InvestRemindController extends InvestBaseController { /** * 修改 */ + @SystemServiceLog @PostMapping("/update") public InvestResultData update(@RequestBody InvestRemindEntity investRemind) { return execute(investRemind, p -> investRemindService.updateById(p)); @@ -70,7 +75,8 @@ public class InvestRemindController extends InvestBaseController { /** * 删除 */ - @GetMapping("/delete") + @SystemServiceLog + @PostMapping("/delete") public InvestResultData delete(@RequestBody Long[] ids) { return execute(ids, p -> investRemindService.removeByIds(Arrays.asList(p))); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java index 6727d9ddd..627a8ce1e 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java @@ -2,17 +2,13 @@ package com.iformall.controller.invest; import com.iformall.annotation.SystemServiceLog; import com.iformall.common.InvestResultData; -import com.iformall.domain.dto.InvestTaskDto; import com.iformall.domain.po.invest.InvestTaskEntity; -import com.iformall.domain.vo.invest.InvestPageQuery; -import com.iformall.domain.vo.invest.InvestPageResult; -import com.iformall.domain.vo.invest.InvestTaskVo; +import com.iformall.domain.vo.invest.*; import com.iformall.service.invest.InvestBizService; import com.iformall.service.invest.InvestTaskService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -42,7 +38,7 @@ public class InvestTaskController extends InvestBaseController { @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") - public InvestResultData> list(InvestPageQuery params) { + public InvestResultData> list(InvestTaskQuery params) { return execute(params, p -> bizService.queryPageTask(p)); } diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java index 8a1307daa..37de72845 100644 --- a/mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java +++ b/mallinkService/src/main/java/com/iformall/domain/dto/InvestTaskDto.java @@ -1,26 +1,15 @@ package com.iformall.domain.dto; -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.iformall.common.LogColumn; +import com.iformall.domain.po.WxShop; import com.iformall.domain.po.invest.InvestTaskEntity; import lombok.Data; -import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode(callSuper = true) -public class InvestTaskDto extends InvestTaskEntity { +public class InvestTaskDto { - @Excel(name="商铺号/多径点位号",width = 20,orderNum = "2") - @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") - private String shopNumber; + @io.swagger.annotations.ApiModelProperty(value="任务信息",name="task") + private InvestTaskEntity task; - @Excel(name="租赁状态",width = 20,orderNum = "7",replace = {"未出租_0","已出租_1"}) - @io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status") - private Integer shopStatus; - /** - * 经营业态 - */ - @LogColumn - @io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId") - private Integer businessId; + @io.swagger.annotations.ApiModelProperty(value="商铺状态)",name="shop") + private WxShop shop; } 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 0135fddfe..28dc0cbe3 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 @@ -19,6 +19,11 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) public class InvestRemindEntity extends InvestBaseEntity { + public static final String KEY_TEXT = "text" ; + public static final String KEY_NEGOTIATIONTYPE = "negotiationType" ; + public static final String KEY_CUSTOMER = "customerId" ; + + /** * 提醒用户InvestRemindEntity */ 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 4ba78dcab..0e63af5be 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 @@ -1,6 +1,5 @@ package com.iformall.domain.vo.invest; -import com.iformall.common.LogColumn; import com.iformall.enums.EnumCustomerType; import lombok.Data; @@ -17,13 +16,11 @@ public class InvestDemandQuery extends InvestPageQuery { * 客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败 */ @io.swagger.annotations.ApiModelProperty(value = "客户分类:0-潜在客户;1-意向客户;2-合作客户;3-谈判失败", name = "customerType") - @LogColumn private EnumCustomerType customerType; /** * 经营业态 */ - @LogColumn @io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId") private Integer businessId; @@ -31,7 +28,6 @@ public class InvestDemandQuery extends InvestPageQuery { * 负责人 */ @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") - @LogColumn private Long owner; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java index c6b75bf86..bd238ff4b 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestDemandVo.java @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) -public class InvestDemandVo extends InvestDemandEntity { +public class InvestDemandVo extends InvestDemandEntity { @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer") private InvestCustomerEntity customer; @@ -20,5 +20,5 @@ public class InvestDemandVo extends InvestDemandEntity { @io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo") private MallUserInfo ownerInfo; - private T targetInfo; + private Object targetInfo; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestPageResult.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestPageResult.java index 0d431dcda..3aeebee39 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestPageResult.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestPageResult.java @@ -2,8 +2,8 @@ package com.iformall.domain.vo.invest; import lombok.Data; +import java.util.Collection; import java.util.Collections; -import java.util.List; @Data public class InvestPageResult { @@ -11,7 +11,7 @@ public class InvestPageResult { /** * 查询数据列表 */ - private List records = Collections.emptyList(); + private Collection records = Collections.emptyList(); /** * 总数 */ diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindVo.java new file mode 100644 index 000000000..6f0bc8bc0 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindVo.java @@ -0,0 +1,32 @@ +package com.iformall.domain.vo.invest; + +import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxBrand; +import com.iformall.domain.po.invest.InvestCustomerEntity; +import com.iformall.domain.po.invest.InvestRemindEntity; +import com.iformall.enums.EnumNegotiationType; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class InvestRemindVo extends InvestRemindEntity { + + @io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo") + private MallUserInfo ownerInfo; + + /** + * 提醒用户InvestRemindEntity + */ + @io.swagger.annotations.ApiModelProperty(value = "customerId", name = "customerId") + private Long customerId; + + @io.swagger.annotations.ApiModelProperty(value = "customer", name = "customer") + private InvestCustomerEntity customer; + + @io.swagger.annotations.ApiModelProperty(value = "brand", name = "brand") + private WxBrand brand; + + @io.swagger.annotations.ApiModelProperty(value = "拜访方式:0-拜访;1-来访;2-电话;3-短信、微信或其它", name = "negotiationType") + private EnumNegotiationType negotiationType; +} 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 new file mode 100644 index 000000000..f60c81e22 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskQuery.java @@ -0,0 +1,32 @@ +package com.iformall.domain.vo.invest; + +import com.iformall.enums.EnumTaskStatus; +import lombok.Data; + +@Data +public class InvestTaskQuery extends InvestPageQuery { + + @io.swagger.annotations.ApiModelProperty(value="商铺编号",name="shopNumber") + private String shopNumber; + + @io.swagger.annotations.ApiModelProperty(value="状态(0:未出租, 1:已出租)",name="status") + private Integer shopStatus; + /** + * 经营业态 + */ + @io.swagger.annotations.ApiModelProperty(value = "经营业态", name = "businessId") + private Integer businessId; + + /** + * 负责人 + */ + @io.swagger.annotations.ApiModelProperty(value = "负责人", name = "owner") + private String taskOwner; + + /** + * 任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成 + */ + @io.swagger.annotations.ApiModelProperty(value = "任务状态:-1-关闭;0-待分配;1-洽谈中;2-意向签约;3-已完成", name = "status") + private EnumTaskStatus taskStatus; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java index 0e3ac7151..408ba09f1 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestTaskVo.java @@ -9,13 +9,13 @@ import java.util.List; @Data @EqualsAndHashCode(callSuper = true) -public class InvestTaskVo extends InvestTaskEntity { +public class InvestTaskVo extends InvestTaskEntity { /** * targetInfo */ @io.swagger.annotations.ApiModelProperty(value = "targetInfo", name = "targetInfo") - private T targetInfo; + private Object targetInfo; @io.swagger.annotations.ApiModelProperty(value = "ownerInfo", name = "ownerInfo") private List ownerInfo ; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java b/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java index 38885896a..147e228d3 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumNegotiationType.java @@ -21,8 +21,8 @@ public enum EnumNegotiationType { return null; } - @EnumValue private final Integer code; + @EnumValue private final String info; EnumNegotiationType(Integer code, String info) { diff --git a/mallinkService/src/main/java/com/iformall/service/WxBrandService.java b/mallinkService/src/main/java/com/iformall/service/WxBrandService.java index 1454993ff..b2c8bc18f 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxBrandService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxBrandService.java @@ -33,7 +33,7 @@ public interface WxBrandService { */ WxBrand getById(Long id); - List getByIds(Collection ids); + Collection getByIds(Collection ids); /** * 根据Id删除实体 diff --git a/mallinkService/src/main/java/com/iformall/service/WxShopService.java b/mallinkService/src/main/java/com/iformall/service/WxShopService.java index 1e61923eb..39dc18622 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxShopService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxShopService.java @@ -2,6 +2,9 @@ package com.iformall.service; import java.io.Serializable; import java.util.*; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.WxShop; @@ -10,6 +13,8 @@ import javax.servlet.http.HttpServletResponse; public interface WxShopService { + List selectList(QueryWrapper queryWrapper) ; + /** * 根据实体查询分页列表 * diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java index 11bfff1d3..a385f268f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBrandServiceImpl.java @@ -45,7 +45,7 @@ public class WxBrandServiceImpl implements WxBrandService { } @Override - public List getByIds(Collection ids) { + public Collection getByIds(Collection ids) { return wxBrandMapper.selectBatchIds(ids); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java index d291ae1b4..bf103fbe4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java @@ -45,6 +45,11 @@ public class WxShopServiceImpl implements WxShopService { @Autowired WxRentContractMapper wxRentContractMapper; + @Override + public List selectList(QueryWrapper queryWrapper) { + return wxShopMapper.selectList(queryWrapper) ; + } + @Override public PageInfo listAsPage(WxShop record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxShopMapper.findList(record)); 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 48cc24755..f75f5beed 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -4,18 +4,21 @@ 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.*; import java.util.List; public interface InvestBizService { - InvestPageResult queryPageDemand(InvestPageQuery params); + InvestPageResult queryPageDemand(InvestDemandQuery params); - InvestPageResult queryPageTask(InvestPageQuery params); + InvestPageResult queryPageTask(InvestTaskQuery params); InvestPageResult queryPageFollowRecord(InvestPageQuery params); + InvestPageResult queryPageRemind(InvestPageQuery params); + List queryUserList() ; boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; @@ -27,4 +30,6 @@ public interface InvestBizService { InvestTaskVo findTaskById(Long id) ; InvestFollowRecordVo findFollowRecordById(Long id) ; + + } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java b/mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java index 131fea438..d7801630c 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/event/InvestListener.java @@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -54,7 +55,7 @@ public class InvestListener implements ApplicationListener { for (InvestTaskEntity task : tasks) { task.setStatus(status); String content = task.getContent(); - Map contentMap = JSON.parseObject(content, Map.class); + HashMap contentMap = JSON.parseObject(content, HashMap.class); contentMap.put(InvestTaskEntity.KEY_CONTRACTID, rentEventInfo.getRentId()); task.setContent(JsonUtil.obj2Json(contentMap)); } 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 206d691c9..deecb7965 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,7 +3,6 @@ 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; 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 7f358c490..f0070e2f2 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,14 +3,13 @@ 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.InvestDemandDto; import com.iformall.domain.dto.InvestTaskDto; import com.iformall.domain.po.*; -import com.iformall.domain.po.invest.InvestCustomerEntity; -import com.iformall.domain.po.invest.InvestDemandEntity; -import com.iformall.domain.po.invest.InvestFollowRecordEntity; -import com.iformall.domain.po.invest.InvestTaskEntity; +import com.iformall.domain.po.invest.*; import com.iformall.domain.vo.invest.*; +import com.iformall.enums.EnumNegotiationType; import com.iformall.service.MallUserInfoService; import com.iformall.service.WxBrandService; import com.iformall.service.WxShopService; @@ -18,15 +17,15 @@ import com.iformall.service.invest.*; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.compress.utils.Lists; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.io.Serializable; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; @Service public class InvestBizServiceImpl implements InvestBizService { @@ -38,6 +37,8 @@ public class InvestBizServiceImpl implements InvestBizService { @Autowired private InvestFollowRecordService followRecordService; @Autowired + private InvestRemindService remindService; + @Autowired private WxShopService shopService; @Autowired private InvestCustomerService customerService; @@ -47,49 +48,87 @@ public class InvestBizServiceImpl implements InvestBizService { private MallUserInfoService userInfoService; @Override - public InvestPageResult queryPageDemand(InvestPageQuery params) { - InvestHelper.notNull(params); - InvestDemandDto queryParams = params.getQueryData(); + public InvestPageResult queryPageDemand(InvestDemandQuery params) { + InvestDemandDto queryParams = convert(params, this::doConvertDemand); + InvestCustomerEntity customerParams = null; + InvestDemandEntity demandParams = null; + if (Objects.nonNull(queryParams)) { + customerParams = queryParams.getCustomer(); + demandParams = queryParams.getDemand(); + } + 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 = null; + if (Objects.nonNull(customerParams)) { + Collection customers = customerService.list(new QueryWrapper<>(customerParams)); + if (CollectionUtils.isEmpty(customers)) { + return investPage; + } + queryWrapperDemand = new LambdaQueryWrapper<>(); + queryWrapperDemand.in(InvestDemandEntity::getId, getIds(customers, InvestCustomerEntity::getId)); } - 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); + + InvestPageResult demandPage = demandService.queryPage(buildPageQuery(params, demandParams), queryWrapperDemand); if (CollectionUtils.isEmpty(demandPage.getRecords())) { return investPage; } - List resultList = getTargeInfoList(demandPage, customerPage.getRecords()); + List resultList = getTargeInfoList(demandPage); BeanUtils.copyProperties(demandPage, investPage); investPage.setRecords(resultList); return investPage; } + private InvestDemandDto doConvertDemand(InvestDemandQuery params) { + InvestCustomerEntity customerEntity = new InvestCustomerEntity(); + customerEntity.setId(params.getCustomerId()); + customerEntity.setType(params.getCustomerType()); + customerEntity.setBusinessId(params.getBusinessId()); + + InvestDemandEntity demandEntity = new InvestDemandEntity(); + demandEntity.setOwner(params.getOwner()); + + InvestDemandDto demandDto = new InvestDemandDto(); + demandDto.setCustomer(customerEntity); + demandDto.setDemand(demandEntity); + return demandDto; + } @Override - public InvestPageResult queryPageTask(InvestPageQuery params) { - InvestTaskDto queryParams = params.getQueryData(); - InvestTaskEntity queryTask = null; + public InvestPageResult queryPageTask(InvestTaskQuery params) { + InvestTaskDto queryParams = convert(params, this::doConvertTask); + InvestTaskEntity taskParams = null; + WxShop shopParams = null; if (Objects.nonNull(queryParams)) { - queryTask = new InvestTaskEntity(); + shopParams = queryParams.getShop(); + taskParams = queryParams.getTask(); } - - InvestPageResult taskPage = taskService.queryPage(new InvestPageQuery<>(queryTask)); - + LambdaQueryWrapper taskQueryWrapper = null; InvestPageResult investPage = new InvestPageResult<>(); + if (Objects.nonNull(shopParams)) { + Collection shops = shopService.selectList(new QueryWrapper<>(shopParams)); + if (CollectionUtils.isEmpty(shops)) { + return investPage; + } + taskQueryWrapper = new LambdaQueryWrapper<>(); + taskQueryWrapper.in(InvestTaskEntity::getTargetId, getIds(shops, WxShop::getId)); + } + if (Objects.nonNull(taskQueryWrapper) && Objects.nonNull(taskParams)) { + taskQueryWrapper.eq(InvestTaskEntity::getOwner, taskParams.getOwner()); + taskQueryWrapper.apply(StringUtils.isNoneEmpty(taskParams.getOwner()), "`owner` REGEXP {0}", taskParams.getOwner()); + } + + InvestPageResult taskPage = taskService.queryPage(buildPageQuery(params, taskParams), taskQueryWrapper); if (CollectionUtils.isEmpty(taskPage.getRecords())) { return investPage; } - List taskList = taskPage.getRecords(); + Collection taskList = taskPage.getRecords(); //2、目标信息 - Collection shops = shopService.getByIds(taskList.stream().map(InvestTaskEntity::getTargetId).collect(Collectors.toList())); - Map shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop)); + Collection shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); + Map shopsMap = getMap(shops, WxShop::getId); //3、用户信息 - Map usersMap = getUserInfoMap(); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); List resultList = new ArrayList<>(); for (InvestTaskEntity item : taskList) { WxShop shop = shopsMap.get(item.getTargetId()); @@ -97,10 +136,26 @@ public class InvestBizServiceImpl implements InvestBizService { } BeanUtils.copyProperties(taskPage, investPage); investPage.setRecords(resultList); - investPage.setTotal(taskPage.getTotal()); return investPage; } + + private InvestTaskDto doConvertTask(InvestTaskQuery params) { + InvestTaskEntity task = new InvestTaskEntity(); + task.setOwner(params.getTaskOwner()); + task.setStatus(params.getTaskStatus()); + + WxShop shop = new WxShop(); + shop.setShopNumber(params.getShopNumber()); + shop.setStatus(params.getShopStatus()); + shop.setBusinessId(params.getBusinessId()); + + InvestTaskDto taskDto = new InvestTaskDto(); + taskDto.setShop(shop); + taskDto.setTask(task); + return taskDto; + } + @Override public InvestPageResult queryPageFollowRecord(InvestPageQuery params) { InvestPageResult recordPage = followRecordService.queryPage(params); @@ -110,16 +165,16 @@ public class InvestBizServiceImpl implements InvestBizService { return investPage; } - List recordList = recordPage.getRecords(); + Collection recordList = recordPage.getRecords(); //2、用户信息 - Map usersMap = getUserInfoMap(); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); //3、客户 - Collection customers = getCustomers(recordList.stream().map(InvestFollowRecordEntity::getCustomerId)); - Map customerMap = getCustomerMap(customers); + Collection customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId)); + Map customerMap = getMap(customers, InvestCustomerEntity::getId); //4、 品牌 - Map brandMap = getBrandMap(customers.stream().map(InvestCustomerEntity::getBrandId).collect(Collectors.toList())); + Map brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); List resultList = new ArrayList<>(); for (InvestFollowRecordEntity item : recordList) { @@ -128,15 +183,63 @@ public class InvestBizServiceImpl implements InvestBizService { resultList.add(buildFollowRecordItem(usersMap, item, customerEntity, brand)); } + BeanUtils.copyProperties(recordPage, investPage); + investPage.setRecords(resultList); + return investPage; + } + + @Override + public InvestPageResult queryPageRemind(InvestPageQuery params) { + InvestHelper.notNull(params); + InvestPageResult investPage = new InvestPageResult<>(); + InvestPageResult recordPage = remindService.queryPage(params); + if (CollectionUtils.isEmpty(recordPage.getRecords())) { + return investPage; + } + Collection recordList = recordPage.getRecords(); + Collection resultList = 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); + } + + //2、用户信息 + Map usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestRemindEntity::getOwner)), MallUserInfo::getId); + + //3、客户 + Collection customers = customerService.listByIds(getIds(resultList, InvestRemindVo::getCustomerId)); + Map customerMap = getMap(customers, InvestCustomerEntity::getId); + //4、 品牌 + Map brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); + + for (InvestRemindVo remindVo : resultList) { + InvestCustomerEntity customerEntity = customerMap.get(remindVo.getCustomerId()); + if (Objects.nonNull(customerEntity)) { + remindVo.setCustomer(customerEntity); + remindVo.setBrand(brandMap.get(customerEntity.getBrandId())); + } + remindVo.setOwnerInfo(usersMap.get(remindVo.getOwner())); + } + + BeanUtils.copyProperties(recordPage, investPage); investPage.setRecords(resultList); investPage.setTotal(recordPage.getTotal()); + return investPage; } private List getMallUserInfos(Map usersMap, InvestFollowRecordEntity item) { - List ownerInfo = null ; - Map contentMap = JSON.parseObject(item.getContent(),Map.class); + List ownerInfo = null; + HashMap contentMap = JSON.parseObject(item.getContent(), HashMap.class); if (MapUtils.isNotEmpty(contentMap)) { Object followMember = contentMap.get(InvestFollowRecordEntity.KEY_MEMBER); ownerInfo = getMallUserInfos(followMember, usersMap); @@ -172,7 +275,7 @@ public class InvestBizServiceImpl implements InvestBizService { public boolean updateCustomerAndDemand(InvestDemandDto demandDto) { InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); customerService.updateById(demandDto.getCustomer()); - InvestDemandEntity demandEntity = demandDto.getDemand() ; + InvestDemandEntity demandEntity = demandDto.getDemand(); demandEntity.setCustomerId(demandDto.getCustomer().getId()); return demandService.updateById(demandEntity); } @@ -183,28 +286,29 @@ public class InvestBizServiceImpl implements InvestBizService { InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId()); WxBrand brand = brandService.getById(customerEntity.getBrandId()); WxShop shop = shopService.getById(demandEntity.getTargetId()); - Map usersMap = getUserInfoMap(); - return buildDemindItem(demandEntity, customerEntity, brand, shop,usersMap); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); + return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap); } @Override public InvestTaskVo findTaskById(Long id) { InvestTaskEntity taskEntity = taskService.getByIdNotNull(id); WxShop shop = shopService.getById(taskEntity.getTargetId()); - Map usersMap = getUserInfoMap(); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); return buildTaskItem(taskEntity, shop, usersMap); } @Override public InvestFollowRecordVo findFollowRecordById(Long id) { - Map usersMap = getUserInfoMap(); InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); WxBrand brand = brandService.getById(customerEntity.getBrandId()); return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); } - private InvestFollowRecordVo buildFollowRecordItem(Map usersMap, InvestFollowRecordEntity item, InvestCustomerEntity customerEntity, WxBrand brand) { + private InvestFollowRecordVo buildFollowRecordItem(Map usersMap, InvestFollowRecordEntity item, + InvestCustomerEntity customerEntity, WxBrand brand) { List ownerInfo = getMallUserInfos(usersMap, item); InvestFollowRecordVo followRecordVo = new InvestFollowRecordVo(); followRecordVo.setCustomer(customerEntity); @@ -215,7 +319,8 @@ public class InvestBizServiceImpl implements InvestBizService { return followRecordVo; } - private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop, Map usersMap) { + private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, + WxShop shop, Map usersMap) { InvestDemandVo resultItemVo = new InvestDemandVo(); resultItemVo.setBrand(brand); resultItemVo.setCustomer(customer); @@ -225,11 +330,6 @@ public class InvestBizServiceImpl implements InvestBizService { return resultItemVo; } - private Map getUserInfoMap() { - Collection users = userInfoService.findList(null); - return users.parallelStream().collect(Collectors.toMap(MallUserInfo::getId, MallUserInfo -> MallUserInfo)); - } - private InvestTaskVo buildTaskItem(InvestTaskEntity item, WxShop shop, Map usersMap) { List ownerInfo = getMallUserInfos(item.getOwner(), usersMap); InvestTaskVo resultItemVo = new InvestTaskVo(); @@ -242,8 +342,8 @@ public class InvestBizServiceImpl implements InvestBizService { private List getMallUserInfos(Object userJson, Map usersMap) { List ownerInfo = Lists.newArrayList(); JSONArray ownerList; - if(userJson instanceof String) { - ownerList = JSONArray.parseArray((String)userJson); + if (userJson instanceof String) { + ownerList = JSONArray.parseArray((String) userJson); } else { ownerList = (JSONArray) userJson; } @@ -255,18 +355,19 @@ public class InvestBizServiceImpl implements InvestBizService { return ownerInfo; } - private List getTargeInfoList(InvestPageResult demandPage, List customers) { - List demandList = demandPage.getRecords(); - Map customersMap = getCustomerMap(customers); + private List getTargeInfoList(InvestPageResult demandPage) { + Collection demandList = demandPage.getRecords(); + Collection customers = customerService.listByIds(getIds(demandList, InvestDemandEntity::getCustomerId)); + Map customersMap = getMap(customers, InvestCustomerEntity::getId); //3、目标信息 - Collection shops = shopService.getByIds(demandList.stream().map(InvestDemandEntity::getTargetId).collect(Collectors.toList())); - Map shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop)); + Collection shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); + Map shopsMap = getMap(shops, WxShop::getId); //4、品牌 - Map brandMap = getBrandMap(customers.stream().map(InvestCustomerEntity::getBrandId).collect(Collectors.toList())); + Map brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); //5、用户 - Map usersMap = getUserInfoMap(); + Map usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); List resultList = new ArrayList<>(); for (InvestDemandEntity item : demandList) { @@ -281,17 +382,25 @@ public class InvestBizServiceImpl implements InvestBizService { return resultList; } - private Map getBrandMap(Collection ids) { - Collection brands = brandService.getByIds(ids); - return brands.stream().collect(Collectors.toMap(WxBrand::getId, brand -> brand)); + private InvestPageQuery buildPageQuery(InvestPageQuery params, T t) { + InvestPageQuery pageQuery = new InvestPageQuery<>(); + BeanUtils.copyProperties(params, pageQuery); + if (Objects.nonNull(t)) { + pageQuery.setQueryData(t); + } + return pageQuery; } + public R convert(T params, Function function) { + InvestHelper.notNull(params); + return function.apply(params); + } - private Map getCustomerMap(Collection customers) { - return customers.stream().collect(Collectors.toMap(InvestCustomerEntity::getId, customer -> customer)); + private Map getMap(Collection dataList, Function keyMapper) { + return dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity)); } - private Collection getCustomers(Stream longStream) { - return customerService.listByIds(longStream.collect(Collectors.toList())); + private Collection getIds(Collection dataList, Function mapper) { + return dataList.parallelStream().map(mapper).collect(Collectors.toList()); } }