Pārlūkot izejas kodu

优化同步账号信息接口

xingguoqiang 3 gadi atpakaļ
vecāks
revīzija
c1d688146f
35 mainītis faili ar 1064 papildinājumiem un 101 dzēšanām
  1. 31 3
      saas-sso/pom.xml
  2. 5 1
      saas-sso/src/main/java/com/persagy/sso/SsoServerApplication.java
  3. 14 14
      saas-sso/src/main/java/com/persagy/sso/client/FmPersonClient.java
  4. 12 3
      saas-sso/src/main/java/com/persagy/sso/client/SaasAccountClient.java
  5. 12 1
      saas-sso/src/main/java/com/persagy/sso/constant/BaseConstant.java
  6. 5 0
      saas-sso/src/main/java/com/persagy/sso/constant/FeignClientNameConstant.java
  7. 1 1
      saas-sso/src/main/java/com/persagy/sso/controller/AccountReflexController.java
  8. 3 3
      saas-sso/src/main/java/com/persagy/sso/controller/DeptReflexController.java
  9. 3 3
      saas-sso/src/main/java/com/persagy/sso/controller/JobReflexController.java
  10. 8 8
      saas-sso/src/main/java/com/persagy/sso/controller/UserController.java
  11. 84 0
      saas-sso/src/main/java/com/persagy/sso/controller/WdAccountController.java
  12. 240 17
      saas-sso/src/main/java/com/persagy/sso/manage/SynUserManage.java
  13. 3 0
      saas-sso/src/main/java/com/persagy/sso/mapper/AccountReflexMapper.java
  14. 19 0
      saas-sso/src/main/java/com/persagy/sso/mapper/WdAccountMapper.java
  15. 20 1
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/AccountDTO.java
  16. 1 2
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/AddJobDTO.java
  17. 2 2
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/AddPersonDTO.java
  18. 1 1
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryDeptDTO.java
  19. 1 4
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryJobDTO.java
  20. 22 0
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryPersonDTO.java
  21. 264 0
      saas-sso/src/main/java/com/persagy/sso/pojo/dto/WdAccount.java
  22. 26 1
      saas-sso/src/main/java/com/persagy/sso/service/IAccountService.java
  23. 1 1
      saas-sso/src/main/java/com/persagy/sso/service/IDeptService.java
  24. 2 2
      saas-sso/src/main/java/com/persagy/sso/service/IPersonService.java
  25. 1 0
      saas-sso/src/main/java/com/persagy/sso/service/IUserService.java
  26. 17 0
      saas-sso/src/main/java/com/persagy/sso/service/IWdAccountService.java
  27. 31 0
      saas-sso/src/main/java/com/persagy/sso/service/impl/AccountService.java
  28. 1 1
      saas-sso/src/main/java/com/persagy/sso/service/impl/DeptService.java
  29. 4 4
      saas-sso/src/main/java/com/persagy/sso/service/impl/PersonService.java
  30. 147 26
      saas-sso/src/main/java/com/persagy/sso/service/impl/SynUserService.java
  31. 24 1
      saas-sso/src/main/java/com/persagy/sso/service/impl/UserServiceImpl.java
  32. 21 0
      saas-sso/src/main/java/com/persagy/sso/service/impl/WdAccountServiceImpl.java
  33. 1 1
      saas-sso/src/main/resources/mapper/JobReflexMapper.xml
  34. 13 0
      saas-sso/src/main/resources/mapper/UserMapper.xml
  35. 24 0
      saas-sso/src/main/resources/mapper/WdAccountMapper.xml

+ 31 - 3
saas-sso/pom.xml

@@ -28,10 +28,10 @@
             <groupId>com.persagy</groupId>
             <artifactId>integrated-swagger2-spring-boot-starter</artifactId>
         </dependency>
-        <dependency>
+       <!-- <dependency>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-db-spring-boot-starter</artifactId>
-        </dependency>
+        </dependency>-->
         <dependency>
             <groupId>com.persagy</groupId>
             <artifactId>integrated-redis-spring-boot-starter</artifactId>
@@ -62,10 +62,38 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
         </dependency>
+
+        <!--多数据源配置-->
+<!--        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>fm-mybatis</artifactId>
+            <version>3.0.0</version>
+            <scope>compile</scope>
+        </dependency>-->
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.3</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.4.1</version>
+            <optional>true</optional>
+        </dependency>
+
     </dependencies>
 
     <build>
-        <finalName>saas-account</finalName>
+        <finalName>saas-sso</finalName>
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>

+ 5 - 1
saas-sso/src/main/java/com/persagy/sso/SsoServerApplication.java

@@ -1,17 +1,21 @@
 package com.persagy.sso;
 
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
-@SpringBootApplication
+@SpringBootApplication(exclude= {DruidDataSourceAutoConfigure.class})
 @ServletComponentScan
 @EnableDiscoveryClient
 @EnableFeignClients(basePackages = "com.persagy.sso.client")
 @EnableTransactionManagement
