| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.catalina.User; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CacheConstant; |
| | |
| | | import org.jeecg.common.util.PasswordUtil; |
| | | import org.jeecg.common.util.UUIDGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.base.entity.UserFactory; |
| | | import org.jeecg.modules.base.mapper.UserFactoryMapper; |
| | | import org.jeecg.modules.base.service.BaseCommonService; |
| | | import org.jeecg.modules.mdc.entity.MdcUserProduction; |
| | | import org.jeecg.modules.mdc.mapper.MdcUserProductionMapper; |
| | | import org.jeecg.modules.system.entity.*; |
| | | import org.jeecg.modules.system.mapper.*; |
| | | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
| | |
| | | @Autowired |
| | | SysRoleIndexMapper sysRoleIndexMapper; |
| | | @Resource |
| | | UserFactoryMapper userFactoryMapper; |
| | | @Resource |
| | | MdcUserProductionMapper mdcUserProductionMapper; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | @Resource |
| | | private MdcProductionEquipmentMapper mdcProductionEquipmentMapper; |
| | | @Resource |
| | | private DncDevicePermissionMapper dncDevicePermissionMapper; |
| | | |
| | | @Override |
| | | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) |
| | |
| | | } |
| | | } |
| | | //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); |
| | | } |
| | | } |
| | | // 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); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | //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); |
| | | } |
| | | } |
| | | // 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"); |
| | |
| | | (existing, replacement) -> existing // 重复键处理 |
| | | )); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据班组Id查询 |
| | | * @param page |
| | | * @param groupId 班组id |
| | | * @param username 用户账户名称 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<SysUser> getUserByGroupId(Page<SysUser> page, String groupId, String username) { |
| | | return userMapper.getUserByGroupId(page,groupId,username); |
| | | } |
| | | |
| | | /** |
| | | * 根据产线Id查询 |
| | | * @param page |
| | | * @param factoryId 班组id |
| | | * @param username 用户账户名称 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<SysUser> getUserByFactoryId(Page<SysUser> page, String factoryId, String username) { |
| | | return userMapper.getUserByFactoryId(page,factoryId,username); |
| | | } |
| | | } |