Przeglądaj źródła

[招商]adjust

release_toaliyun_real
Burce 6 lat temu
rodzic
commit
55f9daa386
5 zmienionych plików z 125 dodań i 102 usunięć
  1. +6
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java
  2. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java
  3. +45
    -46
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java
  4. +8
    -1
      mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java
  5. +65
    -48
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java

+ 6
- 6
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestController.java Wyświetl plik

@@ -3,7 +3,7 @@ package com.iformall.controller.invest;
import com.iformall.annotation.SystemControllerLog; import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.InvestResultData; import com.iformall.common.InvestResultData;
import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.MallUserInfo;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.invest.InvestBizService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;


import java.util.List;



@Slf4j @Slf4j
@RestController @RestController
@@ -20,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
public class InvestController extends InvestBaseController { public class InvestController extends InvestBaseController {


@Autowired @Autowired
private MallUserInfoService userInfoService ;
private InvestBizService bizService ;


/** /**
* 用户列表 * 用户列表
@@ -28,10 +30,8 @@ public class InvestController extends InvestBaseController {
@ApiOperation("用户列表") @ApiOperation("用户列表")
@SystemControllerLog(description = "用户列表") @SystemControllerLog(description = "用户列表")
@PostMapping("/users") @PostMapping("/users")
public InvestResultData userList() {
MallUserInfo query = new MallUserInfo() ;
query.setIsAdmin(0);
return execute(query, p -> userInfoService.findList(query));
public InvestResultData<List<MallUserInfo>> userList() {
return execute(null, p -> bizService.queryUserList());
} }


} }

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestDemandController.java Wyświetl plik

@@ -53,7 +53,7 @@ public class InvestDemandController extends InvestBaseController {
@SystemServiceLog @SystemServiceLog
@GetMapping("/info/{id}") @GetMapping("/info/{id}")
public InvestResultData<InvestDemandVo> info(@PathVariable("id") Long id) { public InvestResultData<InvestDemandVo> info(@PathVariable("id") Long id) {
return execute(id, p -> investBizService.findById(p));
return execute(id, p -> investBizService.findDemandById(p));
} }


/** /**


+ 45
- 46
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestTaskController.java Wyświetl plik

@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;





/** /**
* 招商任务 * 招商任务
* *
@@ -30,56 +29,56 @@ import java.util.Arrays;
@RequestMapping("invest/task") @RequestMapping("invest/task")
@Api(tags = "招商任务") @Api(tags = "招商任务")
public class InvestTaskController extends InvestBaseController { public class InvestTaskController extends InvestBaseController {
@Autowired
private InvestTaskService investTaskService;
@Autowired
private InvestBizService bizService;
@Autowired
private InvestTaskService investTaskService;
@Autowired
private InvestBizService bizService;


/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestTaskVo>> list(InvestPageQuery<InvestTaskEntity> params){
return execute(params, p -> bizService.queryPageTask(p));
}
/**
* 分页列表
*/
@SystemServiceLog
@ApiOperation("分页列表接口")
@GetMapping("/list")
public InvestResultData<InvestPageResult<InvestTaskVo>> list(InvestPageQuery<InvestTaskEntity> params) {
return execute(params, p -> bizService.queryPageTask(p));
}




/**
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData info(@PathVariable("id") Long id){
return execute(id, p -> investTaskService.getByIdNotNull(id));
}
/**
* 信息
*/
@SystemServiceLog
@GetMapping("/info/{id}")
public InvestResultData<InvestTaskVo> info(@PathVariable("id") Long id) {
return execute(id, p -> bizService.findTaskById(id));
}


/**
* 保存
*/
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestTaskEntity investTask){
return execute(investTask, p -> investTaskService.save(p));
}
/**
* 保存
*/
@SystemServiceLog
@PostMapping("/save")
public InvestResultData save(@RequestBody InvestTaskEntity investTask) {
return execute(investTask, p -> investTaskService.save(p));
}


/**
* 修改
*/
@SystemServiceLog
@PostMapping("/update")
public InvestResultData update(@RequestBody InvestTaskEntity investTask){
return execute(investTask, p -> investTaskService.updateById(p));
}
/**
* 修改
*/
@SystemServiceLog
@PostMapping("/update")
public InvestResultData update(@RequestBody InvestTaskEntity investTask) {
return execute(investTask, p -> investTaskService.updateById(p));
}


/**
* 删除
*/
@SystemServiceLog
@PostMapping("/delete")
public InvestResultData delete(@RequestBody Long[] ids){
return execute(ids, p -> investTaskService.removeByIds(Arrays.asList(p)));
}
/**
* 删除
*/
@SystemServiceLog
@PostMapping("/delete")
public InvestResultData delete(@RequestBody Long[] ids) {
return execute(ids, p -> investTaskService.removeByIds(Arrays.asList(p)));
}


} }

