Skip to content

Commit

Permalink
Merge pull request #86 from yanyanho/main
Browse files Browse the repository at this point in the history
add resume query interface
  • Loading branch information
yanyanho authored Dec 13, 2023
2 parents d8eca6e + eb28549 commit c55ff51
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ https://github.com/spruceid/siwe-go/blob/main/message.go
```

## IPFS data
/root/graph-node/docker/data/ipfs
/root/graph-node/docker/data/ipfs

## COS file
https://dlh-1257682033.cos.ap-hongkong.myqcloud.com/{uuid}

## graph ql 集成
"https://api.studio.thegraph.com/proxy/55957/dapp-learning-redpacket/version/latest"
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/dl/officialsite/file/cos/FileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public String upload(MultipartFile file) {
}
//拼接返回路径
cosClient.shutdown();
String imagePath = "https://" + cosProperties.getBucketName() + ".cos." + cosProperties.getRegionName() + ".myqcloud.com/" + key;
return imagePath;
// String imagePath = "https://" + cosProperties.getBucketName() + ".cos." + cosProperties.getRegionName() + ".myqcloud.com/" + key;
return key;
}

public String uploadImage(MultipartFile file) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/dl/officialsite/member/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class Member implements Serializable
//todo
private Long workStatus;

@JsonIgnore
private String resume;


Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/dl/officialsite/member/MemberController.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,25 @@ public class MemberController {
@RequestMapping(value = "/query", method = RequestMethod.GET)
BaseResponse getMemberByAddress(@RequestParam String address) {

Member member = memberService.getMemberWithTeamInfoByAddress(address);
MemberWithTeam member = memberService.getMemberWithTeamInfoByAddress(address);
if (member == null) {
return BaseResponse.failWithReason("1001", "no user found");
}
return BaseResponse.successWithData(member);
}


@RequestMapping(value = "/resume/query", method = RequestMethod.GET)
BaseResponse getMemberResumeByAddress(@RequestParam String address) {

MemberWithTeam member = memberService.getMemberWithTeamInfoByAddress(address);
if (member == null) {
return BaseResponse.failWithReason("1001", "no user found");
}
return BaseResponse.successWithData(member.getResume());
}


@RequestMapping(value = "/all", method = RequestMethod.GET)
BaseResponse getAllMember(@RequestParam String address, @RequestParam(defaultValue = "1") Integer pageNumber,
@RequestParam(defaultValue = "10") Integer pageSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ BaseResponse getRedPacketByAddress(@RequestParam String address, @RequestParam(r
return BaseResponse.successWithData(result);
}

// 更新红包状态,已认领过的地址。
@PostMapping(value = "/query/all")
BaseResponse getAllRedPacketByCriteria(@RequestParam String address,
@RequestBody RedPacketVo redPacket,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ public class RedPacketService {

public CloseableHttpClient httpClient = HttpClients.createDefault();

@Scheduled(cron = "0 0/2 * * * ? ")
@Scheduled(cron = "0 0/1 * * * ? ")
public void updateRedpacketStatus() throws IOException {
log.info("schedule task begin --------------------- ");
HttpPost request = new HttpPost("http://api.studio.thegraph.com/proxy/55957/dapp-learning-redpacket/version/latest");
request.setHeader("Content-Type", "application/json");
// Define your GraphQL query
long currentTimeMillis = System.currentTimeMillis();
String creationTimeGtValue = String.valueOf(currentTimeMillis / 1000 -3600*24*90);

String graphQL = "\" {" +
" redpackets {" +
Expand All @@ -51,12 +53,14 @@ public void updateRedpacketStatus() throws IOException {
" }" +
"}\"";


String query = "{ \"query\": " +
graphQL +
" }";

request.setEntity(new StringEntity(query));
HttpResponse response = httpClient.execute(request);
// System.out.println("response" + response);
HttpEntity entity = response.getEntity();

if (entity != null) {
Expand All @@ -66,7 +70,7 @@ public void updateRedpacketStatus() throws IOException {
JsonObject data = jsonObject.getAsJsonObject("data");
JsonArray redpacketsArray = data.getAsJsonArray("redpackets");

// log.info("redpacket array : " + redpacketsArray);
log.info("redpacket array : " + redpacketsArray.get(0));
List<RedPacket> redPacketList = redPacketRepository.findByStatus(0);

for (int i = 0; i < redpacketsArray.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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.Data;
import org.springframework.stereotype.Service;

@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,22 @@
import com.dl.officialsite.common.base.Pagination;
import com.dl.officialsite.common.enums.CodeEnums;
import com.dl.officialsite.common.exception.BizException;
import com.dl.officialsite.common.utils.HttpSessionUtils;
import com.dl.officialsite.login.model.SessionUserInfo;
import com.dl.officialsite.member.Member;
import com.dl.officialsite.member.MemberRepository;
import com.dl.officialsite.sharing.constant.SharingLockStatus;
import com.dl.officialsite.sharing.dao.ISharingRepository;
import com.dl.officialsite.sharing.model.db.TbShare;
import com.dl.officialsite.sharing.model.vo.SharingVo;
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.SharingByUserResp;
import com.dl.officialsite.sharing.model.vo.SharingVo;
import com.dl.officialsite.sharing.service.IUserSharingService;
import com.google.common.base.Preconditions;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

Expand Down

0 comments on commit c55ff51

Please sign in to comment.