Browse Source

[招商]adjust

release_toaliyun_real
Burce 6 years ago
parent
commit
ba968bf3d1
13 changed files with 62 additions and 209 deletions
  1. +7
    -7
      mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java
  2. +6
    -2
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  3. +0
    -1
      mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java
  4. +0
    -1
      mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java
  5. +0
    -1
      mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java
  6. +0
    -1
      mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java
  7. +0
    -122
      mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java
  8. +2
    -8
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java
  9. +21
    -21
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java
  10. +10
    -20
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java
  11. +3
    -5
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestOperateRecordServiceImpl.java
  12. +6
    -9
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestRemindServiceImpl.java
  13. +7
    -11
      mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java

+ 7
- 7
mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java View File

@@ -1,5 +1,6 @@
package com.iformall.controller.invest;

import com.alibaba.fastjson.JSON;
import com.iformall.common.ErrorCode;
import com.iformall.common.InvestResultData;
import com.iformall.controller.base.BaseController;
@@ -7,18 +8,17 @@ import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.exception.MallinkException;
import lombok.extern.slf4j.Slf4j;

import java.util.function.Function;

@Slf4j
public class InvestBaseController extends BaseController {

interface ExecuteFunction<T, E> {
E execute(T t);
}

public <E, T> InvestResultData<E> execute(T params, ExecuteFunction<T, E> function) {
public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) {
try {
log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(params));
InvestUserContext.setUser(getUser());
E e = function.execute(params);
return new InvestResultData(e);
R r = function.apply(params);
return new InvestResultData(r);
} catch (MallinkException e) {
log.error("execute error", e);
return new InvestResultData(e.getErrorCode(), e.getMessage());


+ 6
- 2
mallinkService/src/main/java/com/iformall/common/ErrorCode.java View File

@@ -1,5 +1,7 @@
package com.iformall.common;

import org.springframework.util.ObjectUtils;

import java.text.MessageFormat;

/**
@@ -524,7 +526,8 @@ public enum ErrorCode{

// 招商管理 53000 begin
INVEST_CUSTOMER_NOT_FOUND(53000, "客户信息不存在"),
INVEST_UNKNOW_ERRROR(53000, "客户信息不存在"),
INVEST_UNKNOW_ERRROR(53001, "客户信息不存在"),
INVEST_DATA_NOT_FOUND(53002, "信息不存在"),
// 招商管理 53999 end


@@ -552,7 +555,8 @@ public enum ErrorCode{
if (param.length == 0) {
return message;
}
return MessageFormat.format(message, param);
//return MessageFormat.format(message, param);
return MessageFormat.format("{0}, {1}", ObjectUtils.nullSafeToString(param), message);
}

public static ErrorCode getByCode(int code) {


+ 0
- 1
mallinkService/src/main/java/com/iformall/domain/po/InvestCustomerEntity.java View File

@@ -66,7 +66,6 @@ public class InvestCustomerEntity extends InvestBaseEntity {
*/
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true)
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Version
private Date updateDate;



+ 0
- 1
mallinkService/src/main/java/com/iformall/domain/po/InvestDemandEntity.java View File

@@ -54,7 +54,6 @@ public class InvestDemandEntity extends InvestBaseEntity {
*/
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true)
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Version
private Date updateDate;



+ 0
- 1
mallinkService/src/main/java/com/iformall/domain/po/InvestOperateRecordEntity.java View File

@@ -57,7 +57,6 @@ public class InvestOperateRecordEntity extends InvestBaseEntity {
* 创建时间
*/
@io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate", example = "2018-10-01 12:18:48")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;

@JsonIgnore


+ 0
- 1
mallinkService/src/main/java/com/iformall/domain/po/InvestTaskEntity.java View File

@@ -53,7 +53,6 @@ public class InvestTaskEntity extends InvestBaseEntity {
*/
@io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true)
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Version
private Date updateDate;



+ 0
- 122
mallinkService/src/main/java/com/iformall/service/invest/InvestHelper.java View File

@@ -1,122 +0,0 @@
package com.iformall.service.invest;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iformall.common.ErrorCode;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.enums.EnumInvestType;
import com.iformall.enums.EnumShopStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxShopService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class InvestHelper {

/**
* 校验商铺
*
* @param shopService
* @param inputEntity
*/
public static void checkShop(WxShopService shopService, InvestBaseEntity inputEntity) {
Long targetId = null;
EnumInvestType investType = null;
if (inputEntity instanceof InvestDemandEntity) {
InvestDemandEntity entity = (InvestDemandEntity) inputEntity;
targetId = entity.getTargetId();
investType = entity.getTargetType();
} else if (inputEntity instanceof InvestTaskEntity) {
InvestTaskEntity entity = (InvestTaskEntity) inputEntity;
targetId = entity.getTargetId();
investType = entity.getTargetType();
}
if (EnumInvestType.SHOP.equals(investType)) {
WxShop shop = shopService.getById(targetId);
checkShopNotNull(shop);
}
}


/**
* 校验参数是否为空
*
* @param shop
*/
public static void checkShopNotNull(WxShop shop) {
if (Objects.isNull(shop)) {
throw new MallinkException(ErrorCode.SHOP_IS_NOT_FOUND);
}

if (Objects.equals(shop.getStatus(), EnumShopStatus.RENT.getCode())) {
throw new MallinkException(ErrorCode.SHOP_IS_RENT);
}
}

/**
* 校验用户是否存在
*
* @param userInfoService
* @param userIdJson
*/
public static void checkUserExit(MallUserInfoService userInfoService, String userIdJson) {
if (Objects.nonNull(userIdJson)) {
List<Long> ids = JSONArray.parseArray(userIdJson, Long.class);
if (CollectionUtils.isNotEmpty(ids)) {
List<Long> usersFromDb = userInfoService.getByIds(ids).stream().map(MallUserInfo::getId).collect(Collectors.toList());
List<Long> notExsitIds = ids.stream().filter(uid -> !usersFromDb.contains(uid)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(notExsitIds)) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), notExsitIds + ErrorCode.USER_IS_EMPTY.getMessage());
}
}
}
}

