| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | |
| | | sysUserDeptVo.setCampusid("1"); |
| | | //根据userName判断一下,是不是之前有新增 |
| | | SysUserDept sysUserDeptOld = null; |
| | | List<SysUserDept> SysUserDeptList = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptVo); |
| | | if (CollectionUtils.isNotEmpty(SysUserDeptList)) { |
| | | sysUserDeptOld = SysUserDeptList.get(0); |
| | | List<SysUserDept> sysUserDeptList = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptVo); |
| | | if (CollectionUtils.isNotEmpty(sysUserDeptList)) { |
| | | sysUserDeptOld = sysUserDeptList.get(0); |
| | | } |
| | | if (ObjectUtils.isEmpty(sysUserDeptOld)) { |
| | | int i = sysUserDeptMapper.insertSysUserDept(sysUserDept); |
| | |
| | | //更新sys-user deptId |
| | | if(StringUtils.isNotEmpty(externalUserDeptInfo.getKeShiID())){ |
| | | sysUser.setDeptId(Long.valueOf(externalUserDeptInfo.getKeShiID())); |
| | | //查询用户科室关系 |
| | | SysUserDept sysUserDeptTemp = new SysUserDept(); |
| | | sysUserDeptTemp.setUserId(sysUser.getUserId()); |
| | | sysUserDeptTemp.setOrgid(externalUserDeptInfo.getZuZhiJGID()); |
| | | List<SysUserDept> sysUserDepts = sysUserDeptMapper.selectSysUserDeptList(sysUserDeptTemp); |
| | | List<String> userDepts = sysUserDepts.stream().map(SysUserDept::getDeptCode). |
| | | distinct().collect(Collectors.toList()); |
| | | //和queryHospUserInfoList采集的数据格式保持一致 |
| | | List<List<String>> userDeptsList = new ArrayList<>(); |
| | | if(!sysUserDeptList.isEmpty()){ |
| | | for(String userDept: userDepts){ |
| | | List<String> uDept = new ArrayList<>(); |
| | | uDept.add(userDept); |
| | | userDeptsList.add(uDept); |
| | | } |
| | | } |
| | | //将部门我病区放到指定字段中 |
| | | Gson gson = new Gson(); |
| | | sysUser.setHospInfo(gson.toJson(userDeptsList)); |
| | | |
| | | sysUserMapper.updateUser(sysUser); |
| | | } |
| | | } |