|
@@ -0,0 +1,789 @@
|
|
|
+package com.management.platform.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.management.platform.constant.Constant;
|
|
|
+import com.management.platform.entity.*;
|
|
|
+import com.management.platform.entity.vo.UserVO;
|
|
|
+import com.management.platform.mapper.*;
|
|
|
+import com.management.platform.service.DepartmentOtherManagerService;
|
|
|
+import com.management.platform.service.FeishuInfoService;
|
|
|
+import com.management.platform.service.SysRoleService;
|
|
|
+import com.management.platform.service.UserService;
|
|
|
+import com.management.platform.service.impl.FeishuInfoServiceImpl;
|
|
|
+import com.management.platform.util.*;
|
|
|
+import com.taobao.api.ApiException;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.*;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.PrintWriter;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneOffset;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author Seyason
|
|
|
+ * @since 2023-02-27
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/feishu-info")
|
|
|
+@Slf4j
|
|
|
+public class FeishuInfoController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private FeishuInfoService feishuInfoService;
|
|
|
+ @Resource
|
|
|
+ private FeishuInfoMapper feishuInfoMapper;
|
|
|
+ @Resource
|
|
|
+ private CompanyMapper companyMapper;
|
|
|
+ @Resource
|
|
|
+ private TimeTypeMapper timeTypeMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleService sysRoleService;
|
|
|
+ @Resource
|
|
|
+ private ProjectBasecostSettingMapper projectBasecostSettingMapper;
|
|
|
+ @Resource
|
|
|
+ private CompanyReportMapper companyReportMapper;
|
|
|
+ @Resource
|
|
|
+ private DepartmentFeishuMapper departmentFeishuMapper;
|
|
|
+ @Resource
|
|
|
+ private DepartmentMapper departmentMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleMapper sysRoleMapper;
|
|
|
+ @Resource
|
|
|
+ private UserService userService;
|
|
|
+ @Resource
|
|
|
+ private UserMapper userMapper;
|
|
|
+ @Resource
|
|
|
+ private SysFunctionMapper sysFunctionMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleFunctionMapper sysRoleFunctionMapper;
|
|
|
+ @Resource
|
|
|
+ private SysRoleModuleMapper sysRoleModuleMapper;
|
|
|
+ @Resource
|
|
|
+ private SysModuleMapper sysModuleMapper;
|
|
|
+ @Resource
|
|
|
+ private TaskGroupMapper taskGroupMapper;
|
|
|
+ @Resource
|
|
|
+ private ProjectAuditorMapper projectAuditorMapper;
|
|
|
+ @Resource
|
|
|
+ DepartmentOtherManagerService departmentOtherManagerService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化内部应用的系统数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/initSystem")
|
|
|
+ public HttpRespMsg initSystem(String appId) throws Exception {
|
|
|
+ //初始化数据生成公司
|
|
|
+ System.out.println("========接收到initSystem请求===appid="+appId);
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ //查找公司对应的记录是否已经添加
|
|
|
+ FeishuInfo feishuInfo = feishuInfoMapper.selectOne(new QueryWrapper<FeishuInfo>().eq("app_id",appId));
|
|
|
+ if (feishuInfo == null) {
|
|
|
+ msg.setError("请在feishu_info表中增加appid:" + appId);
|
|
|
+ } else if (feishuInfo.getCompanyId() != null) {
|
|
|
+ //msg.setError("companyId已存在,如需重新初始化请先重置company_dingding中该条数据的companyId为null");
|
|
|
+ msg.setError("companyId已存在,如需重新初始化请先重置feishu_info中该条数据的companyId为null");
|
|
|
+ } else {
|
|
|
+ /*todo 根据appId 获取企业信息*/
|
|
|
+ JSONObject corpInfo = feishuInfoService.getCorpInfo(feishuInfo);
|
|
|
+ String corpName = corpInfo.getString("name");
|
|
|
+ String corpId = corpInfo.getString("display_id");
|
|
|
+ String corpTag = corpInfo.getString("tenant_tag");
|
|
|
+ corpInfo.getString("tenant_key");
|
|
|
+ Company company = new Company().setCompanyName(corpName)
|
|
|
+ .setExpirationDate(LocalDateTime.now().plusDays(15));
|
|
|
+ company.setPackageWorktime(1);
|
|
|
+ companyMapper.insert(company);
|
|
|
+ feishuInfo.setCorpid(corpId);
|
|
|
+ feishuInfo.setCorpName(corpName);
|
|
|
+ feishuInfo.setCompanyId(company.getId());
|
|
|
+ feishuInfoMapper.updateById(feishuInfo);
|
|
|
+ //生成工作时长
|
|
|
+ TimeType timeType = new TimeType();
|
|
|
+ timeType.setCompanyId(company.getId());
|
|
|
+ timeTypeMapper.insert(timeType);
|
|
|
+ SysRole smanager = sysRoleService.generateDefaultRoles(company.getId());
|
|
|
+ //生成项目的成本基线默认条目
|
|
|
+ String[] array = Constant.DEFAULT_BASE_COST_ITEMS;
|
|
|
+ for (String baseItem : array) {
|
|
|
+ ProjectBasecostSetting setting = new ProjectBasecostSetting();
|
|
|
+ setting.setName(baseItem);
|
|
|
+ setting.setCompanyId(company.getId());
|
|
|
+ projectBasecostSettingMapper.insert(setting);
|
|
|
+ }
|
|
|
+ //todo: 生成项目报表服务默认条目
|
|
|
+ Integer[] arrayInteger=new Integer[]{1,2,3,4,7};
|
|
|
+ for (Integer integerItem : arrayInteger) {
|
|
|
+ CompanyReport companyReport=new CompanyReport();
|
|
|
+ companyReport.setCompanyId(company.getId());
|
|
|
+ companyReport.setReportFormId(integerItem);
|
|
|
+ companyReportMapper.insert(companyReport);
|
|
|
+ }
|
|
|
+ //获取应用可用范围内的部门
|
|
|
+ Map<String, Object> availableRange = feishuInfoService.getAvailableRange(feishuInfo, null);
|
|
|
+ JSONArray deptArray = (JSONArray) availableRange.get("department_ids");
|
|
|
+ JSONArray departmentInfoArrays=new JSONArray();
|
|
|
+ for (int i = 0; i < deptArray.size(); i++) {
|
|
|
+ String dpId = deptArray.getString(i);
|
|
|
+ JSONArray departmentInfo = feishuInfoService.getDepartmentInfo(feishuInfo, dpId);
|
|
|
+ if(departmentInfo!=null&&departmentInfo.size()>0){
|
|
|
+ departmentInfoArrays.addAll(departmentInfo);
|
|
|
+ }
|
|
|
+ JSONArray subDepartmentList =getSubDepartmentList(feishuInfo,dpId);
|
|
|
+ if(subDepartmentList!=null&&subDepartmentList.size()>0){
|
|
|
+ departmentInfoArrays.addAll(subDepartmentList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int j = 0; j < departmentInfoArrays.size(); j++) {
|
|
|
+ JSONObject ob = departmentInfoArrays.getJSONObject(j);
|
|
|
+ String departmentName = String.valueOf(ob.get("name"));
|
|
|
+ System.out.println("synchronizationDP========="+departmentName);
|
|
|
+ String departmentId = String.valueOf(ob.getString("department_id"));
|
|
|
+ String openDepartmentId = String.valueOf(ob.getString("open_department_id"));
|
|
|
+ String departmentParentId =String.valueOf(ob.getString("parent_department_id"));
|
|
|
+ Integer cut = departmentFeishuMapper.selectCount(new QueryWrapper<DepartmentFeishu>().eq("corpid",corpId).eq("feishu_deptid",departmentId));
|
|
|
+ if(cut==0&&!departmentId.equals("0")){
|
|
|
+ System.out.println("join===========");
|
|
|
+ DepartmentFeishu departmentFeishu=new DepartmentFeishu();
|
|
|
+ departmentFeishu.setCorpid(corpId)
|
|
|
+ .setName(departmentName)
|
|
|
+ .setFeishuParentid(departmentParentId)
|
|
|
+ .setFeishuDeptid(departmentId)
|
|
|
+ .setFeishuOpenDeptid(openDepartmentId);
|
|
|
+ Department department = new Department();
|
|
|
+ department.setCompanyId(company.getId());
|
|
|
+ department.setDepartmentName(departmentName);
|
|
|
+ department.setFeishuDeptid(openDepartmentId);
|
|
|
+ departmentMapper.insert(department);
|
|
|
+ departmentFeishu.setSysDeptid(department.getDepartmentId());
|
|
|
+ departmentFeishuMapper.insert(departmentFeishu);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SysRole role = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", company.getId()).eq("rolename","普通员工"));
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", company.getId()));
|
|
|
+ List<DepartmentFeishu> departmentFeishuList = departmentFeishuMapper.selectList(new QueryWrapper<DepartmentFeishu>().eq("corpid", corpId));
|
|
|
+ List<User> userList=new ArrayList<>();
|
|
|
+ for (DepartmentFeishu departmentFeishu : departmentFeishuList) {
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(departmentFeishu.getSysDeptid())).findFirst();
|
|
|
+ //获取到当前部门的上级部门
|
|
|
+ Optional<DepartmentFeishu> wx = departmentFeishuList.stream().filter(dl -> dl.getFeishuOpenDeptid().equals(departmentFeishu.getFeishuParentid())).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ if(wx.isPresent()){
|
|
|
+ Optional<Department> dp = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(wx.get().getSysDeptid())).findFirst();
|
|
|
+ if(dp.isPresent()){
|
|
|
+ first.get().setSuperiorId(dp.get().getDepartmentId());
|
|
|
+ departmentMapper.updateById(first.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //处理部门下的人员
|
|
|
+ JSONArray userInfoWithDepartment=feishuInfoService.getUserInfoWithDepartment(feishuInfo,departmentFeishu.getFeishuOpenDeptid(),null);
|
|
|
+ for (int m=0;m<userInfoWithDepartment.size(); m++) {
|
|
|
+ JSONObject userJson = userInfoWithDepartment.getJSONObject(m);
|
|
|
+ String curUserid = userJson.getString("user_id");
|
|
|
+ String openUserid = userJson.getString("open_id");
|
|
|
+ if(!userJson.getJSONObject("status").getBoolean("is_activated")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<String> departments = (List<String>) userJson.get("department_ids");
|
|
|
+ System.out.println("user info======:"+userJson.toString());
|
|
|
+ //不存在的人员, 进行插入
|
|
|
+ User user = new User();
|
|
|
+ //在当前部门下的员工
|
|
|
+ user.setId(SnowFlake.nextId()+"")
|
|
|
+ .setRoleId(role.getId())//默认普通员工
|
|
|
+ .setRoleName(role.getRolename())
|
|
|
+ .setCompanyId(company.getId())
|
|
|
+ .setName(userJson.getString("name"))
|
|
|
+ .setFeishuUserid(openUserid)
|
|
|
+ .setColor(ColorUtil.randomColor())
|
|
|
+ .setJobNumber(curUserid)
|
|
|
+ .setPassword(MD5Util.getPassword("000000"))
|
|
|
+ .setFeishuDeptid(departmentFeishu.getFeishuDeptid());
|
|
|
+ String max = departments.get(0);
|
|
|
+ Optional<DepartmentFeishu> dpFs = departmentFeishuList.stream().filter(dl -> dl.getFeishuOpenDeptid().equals(max)).findFirst();
|
|
|
+ if(dpFs.isPresent()){
|
|
|
+ Optional<Department> dp = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(dpFs.get().getSysDeptid())).findFirst();
|
|
|
+ if(dp.isPresent()){
|
|
|
+ user.setDepartmentName(dp.get().getDepartmentName());
|
|
|
+ user.setDepartmentId(dp.get().getDepartmentId());
|
|
|
+ user.setDepartmentCascade(convertDepartmentIdToCascade(dp.get().getDepartmentId(),departmentList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean b = userList.stream().anyMatch(ul ->ul.getFeishuUserid()!=null&&ul.getFeishuUserid().equals(user.getFeishuUserid()));
|
|
|
+ if(!b){
|
|
|
+ userList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取应用可用范围内的人员
|
|
|
+ JSONArray userArray = (JSONArray) availableRange.get("user_ids");
|
|
|
+ for (int i = 0; i < userArray.size(); i++) {
|
|
|
+ String userId = userArray.getString(i);
|
|
|
+ JSONObject userInfo = feishuInfoService.getUserInfo(feishuInfo, userId);
|
|
|
+ List<String> departments = (List<String>) userInfo.get("department_ids");
|
|
|
+ //不存在的人员, 进行插入
|
|
|
+ User user = new User();
|
|
|
+ //在当前部门下的员工
|
|
|
+ String max = departments.get(0);
|
|
|
+ user.setId(SnowFlake.nextId()+"")
|
|
|
+ .setRoleId(role.getId())//默认普通员工
|
|
|
+ .setRoleName(role.getRolename())
|
|
|
+ .setCompanyId(company.getId())
|
|
|
+ .setName(userInfo.getString("name"))
|
|
|
+ .setFeishuUserid(userInfo.getString("open_id"))
|
|
|
+ .setColor(ColorUtil.randomColor())
|
|
|
+ .setJobNumber(userInfo.getString("user_id"))
|
|
|
+ .setPassword(MD5Util.getPassword("000000"))
|
|
|
+ .setFeishuDeptid(max);
|
|
|
+ Optional<DepartmentFeishu> dpFs = departmentFeishuList.stream().filter(dl -> dl.getFeishuDeptid().equals(max)).findFirst();
|
|
|
+ if(dpFs.isPresent()){
|
|
|
+ Optional<Department> dp = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(dpFs.get().getSysDeptid())).findFirst();
|
|
|
+ user.setDepartmentName(dp.get().getDepartmentName());
|
|
|
+ user.setDepartmentId(dp.get().getDepartmentId());
|
|
|
+ user.setDepartmentCascade(convertDepartmentIdToCascade(dp.get().getDepartmentId(),departmentList));
|
|
|
+ }
|
|
|
+ boolean b = userList.stream().anyMatch(ul ->ul.getFeishuUserid()!=null&&ul.getFeishuUserid().equals(user.getFeishuUserid()));
|
|
|
+ if(!b){
|
|
|
+ userList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("resutlList========="+userList);
|
|
|
+ userService.saveBatch(userList);
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ private JSONArray getSubDepartmentList(FeishuInfo feishuInfo, String dpId) {
|
|
|
+ JSONArray result=new JSONArray();
|
|
|
+ JSONArray subDepartmentList = feishuInfoService.getSubDepartmentList(feishuInfo, dpId, null);
|
|
|
+ result.addAll(subDepartmentList);
|
|
|
+ if(subDepartmentList!=null&&subDepartmentList.size()>0){
|
|
|
+ for (int i = 0; i < subDepartmentList.size(); i++) {
|
|
|
+ JSONObject ob = subDepartmentList.getJSONObject(i);
|
|
|
+ if(ob.getString("open_department_id")!=null){
|
|
|
+ JSONArray array = getSubDepartmentList(feishuInfo,ob.getString("open_department_id"));
|
|
|
+ result.addAll(array);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ //将部门id转换为部门层级
|
|
|
+ private String convertDepartmentIdToCascade(Integer id, List<Department> allDeptList) {
|
|
|
+ StringBuilder cascade = new StringBuilder();
|
|
|
+ if (id == 0) {
|
|
|
+ cascade.append("0");
|
|
|
+ } else {
|
|
|
+ cascade.append(id);
|
|
|
+ id = findById(id, allDeptList).getSuperiorId();
|
|
|
+ while (id != null) {
|
|
|
+ cascade.append(",").append(id);
|
|
|
+ id = findById(id, allDeptList).getSuperiorId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return cascade.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ private Department findById(int id, List<Department> allList) {
|
|
|
+ return allList.stream().filter(all->all.getDepartmentId().intValue() == id).findFirst().get();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/loginByFeishu")
|
|
|
+ public HttpRespMsg loginByFeishu(String code,String appId){
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
+ FeishuInfo feishuInfo = feishuInfoService.getOne(new QueryWrapper<FeishuInfo>().eq("app_id", appId));
|
|
|
+ String url = FeishuInfoServiceImpl.GET_USER_ACCESS_TOKEN;
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
|
|
|
+ headers.setContentType(type);
|
|
|
+ headers.add("Authorization","Bearer "+feishuInfoService.getAppAccessToken(feishuInfo));
|
|
|
+ JSONObject ob = new JSONObject();
|
|
|
+ ob.put("grant_type", "authorization_code");
|
|
|
+ ob.put("code", code);
|
|
|
+ HttpEntity<JSONObject> Entity = new HttpEntity<>(ob, headers);
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, Entity, String.class);
|
|
|
+ String redirecUrl = null;
|
|
|
+ String openUserId=null;
|
|
|
+ String fsUserId=null;
|
|
|
+ String corpId=null;
|
|
|
+ if (responseEntity.getStatusCode() == HttpStatus.OK) {
|
|
|
+ String resp = responseEntity.getBody();
|
|
|
+ System.err.println(resp);
|
|
|
+ JSONObject obj = JSONObject.parseObject(resp);
|
|
|
+ if (obj.getIntValue("code") == 0) {
|
|
|
+ System.out.println(obj.toString());
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
+ fsUserId = data.getString("user_id");
|
|
|
+ openUserId = data.getString("open_id");
|
|
|
+ corpId = data.getString("tenant_key");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("feishu_userid", openUserId));
|
|
|
+ Integer companyId = 0;
|
|
|
+ if (userList.size() > 0) {
|
|
|
+ //该用户已存在
|
|
|
+ User curUser = userList.get(0);
|
|
|
+ System.out.println("找到用户corpFeishuUserid=="+curUser.getFeishuUserid());
|
|
|
+ companyId = curUser.getCompanyId();
|
|
|
+ String userId = curUser.getId();
|
|
|
+ if (StringUtils.isEmpty(userId) || userId.length() > 50) {
|
|
|
+ //httpRespMsg.setError("账号不存在");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.accountNoExist"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
+ if (user == null) {
|
|
|
+ //httpRespMsg.setError("账号不存在");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.accountNoExist"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ if (user.getIsActive() == 0) {
|
|
|
+ //httpRespMsg.setError("该账号已停用");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.accountDeactivation"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ //查看该公司非会员公司,只能允许试用三天,超时不可登录
|
|
|
+ Company company = companyMapper.selectOne(new QueryWrapper<Company>().eq("id", user.getCompanyId()));
|
|
|
+ //公司未办理会员
|
|
|
+ if (null != company.getExpirationDate()) {
|
|
|
+ if (0 == company.getSetMeal()) {
|
|
|
+ //未办理会员
|
|
|
+ if (company.getExpirationDate().isBefore(LocalDateTime.now())) {
|
|
|
+ //httpRespMsg.setError("账号试用已到期,请联系客服。");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.accountExpired"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (company.getExpirationDate().isBefore(LocalDateTime.now())) {
|
|
|
+ //httpRespMsg.setError("账号会员已到期,请联系客服。");
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.memberExpired"));
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ UserVO userVO = new UserVO().setCompanyName(company.getCompanyName());
|
|
|
+ userVO.setCompany(company);
|
|
|
+ BeanUtils.copyProperties(user, userVO);
|
|
|
+ //还要多返回一个公司名字
|
|
|
+ userVO.setPassword("");
|
|
|
+ LocalDateTime remainingTime = company.getExpirationDate() == null ? LocalDateTime.now() : company.getExpirationDate();
|
|
|
+ userVO.setRemainingTime(remainingTime.toInstant(ZoneOffset.of("+8")).toEpochMilli() -
|
|
|
+ LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
|
|
+ //检测是否是项目经理,项目经理有审核功能权限
|
|
|
+ userVO.setLeader(judgeIsLeader(userVO.getId()));
|
|
|
+ userVO.setTimeType(timeTypeMapper.selectById(company.getId()));
|
|
|
+ List<Department> manageDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", userVO.getId()));
|
|
|
+ List<Integer> deptIds = manageDeptList.stream().map(Department::getDepartmentId).collect(Collectors.toList());
|
|
|
+ //获取当前角色的权限菜单
|
|
|
+ setUserRoleMenu(userVO);
|
|
|
+ httpRespMsg.data = userVO;
|
|
|
+ return httpRespMsg;
|
|
|
+ }else httpRespMsg.setError("飞书用户未开通");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean judgeIsLeader(String userId) {
|
|
|
+ int cnt = projectAuditorMapper.selectCount(new QueryWrapper<ProjectAuditor>().eq("auditor_id", userId));
|
|
|
+ return cnt>0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUserRoleMenu(UserVO user) {
|
|
|
+ Integer roleId = user.getRoleId();
|
|
|
+ //获取公司的套餐
|
|
|
+ Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(company.getId());
|
|
|
+ //按照公司开通的模块进行匹配
|
|
|
+ QueryWrapper<SysModule> queryWrapper = new QueryWrapper<SysModule>().eq("package_time", 1);
|
|
|
+ if (company.getPackageProject() == 1) {
|
|
|
+ queryWrapper.or().eq("package_project", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageOa() == 1) {
|
|
|
+ queryWrapper.or().eq("package_oa", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageExpense() == 1) {
|
|
|
+ queryWrapper.or().eq("package_expense", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageCustomer() == 1) {
|
|
|
+ queryWrapper.or().eq("package_customer", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageEngineering() == 1) {
|
|
|
+ queryWrapper.or().eq("package_engineering", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageContract() == 1) {
|
|
|
+ queryWrapper.or().eq("package_contract", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageEtimecard()== 1) {
|
|
|
+ queryWrapper.or().eq("package_etimecard", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageFinance() == 1) {
|
|
|
+ queryWrapper.or().eq("package_finance", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageProvider() == 1) {
|
|
|
+ queryWrapper.or().eq("package_provider", 1);
|
|
|
+ }
|
|
|
+ if (timeType.getReportWorkflow() == 1) {
|
|
|
+ queryWrapper.or().eq("report_workflow", 1);
|
|
|
+ }
|
|
|
+ if (timeType.getNeedDeptAudit() == 1) {
|
|
|
+ queryWrapper.or().eq("need_dept_audit", 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ queryWrapper.orderByAsc("orderitem");
|
|
|
+
|
|
|
+ //返回菜单
|
|
|
+ List<SysRoleModule> rModules = sysRoleModuleMapper.selectList(new QueryWrapper<SysRoleModule>().eq("role_id", roleId));
|
|
|
+ List<Integer> ids = rModules.stream().map(SysRoleModule::getModuleId).collect(Collectors.toList());
|
|
|
+ //项目报告审核模块,如果参与日报的审核,需要自动加上, 或者担任任务分组负责人
|
|
|
+ if (user.isLeader() || user.isHasAuditDept() || (company.getPackageProject() == 1 && taskGroupMapper.selectCount(new QueryWrapper<TaskGroup>().eq("incharger_id", user.getId())) > 0)) {
|
|
|
+ SysModule projectAuditModule = sysModuleMapper.selectOne(new QueryWrapper<SysModule>().eq("name", "项目报告审核"));
|
|
|
+ if (!ids.contains(projectAuditModule.getId())) {
|
|
|
+ ids.add(projectAuditModule.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysModule> moduleList = sysModuleMapper.selectList(queryWrapper);
|
|
|
+
|
|
|
+ //过滤一下,这个角色选中的模块
|
|
|
+ moduleList = moduleList.stream().filter(m->ids.contains(m.getId())).collect(Collectors.toList());
|
|
|
+ if (company.getPackageEngineering() == 1) {
|
|
|
+ //生成虚拟的两个审核放进去
|
|
|
+ SysModule proModule = new SysModule();
|
|
|
+ proModule.setName("专业审核");
|
|
|
+ proModule.setPath("/reviewProfession");
|
|
|
+ proModule.setId(0);
|
|
|
+ moduleList.add(1,proModule);
|
|
|
+ SysModule deptModule = new SysModule();
|
|
|
+ deptModule.setName("部门审核");
|
|
|
+ deptModule.setPath("/reviewDepartment");
|
|
|
+ deptModule.setId(0);
|
|
|
+ moduleList.add(2,deptModule);
|
|
|
+ }
|
|
|
+ //开启了自定义日报列表的情况下,需要菜单上有
|
|
|
+ if (timeType.getCustomDegreeActive() == 1 && moduleList.stream().anyMatch(mod->mod.getName().equals("系统基础设置"))) {
|
|
|
+ SysModule centerManageModule = new SysModule();
|
|
|
+ //centerManageModule.setName(timeType.getCustomDegreeName()+"管理");
|
|
|
+ centerManageModule.setName(timeType.getCustomDegreeName()+MessageUtils.message("project.manage"));
|
|
|
+ centerManageModule.setPath("/centerManage");
|
|
|
+ centerManageModule.setId(0);
|
|
|
+ //加到组织架构前面
|
|
|
+ int findIndex = 0;
|
|
|
+ for (int i=0;i<moduleList.size(); i++) {
|
|
|
+ if (moduleList.get(i).getName().equals("组织架构") || moduleList.get(i).getName().equals("基础数据管理")) {
|
|
|
+ findIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ moduleList.add(findIndex,centerManageModule);
|
|
|
+ }
|
|
|
+ //组装层级关系,默认只有两级
|
|
|
+ List<SysModule> menuList = new ArrayList<>();
|
|
|
+ for (SysModule module : moduleList) {
|
|
|
+ if (module.getParentId() == null) {
|
|
|
+ menuList.add(module);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (SysModule mainMenu : menuList) {
|
|
|
+ List<SysModule> list = moduleList.stream().filter(mod -> mainMenu.getId().equals(mod.getParentId())).collect(Collectors.toList());
|
|
|
+ mainMenu.setChildren(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ user.setModuleList(menuList);
|
|
|
+ //此处返回权限集合
|
|
|
+ List<Integer> functionIdList = new ArrayList<>();
|
|
|
+ //获取角色所有的功能id
|
|
|
+ List<SysRoleFunction> funList = sysRoleFunctionMapper.selectList(new QueryWrapper<SysRoleFunction>()
|
|
|
+ .eq("role_id", roleId));
|
|
|
+ for (SysRoleFunction sysRoleFunction : funList) {
|
|
|
+ functionIdList.add(sysRoleFunction.getFunctionId());
|
|
|
+ }
|
|
|
+ //获取当前公司开启了得报表
|
|
|
+ List<CompanyReport> companyReportList = companyReportMapper.selectList(new QueryWrapper<CompanyReport>().eq("company_id", company.getId()));
|
|
|
+ List<Integer> formIds = companyReportList.stream().map(CompanyReport::getReportFormId).collect(Collectors.toList());
|
|
|
+ if (functionIdList.size() > 0) {
|
|
|
+ //根据功能id获取可用的操作代码
|
|
|
+ if (formIds.size() == 0) {
|
|
|
+ formIds.add(-1);
|
|
|
+ }
|
|
|
+ QueryWrapper<SysFunction> functionQueryWrapper = new QueryWrapper<SysFunction>().and(wrapper1->wrapper1.isNull("report_form_id").or().in("report_form_id",formIds)).and(wrapper->{
|
|
|
+ wrapper.eq("package_time", 1);
|
|
|
+ if (company.getPackageProject() == 1) {
|
|
|
+ wrapper.or().eq("package_project", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageOa() == 1) {
|
|
|
+ wrapper.or().eq("package_oa", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageExpense() == 1) {
|
|
|
+ wrapper.or().eq("package_expense", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageCustomer() == 1) {
|
|
|
+ wrapper.or().eq("package_customer", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageEngineering() == 1) {
|
|
|
+ wrapper.or().eq("package_engineering", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageContract() == 1) {
|
|
|
+ wrapper.or().eq("package_contract", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageEtimecard()== 1) {
|
|
|
+ wrapper.or().eq("package_etimecard", 1);
|
|
|
+ }
|
|
|
+ if (company.getPackageFinance() == 1) {
|
|
|
+ wrapper.or().eq("package_finance", 1);
|
|
|
+ }
|
|
|
+// if (company.getPackageProvider() == 1) {
|
|
|
+// wrapper.or().eq("package_provider", 1);
|
|
|
+// }
|
|
|
+ if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
+ wrapper.or().eq("sync_corpwx_time", 1);
|
|
|
+ }
|
|
|
+ //开通财务审核功能的
|
|
|
+ if (timeType.getFinanceAudit() == 1) {
|
|
|
+ wrapper.or().eq("finance_audit", 1);
|
|
|
+ }
|
|
|
+ return wrapper;
|
|
|
+ });
|
|
|
+ functionQueryWrapper.orderByAsc("seq");
|
|
|
+ List<SysFunction> functionList = sysFunctionMapper.selectList(functionQueryWrapper);
|
|
|
+ functionList = functionList.stream().filter(f->functionIdList.contains(f.getId())).collect(Collectors.toList());
|
|
|
+ user.setFunctionList(functionList);
|
|
|
+ } else {
|
|
|
+ user.setFunctionList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/initSuperManager")
|
|
|
+ public HttpRespMsg initSuperManager(String corpid, String name) {
|
|
|
+ return feishuInfoService.initSuperManager(corpid, name);
|
|
|
+ }
|
|
|
+
|
|
|
+ //"企业微信数据回调"
|
|
|
+ @RequestMapping(value = "/dataCallback", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void dataCallback(@RequestBody JSONObject jsonParam, HttpServletResponse response) throws IOException {
|
|
|
+ //用于验证飞书的部分
|
|
|
+ PrintWriter out = null;
|
|
|
+ JSONObject jsonObject=new JSONObject();
|
|
|
+ if(jsonParam.getString("challenge")!=null){
|
|
|
+ jsonObject.put("challenge",jsonParam.getString("challenge"));
|
|
|
+ //设定类容为json的格式
|
|
|
+ response.setContentType("application/json;charset=UTF-8");
|
|
|
+ out = response.getWriter();
|
|
|
+ //写到客户端
|
|
|
+ out.write(jsonObject.toJSONString());
|
|
|
+ out.flush();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("============回调参数==========="+jsonParam.toJSONString());
|
|
|
+ JSONObject headerOb =jsonParam.getJSONObject("header");
|
|
|
+ if(headerOb==null||headerOb.size()<=0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject eventOb = jsonParam.getJSONObject("event");
|
|
|
+ log.info("=========event======"+eventOb.toJSONString());
|
|
|
+ String appId = headerOb.getString("app_id");
|
|
|
+ log.info("========app_id========"+appId);
|
|
|
+ String tenantKey = headerOb.getString("tenant_key");
|
|
|
+ log.info("========tenant_key========"+tenantKey);
|
|
|
+ String createTime = headerOb.getString("create_time");
|
|
|
+ log.info("========create_time========"+createTime);
|
|
|
+ List<FeishuInfo> feishuInfoList = feishuInfoMapper.selectList(new QueryWrapper<FeishuInfo>().eq("app_id", appId));
|
|
|
+ if(feishuInfoList.size()>0){
|
|
|
+ FeishuInfo feishuInfo = feishuInfoList.get(0);
|
|
|
+ List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", feishuInfo.getCompanyId()));
|
|
|
+ SysRole role = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id",feishuInfo.getCompanyId()).eq("rolename","普通员工"));
|
|
|
+ //通讯录权限范围变更
|
|
|
+ //todo:新增的
|
|
|
+ if(eventOb!=null&&eventOb.getJSONObject("added").size()>0){
|
|
|
+ JSONObject addedOb = eventOb.getJSONObject("added");
|
|
|
+ //todo:处理部门
|
|
|
+ JSONArray departmentArray = addedOb.getJSONArray("departments");
|
|
|
+ JSONArray allNeedTodo=new JSONArray();
|
|
|
+ allNeedTodo.addAll(departmentArray);
|
|
|
+ for (int i = 0; i < departmentArray.size(); i++) {
|
|
|
+ JSONObject ob = departmentArray.getJSONObject(i);
|
|
|
+ JSONArray jsonArray = getSubDepartmentList(feishuInfo, ob.getString("open_department_id"));
|
|
|
+ if(jsonArray!=null&&jsonArray.size()>0){
|
|
|
+ allNeedTodo.addAll(jsonArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Department> departmentList=new ArrayList<>();
|
|
|
+ List<DepartmentFeishu> departmentFeishuList=new ArrayList<>();
|
|
|
+ for (int j = 0; j < allNeedTodo.size(); j++) {
|
|
|
+ JSONObject ob = allNeedTodo.getJSONObject(j);
|
|
|
+ String departmentName = String.valueOf(ob.get("name"));
|
|
|
+ System.out.println("synchronizationDP========="+departmentName);
|
|
|
+ String departmentId = String.valueOf(ob.getString("department_id"));
|
|
|
+ String openDepartmentId = String.valueOf(ob.getString("open_department_id"));
|
|
|
+ String departmentParentId =String.valueOf(ob.getString("parent_department_id"));
|
|
|
+ JSONArray leaders = ob.getJSONArray("leaders");
|
|
|
+ Integer cut = departmentFeishuMapper.selectCount(new QueryWrapper<DepartmentFeishu>().eq("corpid",feishuInfo.getCorpid()).eq("feishu_deptid",departmentId));
|
|
|
+ if(cut==0&&!departmentId.equals("0")){
|
|
|
+ System.out.println("join===========");
|
|
|
+ DepartmentFeishu departmentFeishu=new DepartmentFeishu();
|
|
|
+ departmentFeishu.setCorpid(feishuInfo.getCorpid())
|
|
|
+ .setName(departmentName)
|
|
|
+ .setFeishuParentid(departmentParentId)
|
|
|
+ .setFeishuDeptid(departmentId)
|
|
|
+ .setFeishuOpenDeptid(openDepartmentId);
|
|
|
+ Department department = new Department();
|
|
|
+ department.setCompanyId(feishuInfo.getCompanyId());
|
|
|
+ department.setDepartmentName(departmentName);
|
|
|
+ department.setFeishuDeptid(openDepartmentId);
|
|
|
+ departmentMapper.insert(department);
|
|
|
+ List<DepartmentOtherManager> odList=new ArrayList<>();
|
|
|
+ if(leaders!=null&&leaders.size()>0){
|
|
|
+ //todo:处理主要负责人
|
|
|
+ Optional<Object> first = leaders.stream().filter(l -> ((JSONObject) l).getIntValue("leaderType") == 1).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ JSONObject firstOb = (JSONObject) first.get();
|
|
|
+ Optional<User> leaderID = allUserList.stream().filter(ul -> ul.getFeishuUserid().equals(firstOb.getString("leaderID"))).findFirst();
|
|
|
+ if(leaderID.isPresent()){
|
|
|
+ department.setManagerId(leaderID.get().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //todo:处理次要负责人
|
|
|
+ List<Object> othObs = leaders.stream().filter(l -> ((JSONObject) l).getIntValue("leaderType") == 2).collect(Collectors.toList());
|
|
|
+ for (Object othOb : othObs) {
|
|
|
+ JSONObject oth = (JSONObject) othOb;
|
|
|
+ Optional<User> leaderID = allUserList.stream().filter(ul -> ul.getFeishuUserid().equals(oth.getString("leaderID"))).findFirst();
|
|
|
+ if(leaderID.isPresent()){
|
|
|
+ DepartmentOtherManager departmentOtherManager=new DepartmentOtherManager();
|
|
|
+ departmentOtherManager.setCompanyId(feishuInfo.getCompanyId());
|
|
|
+ departmentOtherManager.setDepartmentId(department.getDepartmentId());
|
|
|
+ departmentOtherManager.setOtherManagerId(leaderID.get().getId());
|
|
|
+ odList.add(departmentOtherManager);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ departmentMapper.updateById(department);
|
|
|
+ departmentList.add(department);
|
|
|
+ departmentFeishu.setSysDeptid(department.getDepartmentId());
|
|
|
+ departmentFeishuMapper.insert(departmentFeishu);
|
|
|
+ departmentFeishuList.add(departmentFeishu);
|
|
|
+ departmentOtherManagerService.saveBatch(odList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<User> newUserList=new ArrayList<>();
|
|
|
+ for (DepartmentFeishu departmentFeishu : departmentFeishuList) {
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(departmentFeishu.getSysDeptid())).findFirst();
|
|
|
+ //获取到当前部门的上级部门
|
|
|
+ Optional<DepartmentFeishu> wx = departmentFeishuList.stream().filter(dl -> dl.getFeishuOpenDeptid().equals(departmentFeishu.getFeishuParentid())).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ if(wx.isPresent()){
|
|
|
+ Optional<Department> dp = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(wx.get().getSysDeptid())).findFirst();
|
|
|
+ if(dp.isPresent()){
|
|
|
+ first.get().setSuperiorId(dp.get().getDepartmentId());
|
|
|
+ departmentMapper.updateById(first.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //处理部门下的人员
|
|
|
+ JSONArray userInfoWithDepartment=feishuInfoService.getUserInfoWithDepartment(feishuInfo,departmentFeishu.getFeishuOpenDeptid(),null);
|
|
|
+ for (int m=0;m<userInfoWithDepartment.size(); m++) {
|
|
|
+ JSONObject userJson = userInfoWithDepartment.getJSONObject(m);
|
|
|
+ String curUserid = userJson.getString("user_id");
|
|
|
+ String openUserid = userJson.getString("open_id");
|
|
|
+ if(!userJson.getJSONObject("status").getBoolean("is_activated")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<String> departments = (List<String>) userJson.get("department_ids");
|
|
|
+ System.out.println("user info======:"+userJson.toString());
|
|
|
+ boolean b = allUserList.stream().anyMatch(al -> al.getFeishuUserid() != null && al.getFeishuUserid().equals(userJson.getString("open_id")));
|
|
|
+ if(!b){
|
|
|
+ //不存在的人员, 进行插入
|
|
|
+ User user = new User();
|
|
|
+ //在当前部门下的员工
|
|
|
+ user.setId(SnowFlake.nextId()+"")
|
|
|
+ .setRoleId(role.getId())//默认普通员工
|
|
|
+ .setRoleName(role.getRolename())
|
|
|
+ .setCompanyId(feishuInfo.getCompanyId())
|
|
|
+ .setName(userJson.getString("name"))
|
|
|
+ .setFeishuUserid(openUserid)
|
|
|
+ .setColor(ColorUtil.randomColor())
|
|
|
+ .setJobNumber(curUserid)
|
|
|
+ .setPassword(MD5Util.getPassword("000000"))
|
|
|
+ .setFeishuDeptid(departmentFeishu.getFeishuDeptid());
|
|
|
+ String max = departments.get(0);
|
|
|
+ Optional<DepartmentFeishu> dpFs = departmentFeishuList.stream().filter(dl -> dl.getFeishuOpenDeptid().equals(max)).findFirst();
|
|
|
+ if(dpFs.isPresent()){
|
|
|
+ Optional<Department> dp = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(dpFs.get().getSysDeptid())).findFirst();
|
|
|
+ if(dp.isPresent()){
|
|
|
+ user.setDepartmentName(dp.get().getDepartmentName());
|
|
|
+ user.setDepartmentId(dp.get().getDepartmentId());
|
|
|
+ user.setDepartmentCascade(convertDepartmentIdToCascade(dp.get().getDepartmentId(),departmentList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean c = newUserList.stream().anyMatch(ul ->ul.getFeishuUserid()!=null&&ul.getFeishuUserid().equals(user.getFeishuUserid()));
|
|
|
+ if(!c){
|
|
|
+ newUserList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //todo:处理人员
|
|
|
+ JSONArray userArrays = addedOb.getJSONArray("users");
|
|
|
+ if(userArrays!=null&&userArrays.size()>0){
|
|
|
+ for (int i = 0; i < userArrays.size(); i++) {
|
|
|
+ JSONObject userOb = userArrays.getJSONObject(i);
|
|
|
+ boolean b = allUserList.stream().anyMatch(al -> al.getFeishuUserid() != null && al.getFeishuUserid().equals(userOb.getString("open_id")));
|
|
|
+ if(!b){
|
|
|
+ //不存在的人员, 进行插入
|
|
|
+ User user = new User();
|
|
|
+ user.setId(SnowFlake.nextId()+"")
|
|
|
+ .setRoleId(role.getId())//默认普通员工
|
|
|
+ .setRoleName(role.getRolename())
|
|
|
+ .setCompanyId(feishuInfo.getCompanyId())
|
|
|
+ .setName(userOb.getString("name"))
|
|
|
+ .setFeishuUserid(userOb.getString("open_id"))
|
|
|
+ .setColor(ColorUtil.randomColor())
|
|
|
+ .setJobNumber(userOb.getString("user_id"))
|
|
|
+ .setPassword(MD5Util.getPassword("000000"));
|
|
|
+ boolean c = newUserList.stream().anyMatch(ul ->ul.getFeishuUserid()!=null&&ul.getFeishuUserid().equals(user.getFeishuUserid()));
|
|
|
+ if(!c){
|
|
|
+ newUserList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(newUserList.size()>0){
|
|
|
+ userService.saveBatch(newUserList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //todo:移除的
|
|
|
+ if(eventOb.getJSONObject("removed")!=null){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|