diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java index 6022b4af4..a141571a5 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestBaseController.java @@ -5,10 +5,7 @@ import com.iformall.common.ErrorCode; import com.iformall.common.InvestResultData; import com.iformall.controller.base.BaseController; 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.service.invest.InvestHelper; import lombok.extern.slf4j.Slf4j; @@ -30,6 +27,7 @@ public class InvestBaseController extends BaseController { registerEnumEditor(dataBinder, EnumCustomerRatingType.class, "customerRatingType") ; registerEnumEditor(dataBinder, EnumTaskStatus.class, "taskStatus") ; registerEnumEditor(dataBinder, EnumFollowType.class, "type") ; + registerEnumEditor(dataBinder, EnumRemindDateType.class, "dateType") ; } public InvestResultData execute(T params, Function function) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java index 6be4f75cd..0def385d1 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestCustomerController.java @@ -44,8 +44,8 @@ public class InvestCustomerController extends InvestBaseController{ @ApiOperation("客户信息列表") @SystemControllerLog(description = "客户信息列表") @GetMapping("/list/simple") - public InvestResultData> list(InvestPageQuery params) { - return execute(params, p -> investCustomerService.queryPage(p)); + public InvestResultData> listSimple(InvestDemandQuery params) { + return execute(params, p -> investBizService.queryPageDemand(p)); } /** diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestMessageController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestMessageController.java new file mode 100755 index 000000000..37f340baa --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestMessageController.java @@ -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 + * @email + * @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> list(InvestMessageQuery params) { + return execute(params, p -> bizService.queryPageMessage(p)); + } + + + /** + * 信息 + */ + @SystemServiceLog + @GetMapping("/info/{id}") + public InvestResultData 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()); + } + +} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java index e5ba087d5..8987ac499 100755 --- a/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/invest/InvestRemindController.java @@ -5,6 +5,7 @@ import com.iformall.common.InvestResultData; import com.iformall.domain.po.invest.InvestRemindEntity; import com.iformall.domain.vo.invest.InvestPageQuery; import com.iformall.domain.vo.invest.InvestPageResult; +import com.iformall.domain.vo.invest.InvestRemindQuery; import com.iformall.domain.vo.invest.InvestRemindVo; import com.iformall.service.invest.InvestBizService; import com.iformall.service.invest.InvestRemindService; @@ -43,7 +44,7 @@ public class InvestRemindController extends InvestBaseController { @SystemServiceLog @ApiOperation("分页列表接口") @GetMapping("/list") - public InvestResultData> list(InvestPageQuery params) { + public InvestResultData> list(InvestRemindQuery params) { return execute(params, p -> bizService.queryPageRemind(p)); } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java index 68c25d5c9..68580c1cb 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestDemandEntity.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.Version; import com.fasterxml.jackson.annotation.JsonProperty; import com.iformall.common.LogColumn; -import com.iformall.domain.po.invest.InvestBaseEntity; import com.iformall.enums.EnumInvestType; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestMessageEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestMessageEntity.java new file mode 100755 index 000000000..4092e23d1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestMessageEntity.java @@ -0,0 +1,31 @@ +package com.iformall.domain.po.invest; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 招商任务 + * + * @author + * @email + * @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; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java index f3d23e067..d9edb8df0 100755 --- a/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/invest/InvestTaskEntity.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.Version; import com.fasterxml.jackson.annotation.JsonProperty; -import com.iformall.domain.po.invest.InvestBaseEntity; import com.iformall.enums.EnumInvestType; import com.iformall.enums.EnumTaskStatus; import lombok.Data; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestMessageQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestMessageQuery.java new file mode 100644 index 000000000..cade23000 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestMessageQuery.java @@ -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; + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindQuery.java b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindQuery.java new file mode 100644 index 000000000..e6b5c7269 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/invest/InvestRemindQuery.java @@ -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; + +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRemindDateType.java b/mallinkService/src/main/java/com/iformall/enums/EnumRemindDateType.java new file mode 100644 index 000000000..51bef7a5f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRemindDateType.java @@ -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; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/InvestMessageDao.java b/mallinkService/src/main/java/com/iformall/mapper/InvestMessageDao.java new file mode 100755 index 000000000..10478dcaa --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/InvestMessageDao.java @@ -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 + * @email + * @date 2019-09-23 18:40:43 + */ +@Mapper +public interface InvestMessageDao extends BaseMapper { + +} diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java index 8bebe9e95..8699bf32f 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestBizService.java @@ -2,7 +2,7 @@ package com.iformall.service.invest; import com.iformall.domain.dto.InvestDemandDto; 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 java.util.Collection; @@ -15,7 +15,9 @@ public interface InvestBizService { InvestPageResult queryPageFollowRecord(InvestFollowQuery params); - InvestPageResult queryPageRemind(InvestPageQuery params); + InvestPageResult queryPageRemind(InvestRemindQuery params); + + InvestPageResult queryPageMessage(InvestMessageQuery params) ; Collection queryUserList() ; diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestMessageService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestMessageService.java new file mode 100755 index 000000000..3fa4c2fcc --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestMessageService.java @@ -0,0 +1,16 @@ +package com.iformall.service.invest; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.iformall.domain.po.invest.InvestMessageEntity; + +/** + * 招商任务 + * + * @author + * @email + * @date 2019-09-23 18:40:43 + */ +public interface InvestMessageService extends IService,InvestBaseService { + boolean removeAll() ; +} + diff --git a/mallinkService/src/main/java/com/iformall/service/invest/InvestRemindService.java b/mallinkService/src/main/java/com/iformall/service/invest/InvestRemindService.java index 528945552..e25a8ece7 100755 --- a/mallinkService/src/main/java/com/iformall/service/invest/InvestRemindService.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/InvestRemindService.java @@ -14,7 +14,7 @@ import com.iformall.domain.vo.invest.InvestPageResult; */ public interface InvestRemindService extends IService,InvestBaseService { - InvestPageResult queryPage(InvestPageQuery params); + //InvestPageResult queryPage(InvestPageQuery params); boolean removeAll() ; } diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java index e63bdf5be..4c20f1cc7 100644 --- a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestBizServiceImpl.java @@ -43,6 +43,8 @@ public class InvestBizServiceImpl implements InvestBizService { @Autowired private InvestRemindService remindService; @Autowired + private InvestMessageService messageService; + @Autowired private WxShopService shopService; @Autowired private InvestCustomerService customerService; @@ -207,10 +209,15 @@ public class InvestBizServiceImpl implements InvestBizService { } @Override - public InvestPageResult queryPageRemind(InvestPageQuery params) { + public InvestPageResult queryPageRemind(InvestRemindQuery params) { InvestHelper.notNull(params); InvestPageResult investPage = new InvestPageResult<>(); - InvestPageResult recordPage = remindService.queryPage(params); + InvestPageQuery remindPageQuery = new InvestPageQuery<>(); + BeanUtils.copyProperties(params, remindPageQuery); + InvestRemindEntity remindQuery = new InvestRemindEntity(); + remindQuery.setOwner(params.getOwnerId()); + remindPageQuery.setQueryData(remindQuery); + InvestPageResult recordPage = remindService.queryPage(remindPageQuery); if (CollectionUtils.isEmpty(recordPage.getRecords())) { return investPage; } @@ -244,6 +251,17 @@ public class InvestBizServiceImpl implements InvestBizService { return investPage; } + @Override + public InvestPageResult queryPageMessage(InvestMessageQuery params) { + InvestHelper.notNull(params); + InvestPageQuery 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 wrapper, String tbl, Long tId) { if (ObjectUtils.allNotNull(tbl, tId)) { wrapper.eq(InvestOperateRecordEntity::getTbl, tbl); @@ -272,7 +290,7 @@ public class InvestBizServiceImpl implements InvestBizService { @Override public boolean saveCustomerAndDemand(InvestDemandDto demandDto) { 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)) { customerEntityDB = demandDto.getCustomer(); customerService.save(customerEntityDB); diff --git a/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestMessageServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestMessageServiceImpl.java new file mode 100755 index 000000000..f1963b4d1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/invest/impl/InvestMessageServiceImpl.java @@ -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 implements InvestMessageService { + + @TableLog + @Override + public boolean save(InvestMessageEntity entity) { + return super.saveAction(entity, this::checkBeforeSaveOrUpdate); + } + + @TableLog + @Override + public boolean update(InvestMessageEntity entity, Wrapper 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 updateWrapper) { + notSupport(); + return false; + } + + @Override + public boolean removeAll() { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(InvestMessageEntity::getTenantId, InvestUserContext.getUser().getTenantId()); + wrapper.eq(InvestMessageEntity::getOwner, InvestUserContext.getUserId()); + return super.remove(wrapper); + } +}