|
|
@ -2,6 +2,7 @@ package com.hnac.hzims.basic.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
|
|
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
|
|
|
import com.hnac.hzims.basic.entity.PersonManagemetEntity; |
|
|
|
import com.hnac.hzims.basic.entity.PersonManagemetEntity; |
|
|
@ -22,6 +23,9 @@ import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.xml.ws.WebServiceException; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -37,7 +41,7 @@ import java.util.stream.Collectors; |
|
|
|
public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemetMapper, PersonManagemetEntity> implements IImsPresonManagementService { |
|
|
|
public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemetMapper, PersonManagemetEntity> implements IImsPresonManagementService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ISysClient sysClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
private final IImsCertificatetService certificatetService; |
|
|
|
private final IImsCertificatetService certificatetService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,44 +63,51 @@ public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemet |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Boolean submit(PersonManagemetVo personManagemetVo) { |
|
|
|
public R submit(PersonManagemetVo personManagemetVo) throws IllegalAccessException { |
|
|
|
try { |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(personManagemetVo)) { |
|
|
|
if (ObjectUtil.isNotEmpty(personManagemetVo)) { |
|
|
|
PersonManagemetEntity personManagemetEntity = new PersonManagemetEntity(); |
|
|
|
PersonManagemetEntity personManagemetEntity = new PersonManagemetEntity(); |
|
|
|
BeanUtil.copy(personManagemetVo, personManagemetEntity); |
|
|
|
BeanUtil.copy(personManagemetVo, personManagemetEntity); |
|
|
|
if (StringUtils.isBlank(personManagemetEntity.getUnitName())){ |
|
|
|
if (!allFieldsNull(personManagemetEntity)) { |
|
|
|
String deptId = AuthUtil.getDeptId(); |
|
|
|
if (StringUtils.isBlank(personManagemetEntity.getUnitName())){ |
|
|
|
R<String> deptName = sysClient.getDeptName(Long.valueOf(deptId)); |
|
|
|
String deptId = AuthUtil.getDeptId(); |
|
|
|
if (deptName.isSuccess()&&StringUtils.isBlank(deptName.getData())){ |
|
|
|
R<String> deptName = sysClient.getDeptName(Long.valueOf(deptId)); |
|
|
|
personManagemetEntity.setUnitName(deptName.getData()); |
|
|
|
if (deptName.isSuccess()&&StringUtils.isNotBlank(deptName.getData())){ |
|
|
|
|
|
|
|
personManagemetEntity.setUnitName(deptName.getData()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Integer count = baseMapper.selectCount(Wrappers.<PersonManagemetEntity>query().lambda() |
|
|
|
if (ObjectUtil.isNotEmpty(personManagemetEntity)) { |
|
|
|
.eq(PersonManagemetEntity::getUserId, personManagemetEntity.getUserId()) |
|
|
|
this.saveOrUpdate(personManagemetEntity); |
|
|
|
.eq(PersonManagemetEntity::getIsDeleted, 0)); |
|
|
|
|
|
|
|
if (count>0){ |
|
|
|
|
|
|
|
return R.fail("该用户已存在,请重新编辑!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.saveOrUpdate(personManagemetEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtil.isNotEmpty(personManagemetVo.getCertificatetEntityList())) { |
|
|
|
if (CollectionUtil.isNotEmpty(personManagemetVo.getCertificatetEntityList())) { |
|
|
|
List<CertificatetEntity> certificatetList = personManagemetVo.getCertificatetEntityList().stream().map( |
|
|
|
List<CertificatetEntity> certificatetList = personManagemetVo.getCertificatetEntityList().stream().map( |
|
|
|
s -> { |
|
|
|
s -> { |
|
|
|
s.setPersonId(personManagemetEntity.getId().toString()); |
|
|
|
if(StringUtils.isBlank(s.getPersonId())){ |
|
|
|
if (System.currentTimeMillis() > s.getDeadTime().getTime()){ |
|
|
|
s.setPersonId(personManagemetEntity.getId().toString()); |
|
|
|
s.setStatus(2); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
s.setStatus(1); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|
).collect(Collectors.toList()); |
|
|
|
).collect(Collectors.toList()); |
|
|
|
certificatetService.saveOrUpdateBatch(certificatetList); |
|
|
|
certificatetService.saveOrUpdateBatch(certificatetList); |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return R.success("保存成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return R.fail("保存失败"); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("入参 personManagemetVo" + personManagemetVo + ":" + e); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean allFieldsNull(Object obj) throws IllegalAccessException { |
|
|
|
|
|
|
|
for (Field field : obj.getClass().getDeclaredFields()) { |
|
|
|
|
|
|
|
field.setAccessible(true); |
|
|
|
|
|
|
|
if (field.get(obj) != null) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo) { |
|
|
|
public Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo) { |
|
|
|