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. 55
      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.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity; 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") @TableName("hzims_person_managemet")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "人员管理表", description = "人员管理表") @ApiModel(value = "人员管理表", description = "人员管理表")
public class PersonManagemetEntity extends TenantEntity { public class PersonManagemetEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* 用户ID * 用户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") @PostMapping ("/submit")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "增加", notes = "传入imsDutyClass") @ApiOperation(value = "增加", notes = "传入imsDutyClass")
public R submit(@RequestBody PersonManagemetVo personManagemetVo) { public R submit(@RequestBody PersonManagemetVo personManagemetVo) throws IllegalAccessException {
Boolean submit = iImsPresonManagementService.submit(personManagemetVo); return iImsPresonManagementService.submit(personManagemetVo);
if (submit){
return R.success("保存成功");
}
return R.fail("保存失败");
} }
/** /**

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="deadTime" column="dead_time" />
<result property="pic" column="pic" /> <result property="pic" column="pic" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="createTime" column="CREATE_TIME" /> <result property="createTime" column="BCREATE_TIME" />
<result property="isDead" column="isDead" /> <result property="isDead" column="isDead" />
</collection> </collection>
</resultMap> </resultMap>
@ -27,8 +27,8 @@
<!--嵌套查询--> <!--嵌套查询-->
<select id="getPersonManagemetEntity" resultMap="PersonManagemetMap"> <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, 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, 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 "" case when b.dead_time is null then null
when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead
from hzims_person_managemet as a from hzims_person_managemet as a
left join hzims_certificatet as b 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.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.vo.PersonManagemetVo; import com.hnac.hzims.basic.vo.PersonManagemetVo;
import org.springblade.core.mp.support.Query; 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); IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query);
Boolean submit(PersonManagemetVo personManagemetVo); R submit(PersonManagemetVo personManagemetVo) throws IllegalAccessException;
Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo); Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo);
} }

55
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.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) {

Loading…
Cancel
Save