| 
					
				 | 
			
			
				@@ -1,65 +1,61 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.fs.app.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hutool.core.img.ImgUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hutool.core.io.FileUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.core.lang.Validator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hutool.extra.qrcode.QrCodeUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hutool.json.JSONUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.app.annotation.Login; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.app.param.EditPwdParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.app.param.EditUserInfoParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.app.param.EditUserQrCodeParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.app.param.LoginParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.app.param.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.app.utils.JwtUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.app.vo.CompanySubUserVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.app.vo.CompanyUserAppVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.app.vo.UserListVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.app.vo.UserVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.annotation.RepeatSubmit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.config.FSConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.common.constant.Constants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.core.redis.RedisCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.exception.BaseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.exception.CustomException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.exception.ServiceException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.PinYinUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.common.utils.ServletUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.utils.bean.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.common.utils.http.HttpUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.domain.Company; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.domain.CompanyUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.domain.CompanyUserCard; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.company.param.BaseQueryParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.param.CompanyUserCardQueryParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.company.vo.CompanyUserVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.core.security.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.crm.param.CrmDelEventParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.crm.param.CrmEventListQueryParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.crm.vo.CrmEventListQueryVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.fs.store.vo.FsStoreCouponIssueVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.course.service.IFsCourseRedPacketLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.his.param.BaseParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.store.service.IFsUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.fs.wx.miniapp.config.WxMaProperties; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.github.pagehelper.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import io.jsonwebtoken.Claims; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.commons.io.FileUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.validation.annotation.Validated; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.ZoneId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.format.DateTimeFormatter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.format.DateTimeParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.concurrent.TimeUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import static com.fs.common.constant.Constants.PAGE_SIZE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Api("个人中心") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping(value = "/app/user") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -84,6 +80,10 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ICompanyUserCardService companyUserCardService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsUserService fsUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IFsCourseRedPacketLogService courseRedPacketLogService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private WxMaProperties properties; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -256,10 +256,13 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("获取通讯录") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/getAllUsers") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public R getAllUsers(HttpServletRequest request, @ApiParam(required = false, name = "searchKey", value = "searchKey") @RequestParam(value = "searchKey", required = false) String searchKey) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getAllUsers(HttpServletRequest request, @ApiParam(required = false, name = "searchKey", value = "searchKey") @RequestParam(value = "searchKey", required = false) String searchKey, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         @RequestParam Integer isAudit) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.debug("获取通讯录 searchKey:{}, isAudit: {}", searchKey, isAudit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CompanyUser user = new CompanyUser(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         user.setNickName(searchKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         user.setCompanyId(getCompanyId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        user.setIsAudit(isAudit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         user.setIsDel(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CompanyUserVO> list = userService.selectMyUserList(user); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<UserVO> users = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -270,6 +273,10 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             vo.setNickName(u.getNickName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             vo.setUserId(u.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             vo.setAvatar(u.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            vo.setRegisterTime(u.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            vo.setStatus(u.getStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            vo.setPhoneNumber(u.getPhonenumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            vo.setIsAudit(u.getIsAudit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             users.add(vo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Object, List<UserVO>> res = users.parallelStream().collect( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -285,13 +292,14 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok().put("users", vos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation("获取用户信息ByUserId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("/getUserInfoByUserId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public R getUserInfoByUserId( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             @ApiParam(required = true, name = "userId", value = "用户ID") @RequestParam(value = "userId", required = false) Long userId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             HttpServletRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.debug("获取用户信息ByUserId userId:{}", userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CompanyUser user = userService.selectCompanyUserById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<String> postList = postService.selectPostNameListByUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (user == null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -300,7 +308,24 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (user.getStatus().equals("1")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return R.error(40002, "用户已停用"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return R.ok().put("user", user).put("post", postList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 查询用户会员数、今日新增用户数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Long> result = fsUserService.getUserVipCountByCompanyUserId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 红包数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int redPackCount = courseRedPacketLogService.getCountByCompanyUserIdId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 新用户红包金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal newVipRedPackAmount = courseRedPacketLogService.getNewVipRedPackAmountByCompanyUserIdId(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CompanyUserAppVO userVO = new CompanyUserAppVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BeanUtils.copyProperties(user, userVO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userVO.setVipCount(result.getOrDefault("vipCount", 0L)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userVO.setNewVipCount(result.getOrDefault("newVipCount", 0L)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userVO.setRedPacketCount(redPackCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userVO.setNewVipRedPackAmount(newVipRedPackAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.ok().put("user", userVO).put("post", postList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return R.error("操作异常"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -583,4 +608,29 @@ public class UserController extends AppBaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok().put("data", list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("修改用户状态") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/changeUserState") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R changeUserState(@RequestParam Long userId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.debug("修改用户状态 userId :{}", userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CompanyUser companyUser = companyUserService.selectCompanyUserById(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (Objects.isNull(companyUser)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new ServiceException("用户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String state = "0".equals(companyUser.getStatus()) ? "1" : "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUser.setStatus(state); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUserService.updateCompanyUser(companyUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Login 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("批量审核用户") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/audit") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R auditUser(@RequestParam List<Long> userIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.debug("批量审核用户 userIds :{}", userIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        companyUserService.auditUsers(userIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |