-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from Dapp-Learning-DAO/feature/aaron_sharing
merge Feature/aaron sharing
- Loading branch information
Showing
28 changed files
with
727 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/dl/officialsite/common/base/PagedList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.dl.officialsite.common.base; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class PagedList<T>{ | ||
|
||
private List<T> data; | ||
|
||
private Pagination pagination; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/dl/officialsite/common/base/Pagination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.dl.officialsite.common.base; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class Pagination { | ||
} |
72 changes: 72 additions & 0 deletions
72
src/main/java/com/dl/officialsite/sharing/controller/SharingManagementController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.dl.officialsite.sharing.controller; | ||
|
||
import com.dl.officialsite.common.base.BaseResponse; | ||
import com.dl.officialsite.sharing.model.req.CreateSessionRoomReq; | ||
import com.dl.officialsite.sharing.model.req.GenerateSharingDataReq; | ||
import com.dl.officialsite.sharing.model.resp.CreateMeetingRoomResp; | ||
import com.dl.officialsite.sharing.model.resp.GenerateSharingDataResp; | ||
import com.dl.officialsite.sharing.model.resp.QueryMeetingResp; | ||
import com.dl.officialsite.sharing.service.ISharingManagementService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("share/v1/management") | ||
@Slf4j | ||
public class SharingManagementController { | ||
|
||
@Autowired | ||
private ISharingManagementService service; | ||
|
||
/** | ||
* 分享锁定之后,修改人就不能修改。这功能是避免做好海报之后,分享人又改内容,导致海报同分享不一致场景 | ||
*/ | ||
@PostMapping("lock") | ||
public BaseResponse lockSharing(long shareId){ | ||
this.service.lockSharing(shareId); | ||
return BaseResponse.success(); | ||
} | ||
|
||
/** | ||
* 解锁。特别情况下,分享人临时改内容。 | ||
* @param shareId | ||
*/ | ||
@PostMapping("unlock") | ||
public BaseResponse unlockSharing(long shareId){ | ||
this.service.unlockSharing(shareId); | ||
return BaseResponse.success(); | ||
} | ||
|
||
|
||
/** | ||
* 创建session room | ||
* @param req | ||
* @return | ||
*/ | ||
@PostMapping("meeting/creation") | ||
public BaseResponse<CreateMeetingRoomResp> createSessionRoom(CreateSessionRoomReq req){ | ||
CreateMeetingRoomResp resp = this.service.createSessionRoom(req); | ||
return BaseResponse.successWithData(resp); | ||
} | ||
|
||
@PostMapping("meeting/query") | ||
public BaseResponse<QueryMeetingResp> createSessionRoom(long shareId){ | ||
QueryMeetingResp resp = this.service.queryMeeting(shareId); | ||
return BaseResponse.successWithData(resp); | ||
} | ||
|
||
|
||
/** | ||
* 生成分享海报、文案 | ||
* @param req | ||
* @return | ||
*/ | ||
@PostMapping("view") | ||
public BaseResponse<GenerateSharingDataResp> viewSharingData(GenerateSharingDataReq req){ | ||
GenerateSharingDataResp resp = this.service.viewSharingData(req); | ||
return BaseResponse.successWithData(resp); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/dl/officialsite/sharing/controller/SharingRewardController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.dl.officialsite.sharing.controller; | ||
|
||
import com.dl.officialsite.common.base.BaseResponse; | ||
import com.dl.officialsite.sharing.model.resp.ClaimSharingRewardResp; | ||
import com.dl.officialsite.sharing.model.resp.PreCheckSharingRewardResp; | ||
import com.dl.officialsite.sharing.service.IRewardService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("share/v1/reward") | ||
@Slf4j | ||
public class SharingRewardController { | ||
|
||
@Autowired | ||
private IRewardService rewardService; | ||
/** | ||
* 预先查看分享奖励信息供分享人确认 | ||
* @param sharingId | ||
* @return | ||
*/ | ||
@GetMapping("precheck") | ||
public BaseResponse<PreCheckSharingRewardResp> preCheckSharingReward(long sharingId){ | ||
return BaseResponse.successWithData(this.rewardService.preCheckSharingReward(sharingId)); | ||
} | ||
|
||
/** | ||
* 领取奖励 | ||
* @param sharingId | ||
* @return | ||
*/ | ||
@GetMapping("claim") | ||
public BaseResponse<ClaimSharingRewardResp> claimSharingReward(long sharingId){ | ||
return BaseResponse.successWithData(this.rewardService.claimSharingReward(sharingId)); | ||
} | ||
|
||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/com/dl/officialsite/sharing/controller/UserSharingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.dl.officialsite.sharing.controller; | ||
|
||
import com.dl.officialsite.common.base.BaseResponse; | ||
import com.dl.officialsite.sharing.model.pojo.SharingPojo; | ||
import com.dl.officialsite.sharing.model.req.CreateSharingReq; | ||
import com.dl.officialsite.sharing.model.req.UpdateSharingReq; | ||
import com.dl.officialsite.sharing.model.resp.AllSharingResp; | ||
import com.dl.officialsite.sharing.model.resp.ClaimSharingRewardResp; | ||
import com.dl.officialsite.sharing.model.resp.PreCheckSharingRewardResp; | ||
import com.dl.officialsite.sharing.model.resp.SharingByUserResp; | ||
import com.dl.officialsite.sharing.service.IUserSharingService; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("share/v1/usershare") | ||
@Slf4j | ||
public class UserSharingController { | ||
|
||
@Autowired | ||
private IUserSharingService userSharingService; | ||
|
||
//————————————————————————————————————分享人相关功能———————————————————————————————————— | ||
/** | ||
* 创建分享 | ||
* @param req | ||
* @return | ||
*/ | ||
@PostMapping("create") | ||
public BaseResponse<Long> createSharing(CreateSharingReq req){ | ||
return BaseResponse.successWithData(this.userSharingService.createSharing(req)); | ||
} | ||
|
||
/** | ||
* 修改分享 | ||
*/ | ||
@PostMapping("update") | ||
public BaseResponse updateSharing(UpdateSharingReq req){ | ||
this.userSharingService.updateSharing(req); | ||
return BaseResponse.success(); | ||
} | ||
|
||
/** | ||
* 删除分享 | ||
*/ | ||
@PostMapping("delete") | ||
public BaseResponse deleteSharing(long shareId){ | ||
this.userSharingService.deleteSharing(shareId); | ||
return BaseResponse.success(); | ||
} | ||
|
||
//————————————————————————————————————网站读者相关功能———————————————————————————————————— | ||
/** | ||
* 查看全部分享 | ||
* @return | ||
*/ | ||
public BaseResponse<AllSharingResp> loadSharing(int pageNo, int pageSize){ | ||
return BaseResponse.successWithData(this.userSharingService.loadSharing(pageNo, pageSize)); | ||
} | ||
|
||
/** | ||
* 查看分享内容 | ||
* @param shareId | ||
* @return | ||
*/ | ||
public BaseResponse<SharingPojo> querySharing(long shareId){ | ||
return BaseResponse.successWithData(this.userSharingService.querySharing(shareId)); | ||
} | ||
|
||
/** | ||
* 查看用户的分享 | ||
* @param uid | ||
* @return | ||
*/ | ||
public BaseResponse<SharingByUserResp> loadSharingByUser(long uid) { | ||
return BaseResponse.successWithData(this.userSharingService.loadSharingByUser(uid)); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/dl/officialsite/sharing/dao/ISharingRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.dl.officialsite.sharing.dao; | ||
|
||
import com.dl.officialsite.sharing.model.db.SharingEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface ISharingRepository extends JpaRepository<SharingEntity, Long> { | ||
|
||
@Query(value = "select member_id from team_member where team_id = :team_id", nativeQuery = true) | ||
List<Long> findByTeamId(@Param("team_id")Long teamId); | ||
|
||
@Query(value = "select member_id from team_member where team_id = :team_id and status = :status", | ||
nativeQuery = | ||
true) | ||
List<Long> findByTeamIdStatus(@Param("team_id")Long teamId, @Param("status")int status); | ||
} |
74 changes: 74 additions & 0 deletions
74
src/main/java/com/dl/officialsite/sharing/model/db/SharingEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.dl.officialsite.sharing.model.db; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
|
||
@Data | ||
@Entity | ||
@Table(name = "tb_share") | ||
public class SharingEntity { | ||
|
||
/** | ||
* 分享Id | ||
*/ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private long id; | ||
|
||
/** | ||
* 分享主题 | ||
*/ | ||
private String theme; | ||
|
||
/** | ||
* 分享日期 | ||
*/ | ||
private String date; | ||
|
||
/** | ||
* 分享时间(UTC+8) | ||
*/ | ||
private String time; | ||
|
||
/** | ||
* 分享语言 | ||
*/ | ||
private int language; // 0 Chinese 1 English | ||
|
||
/** | ||
* 分享人匿称 | ||
*/ | ||
private String presenter; | ||
|
||
/** | ||
* 分享所属组织 | ||
*/ | ||
private String Org; | ||
|
||
/** | ||
* 分享人twitter | ||
*/ | ||
private String twitter; | ||
|
||
/** | ||
* 分享人 | ||
*/ | ||
private String memberId; | ||
|
||
/** | ||
* 文档连接 | ||
*/ | ||
private String sharingDoc; | ||
|
||
/** | ||
* 标签类别 | ||
*/ | ||
//defi zk underlying | ||
private String label; | ||
|
||
/** | ||
* 奖励金额 | ||
*/ | ||
private Integer reward; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/com/dl/officialsite/sharing/model/req/ClaimSharingRewardReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.dl.officialsite.sharing.model.req; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class ClaimSharingRewardReq { | ||
|
||
private long shareId; | ||
|
||
|
||
|
||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/dl/officialsite/sharing/model/req/CreateSessionRoomReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.dl.officialsite.sharing.model.req; | ||
|
||
public class CreateSessionRoomReq { | ||
} |
Oops, something went wrong.