+@MapperScan("com.persagy.sso.mapper")
 public class SsoServerApplication {
 
 	public static void main(String[] args) {

+ 14 - 14
saas-sso/src/main/java/com/persagy/sso/client/FmPersonClient.java

@@ -30,7 +30,7 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/departments/create")
+    @PostMapping("/fm-person/departments/create")
     ResponseResult saveDept(@RequestBody AddDepartmentDTO addDepartmentDTO, @RequestHeader("token") String token);
 
     /**
@@ -40,7 +40,7 @@ public interface FmPersonClient {
      * @param idDTO:
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/departments/delete")
+    @PostMapping("/fm-person/departments/delete")
     ResponseResult deleteDept(@RequestBody IdDTO idDTO);
 
 
@@ -52,7 +52,7 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/saasRoles/create")
+    @PostMapping("/fm-person/saasRoles/create")
     ResponseResult saveJob(@RequestBody AddJobDTO addJobDTO,@RequestHeader("token") String token);
 
 
@@ -63,7 +63,7 @@ public interface FmPersonClient {
      * @param idDTO:
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/saasRoles/delete")
+    @PostMapping("/fm-person/saasRoles/delete")
     ResponseResult deleteJob(@RequestBody IdDTO idDTO);
 
     /**
@@ -74,7 +74,7 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/persons/sync_create")
+    @PostMapping("/fm-person/persons/sync_create")
     ResponseResult savePerson(@RequestBody AddPersonDTO addPersonDTO,@RequestHeader("token") String token);
 
 
@@ -85,7 +85,7 @@ public interface FmPersonClient {
      * @param idDTO:
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/departments/get")
+    @PostMapping("/fm-person/departments/get")
     ResponseResult queryDeptById(@RequestBody IdDTO idDTO);
 
     /**
@@ -96,7 +96,7 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/departments/update")
+    @PostMapping("/fm-person/departments/update")
     ResponseResult updateDept(@RequestBody AddDepartmentDTO addDepartmentDTO, @RequestHeader("token") String token);
 
 
@@ -109,7 +109,7 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/saasRoles/update")
+    @PostMapping("/fm-person/saasRoles/update")
     ResponseResult updateJob(@RequestBody AddJobDTO addJobDTO,@RequestHeader("token") String token);
 
     /**
@@ -120,28 +120,28 @@ public interface FmPersonClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/persons/update")
+    @PostMapping("/fm-person/persons/update")
     ResponseResult updatePerson(@RequestBody AddPersonDTO addPersonDTO, @RequestHeader("token") String token);
 
 
     /**
-     * @Description: 查询集团级部门
+     * @Description: 根据条件查询部门信息
      * @Author: xgq
      * @Date: 2021/4/15 19:56
      * @param queryDeptDTO :
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/departments/query")
+    @PostMapping("/fm-person/departments/query")
     ResponseResult queryGroupDept(@RequestBody QueryDeptDTO queryDeptDTO, @RequestHeader("token") String token);
 
     /**
      * @Description: 根据条件查询人员
      * @Author: xgq
      * @Date: 2021/4/16 12:06
-     * @param accountDTO:
+     * @param queryPersonDTO :
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/fm-person-test/persons/queryByNameOrUsername")
-    ResponseResult queryPersonByCondition(@RequestBody  AccountDTO accountDTO, @RequestHeader("token") String token);
+    @PostMapping("/fm-person/persons/queryByUsername")
+    ResponseResult queryPersonByCondition(@RequestBody QueryPersonDTO queryPersonDTO, @RequestHeader("token") String token);
 }

+ 12 - 3
saas-sso/src/main/java/com/persagy/sso/client/SaasAccountClient.java

@@ -10,13 +10,16 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 
+import java.util.List;
+
 /**
  * @Description: 调用fm-person的接口信息
  * @Author: xgq
  * @Date: 2021/4/14 21:51
  * @return: null
  **/
-@FeignClient(name = FeignClientNameConstant.SAAS_ACCOUNT_CLIENT_NAME, fallbackFactory = SaasAccountClientFallbackFactory.class,
+@FeignClient(name = FeignClientNameConstant.SAAS_ACCOUNT_CLIENT_NAME,
+        url=FeignClientNameConstant.SAAS_ACCOUNT_CLIENT_URL ,fallbackFactory = SaasAccountClientFallbackFactory.class,
         configuration = FeignConfig.class)
 public interface SaasAccountClient {
 
@@ -27,7 +30,7 @@ public interface SaasAccountClient {
      * @param accountDTO:
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/account/querySaasAccountList")
+    @PostMapping("/account/querySaasAccountByUsername")
     ResponseResult queryAccountByCondition(@RequestBody  AccountDTO accountDTO);
 
     /**
@@ -71,6 +74,12 @@ public interface SaasAccountClient {
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
-    @PostMapping("/role/querySaasRoleList")
+    @PostMapping("/role/querySaasRoleByName")
     ResponseResult queryJobBuCondition(@RequestBody QueryJobDTO queryJobDTO,@RequestHeader("token") String token);
+
+    @PostMapping("/account/querySaasAccountList")
+    ResponseResult queryAccountListBySource(@RequestBody  AccountDTO accountDTO,@RequestHeader("token")  String token);
+
+    @PostMapping("/account/deleteSaasAccountListByIds")
+    ResponseResult deleteByIds(@RequestBody AccountDTO accountDTO, @RequestHeader("token") String token);
 }

+ 12 - 1
saas-sso/src/main/java/com/persagy/sso/constant/BaseConstant.java

@@ -45,6 +45,11 @@ public class BaseConstant {
     public static String ACCOUNT_TYPE_NORMAL = "2";
 
 
+    /**
+     * 账号类型(2:普通账号)
+     **/
+   // public static String ACCOUNT_TYPE_WD = "100";
+
 
     /**
      * 部门类型(0:集团)
@@ -66,7 +71,7 @@ public class BaseConstant {
     /**
      * 岗位(角色)类型:0-系统角色,1-业务角色, 2-业务超管默认角色,4:万达OA同步角色
      **/
-    public static String JOB_ROLE_TYPE = "1";
+    public static String JOB_ROLE_TYPE = "4";
 
 
     /**
@@ -80,6 +85,11 @@ public class BaseConstant {
     public static String GROUP_CODE_WD = "WD";
 
     /**
+     * account-source :万达集团:201
+     **/
+    public static String ACCOUNT_SOURCE_WD = "201";
+
+    /**
      * 公共参数
      **/
     public static String ACCOUNT_ID = "accountId";
@@ -88,6 +98,7 @@ public class BaseConstant {
     public static String APP_ID = "appId";
     public static String SYSTEM_ID = "systemId";
     public static String ROLE_ID = "roleId";
+    public static String ACCOUNT_BELONG = "accountBelong";
 
 
     /**

+ 5 - 0
saas-sso/src/main/java/com/persagy/sso/constant/FeignClientNameConstant.java

@@ -25,4 +25,9 @@ public class FeignClientNameConstant {
      **/
     public static final String FM_PERSON_CLIENT_URL = "http://develop.persagy.com";
 
+
+    /**
+     * saas-account服务url
+     **/
+    public static final String SAAS_ACCOUNT_CLIENT_URL = "http://develop.persagy.com/saas-account";
 }

+ 1 - 1
saas-sso/src/main/java/com/persagy/sso/controller/AccountReflexController.java

@@ -29,7 +29,7 @@ import io.swagger.annotations.ApiOperation;
  * @date 2021-04-16 00:32:26
  */
 
-@Api(tags = "账号映射关系")
+@Api(tags = "账号映射关系,未使用")
 @RestController
 @RequestMapping(value = "/accountReflex", method = RequestMethod.POST)
 public class AccountReflexController {

+ 3 - 3
saas-sso/src/main/java/com/persagy/sso/controller/DeptReflexController.java

@@ -29,13 +29,13 @@ import io.swagger.annotations.ApiOperation;
  * @date 2021-04-15 21:48:53
  */
 
-@Api(tags = "部门映射关系")
+@Api(tags = "部门映射关系,未使用")
 @RestController
 @RequestMapping(value = "/deptReflex", method = RequestMethod.POST)
 public class DeptReflexController {
     @Autowired
     private IDeptReflexService deptReflexService;
-    
+
     /**
      * 列表查询
      */
@@ -60,7 +60,7 @@ public class DeptReflexController {
         boolean result = this.deptReflexService.save(deptReflex);
         return result ? ResponseResultUtil.successResult("保存成功") : ResponseResultUtil.errorResult("保存失败");
     }
-    
+
     /**
      * 更新
      */

+ 3 - 3
saas-sso/src/main/java/com/persagy/sso/controller/JobReflexController.java

@@ -29,13 +29,13 @@ import io.swagger.annotations.ApiOperation;
  * @date 2021-04-15 21:49:05
  */
 
-@Api(tags = "岗位映射关系")
+@Api(tags = "岗位映射关系,未使用")
 @RestController
 @RequestMapping(value = "/jobReflex", method = RequestMethod.POST)
 public class JobReflexController {
     @Autowired
     private IJobReflexService jobReflexService;
-    
+
     /**
      * 列表查询
      */
@@ -60,7 +60,7 @@ public class JobReflexController {
         boolean result = this.jobReflexService.save(jobReflex);
         return result ? ResponseResultUtil.successResult("保存成功") : ResponseResultUtil.errorResult("保存失败");
     }
-    
+
     /**
      * 更新
      */

+ 8 - 8
saas-sso/src/main/java/com/persagy/sso/controller/UserController.java

@@ -1,6 +1,7 @@
 package com.persagy.sso.controller;
 
 import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.google.common.collect.Lists;
 import com.persagy.common.utils.ResponseResult;
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -25,14 +27,13 @@ import java.util.List;
  * @author zhangqiankun
  * @date 2021-04-13 14:55:06
  */
-
-@Api(tags = "对接用户信息")
+@Api(tags = "对接用户信息,仅做测试")
 @RestController
 @RequestMapping(value = "/wdUser", method = RequestMethod.POST)
 public class UserController {
     @Autowired
     private IUserService wdUserService;
-    
+
     /**
      * 列表查询
      */
@@ -52,12 +53,11 @@ public class UserController {
      * 新增
      */
 	@ApiOperation(value = "保存用户信息")
-//	@RequestMapping(value = "createWdUser")
-    public ResponseResult createWdUser(@RequestBody WdUser wdUser) {
-        boolean result = this.wdUserService.save(wdUser);
-        return result ? ResponseResultUtil.successResult("保存成功") : ResponseResultUtil.errorResult("保存失败");
+	@RequestMapping(value = "createWdUser")
+    public ResponseResult createWdUser() {
+        wdUserService.createWdUser();
+        return ResponseResultUtil.successResult(new ArrayList<>());
     }
-    
     /**
      * 更新
      */

+ 84 - 0
saas-sso/src/main/java/com/persagy/sso/controller/WdAccountController.java

@@ -0,0 +1,84 @@
+package com.persagy.sso.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Lists;
+import com.persagy.common.utils.ResponseResult;
+import com.persagy.common.utils.ResponseResultUtil;
+import com.persagy.sso.pojo.dto.WdAccount;
+import com.persagy.sso.pojo.dto.WdAccount.Builder;
+import com.persagy.sso.service.IWdAccountService;
+
+import cn.hutool.core.collection.CollectionUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author xgq
+ * @date 2021-04-29 11:30:51
+ */
+
+@Api(tags = "万达账号映射信息")
+@RestController
+@RequestMapping(value = "/wdAccount", method = RequestMethod.POST)
+public class WdAccountController {
+    @Autowired
+    private IWdAccountService wdAccountService;
+
+    /**
+     * 列表查询
+     */
+    @ApiOperation(value = "列表查询")
+    @RequestMapping(value = "queryWdAccountList")
+    public ResponseResult queryWdAccountList(@RequestBody WdAccount wdAccount) {
+    	Builder builder = new WdAccount.Builder().createQueryWrapper();
+    	LambdaQueryWrapper<WdAccount> queryWrapper = builder.builderQueryWrapper();
+    	List<WdAccount> list = this.wdAccountService.list(queryWrapper);
+    	if (CollectionUtil.isEmpty(list)) {
+			return ResponseResultUtil.successResult(Lists.newArrayList(), 0L);
+		}
+        return ResponseResultUtil.successResult(list, (long)list.size());
+    }
+
+    /**
+     * 新增
+     */
+	@ApiOperation(value = "保存")
+	@RequestMapping(value = "createWdAccount")
+    public ResponseResult createWdAccount(@RequestBody WdAccount wdAccount) {
+        boolean result = this.wdAccountService.save(wdAccount);
+        return result ? ResponseResultUtil.successResult("保存成功") : ResponseResultUtil.errorResult("保存失败");
+    }
+
+    /**
+     * 更新
+     */
+	@ApiOperation(value = "更新")
+	@RequestMapping(value = "updateWdAccount")
+    public ResponseResult updateWdAccount(@RequestBody WdAccount wdAccount) {
+        boolean result = this.wdAccountService.updateById(wdAccount);
+        return result ? ResponseResultUtil.successResult("更新成功") : ResponseResultUtil.errorResult("更新失败");
+    }
+
+    /**
+     * 物理删除
+     */
+    @ApiOperation(value = "删除")
+    @RequestMapping(value = "deleteWdAccount")
+    public ResponseResult deleteWdAccount(@RequestBody WdAccount wdAccount) {
+        boolean result = this.wdAccountService.removeById(wdAccount.getId());
+        return result ? ResponseResultUtil.successResult("删除成功") : ResponseResultUtil.errorResult("删除失败");
+    }
+    
+}

+ 240 - 17
saas-sso/src/main/java/com/persagy/sso/manage/SynUserManage.java

@@ -2,18 +2,21 @@ package com.persagy.sso.manage;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.persagy.common.exception.BusinessException;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.sso.constant.BaseConstant;
 import com.persagy.sso.pojo.dto.*;
 import com.persagy.sso.service.*;
 import com.persagy.sso.util.BaseUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
+import java.util.*;
 
 /**
  * @ClassName : SynUserManage
@@ -41,6 +44,10 @@ public class SynUserManage {
     private IPersonService personService;
     @Autowired
     private IAccountService accountService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private IWdAccountService wdAccountService;
 
     /***
      * @Description: 保存部门信息
@@ -159,7 +166,7 @@ public class SynUserManage {
     }
 
     /**
-     * @Description: 查询部门信息
+     * @Description: 根据条件查询部门信息
      * @Author: xgq
      * @Date: 2021/4/15 19:51
      * @param queryDeptDTO :
@@ -194,9 +201,7 @@ public class SynUserManage {
     public JSONObject queryAccountByCondition(String username, String token) {
         AccountDTO accountDTO = new AccountDTO();
         accountDTO.setUsername(username);
-        //// TODO: 2021/4/19  根据账号名称查询账号信息
-        
-        
+       accountDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
     ResponseResult result  =   accountService.queryAccountByCondition(accountDTO);
         if(!BaseUtils.CheckResult(result)){
             throw new BusinessException("query account info error:"+BaseUtils.getMsg(result) );
@@ -291,7 +296,8 @@ public class SynUserManage {
         createDTO.setAppId(BaseConstant.APP_ID_PC);
         createDTO.setUsername(user.getUsername());
         createDTO.setAccountType(BaseConstant.ACCOUNT_TYPE_NORMAL);
-        createDTO.setAccountSource(BaseConstant.VALID_TRUE);
+        //accountSource:万达:201
+        createDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
         //账号有效期,0-期内有效,1-永久有效
         createDTO.setValidLast(BaseConstant.VALID_TRUE);
         createDTO.setValid(Integer.valueOf(BaseConstant.VALID_TRUE));
@@ -327,10 +333,10 @@ public class SynUserManage {
      * @return: com.persagy.common.utils.ResponseResult
      **/
     public JSONObject queryPersonByCondition(WdUser user, String token) {
-        AccountDTO accountDTO = new AccountDTO();
+        QueryPersonDTO queryPersonDTO = new QueryPersonDTO();
         String username = user.getUsername();
-        accountDTO.setUsername(username);
-        ResponseResult result =   personService.queryPersonByCondition(accountDTO,token);
+        queryPersonDTO.setUsername(username);
+        ResponseResult result =   personService.queryPersonByCondition(queryPersonDTO,token);
         if(!BaseUtils.CheckResult(result)){
             throw new BusinessException("query user by username  error: " +BaseUtils.getMsg(result));
         }
@@ -349,17 +355,11 @@ public class SynUserManage {
      * @Description: 根据角色名称查询角色信息
      * @Author: xgq
      * @Date: 2021/4/17 19:54
-     * @param oaJobName :
+     * @param queryJobDTO :
      * @param token
      * @return: void
      **/
-    public JSONArray  queryJobBuCondition(String oaJobName, String token) {
-        QueryJobDTO queryJobDTO = new QueryJobDTO();
-        queryJobDTO.setAccountBelong(BaseConstant.ACCOUNT_TYPE_BUSINESS);
-        queryJobDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
-        queryJobDTO.setAccountId(BaseConstant.SYSTEM_ID);
-        queryJobDTO.setAppId(BaseConstant.APP_ID_PC);
-        queryJobDTO.setRoleName(oaJobName);
+    public JSONArray  queryJobBuCondition(QueryJobDTO queryJobDTO, String token) {
         ResponseResult result = jobService.queryJobBuCondition(queryJobDTO,token);
         if(!BaseUtils.CheckResult(result)){
             throw new BusinessException("query role by name  error: " +BaseUtils.getMsg(result));
@@ -370,4 +370,227 @@ public class SynUserManage {
          }
         return roleArray;
     }
+
+    /**
+     * @Description: 查询需要同步的用户信息
+     * @Author: xgq
+     * @Date: 2021/4/28 16:16
+
+     * @return: java.util.List<com.persagy.sso.pojo.dto.WdUser>
+     **/
+    @DS("syn")
+    public List<WdUser> querySynUserList() {
+        LambdaQueryWrapper<WdUser> queryWrapper = new WdUser.Builder().createQueryWrapper().builderQueryWrapper();
+        List<WdUser> userList = userService.list(queryWrapper);
+        return userList;
+    }
+
+
+    /**
+     * @Description: 根据来源查询账号信息
+     * @Author: xgq     
+     * @Date: 2021/4/29 10:20 
+     * @param token :
+     * @return: com.alibaba.fastjson.JSONObject
+     **/
+    public JSONArray queryAccountListBySource(String token) {
+        AccountDTO accountDTO = new AccountDTO();
+        accountDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+        accountDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
+        ResponseResult result  =   accountService.queryAccountListBySource(accountDTO,token);
+        if(!BaseUtils.CheckResult(result)){
+            throw new BusinessException("query account info by resource error:"+BaseUtils.getMsg(result) );
+        }
+        JSONArray array = BaseUtils.getContent2Array(result);
+        if(null == array || (null !=array &&  array.size()==0)){
+            return null;
+        } else {
+            return array;
+        }
+    }
+
+    
+    /**
+     * @Description: 保存账号信息
+     * @Author: xgq
+     * @Date: 2021/4/29 10:49
+     * @param user:
+     * @param token:
+     * @return: void
+     **/
+    @Transactional
+    public void saveAccountItem(WdUser user, String token) {
+        //保存账号信息
+        SaasAccountCreateDTO createDTO = new SaasAccountCreateDTO();
+        createDTO.setAccountBelong(BaseConstant.ACCOUNT_TYPE_BUSINESS);
+        createDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+        createDTO.setAppId(BaseConstant.APP_ID_PC);
+        createDTO.setUsername(user.getUsername());
+        createDTO.setAccountType(BaseConstant.ACCOUNT_TYPE_NORMAL);
+        //accountSource:万达:201
+        createDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
+        //账号有效期,0-期内有效,1-永久有效
+        createDTO.setValidLast(BaseConstant.VALID_TRUE);
+        createDTO.setValid(Integer.valueOf(BaseConstant.VALID_TRUE));
+      //  createDTO.setCasType(BaseConstant.CASE_TYPE_MAJOR);
+     //   createDTO.setRoles(Arrays.asList(accountDTO));
+        ResponseResult result =   accountService.insertAccount(createDTO,token);
+        if (!BaseUtils.CheckResult(result)) {
+            throw new RuntimeException("save account info error:"+BaseUtils.getMsg(result) );
+        }
+        //保存其他信息
+        //账号id
+        String accountId = BaseUtils.getContentStr(result);
+        WdAccount wdAccount = new WdAccount();
+        wdAccount.setAccountId(accountId);
+        wdAccount.setEmployeeId(user.getEmployeeID());
+        wdAccount.setEmployeeCode(user.getEmployeeCode());
+        wdAccount.setEmployeeName(user.getEmployeeName());
+        wdAccount.setGender(user.getGender());
+        wdAccount.setUsername(user.getUsername());
+        wdAccount.setUnitId(user.getUnitID());
+        wdAccount.setUnitName(user.getUnitName());
+        wdAccount.setJobId(user.getJobId());
+        wdAccount.setJobName(user.getJobName());
+        wdAccount.setEmployeeStatusName(user.getEmployeeStatusName());
+        wdAccount.setEmployeeStatus(user.getEmployeeStatus());
+        wdAccount.setStatus(user.getStatus());
+        wdAccount.setCreateIme(new Date());
+        wdAccount.setUpdateTime(new Date());
+        boolean save = wdAccountService.save(wdAccount);
+        if(!save){
+            throw new BusinessException("save account reflex info error..." );
+        }
+    }
+
+
+
+    public void updateAccountItem(WdAccount wdAccount, WdUser user, String token) {
+        //重新赋值
+        wdAccount.setEmployeeCode(user.getEmployeeCode());
+        wdAccount.setEmployeeName(user.getEmployeeName());
+        wdAccount.setGender(user.getGender());
+        wdAccount.setUsername(user.getUsername());
+        wdAccount.setUnitId(user.getUnitID());
+        wdAccount.setUnitName(user.getUnitName());
+        wdAccount.setJobId(user.getJobId());
+        wdAccount.setJobName(user.getJobName());
+        wdAccount.setEmployeeStatusName(user.getEmployeeStatusName());
+        wdAccount.setEmployeeStatus(user.getEmployeeStatus());
+        wdAccount.setStatus(user.getStatus());
+        wdAccount.setUpdateTime(new Date());
+        boolean save = wdAccountService.updateById(wdAccount);
+        if(!save){
+            throw new BusinessException("update account reflex info error..." );
+        }
+    }
+
+
+    public List<WdAccount> queryAllReflexList() {
+        return wdAccountService.list();
+    }
+
+
+    public void deleteSynAccount(Map<String, WdAccount> reflexAccountMap, String token) {
+        //整理数据
+        List<String> idList = new ArrayList<>();
+        List<String> accountIdList = new ArrayList<>();
+        reflexAccountMap.entrySet().stream().forEach(
+                s->{
+                    WdAccount value = s.getValue();
+                    if(null !=value){
+                        idList.add(value.getId());
+                        accountIdList.add(value.getAccountId());
+                    }
+                }
+        );
+        //删除映射表的信息
+        boolean delete = wdAccountService.removeByIds(idList);
+        if(!delete){
+            throw new BusinessException("delete account reflex info error..." );
+        }
+        //删除账号表的信息
+        AccountDTO accountDTO = new AccountDTO();
+        accountDTO.setAccountBelong(BaseConstant.ACCOUNT_TYPE_BUSINESS);
+        accountDTO.setAccountType(BaseConstant.ACCOUNT_TYPE_NORMAL);
+        accountDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
+        accountDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+        accountDTO.setAppId(BaseConstant.APP_ID_PC);
+        accountDTO.setIds(accountIdList);
+             ResponseResult  result = accountService.deleteByIds(accountDTO,token);
+        if(!BaseUtils.CheckResult(result)){
+            throw new BusinessException("delete account  info error..." );
+        }
+    }
+
+
+    public void dealDeletedSynAccount(Map<String, WdAccount> reflexAccountMap, String token) throws Exception{
+        //查询之前同步的账号信息
+        JSONArray array = queryAccountListBySource(token);
+        //如果查询的数量比映射表多,说明有垃圾数据没有清除掉
+       if(null != array){
+           int mapCount = reflexAccountMap.size();
+           int arrayCount = array.size();
+           if(arrayCount > mapCount){
+               //获取多出来的数据删除
+               List<String> exitAccountIdList = new ArrayList<>();
+               reflexAccountMap.entrySet().stream().forEach(
+                       s->{
+                           WdAccount value = s.getValue();
+                           if(null !=value){
+                               exitAccountIdList.add(value.getAccountId());
+                           }
+                       }
+               );
+            // 获取需要删除的
+               List<String> deleteAccountIdList = new ArrayList<>();
+               for (int i = 0; i <array.size(); i++) {
+                   JSONObject jsonObject = array.getJSONObject(i);
+                   String id = jsonObject.getString("id");
+                   if(!exitAccountIdList.contains(id)){
+                       deleteAccountIdList.add(id);
+                   }
+               }
+               if(CollectionUtils.isNotEmpty(deleteAccountIdList)){
+                   //删除账号表的信息
+                   AccountDTO accountDTO = new AccountDTO();
+                   accountDTO.setAccountBelong(BaseConstant.ACCOUNT_TYPE_BUSINESS);
+                   accountDTO.setAccountType(BaseConstant.ACCOUNT_TYPE_NORMAL);
+                   accountDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
+                   accountDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+                   accountDTO.setAppId(BaseConstant.APP_ID_PC);
+                   accountDTO.setIds(deleteAccountIdList);
+                   ResponseResult  result = accountService.deleteByIds(accountDTO,token);
+                   if(!BaseUtils.CheckResult(result)){
+                       throw new BusinessException("delete account  info error..." );
+                   }
+               }
+           }
+       }
+    }
+
+
+    public void deleteAccountReflexById(String id) {
+        boolean result = wdAccountService.removeById(id);
+        if(!result){
+            throw new BusinessException("delete account reflex info error ...");
+        }
+    }
+
+    public JSONObject queryAccountById(String accountId ,String token) {
+        AccountDTO accountDTO = new AccountDTO();
+        accountDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+        accountDTO.setAccountSource(BaseConstant.ACCOUNT_SOURCE_WD);
+        accountDTO.setAccountId(accountId);
+        ResponseResult result  =   accountService.queryAccountById(accountDTO,token);
+        if(!BaseUtils.CheckResult(result)){
+            throw new BusinessException("query account info by resource error:"+BaseUtils.getMsg(result) );
+        }
+        JSONArray array = BaseUtils.getContent2Array(result);
+        if(null == array || (null !=array &&  array.size()==0)){
+            return null;
+        } else {
+            return array.getJSONObject(0);
+        }
+    }
 }

+ 3 - 0
saas-sso/src/main/java/com/persagy/sso/mapper/AccountReflexMapper.java

@@ -1,9 +1,11 @@
 package com.persagy.sso.mapper;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.persagy.sso.pojo.dto.AccountReflex;
+import org.springframework.stereotype.Repository;
 
 /**
  * 
@@ -14,6 +16,7 @@ import com.persagy.sso.pojo.dto.AccountReflex;
  * @date 2021-04-16 00:32:26
  */
 @Mapper
+@Repository
 public interface AccountReflexMapper extends BaseMapper<AccountReflex> {
 
 }

+ 19 - 0
saas-sso/src/main/java/com/persagy/sso/mapper/WdAccountMapper.java

@@ -0,0 +1,19 @@
+package com.persagy.sso.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.sso.pojo.dto.WdAccount;
+
+/**
+ * 
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author xgq
+ * @date 2021-04-29 11:30:51
+ */
+@Mapper
+public interface WdAccountMapper extends BaseMapper<WdAccount> {
+
+}

+ 20 - 1
saas-sso/src/main/java/com/persagy/sso/pojo/dto/AccountDTO.java

@@ -3,6 +3,8 @@ package com.persagy.sso.pojo.dto;
 import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * @ClassName : AccountDTO
  * @Author :xgq
@@ -14,9 +16,26 @@ import lombok.Data;
 @ApiModel(value = "查询账号入参")
 public class AccountDTO {
 
+    private  String appId;
+
+     /**账号所属, 0-运维系统账号,1-业务账号 **/
+    private String accountBelong;
+
+    /**账号类型, 0-超级管理员(所有集团),1-单集团管理员(单集团),2-普通账号 */
+    private String accountType;
+
+    /**账号来源,万达集团:201 **/
+    private String accountSource;
+
+    /**集团编码**/
+    private String groupCode;
+
     private String username;
 
     private String roleId;
 
-    private String name;
+    /** id集合 **/
+    private List<String> ids;
+
+    private String accountId;
 }

+ 1 - 2
saas-sso/src/main/java/com/persagy/sso/pojo/dto/AddJobDTO.java

@@ -21,8 +21,7 @@ public class AddJobDTO {
     private String id;
 
     @ApiModelProperty(value = "角色类型", required = true)
-    @NotNull(message = "角色类型不能为空")
-    private String roleType;
+    private String roleType;    
 
     @ApiModelProperty(value = "accountBelong")
     private String accountBelong;

+ 2 - 2
saas-sso/src/main/java/com/persagy/sso/pojo/dto/AddPersonDTO.java

@@ -37,11 +37,11 @@ public class AddPersonDTO {
     @NotNull(message = "账号不能为空")
     private String username;
 
-    @NotEmpty(message = "部门不能为空")
+  //  @NotEmpty(message = "部门不能为空")
     @ApiModelProperty(value = "所属部门id", required = true)
     private List<String> depIds;
 
-    @NotEmpty(message = "项目权限不能为空")
+    //@NotEmpty(message = "项目权限不能为空")
    // @ApiModelProperty(value = "关联的项目", required = true)
    // private List<UpsertSaasProjectDTO> projects;
 

+ 1 - 1
saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryDeptDTO.java

@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
- * @ClassName : IdDTO
+ * @ClassName : QueryDeptDTO
  * @Author :xgq
  * @Date :Created in 2021/4/14 22:05
  * @Description: TODO

+ 1 - 4
saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryJobDTO.java

@@ -31,11 +31,8 @@ public class QueryJobDTO {
     /**角色名称**/
     private String roleName;
 
-
-
-
     /**
-     * 角色类型,1:岗位; 2:集团管理员; 3:角色
+     * 角色类型,1:岗位; 2:集团管理员; 3:角色,万达同步的数据:101
      * **/
     private String roleType;
 }

+ 22 - 0
saas-sso/src/main/java/com/persagy/sso/pojo/dto/QueryPersonDTO.java

@@ -0,0 +1,22 @@
+package com.persagy.sso.pojo.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * @ClassName : AccountDTO
+ * @Author :xgq
+ * @Date :Created in 2021/4/16 0:42
+ * @Description: TODO
+ * @Version : 1.0
+ */
+@Data
+@ApiModel(value = "查询人员入参")
+public class QueryPersonDTO {
+
+    private String username;
+
+    
+    private String groupCode;
+
+}

+ 264 - 0
saas-sso/src/main/java/com/persagy/sso/pojo/dto/WdAccount.java

@@ -0,0 +1,264 @@
+package com.persagy.sso.pojo.dto;
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.persagy.common.model.BaseEntity;
+import com.persagy.common.utils.StringUtil;
+
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * 
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author xgq
+ * @date 2021-04-29 11:30:51
+ */
+@Getter
+@Setter
+@ToString
+@EqualsAndHashCode(callSuper = false)
+@TableName("wd_account")
+public class WdAccount extends BaseEntity<WdAccount> {
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String accountId;			// 账号id
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String employeeId;			// 员工编号
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String employeeCode;			// 工号(长度为6位的数字,该工号将全公司唯一)
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String employeeName;			// 姓名
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String gender;			// 性别
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String username;			// 员工万信号
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String unitId;			// 部门编号(某个人所在的部门)
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String unitName;			// 部门名称
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String jobId;			// 岗位编号
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String jobName;			// 岗位名称
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String employeeStatusName;			// 员工状态名称
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String employeeStatus;			// 员工状态编码
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private String status;			// 状态(1:有效;0:无效),当员工未入职(employeeStatus=0)的时候,该字段的值必须是0,除此之外的状态,该字段都是1
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private Date createIme;			// 创建时间
+
+        @TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
+	private Date updateTime;			// 更新时间
+
+    
+	public static class Builder {
+
+		private LambdaQueryWrapper<WdAccount> queryWrapper = null;
+		
+		private LambdaUpdateWrapper<WdAccount> updateWrapper = null;
+		
+		public Builder createQueryWrapper() {
+			queryWrapper = new LambdaQueryWrapper<WdAccount>();
+			return this;
+		}
+		
+		public Builder createUpdateWrapper() {
+			updateWrapper = new LambdaUpdateWrapper<WdAccount>();
+			return this;
+		}
+		
+				public Builder idEq (String id) {
+							if (StringUtil.isNotBlank(id)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getId, id);
+					} else {
+						queryWrapper.eq(WdAccount::getId, id);
+					}
+				}
+					    			return this;
+		}
+				public Builder accountIdEq (String accountId) {
+							if (StringUtil.isNotBlank(accountId)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getAccountId, accountId);
+					} else {
+						queryWrapper.eq(WdAccount::getAccountId, accountId);
+					}
+				}
+					    			return this;
+		}
+				public Builder employeeIdEq (String employeeId) {
+							if (StringUtil.isNotBlank(employeeId)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getEmployeeId, employeeId);
+					} else {
+						queryWrapper.eq(WdAccount::getEmployeeId, employeeId);
+					}
+				}
+					    			return this;
+		}
+				public Builder employeeCodeEq (String employeeCode) {
+							if (StringUtil.isNotBlank(employeeCode)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getEmployeeCode, employeeCode);
+					} else {
+						queryWrapper.eq(WdAccount::getEmployeeCode, employeeCode);
+					}
+				}
+					    			return this;
+		}
+				public Builder employeeNameEq (String employeeName) {
+							if (StringUtil.isNotBlank(employeeName)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getEmployeeName, employeeName);
+					} else {
+						queryWrapper.eq(WdAccount::getEmployeeName, employeeName);
+					}
+				}
+					    			return this;
+		}
+				public Builder genderEq (String gender) {
+							if (StringUtil.isNotBlank(gender)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getGender, gender);
+					} else {
+						queryWrapper.eq(WdAccount::getGender, gender);
+					}
+				}
+					    			return this;
+		}
+				public Builder usernameEq (String username) {
+							if (StringUtil.isNotBlank(username)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getUsername, username);
+					} else {
+						queryWrapper.eq(WdAccount::getUsername, username);
+					}
+				}
+					    			return this;
+		}
+				public Builder unitIdEq (String unitId) {
+							if (StringUtil.isNotBlank(unitId)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getUnitId, unitId);
+					} else {
+						queryWrapper.eq(WdAccount::getUnitId, unitId);
+					}
+				}
+					    			return this;
+		}
+				public Builder unitNameEq (String unitName) {
+							if (StringUtil.isNotBlank(unitName)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getUnitName, unitName);
+					} else {
+						queryWrapper.eq(WdAccount::getUnitName, unitName);
+					}
+				}
+					    			return this;
+		}
+				public Builder jobIdEq (String jobId) {
+							if (StringUtil.isNotBlank(jobId)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getJobId, jobId);
+					} else {
+						queryWrapper.eq(WdAccount::getJobId, jobId);
+					}
+				}
+					    			return this;
+		}
+				public Builder jobNameEq (String jobName) {
+							if (StringUtil.isNotBlank(jobName)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getJobName, jobName);
+					} else {
+						queryWrapper.eq(WdAccount::getJobName, jobName);
+					}
+				}
+					    			return this;
+		}
+				public Builder employeeStatusNameEq (String employeeStatusName) {
+							if (StringUtil.isNotBlank(employeeStatusName)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getEmployeeStatusName, employeeStatusName);
+					} else {
+						queryWrapper.eq(WdAccount::getEmployeeStatusName, employeeStatusName);
+					}
+				}
+					    			return this;
+		}
+				public Builder employeeStatusEq (String employeeStatus) {
+							if (StringUtil.isNotBlank(employeeStatus)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getEmployeeStatus, employeeStatus);
+					} else {
+						queryWrapper.eq(WdAccount::getEmployeeStatus, employeeStatus);
+					}
+				}
+					    			return this;
+		}
+				public Builder statusEq (String status) {
+							if (StringUtil.isNotBlank(status)) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getStatus, status);
+					} else {
+						queryWrapper.eq(WdAccount::getStatus, status);
+					}
+				}
+					    			return this;
+		}
+				public Builder createImeEq (Date createIme) {
+					    				if (null != createIme) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getCreateIme, createIme);
+					} else {
+						queryWrapper.eq(WdAccount::getCreateIme, createIme);
+					}
+				}
+						return this;
+		}
+				public Builder updateTimeEq (Date updateTime) {
+					    				if (null != updateTime) {
+					if (updateWrapper != null) {
+						updateWrapper.eq(WdAccount::getUpdateTime, updateTime);
+					} else {
+						queryWrapper.eq(WdAccount::getUpdateTime, updateTime);
+					}
+				}
+						return this;
+		}
+				
+		public LambdaQueryWrapper<WdAccount> builderQueryWrapper() {
+			return queryWrapper;
+		}
+		
+		public LambdaUpdateWrapper<WdAccount> builderUpdateWrapper() {
+			return updateWrapper;
+		}
+	}
+}

