From 5bf271bdaee169546ec97e583cd049160bbfc756 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 06 Aug 2020 17:52:52 +0800 Subject: [PATCH] 20200806 代码提交 --- src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java | 3 - src/main/resources/i18n/messages_zh_CN.properties | 2 + src/main/resources/mapper/documentary/FollowFollowerNoticeDao.xml | 14 ++++++ src/main/java/com/xcong/excoin/modules/documentary/vo/FollowFollowerNoticeVo.java | 5 ++ src/main/java/com/xcong/excoin/modules/documentary/dto/FollowFollowerNoticeDto.java | 20 ++++++++++ src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java | 8 ++++ src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 7 ++- src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 4 + src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 31 +++++++++++---- src/main/resources/mapper/documentary/FollowTraderInfoDao.xml | 2 src/main/resources/i18n/messages_en_US.properties | 2 + 11 files changed, 81 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java index 5958455..2d734e4 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java @@ -14,6 +14,7 @@ import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto; +import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto; import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto; import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto; import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; @@ -65,8 +66,8 @@ @ApiOperation(value="通知消息", notes="通知消息") @ApiResponses({@ApiResponse( code = 200, message = "success", response = FollowFollowerNoticeVo.class)}) @PostMapping(value = "/getFollowFollowerNoticeList") - public Result getFollowFollowerNoticeList() { - return documentaryService.getFollowFollowerNoticeList(); + public Result getFollowFollowerNoticeList(@RequestBody @Valid FollowFollowerNoticeDto followFollowerNoticeDto) { + return documentaryService.getFollowFollowerNoticeList(followFollowerNoticeDto); } /** @@ -164,7 +165,7 @@ } /** - * 跟单---跟单设置 + * 跟单---跟单设置--新增跟单 */ @ApiOperation(value="跟单---跟单设置--新增跟单", notes="跟单---跟单设置--新增跟单") @PostMapping(value = "/addDocumentaryOrderSet") diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java index 84d87b7..2a58ee4 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerNoticeDao.java @@ -1,10 +1,18 @@ package com.xcong.excoin.modules.documentary.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.xcong.excoin.modules.documentary.entity.FollowFollowerNoticeEntity; + +import org.apache.ibatis.annotations.Param; + /** * @author helius */ public interface FollowFollowerNoticeDao extends BaseMapper<FollowFollowerNoticeEntity> { + + IPage<FollowFollowerNoticeEntity> selectFollowFollowerNoticePage(Page<FollowFollowerNoticeEntity> page, + @Param("record")FollowFollowerNoticeEntity followFollowerNoticeEntity); } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java index 93904e6..cd26af6 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderInfoDao.java @@ -2,8 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; - -import io.lettuce.core.dynamic.annotation.Param; +import org.apache.ibatis.annotations.Param; public interface FollowTraderInfoDao extends BaseMapper<FollowTraderInfoEntity> { diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowFollowerNoticeDto.java b/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowFollowerNoticeDto.java new file mode 100644 index 0000000..1b3318f --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowFollowerNoticeDto.java @@ -0,0 +1,20 @@ +package com.xcong.excoin.modules.documentary.dto; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +@Data +@ApiModel(value = "FollowFollowerNoticeDto", description = "参数接受类") +public class FollowFollowerNoticeDto { + @NotNull + @Min(1) + @ApiModelProperty(value = "第几页", example = "1") + private int pageNum; + + @NotNull + @ApiModelProperty(value = "每页数量", example = "10") + private int pageSize; +} diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java index 10237e3..859dc6a 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java @@ -7,6 +7,7 @@ import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto; +import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto; import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto; import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto; import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; @@ -66,6 +67,7 @@ public Result getOutFollowInfo(@Valid OutFollowInfoDto outFollowInfoDto); - public Result getFollowFollowerNoticeList(); + public Result getFollowFollowerNoticeList(@Valid FollowFollowerNoticeDto followFollowerNoticeDto); + } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java index 8180bf1..5a23cb7 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java @@ -35,6 +35,7 @@ import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao; import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto; +import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto; import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto; import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto; import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; @@ -455,7 +456,7 @@ FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId); if (traderInfoEntity != null) { - return Result.fail("交易员不能进行跟单"); + return Result.fail(MessageSourceUtils.getString("documentary_service_0014")); } FollowFollowerSettingEntity isExistSetting = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId, traderId); @@ -649,6 +650,14 @@ List<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectByMap(columnMaps); if(CollUtil.isNotEmpty(followFollowerProfitEntitys)) { return Result.fail(MessageSourceUtils.getString("documentary_service_0015")); + } + + //合约不能持仓 + Map<String, Object> contractHoldColumnMap = new HashMap<>(); + contractHoldColumnMap.put("member_id", memberId); + List<ContractHoldOrderEntity> contractHoldOrderEntitys = contractHoldOrderDao.selectByMap(contractHoldColumnMap); + if(CollUtil.isNotEmpty(contractHoldOrderEntitys)) { + return Result.fail(MessageSourceUtils.getString("documentary_service_0013")); } Map<String, Object> columnMap = new HashMap<>(); @@ -997,21 +1006,25 @@ } @Override - public Result getFollowFollowerNoticeList() { + public Result getFollowFollowerNoticeList(FollowFollowerNoticeDto followFollowerNoticeDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); List<FollowFollowerNoticeVo> arrayList = new ArrayList<>(); - Map<String, Object> columnMap = new HashMap<>(); - columnMap.put("member_id", memberId); - List<FollowFollowerNoticeEntity> selectByMap = followFollowerNoticeDao.selectByMap(columnMap ); - if(CollUtil.isNotEmpty(selectByMap)) { - for(FollowFollowerNoticeEntity followFollowerNoticeEntity : selectByMap) { + Page<FollowFollowerNoticeEntity> page = new Page<>(followFollowerNoticeDto.getPageNum(), followFollowerNoticeDto.getPageSize()); + FollowFollowerNoticeEntity followFollowerNoticeEntity = new FollowFollowerNoticeEntity(); + followFollowerNoticeEntity.setMemberId(memberId); + IPage<FollowFollowerNoticeEntity> followFollowerNoticelist = followFollowerNoticeDao.selectFollowFollowerNoticePage(page, followFollowerNoticeEntity); + List<FollowFollowerNoticeEntity> records = followFollowerNoticelist.getRecords(); + if(CollUtil.isNotEmpty(records)) { + for(FollowFollowerNoticeEntity followFollowerNotice : records) { FollowFollowerNoticeVo followFollowerNoticeVo = new FollowFollowerNoticeVo(); - String title = followFollowerNoticeEntity.getTitle(); + String title = followFollowerNotice.getTitle(); followFollowerNoticeVo.setTitle(title); - String content = followFollowerNoticeEntity.getContent(); + String content = followFollowerNotice.getContent(); followFollowerNoticeVo.setContent(content); + Date createTime = followFollowerNotice.getCreateTime(); + followFollowerNoticeVo.setCreateTime(createTime); arrayList.add(followFollowerNoticeVo); } } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowFollowerNoticeVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowFollowerNoticeVo.java index e878081..042a3bf 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowFollowerNoticeVo.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowFollowerNoticeVo.java @@ -1,5 +1,7 @@ package com.xcong.excoin.modules.documentary.vo; +import java.util.Date; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,6 +10,9 @@ @ApiModel(value = "FollowFollowerNoticeVo", description = "返回值") public class FollowFollowerNoticeVo { + @ApiModelProperty("时间") + private Date createTime; + @ApiModelProperty("标题") private String title; diff --git a/src/main/resources/i18n/messages_en_US.properties b/src/main/resources/i18n/messages_en_US.properties index 5bac87c..1a11b2a 100644 --- a/src/main/resources/i18n/messages_en_US.properties +++ b/src/main/resources/i18n/messages_en_US.properties @@ -223,6 +223,8 @@ home_service_0013=Modification succeeded, please log in home_service_0014=The mobile number does not exist, please register and log in +documentary_service_0013=Please close the position after applying +documentary_service_0014=The current status cannot be followed documentary_service_0015=Please cancel and apply again uploadFile_controller_0001=Upload failed diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties index 65bc4c5..bbb1439 100644 --- a/src/main/resources/i18n/messages_zh_CN.properties +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -223,6 +223,8 @@ home_service_0013=修改成功,请登录 home_service_0014=不存在该手机号码,请进行注册登录 +documentary_service_0013=请平仓后,在申请 +documentary_service_0014=当前状态不能进行跟单 documentary_service_0015=当前有跟单,请取消再申请 uploadFile_controller_0001=上传失败 diff --git a/src/main/resources/mapper/documentary/FollowFollowerNoticeDao.xml b/src/main/resources/mapper/documentary/FollowFollowerNoticeDao.xml index 1e5097c..793374b 100644 --- a/src/main/resources/mapper/documentary/FollowFollowerNoticeDao.xml +++ b/src/main/resources/mapper/documentary/FollowFollowerNoticeDao.xml @@ -1,5 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowFollowerNoticeDao"> - + <select id="selectFollowFollowerNoticePage" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerNoticeEntity"> + select + * + from follow_follower_notice + <if test="record != null"> + <where> + <if test="record.memberId != null" > + and member_id=#{record.memberId} + </if> + </where> + </if> + order by create_time desc + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml b/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml index 4b32266..58e2101 100644 --- a/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml +++ b/src/main/resources/mapper/documentary/FollowTraderInfoDao.xml @@ -8,7 +8,7 @@ <select id="selectTraderInfoByMemberId" resultType="com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity"> - select * from follow_trader_info where member_id=#{memberId} + select * from follow_trader_info where member_id=#{memberId} and verify_status in (1,3) </select> -- Gitblit v1.9.1