| @@ -5,10 +5,7 @@ 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; | ||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.enums.EnumCustomerRatingType; | |||||
| import com.iformall.enums.EnumCustomerType; | |||||
| import com.iformall.enums.EnumFollowType; | |||||
| import com.iformall.enums.EnumTaskStatus; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.invest.InvestHelper; | import com.iformall.service.invest.InvestHelper; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| @@ -30,6 +27,7 @@ public class InvestBaseController extends BaseController { | |||||
| registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ; | registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ; | ||||
| registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ; | registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ; | ||||
| registerEnumEditor(dataBinder, EnumFollowType.class, "type") ; | registerEnumEditor(dataBinder, EnumFollowType.class, "type") ; | ||||
| registerEnumEditor(dataBinder, EnumRemindDateType.class, "dateType") ; | |||||
| } | } | ||||
| public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) { | public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) { | ||||
| @@ -44,8 +44,8 @@ public class InvestCustomerController extends InvestBaseController{ | |||||
| @ApiOperation("客户信息列表") | @ApiOperation("客户信息列表") | ||||
| @SystemControllerLog(description = "客户信息列表") | @SystemControllerLog(description = "客户信息列表") | ||||
| @GetMapping("/list/simple") | @GetMapping("/list/simple") | ||||
| public InvestResultData<InvestPageResult<InvestCustomerEntity>> list(InvestPageQuery<InvestCustomerEntity> params) { | |||||
| return execute(params, p -> investCustomerService.queryPage(p)); | |||||
| public InvestResultData<InvestPageResult<InvestDemandVo>> listSimple(InvestDemandQuery params) { | |||||
| return execute(params, p -> investBizService.queryPageDemand(p)); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -0,0 +1,93 @@ | |||||
| package com.iformall.controller.invest; | |||||
| import com.iformall.annotation.SystemServiceLog; | |||||
| import com.iformall.common.InvestResultData; | |||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | |||||
| import com.iformall.domain.vo.invest.InvestMessageQuery; | |||||
| import com.iformall.domain.vo.invest.InvestPageResult; | |||||
| import com.iformall.service.invest.InvestBizService; | |||||
| import com.iformall.service.invest.InvestMessageService; | |||||
| 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 java.util.Arrays; | |||||
| /** | |||||
| * 招商模块-消息提醒 | |||||
| * | |||||
| * @author | |||||
| * @date 2019-09-23 18:40:43 | |||||
| */ | |||||
| @Slf4j | |||||
| @RestController | |||||
| @RequestMapping("invest/message") | |||||
| @Api(tags = "招商模块-消息提醒") | |||||
| public class InvestMessageController extends InvestBaseController { | |||||
| @Autowired | |||||
| private InvestMessageService investRemindService; | |||||
| @Autowired | |||||
| private InvestBizService bizService; | |||||
| /** | |||||
| * 分页列表 | |||||
| */ | |||||
| @SystemServiceLog | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("/list") | |||||
| public InvestResultData<InvestPageResult<InvestMessageEntity>> list(InvestMessageQuery params) { | |||||
| return execute(params, p -> bizService.queryPageMessage(p)); | |||||
| } | |||||
| /** | |||||
| * 信息 | |||||
| */ | |||||
| @SystemServiceLog | |||||
| @GetMapping("/info/{id}") | |||||
| public InvestResultData<InvestMessageEntity> info(@PathVariable("id") Long id) { | |||||
| return execute(id, p -> investRemindService.getByIdNotNull(p)); | |||||
| } | |||||
| /** | |||||
| * 保存 | |||||
| */ | |||||
| //@RequiresPermissions("investFollowRecordEdit") | |||||
| @SystemServiceLog | |||||
| //@PostMapping("/save") | |||||
| public InvestResultData save(@RequestBody InvestMessageEntity messageEntity) { | |||||
| return execute(messageEntity, p -> investRemindService.save(p)); | |||||
| } | |||||
| /** | |||||
| * 修改 | |||||
| */ | |||||
| @SystemServiceLog | |||||
| //@PostMapping("/update") | |||||
| public InvestResultData update(@RequestBody InvestMessageEntity messageEntity) { | |||||
| return execute(messageEntity, p -> investRemindService.updateById(p)); | |||||
| } | |||||
| /** | |||||
| * 删除 | |||||
| */ | |||||
| @SystemServiceLog | |||||
| @PostMapping("/delete") | |||||
| public InvestResultData delete(@RequestBody Long[] ids) { | |||||
| return execute(ids, p -> investRemindService.removeByIds(Arrays.asList(p))); | |||||
| } | |||||
| /** | |||||
| * 删除登录用户全部提醒 | |||||
| */ | |||||
| @SystemServiceLog | |||||
| @PostMapping("/deleteAll") | |||||
| public InvestResultData deleteAll() { | |||||
| return execute(null, p -> investRemindService.removeAll()); | |||||
| } | |||||
| } | |||||
| @@ -5,6 +5,7 @@ import com.iformall.common.InvestResultData; | |||||
| import com.iformall.domain.po.invest.InvestRemindEntity; | import com.iformall.domain.po.invest.InvestRemindEntity; | ||||
| 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.InvestRemindQuery; | |||||
| import com.iformall.domain.vo.invest.InvestRemindVo; | import com.iformall.domain.vo.invest.InvestRemindVo; | ||||
| import com.iformall.service.invest.InvestBizService; | import com.iformall.service.invest.InvestBizService; | ||||
| import com.iformall.service.invest.InvestRemindService; | import com.iformall.service.invest.InvestRemindService; | ||||
| @@ -43,7 +44,7 @@ public class InvestRemindController extends InvestBaseController { | |||||
| @SystemServiceLog | @SystemServiceLog | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("/list") | @GetMapping("/list") | ||||
| public InvestResultData<InvestPageResult<InvestRemindVo>> list(InvestPageQuery<InvestRemindEntity> params) { | |||||
| public InvestResultData<InvestPageResult<InvestRemindVo>> list(InvestRemindQuery params) { | |||||
| return execute(params, p -> bizService.queryPageRemind(p)); | return execute(params, p -> bizService.queryPageRemind(p)); | ||||
| } | } | ||||
| @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.baomidou.mybatisplus.annotation.Version; | import com.baomidou.mybatisplus.annotation.Version; | ||||
| import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.JsonProperty; | ||||
| import com.iformall.common.LogColumn; | import com.iformall.common.LogColumn; | ||||
| import com.iformall.domain.po.invest.InvestBaseEntity; | |||||
| import com.iformall.enums.EnumInvestType; | import com.iformall.enums.EnumInvestType; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -0,0 +1,31 @@ | |||||
| package com.iformall.domain.po.invest; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| /** | |||||
| * 招商任务 | |||||
| * | |||||
| * @author | |||||
| * @date 2019-09-24 14:48:11 | |||||
| */ | |||||
| @Data | |||||
| @TableName("invest_message") | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class InvestMessageEntity extends InvestBaseEntity { | |||||
| /** | |||||
| * 用户 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "用户", name = "owner") | |||||
| private Long owner; | |||||
| /** | |||||
| * 消息内容 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "消息内容", name = "message") | |||||
| private String message; | |||||
| } | |||||
| @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.baomidou.mybatisplus.annotation.Version; | import com.baomidou.mybatisplus.annotation.Version; | ||||
| import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.JsonProperty; | ||||
| import com.iformall.domain.po.invest.InvestBaseEntity; | |||||
| import com.iformall.enums.EnumInvestType; | import com.iformall.enums.EnumInvestType; | ||||
| import com.iformall.enums.EnumTaskStatus; | import com.iformall.enums.EnumTaskStatus; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo.invest; | |||||
| import lombok.Data; | |||||
| @Data | |||||
| public class InvestMessageQuery extends InvestPageQuery { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "用户", name = "owner") | |||||
| private Long owner; | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.domain.vo.invest; | |||||
| import com.iformall.enums.EnumRemindDateType; | |||||
| import lombok.Data; | |||||
| @Data | |||||
| public class InvestRemindQuery extends InvestPageQuery { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "用户", name = "ownerId") | |||||
| private Long ownerId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "预约时间", name = "dateType") | |||||
| private EnumRemindDateType dateType; | |||||
| } | |||||
| @@ -0,0 +1,42 @@ | |||||
| package com.iformall.enums; | |||||
| import com.baomidou.mybatisplus.annotation.EnumValue; | |||||
| import com.fasterxml.jackson.annotation.JsonValue; | |||||
| /** | |||||
| * | |||||
| */ | |||||
| public enum EnumRemindDateType { | |||||
| TODAY(0, "今天"), | |||||
| THREE(1, "近三天"), | |||||
| WEEK(2, "近一周"), | |||||
| MONTH(3, "近一个月"), | |||||
| ; | |||||
| public static EnumRemindDateType getEnum(Integer code) { | |||||
| for (EnumRemindDateType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| @EnumValue | |||||
| private final Integer code; | |||||
| private final String info; | |||||
| EnumRemindDateType(Integer code, String info) { | |||||
| this.code = code; | |||||
| this.info = info; | |||||
| } | |||||
| @JsonValue | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getInfo() { | |||||
| return info; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | |||||
| import org.apache.ibatis.annotations.Mapper; | |||||
| /** | |||||
| * 客户列表 | |||||
| * | |||||
| * @author | |||||
| * @date 2019-09-23 18:40:43 | |||||
| */ | |||||
| @Mapper | |||||
| public interface InvestMessageDao extends BaseMapper<InvestMessageEntity> { | |||||
| } | |||||
| @@ -2,7 +2,7 @@ package com.iformall.service.invest; | |||||
| import com.iformall.domain.dto.InvestDemandDto; | import com.iformall.domain.dto.InvestDemandDto; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.invest.InvestRemindEntity; | |||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | |||||
| import com.iformall.domain.vo.invest.*; | import com.iformall.domain.vo.invest.*; | ||||
| import java.util.Collection; | import java.util.Collection; | ||||
| @@ -15,7 +15,9 @@ public interface InvestBizService { | |||||
| InvestPageResult<InvestFollowRecordVo> queryPageFollowRecord(InvestFollowQuery params); | InvestPageResult<InvestFollowRecordVo> queryPageFollowRecord(InvestFollowQuery params); | ||||
| InvestPageResult<InvestRemindVo> queryPageRemind(InvestPageQuery<InvestRemindEntity> params); | |||||
| InvestPageResult<InvestRemindVo> queryPageRemind(InvestRemindQuery params); | |||||
| InvestPageResult<InvestMessageEntity> queryPageMessage(InvestMessageQuery params) ; | |||||
| Collection<MallUserInfo> queryUserList() ; | Collection<MallUserInfo> queryUserList() ; | ||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.service.invest; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | |||||
| /** | |||||
| * 招商任务 | |||||
| * | |||||
| * @author | |||||
| * @date 2019-09-23 18:40:43 | |||||
| */ | |||||
| public interface InvestMessageService extends IService<InvestMessageEntity>,InvestBaseService<InvestMessageEntity> { | |||||
| boolean removeAll() ; | |||||
| } | |||||
| @@ -14,7 +14,7 @@ import com.iformall.domain.vo.invest.InvestPageResult; | |||||
| */ | */ | ||||
| public interface InvestRemindService extends IService<InvestRemindEntity>,InvestBaseService<InvestRemindEntity> { | public interface InvestRemindService extends IService<InvestRemindEntity>,InvestBaseService<InvestRemindEntity> { | ||||
| InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params); | |||||
| //InvestPageResult<InvestRemindEntity> queryPage(InvestPageQuery<InvestRemindEntity> params); | |||||
| boolean removeAll() ; | boolean removeAll() ; | ||||
| } | } | ||||
| @@ -43,6 +43,8 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Autowired | @Autowired | ||||
| private InvestRemindService remindService; | private InvestRemindService remindService; | ||||
| @Autowired | @Autowired | ||||
| private InvestMessageService messageService; | |||||
| @Autowired | |||||
| private WxShopService shopService; | private WxShopService shopService; | ||||
| @Autowired | @Autowired | ||||
| private InvestCustomerService customerService; | private InvestCustomerService customerService; | ||||
| @@ -207,10 +209,15 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public InvestPageResult<InvestRemindVo> queryPageRemind(InvestPageQuery<InvestRemindEntity> params) { | |||||
| public InvestPageResult<InvestRemindVo> queryPageRemind(InvestRemindQuery params) { | |||||
| InvestHelper.notNull(params); | InvestHelper.notNull(params); | ||||
| InvestPageResult<InvestRemindVo> investPage = new InvestPageResult<>(); | InvestPageResult<InvestRemindVo> investPage = new InvestPageResult<>(); | ||||
| InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(params); | |||||
| InvestPageQuery<InvestRemindEntity> remindPageQuery = new InvestPageQuery<>(); | |||||
| BeanUtils.copyProperties(params, remindPageQuery); | |||||
| InvestRemindEntity remindQuery = new InvestRemindEntity(); | |||||
| remindQuery.setOwner(params.getOwnerId()); | |||||
| remindPageQuery.setQueryData(remindQuery); | |||||
| InvestPageResult<InvestRemindEntity> recordPage = remindService.queryPage(remindPageQuery); | |||||
| if (CollectionUtils.isEmpty(recordPage.getRecords())) { | if (CollectionUtils.isEmpty(recordPage.getRecords())) { | ||||
| return investPage; | return investPage; | ||||
| } | } | ||||
| @@ -244,6 +251,17 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| return investPage; | return investPage; | ||||
| } | } | ||||
| @Override | |||||
| public InvestPageResult<InvestMessageEntity> queryPageMessage(InvestMessageQuery params) { | |||||
| InvestHelper.notNull(params); | |||||
| InvestPageQuery<InvestMessageEntity> query = new InvestPageQuery<>(); | |||||
| BeanUtils.copyProperties(params, query); | |||||
| InvestMessageEntity messageEntity = new InvestMessageEntity(); | |||||
| messageEntity.setOwner(InvestUserContext.getUserId()); | |||||
| query.setQueryData(messageEntity); | |||||
| return messageService.queryPage(query); | |||||
| } | |||||
| private void buildQueryWrapper(LambdaQueryWrapper<InvestOperateRecordEntity> wrapper, String tbl, Long tId) { | private void buildQueryWrapper(LambdaQueryWrapper<InvestOperateRecordEntity> wrapper, String tbl, Long tId) { | ||||
| if (ObjectUtils.allNotNull(tbl, tId)) { | if (ObjectUtils.allNotNull(tbl, tId)) { | ||||
| wrapper.eq(InvestOperateRecordEntity::getTbl, tbl); | wrapper.eq(InvestOperateRecordEntity::getTbl, tbl); | ||||
| @@ -272,7 +290,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Override | @Override | ||||
| public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { | public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { | ||||
| InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); | InvestHelper.notNull(demandDto, demandDto.getCustomer(), demandDto.getDemand()); | ||||
| InvestCustomerEntity customerEntityDB = customerService.getById(demandDto.getCustomer().getId()); | |||||
| InvestCustomerEntity customerEntityDB = customerService.getByIdNotNull(demandDto.getCustomer().getId()); | |||||
| if (Objects.isNull(customerEntityDB)) { | if (Objects.isNull(customerEntityDB)) { | ||||
| customerEntityDB = demandDto.getCustomer(); | customerEntityDB = demandDto.getCustomer(); | ||||
| customerService.save(customerEntityDB); | customerService.save(customerEntityDB); | ||||
| @@ -0,0 +1,61 @@ | |||||
| package com.iformall.service.invest.impl; | |||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
| import com.iformall.common.TableLog; | |||||
| import com.iformall.domain.po.invest.InvestMessageEntity; | |||||
| import com.iformall.domain.vo.invest.InvestUserContext; | |||||
| import com.iformall.mapper.InvestMessageDao; | |||||
| import com.iformall.service.invest.InvestHelper; | |||||
| import com.iformall.service.invest.InvestMessageService; | |||||
| import org.springframework.stereotype.Service; | |||||
| @Service | |||||
| public class InvestMessageServiceImpl extends InvestBaseServiceImpl<InvestMessageDao, InvestMessageEntity> implements InvestMessageService { | |||||
| @TableLog | |||||
| @Override | |||||
| public boolean save(InvestMessageEntity entity) { | |||||
| return super.saveAction(entity, this::checkBeforeSaveOrUpdate); | |||||
| } | |||||
| @TableLog | |||||
| @Override | |||||
| public boolean update(InvestMessageEntity entity, Wrapper<InvestMessageEntity> updateWrapper) { | |||||
| return super.updateActon(entity, updateWrapper, this::checkBeforeSaveOrUpdate); | |||||
| } | |||||
| @TableLog | |||||
| @Override | |||||
| public boolean updateById(InvestMessageEntity entity) { | |||||
| return super.updateByIdAction(entity, this::checkBeforeSaveOrUpdate); | |||||
| } | |||||
| private void checkBeforeSaveOrUpdate(InvestMessageEntity entity) { | |||||
| InvestHelper.notNull(entity, entity.getMessage(), entity.getOwner()); | |||||
| } | |||||
| @Deprecated | |||||
| @Override | |||||
| public boolean saveOrUpdate(InvestMessageEntity entity) { | |||||
| notSupport(); | |||||
| return false; | |||||
| } | |||||
| @Deprecated | |||||
| @Override | |||||
| public boolean update(Wrapper<InvestMessageEntity> updateWrapper) { | |||||
| notSupport(); | |||||
| return false; | |||||
| } | |||||
| @Override | |||||
| public boolean removeAll() { | |||||
| LambdaUpdateWrapper<InvestMessageEntity> wrapper = new LambdaUpdateWrapper<>(); | |||||
| wrapper.eq(InvestMessageEntity::getTenantId, InvestUserContext.getUser().getTenantId()); | |||||
| wrapper.eq(InvestMessageEntity::getOwner, InvestUserContext.getUserId()); | |||||
| return super.remove(wrapper); | |||||
| } | |||||
| } | |||||