Browse Source

关闭用户同步任务

tags/24080901
WendyYang 10 months ago
parent
commit
414d1c6720
8 changed files with 27 additions and 11 deletions
  1. BIN
      hz-pm-api/src/lib/kingbase8-8.2.0.jar
  2. BIN
      hz-pm-api/src/lib/kingbase8-8.6.0.jar
  3. +2
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java
  4. +7
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java
  5. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java
  6. +4
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java
  7. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java
  8. +9
    -2
      hz-pm-api/src/main/resources/application-prod.yml

BIN
hz-pm-api/src/lib/kingbase8-8.2.0.jar View File


BIN
hz-pm-api/src/lib/kingbase8-8.6.0.jar View File


+ 2
- 3
hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java View File

@@ -33,7 +33,6 @@ public class MhApiClient {
private static final String COMPANY_URL = "/sync/company"; private static final String COMPANY_URL = "/sync/company";





public MhRetDTO<List<MhUnitDTO>> queryUnits() { public MhRetDTO<List<MhUnitDTO>> queryUnits() {
String requestUrl = mhApiHost + UNIT_URL; String requestUrl = mhApiHost + UNIT_URL;
String retBody = HttpUtil.get(requestUrl); String retBody = HttpUtil.get(requestUrl);
@@ -52,7 +51,7 @@ public class MhApiClient {
String requestUrl = mhApiHost + USER_URL; String requestUrl = mhApiHost + USER_URL;
if (syncDateTime != null) { if (syncDateTime != null) {
String timeString = LocalDateTimeUtil.format(syncDateTime, NORM_DATETIME_FORMATTER); String timeString = LocalDateTimeUtil.format(syncDateTime, NORM_DATETIME_FORMATTER);
requestUrl = "?syncDateTime=" + timeString;
requestUrl += "?syncDateTime=" + timeString;
} }
String retBody = HttpUtil.get(requestUrl); String retBody = HttpUtil.get(requestUrl);
return JSONUtil.toBean(retBody, new TypeReference<MhRetDTO<List<MhUserDTO>>>() { return JSONUtil.toBean(retBody, new TypeReference<MhRetDTO<List<MhUserDTO>>>() {
@@ -63,7 +62,7 @@ public class MhApiClient {
String requestUrl = mhApiHost + EXPERT_URL; String requestUrl = mhApiHost + EXPERT_URL;
if (syncDateTime != null) { if (syncDateTime != null) {
String timeString = LocalDateTimeUtil.format(syncDateTime, NORM_DATETIME_FORMATTER); String timeString = LocalDateTimeUtil.format(syncDateTime, NORM_DATETIME_FORMATTER);
requestUrl = "?syncDateTime=" + timeString;
requestUrl += "?syncDateTime=" + timeString;
} }
String retBody = HttpUtil.get(requestUrl); String retBody = HttpUtil.get(requestUrl);
return JSONUtil.toBean(retBody, new TypeReference<MhRetDTO<MhExpertDTO>>() { return JSONUtil.toBean(retBody, new TypeReference<MhRetDTO<MhExpertDTO>>() {


+ 7
- 4
hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java View File

@@ -27,7 +27,6 @@ import java.time.LocalDateTime;
public class MhSyncController { public class MhSyncController {


private final SyncMhUserOrgManage syncMhUserOrgManage; private final SyncMhUserOrgManage syncMhUserOrgManage;
private final MhApiClient mhApiClient;


@GetMapping("/users") @GetMapping("/users")
public void getUsers(@RequestParam(value = "syncTime", required = false) public void getUsers(@RequestParam(value = "syncTime", required = false)
@@ -41,10 +40,14 @@ public class MhSyncController {
} }


@GetMapping("/experts") @GetMapping("/experts")
public Object getExperts(@RequestParam(value = "syncTime", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) {
return mhApiClient.queryExperts(syncTime);
public void getExperts(@RequestParam(value = "syncTime", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) {
syncMhUserOrgManage.syncExperts(syncTime);
} }


@GetMapping("/company")
public void getExperts() {
syncMhUserOrgManage.syncCompany();
}


} }

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java View File

@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* @since 2023-12-25 * @since 2023-12-25
*/ */
@Data @Data
@TableName("MH_UNIT")
@TableName("MH_COMPANY")
@ApiModel(value = "MhUnit对象", description = "企业表") @ApiModel(value = "MhUnit对象", description = "企业表")
public class MhCompany implements Serializable { public class MhCompany implements Serializable {




+ 4
- 1
hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -80,7 +81,9 @@ public class SyncMhUserOrgManage {
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
userInfo.setMhUserId(mhUser.getUserId()); userInfo.setMhUserId(mhUser.getUserId());
if (Boolean.TRUE.equals(mhUser.getIsZzdAccount())) { if (Boolean.TRUE.equals(mhUser.getIsZzdAccount())) {
userInfo.setAccountId(Long.parseLong(mhUser.getAccountId()));
if (NumberUtil.isNumber(mhUser.getAccountId())) {
userInfo.setAccountId(Long.parseLong(mhUser.getAccountId()));
}
} }
UserAvailableEnum userStatus = getUserAvailable(mhUser.getStatus()); UserAvailableEnum userStatus = getUserAvailable(mhUser.getStatus());
userInfo.setAvailable(userStatus.name()); userInfo.setAvailable(userStatus.name());


+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java View File

@@ -1,12 +1,14 @@
package com.hz.pm.api.user.security.auth.mh; package com.hz.pm.api.user.security.auth.mh;




import cn.hutool.json.JSONUtil;
import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.user.convert.UserInfoConvertor; import com.hz.pm.api.user.convert.UserInfoConvertor;
import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -21,6 +23,7 @@ import static com.hz.pm.api.user.model.enumeration.UserAvailableEnum.DISABLE;
* @author WendyYang * @author WendyYang
* @since 11:22 2023/12/26 * @since 11:22 2023/12/26
*/ */
@Slf4j
@Service("mhLoginUserDetailService") @Service("mhLoginUserDetailService")
@RequiredArgsConstructor @RequiredArgsConstructor
public class MhLoginUserDetailService implements UserDetailsService { public class MhLoginUserDetailService implements UserDetailsService {
@@ -33,6 +36,7 @@ public class MhLoginUserDetailService implements UserDetailsService {
if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) { if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) {
throw BizException.wrap("用户不存在或已被禁用"); throw BizException.wrap("用户不存在或已被禁用");
} }
log.info("登录用户为:{}", JSONUtil.toJsonStr(userInfo));
return UserInfoConvertor.convert(userInfo); return UserInfoConvertor.convert(userInfo);
} }




+ 9
- 2
hz-pm-api/src/main/resources/application-prod.yml View File

@@ -242,7 +242,6 @@ login:
url: http://60.188.225.145/login url: http://60.188.225.145/login
web: web:
url: http://60.188.225.145 url: http://60.188.225.145

mh: mh:
sso: sso:
client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310
@@ -251,4 +250,12 @@ mh:
expert-qr-code-url: http://10.54.38.13:8081/mh-gateway/problem/expert/getExpertQrCode expert-qr-code-url: http://10.54.38.13:8081/mh-gateway/problem/expert/getExpertQrCode
file: file:
detail-url: http://10.54.38.13:8081/mh-gateway/oss/ossfile/getFileInfoList detail-url: http://10.54.38.13:8081/mh-gateway/oss/ossfile/getFileInfoList
down-url: http://10.54.38.13:8081/mh-gateway/oss/oss/downloadFileNotLogin
down-url: http://10.54.38.13:8081/mh-gateway/oss/oss/downloadFileNotLogin
sync-mh-company:
open: false
sync-mh-user:
open: false
sync-mh-expert:
open: false
sync-mh-unit:
open: false

Loading…
Cancel
Save