feat:业务配置新增工种,手动同步利元亨用户按钮

This commit is contained in:
2026-04-02 14:12:32 +08:00
parent c015916a2a
commit bee4e892f3
17 changed files with 95 additions and 8 deletions

View File

@@ -1,13 +1,19 @@
package com.sdm.system.controller;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.common.ThreadLocalContext;
import com.sdm.outbridge.entity.LyricVUserToDm;
import com.sdm.outbridge.service.lyric.*;
import com.sdm.system.model.entity.SystemParamConfigBean;
import com.sdm.system.service.ISimulationSystemConfigService;
import com.sdm.system.service.ISysTenantService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -24,11 +30,51 @@ public class LyricUserController {
@Autowired
private LyricIntegrateService lyricIntegrateService;
@Autowired
private ISimulationSystemConfigService configService;
@Autowired
private ISysTenantService tenantService;
@Value("${defaultTenantId}")
private String defaultTenantId;
@PostMapping("/queryUserList")
@Operation(summary = "查询利元亨用户列表")
public SdmResponse<List<LyricVUserToDm>> queryUserList(@RequestParam(required = false) String workType) {
SdmResponse sdmResponse = lyricIntegrateService.queryUserList(workType);
return sdmResponse;
if (workType != null && !workType.isEmpty()) {
return lyricIntegrateService.queryUserList(workType);
}
// 从系统参数配置获取工种列表
List<String> workTypeList = new ArrayList<>();
try {
SdmResponse configResponse = configService.querySystemParamConfig("WORKFORCE_ALLOCATION");
if (configResponse != null && configResponse.getData() != null) {
SystemParamConfigBean configBean = (SystemParamConfigBean) configResponse.getData();
List<String> values = configBean.values;
for (String value : values) {
JSONObject jsonObj = JSONObject.parseObject(value);
String wt = jsonObj.getString("workType");
if (wt != null) {
workTypeList.add(wt);
}
}
}
} catch (Exception e) {
log.error("解析工种配置失败", e);
}
log.info("[queryUserList] workTypeList:{}", workTypeList);
return lyricIntegrateService.queryUserList(workTypeList);
}
@PostMapping("/syncLyricUsers")
@Operation(summary = "同步利元亨用户")
public SdmResponse syncLyricUsers() {
if (StringUtils.equals(defaultTenantId, String.valueOf(ThreadLocalContext.getTenantId()))) {
return SdmResponse.success();
}
log.info("[syncLyricUsers] start......");
return tenantService.allSyncLyricUsers();
}
}

View File

@@ -63,4 +63,6 @@ public interface ISysTenantService extends IService<SysTenant> {
*/
SdmResponse getTenantDetailById(Long tenantId);
SdmResponse allSyncLyricUsers();
}

View File

@@ -39,6 +39,9 @@ public class CIDtenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
@Value("${cid.tenant.listTenant}")
private String listTenant;
@Value("${cid.tenant.allSyncLyricUsers}")
private String allSyncLyricUsers;
@Override
public String getType() {
return type;
@@ -107,4 +110,16 @@ public class CIDtenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
return SdmResponse.failed("查询失败");
}
}
@Override
public SdmResponse allSyncLyricUsers() {
try {
String resultJson = HttpUtil.get(cidUrl + allSyncLyricUsers);
log.info("allSyncLyricUsers url:{}, resp: {}", cidUrl + allSyncLyricUsers, resultJson);
return JSON.parseObject(resultJson, SdmResponse.class);
} catch (Exception e) {
log.error("同步用户失败", e);
return SdmResponse.failed("同步用户失败");
}
}
}

View File

@@ -121,4 +121,9 @@ public class LocalSysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysT
BeanUtils.copyProperties(sysTenant, sysRoleResp);
return SdmResponse.success(sysRoleResp);
}
@Override
public SdmResponse allSyncLyricUsers() {
return null;
}
}

View File

@@ -160,6 +160,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup

View File

@@ -160,6 +160,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup

View File

@@ -160,6 +160,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup

View File

@@ -160,6 +160,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup

View File

@@ -160,6 +160,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup

View File

@@ -166,6 +166,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
# 单次批量查询cid审批流详情的条数
batchCount: 500

View File

@@ -161,6 +161,7 @@ cid:
tenant:
getTenantDetailById: /spdm-tenant/getTenantDetailById
listTenant: /spdm-tenant/listTenant
allSyncLyricUsers: /spdm-tenant/allSyncLyricUsers
flow:
launchApprove: /spdm-flow/startFlow
queryFlowTemplate: /spdm-flow/listProcessByGroup