+ 26 - 1
saas-sso/src/main/java/com/persagy/sso/service/IAccountService.java

@@ -3,7 +3,9 @@ package com.persagy.sso.service;
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.sso.pojo.dto.AccountDTO;
 import com.persagy.sso.pojo.dto.QueryRoleDTO;
-import com.persagy.sso.pojo.dto.SaasAccountCreateDTO; /**
+import com.persagy.sso.pojo.dto.SaasAccountCreateDTO;
+
+/**
  * @ClassName : IAccountService
  * @Author :xgq
  * @Date :Created in 2021/4/16 0:39
@@ -54,4 +56,27 @@ public interface IAccountService {
      * @return: com.persagy.common.utils.ResponseResult
      **/
     ResponseResult insertAccount(SaasAccountCreateDTO createDTO, String token);
+
+
+    /**
+     * @Description: 根据账号来源查询账号
+     * @Author: xgq
+     * @Date: 2021/4/29 10:24
+     * @param accountDTO:
+     * @param token:
+     * @return: com.persagy.common.utils.ResponseResult
+     **/
+    ResponseResult queryAccountListBySource(AccountDTO accountDTO, String token);
+
+    /**
+     * @Description: 根据id批量删除
+     * @Author: xgq
+     * @Date: 2021/4/29 18:31
+     * @param accountDTO :
+     * @param token
+     * @return: com.persagy.common.utils.ResponseResult
+     **/
+    ResponseResult deleteByIds(AccountDTO accountDTO, String token);
+
+    ResponseResult queryAccountById(AccountDTO accountDTO, String token);
 }

