| @@ -3,9 +3,14 @@ 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.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 lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -35,10 +40,17 @@ public class InvestOperateRecordController { | |||
| */ | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("/list") | |||
| public ResultData list(InvestPageQuery<InvestOperateRecordEntity> params){ | |||
| List page = investOperateRecordService.queryPage(params); | |||
| return new ResultData(page); | |||
| public InvestResultData<InvestPageResult<InvestOperateRecordEntity>> list(InvestPageQuery<InvestOperateRecordEntity> params) { | |||
| try { | |||
| InvestPageResult<InvestOperateRecordEntity> page = investOperateRecordService.queryPage(params); | |||
| return new InvestResultData(page); | |||
| } catch (MallinkException e) { | |||
| log.error("list error", e); | |||
| return new InvestResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| log.error("list error", e); | |||
| return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| } | |||
| @@ -3,9 +3,14 @@ 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.domain.po.InvestOperateRecordEntity; | |||
| import com.iformall.domain.po.InvestRemindEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.invest.InvestRemindService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -36,10 +41,17 @@ public class InvestRemindController { | |||
| */ | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("/list") | |||
| public ResultData list(InvestPageQuery<InvestRemindEntity> params){ | |||
| List page = investRemindService.queryPage(params); | |||
| return new ResultData(page); | |||
| public InvestResultData<InvestPageResult<InvestRemindEntity>> list(InvestPageQuery<InvestRemindEntity> params) { | |||
| try { | |||
| InvestPageResult<InvestRemindEntity> page = investRemindService.queryPage(params); | |||
| return new InvestResultData(page); | |||
| } catch (MallinkException e) { | |||
| log.error("list error", e); | |||
| return new InvestResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| log.error("list error", e); | |||
| return new InvestResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| } | |||
| @@ -33,16 +33,4 @@ public class InvestRemindEntity extends InvestBaseEntity { | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "提醒时间", name = "minute") | |||
| private Long minute; | |||
| /** | |||
| * 开始时间 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "开始时间", name = "beginDate", example = "2018-10-01 12:18:48") | |||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
| private Date beginDate; | |||
| /** | |||
| * 结束时间 | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "结束时间", name = "endDate", example = "2018-10-01 12:18:48") | |||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
| private Date endDate; | |||
| } | |||
| @@ -3,8 +3,7 @@ package com.iformall.service.invest; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import com.iformall.domain.po.InvestOperateRecordEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import java.util.List; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| /** | |||
| * 操作记录 | |||
| @@ -15,6 +14,6 @@ import java.util.List; | |||
| */ | |||
| public interface InvestOperateRecordService extends IService<InvestOperateRecordEntity> { | |||
| List queryPage(InvestPageQuery<InvestOperateRecordEntity> params); | |||
| InvestPageResult<InvestOperateRecordEntity> queryPage(InvestPageQuery<InvestOperateRecordEntity> params); | |||
| } | |||
| @@ -3,9 +3,7 @@ package com.iformall.service.invest; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import com.iformall.domain.po.InvestRemindEntity; | |||
| import com.iformall.domain.vo.invest.InvestPageQuery; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||
| /** | |||
| * 招商提醒 | |||
| @@ -16,6 +14,6 @@ import java.util.Map; | |||
| */ | |||
| public interface InvestRemindService extends IService<InvestRemindEntity> { | |||
| List queryPage(InvestPageQuery<InvestRemindEntity> params); | |||
| InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params); | |||
| } | |||
| @@ -85,18 +85,16 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||
| @Override | |||
| public boolean saveCustomerAndDemand(InvestDemandVo customerDemandVo) { | |||
| savaOrUpdateCustomerDemand(customerDemandVo); | |||
| return true; | |||
| return savaOrUpdateCustomerDemand(customerDemandVo); | |||
| } | |||
| @Override | |||
| public boolean updateCustomerAndDemand(InvestDemandVo customerDemandVo) { | |||
| savaOrUpdateCustomerDemand(customerDemandVo); | |||
| return true; | |||
| return savaOrUpdateCustomerDemand(customerDemandVo); | |||
| } | |||
| private void savaOrUpdateCustomerDemand(InvestDemandVo customerDemandVo) { | |||
| private boolean savaOrUpdateCustomerDemand(InvestDemandVo customerDemandVo) { | |||
| InvestHelper.checkAllNotNull(customerDemandVo); | |||
| InvestHelper.checkAllNotNull(customerDemandVo.getBrand(), customerDemandVo.getCustomer()); | |||
| InvestCustomerEntity customerEntity = new InvestCustomerEntity(); | |||
| @@ -104,7 +102,7 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||
| customerService.saveOrUpdate(customerEntity); | |||
| InvestDemandEntity demandEntity = new InvestDemandEntity(); | |||
| BeanUtils.copyProperties(customerDemandVo, demandEntity); | |||
| this.saveOrUpdate(demandEntity); | |||
| return this.saveOrUpdate(demandEntity); | |||
| } | |||
| @Override | |||
| @@ -18,6 +18,7 @@ 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; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -40,10 +41,14 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor | |||
| public InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params) { | |||
| InvestHelper.checkAllNotNull(params); | |||
| Page page = InvestHelper.buildQueryPage(params); | |||
| InvestPageResult<InvestFollowRecordEntity> investPage = new InvestPageResult<>(); | |||
| InvestFollowRecordEntity queryTask = params.getQueryData(); | |||
| LambdaQueryWrapper<InvestFollowRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask); | |||
| IPage<InvestFollowRecordEntity> records = this.page(page,queryWrapper) ; | |||
| IPage<InvestFollowRecordEntity> records = this.page(page, queryWrapper); | |||
| InvestPageResult<InvestFollowRecordEntity> investPage = new InvestPageResult<>(); | |||
| if (CollectionUtils.isEmpty(records.getRecords())) { | |||
| return investPage; | |||
| } | |||
| BeanUtils.copyProperties(records, investPage); | |||
| return investPage; | |||
| } | |||
| @@ -55,25 +60,31 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor | |||
| return super.save(entity); | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean update(InvestFollowRecordEntity entity, Wrapper<InvestFollowRecordEntity> updateWrapper) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| //checkBeforeSaveOrUpdate(entity); | |||
| //return super.update(entity, updateWrapper); | |||
| notSupport(); | |||
| return false; | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean saveOrUpdate(InvestFollowRecordEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.saveOrUpdate(entity); | |||
| //checkBeforeSaveOrUpdate(entity); | |||
| //return super.saveOrUpdate(entity); | |||
| notSupport(); | |||
| return false; | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean updateById(InvestFollowRecordEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| //checkBeforeSaveOrUpdate(entity); | |||
| //return super.updateById(entity); | |||
| notSupport(); | |||
| return false; | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { | |||
| @@ -90,4 +101,8 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor | |||
| InvestHelper.checkUserExit(userInfoService, entity.getOwner()); | |||
| } | |||
| private void notSupport() { | |||
| throw new MallinkException(ErrorCode.SYS_METHOD_NOT_SUPPORT); | |||
| } | |||
| } | |||
| @@ -1,14 +1,20 @@ | |||
| package com.iformall.service.invest.impl; | |||
| 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.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 java.util.List; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| @@ -16,8 +22,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| public class InvestOperateRecordServiceImpl extends ServiceImpl<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService { | |||
| @Override | |||
| public List queryPage(InvestPageQuery<InvestOperateRecordEntity> params) { | |||
| return this.list() ; | |||
| public InvestPageResult<InvestOperateRecordEntity> queryPage(InvestPageQuery<InvestOperateRecordEntity> params) { | |||
| InvestHelper.checkAllNotNull(params); | |||
| //1、分页信息 | |||
| Page queryPage = InvestHelper.buildQueryPage(params); | |||
| //2、查询数据 | |||
| InvestOperateRecordEntity queryParams = params.getQueryData(); | |||
| LambdaQueryWrapper<InvestOperateRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | |||
| IPage<InvestOperateRecordEntity> taskPage = this.page(queryPage, queryWrapper); | |||
| InvestPageResult<InvestOperateRecordEntity> investPage = new InvestPageResult<>(); | |||
| if (CollectionUtils.isEmpty(taskPage.getRecords())) { | |||
| return investPage; | |||
| } | |||
| BeanUtils.copyProperties(taskPage, investPage); | |||
| return investPage; | |||
| } | |||
| @TableLog | |||
| @@ -26,19 +45,19 @@ public class InvestOperateRecordServiceImpl extends ServiceImpl<InvestOperateRec | |||
| return super.save(entity); | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean update(InvestOperateRecordEntity entity, Wrapper<InvestOperateRecordEntity> updateWrapper) { | |||
| return super.update(entity, updateWrapper); | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean saveOrUpdate(InvestOperateRecordEntity entity) { | |||
| return super.saveOrUpdate(entity); | |||
| } | |||
| @TableLog | |||
| @Deprecated | |||
| @Override | |||
| public boolean updateById(InvestOperateRecordEntity entity) { | |||
| return super.updateById(entity); | |||
| @@ -1,46 +1,79 @@ | |||
| package com.iformall.service.invest.impl; | |||
| 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; | |||
| 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 java.util.List; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| @Service | |||
| public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, InvestRemindEntity> implements InvestRemindService { | |||
| @Autowired | |||
| private MallUserInfoService userInfoService; | |||
| @Override | |||
| public List queryPage(InvestPageQuery<InvestRemindEntity> params) { | |||
| return this.list() ; | |||
| public InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params) { | |||
| InvestHelper.checkAllNotNull(params); | |||
| //1、分页信息 | |||
| Page queryPage = InvestHelper.buildQueryPage(params); | |||
| //2、查询数据 | |||
| InvestRemindEntity queryParams = params.getQueryData(); | |||
| InvestHelper.checkUserExit(userInfoService, queryParams.getOwner()); | |||
| LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | |||
| IPage<InvestRemindEntity> taskPage = this.page(queryPage, queryWrapper); | |||
| InvestPageResult<InvestRemindEntity> investPage = new InvestPageResult<>(); | |||
| if (CollectionUtils.isEmpty(taskPage.getRecords())) { | |||
| return investPage; | |||
| } | |||
| BeanUtils.copyProperties(taskPage, investPage); | |||
| return investPage; | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean save(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestRemindEntity entity, Wrapper<InvestRemindEntity> updateWrapper) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean saveOrUpdate(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.saveOrUpdate(entity); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestRemindEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| } | |||
| private void checkBeforeSaveOrUpdate(InvestRemindEntity input) { | |||
| InvestHelper.checkAllNotNull(input); | |||
| InvestHelper.checkUserExit(userInfoService, input.getOwner()); | |||
| } | |||
| } | |||
| @@ -2,9 +2,7 @@ package com.iformall.service.invest.impl; | |||
| 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.metadata.IPage; | |||
| import com.baomidou.mybatisplus.core.toolkit.LambdaUtils; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import com.iformall.common.TableLog; | |||
| import com.iformall.domain.po.*; | |||
| @@ -80,14 +78,12 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||
| @Override | |||
| public boolean save(InvestTaskEntity entity) { | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.save(entity); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestTaskEntity entity, Wrapper<InvestTaskEntity> updateWrapper) { | |||
| // 1 check shop 状态 | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.update(entity, updateWrapper); | |||
| } | |||
| @@ -95,7 +91,6 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||
| @TableLog | |||
| @Override | |||
| public boolean saveOrUpdate(InvestTaskEntity entity) { | |||
| // 1 check shop 状态 | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.saveOrUpdate(entity); | |||
| } | |||
| @@ -103,7 +98,6 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||
| @TableLog | |||
| @Override | |||
| public boolean updateById(InvestTaskEntity entity) { | |||
| // 1 check shop 状态 | |||
| checkBeforeSaveOrUpdate(entity); | |||
| return super.updateById(entity); | |||
| } | |||