提交 31caad54 作者: 张小凤

PilotCertificationServiceImpl(add)

上级 8cd99216
...@@ -104,4 +104,6 @@ public class PilotCertificationDTO { ...@@ -104,4 +104,6 @@ public class PilotCertificationDTO {
private String reason; private String reason;
@ApiModelProperty(value = "飞手头像", example = "http://") @ApiModelProperty(value = "飞手头像", example = "http://")
private String userImg; private String userImg;
@ApiModelProperty(value = "关注状态")
private Boolean status;
} }
...@@ -58,5 +58,8 @@ public class PilotCertificationQO implements Serializable { ...@@ -58,5 +58,8 @@ public class PilotCertificationQO implements Serializable {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
@ApiModelProperty(value = "",hidden = true)
private Integer tokenUserId;
} }
...@@ -61,6 +61,11 @@ public class PilotCertificationController extends BaseController { ...@@ -61,6 +61,11 @@ public class PilotCertificationController extends BaseController {
@PostMapping("/appListPilot") @PostMapping("/appListPilot")
public ResultBody<PilotCertificationDTO> pilotList(HttpServletRequest request, public ResultBody<PilotCertificationDTO> pilotList(HttpServletRequest request,
@Validated(value = {Page.class}) @ApiParam(value = "飞手查询", required = true) @RequestBody PilotCertificationQO param) { @Validated(value = {Page.class}) @ApiParam(value = "飞手查询", required = true) @RequestBody PilotCertificationQO param) {
String token = request.getHeader("token");
if (token!=null){
Integer userAccountId = this.getUserLoginInfoFromRedis(request).getUserAccountId();
param.setTokenUserId(userAccountId);
}
return ResultBody.success(certificationService.pilotList(param)); return ResultBody.success(certificationService.pilotList(param));
} }
......
package com.mmc.iuav.user.entity.dronepilot;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author small
* @Date 2023/10/12 10:23
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ForumAttentionDO {
private Integer id;
@ApiModelProperty(value = "被关注的用户")
private Integer userAccountId;
@ApiModelProperty(value = "关注用户")
private Integer attentionUserAccountId;
@ApiModelProperty(value = "关注状态")
private Boolean status;
@ApiModelProperty(value = "是否相互关注")
private Boolean mutualAttention;
private String createTime;
private String updateTime;
}
package com.mmc.iuav.user.service.dronepilot.impl; package com.mmc.iuav.user.service.dronepilot.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.mmc.iuav.http.HttpsRequestUtil; import com.mmc.iuav.http.HttpsRequestUtil;
import com.mmc.iuav.page.PageResult; import com.mmc.iuav.page.PageResult;
...@@ -28,8 +29,11 @@ import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO; ...@@ -28,8 +29,11 @@ import com.mmc.iuav.user.model.vo.dronepilot.PilotCertificationVO;
import com.mmc.iuav.user.model.vo.userpoints.UserPointsVO; import com.mmc.iuav.user.model.vo.userpoints.UserPointsVO;
import com.mmc.iuav.user.service.dronepilot.PilotCertificationService; import com.mmc.iuav.user.service.dronepilot.PilotCertificationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -60,6 +64,13 @@ public class PilotCertificationServiceImpl implements PilotCertificationService ...@@ -60,6 +64,13 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
@Autowired @Autowired
private UserPointsDetailsDao userPointsDetailsDao; private UserPointsDetailsDao userPointsDetailsDao;
@Autowired
private RestTemplate restTemplate;
@Value("${iuav.ims.uri}")
private String imsApp;
@Override @Override
public ResultBody insertPilot(PilotCertificationVO certificationVO, LoginSuccessDTO userLoginInfoFromRedis) { public ResultBody insertPilot(PilotCertificationVO certificationVO, LoginSuccessDTO userLoginInfoFromRedis) {
...@@ -135,11 +146,46 @@ public class PilotCertificationServiceImpl implements PilotCertificationService ...@@ -135,11 +146,46 @@ public class PilotCertificationServiceImpl implements PilotCertificationService
List<PilotCertificationDTO> collect = pilotList.stream().map(PilotCertificationDO::buildPilotCertificationDTO).collect(Collectors.toList()); List<PilotCertificationDTO> collect = pilotList.stream().map(PilotCertificationDO::buildPilotCertificationDTO).collect(Collectors.toList());
collect = collect.stream().skip((pageNo - 1) * param.getPageSize()).limit(param.getPageSize()). collect = collect.stream().skip((pageNo - 1) * param.getPageSize()).limit(param.getPageSize()).
collect(Collectors.toList()); collect(Collectors.toList());
Integer tokenUserId = param.getTokenUserId();
if (tokenUserId!=null){
List<ForumAttentionDO> info = info(param.getTokenUserId());
for (ForumAttentionDO forumAttentionDO : info) {
for (PilotCertificationDTO pilotCertificationDTO : collect) {
if (forumAttentionDO.getMutualAttention().equals(true)){
if (pilotCertificationDTO.getUserAccountId().equals(forumAttentionDO.getUserAccountId())||
pilotCertificationDTO.getUserAccountId().equals(forumAttentionDO.getAttentionUserAccountId())){
pilotCertificationDTO.setStatus(true);
}
}
if (forumAttentionDO.getMutualAttention().equals(false)){
if (pilotCertificationDTO.getUserAccountId().equals(forumAttentionDO.getUserAccountId())){
pilotCertificationDTO.setStatus(true);
}
}
}
}
}
PageResult pageResult = PageResult.buildPage(pageNo, param.getPageSize(), pilotList.size(), collect); PageResult pageResult = PageResult.buildPage(pageNo, param.getPageSize(), pilotList.size(), collect);
return pageResult; return pageResult;
} }
public List<ForumAttentionDO> info( Integer userAccountId) {
String token = null;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(userAccountId.toString(), headers);
ResponseEntity<String> exchange = restTemplate.exchange(imsApp + "/release/dynamic/getPilot?userAccountId=" + userAccountId , HttpMethod.GET, entity, String.class);
Object body = exchange.getBody();
JSONObject jsonObject1 = JSONObject.parseObject(body.toString());
List<Map> mapList = (List<Map>)jsonObject1.get("result");
List<ForumAttentionDO> forumAttentionDOS = JSON.parseArray(JSON.toJSONString(mapList), ForumAttentionDO.class);
return forumAttentionDOS;
}
@Override @Override
public PilotCertificationDTO detailPilot(Integer id) { public PilotCertificationDTO detailPilot(Integer id) {
PilotCertificationDO certificationDO = certificationDao.detailPilot(id); PilotCertificationDO certificationDO = certificationDao.detailPilot(id);
......
...@@ -97,5 +97,7 @@ iuav: ...@@ -97,5 +97,7 @@ iuav:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
pms: pms:
uri: http://pms-svc:8099 uri: http://pms-svc:8099
ims:
uri: http://ims-svc:10001
scheduling: scheduling:
enabled: true enabled: true
\ No newline at end of file
...@@ -61,3 +61,5 @@ iuav: ...@@ -61,3 +61,5 @@ iuav:
uri: http://127.0.0.1:8088 uri: http://127.0.0.1:8088
pms: pms:
uri: http://127.0.0.1:8099 uri: http://127.0.0.1:8099
ims:
uri: http://localhost:10001
...@@ -89,5 +89,7 @@ iuav: ...@@ -89,5 +89,7 @@ iuav:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
pms: pms:
uri: http://pms-svc:8099 uri: http://pms-svc:8099
ims:
uri: http://ims-svc:10001
scheduling: scheduling:
enabled: true enabled: true
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论