+ 1 - 1
saas-sso/src/main/java/com/persagy/sso/service/IDeptService.java

@@ -41,7 +41,7 @@ public interface IDeptService {
     ResponseResult updateDept(AddDepartmentDTO addDepartmentDTO, String token);
 
     /**
-     * @Description: 查询集团级部门信息
+     * @Description: 根据条件查询级部门信息
      * @Author: xgq
      * @Date: 2021/4/15 19:55
      * @param queryDeptDTO :

+ 2 - 2
saas-sso/src/main/java/com/persagy/sso/service/IPersonService.java

@@ -1,8 +1,8 @@
 package com.persagy.sso.service;
 
 import com.persagy.common.utils.ResponseResult;
-import com.persagy.sso.pojo.dto.AccountDTO;
 import com.persagy.sso.pojo.dto.AddPersonDTO;
+import com.persagy.sso.pojo.dto.QueryPersonDTO;
 
 /**
  * @ClassName : IPersonService
@@ -22,5 +22,5 @@ public interface IPersonService {
     ResponseResult updatePerson(AddPersonDTO addPersonDTO, String token);
 
     /**根据条件查询人员 */
-    ResponseResult queryPersonByCondition(AccountDTO accountDTO, String token);
+    ResponseResult queryPersonByCondition(QueryPersonDTO personDTO, String token);
 }

