From cf3b4b7fc95fd5b83cae6842e8c24b99e70068e0 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期二, 27 四月 2021 16:55:07 +0800
Subject: [PATCH] 修复bug

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java |  373 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 362 insertions(+), 11 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
index 59ee7e4..e30843c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -1,21 +1,23 @@
 package com.panzhihua.service_user.api;
 
 import com.panzhihua.common.model.dtos.PageDTO;
+import com.panzhihua.common.model.dtos.community.ExportSpecialUserDTO;
+import com.panzhihua.common.model.dtos.community.ExportUserDTO;
 import com.panzhihua.common.model.dtos.community.NoticeReadDTO;
-import com.panzhihua.common.model.dtos.user.PageFeedBackDTO;
-import com.panzhihua.common.model.dtos.user.PageUserAppletsBackstageDTO;
-import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO;
+import com.panzhihua.common.model.dtos.user.*;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.SystemmanagementConfigVO;
+import com.panzhihua.common.model.vos.shop.ShopStoreVO;
 import com.panzhihua.common.model.vos.user.*;
+import com.panzhihua.service_user.service.SysUserInputService;
 import com.panzhihua.service_user.service.UserService;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -23,10 +25,13 @@
  * @author: huang.hongfa weixin hhf9596 qq 959656820
  * @create: 2020-11-24 09:00
  **/
+@Slf4j
 @RestController("/")
 public class UserApi {
     @Resource
     private UserService userService;
+    @Resource
+    private SysUserInputService sysUserInputService;
 
     /**
      * 新增微信用户
@@ -71,9 +76,9 @@
      */
     @PostMapping("/getUserInfo")
     public R<LoginUserInfoVO> getUserInfo(@RequestParam("userName") String userName){
-        int index = userName.indexOf("_");
+        int index = userName.lastIndexOf("_");
         String type = userName.substring(index+1, userName.length());
-        String name = userName.substring(0, userName.indexOf("_"));
+        String name = userName.substring(0, index);
         return userService.getUserInfo(name,Integer.parseInt(type));
     }
 
@@ -148,6 +153,15 @@
     }
 
     /**
+     * 查询当前社区所有标签以及预设标签
+     * @return 标签集合
+     */
+    @PostMapping("listtag/getTag")
+    public R listTags(@RequestParam("communityId") Long communityId){
+        return userService.listTags(communityId);
+    }
+
+    /**
      * 人员详情
      * @param userId 用户id
      * @return 人员详情
@@ -175,6 +189,16 @@
     @PostMapping("putuserisvolunteer")
     R putUserIsVolunteer(@RequestParam("phone")String phone,@RequestParam("type")int type){
         return userService.putUserIsVolunteer(phone,type);
+    }
+
+    /**
+     * 修改用户志愿者状态
+     * @param userId 志愿者ID
+     * @param type 1是志愿者 0 不是
+     */
+    @PostMapping("putuserisvolunteerbyid")
+    R putUserIsVolunteerById(@RequestParam("userId")Long userId,@RequestParam("type")int type){
+        return userService.putUserIsVolunteerById(userId, type);
     }
 
     /**
@@ -248,17 +272,18 @@
     }
 
     /**
-     * 新增运营后台账户
+     * 新增运营、社区后台账户
      * @param administratorsUserVO 账户信息
      * @return 新增结果
      */
     @PostMapping("adduserbackstage")
     public R addUserBackstage(@RequestBody AdministratorsUserVO administratorsUserVO){
+
         return userService.addUserBackstage(administratorsUserVO);
     }
 
     /**
-     * 编辑运营后台账户
+     * 编辑运营、社区后台账户
      * @param administratorsUserVO 编辑账户内容
      * @return 编辑结果
      */
@@ -455,4 +480,330 @@
     public R dataKanban(){
         return userService.dataKanban();
     }