public static void checkUserExit(MallUserInfoService userInfoService, Long id) {
if (Objects.nonNull(id)) {
MallUserInfo userInfo = userInfoService.getById(id);
if (Objects.isNull(userInfo))
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), id + ErrorCode.USER_IS_EMPTY.getMessage());
}
}

public static void checkCustomerExit(InvestCustomerService customerService, Long id) {
InvestCustomerEntity customerEntity = customerService.getById(id);
if (Objects.isNull(customerEntity)) {
throw new MallinkException(ErrorCode.INVEST_CUSTOMER_NOT_FOUND.getCode(), id + ErrorCode.INVEST_CUSTOMER_NOT_FOUND.getMessage());
}
}

/**
* 校验参数是否为空
*
* @param values
*/
public static void checkAllNotNull(final Object... values) {
if (!ObjectUtils.allNotNull(values)) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
}

public static Page buildQueryPage(InvestPageQuery pageQuery) {
Page page = new Page();
page.setCurrent(pageQuery.getPageNum());
page.setSize(pageQuery.getPageSize());
page.setAscs(pageQuery.getAscs());
page.setDescs(pageQuery.getDescs());
page.setOptimizeCountSql(true);
page.setSearchCount(true);
return page;
}


public static void notSupport() {
throw new MallinkException(ErrorCode.SYS_METHOD_NOT_SUPPORT);
}
}

+ 2
- 8
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestCustomerServiceImpl.java View File

@@ -1,7 +1,6 @@
package com.iformall.service.invest.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iformall.common.ErrorCode;
import com.iformall.common.TableLog;
import com.iformall.domain.po.InvestCustomerEntity;
@@ -13,7 +12,6 @@ import com.iformall.mapper.InvestCustomerDao;
import com.iformall.service.WxBrandService;
import com.iformall.service.WxBusinessService;
import com.iformall.service.invest.InvestCustomerService;
import com.iformall.service.invest.InvestHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@@ -21,7 +19,7 @@ import java.util.List;
import java.util.Objects;