+ 1 - 0
saas-sso/src/main/java/com/persagy/sso/service/IUserService.java

@@ -14,5 +14,6 @@ import com.persagy.sso.pojo.dto.WdUser;
  */
 public interface IUserService extends ISuperService<WdUser> {
 
+    void createWdUser();
 }
 

+ 17 - 0
saas-sso/src/main/java/com/persagy/sso/service/IWdAccountService.java

@@ -0,0 +1,17 @@
+package com.persagy.sso.service;
+
+import com.persagy.common.service.ISuperService;
+import com.persagy.sso.pojo.dto.WdAccount;
+
+/**
+ * 
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author xgq
+ * @date 2021-04-29 11:30:51
+ */
+public interface IWdAccountService extends ISuperService<WdAccount> {
+
+}
+

+ 31 - 0
saas-sso/src/main/java/com/persagy/sso/service/impl/AccountService.java

@@ -74,4 +74,35 @@ public class AccountService implements IAccountService {
     public ResponseResult insertAccount(SaasAccountCreateDTO createDTO, String token) {
         return saasAccountClient.insertAccount(createDTO,token);
     }
+
+    /**
+     * @Description: 根据账号来源查询账号
+     * @Author: xgq
+     * @Date: 2021/4/29 10:27
+     * @param accountDTO:
+     * @param token:
+     * @return: com.persagy.common.utils.ResponseResult
+     **/
+    @Override
+    public ResponseResult queryAccountListBySource(AccountDTO accountDTO, String token) {
+        return saasAccountClient.queryAccountListBySource(accountDTO,token);
+    }
+
+    /**
+     * @Description: 根据id批量删除
+     * @Author: xgq
+     * @Date: 2021/4/29 18:32
+     * @param accountDTO :
+     * @param token :
+     * @return: com.persagy.common.utils.ResponseResult
+     **/
+    @Override
+    public ResponseResult deleteByIds(AccountDTO accountDTO, String token) {
+        return saasAccountClient.deleteByIds(accountDTO,token);
+    }
+
+    @Override
+    public ResponseResult queryAccountById(AccountDTO accountDTO, String token) {
+        return saasAccountClient.queryAccountListBySource(accountDTO,token);
+    }
 }