+
+    /**
+     * 社区管理后台数据看板
+     * @param communityId 社区id
+     * @return 看板用户数据
+     */
+    @PostMapping("indexdatacommunitybackstage")
+    public R indexDataCommunityBackstage(@RequestParam("communityId")Long communityId){
+        return userService.indexDataCommunityBackstage(communityId);
+    }
+
+    /**
+     * 定时任务维护用户持续登录时间
+     * @return 维护结果
+     */
+    @PostMapping("timedtaskcontinuouslandingdays")
+    public R timedTaskContinuousLandingDays(){
+        return userService.timedTaskContinuousLandingDays();
+    }
+
+    /**
+     * 新增用户通知
+     * @param sysUserNoticeVO 通知内容
+     * @return 新增结果
+     */
+    @PostMapping("addnotice")
+    public R addNotice(@RequestBody SysUserNoticeVO sysUserNoticeVO){
+        return userService.addNotice(sysUserNoticeVO);
+    }
+
+    /**
+     * 修改用户的党员状态
+     * @param idCard 身份证号
+     * @return 修改结果
+     */
+    @PostMapping("updateuserispartymember")
+    public R updateUserIsPartymember(@RequestParam("idCard")String idCard){
+        return userService.updateUserIsPartymember(idCard);
+    }
+
+    /**
+     * 获取各种协议
+     * @param type  1居民端app协议 2网格员端app协议 3商家端app协议 4隐私政策
+     * @return 协议内容
+     */
+    @PostMapping("agreement")
+    public R agreement(@RequestParam("type")Integer type){
+        return userService.agreement(type);
+    }
+
+    /**
+     * 维护用户最后登录时间
+     * @param userId 用户主键
+     * @return 维护结果
+     */
+    @PostMapping("putuserlastlogintime")
+    public R putUserLastLoginTime(@RequestParam("userId")Long userId){
+        return userService.putUserLastLoginTime(userId);
+    }
+
+    /**
+     * 删除意见反馈
+     * @param id 主键
+     * @return 删除结果
+     */
+    @PostMapping("deletefeedback")
+    public R deleteFeedback(@RequestParam("id")Long id){
+        return userService.deleteFeedback(id);
+    }
+
+    /**
+     * 校验小区是否存在
+     * @param areaName 小区名字
+     * @return 校验结果
+     */
+    @PostMapping("checkaereaname")
+    public R checkAereaName(@RequestParam("areaName")String areaName){
+        return userService.checkAereaName(areaName);
+    }
+
+    /**
+     * 批量导入居民用户
+     * @param list 居民用户集合
+     * @param areaName 小区名字
+     * @return 导入结果
+     */
+    @PostMapping("batchsaveuser")
+    public R batchSaveUser(@RequestBody List<EexcelUserDTO> list,@RequestParam("areaName")StringBuffer areaName){
+        R r = null;
+        try {
+            r = sysUserInputService.batchSaveUser(list, areaName);
+        } catch (Exception e) {
+            String message = e.getMessage();
+            log.error(message);
+            if (message.contains("unique_id_card")) {
+                int i = message.indexOf("'");
+                String idcard = message.substring(i + 1, message.indexOf("'", i + 1));
+//                System.out.println(idcard);
+                return R.fail("身份证存在重复"+idcard);
+            }else {
+                return R.fail(e.getMessage());
+            }
+        }
+        return r;
+    }
+
+    /**
+     * 社区人员详情包括导入人员
+     * @param userId 人员id
+     * @return CommunityUserInfoVO
+     */
+    @PostMapping("detailusercomunity")
+    public R detailUserComunity(@RequestParam("userId")Long userId){
+        CommunityUserInfoVO communityUserInfoVO=new CommunityUserInfoVO();
+        if(userId<100000000l){
+            communityUserInfoVO=userService.detailUserComunity(userId);
+        }else{
+            communityUserInfoVO=sysUserInputService.detailUserComunity(userId);
+        }
+        return R.ok(communityUserInfoVO);
+    }
+
+    /**
+     *  用户搜索了就下载搜索的用户否则下载所有用户
+     * @param exportUserDTO 用户搜索内容
+     * @return List<EexcelUserDTO> excel内容
+     */
+    @PostMapping("export")
+    public R export(@RequestBody ExportUserDTO exportUserDTO){
+      return userService.export(exportUserDTO);
+    }
+
+    /**
+     * 通过手机号码查询用户信息
+     * @param phone
+     * @return
+     */
+    @GetMapping("getUserByPhone")
+    public R getSysUserVOByPhone(@RequestParam(value = "phone") String phone){
+        return userService.getSysUserVOByPhone(phone);
+    }
+
+    /**
+     * 通过账号和渠道查询用户信息
+     * @param account
+     * @return
+     */
+    @GetMapping("getUserByAccount")
+    public R getSysUserVOByAccount(@RequestParam(value = "account") String account,@RequestParam(value = "type") Integer type){
+        return userService.getSysUserVOByAccount(account, type);
+    }
+
+    /**
+     *分页查询人口管理
+     * @param pageInputUserDTO 查询参数
+     * @return 分页数据
+     */
+    @PostMapping("common/data/user/page")
+    public R pageInputUser(@RequestBody PageInputUserDTO pageInputUserDTO){
+        return sysUserInputService.pageInputUser(pageInputUserDTO);
+    }
+
+    /**
+     * 设置用户标签
+     * @param inputUserTagsDTO 标签信息
+     * @return 设置结果
+     */
+    @PostMapping("common/data/user/tags")
+    public R setInputUserTag(@RequestBody InputUserTagsDTO inputUserTagsDTO){
+        return sysUserInputService.putUserTag(inputUserTagsDTO);
+    }
+
+    /**
+     * 批量导入居民用户
+     * @param list 居民用户集合
+     * @param areaName 小区名字
+     * @return 导入结果
+     */
+    @PostMapping("common/data/user/import")
+    public R batchSaveInputUser(@RequestBody List<EexcelUserDTO> list,@RequestParam("areaName")StringBuffer areaName){
+        R r = null;
+        try {
+            r = sysUserInputService.batchSaveUser(list, areaName);
+        } catch (Exception e) {
+            String message = e.getMessage();
+            log.error(message);
+            if (message.contains("unique_id_card")) {
+                int i = message.indexOf("'");
+                String idcard = message.substring(i + 1, message.indexOf("'", i + 1));
+//                System.out.println(idcard);
+                return R.fail("身份证存在重复"+idcard);
+            }else {
+                return R.fail(e.getMessage());
+            }
+        }
+        return r;
+    }
+
+    /**
+     *  居民管理》居民详情
+     * @param id 人员id
+     * @return CommunityUserInfoVO
+     */
+    @PostMapping("common/data/user/detail")
+    public R inputUserDetail(@RequestParam("id")Long id){
+        return sysUserInputService.inputUserDetail(id);
+    }
+
+    /**
+     *  用户搜索了就下载搜索的用户否则下载所有用户
+     * @param exportUserDTO 用户搜索内容
+     * @return List<EexcelUserDTO> excel内容
+     */
+    @PostMapping("common/data/user/export")
+    public R inputUserExport(@RequestBody ExportUserDTO exportUserDTO){
+        return sysUserInputService.exportInputUser(exportUserDTO);
+    }
+
+    /**
+     * 特殊群体
+     * @param pageInputUserDTO
+     * @return
+     */
+    @PostMapping("common/data/special/page")
+    R specialInputUser(@RequestBody PageInputUserDTO pageInputUserDTO) {
+        return sysUserInputService.specialInputUser(pageInputUserDTO);
+    }
+
+    /**
+     * 特殊群体
+     * @param id
+     * @return
+     */
+    @DeleteMapping("common/data/special/delete")
+    R deleteSpecialInputUser(@RequestParam(value = "id") Long id) {
+        return sysUserInputService.deleteSpecialInputUser(id);
+    }
+    /**
+     * 特殊群体标签列表
+     * @param comMngUserTagDTO
+     * @return
+     */
+    @PostMapping("common/data/special/tags/page")
+    R specialInputUserTags(@RequestBody ComMngUserTagDTO comMngUserTagDTO) {
+        return sysUserInputService.specialInputUserTags(comMngUserTagDTO);
+    }
+
+    /**
+     * 新增或修改特殊群体标签
+     * @param comMngTagVO
+     * @return
+     */
+    @PostMapping("common/data/special/tags/save")
+    R saveSpecialInputUserTags(@RequestBody ComMngTagVO comMngTagVO) {
+        return sysUserInputService.saveSpecialInputUserTags(comMngTagVO);
+    }
+
+    /**
+     * 删除特殊群体标签
+     * @param id
+     * @return
+     */
+    @DeleteMapping("common/data/special/tags/delete")
+    R deleteSpecialInputUserTags(@RequestParam(value = "id") Long id) {
+        return sysUserInputService.deleteSpecialInputUserTags(id);
+    }
+
+    /**
+     * 特殊群体导出
+     * @param exportSpecialUserDTO
+     * @return
+     */
+    @PostMapping("common/data/special/export")
+    R specialUserExport(@RequestBody ExportSpecialUserDTO exportSpecialUserDTO) {
+        return sysUserInputService.specialUserExport(exportSpecialUserDTO);
+    }
+
+    /**
+     * 创建SysUser用户信息以及权限
+     * @param storeVO   请求参数
+     * @return  创建结果
+     */
+    @PostMapping("addSysUser")
+    public R addSysUser(@RequestBody ShopStoreVO storeVO){
+        return userService.addSysUser(storeVO);
+    }
+
+    /**
+     * 修改SysUser用户信息
+     * @param storeVO   请求参数
+     * @return  修改结果
+     */
+    @PostMapping("editSysUser")
+    public R editSysUser(@RequestBody ShopStoreVO storeVO){
+        return userService.editSysUser(storeVO);
+    }
+
+    /**
+     * 修改用户小程序首页活动提示
+     * @param userEditTipsDTO  请求参数
+     * @return  修改结果
+     */
+    @PostMapping("editUserTips")
+    public R editUserTips(@RequestBody SysUserEditTipsDTO userEditTipsDTO) {
+        return userService.editUserTips(userEditTipsDTO);
+    }
+
+    /**
+     * 获取用户电子档案
+     * @param userId 家庭成员信息
+     * @return 结果
+     */
+    @GetMapping("getUserArchives")
+    public R getUserArchives(@RequestParam("userId") Long userId){
+        return userService.getUserArchives(userId);
+    }
+
+    /**
+     * 编辑用户电子档案
+     * @param userArchivesVO 编辑的信息
+     * @return 编辑结果
+     */
+    @PostMapping("updateUserArchives")
+    public R updateUserArchives(@RequestBody UpdateUserArchivesVO userArchivesVO){
+        return userService.updateUserArchives(userArchivesVO);
+    }
 }

--
Gitblit v1.7.1