|
|
@@ -12,6 +12,7 @@ import com.zhongzheng.bo.SysCertificateBo;
|
|
|
import com.zhongzheng.common.filter.CustomException;
|
|
|
import com.zhongzheng.common.model.TableDataInfo;
|
|
|
import com.zhongzheng.common.util.DateUtils;
|
|
|
+import com.zhongzheng.common.util.EncryptHandler;
|
|
|
import com.zhongzheng.domian.*;
|
|
|
import com.zhongzheng.mapper.SysCertificateMapper;
|
|
|
import com.zhongzheng.mapper.SysPersonMapper;
|
|
|
@@ -109,6 +110,16 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
List<SysCertificateAddition> arraylist=cetAddList.stream().filter(cet->cet.getCertificateId().equals(element.getCertificateId())).collect(Collectors.toList());
|
|
|
MajorVo[] majorVos=new MajorVo[arraylist.size()];
|
|
|
int i=0;
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(element.getIdCard())) {
|
|
|
+ element.setIdCard(EncryptHandler.decrypt(element.getIdCard()));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(element.getPhone())) {
|
|
|
+ element.setPhone(EncryptHandler.decrypt(element.getPhone()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ /// throw new RuntimeException(e);
|
|
|
+ }
|
|
|
for (SysCertificateAddition m : arraylist) {
|
|
|
majorVos[i]=new MajorVo();
|
|
|
majorVos[i].setMajorId(m.getMajorId());
|
|
|
@@ -173,6 +184,18 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
}
|
|
|
|
|
|
Page<SysCertificate> page = page(new Page<>(entity.getPageNum(), entity.getPageSize()),queryWrapper );
|
|
|
+ page.getRecords().forEach(element -> {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotBlank(element.getIdCard())) {
|
|
|
+ element.setIdCard(EncryptHandler.decrypt(element.getIdCard()));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(element.getPhone())) {
|
|
|
+ element.setPhone(EncryptHandler.decrypt(element.getPhone()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ /// throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
info.setRows(page.getRecords());
|
|
|
info.setTotal(page.getTotal());
|
|
|
info.setCode(HttpStatus.HTTP_OK);
|
|
|
@@ -233,32 +256,42 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
|
|
|
@Override
|
|
|
public long insertCertificate(SysCertificateBo entity) {
|
|
|
- if(entity.getPersonId()==0&&entity.getPersonName().isEmpty()){
|
|
|
- throw new CustomException("参数未有企业员工信息");
|
|
|
- }
|
|
|
- if(entity.getCompanyId()==0&&entity.getCompanyName().isEmpty()){
|
|
|
- throw new CustomException("参数未有客户信息");
|
|
|
- }
|
|
|
+ if(entity.getCertificateType()==2) {
|
|
|
+ if (entity.getPersonId() == 0 && entity.getPersonName().isEmpty()) {
|
|
|
+ throw new CustomException("参数未有企业员工信息");
|
|
|
+ }
|
|
|
+ if (entity.getCompanyId() == 0 && entity.getCompanyName().isEmpty()) {
|
|
|
+ throw new CustomException("参数未有客户信息");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- if(entity.getPersonId()==0&& StringUtils.isNotBlank(entity.getPersonName())){
|
|
|
- SysPerson person=new SysPerson();
|
|
|
- person.setPersonName(entity.getPersonName());
|
|
|
- person.setCompanyId(entity.getCompanyId());
|
|
|
- person.setCreator(entity.getUserId());
|
|
|
- sysPersonService.getPersonByNameAndNoInert(person);
|
|
|
- entity.setPersonId(person.getPersonId());
|
|
|
+ if (entity.getPersonId() == 0 && StringUtils.isNotBlank(entity.getPersonName())) {
|
|
|
+ SysPerson person = new SysPerson();
|
|
|
+ person.setPersonName(entity.getPersonName());
|
|
|
+ person.setCompanyId(entity.getCompanyId());
|
|
|
+ person.setCreator(entity.getUserId());
|
|
|
+ sysPersonService.getPersonByNameAndNoInert(person);
|
|
|
+ entity.setPersonId(person.getPersonId());
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
int count = 0;
|
|
|
int i_count=0;
|
|
|
- SysCertificate info = getOne(new LambdaUpdateWrapper<SysCertificate>().eq(SysCertificate::getPersonId,entity.getPersonId())
|
|
|
- .eq(SysCertificate::getStatus,1)
|
|
|
- .eq(SysCertificate::getCertificateTypeId2,entity.getCertificateTypeId2()));
|
|
|
+ SysCertificate info =null;
|
|
|
+ if(entity.getCertificateType()==2) {
|
|
|
+ info = getOne(new LambdaUpdateWrapper<SysCertificate>().eq(SysCertificate::getPersonId, entity.getPersonId())
|
|
|
+ .eq(SysCertificate::getStatus, 1)
|
|
|
+ .eq(SysCertificate::getCertificateTypeId2, entity.getCertificateTypeId2()));
|
|
|
+ }else {
|
|
|
+ info = getOne(new LambdaUpdateWrapper<SysCertificate>().eq(SysCertificate::getCompanyId, entity.getCompanyId())
|
|
|
+ .eq(SysCertificate::getStatus, 1)
|
|
|
+ .eq(SysCertificate::getCertificateTypeId2, entity.getCertificateTypeId2()));
|
|
|
+ }
|
|
|
|
|
|
- if(info!=null)
|
|
|
- {
|
|
|
+
|
|
|
+ if(info!=null&&entity.getCertificateType()==2) {
|
|
|
entity.setCertificateId(info.getCertificateId());
|
|
|
- return updateCertificate(entity,entity.getUserId());
|
|
|
+ return updateCertificate(entity, entity.getUserId());
|
|
|
}
|
|
|
|
|
|
Long certificateId= 0L;
|
|
|
@@ -280,6 +313,9 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
model.setCompanyId(entity.getCompanyId());
|
|
|
model.setCreator(entity.getUserId());
|
|
|
model.setCreateTime(DateUtils.getNowTime());
|
|
|
+ model.setIssuerName(entity.getIssuerName());
|
|
|
+ model.setIssueDate(entity.getIssueDate());
|
|
|
+ model.setIsPrimary(entity.getIsPrimary());
|
|
|
model.setStatus(1);
|
|
|
if(entity.getMajorId()>0)
|
|
|
{
|
|
|
@@ -293,11 +329,13 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
if(sysCertificateType2!=null) {
|
|
|
model.setCertificateTypeName2(sysCertificateType2.getCertificateTypeName());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
save(model);
|
|
|
certificateId=model.getCertificateId();
|
|
|
}else {
|
|
|
+ if(entity.getCertificateType()!=2)
|
|
|
+ {
|
|
|
+ throw new CustomException("证书已存在!");
|
|
|
+ }
|
|
|
certificateId=info.getCertificateId();
|
|
|
}
|
|
|
|
|
|
@@ -313,7 +351,8 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
SysCertificateBo certModel = new SysCertificateBo();
|
|
|
certModel.setUserId(entity.getUserId());
|
|
|
certModel.setCompanyId(entity.getCompanyId());
|
|
|
- certModel.setCertificateId(entity.getCertificateId());
|
|
|
+ certModel.setCertificateId(certificateId);
|
|
|
+ certModel.setExpiryDate(entity.getExpiryDate());
|
|
|
certModel.setIsHasMajor(0);
|
|
|
certadditionService.updateCertificateAddition(certModel, entity.getUserId());
|
|
|
count++;
|
|
|
@@ -328,7 +367,8 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
certModel.setCertificateId(certificateId);
|
|
|
certModel.setExpiryDate(element.getExpiryDate());
|
|
|
certModel.setMajorId(element.getMajorId());
|
|
|
- certModel.setMajorName(element.getMajorName());
|
|
|
+ CertificateMajor major= majorService.selectCertificateMajorById(element.getMajorId());
|
|
|
+ certModel.setMajorName(major.getMajorName());
|
|
|
certadditionService.updateCertificateAddition(certModel, entity.getUserId());
|
|
|
count++;
|
|
|
}
|
|
|
@@ -339,23 +379,26 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
|
|
|
@Override
|
|
|
public int updateCertificate(SysCertificateBo entity, long userid) {
|
|
|
- if(entity.getPersonId()==0&&entity.getPersonName().isEmpty()){
|
|
|
- throw new CustomException("参数未有企业员工信息");
|
|
|
- }
|
|
|
- if(entity.getCompanyId()==0&&entity.getCompanyName().isEmpty()){
|
|
|
- throw new CustomException("参数未有客户信息");
|
|
|
- }
|
|
|
+ if(entity.getCertificateType()==2) {
|
|
|
+ if (entity.getPersonId() == 0 && entity.getPersonName().isEmpty()) {
|
|
|
+ throw new CustomException("参数未有企业员工信息");
|
|
|
+ }
|
|
|
+ if (entity.getCompanyId() == 0 && entity.getCompanyName().isEmpty()) {
|
|
|
+ throw new CustomException("参数未有客户信息");
|
|
|
+ }
|
|
|
+ if(entity.getPersonId()==0&& !StringUtils.isNotBlank(entity.getPersonName())){
|
|
|
+ SysPerson person=new SysPerson();
|
|
|
+ person.setPersonName(entity.getPersonName());
|
|
|
+ person.setCompanyId(entity.getCompanyId());
|
|
|
+ person.setCreator(entity.getUserId());
|
|
|
+ sysPersonService.getPersonByNameAndNoInert(person);
|
|
|
+ entity.setPersonId(person.getPersonId());
|
|
|
|
|
|
- if(entity.getPersonId()==0&& !StringUtils.isNotBlank(entity.getPersonName())){
|
|
|
- SysPerson person=new SysPerson();
|
|
|
- person.setPersonName(entity.getPersonName());
|
|
|
- person.setCompanyId(entity.getCompanyId());
|
|
|
- person.setCreator(entity.getUserId());
|
|
|
- sysPersonService.getPersonByNameAndNoInert(person);
|
|
|
- entity.setPersonId(person.getPersonId());
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
SysCertificate model = new SysCertificate();
|
|
|
model.setCertificateType(entity.getCertificateTypeId());
|
|
|
model.setCertificateName(entity.getCertificateName());
|
|
|
@@ -368,6 +411,9 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
model.setCompanyId(entity.getCompanyId());
|
|
|
model.setCreator(entity.getUserId());
|
|
|
model.setCreateTime(DateUtils.getNowTime());
|
|
|
+ model.setIssuerName(entity.getIssuerName());
|
|
|
+ model.setIssueDate(entity.getIssueDate());
|
|
|
+ model.setIsPrimary(entity.getIsPrimary());
|
|
|
model.setStatus(1);
|
|
|
SysCertificateType sysCertificateType=certTypeSeaService.selectCertificateById(entity.getCertificateTypeId());
|
|
|
SysCertificateType sysCertificateType2=new SysCertificateType();
|
|
|
@@ -398,6 +444,7 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
certModel.setUserId(entity.getUserId());
|
|
|
certModel.setCompanyId(entity.getCompanyId());
|
|
|
certModel.setCertificateId(entity.getCertificateId());
|
|
|
+ certModel.setExpiryDate(entity.getExpiryDate());
|
|
|
certModel.setIsHasMajor(0);
|
|
|
certadditionService.updateCertificateAddition(certModel, entity.getUserId());
|
|
|
count++;
|
|
|
@@ -414,7 +461,8 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
certModel.setCertificateId(entity.getCertificateId());
|
|
|
certModel.setExpiryDate(element.getExpiryDate());
|
|
|
certModel.setMajorId(element.getMajorId());
|
|
|
- certModel.setMajorName(element.getMajorName());
|
|
|
+ CertificateMajor major= majorService.selectCertificateMajorById(element.getMajorId());
|
|
|
+ certModel.setMajorName(major.getMajorName());
|
|
|
certModel.setCertificateAdditionId(element.getCertificateAdditionId());
|
|
|
certadditionService.updateCertificateAddition(certModel, entity.getUserId());
|
|
|
count++;
|
|
|
@@ -450,4 +498,32 @@ public class SysCertificateServiceImpl extends ServiceImpl<SysCertificateMapper,
|
|
|
model.setUpdateTime(DateUtils.getNowTime());
|
|
|
return certMapper.updateById(model)>0;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void CertificateWarning() {
|
|
|
+ SysCertificateBo entity= new SysCertificateBo();
|
|
|
+ entity.setWarningState(2);
|
|
|
+ TableDataInfo<SysCertificate> info = selectList(entity);
|
|
|
+
|
|
|
+ List<SysCertificateType> sysCertificateTypeList=certTypeSeaService.list(new LambdaQueryWrapper<SysCertificateType>().eq(SysCertificateType::getStatus,1));
|
|
|
+ info.getRows().forEach(cert->{
|
|
|
+ SysCertificateType certType=sysCertificateTypeList.stream().filter(s->s.getCertificateTypeId().equals(cert.getCertificateTypeId())).findFirst().orElse(null);
|
|
|
+ if(certType!=null)
|
|
|
+ {
|
|
|
+ if(certType.getWarningTime()>0)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(cert.getExpiryDate()>0&&cert.getExpiryDate()<DateUtils.getDayAfter(System.currentTimeMillis(),certType.getWarningTime()) )
|
|
|
+ {
|
|
|
+
|
|
|
+ cert.setWarningState(1);
|
|
|
+ cert.setWarningTime(System.currentTimeMillis());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|