@Service
public class InvestCustomerServiceImpl extends ServiceImpl<InvestCustomerDao, InvestCustomerEntity> implements InvestCustomerService {
public class InvestCustomerServiceImpl extends InvestBaseService<InvestCustomerDao, InvestCustomerEntity> implements InvestCustomerService {

@Autowired
private WxBrandService brandService;
@@ -54,11 +52,7 @@ public class InvestCustomerServiceImpl extends ServiceImpl<InvestCustomerDao, In
@Deprecated
@Override
public boolean saveOrUpdate(InvestCustomerEntity entity) {
//checkBusiness(entity);
//checkBrand(entity);
//checkType(entity);
//return super.saveOrUpdate(entity);
InvestHelper.notSupport();
notSupport();
return false ;
}



+ 21
- 21
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestDemandServiceImpl.java View File

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iformall.common.TableLog;
import com.iformall.domain.po.InvestCustomerEntity;
import com.iformall.domain.po.InvestDemandEntity;
@@ -19,7 +18,6 @@ import com.iformall.service.WxBrandService;
import com.iformall.service.WxShopService;
import com.iformall.service.invest.InvestCustomerService;
import com.iformall.service.invest.InvestDemandService;
import com.iformall.service.invest.InvestHelper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +28,7 @@ import java.util.stream.Collectors;


@Service
public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, InvestDemandEntity> implements InvestDemandService {
public class InvestDemandServiceImpl extends InvestBaseService<InvestDemandDao, InvestDemandEntity> implements InvestDemandService {

@Autowired
private WxShopService shopService;
@@ -43,8 +41,8 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest

@Override
public InvestPageResult<InvestDemandVo> queryPage(InvestPageQuery<InvestDemandEntity> params) {
InvestHelper.checkAllNotNull(params);
Page page = InvestHelper.buildQueryPage(params);
checkAllNotNull(params);
Page page = buildQueryPage(params);
InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>();
//1、客户需求
InvestDemandEntity queryTask = params.getQueryData();
@@ -54,6 +52,14 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest
return investPage;
}

List<InvestDemandVo> resultList = getITargeInfoList(demandPage);

BeanUtils.copyProperties(demandPage, investPage);
investPage.setRecords(resultList);
return investPage;
}

private List<InvestDemandVo> getITargeInfoList(IPage<InvestDemandEntity> demandPage) {
List<InvestDemandEntity> demandList = demandPage.getRecords();
//2、客户信息
Collection<InvestCustomerEntity> customers = customerService.listByIds(demandList
@@ -78,11 +84,7 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest
}
resultList.add(buildResultItem(item, customer, brand, shop));
}

BeanUtils.copyProperties(demandPage, investPage);
investPage.setRecords(resultList);
investPage.setTotal(demandPage.getTotal());
return investPage;
return resultList;
}

@Override
@@ -97,8 +99,8 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest


private boolean savaOrUpdateCustomerDemand(InvestDemandVo customerDemandVo) {
InvestHelper.checkAllNotNull(customerDemandVo);
InvestHelper.checkAllNotNull(customerDemandVo.getBrand(), customerDemandVo.getCustomer());
checkAllNotNull(customerDemandVo);
checkAllNotNull(customerDemandVo.getBrand(), customerDemandVo.getCustomer());
InvestCustomerEntity customerEntity = new InvestCustomerEntity();
BeanUtils.copyProperties(customerDemandVo, customerEntity);
customerService.saveOrUpdate(customerEntity);
@@ -109,11 +111,11 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest

@Override
public InvestDemandVo findById(Long id) {
InvestHelper.checkAllNotNull(id);
checkAllNotNull(id);
InvestDemandEntity demandEntity = this.getById(id);
InvestHelper.checkAllNotNull(demandEntity);
checkAllNotNull(demandEntity);
InvestCustomerEntity customerEntity = customerService.getById(demandEntity.getCustomerId());
InvestHelper.checkAllNotNull(customerEntity);
checkAllNotNull(customerEntity);
WxBrand brand = brandService.getById(customerEntity.getBrandId());
WxShop shop = shopService.getById(demandEntity.getTargetId());
InvestDemandVo customerDemandVo = buildResultItem(demandEntity, customerEntity, brand, shop);
@@ -147,9 +149,7 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest
@Deprecated
@Override
public boolean saveOrUpdate(InvestDemandEntity entity) {
//checkBeforeSaveOrUpdate(entity);
//return super.saveOrUpdate(entity);
InvestHelper.notSupport();
notSupport();
return false ;
}

@@ -161,9 +161,9 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest
}

private void checkBeforeSaveOrUpdate(InvestDemandEntity entity) {
InvestHelper.checkCustomerExit(customerService, entity.getCustomerId());
InvestHelper.checkUserExit(userInfoService, entity.getOwner());
InvestHelper.checkShop(shopService, entity);
checkCustomerExit(customerService, entity.getCustomerId());
checkUserExit(userInfoService, entity.getOwner());
checkShop(shopService, entity);
}

}

+ 10
- 20
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestFollowRecordServiceImpl.java View File

@@ -4,20 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iformall.common.ErrorCode;
import com.iformall.common.TableLog;
import com.iformall.domain.po.InvestBaseEntity;
import com.iformall.domain.po.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.exception.MallinkException;
import com.iformall.mapper.InvestFollowRecordDao;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.invest.InvestDemandService;
import com.iformall.service.invest.InvestFollowRecordService;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestTaskService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
@@ -27,19 +25,17 @@ import org.springframework.stereotype.Service;
import java.util.Objects;

@Service
public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecordDao, InvestFollowRecordEntity> implements InvestFollowRecordService {
public class InvestFollowRecordServiceImpl extends InvestBaseService<InvestFollowRecordDao, InvestFollowRecordEntity> implements InvestFollowRecordService {

@Autowired
private InvestDemandService demandService ;
@Autowired
private InvestTaskService taskService ;
@Autowired
private MallUserInfoService userInfoService;

@Override
public InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params) {
InvestHelper.checkAllNotNull(params);
Page page = InvestHelper.buildQueryPage(params);
checkAllNotNull(params);
Page page = buildQueryPage(params);
InvestFollowRecordEntity queryTask = params.getQueryData();
LambdaQueryWrapper<InvestFollowRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask);
IPage<InvestFollowRecordEntity> records = this.page(page, queryWrapper);
@@ -62,32 +58,27 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor
@Deprecated
@Override
public boolean update(InvestFollowRecordEntity entity, Wrapper<InvestFollowRecordEntity> updateWrapper) {
//checkBeforeSaveOrUpdate(entity);
//return super.update(entity, updateWrapper);
InvestHelper.notSupport();
notSupport();
return false;
}

@Deprecated
@Override
public boolean saveOrUpdate(InvestFollowRecordEntity entity) {
//checkBeforeSaveOrUpdate(entity);
//return super.saveOrUpdate(entity);
InvestHelper.notSupport();
notSupport();
return false;
}

@Deprecated
@Override
public boolean updateById(InvestFollowRecordEntity entity) {
//checkBeforeSaveOrUpdate(entity);
//return super.updateById(entity);
InvestHelper.notSupport();
notSupport();
return false;
}

private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) {
InvestHelper.checkAllNotNull(entity);
checkAllNotNull(entity);
checkAllNotNull(InvestUserContext.getUserId());
InvestBaseEntity baseInvestEntity;
if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) {
baseInvestEntity = demandService.getById(entity.getFollowId());
@@ -96,8 +87,7 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor
} else {
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL) ;
}
InvestHelper.checkAllNotNull(baseInvestEntity);
checkAllNotNull(baseInvestEntity);

InvestHelper.checkUserExit(userInfoService, entity.getOwner());
}
}

+ 3
- 5
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestOperateRecordServiceImpl.java View File

@@ -9,23 +9,21 @@ import com.iformall.domain.po.InvestOperateRecordEntity;
import com.iformall.domain.vo.invest.InvestPageQuery;
import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.mapper.InvestOperateRecordDao;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestOperateRecordService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


@Service
public class InvestOperateRecordServiceImpl extends ServiceImpl<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService {
public class InvestOperateRecordServiceImpl extends InvestBaseService<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService {

@Override
public InvestPageResult<InvestOperateRecordEntity> queryPage(InvestPageQuery<InvestOperateRecordEntity> params) {
InvestHelper.checkAllNotNull(params);
checkAllNotNull(params);
//1、分页信息
Page queryPage = InvestHelper.buildQueryPage(params);
Page queryPage = buildQueryPage(params);
//2、查询数据
InvestOperateRecordEntity queryParams = params.getQueryData();
LambdaQueryWrapper<InvestOperateRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams);


+ 6
- 9
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestRemindServiceImpl.java View File

@@ -11,29 +11,27 @@ import com.iformall.domain.vo.invest.InvestPageResult;
import com.iformall.domain.vo.invest.InvestUserContext;
import com.iformall.mapper.InvestRemindDao;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestRemindService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

@Service
public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, InvestRemindEntity> implements InvestRemindService {
public class InvestRemindServiceImpl extends InvestBaseService<InvestRemindDao, InvestRemindEntity> implements InvestRemindService {

@Autowired
private MallUserInfoService userInfoService;

@Override
public InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params) {
InvestHelper.checkAllNotNull(params);
checkAllNotNull(params);
//1、分页信息
Page queryPage = InvestHelper.buildQueryPage(params);
Page queryPage = buildQueryPage(params);
//2、查询数据
InvestRemindEntity queryParams = params.getQueryData();
InvestHelper.checkUserExit(userInfoService, InvestUserContext.getUserId());
checkUserExit(userInfoService, InvestUserContext.getUserId());
LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams);
IPage<InvestRemindEntity> taskPage = this.page(queryPage, queryWrapper);

@@ -74,9 +72,8 @@ public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, Invest
}

private void checkBeforeSaveOrUpdate(InvestRemindEntity input) {
InvestHelper.checkAllNotNull(input);

InvestHelper.checkAllNotNull(InvestUserContext.getUser());
checkAllNotNull(input);
checkAllNotNull(InvestUserContext.getUser());
input.setOwner(InvestUserContext.getUserId());
input.setTenantId(InvestUserContext.getUser().getTenantId());
}


+ 7
- 11
mallinkService/src/main/java/com/iformall/service/invest/impl/InvestTaskServiceImpl.java View File

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iformall.common.TableLog;
import com.iformall.domain.po.InvestTaskEntity;
import com.iformall.domain.po.WxShop;
@@ -14,7 +13,6 @@ import com.iformall.domain.vo.invest.InvestTaskVo;
import com.iformall.mapper.InvestTaskDao;
import com.iformall.service.MallUserInfoService;
import com.iformall.service.WxShopService;
import com.iformall.service.invest.InvestHelper;
import com.iformall.service.invest.InvestTaskService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
@@ -29,7 +27,7 @@ import java.util.stream.Collectors;


@Service
public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTaskEntity> implements InvestTaskService {
public class InvestTaskServiceImpl extends InvestBaseService<InvestTaskDao, InvestTaskEntity> implements InvestTaskService {

@Autowired
private WxShopService shopService;
@@ -38,8 +36,8 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask

@Override
public InvestPageResult<InvestTaskVo> queryPage(InvestPageQuery<InvestTaskEntity> params) {
InvestHelper.checkAllNotNull(params);
Page queryPage = InvestHelper.buildQueryPage(params);
checkAllNotNull(params);
Page queryPage = buildQueryPage(params);
//1、任务信息
InvestTaskEntity queryTask = params.getQueryData();
LambdaQueryWrapper<InvestTaskEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask);
@@ -94,9 +92,7 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask
@Deprecated
@Override
public boolean saveOrUpdate(InvestTaskEntity entity) {
//checkBeforeSaveOrUpdate(entity);
//return super.saveOrUpdate(entity);
InvestHelper.notSupport();
notSupport();
return false ;
}

@@ -109,10 +105,10 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask


private void checkBeforeSaveOrUpdate(InvestTaskEntity entity) {
InvestHelper.checkAllNotNull(entity);
checkAllNotNull(entity);
// 1 check shop 状态
InvestHelper.checkShop(shopService, entity);
checkShop(shopService, entity);
// 2 check user
InvestHelper.checkUserExit(userInfoService, entity.getOwner());
checkUserExit(userInfoService, entity.getOwner());
}
}

Loading…
Cancel
Save