+ 1 - 1
saas-sso/src/main/java/com/persagy/sso/service/impl/DeptService.java

@@ -78,7 +78,7 @@ public class DeptService implements IDeptService {
     }
 
     /**
-     * @Description: 查询集团级部门
+     * @Description: 根据条件查询部门信息
      * @Author: xgq
      * @Date: 2021/4/15 19:56
      * @param queryDeptDTO :

+ 4 - 4
saas-sso/src/main/java/com/persagy/sso/service/impl/PersonService.java

@@ -2,8 +2,8 @@ package com.persagy.sso.service.impl;
 
 import com.persagy.common.utils.ResponseResult;
 import com.persagy.sso.client.FmPersonClient;
-import com.persagy.sso.pojo.dto.AccountDTO;
 import com.persagy.sso.pojo.dto.AddPersonDTO;
+import com.persagy.sso.pojo.dto.QueryPersonDTO;
 import com.persagy.sso.service.IPersonService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,12 +55,12 @@ public class PersonService implements IPersonService {
      * @Description: 根据条件查询人员
      * @Author: xgq
      * @Date: 2021/4/16 12:06
-     * @param accountDTO :
+     * @param personDTO :
      * @param token
      * @return: com.persagy.common.utils.ResponseResult
      **/
     @Override
-    public ResponseResult queryPersonByCondition(AccountDTO accountDTO, String token) {
-        return fmPersonClient.queryPersonByCondition(accountDTO,token);
+    public ResponseResult queryPersonByCondition(QueryPersonDTO personDTO, String token) {
+        return fmPersonClient.queryPersonByCondition(personDTO,token);
     }
 }

+ 147 - 26
saas-sso/src/main/java/com/persagy/sso/service/impl/SynUserService.java

