统一身份认证用户信息接口接口
This commit is contained in:
parent
e12712bc99
commit
37a4d25824
|
|
@ -86,18 +86,18 @@ public class CancelRevokeController extends BaseController {
|
||||||
return RestResult.ok(result);
|
return RestResult.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 审批操作
|
// * 审批操作
|
||||||
* POST /api/cancelRevoke/approve
|
// * POST /api/cancelRevoke/approve
|
||||||
*/
|
// */
|
||||||
@ApiOperation("审批操作")
|
// @ApiOperation("审批操作")
|
||||||
@PostMapping("/approve")
|
// @PostMapping("/approve")
|
||||||
public RestResult<CancelRevokeApproveResultVO> approve(
|
// public RestResult<CancelRevokeApproveResultVO> approve(
|
||||||
@Validated @RequestBody CancelRevokeApproveDTO approveDTO,
|
// @Validated @RequestBody CancelRevokeApproveDTO approveDTO,
|
||||||
HttpServletRequest request) {
|
// HttpServletRequest request) {
|
||||||
CancelRevokeApproveResultVO result = cancelRevokeService.approve(approveDTO, request);
|
// CancelRevokeApproveResultVO result = cancelRevokeService.approve(approveDTO, request);
|
||||||
return RestResult.ok(result);
|
// return RestResult.ok(result);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤销吊销待办列表(我的待办)
|
* 撤销吊销待办列表(我的待办)
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,12 @@ import com.chinaweal.aiccs.aiccs.force.cancel.mapper.CancelRevokeApproveMapper;
|
||||||
import com.chinaweal.aiccs.aiccs.force.cancel.mapper.CancelRevokeMapper;
|
import com.chinaweal.aiccs.aiccs.force.cancel.mapper.CancelRevokeMapper;
|
||||||
import com.chinaweal.aiccs.aiccs.force.cancel.service.ICancelRevokeService;
|
import com.chinaweal.aiccs.aiccs.force.cancel.service.ICancelRevokeService;
|
||||||
import com.chinaweal.aiccs.aiccs.force.mapper.XrForceDeregisterMapper;
|
import com.chinaweal.aiccs.aiccs.force.mapper.XrForceDeregisterMapper;
|
||||||
|
import com.chinaweal.aiccs.aiccs.revoke.entity.Revokelist;
|
||||||
|
import com.chinaweal.aiccs.aiccs.revoke.service.RevokelistService;
|
||||||
import com.chinaweal.aiccs.aiccs.system.service.TRBaseCodeService;
|
import com.chinaweal.aiccs.aiccs.system.service.TRBaseCodeService;
|
||||||
import com.chinaweal.aiccs.common.base.controller.BaseController;
|
import com.chinaweal.aiccs.common.base.controller.BaseController;
|
||||||
import com.chinaweal.aiccs.common.constant.BaseDataConstant;
|
import com.chinaweal.aiccs.common.constant.BaseDataConstant;
|
||||||
|
import com.chinaweal.aiccs.common.util.FlowUtil;
|
||||||
import com.chinaweal.aiccs.common.util.StringUtils;
|
import com.chinaweal.aiccs.common.util.StringUtils;
|
||||||
import com.chinaweal.aiccs.org.service.AicorgService;
|
import com.chinaweal.aiccs.org.service.AicorgService;
|
||||||
import com.chinaweal.aiccs.org.service.TUsersService;
|
import com.chinaweal.aiccs.org.service.TUsersService;
|
||||||
|
|
@ -35,7 +38,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤销吊销业务Service实现类
|
* 撤销吊销业务Service实现类
|
||||||
|
|
@ -44,8 +46,10 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class CancelRevokeServiceImpl extends BaseController implements ICancelRevokeService {
|
public class CancelRevokeServiceImpl extends BaseController implements ICancelRevokeService {
|
||||||
|
|
||||||
/** 撤销吊销业务类型 */
|
/**
|
||||||
private static final String BIZ_TYPE_CANCEL_REVOKE = "CANCELREVOKE";
|
* 撤销吊销业务类型
|
||||||
|
*/
|
||||||
|
private static final String BIZ_TYPE_CANCEL_REVOKE = "cancelrevoke";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CancelRevokeMapper cancelRevokeMapper;
|
private CancelRevokeMapper cancelRevokeMapper;
|
||||||
|
|
@ -73,6 +77,8 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TUsersService usersService;
|
private TUsersService usersService;
|
||||||
|
@Autowired
|
||||||
|
private RevokelistService revokelistService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -84,7 +90,7 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
|
|
||||||
// 生成业务ID和业务编号
|
// 生成业务ID和业务编号
|
||||||
String bizId = StringUtils.getUUID();
|
String bizId = StringUtils.getUUID();
|
||||||
String bizSeq = "CXQX-" + System.currentTimeMillis();
|
String bizSeq = StringUtils.getUUID();
|
||||||
|
|
||||||
// 获取用户所属机关区域码
|
// 获取用户所属机关区域码
|
||||||
String decorgCode = aicorgService.getRegionCodeByUser(user);
|
String decorgCode = aicorgService.getRegionCodeByUser(user);
|
||||||
|
|
@ -133,7 +139,7 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
taskList.setBusstatus(BaseDataConstant.BUSINESS_STATUS_TRANSACT);
|
taskList.setBusstatus(BaseDataConstant.BUSINESS_STATUS_TRANSACT);
|
||||||
|
|
||||||
// 使用TSTaskListService的startWorkFlow方法启动工作流
|
// 使用TSTaskListService的startWorkFlow方法启动工作流
|
||||||
String workflowid = taskListService.startWorkFlow(taskList, user, BIZ_TYPE_CANCEL_REVOKE);
|
String workflowid = taskListService.startWorkFlow(taskList, user, FlowUtil.SERIOUS_ILLEGAL_REM_WORKFLOW);
|
||||||
|
|
||||||
// 更新业务表的流程ID
|
// 更新业务表的流程ID
|
||||||
CancelRevoke updateEntity = new CancelRevoke();
|
CancelRevoke updateEntity = new CancelRevoke();
|
||||||
|
|
@ -317,7 +323,7 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
* 处理审批通过
|
* 处理审批通过
|
||||||
*/
|
*/
|
||||||
private void processApprovePass(CancelRevoke cancelRevoke, CancelRevokeApproveDTO approveDTO,
|
private void processApprovePass(CancelRevoke cancelRevoke, CancelRevokeApproveDTO approveDTO,
|
||||||
TSTaskList taskList, AICUser user) {
|
TSTaskList taskList, AICUser user) {
|
||||||
String nextNodeID = approveDTO.getNextNodeID();
|
String nextNodeID = approveDTO.getNextNodeID();
|
||||||
|
|
||||||
// 更新业务流程信息
|
// 更新业务流程信息
|
||||||
|
|
@ -347,6 +353,10 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
// 如果工作流已结束,更新业务状态为已通过
|
// 如果工作流已结束,更新业务状态为已通过
|
||||||
if (BaseDataConstant.BUSINESS_STATUS_END.equals(taskList.getBusstatus())) {
|
if (BaseDataConstant.BUSINESS_STATUS_END.equals(taskList.getBusstatus())) {
|
||||||
cancelRevokeMapper.updateStatus(cancelRevoke.getBizId(), "5", nextNodeID);
|
cancelRevokeMapper.updateStatus(cancelRevoke.getBizId(), "5", nextNodeID);
|
||||||
|
revokelistService.lambdaUpdate()
|
||||||
|
.set(Revokelist::getLauptime, LocalDateTime.now())
|
||||||
|
.set(Revokelist::getState, "2")
|
||||||
|
.eq(Revokelist::getUniscid, cancelRevoke.getUniscid()).update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,7 +364,7 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
* 处理审批拒绝
|
* 处理审批拒绝
|
||||||
*/
|
*/
|
||||||
private void processApproveReject(CancelRevoke cancelRevoke, CancelRevokeApproveDTO approveDTO,
|
private void processApproveReject(CancelRevoke cancelRevoke, CancelRevokeApproveDTO approveDTO,
|
||||||
TSTaskList taskList, AICUser user) {
|
TSTaskList taskList, AICUser user) {
|
||||||
// 更新业务流程状态
|
// 更新业务流程状态
|
||||||
cancelRevokeMapper.updateStatus(cancelRevoke.getBizId(), "6", approveDTO.getCurrentNode());
|
cancelRevokeMapper.updateStatus(cancelRevoke.getBizId(), "6", approveDTO.getCurrentNode());
|
||||||
|
|
||||||
|
|
@ -458,7 +468,7 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
Page<Map<String, Object>> page = new Page<>(pageNum, pageSize);
|
Page<Map<String, Object>> page = new Page<>(pageNum, pageSize);
|
||||||
Map<String, Object> params = buildQueryParams(queryDTO);
|
Map<String, Object> params = buildQueryParams(queryDTO);
|
||||||
com.baomidou.mybatisplus.core.metadata.IPage<Map<String, Object>> pageResult =
|
com.baomidou.mybatisplus.core.metadata.IPage<Map<String, Object>> pageResult =
|
||||||
cancelRevokeMapper.selectRevokedEntPage(page, params);
|
cancelRevokeMapper.selectRevokedEntPage(page, params);
|
||||||
|
|
||||||
CancelRevokePageVO result = new CancelRevokePageVO();
|
CancelRevokePageVO result = new CancelRevokePageVO();
|
||||||
result.setList(pageResult.getRecords());
|
result.setList(pageResult.getRecords());
|
||||||
|
|
@ -482,8 +492,8 @@ public class CancelRevokeServiceImpl extends BaseController implements ICancelRe
|
||||||
// 获取当前用户的待办任务
|
// 获取当前用户的待办任务
|
||||||
LambdaQueryWrapper<TSTaskList> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<TSTaskList> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(TSTaskList::getSignuserid, user.getPrimaryKey())
|
wrapper.eq(TSTaskList::getSignuserid, user.getPrimaryKey())
|
||||||
.eq(TSTaskList::getBustype, BIZ_TYPE_CANCEL_REVOKE)
|
.eq(TSTaskList::getBustype, BIZ_TYPE_CANCEL_REVOKE)
|
||||||
.eq(TSTaskList::getBusstatus, BaseDataConstant.BUSINESS_STATUS_TRANSACT);
|
.eq(TSTaskList::getBusstatus, BaseDataConstant.BUSINESS_STATUS_TRANSACT);
|
||||||
Page<TSTaskList> page = new Page<>(pageNum, pageSize);
|
Page<TSTaskList> page = new Page<>(pageNum, pageSize);
|
||||||
com.baomidou.mybatisplus.core.metadata.IPage<TSTaskList> pageResult = taskListService.page(page, wrapper);
|
com.baomidou.mybatisplus.core.metadata.IPage<TSTaskList> pageResult = taskListService.page(page, wrapper);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public class FlowUtil {
|
||||||
|
|
||||||
public static final String SERILLEGALWORKFLOW = "serIllegalWorkFlow";//严重违法失信名单
|
public static final String SERILLEGALWORKFLOW = "serIllegalWorkFlow";//严重违法失信名单
|
||||||
public static final String SERIOUS_ILLEGAL_WORKFLOW = "seriousIllegalWorkflow";//列入严重违法失信名单
|
public static final String SERIOUS_ILLEGAL_WORKFLOW = "seriousIllegalWorkflow";//列入严重违法失信名单
|
||||||
|
public static final String SERIOUS_ILLEGAL_REM_WORKFLOW = "seriousRemWorkFlow";//移出严重违法失信名单
|
||||||
public static final String SERILLEGALDISSENTWORKFLOW = "serIllegalDissentWorkFlow";//严重违法失信企业 异议
|
public static final String SERILLEGALDISSENTWORKFLOW = "serIllegalDissentWorkFlow";//严重违法失信企业 异议
|
||||||
|
|
||||||
public static final String ANNUAL_DISSENT_WORKFLOW = "annualDissentWorkFlow";//年报公示信息异议
|
public static final String ANNUAL_DISSENT_WORKFLOW = "annualDissentWorkFlow";//年报公示信息异议
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public class ShiroConfig {
|
||||||
filterChainDefinitionMap.put("/user/casLogin_LangChao", DefaultFilter.anon.name());
|
filterChainDefinitionMap.put("/user/casLogin_LangChao", DefaultFilter.anon.name());
|
||||||
filterChainDefinitionMap.put("/user/isHaveUser", DefaultFilter.anon.name());
|
filterChainDefinitionMap.put("/user/isHaveUser", DefaultFilter.anon.name());
|
||||||
filterChainDefinitionMap.put("/abnormal/repair/api/**", DefaultFilter.anon.name());
|
filterChainDefinitionMap.put("/abnormal/repair/api/**", DefaultFilter.anon.name());
|
||||||
|
filterChainDefinitionMap.put("/ims/v1/**", DefaultFilter.anon.name());
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/**", DefaultFilter.anon.name());
|
filterChainDefinitionMap.put("/**", DefaultFilter.anon.name());
|
||||||
// if ("prod172".equals(env)) {
|
// if ("prod172".equals(env)) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.chinaweal.aiccs.org.controller;
|
||||||
|
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsOrgDTO;
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsUserDTO;
|
||||||
|
import com.chinaweal.aiccs.org.entity.vo.ImsResultVO;
|
||||||
|
import com.chinaweal.aiccs.org.service.IImsOrgService;
|
||||||
|
import com.chinaweal.aiccs.org.service.IImsUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS统一身份管理系统数据同步接口
|
||||||
|
* 用于接收吉大正元IMS推送的机构和用户数据
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ims/v1")
|
||||||
|
@Api(tags = "IMS统一身份同步接口")
|
||||||
|
public class ImsSyncController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IImsOrgService imsOrgService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IImsUserService imsUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构同步接口
|
||||||
|
* 接收IMS推送的机构数据
|
||||||
|
*
|
||||||
|
* @param dto 机构同步数据
|
||||||
|
* @return 同步结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/org/orgSynchronous")
|
||||||
|
@ApiOperation(value = "机构同步接口", notes = "接收IMS推送的机构数据,支持新增、修改、删除操作")
|
||||||
|
public ImsResultVO orgSynchronous(@RequestBody ImsOrgDTO dto) {
|
||||||
|
log.info("IMS机构同步请求: type={}, orgCode={}", dto.getType(), dto.getCode());
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean result = imsOrgService.syncOrg(dto);
|
||||||
|
if (result) {
|
||||||
|
return ImsResultVO.ok();
|
||||||
|
} else {
|
||||||
|
return ImsResultVO.fail("机构同步失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("IMS机构同步异常: {}", e.getMessage(), e);
|
||||||
|
return ImsResultVO.fail("机构同步异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户同步接口
|
||||||
|
* 接收IMS推送的用户数据
|
||||||
|
*
|
||||||
|
* @param dto 用户同步数据
|
||||||
|
* @return 同步结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/user/userSynchronous")
|
||||||
|
@ApiOperation(value = "用户同步接口", notes = "接收IMS推送的用户数据,支持新增、修改、删除操作")
|
||||||
|
public ImsResultVO userSynchronous(@RequestBody ImsUserDTO dto) {
|
||||||
|
log.info("IMS用户同步请求: type={}, userCode={}", dto.getType(), dto.getUsercode());
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean result = imsUserService.syncUser(dto);
|
||||||
|
if (result) {
|
||||||
|
return ImsResultVO.ok();
|
||||||
|
} else {
|
||||||
|
return ImsResultVO.fail("用户同步失败");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("IMS用户同步异常: {}", e.getMessage(), e);
|
||||||
|
return ImsResultVO.fail("用户同步异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接测试接口
|
||||||
|
* 用于IMS系统测试连接是否正常
|
||||||
|
*
|
||||||
|
* @return 测试结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/test")
|
||||||
|
@ApiOperation(value = "连接测试接口", notes = "测试与IMS系统的连接是否正常")
|
||||||
|
public ImsResultVO testConnection() {
|
||||||
|
log.info("IMS连接测试请求");
|
||||||
|
return ImsResultVO.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.chinaweal.aiccs.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS(统一身份认证)的机构表
|
||||||
|
* @author lroyia
|
||||||
|
* @since 2026/3/23 13:51
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("IMS(统一身份认证)的机构")
|
||||||
|
@TableName(value = "IMS_ORG", schema = "CXAICORG")
|
||||||
|
public class ImsOrg implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构编码
|
||||||
|
*/
|
||||||
|
@TableId("CODE")
|
||||||
|
@ApiModelProperty("机构编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区编码
|
||||||
|
*/
|
||||||
|
@TableField("AREACODE")
|
||||||
|
@ApiModelProperty("地区编码")
|
||||||
|
private String areacode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构层级
|
||||||
|
*/
|
||||||
|
@TableField("PR")
|
||||||
|
@ApiModelProperty("机构层级")
|
||||||
|
private String pr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构名称
|
||||||
|
*/
|
||||||
|
@TableField("NAME")
|
||||||
|
@ApiModelProperty("机构名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级机构
|
||||||
|
*/
|
||||||
|
@TableField("PARENT")
|
||||||
|
@ApiModelProperty("上级机构")
|
||||||
|
private String parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机构状态
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("机构状态")
|
||||||
|
@TableField("orgstate")
|
||||||
|
private String orgstate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是部门
|
||||||
|
*/
|
||||||
|
@TableField("IS_DEPART")
|
||||||
|
@ApiModelProperty("是否是部门")
|
||||||
|
private String isDepart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一社会信用代码
|
||||||
|
*/
|
||||||
|
@TableField("ID")
|
||||||
|
@ApiModelProperty("统一社会信用代码")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级机构编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("上级机构编码")
|
||||||
|
@TableField("PARENTCODE")
|
||||||
|
private String parentcode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 局规
|
||||||
|
*/
|
||||||
|
@TableField("RB")
|
||||||
|
@ApiModelProperty("局规")
|
||||||
|
private String rb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通讯地址
|
||||||
|
*/
|
||||||
|
@TableField("CA")
|
||||||
|
@ApiModelProperty("通讯地址")
|
||||||
|
private String ca;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField("CREATE_TIME")
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField("UPDATE_TIME")
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除(0否1是)
|
||||||
|
*/
|
||||||
|
@TableField("DELETED")
|
||||||
|
@ApiModelProperty("是否删除(0否1是)")
|
||||||
|
private String deleted;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package com.chinaweal.aiccs.org.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS(统一身份认证)的用户表
|
||||||
|
*
|
||||||
|
* @author lroyia
|
||||||
|
* @since 2026/3/23 14:04
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("IMS(统一身份认证)的用户表")
|
||||||
|
@TableName(value = "IMS_USER", schema = "CXAICORG")
|
||||||
|
public class ImsUser implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编码
|
||||||
|
*/
|
||||||
|
@TableId("USERCODE")
|
||||||
|
@ApiModelProperty("用户编码")
|
||||||
|
private String usercode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("手机号")
|
||||||
|
@TableField("MOBILE")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
@TableField("USERNAME")
|
||||||
|
@ApiModelProperty("姓名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发证日期
|
||||||
|
*/
|
||||||
|
@TableField("CERDATE")
|
||||||
|
@ApiModelProperty("发证日期")
|
||||||
|
private String cerdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 固定电话
|
||||||
|
*/
|
||||||
|
@TableField("LANDLINE")
|
||||||
|
@ApiModelProperty("固定电话")
|
||||||
|
private String landline;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作性质
|
||||||
|
*/
|
||||||
|
@TableField("JOBNA")
|
||||||
|
@ApiModelProperty("工作性质")
|
||||||
|
private String jobna;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@TableField("GENDER")
|
||||||
|
@ApiModelProperty("性别")
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法证号
|
||||||
|
*/
|
||||||
|
@TableField("LECN")
|
||||||
|
@ApiModelProperty("执法证号")
|
||||||
|
private String lecn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否漫游
|
||||||
|
*/
|
||||||
|
@TableField("IS_ROAM")
|
||||||
|
@ApiModelProperty("是否漫游")
|
||||||
|
private String isRoam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@TableField("STATUS")
|
||||||
|
@ApiModelProperty("状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织机构
|
||||||
|
*/
|
||||||
|
@TableField("USERORG")
|
||||||
|
@ApiModelProperty("组织机构")
|
||||||
|
private String userorg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证号
|
||||||
|
*/
|
||||||
|
@TableField("ID_CARD")
|
||||||
|
@ApiModelProperty("身份证号")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
@TableField("EMAIL")
|
||||||
|
@ApiModelProperty("邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField("CREATE_TIME")
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField("UPDATE_TIME")
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否删除(0否1是)
|
||||||
|
*/
|
||||||
|
@TableField("DELETED")
|
||||||
|
@ApiModelProperty("是否删除(0否1是)")
|
||||||
|
private String deleted;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.chinaweal.aiccs.org.entity.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS机构同步DTO
|
||||||
|
* 用于接收吉大正元IMS推送的机构数据
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(description = "IMS机构同步DTO")
|
||||||
|
public class ImsOrgDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "操作类型: add-新增/修改, delete-删除, test-测试连接")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "地区编码")
|
||||||
|
private String areacode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构层级")
|
||||||
|
private String pr;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上级机构")
|
||||||
|
private String parent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构状态")
|
||||||
|
private String orgstate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否是部门")
|
||||||
|
private String isDepart;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "统一社会信用代码")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上级机构编码")
|
||||||
|
private String parentcode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "局规")
|
||||||
|
private String rb;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "通讯地址")
|
||||||
|
private String ca;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.chinaweal.aiccs.org.entity.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS用户同步DTO
|
||||||
|
* 用于接收吉大正元IMS推送的用户数据
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(description = "IMS用户同步DTO")
|
||||||
|
public class ImsUserDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "操作类型: add-新增/修改, delete-删除, test-测试连接")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编码")
|
||||||
|
private String usercode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "姓名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发证日期")
|
||||||
|
private String cerdate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "固定电话")
|
||||||
|
private String landline;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工作性质")
|
||||||
|
private String jobna;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "性别")
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "执法证号")
|
||||||
|
private String lecn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否漫游")
|
||||||
|
private String isRoam;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "组织机构")
|
||||||
|
private String userorg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "身份证号")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱")
|
||||||
|
private String email;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.chinaweal.aiccs.org.entity.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS响应结果
|
||||||
|
* @author lroyia
|
||||||
|
* @since 2026/3/23 13:44
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@ApiModel("IMS响应结果")
|
||||||
|
public class ImsResultVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static final String SUCCESS_MSG = "success";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应信息
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("响应信息")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功
|
||||||
|
*
|
||||||
|
* @return 信息体
|
||||||
|
*/
|
||||||
|
public static ImsResultVO ok() {
|
||||||
|
ImsResultVO resultVO = new ImsResultVO();
|
||||||
|
resultVO.setCode("0");
|
||||||
|
resultVO.setMessage(SUCCESS_MSG);
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败
|
||||||
|
*
|
||||||
|
* @param msg 失败消息
|
||||||
|
* @return 信息体
|
||||||
|
*/
|
||||||
|
public static ImsResultVO fail(String msg) {
|
||||||
|
ImsResultVO resultVO = new ImsResultVO();
|
||||||
|
resultVO.setCode("1");
|
||||||
|
resultVO.setMessage(msg);
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chinaweal.aiccs.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS(统一身份认证)的机构表 Mapper
|
||||||
|
* @author lroyia
|
||||||
|
* @since 2026/3/23 14:21
|
||||||
|
**/
|
||||||
|
public interface ImsOrgMapper extends BaseMapper<ImsOrg> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chinaweal.aiccs.org.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS(统一身份认证)的用户表
|
||||||
|
* @author lroyia
|
||||||
|
* @since 2026/3/23 14:21
|
||||||
|
**/
|
||||||
|
public interface ImsUserMapper extends BaseMapper<ImsUser> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.chinaweal.aiccs.org.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsOrg;
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsOrgDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS机构同步服务接口
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
public interface IImsOrgService extends IService<ImsOrg> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步机构数据
|
||||||
|
*
|
||||||
|
* @param dto 机构同步数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean syncOrg(ImsOrgDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步新增或修改机构
|
||||||
|
*
|
||||||
|
* @param dto 机构数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean addOrUpdateOrg(ImsOrgDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除机构
|
||||||
|
*
|
||||||
|
* @param dto 机构数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean removeOrg(ImsOrgDTO dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.chinaweal.aiccs.org.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsUser;
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsUserDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS用户同步服务接口
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
public interface IImsUserService extends IService<ImsUser> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步用户数据
|
||||||
|
*
|
||||||
|
* @param dto 用户同步数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean syncUser(ImsUserDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步新增或修改用户
|
||||||
|
*
|
||||||
|
* @param dto 用户数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean addOrUpdateUser(ImsUserDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户
|
||||||
|
*
|
||||||
|
* @param dto 用户数据
|
||||||
|
* @return true-成功, false-失败
|
||||||
|
*/
|
||||||
|
boolean removeUser(ImsUserDTO dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.chinaweal.aiccs.org.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chinaweal.aiccs.common.util.StringUtils;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsOrg;
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsOrgDTO;
|
||||||
|
import com.chinaweal.aiccs.org.mapper.ImsOrgMapper;
|
||||||
|
import com.chinaweal.aiccs.org.service.IImsOrgService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS机构同步服务实现
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ImsOrgServiceImpl extends ServiceImpl<ImsOrgMapper, ImsOrg> implements IImsOrgService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ImsOrgServiceImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean syncOrg(ImsOrgDTO dto) {
|
||||||
|
if (dto == null || dto.getType() == null) {
|
||||||
|
logger.error("IMS机构同步失败: 参数为空或类型未指定");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String type = dto.getType();
|
||||||
|
try {
|
||||||
|
switch (type) {
|
||||||
|
case "add":
|
||||||
|
return addOrUpdateOrg(dto);
|
||||||
|
case "delete":
|
||||||
|
return removeOrg(dto);
|
||||||
|
case "test":
|
||||||
|
logger.info("IMS机构连接测试成功");
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
logger.warn("IMS机构同步失败: 未知的操作类型 {}", type);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("IMS机构同步异常: {}", e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean addOrUpdateOrg(ImsOrgDTO dto) {
|
||||||
|
if (dto.getCode() == null || dto.getCode().isEmpty()) {
|
||||||
|
logger.error("IMS机构同步失败: 机构编码为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("IMS机构同步[新增/修改]: code={}, name={}", dto.getCode(), dto.getName());
|
||||||
|
|
||||||
|
// 根据机构编码查询是否已存在
|
||||||
|
ImsOrg existOrg = this.getById(dto.getCode());
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
if (existOrg != null) {
|
||||||
|
// 存在则更新
|
||||||
|
logger.info("IMS机构同步: 发现已有机构, 执行更新, code={}", existOrg.getCode());
|
||||||
|
existOrg.setName(dto.getName());
|
||||||
|
existOrg.setAreacode(dto.getAreacode());
|
||||||
|
existOrg.setPr(dto.getPr());
|
||||||
|
existOrg.setParent(dto.getParent());
|
||||||
|
existOrg.setOrgstate(dto.getOrgstate());
|
||||||
|
existOrg.setIsDepart(dto.getIsDepart());
|
||||||
|
existOrg.setId(dto.getId());
|
||||||
|
existOrg.setParentcode(dto.getParentcode());
|
||||||
|
existOrg.setRb(dto.getRb());
|
||||||
|
existOrg.setCa(dto.getCa());
|
||||||
|
existOrg.setUpdateTime(now);
|
||||||
|
return this.updateById(existOrg);
|
||||||
|
} else {
|
||||||
|
// 不存在则新增
|
||||||
|
logger.info("IMS机构同步: 未发现已有机构, 执行新增");
|
||||||
|
ImsOrg newOrg = new ImsOrg();
|
||||||
|
newOrg.setCode(dto.getCode());
|
||||||
|
newOrg.setName(dto.getName());
|
||||||
|
newOrg.setAreacode(dto.getAreacode());
|
||||||
|
newOrg.setPr(dto.getPr());
|
||||||
|
newOrg.setParent(dto.getParent());
|
||||||
|
newOrg.setOrgstate(dto.getOrgstate());
|
||||||
|
newOrg.setIsDepart(dto.getIsDepart());
|
||||||
|
newOrg.setId(dto.getId());
|
||||||
|
newOrg.setParentcode(dto.getParentcode());
|
||||||
|
newOrg.setRb(dto.getRb());
|
||||||
|
newOrg.setCa(dto.getCa());
|
||||||
|
newOrg.setCreateTime(now);
|
||||||
|
newOrg.setUpdateTime(now);
|
||||||
|
return this.save(newOrg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean removeOrg(ImsOrgDTO dto) {
|
||||||
|
if (StringUtils.isBlank(dto.getCode())) {
|
||||||
|
logger.error("IMS机构删除失败: 机构编码为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("IMS机构同步[删除]: orgCode={}", dto.getCode());
|
||||||
|
|
||||||
|
// 根据机构编码查询机构
|
||||||
|
ImsOrg existOrg = this.getById(dto.getCode());
|
||||||
|
if (existOrg == null) {
|
||||||
|
logger.warn("IMS机构删除: 机构不存在, orgCode={}", dto.getCode());
|
||||||
|
return true; // 不存在也返回成功
|
||||||
|
}
|
||||||
|
|
||||||
|
// 逻辑删除
|
||||||
|
existOrg.setDeleted("1");
|
||||||
|
existOrg.setUpdateTime(LocalDateTime.now());
|
||||||
|
return this.updateById(existOrg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.chinaweal.aiccs.org.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chinaweal.aiccs.org.entity.ImsUser;
|
||||||
|
import com.chinaweal.aiccs.org.entity.dto.ImsUserDTO;
|
||||||
|
import com.chinaweal.aiccs.org.mapper.ImsUserMapper;
|
||||||
|
import com.chinaweal.aiccs.org.service.IImsUserService;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMS用户同步服务实现
|
||||||
|
*
|
||||||
|
* @author aiccs
|
||||||
|
* @since 2026-03-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ImsUserServiceImpl extends ServiceImpl<ImsUserMapper, ImsUser> implements IImsUserService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ImsUserServiceImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean syncUser(ImsUserDTO dto) {
|
||||||
|
if (dto == null || dto.getType() == null) {
|
||||||
|
logger.error("IMS用户同步失败: 参数为空或类型未指定");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String type = dto.getType();
|
||||||
|
try {
|
||||||
|
switch (type) {
|
||||||
|
case "add":
|
||||||
|
return addOrUpdateUser(dto);
|
||||||
|
case "delete":
|
||||||
|
return removeUser(dto);
|
||||||
|
case "test":
|
||||||
|
logger.info("IMS用户连接测试成功");
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
logger.warn("IMS用户同步失败: 未知的操作类型 {}", type);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("IMS用户同步异常: {}", e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean addOrUpdateUser(ImsUserDTO dto) {
|
||||||
|
if (StringUtils.isBlank(dto.getUsercode())) {
|
||||||
|
logger.error("IMS用户同步失败: 用户编号为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("IMS用户同步[新增/修改]: usercode={}, username={}", dto.getUsercode(), dto.getUsername());
|
||||||
|
|
||||||
|
// 根据用户编号查询是否已存在
|
||||||
|
ImsUser existUser = this.getById(dto.getUsercode());
|
||||||
|
|
||||||
|
if (existUser != null) {
|
||||||
|
// 存在则更新
|
||||||
|
logger.info("IMS用户同步: 发现已有用户, 执行更新, usercode={}", existUser.getUsercode());
|
||||||
|
updateImsUserFromDto(existUser, dto);
|
||||||
|
this.updateById(existUser);
|
||||||
|
} else {
|
||||||
|
// 不存在则新增
|
||||||
|
logger.info("IMS用户同步: 未发现已有用户, 执行新增");
|
||||||
|
ImsUser newUser = new ImsUser();
|
||||||
|
newUser.setUsercode(dto.getUsercode());
|
||||||
|
newUser.setUsername(dto.getUsername());
|
||||||
|
newUser.setMobile(dto.getMobile());
|
||||||
|
newUser.setGender(dto.getGender());
|
||||||
|
newUser.setEmail(dto.getEmail());
|
||||||
|
newUser.setIdCard(dto.getIdCard());
|
||||||
|
newUser.setLandline(dto.getLandline());
|
||||||
|
newUser.setJobna(dto.getJobna());
|
||||||
|
newUser.setLecn(dto.getLecn());
|
||||||
|
newUser.setCerdate(dto.getCerdate());
|
||||||
|
newUser.setIsRoam(dto.getIsRoam());
|
||||||
|
newUser.setStatus(dto.getStatus());
|
||||||
|
newUser.setUserorg(dto.getUserorg());
|
||||||
|
newUser.setDeleted("0");
|
||||||
|
this.save(newUser);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean removeUser(ImsUserDTO dto) {
|
||||||
|
if (StringUtils.isBlank(dto.getUsercode())) {
|
||||||
|
logger.error("IMS用户删除失败: 用户编号为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("IMS用户同步[删除]: usercode={}", dto.getUsercode());
|
||||||
|
|
||||||
|
ImsUser existUser = this.getById(dto.getUsercode());
|
||||||
|
if (existUser == null) {
|
||||||
|
logger.warn("IMS用户删除: 用户不存在, usercode={}", dto.getUsercode());
|
||||||
|
return true; // 不存在也返回成功
|
||||||
|
}
|
||||||
|
|
||||||
|
// 逻辑删除
|
||||||
|
existUser.setDeleted("1");
|
||||||
|
this.updateById(existUser);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据DTO更新ImsUser对象
|
||||||
|
*/
|
||||||
|
private void updateImsUserFromDto(ImsUser user, ImsUserDTO dto) {
|
||||||
|
user.setUsername(dto.getUsername());
|
||||||
|
user.setMobile(dto.getMobile());
|
||||||
|
user.setGender(dto.getGender());
|
||||||
|
user.setEmail(dto.getEmail());
|
||||||
|
user.setIdCard(dto.getIdCard());
|
||||||
|
user.setLandline(dto.getLandline());
|
||||||
|
user.setJobna(dto.getJobna());
|
||||||
|
user.setLecn(dto.getLecn());
|
||||||
|
user.setCerdate(dto.getCerdate());
|
||||||
|
user.setIsRoam(dto.getIsRoam());
|
||||||
|
user.setStatus(dto.getStatus());
|
||||||
|
user.setUserorg(dto.getUserorg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.chinaweal.aiccs.org.mapper.ImsOrgMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?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.chinaweal.aiccs.org.mapper.ImsUserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue