Browse Source

证书管理接口修改

zhongwei
ty 11 months ago
parent
commit
9c02950486
  1. 6
      hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/PersonManagemetEntity.java
  2. 8
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java
  3. 6
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml
  4. 3
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsPresonManagementService.java
  5. 39
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java

6
hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/PersonManagemetEntity.java

@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* 实体类
@ -18,9 +20,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
@TableName("hzims_person_managemet")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "人员管理表", description = "人员管理表")
public class PersonManagemetEntity extends TenantEntity {
private static final long serialVersionUID = 1L;
public class PersonManagemetEntity extends TenantEntity implements Serializable {
/**
* 用户ID

8
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java

@ -61,12 +61,8 @@ public class PresonManagementController extends BladeController {
@PostMapping ("/submit")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "增加", notes = "传入imsDutyClass")
public R submit(@RequestBody PersonManagemetVo personManagemetVo) {
Boolean submit = iImsPresonManagementService.submit(personManagemetVo);
if (submit){
return R.success("保存成功");
}
return R.fail("保存失败");
public R submit(@RequestBody PersonManagemetVo personManagemetVo) throws IllegalAccessException {
return iImsPresonManagementService.submit(personManagemetVo);
}
/**

6
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml

@ -19,7 +19,7 @@
<result property="deadTime" column="dead_time" />
<result property="pic" column="pic" />
<result property="status" column="status" />
<result property="createTime" column="CREATE_TIME" />
<result property="createTime" column="BCREATE_TIME" />
<result property="isDead" column="isDead" />
</collection>
</resultMap>
@ -27,8 +27,8 @@
<!--嵌套查询-->
<select id="getPersonManagemetEntity" resultMap="PersonManagemetMap">
select a.id ,a.name,a.unit_name ,a.sex,a.job ,a.academic_title,a.phone ,a.CREATE_TIME,
b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME,b.status,b.create_dept,
case when b.dead_time is null then ""
b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME as BCREATE_TIME,b.status,b.create_dept,
case when b.dead_time is null then null
when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead
from hzims_person_managemet as a
left join hzims_certificatet as b

3
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsPresonManagementService.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.basic.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.vo.PersonManagemetVo;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
/**
* 服务类
@ -15,7 +16,7 @@ public interface IImsPresonManagementService extends IService<PersonManagemetEnt
IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query);
Boolean submit(PersonManagemetVo personManagemetVo);
R submit(PersonManagemetVo personManagemetVo) throws IllegalAccessException;
Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo);
}

39
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java

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

Loading…
Cancel
Save