@@ -15,11 +15,13 @@ import com.persagy.sso.util.BaseUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
+import javax.naming.ldap.HasControls;
+import java.util.*;
 
 /**
  * @ClassName : SynUserService
@@ -47,6 +49,19 @@ public class SynUserService implements ISynUserService {
     @Value("${saas.secure.aes.iv}")
     private String aesIv;
 
+    
+    /**
+     * @Description: 同步人员信息------走定时任务
+     * @Author: xgq
+     * @Date: 2021/4/14 23:19
+
+     * @return: com.persagy.common.utils.ResponseResult
+     **/
+    public ResponseResult synUserList() throws Exception{
+        return synUserInfo();
+    }
+
+
     /**
      * @Description: 全量同步人员信息
      * @Author: xgq
@@ -60,35 +75,133 @@ public class SynUserService implements ISynUserService {
         token.put(BaseConstant.ACCOUNT_ID,BaseConstant.SYSTEM_ID);
         token.put(BaseConstant.GROUP_CODE, BaseConstant.GROUP_CODE_WD);
         token.put(BaseConstant.APP_ID, BaseConstant.APP_ID_PC);
+        //账号所属, 0-运维系统账号,1-业务账号,必填
+        token.put(BaseConstant.ACCOUNT_BELONG, BaseConstant.RESOURCE_FROM_OA_WD);
         //加密
         SecureAES aes = new  SecureAES(aesKey,aesIv);
         String tokenStr = aes.encryptAccount(token);
         //实际参数: 加密后的param+.+token
         tokenStr = tokenStr + BaseConstant.SEPARATE_CODE + BaseConstant.DEFAULT_TOKEN;
         //查询数据库,获取对应的用户信息
-        LambdaQueryWrapper<WdUser> queryWrapper = new WdUser.Builder().createQueryWrapper().builderQueryWrapper();
-        List<WdUser> userList = userService.list(queryWrapper);
+        //测试用数据库: 39.102.43.1799934  wd_org   wd  NjnTECQh3:s9
+        List<WdUser> userList = synUserManage.querySynUserList();
         if(CollectionUtils.isEmpty(userList)){
             log.info("no user info ...");
             return ResponseResultUtil.successResult();
         }
-        //开始同步数据逻辑
-        synDeptJobPersonInfo(tokenStr,userList);
-        return ResponseResultUtil.errorResult("全量同步用户信息成功...");
+        //开始同步数据逻辑---同步简化版的oa结构
+       // synDeptJobPersonInfo(tokenStr,userList);
+        //开始同步数据逻辑---以同步人员数据为主
+        synAccountInfo(tokenStr,userList);
+        return ResponseResultUtil.successResult("全量同步用户信息成功...");
 }
 
 
     /**
- * @Description: 同步人员信息------走定时任务
- * @Author: xgq
- * @Date: 2021/4/14 23:19
+     * @Description: 同步逻辑
+     * @Author: xgq
+     * @Date: 2021/4/27 20:53
+     * @param token:
+     * @param userList:
+     * @return: void
+     **/
+    private void synAccountInfo(String token, List<WdUser> userList) {
+        //查询所有的映射信息
+        List<WdAccount> accountReflexList = synUserManage.queryAllReflexList();
+        //转成一个map,key:employeeId value:WdAccount
+        Map<String, WdAccount> reflexAccountMap = new HashMap<>();
+         if(CollectionUtils.isNotEmpty(accountReflexList)){
+             //之前已经同步过数据,获取映射关系
+             getReflexMap(accountReflexList,reflexAccountMap);
+         }
+         //处理之前的错误数据:应该删除未删除
+        try {
+            synUserManage.dealDeletedSynAccount(reflexAccountMap,token);
+        } catch (Exception e) {
+            log.error("deal deleted account error,reason: "+e.getMessage());
+        }
+        //待同步的数据
+        for (int i = 0; i <userList.size() ; i++) {
+            WdUser user = userList.get(i);
+            try {
+                synAccountItem(user,reflexAccountMap,token);
+            } catch (Exception e) {
+                log.error("syn user(id:"+(user.getEmployeeID()) +") error, reason: "+e.getMessage());
+            }
+        }
+        //判断map的值,如果没有需要删除的账号,那么map应该是空的
+        if(reflexAccountMap.isEmpty()){
+            log.info("no delete employee....");
+        } else {
+            //留下的都是被删除的
+            try {
+                synUserManage.deleteSynAccount(reflexAccountMap,token);
+                log.info("delete employee success...");
+            } catch (Exception e) {
+                log.error("delete employee error, reason: "+e.getMessage());
+            }
+        }
+        log.info("syn account info end ...");
+    }
 
