| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.controller.invest; | package com.iformall.controller.invest; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.InvestResultData; | import com.iformall.common.InvestResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -7,18 +8,17 @@ import com.iformall.domain.vo.invest.InvestUserContext; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import java.util.function.Function; | |||||
| @Slf4j | @Slf4j | ||||
| public class InvestBaseController extends BaseController { | 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 { | try { | ||||
| log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(params)); | |||||
| InvestUserContext.setUser(getUser()); | InvestUserContext.setUser(getUser()); | ||||
| E e = function.execute(params); | |||||
| return new InvestResultData(e); | |||||
| R r = function.apply(params); | |||||
| return new InvestResultData(r); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| log.error("execute error", e); | log.error("execute error", e); | ||||
| return new InvestResultData(e.getErrorCode(), e.getMessage()); | return new InvestResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.common; | package com.iformall.common; | ||||
| import org.springframework.util.ObjectUtils; | |||||
| import java.text.MessageFormat; | import java.text.MessageFormat; | ||||
| /** | /** | ||||
| @@ -524,7 +526,8 @@ public enum ErrorCode{ | |||||
| // 招商管理 53000 begin | // 招商管理 53000 begin | ||||
| INVEST_CUSTOMER_NOT_FOUND(53000, "客户信息不存在"), | INVEST_CUSTOMER_NOT_FOUND(53000, "客户信息不存在"), | ||||
| INVEST_UNKNOW_ERRROR(53000, "客户信息不存在"), | |||||
| INVEST_UNKNOW_ERRROR(53001, "客户信息不存在"), | |||||
| INVEST_DATA_NOT_FOUND(53002, "信息不存在"), | |||||
| // 招商管理 53999 end | // 招商管理 53999 end | ||||
| @@ -552,7 +555,8 @@ public enum ErrorCode{ | |||||
| if (param.length == 0) { | if (param.length == 0) { | ||||
| return message; | 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) { | public static ErrorCode getByCode(int code) { | ||||
| @@ -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) | @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true) | ||||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | @JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| @Version | @Version | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @@ -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) | @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true) | ||||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | @JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| @Version | @Version | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @@ -57,7 +57,6 @@ public class InvestOperateRecordEntity extends InvestBaseEntity { | |||||
| * 创建时间 | * 创建时间 | ||||
| */ | */ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate", example = "2018-10-01 12:18:48") | @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; | private Date createDate; | ||||
| @JsonIgnore | @JsonIgnore | ||||
| @@ -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) | @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate", example = "2018-10-01 12:18:48",readOnly = true) | ||||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | @JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||||
| @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
| @Version | @Version | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @@ -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); | |||||
| } | |||||
| } | |||||
| @@ -1,7 +1,6 @@ | |||||
| package com.iformall.service.invest.impl; | package com.iformall.service.invest.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.InvestCustomerEntity; | import com.iformall.domain.po.InvestCustomerEntity; | ||||
| @@ -13,7 +12,6 @@ import com.iformall.mapper.InvestCustomerDao; | |||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| import com.iformall.service.WxBusinessService; | import com.iformall.service.WxBusinessService; | ||||
| import com.iformall.service.invest.InvestCustomerService; | import com.iformall.service.invest.InvestCustomerService; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -21,7 +19,7 @@ import java.util.List; | |||||
| import java.util.Objects; | import java.util.Objects; | ||||
| @Service | @Service | ||||
| public class InvestCustomerServiceImpl extends ServiceImpl<InvestCustomerDao, InvestCustomerEntity> implements InvestCustomerService { | |||||
| public class InvestCustomerServiceImpl extends InvestBaseService<InvestCustomerDao, InvestCustomerEntity> implements InvestCustomerService { | |||||
| @Autowired | @Autowired | ||||
| private WxBrandService brandService; | private WxBrandService brandService; | ||||
| @@ -54,11 +52,7 @@ public class InvestCustomerServiceImpl extends ServiceImpl<InvestCustomerDao, In | |||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean saveOrUpdate(InvestCustomerEntity entity) { | public boolean saveOrUpdate(InvestCustomerEntity entity) { | ||||
| //checkBusiness(entity); | |||||
| //checkBrand(entity); | |||||
| //checkType(entity); | |||||
| //return super.saveOrUpdate(entity); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false ; | return false ; | ||||
| } | } | ||||
| @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.InvestCustomerEntity; | import com.iformall.domain.po.InvestCustomerEntity; | ||||
| import com.iformall.domain.po.InvestDemandEntity; | import com.iformall.domain.po.InvestDemandEntity; | ||||
| @@ -19,7 +18,6 @@ import com.iformall.service.WxBrandService; | |||||
| import com.iformall.service.WxShopService; | import com.iformall.service.WxShopService; | ||||
| import com.iformall.service.invest.InvestCustomerService; | import com.iformall.service.invest.InvestCustomerService; | ||||
| import com.iformall.service.invest.InvestDemandService; | import com.iformall.service.invest.InvestDemandService; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -30,7 +28,7 @@ import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, InvestDemandEntity> implements InvestDemandService { | |||||
| public class InvestDemandServiceImpl extends InvestBaseService<InvestDemandDao, InvestDemandEntity> implements InvestDemandService { | |||||
| @Autowired | @Autowired | ||||
| private WxShopService shopService; | private WxShopService shopService; | ||||
| @@ -43,8 +41,8 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| @Override | @Override | ||||
| public InvestPageResult<InvestDemandVo> queryPage(InvestPageQuery<InvestDemandEntity> params) { | 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<>(); | InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>(); | ||||
| //1、客户需求 | //1、客户需求 | ||||
| InvestDemandEntity queryTask = params.getQueryData(); | InvestDemandEntity queryTask = params.getQueryData(); | ||||
| @@ -54,6 +52,14 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| return investPage; | 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(); | List<InvestDemandEntity> demandList = demandPage.getRecords(); | ||||
| //2、客户信息 | //2、客户信息 | ||||
| Collection<InvestCustomerEntity> customers = customerService.listByIds(demandList | Collection<InvestCustomerEntity> customers = customerService.listByIds(demandList | ||||
| @@ -78,11 +84,7 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| } | } | ||||
| resultList.add(buildResultItem(item, customer, brand, shop)); | resultList.add(buildResultItem(item, customer, brand, shop)); | ||||
| } | } | ||||
| BeanUtils.copyProperties(demandPage, investPage); | |||||
| investPage.setRecords(resultList); | |||||
| investPage.setTotal(demandPage.getTotal()); | |||||
| return investPage; | |||||
| return resultList; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -97,8 +99,8 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| private boolean savaOrUpdateCustomerDemand(InvestDemandVo customerDemandVo) { | 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(); | InvestCustomerEntity customerEntity = new InvestCustomerEntity(); | ||||
| BeanUtils.copyProperties(customerDemandVo, customerEntity); | BeanUtils.copyProperties(customerDemandVo, customerEntity); | ||||
| customerService.saveOrUpdate(customerEntity); | customerService.saveOrUpdate(customerEntity); | ||||
| @@ -109,11 +111,11 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| @Override | @Override | ||||
| public InvestDemandVo findById(Long id) { | public InvestDemandVo findById(Long id) { | ||||
| InvestHelper.checkAllNotNull(id); | |||||
| checkAllNotNull(id); | |||||
| InvestDemandEntity demandEntity = this.getById(id); | InvestDemandEntity demandEntity = this.getById(id); | ||||
| InvestHelper.checkAllNotNull(demandEntity); | |||||
| checkAllNotNull(demandEntity); | |||||
| InvestCustomerEntity customerEntity = customerService.getById(demandEntity.getCustomerId()); | InvestCustomerEntity customerEntity = customerService.getById(demandEntity.getCustomerId()); | ||||
| InvestHelper.checkAllNotNull(customerEntity); | |||||
| checkAllNotNull(customerEntity); | |||||
| WxBrand brand = brandService.getById(customerEntity.getBrandId()); | WxBrand brand = brandService.getById(customerEntity.getBrandId()); | ||||
| WxShop shop = shopService.getById(demandEntity.getTargetId()); | WxShop shop = shopService.getById(demandEntity.getTargetId()); | ||||
| InvestDemandVo customerDemandVo = buildResultItem(demandEntity, customerEntity, brand, shop); | InvestDemandVo customerDemandVo = buildResultItem(demandEntity, customerEntity, brand, shop); | ||||
| @@ -147,9 +149,7 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean saveOrUpdate(InvestDemandEntity entity) { | public boolean saveOrUpdate(InvestDemandEntity entity) { | ||||
| //checkBeforeSaveOrUpdate(entity); | |||||
| //return super.saveOrUpdate(entity); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false ; | return false ; | ||||
| } | } | ||||
| @@ -161,9 +161,9 @@ public class InvestDemandServiceImpl extends ServiceImpl<InvestDemandDao, Invest | |||||
| } | } | ||||
| private void checkBeforeSaveOrUpdate(InvestDemandEntity entity) { | 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); | |||||
| } | } | ||||
| } | } | ||||
| @@ -4,20 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 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.ErrorCode; | ||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.InvestBaseEntity; | import com.iformall.domain.po.InvestBaseEntity; | ||||
| import com.iformall.domain.po.InvestFollowRecordEntity; | import com.iformall.domain.po.InvestFollowRecordEntity; | ||||
| 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.InvestUserContext; | |||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.InvestFollowRecordDao; | import com.iformall.mapper.InvestFollowRecordDao; | ||||
| import com.iformall.service.MallUserInfoService; | |||||
| import com.iformall.service.invest.InvestDemandService; | import com.iformall.service.invest.InvestDemandService; | ||||
| import com.iformall.service.invest.InvestFollowRecordService; | import com.iformall.service.invest.InvestFollowRecordService; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestTaskService; | import com.iformall.service.invest.InvestTaskService; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| @@ -27,19 +25,17 @@ import org.springframework.stereotype.Service; | |||||
| import java.util.Objects; | import java.util.Objects; | ||||
| @Service | @Service | ||||
| public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecordDao, InvestFollowRecordEntity> implements InvestFollowRecordService { | |||||
| public class InvestFollowRecordServiceImpl extends InvestBaseService<InvestFollowRecordDao, InvestFollowRecordEntity> implements InvestFollowRecordService { | |||||
| @Autowired | @Autowired | ||||
| private InvestDemandService demandService ; | private InvestDemandService demandService ; | ||||
| @Autowired | @Autowired | ||||
| private InvestTaskService taskService ; | private InvestTaskService taskService ; | ||||
| @Autowired | |||||
| private MallUserInfoService userInfoService; | |||||
| @Override | @Override | ||||
| public InvestPageResult<InvestFollowRecordEntity> queryPage(InvestPageQuery<InvestFollowRecordEntity> params) { | 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(); | InvestFollowRecordEntity queryTask = params.getQueryData(); | ||||
| LambdaQueryWrapper<InvestFollowRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask); | LambdaQueryWrapper<InvestFollowRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask); | ||||
| IPage<InvestFollowRecordEntity> records = this.page(page, queryWrapper); | IPage<InvestFollowRecordEntity> records = this.page(page, queryWrapper); | ||||
| @@ -62,32 +58,27 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor | |||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean update(InvestFollowRecordEntity entity, Wrapper<InvestFollowRecordEntity> updateWrapper) { | public boolean update(InvestFollowRecordEntity entity, Wrapper<InvestFollowRecordEntity> updateWrapper) { | ||||
| //checkBeforeSaveOrUpdate(entity); | |||||
| //return super.update(entity, updateWrapper); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean saveOrUpdate(InvestFollowRecordEntity entity) { | public boolean saveOrUpdate(InvestFollowRecordEntity entity) { | ||||
| //checkBeforeSaveOrUpdate(entity); | |||||
| //return super.saveOrUpdate(entity); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean updateById(InvestFollowRecordEntity entity) { | public boolean updateById(InvestFollowRecordEntity entity) { | ||||
| //checkBeforeSaveOrUpdate(entity); | |||||
| //return super.updateById(entity); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false; | return false; | ||||
| } | } | ||||
| private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { | private void checkBeforeSaveOrUpdate(InvestFollowRecordEntity entity) { | ||||
| InvestHelper.checkAllNotNull(entity); | |||||
| checkAllNotNull(entity); | |||||
| checkAllNotNull(InvestUserContext.getUserId()); | |||||
| InvestBaseEntity baseInvestEntity; | InvestBaseEntity baseInvestEntity; | ||||
| if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) { | if(Objects.equals(entity.getType(), EnumFollowType.DEMAND)) { | ||||
| baseInvestEntity = demandService.getById(entity.getFollowId()); | baseInvestEntity = demandService.getById(entity.getFollowId()); | ||||
| @@ -96,8 +87,7 @@ public class InvestFollowRecordServiceImpl extends ServiceImpl<InvestFollowRecor | |||||
| } else { | } else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | ||||
| } | } | ||||
| InvestHelper.checkAllNotNull(baseInvestEntity); | |||||
| checkAllNotNull(baseInvestEntity); | |||||
| InvestHelper.checkUserExit(userInfoService, entity.getOwner()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,23 +9,21 @@ import com.iformall.domain.po.InvestOperateRecordEntity; | |||||
| 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.mapper.InvestOperateRecordDao; | import com.iformall.mapper.InvestOperateRecordDao; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestOperateRecordService; | import com.iformall.service.invest.InvestOperateRecordService; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| @Service | @Service | ||||
| public class InvestOperateRecordServiceImpl extends ServiceImpl<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService { | |||||
| public class InvestOperateRecordServiceImpl extends InvestBaseService<InvestOperateRecordDao, InvestOperateRecordEntity> implements InvestOperateRecordService { | |||||
| @Override | @Override | ||||
| public InvestPageResult<InvestOperateRecordEntity> queryPage(InvestPageQuery<InvestOperateRecordEntity> params) { | public InvestPageResult<InvestOperateRecordEntity> queryPage(InvestPageQuery<InvestOperateRecordEntity> params) { | ||||
| InvestHelper.checkAllNotNull(params); | |||||
| checkAllNotNull(params); | |||||
| //1、分页信息 | //1、分页信息 | ||||
| Page queryPage = InvestHelper.buildQueryPage(params); | |||||
| Page queryPage = buildQueryPage(params); | |||||
| //2、查询数据 | //2、查询数据 | ||||
| InvestOperateRecordEntity queryParams = params.getQueryData(); | InvestOperateRecordEntity queryParams = params.getQueryData(); | ||||
| LambdaQueryWrapper<InvestOperateRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | LambdaQueryWrapper<InvestOperateRecordEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | ||||
| @@ -11,29 +11,27 @@ import com.iformall.domain.vo.invest.InvestPageResult; | |||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.mapper.InvestRemindDao; | import com.iformall.mapper.InvestRemindDao; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestRemindService; | import com.iformall.service.invest.InvestRemindService; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| @Service | @Service | ||||
| public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, InvestRemindEntity> implements InvestRemindService { | |||||
| public class InvestRemindServiceImpl extends InvestBaseService<InvestRemindDao, InvestRemindEntity> implements InvestRemindService { | |||||
| @Autowired | @Autowired | ||||
| private MallUserInfoService userInfoService; | private MallUserInfoService userInfoService; | ||||
| @Override | @Override | ||||
| public InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params) { | public InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params) { | ||||
| InvestHelper.checkAllNotNull(params); | |||||
| checkAllNotNull(params); | |||||
| //1、分页信息 | //1、分页信息 | ||||
| Page queryPage = InvestHelper.buildQueryPage(params); | |||||
| Page queryPage = buildQueryPage(params); | |||||
| //2、查询数据 | //2、查询数据 | ||||
| InvestRemindEntity queryParams = params.getQueryData(); | InvestRemindEntity queryParams = params.getQueryData(); | ||||
| InvestHelper.checkUserExit(userInfoService, InvestUserContext.getUserId()); | |||||
| checkUserExit(userInfoService, InvestUserContext.getUserId()); | |||||
| LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | LambdaQueryWrapper<InvestRemindEntity> queryWrapper = new LambdaQueryWrapper<>(queryParams); | ||||
| IPage<InvestRemindEntity> taskPage = this.page(queryPage, queryWrapper); | IPage<InvestRemindEntity> taskPage = this.page(queryPage, queryWrapper); | ||||
| @@ -74,9 +72,8 @@ public class InvestRemindServiceImpl extends ServiceImpl<InvestRemindDao, Invest | |||||
| } | } | ||||
| private void checkBeforeSaveOrUpdate(InvestRemindEntity input) { | private void checkBeforeSaveOrUpdate(InvestRemindEntity input) { | ||||
| InvestHelper.checkAllNotNull(input); | |||||
| InvestHelper.checkAllNotNull(InvestUserContext.getUser()); | |||||
| checkAllNotNull(input); | |||||
| checkAllNotNull(InvestUserContext.getUser()); | |||||
| input.setOwner(InvestUserContext.getUserId()); | input.setOwner(InvestUserContext.getUserId()); | ||||
| input.setTenantId(InvestUserContext.getUser().getTenantId()); | input.setTenantId(InvestUserContext.getUser().getTenantId()); | ||||
| } | } | ||||
| @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.InvestTaskEntity; | import com.iformall.domain.po.InvestTaskEntity; | ||||
| import com.iformall.domain.po.WxShop; | 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.mapper.InvestTaskDao; | ||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import com.iformall.service.WxShopService; | import com.iformall.service.WxShopService; | ||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestTaskService; | import com.iformall.service.invest.InvestTaskService; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
| @@ -29,7 +27,7 @@ import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTaskEntity> implements InvestTaskService { | |||||
| public class InvestTaskServiceImpl extends InvestBaseService<InvestTaskDao, InvestTaskEntity> implements InvestTaskService { | |||||
| @Autowired | @Autowired | ||||
| private WxShopService shopService; | private WxShopService shopService; | ||||
| @@ -38,8 +36,8 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||||
| @Override | @Override | ||||
| public InvestPageResult<InvestTaskVo> queryPage(InvestPageQuery<InvestTaskEntity> params) { | public InvestPageResult<InvestTaskVo> queryPage(InvestPageQuery<InvestTaskEntity> params) { | ||||
| InvestHelper.checkAllNotNull(params); | |||||
| Page queryPage = InvestHelper.buildQueryPage(params); | |||||
| checkAllNotNull(params); | |||||
| Page queryPage = buildQueryPage(params); | |||||
| //1、任务信息 | //1、任务信息 | ||||
| InvestTaskEntity queryTask = params.getQueryData(); | InvestTaskEntity queryTask = params.getQueryData(); | ||||
| LambdaQueryWrapper<InvestTaskEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask); | LambdaQueryWrapper<InvestTaskEntity> queryWrapper = new LambdaQueryWrapper<>(queryTask); | ||||
| @@ -94,9 +92,7 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||||
| @Deprecated | @Deprecated | ||||
| @Override | @Override | ||||
| public boolean saveOrUpdate(InvestTaskEntity entity) { | public boolean saveOrUpdate(InvestTaskEntity entity) { | ||||
| //checkBeforeSaveOrUpdate(entity); | |||||
| //return super.saveOrUpdate(entity); | |||||
| InvestHelper.notSupport(); | |||||
| notSupport(); | |||||
| return false ; | return false ; | ||||
| } | } | ||||
| @@ -109,10 +105,10 @@ public class InvestTaskServiceImpl extends ServiceImpl<InvestTaskDao, InvestTask | |||||
| private void checkBeforeSaveOrUpdate(InvestTaskEntity entity) { | private void checkBeforeSaveOrUpdate(InvestTaskEntity entity) { | ||||
| InvestHelper.checkAllNotNull(entity); | |||||
| checkAllNotNull(entity); | |||||
| // 1 check shop 状态 | // 1 check shop 状态 | ||||
| InvestHelper.checkShop(shopService, entity); | |||||
| checkShop(shopService, entity); | |||||
| // 2 check user | // 2 check user | ||||
| InvestHelper.checkUserExit(userInfoService, entity.getOwner()); | |||||
| checkUserExit(userInfoService, entity.getOwner()); | |||||
| } | } | ||||
| } | } | ||||