|
|
|
@@ -6,13 +6,14 @@ 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.po.InvestTaskEntity; |
|
|
|
import com.iformall.domain.vo.invest.InvestPageQuery; |
|
|
|
import com.iformall.domain.vo.invest.InvestPageResult; |
|
|
|
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; |
|
|
|
@@ -32,6 +33,8 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor |
|
|
|
private InvestDemandService demandService ; |
|
|
|
@Autowired |
|
|
|
private InvestTaskService taskService ; |
|
|
|
@Autowired |
|
|
|
private MallUserInfoService userInfoService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params) { |
|
|
|
@@ -48,35 +51,43 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor |
|
|
|
@TableLog |
|
|
|
@Override |
|
|
|
public boolean save(InvestFollowRecordEntity entity) { |
|
|
|
checkBeforeSaveOrUpdate(entity); |
|
|
|
return super.save(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@TableLog |
|
|
|
@Override |
|
|
|
public boolean update(InvestFollowRecordEntity entity, Wrapper<InvestFollowRecordEntity> updateWrapper) { |
|
|
|
checkBeforeSaveOrUpdate(entity); |
|
|
|
return super.update(entity, updateWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@TableLog |
|
|
|
@Override |
|
|
|
public boolean saveOrUpdate(InvestFollowRecordEntity entity) { |
|
|
|
checkBeforeSaveOrUpdate(entity); |
|
|
|
return super.saveOrUpdate(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@TableLog |
|
|
|
@Override |
|
|
|
public boolean updateById(InvestFollowRecordEntity entity) { |
|
|
|
checkBeforeSaveOrUpdate(entity); |
|
|
|
return super.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { |
|
|
|
InvestHelper.checkAllNotNull(entity); |
|
|
|
InvestBaseEntity baseInvestEntity; |
|
|
|
if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) { |
|
|
|
|
|
|
|
baseInvestEntity = demandService.getById(entity.getFollowId()); |
|
|
|
} else if(Objects.equals(entity.getType(), EnumFollowType.TASK)) { |
|
|
|
|
|
|
|
baseInvestEntity = taskService.getById(entity.getFollowId()); |
|
|
|
} else { |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL) ; |
|
|
|
} |
|
|
|
InvestHelper.checkAllNotNull(baseInvestEntity); |
|
|
|
|
|
|
|
InvestHelper.checkUserExit(userInfoService, entity.getOwner()); |
|
|
|
} |
|
|
|
} |