|
@@ -6,9 +6,13 @@ package com.jeeplus.sys.service;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.jeeplus.sys.domain.Cert;
|
|
|
import com.jeeplus.sys.domain.Office;
|
|
|
+import com.jeeplus.sys.mapper.CertMapper;
|
|
|
import com.jeeplus.sys.mapper.OfficeMapper;
|
|
|
+import com.jeeplus.sys.service.dto.CertDTO;
|
|
|
import com.jeeplus.sys.service.dto.LoginUserOnlineDTO;
|
|
|
+import com.jeeplus.sys.service.mapstruct.CertWrapper;
|
|
|
import com.jeeplus.sys.utils.ServletUtils;
|
|
|
import com.jeeplus.sys.utils.ip.AddressUtils;
|
|
|
import com.jeeplus.sys.utils.ip.IpUtils;
|
|
@@ -61,6 +65,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
|
|
|
@Autowired
|
|
|
private OfficeMapper officeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CertService certService;
|
|
|
+
|
|
|
/**
|
|
|
* 单一登录判断,是否允许登录
|
|
|
* @return
|
|
@@ -382,4 +389,30 @@ public class UserService extends ServiceImpl<UserMapper, User> {
|
|
|
public List<UserDTO> getUserInfoByMobile(UserDTO userDTO) {
|
|
|
return userMapper.getUserInfoByMobile(userDTO);
|
|
|
}
|
|
|
+
|
|
|
+// 保存人员执业资质
|
|
|
+ public void saveCertList(UserDTO userDTO) {
|
|
|
+ if (ObjectUtil.isNotEmpty(userDTO)) {
|
|
|
+ if (CollectionUtil.isNotEmpty(userDTO.getCertDTOList())) {
|
|
|
+ List<String> ids = userDTO.getCertDTOList().stream().filter(item -> {
|
|
|
+ if (com.jeeplus.sys.utils.StringUtils.isNotBlank(item.getId())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).map(CertDTO::getId).collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(ids)) {
|
|
|
+ certService.remove(new QueryWrapper<Cert>().lambda().eq(Cert::getUserId,userDTO.getId()).notIn(Cert::getId,ids));
|
|
|
+ }else{
|
|
|
+ certService.remove(new QueryWrapper<Cert>().lambda().eq(Cert::getUserId,userDTO.getId()));
|
|
|
+ }
|
|
|
+ userDTO.getCertDTOList().stream().forEach(item->{
|
|
|
+ Cert cert = CertWrapper.INSTANCE.toEntity(item);
|
|
|
+ cert.setUserId(userDTO.getId());
|
|
|
+ certService.saveOrUpdate(cert);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ certService.remove(new QueryWrapper<Cert>().lambda().eq(Cert::getUserId,userDTO.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|