| | |
| | | @Service |
| | | @Slf4j |
| | | public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService { |
| | | |
| | | |
| | | @Autowired |
| | | private SysUserMapper userMapper; |
| | | @Autowired |
| | |
| | | MdcUserProductionMapper mdcUserProductionMapper; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | @Resource |
| | | private MdcProductionEquipmentMapper mdcProductionEquipmentMapper; |
| | | @Resource |
| | | private DncDevicePermissionMapper dncDevicePermissionMapper; |
| | | |
| | | @Override |
| | | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) |
| | |
| | | public SysUser getUserByName(String username) { |
| | | return userMapper.getUserByName(username); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addUserWithRole(SysUser user, String roles) { |
| | |
| | | roleIndex = list.get(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | //如果componentUrl为空,则返回空 |
| | | if(oConvertUtils.isEmpty(roleIndex.getComponent())){ |
| | | return null; |
| | |
| | | info.setSysUserName(sysUser.getRealname()); |
| | | info.setSysOrgCode(sysUser.getOrgCode()); |
| | | } |
| | | |
| | | |
| | | //多部门支持in查询 |
| | | List<SysDepart> list = sysDepartMapper.queryUserDeparts(sysUser.getId()); |
| | | List<String> sysMultiOrgCode = new ArrayList<String>(); |
| | |
| | | } |
| | | } |
| | | info.setSysMultiOrgCode(sysMultiOrgCode); |
| | | |
| | | |
| | | return info; |
| | | } |
| | | |
| | |
| | | sysUserDepartMapper.insert(userDeaprt); |
| | | } |
| | | } |
| | | String[] arr = {}; |
| | | //step.4 保存所属产线 |
| | | if (oConvertUtils.isNotEmpty(selectedProductions)) { |
| | | String[] arr = selectedProductions.split(","); |
| | | arr = selectedProductions.split(","); |
| | | for (String productionId : arr) { |
| | | MdcUserProduction mdcUserProduction = new MdcUserProduction(user.getId(), productionId); |
| | | mdcUserProductionMapper.insert(mdcUserProduction); |
| | | } |
| | | } |
| | | //step.5 保存设备权限 |
| | | List<String> EquipmentIds= mdcProductionEquipmentMapper.selectList(new QueryWrapper<MdcProductionEquipment>().in("production_id",arr)) |
| | | .stream().map(MdcProductionEquipment::getEquipmentId).collect(Collectors.toList()); |
| | | if (oConvertUtils.isNotEmpty(EquipmentIds)) { |
| | | for (String equipmentId : EquipmentIds) { |
| | | DncDevicePermission dncDevicePermission=new DncDevicePermission(); |
| | | dncDevicePermission.setDeviceId(equipmentId); |
| | | dncDevicePermission.setUserId(user.getId()); |
| | | dncDevicePermissionMapper.insert(dncDevicePermission); |
| | | } |
| | | } |
| | | } |
| | |
| | | mdcUserProductionMapper.insert(mdcUserProduction); |
| | | } |
| | | } |
| | | //step.5 修改手机号和邮箱 |
| | | //step.5 修改设备权限 |
| | | //先删后加 |
| | | dncDevicePermissionMapper.delete(new QueryWrapper<DncDevicePermission>().lambda().eq(DncDevicePermission::getUserId, user.getId())); |
| | | List<String> EquipmentIds= mdcProductionEquipmentMapper.selectList(new QueryWrapper<MdcProductionEquipment>().in("production_id",array)) |
| | | .stream().map(MdcProductionEquipment::getEquipmentId).collect(Collectors.toList()); |
| | | if (oConvertUtils.isNotEmpty(EquipmentIds)) { |
| | | for (String equipmentId : EquipmentIds) { |
| | | DncDevicePermission dncDevicePermission=new DncDevicePermission(); |
| | | dncDevicePermission.setDeviceId(equipmentId); |
| | | dncDevicePermission.setUserId(user.getId()); |
| | | dncDevicePermissionMapper.insert(dncDevicePermission); |
| | | } |
| | | } |
| | | //step.6 修改手机号和邮箱 |
| | | // 更新手机号、邮箱空字符串为 null |
| | | userMapper.updateNullByEmptyString("email"); |
| | | userMapper.updateNullByEmptyString("phone"); |