+ 8
- 1
mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java Wyświetl plik

@@ -2,20 +2,27 @@ package com.iformall.service.invest;


import com.iformall.domain.po.InvestDemandEntity; import com.iformall.domain.po.InvestDemandEntity;
import com.iformall.domain.po.InvestTaskEntity; import com.iformall.domain.po.InvestTaskEntity;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.vo.invest.InvestDemandVo; import com.iformall.domain.vo.invest.InvestDemandVo;
import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult; import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.domain.vo.invest.InvestTaskVo; import com.iformall.domain.vo.invest.InvestTaskVo;


import java.util.List;

public interface InvestBizService { public interface InvestBizService {


InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandEntity> params); InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandEntity> params);


InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskEntity> params); InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskEntity> params);


List<MallUserInfo> queryUserList() ;

boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) ; boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) ;


boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) ; boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) ;


InvestDemandVo findById(Long id) ;
InvestDemandVo findDemandById(Long id) ;

InvestTaskVo findTaskById(Long id) ;
} }

+ 65
- 48
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java Wyświetl plik

@@ -64,7 +64,6 @@ public class InvestBizServiceImpl implements InvestBizService {
public InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskEntity> params) { public InvestPageResult<InvestTaskVo> queryPageTask(InvestPageQuery<InvestTaskEntity> params) {
InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(params); InvestPageResult<InvestTaskEntity> taskPage = taskService.queryPage(params);



InvestPageResult<InvestTaskVo> investPage = new InvestPageResult<>(); InvestPageResult<InvestTaskVo> investPage = new InvestPageResult<>();
if (CollectionUtils.isEmpty(taskPage.getRecords())) { if (CollectionUtils.isEmpty(taskPage.getRecords())) {
return investPage; return investPage;
@@ -75,10 +74,9 @@ public class InvestBizServiceImpl implements InvestBizService {
//2、目标信息 //2、目标信息
Collection<WxShop> shops = shopService.getByIds(taskList.stream().map(InvestTaskEntity::getTargetId).collect(Collectors.toList())); Collection<WxShop> shops = shopService.getByIds(taskList.stream().map(InvestTaskEntity::getTargetId).collect(Collectors.toList()));
Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop)); Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop));

//3、用户信息 //3、用户信息
Collection<MallUserInfo> users = userInfoService.findList(null);
Map<Long, MallUserInfo> usersMap = users.parallelStream().collect(Collectors.toMap(MallUserInfo::getId, MallUserInfo -> MallUserInfo));
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
List<InvestTaskVo> resultList = new ArrayList<>(); List<InvestTaskVo> resultList = new ArrayList<>();
for (InvestTaskEntity item : taskList) { for (InvestTaskEntity item : taskList) {
WxShop shop = shopsMap.get(item.getTargetId()); WxShop shop = shopsMap.get(item.getTargetId());
@@ -91,48 +89,11 @@ public class InvestBizServiceImpl implements InvestBizService {
return investPage; return investPage;
} }


private InvestTaskVo buildResultItem(InvestTaskEntity item, WxShop shop, Map<Long, MallUserInfo> usersMap) {
List<MallUserInfo> ownerInfo = Lists.newArrayList();
List<Long> ownerList = JSON.parseArray(item.getOwner(), Long.class);
if (CollectionUtils.isNotEmpty(ownerList)) {
for (Long userId : ownerList) {
ownerInfo.add(usersMap.get(userId));
}
}
InvestTaskVo resultItemVo = InvestTaskVo.builder()
.targetInfo(shop)
.ownerInfo(ownerInfo)
.build();
BeanUtils.copyProperties(item, resultItemVo);
return resultItemVo;
}

private List<InvestDemandVo> getITargeInfoList(IPage<InvestDemandEntity> demandPage) {
List<InvestDemandEntity> demandList = demandPage.getRecords();
//2、客户信息
Collection<InvestCustomerEntity> customers = customerService.listByIds(demandList
.stream().map(InvestDemandEntity::getCustomerId).collect(Collectors.toList()));
Map<Long, InvestCustomerEntity> customersMap = customers.stream().collect(Collectors.toMap(InvestCustomerEntity::getId, customer -> customer));

//3、目标信息
Collection<WxShop> shops = shopService.getByIds(demandList.stream().map(InvestDemandEntity::getTargetId).collect(Collectors.toList()));
Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop));

//4 品牌
Collection<WxBrand> brands = brandService.getByIds(customers.stream().map(InvestCustomerEntity::getBrandId).collect(Collectors.toList()));
Map<Long, WxBrand> brandMap = brands.stream().collect(Collectors.toMap(WxBrand::getId, brand -> brand));

List<InvestDemandVo> 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(buildResultItem(item, customer, brand, shop));
}
return resultList;
@Override
public List<MallUserInfo> queryUserList() {
MallUserInfo query = new MallUserInfo();
query.setIsAdmin(0);
return userInfoService.findList(query);
} }


