Commit f30c9e79 authored by zengxiaoli@yeah.net's avatar zengxiaoli@yeah.net

评定人员鉴定人员录入前加唯一性校验(有效数据保证一条)

parent 5bb529e6
......@@ -322,9 +322,8 @@ public class AprOrganController {
if (chAprEmp.getGroupLeader() == null) {//评定人员是否是组长
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
aprOrganService.addOrUpdateAprEmp(chAprEmp);
return Result.success();
int result = aprOrganService.addOrUpdateAprEmp(chAprEmp);
return result>0?Result.failed("该评定人员已存在于系统,请勿重复录入"):Result.success();
}
/**
......
......@@ -115,8 +115,8 @@ public class SuperviseOrganEmpController {
if (StringUtils.isBlank(chSuperviseOrganEmp.getSpvEmpName()) || StringUtils.isBlank(chSuperviseOrganEmp.getCertifType()) || StringUtils.isBlank(chSuperviseOrganEmp.getGender()) || StringUtils.isBlank(chSuperviseOrganEmp.getMobilePhone())) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
superviseOrganEmpService.insertOrUpdateEmpInfo(chSuperviseOrganEmp);
return Result.success();
int result = superviseOrganEmpService.insertOrUpdateEmpInfo(chSuperviseOrganEmp);
return result>0?Result.failed("该监管人员已存在于系统,请勿重复录入"):Result.success();
}
/**
......
......@@ -40,7 +40,7 @@ public interface AprOrganService extends IService<ChAprOrgan> {
Workbook aprEmpExport(Long organId, Boolean isIncluded, String provincial, String city, String area, String organName, String name, String tel, String certiCode, String isLock, String empType, String groupLeader);
void addOrUpdateAprEmp(AprEmpInfoVO chAprEmp);
int addOrUpdateAprEmp(AprEmpInfoVO chAprEmp);
List<ChCfgAprempType> cfgAprEmpType(String parAprempTypeId);
......
......@@ -21,7 +21,7 @@ public interface SuperviseOrganEmpService extends IService<ChSuperviseOrgan> {
void updateEmpStatus(String empId, Short isLock);
void insertOrUpdateEmpInfo(ChSuperviseOrganEmp chSuperviseOrganEmp);
int insertOrUpdateEmpInfo(ChSuperviseOrganEmp chSuperviseOrganEmp);
Page<SuperviseOrganVO> superviseOrganList(Page<SuperviseOrganVO> page, Long organId, Boolean isIncluded, String spvOrganName);
......
......@@ -13,10 +13,7 @@ import com.hungraim.ltc.governance.service.AprOrganService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.assessment.ChAprEmp;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgAprGroupDetail;
import com.hungraim.ltc.pojo.entity.serviceManage.ChAprOrgan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgAprOrganType;
import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgAprempType;
import com.hungraim.ltc.pojo.entity.serviceManage.ChFndEducation;
import com.hungraim.ltc.pojo.entity.serviceManage.*;
import com.hungraim.ltc.pojo.vo.assessment.AprEmpExportVO;
import com.hungraim.ltc.pojo.vo.governance.AprEmpInfoVO;
import com.hungraim.ltc.pojo.vo.governance.AprEmpVO;
......@@ -182,9 +179,18 @@ public class AprOrganServiceImpl extends ServiceImpl<AprOrganMapper, ChAprOrgan>
@Transactional(rollbackFor = Exception.class)
@Override
public void addOrUpdateAprEmp(AprEmpInfoVO chAprEmp) {
public int addOrUpdateAprEmp(AprEmpInfoVO chAprEmp) {
int queryResult = 0;
if (chAprEmp.getEmpId() == null) {
//新增
QueryWrapper<ChAprEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CERTI_CODE", chAprEmp.getCertiCode());
queryWrapper.eq("IS_LOCK",0);
queryResult = aprEmpMapper.selectCount(queryWrapper);
if(queryResult>0){
return queryResult;
}
chAprEmp.setEffTime(new Date());
chAprEmp.setIsLock(0);
aprEmpMapper.insert(chAprEmp);
......@@ -199,6 +205,7 @@ public class AprOrganServiceImpl extends ServiceImpl<AprOrganMapper, ChAprOrgan>
chAprEmp.setEmpId(chAprEmp.getEmpId());
}
updateAttachs(chAprEmp.getFileDataList(), chAprEmp.getEmpId().longValue(), AttachType.APR_ORGAN_EMP.getUploadType());
return queryResult;
}
@Override
......
......@@ -3,12 +3,14 @@ package com.hungraim.ltc.governance.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hungraim.ltc.api.OrganFeignService;
import com.hungraim.ltc.governance.dao.SuperviseOrganEmpMapper;
import com.hungraim.ltc.governance.dao.SuperviseOrganMapper;
import com.hungraim.ltc.governance.service.SuperviseOrganEmpService;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvOrganEmp;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSuperviseOrgan;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSuperviseOrganEmp;
import com.hungraim.ltc.pojo.vo.governance.ChSuperviseOrganEmpVo;
......@@ -61,17 +63,26 @@ public class SuperviseOrganServiceImpl extends ServiceImpl<SuperviseOrganMapper,
}
@Override
public void insertOrUpdateEmpInfo(ChSuperviseOrganEmp chSuperviseOrganEmp) {
public int insertOrUpdateEmpInfo(ChSuperviseOrganEmp chSuperviseOrganEmp) {
Long spvEmpId = chSuperviseOrganEmp.getSpvEmpId();
int queryResult = 0;
if (spvEmpId != null) {
//更新
superviseOrganEmpMapper.updateById(chSuperviseOrganEmp);
} else {
//新增
QueryWrapper<ChSuperviseOrganEmp> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CERTIF_NUM", chSuperviseOrganEmp.getCertifNum());
queryWrapper.eq("IS_LOCK",0);
queryResult = superviseOrganEmpMapper.selectCount(queryWrapper);
if(queryResult>0){
return queryResult;
}
chSuperviseOrganEmp.setEffTime(new Date());
chSuperviseOrganEmp.setIsLock((short) 0);
superviseOrganEmpMapper.insert(chSuperviseOrganEmp);
}
return queryResult;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment