| @@ -1,7 +1,5 @@ | |||
| package com.iformall.controller.invest; | |||
| import java.util.Arrays; | |||
| import com.iformall.annotation.SystemServiceLog; | |||
| import com.iformall.common.InvestResultData; | |||
| import com.iformall.domain.po.InvestDemandEntity; | |||
| @@ -9,11 +7,13 @@ 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.InvestDemandService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Arrays; | |||
| /** | |||
| @@ -1,21 +1,17 @@ | |||
| package com.iformall.controller.invest; | |||
| import java.util.Arrays; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.InvestResultData; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.InvestFollowRecordEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.invest.InvestFollowRecordService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Arrays; | |||
| @@ -1,23 +1,17 @@ | |||
| package com.iformall.controller.invest; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.InvestResultData; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.InvestOperateRecordEntity; | |||
| import com.iformall.domain.vo.invest.InvestDemandVo; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.invest.InvestOperateRecordService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Arrays; | |||
| @@ -1,17 +1,17 @@ | |||
| package com.iformall.controller.invest; | |||
| import java.util.Arrays; | |||
| import com.iformall.common.InvestResultData; | |||
| import com.iformall.domain.po.InvestRemindEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| import com.iformall.service.invest.InvestRemindService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Arrays; | |||
| @@ -1,7 +1,5 @@ | |||
| package com.iformall.controller.invest; | |||
| import java.util.Arrays; | |||
| import com.iformall.annotation.SystemServiceLog; | |||
| import com.iformall.common.InvestResultData; | |||
| import com.iformall.domain.po.InvestTaskEntity; | |||
| @@ -9,11 +7,13 @@ import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| import com.iformall.domain.vo.invest.InvestTaskVo; | |||
| import com.iformall.service.invest.InvestTaskService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.Arrays; | |||
| @@ -2,12 +2,15 @@ package com.iformall.service.invest.impl; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| 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.*; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestUserContext; | |||
| import com.iformall.enums.EnumInvestType; | |||
| import com.iformall.enums.EnumShopStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -20,6 +23,7 @@ import org.apache.commons.lang3.ObjectUtils; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| import java.util.Objects; | |||
| import java.util.function.Consumer; | |||
| import java.util.stream.Collectors; | |||
| public class InvestBaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> { | |||
| @@ -31,6 +35,37 @@ public class InvestBaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M | |||
| return t; | |||
| } | |||
| @TableLog | |||
| public boolean saveAction(T entity, Consumer<T> consumer) { | |||
| checkUserAndTenant(entity,consumer); | |||
| return super.save(entity); | |||
| } | |||
| @TableLog | |||
| public boolean updateActon(T entity, Wrapper<T> updateWrapper,Consumer<T> consumer) { | |||
| checkUserAndTenant(entity,consumer); | |||
| return super.update(entity, updateWrapper); | |||
| } | |||
| @TableLog | |||
| public boolean saveOrUpdateAction(T entity,Consumer<T> consumer) { | |||
| checkUserAndTenant(entity,consumer); | |||
| return super.saveOrUpdate(entity); | |||
| } | |||
| @TableLog | |||
| public boolean updateByIdAction(T entity,Consumer<T> consumer) { | |||
| checkUserAndTenant(entity,consumer); | |||
| return super.updateById(entity); | |||
| } | |||
| void checkUserAndTenant(T input,Consumer<T> consumer) { | |||
| checkAllNotNull(input); | |||
| checkAllNotNull(InvestUserContext.getUser()); | |||
| ((InvestBaseEntity) input).setTenantId(InvestUserContext.getUser().getTenantId()); | |||
| consumer.accept(input); | |||
| } | |||
| /** | |||
| * 校验商铺 | |||
| * | |||
| @@ -34,19 +34,12 @@ public class InvestCustomerServiceImpl extends InvestBaseService<InvestCustomerD | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestCustomerEntity entity) { | |||
| checkBusiness(entity); | |||
| checkBrand(entity); | |||
| checkType(entity); | |||
| return super.save(entity); | |||
| return super.saveAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestCustomerEntity entity, Wrapper<InvestCustomerEntity> updateWrapper) { | |||
| checkBusiness(entity); | |||
| checkBrand(entity); | |||
| checkType(entity); | |||
| return super.update(entity, updateWrapper); | |||
| return super.updateActon(entity, updateWrapper,input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @Deprecated | |||
| @@ -56,15 +49,18 @@ public class InvestCustomerServiceImpl extends InvestBaseService<InvestCustomerD | |||
| return false ; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestCustomerEntity entity) { | |||
| checkBusiness(entity); | |||
| checkBrand(entity); | |||
| checkType(entity); | |||
| return super.updateById(entity); | |||
| return super.updateByIdAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestCustomerEntity entity) { | |||
| checkBusiness(entity); | |||
| checkBrand(entity); | |||
| checkType(entity); | |||
| } | |||
| private void checkBusiness(InvestCustomerEntity entity) { | |||
| WxBusiness business = businessService.getById(entity.getBusinessId()) ; | |||
| if (Objects.isNull(business)) { | |||
| @@ -1,10 +1,10 @@ | |||
| package com.iformall.service.invest.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| 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.iformall.common.TableLog; | |||
| import com.iformall.domain.po.InvestCustomerEntity; | |||
| import com.iformall.domain.po.InvestDemandEntity; | |||
| import com.iformall.domain.po.WxBrand; | |||
| @@ -132,18 +132,14 @@ public class InvestDemandServiceImpl extends InvestBaseService<InvestDemandDao, | |||
| return resultItemVo; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestDemandEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| return super.saveAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestDemandEntity entity, Wrapper<InvestDemandEntity> updateWrapper) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| return super.updateActon(entity, updateWrapper,input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @Deprecated | |||
| @@ -153,17 +149,18 @@ public class InvestDemandServiceImpl extends InvestBaseService<InvestDemandDao, | |||
| return false ; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestDemandEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| return super.updateByIdAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestDemandEntity entity) { | |||
| checkCustomerExit(customerService, entity.getCustomerId()); | |||
| checkUserExit(userInfoService, entity.getOwner()); | |||
| checkShop(shopService, entity); | |||
| if(Objects.nonNull(entity.getIntent())) { | |||
| entity.setIntent(JSON.toJSONString(entity.getIntent())); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,11 +1,11 @@ | |||
| package com.iformall.service.invest.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| 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.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; | |||
| @@ -48,11 +48,9 @@ public class InvestFollowRecordServiceImpl extends InvestBaseService<InvestFollo | |||
| return investPage; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestFollowRecordEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| return super.saveAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @Deprecated | |||
| @@ -89,5 +87,8 @@ public class InvestFollowRecordServiceImpl extends InvestBaseService<InvestFollo | |||
| } | |||
| checkAllNotNull(baseInvestEntity); | |||
| if(Objects.nonNull(entity.getContent())) { | |||
| entity.setContent(JSON.toJSONString(entity.getContent())); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,10 +1,10 @@ | |||
| package com.iformall.service.invest.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| 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.iformall.common.TableLog; | |||
| import com.iformall.domain.po.InvestRemindEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| @@ -17,6 +17,8 @@ import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.Objects; | |||
| @Service | |||
| public class InvestRemindServiceImpl extends InvestBaseService<InvestRemindDao, InvestRemindEntity> implements InvestRemindService { | |||
| @@ -43,38 +45,30 @@ public class InvestRemindServiceImpl extends InvestBaseService<InvestRemindDao, | |||
| return investPage; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| return super.saveAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestRemindEntity entity, Wrapper<InvestRemindEntity> updateWrapper) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| return super.updateActon(entity, updateWrapper, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean saveOrUpdate(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.saveOrUpdate(entity); | |||
| return super.saveOrUpdateAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| return super.updateByIdAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestRemindEntity input) { | |||
| checkAllNotNull(input); | |||
| checkAllNotNull(InvestUserContext.getUser()); | |||
| input.setOwner(InvestUserContext.getUserId()); | |||
| input.setTenantId(InvestUserContext.getUser().getTenantId()); | |||
| if (Objects.nonNull(input.getContent())) { | |||
| input.setContent(JSON.toJSONString(input.getContent())); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,10 +1,10 @@ | |||
| package com.iformall.service.invest.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| 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.iformall.common.TableLog; | |||
| import com.iformall.domain.po.InvestTaskEntity; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| @@ -19,10 +19,7 @@ import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.Collection; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @@ -75,18 +72,14 @@ public class InvestTaskServiceImpl extends InvestBaseService<InvestTaskDao, Inve | |||
| return resultItemVo; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestTaskEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| return super.saveAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestTaskEntity entity, Wrapper<InvestTaskEntity> updateWrapper) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| return super.updateActon(entity, updateWrapper, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| @Deprecated | |||
| @@ -96,19 +89,22 @@ public class InvestTaskServiceImpl extends InvestBaseService<InvestTaskDao, Inve | |||
| return false ; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestTaskEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| return super.updateByIdAction(entity, input -> checkBeforeSaveOrUpdate(input)); | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestTaskEntity entity) { | |||
| checkAllNotNull(entity); | |||
| // 1 check shop 状态 | |||
| checkShop(shopService, entity); | |||
| // 2 check user | |||
| checkUserExit(userInfoService, entity.getOwner()); | |||
| if (Objects.nonNull(entity.getOwner())) { | |||
| entity.setOwner(JSON.toJSONString(entity.getOwner())); | |||
| } | |||
| if (Objects.nonNull(entity.getContent())) { | |||
| entity.setContent(JSON.toJSONString(entity.getContent())); | |||
| } | |||
| } | |||
| } | |||