@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -160,8 +121,7 @@ public class InvestBizServiceImpl implements InvestBizService {
} }


@Override @Override
public InvestDemandVo findById(Long id) {
InvestHelper.allNotNull(id);
public InvestDemandVo findDemandById(Long id) {
InvestDemandEntity demandEntity = demandService.getByIdNotNull(id); InvestDemandEntity demandEntity = demandService.getByIdNotNull(id);
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId()); InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId());
WxBrand brand = brandService.getById(customerEntity.getBrandId()); WxBrand brand = brandService.getById(customerEntity.getBrandId());
@@ -169,6 +129,14 @@ public class InvestBizServiceImpl implements InvestBizService {
return buildResultItem(demandEntity, customerEntity, brand, shop); return buildResultItem(demandEntity, customerEntity, brand, shop);
} }


@Override
public InvestTaskVo findTaskById(Long id) {
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id);
WxShop shop = shopService.getById(taskEntity.getTargetId());
Map<Long, MallUserInfo> usersMap = getUserInfoMap();
return buildResultItem(taskEntity, shop, usersMap);
}

private InvestDemandVo buildResultItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop) { private InvestDemandVo buildResultItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop) {
InvestDemandVo resultItemVo = InvestDemandVo.builder() InvestDemandVo resultItemVo = InvestDemandVo.builder()
.brand(brand) .brand(brand)
@@ -178,4 +146,53 @@ public class InvestBizServiceImpl implements InvestBizService {
BeanUtils.copyProperties(item, resultItemVo); BeanUtils.copyProperties(item, resultItemVo);
return resultItemVo; return resultItemVo;
} }

private Map<Long, MallUserInfo> getUserInfoMap() {
Collection<MallUserInfo> users = userInfoService.findList(null);
return users.parallelStream().collect(Collectors.toMap(MallUserInfo::getId, MallUserInfo -> MallUserInfo));
}

private InvestTaskVo buildResultItem(InvestTaskEntity item, WxShop shop, Map<Long, MallUserInfo> usersMap) {
List<MallUserInfo> ownerInfo = Lists.newArrayList();
List<Long> ownerList = JSON.parseArray(item.getOwner(), Long.class);
if (CollectionUtils.isNotEmpty(ownerList)) {
for (Long userId : ownerList) {
ownerInfo.add(usersMap.get(userId));
}
}
InvestTaskVo resultItemVo = InvestTaskVo.builder()
.targetInfo(shop)
.ownerInfo(ownerInfo)
.build();
BeanUtils.copyProperties(item, resultItemVo);
return resultItemVo;
}

private List<InvestDemandVo> getITargeInfoList(IPage<InvestDemandEntity> demandPage) {
List<InvestDemandEntity> demandList = demandPage.getRecords();
//2、客户信息
Collection<InvestCustomerEntity> customers = customerService.listByIds(demandList
.stream().map(InvestDemandEntity::getCustomerId).collect(Collectors.toList()));
Map<Long, InvestCustomerEntity> customersMap = customers.stream().collect(Collectors.toMap(InvestCustomerEntity::getId, customer -> customer));

//3、目标信息
Collection<WxShop> shops = shopService.getByIds(demandList.stream().map(InvestDemandEntity::getTargetId).collect(Collectors.toList()));
Map<Long, WxShop> shopsMap = shops.stream().collect(Collectors.toMap(WxShop::getId, shop -> shop));

//4 品牌
Collection<WxBrand> brands = brandService.getByIds(customers.stream().map(InvestCustomerEntity::getBrandId).collect(Collectors.toList()));
Map<Long, WxBrand> brandMap = brands.stream().collect(Collectors.toMap(WxBrand::getId, brand -> brand));

List<InvestDemandVo> 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(buildResultItem(item, customer, brand, shop));
}
return resultList;
}
} }

Ładowanie…
Anuluj
Zapisz