- * @return: com.persagy.common.utils.ResponseResult
- **/
-    public ResponseResult synUserList() throws Exception{
-        return synUserInfo();
+
+
+    private void getReflexMap(List<WdAccount> accountReflexList, Map<String, WdAccount> reflexAccountMap) {
+        for (int i = 0; i <accountReflexList.size() ; i++) {
+            WdAccount wdAccount = accountReflexList.get(i);
+            String employeeId = wdAccount.getEmployeeId();
+            reflexAccountMap.put(employeeId, wdAccount);
+        }
     }
 
+
+    private void synAccountItem(WdUser user, Map<String, WdAccount> reflexAccountMap, String token) {
+        //参数校验
+        String username = user.getUsername();
+        String employeeId = user.getEmployeeID();
+        if(StringUtils.isBlank(username)|| StringUtils.isBlank(employeeId)){
+            //数据不完整,不同步该数据,直接返回
+            return ;
+        }
+        //查询账号id在映射表是否存在(判断是新增还是修改)
+        if(!reflexAccountMap.containsKey(employeeId)){
+            //之前不存在,新增
+            //查询账号名称在账号表是否存在
+            JSONObject account = synUserManage.queryAccountByCondition(username,token);
+          //正常应该不存在
+         if(null==account){
+             //保存账号数据
+             synUserManage.saveAccountItem(user,token);
+         } else { //账号名称已经存在
+             throw new BusinessException("username: " +username + "is exit...");
+         }
+        } else {
+        //之前已经存在,修改信息,
+            // 账号表没有需要修改的信息,只修改映射表
+            //查询下是否存在,如果不存在,说明是之前同步的时候有问题,新建就行,正常应该存在
+                WdAccount wdAccount = reflexAccountMap.get(employeeId);
+            String accountId = wdAccount.getAccountId();
+            if(StringUtils.isBlank(accountId)){
+                //删除映射,重新添加
+                synUserManage.deleteAccountReflexById(wdAccount.getId());
+                synUserManage.saveAccountItem(user,token);
+            } else {
+                //根据账号去查这条数据,没有就新建
+                JSONObject accountJson = synUserManage.queryAccountById(accountId,token);
+                if(null == accountJson ){
+                    synUserManage.deleteAccountReflexById(wdAccount.getId());
+                    synUserManage.saveAccountItem(user,token);
+                } else {
+                    synUserManage.updateAccountItem(wdAccount,user, token);
+                }
+            }
+             //删除修改的数据
+            reflexAccountMap.remove(employeeId);
+            }
+        }
+
+
+
     /**
      * @Description: 同步逻辑
      * @Author: xgq
@@ -212,7 +325,8 @@ public class SynUserService implements ISynUserService {
         addDepartmentDTO.setParentId(deptParentId);
         //部门类型,0:集团; 1:公司; 2:部门,默认部门
         addDepartmentDTO.setType(BaseConstant.DEPT_TYPE_DEPT);
-        //根据部门名称查找部门
+        //根据部门名称查找部门,判断部门名称是否存在,第一次同步应该不存在,走新建逻辑,再次同步时存在且映射正确
+        //如果出现存在部门名称但是不存在映射的情况,一般为人为的添加了部门的数据,直接绑定对应的部门间关系
         QueryDeptDTO queryDeptDTO = new QueryDeptDTO();
             queryDeptDTO.setName(oaDeptName);
       ResponseResult queryDeptResult =   synUserManage.queryDeptByCondition(queryDeptDTO, token);
@@ -239,6 +353,7 @@ public class SynUserService implements ISynUserService {
                     throw new BusinessException("save dept reflex error...");
                 }
                 //更新那条部门表的数据
+                addDepartmentDTO.setId(newDeptId);
                  result = synUserManage.updateDept(addDepartmentDTO, token);
               if(!BaseUtils.CheckResult(result)){
                   throw new BusinessException("update dept info error...");
@@ -257,7 +372,7 @@ public class SynUserService implements ISynUserService {
                          throw new BusinessException("update dept info error...");
                      }
                  }
-                deptId = oldDeptId;
+                                                  deptId = oldDeptId;
             }
         } else {
          //不存在该部门名称,查看有没有映射关系
@@ -296,17 +411,20 @@ public class SynUserService implements ISynUserService {
         oaJobId = user.getJobId();
         oaJobName = user.getJobName();
         if(StringUtils.isBlank(oaJobId)|| StringUtils.isBlank(oaJobName)){
-            //部门信息为空
+            //岗位信息为空
             return jobId;
         }
+        addJobDTO.setAccountBelong(BaseConstant.ACCOUNT_TYPE_BUSINESS);
+        addJobDTO.setGroupCode(BaseConstant.GROUP_CODE_WD);
+        addJobDTO.setAccountId(BaseConstant.SYSTEM_ID);
+        addJobDTO.setAppId(BaseConstant.APP_ID_PC);
         addJobDTO.setRoleType(BaseConstant.JOB_ROLE_TYPE);
         addJobDTO.setRoleName(oaJobName);
         ResponseResult result = new ResponseResult();
         //判断岗位名称是否存在,根据名称查询岗位列表
-        //// TODO: 2021/4/19   需要人员提供接口
-
-
-          JSONArray jobArray   = synUserManage.queryJobBuCondition(oaJobName,token);
+        QueryJobDTO queryJobDTO = new QueryJobDTO();
+        BeanUtils.copyProperties(addJobDTO, queryJobDTO);
+          JSONArray jobArray   = synUserManage.queryJobBuCondition(queryJobDTO,token);
           if(jobArray.size()> 0){
           //已经存在该岗位名称,查看岗位名称对应的岗位id
               String newJobId = jobArray.getJSONObject(0).getString(BaseConstant.RESPONSE_ID);
@@ -320,11 +438,12 @@ public class SynUserService implements ISynUserService {
                   jobReflex.setId(BaseUtils.getUuid());
                   boolean save = jobReflexService.save(jobReflex);
                   if(!save){
-                      throw new BusinessException("save job reflex info error...");
+                      throw new BusinessException("save job reflex info error: "+BaseUtils.getMsg(result));
                   }
+                  addJobDTO.setId(newJobId);
                result =   synUserManage.updateJob(addJobDTO,token);
                    if(!BaseUtils.CheckResult(result)){
-                       throw new BusinessException("update job  info error...");
+                       throw new BusinessException("update job  info error: "+BaseUtils.getMsg(result));
                    }
                   jobId = newJobId;
               } else {
@@ -334,7 +453,10 @@ public class SynUserService implements ISynUserService {
                   if(!newJobId.equals(oldJobId)){
                       addJobDTO.setId(oldJobId);
                       addJobDTO.setRoleName(BaseConstant.GROUP_NAME+oaJobName);
-                      synUserManage.updateJob(addJobDTO,token);
+                      result=   synUserManage.updateJob(addJobDTO,token);
+                      if(!BaseUtils.CheckResult(result)){
+                          throw new BusinessException("update job  info error: "+BaseUtils.getMsg(result));
+                      }
                       jobId = oldJobId;
                   }
               }
@@ -374,8 +496,7 @@ public class SynUserService implements ISynUserService {
         if(StringUtils.isBlank(username)|| StringUtils.isBlank(employeeId)){
             return accountId;
         }
-        //todo 乾坤 
-
+        //查询账号名称是否存在
           JSONObject account = synUserManage.queryAccountByCondition(username,token);
           if(null == account){
               //不存在,创建账号信息和账号间映射关系信息
@@ -422,7 +543,7 @@ public class SynUserService implements ISynUserService {
      **/
     private void dealUserInfo(WdUser user, String deptId, String jobId, String accountId, String token) {
         if(StringUtils.isNotBlank(accountId)){
-            //根据username查询人是否存在
+            //根据username查询人员信息
          JSONObject  userJson =    synUserManage.queryPersonByCondition(user,token);
             AddPersonDTO addPersonDTO = new AddPersonDTO();
             //判断是否存在

+ 24 - 1
saas-sso/src/main/java/com/persagy/sso/service/impl/UserServiceImpl.java

@@ -1,11 +1,15 @@
 package com.persagy.sso.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.persagy.common.service.impl.SuperServiceImpl;
 import com.persagy.sso.mapper.UserMapper;
 import com.persagy.sso.pojo.dto.WdUser;
 import com.persagy.sso.service.IUserService;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 
  * 
@@ -16,5 +20,24 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class UserServiceImpl extends SuperServiceImpl<UserMapper, WdUser> implements IUserService {
-
+    @Override
+    @DS("syn")
+    public void createWdUser() {
+        WdUser wdUser ;
+        List<String> list = new ArrayList<>();
+        for (int i = 1001; i <= 1050 ; i++) {
+            wdUser = new WdUser();
+            wdUser.setEmployeeID("EM"+i);
+            wdUser.setEmployeeCode("EM"+i);
+            wdUser.setEmployeeName("测试数据EM" + i);
+            wdUser.setGender("1");
+            wdUser.setUsername("test"+i);
+            wdUser.setOrgID("BM"+i);
+            wdUser.setOrgName("部门名称"+i);
+            wdUser.setJobId("GW"+i);
+            wdUser.setJobName("岗位"+i);
+            boolean result =   this.save(wdUser);
+            list.add(result ? wdUser.getEmployeeID() + "保存成功" : wdUser.getEmployeeID() + "保存失败");
+        }
+    }
 }

+ 21 - 0
saas-sso/src/main/java/com/persagy/sso/service/impl/WdAccountServiceImpl.java

@@ -0,0 +1,21 @@
+package com.persagy.sso.service.impl;
+
+import org.springframework.stereotype.Service;
+
+import com.persagy.common.service.impl.SuperServiceImpl;
+import com.persagy.sso.mapper.WdAccountMapper;
+import com.persagy.sso.pojo.dto.WdAccount;
+import com.persagy.sso.service.IWdAccountService;
+
+/**
+ * 
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author xgq
+ * @date 2021-04-29 11:30:51
+ */
+@Service
+public class WdAccountServiceImpl extends SuperServiceImpl<WdAccountMapper, WdAccount> implements IWdAccountService {
+
+}

+ 1 - 1
saas-sso/src/main/resources/mapper/JobReflexMapper.xml

@@ -10,4 +10,4 @@
 			<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
 			<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
 		</resultMap>
-</mapper>
+</mapper>

+ 13 - 0
saas-sso/src/main/resources/mapper/UserMapper.xml

@@ -30,4 +30,17 @@
       jobId,jobName,employeeStatusName,employeeStatus,unitfullpath,status  FROM wd_user
       </select>
 
+    <insert id="insert" parameterType="com.persagy.sso.pojo.dto.WdUser">
+      insert into wd_user(employeeID,employeeCode,employeeName,gender,username,
+      orgID,orgName,unitID,unitName,jobId,jobName,employeeStatusName,employeeStatus,
+      unitfullpath,status
+      ) VALUES (
+      #{employeeID,jdbcType=VARCHAR},#{employeeCode,jdbcType=VARCHAR},#{employeeName,jdbcType=VARCHAR},
+      #{gender,jdbcType=VARCHAR},#{username,jdbcType=VARCHAR},#{orgID,jdbcType=VARCHAR},
+      #{orgName,jdbcType=VARCHAR},#{unitID,jdbcType=VARCHAR},#{unitName,jdbcType=VARCHAR},
+      #{jobId,jdbcType=VARCHAR},#{jobName,jdbcType=VARCHAR},#{employeeStatusName,jdbcType=VARCHAR},
+      #{employeeStatus,jdbcType=VARCHAR},#{unitfullpath,jdbcType=VARCHAR},#{status,jdbcType=CHAR}
+      )
+    </insert>
+
 </mapper>

+ 24 - 0
saas-sso/src/main/resources/mapper/WdAccountMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.persagy.sso.mapper.WdAccountMapper">
+    
+	<resultMap id="BaseResultMap" type="com.persagy.sso.pojo.dto.WdAccount">
+			<result column="id" property="id" jdbcType="VARCHAR" />
+			<result column="account_id" property="accountId" jdbcType="VARCHAR" />
+			<result column="employee_id" property="employeeId" jdbcType="VARCHAR" />
+			<result column="employee_code" property="employeeCode" jdbcType="VARCHAR" />
+			<result column="employee_name" property="employeeName" jdbcType="VARCHAR" />
+			<result column="gender" property="gender" jdbcType="VARCHAR" />
+			<result column="username" property="username" jdbcType="VARCHAR" />
+			<result column="unit_id" property="unitId" jdbcType="VARCHAR" />
+			<result column="unit_name" property="unitName" jdbcType="VARCHAR" />
+			<result column="job_id" property="jobId" jdbcType="VARCHAR" />
+			<result column="job_name" property="jobName" jdbcType="VARCHAR" />
+			<result column="employee_status_name" property="employeeStatusName" jdbcType="VARCHAR" />
+			<result column="employee_status" property="employeeStatus" jdbcType="VARCHAR" />
+			<result column="status" property="status" jdbcType="CHAR" />
+			<result column="create_ime" property="createIme" jdbcType="TIMESTAMP" />
+			<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+		</resultMap>
+</mapper>