From aff4d9bea541a179f7bd0c4b318a864c54bd7ca4 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 18 三月 2025 21:33:16 +0800
Subject: [PATCH] bug修改
---
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java | 110 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 85 insertions(+), 25 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
index f2e80bc..ad2cb00 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/controller/HomeController.java
@@ -1,35 +1,32 @@
package com.panzhihua.sangeshenbian.controller;
import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo;
-import com.panzhihua.common.service.sangeshenbian.SystemUserService;
-import com.panzhihua.common.service.user.UserService;
+import com.panzhihua.common.redis.RedisUtils;
import com.panzhihua.sangeshenbian.model.entity.Banner;
+import com.panzhihua.sangeshenbian.model.entity.PartyMember;
import com.panzhihua.sangeshenbian.model.entity.SystemUser;
import com.panzhihua.sangeshenbian.model.query.BasePage;
import com.panzhihua.sangeshenbian.model.vo.ComplaintTodoVO;
import com.panzhihua.sangeshenbian.model.vo.MessageNotificationVO;
import com.panzhihua.sangeshenbian.model.vo.PartyCardInfoVO;
-import com.panzhihua.sangeshenbian.service.IBannerService;
-import com.panzhihua.sangeshenbian.service.IComplaintService;
-import com.panzhihua.sangeshenbian.service.IMessageNotificationService;
-import com.panzhihua.sangeshenbian.service.ISystemUserService;
+import com.panzhihua.sangeshenbian.service.*;
import com.panzhihua.sangeshenbian.utils.BaiduMapUtil;
+import com.panzhihua.sangeshenbian.warpper.IdentityInformation;
+import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
-import java.util.List;
+import java.util.*;
/**
* @author mitao
@@ -37,63 +34,126 @@
*/
@RestController
@RequestMapping("/applet/home")
-@RequiredArgsConstructor(onConstructor_=@Lazy)
+@RequiredArgsConstructor(onConstructor_ = @Lazy)
@Api(tags = "首页相关接口")
public class HomeController extends BaseController {
private final IBannerService bannerService;
private final IMessageNotificationService messageNotificationService;
private final IComplaintService complaintService;
private final ISystemUserService systemUserService;
- private final UserService userService;
+ private final IPartyMemberService partyMemberService;
+ private final RedisUtils redisUtils;
+ private final IdentityInformationService identityInformationService;
+
@ApiOperation("获取banner列表")
@GetMapping("/banner-list")
public R<List<Banner>> getBannerList() {
return R.ok(bannerService.list());
}
+
@GetMapping("/party-card-info")
@ApiOperation("获取党员证信息")
public R<PartyCardInfoVO> getPartyCardInfo() {
LoginUserInfoVO loginUserInfo = getLoginUserInfo();
+ // 获取党员信息
+ PartyMember partyMember = partyMemberService.getOne(new LambdaQueryWrapper<PartyMember>()
+ .eq(PartyMember::getPhone, loginUserInfo.getPhone())
+ .eq(PartyMember::getDelFlag, 0));
+
PartyCardInfoVO partyCardInfoVO = new PartyCardInfoVO();
- partyCardInfoVO.setName(loginUserInfo.getName());
- partyCardInfoVO.setIdCard(loginUserInfo.getIdCard());
- partyCardInfoVO.setPartyOrganization(loginUserInfo.getCommunityName());
+ partyCardInfoVO.setAvatar(partyMember.getAvatar());
+ partyCardInfoVO.setName(partyMember.getName());
+ partyCardInfoVO.setIdCard(partyMember.getIdNumber());
+ partyCardInfoVO.setDistricts(partyMember.getDistricts());
+ partyCardInfoVO.setStreet(partyMember.getStreet());
+ partyCardInfoVO.setCommunity(partyMember.getCommunity());
+ partyCardInfoVO.setPartyOrganization(partyMember.getPartyOrganization());
return R.ok(partyCardInfoVO);
}
+
@PostMapping("/message")
@ApiOperation("获取消息列表")
public R<Page<MessageNotificationVO>> getMessageList(@RequestBody BasePage page) {
- return R.ok(messageNotificationService.getMessageList(page,getUserId()));
+ return R.ok(messageNotificationService.getMessageList(page, getUserId()));
}
+
@PostMapping("/todo-list")
@ApiOperation("获取待办诉求")
public R<Page<ComplaintTodoVO>> getTodoList(@RequestBody BasePage page) {
- return R.ok(complaintService.getTodoList(page,getLoginUserInfo()));
+ return R.ok(complaintService.getTodoList(page, getLoginUserInfo()));
}
+
@GetMapping("/current-user-info")
@ApiOperation("获取三个身边当前用户信息 用于判断用户是否是上级")
public R<SystemUser> getCurrentUserInfo() {
- return R.ok(systemUserService.getSystemUserByPhone(getLoginUserInfo().getPhone()).orElse(null));
+ return R.ok(systemUserService.getSystemUserAdminByPhone(getLoginUserInfo().getPhone()).orElse(null));
}
+
/**
* 标记已读
*/
@PostMapping("/read")
@ApiOperation("标记已读")
- public R<?> read(){
+ public R<?> read() {
messageNotificationService.read(getLoginUserInfo());
return R.ok();
}
/**
* 百度地图圆形区域检索
+ *
* @param query
* @param location
* @return
*/
- @PostMapping("/search-location")
+ @GetMapping("/search-location")
@ApiOperation("百度地图圆形区域检索")
- public R<JSONArray> searchLocation(String query,String location){
- return R.ok(BaiduMapUtil.searchLocation(query,location));
+ public R<JSONArray> searchLocation(String query, String location) {
+ return R.ok(BaiduMapUtil.searchLocation(query, location));
+ }
+ @GetMapping("/geoconv")
+ @ApiOperation("百度地图经纬度转换")
+ public R<JSONObject> geoconv(String coords) {
+ try {
+ return R.ok(BaiduMapUtil.geoconv(coords));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ /**
+ * 获取身份信息
+ */
+ @GetMapping("/identity-info")
+ @ApiOperation("获取身份信息")
+ public R<IdentityInformationVO> getIdentityInfo() {
+ LoginUserInfoVO loginUserInfo = getLoginUserInfo();
+ IdentityInformation identityInformation = identityInformationService.getIdentityInformation(loginUserInfo);
+ IdentityInformationVO identityInformationVO = new IdentityInformationVO();
+ BeanUtils.copyProperties(identityInformation, identityInformationVO);
+ return R.ok(identityInformationVO);
+ }
+
+
+
+ /**
+ * 切换身份
+ */
+ @GetMapping("/change-identity")
+ @ApiOperation("切换身份")
+ public R<?> changeIdentity(Integer identity) {
+ LoginUserInfoVO loginUserInfo = getLoginUserInfo();
+ redisUtils.set("identity:" + loginUserInfo.getPhone(), identity);
+ return R.ok();
+ }
+
+ /**
+ * 提示内容确认
+ */
+ @GetMapping("/confirm-content")
+ @ApiOperation("提示内容确认")
+ public R<?> confirmContent() {
+ LoginUserInfoVO loginUserInfo = getLoginUserInfo();
+ redisUtils.set("confirmContent:" + loginUserInfo.getPhone(), 1);
+ return R.ok();
}
}
--
Gitblit v1.7.1