@@ -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>>() { | ||||
@@ -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(); | |||||
} | |||||
} | } |
@@ -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,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()); | ||||
@@ -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); | ||||
} | } | ||||
@@ -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 |