|
|
@ -1,24 +1,75 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.ExcelPoiUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
|
import com.epmet.dao.IcVaccineDao; |
|
|
|
import com.epmet.dao.IcVaccinePrarmeterDao; |
|
|
|
import com.epmet.dao.IcVaccineRelationDao; |
|
|
|
import com.epmet.dto.IcVaccinePrarmeterDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.GridInfoByNameResultDTO; |
|
|
|
import com.epmet.dto.result.IcHouseInfoCollectResultDTO; |
|
|
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
|
|
|
import com.epmet.dto.result.UploadImgResultDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.entity.IcUserChangeRecordEntity; |
|
|
|
import com.epmet.entity.IcVaccinePrarmeterEntity; |
|
|
|
import com.epmet.excel.IcVaccinePrarmeterImportExcel; |
|
|
|
import com.epmet.excel.error.IcVaccinePrarmeterImportErrorModel; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
import com.epmet.redis.IcVaccinePrarmeterRedis; |
|
|
|
import com.epmet.service.IcUserChangeRecordService; |
|
|
|
import com.epmet.service.IcVaccinePrarmeterService; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.http.entity.ContentType; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 新冠病毒疫苗接种人员信息台账 |
|
|
@ -27,11 +78,37 @@ import java.util.Map; |
|
|
|
* @since v1.0.0 2022-08-22 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrarmeterDao, IcVaccinePrarmeterEntity> implements IcVaccinePrarmeterService { |
|
|
|
@Slf4j |
|
|
|
public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrarmeterDao, IcVaccinePrarmeterEntity> implements IcVaccinePrarmeterService,ResultDataResolver { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Resource |
|
|
|
private IcVaccinePrarmeterRedis icVaccinePrarmeterRedis; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private GovOrgFeignClient govOrgFeignClient; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IcResiUserDao icResiUserDao; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IcUserChangeRecordService icUserChangeRecordService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IcVaccineDao icVaccineDao; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IcVaccineRelationDao icVaccineRelationDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcVaccinePrarmeterDTO> page(Map<String, Object> params) { |
|
|
|
IPage<IcVaccinePrarmeterEntity> page = baseDao.selectPage( |
|
|
@ -41,6 +118,18 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar |
|
|
|
return getPageData(page, IcVaccinePrarmeterDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 条件查询 |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<IcVaccinePrarmeterDTO> getPhrasePage(Map<String, Object> params) { |
|
|
|
IPage<IcVaccinePrarmeterDTO> page = getPage(params); |
|
|
|
List<IcVaccinePrarmeterDTO> list = baseDao.getPhrasePage(params); |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcVaccinePrarmeterDTO> list(Map<String, Object> params) { |
|
|
|
List<IcVaccinePrarmeterEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
@ -66,14 +155,26 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcVaccinePrarmeterDTO dto) { |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); |
|
|
|
if (null == gridInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败"); |
|
|
|
} |
|
|
|
IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class); |
|
|
|
entity.setCustomerId(gridInfo.getCustomerId()); |
|
|
|
entity.setPids(gridInfo.getPids()); |
|
|
|
entity.setCheckState(NumConstant.ZERO_STR); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcVaccinePrarmeterDTO dto) { |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(dto.getGridId()); |
|
|
|
if (null == gridInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息失败", "获取网格信息失败"); |
|
|
|
} |
|
|
|
IcVaccinePrarmeterEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterEntity.class); |
|
|
|
entity.setPids(gridInfo.getPids()); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
@ -84,4 +185,633 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 【新冠病毒疫苗接种人员信息台账】导入 |
|
|
|
* @param tokenDto |
|
|
|
* @param inputStream |
|
|
|
* @param taskId |
|
|
|
* @author wgf |
|
|
|
* @date 2022/8/22 15:35 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Async |
|
|
|
public void importFile(TokenDto tokenDto, InputStream inputStream, String taskId) { |
|
|
|
List<IcVaccinePrarmeterImportErrorModel> errorInfo = new ArrayList<>(); |
|
|
|
|
|
|
|
try { |
|
|
|
List<IcVaccinePrarmeterImportExcel> list = ExcelPoiUtils.importExcel(inputStream, 0,1, IcVaccinePrarmeterImportExcel.class); |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); |
|
|
|
return; |
|
|
|
} |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
if (null == staffInfo){ |
|
|
|
throw new EpmetException("未查询到工作人员信息"+tokenDto.getUserId()); |
|
|
|
} |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); |
|
|
|
if (null == agencyInfo){ |
|
|
|
throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 校验空单元格以及网格名称是否正确
|
|
|
|
checkInfo(list,errorInfo,tokenDto); |
|
|
|
|
|
|
|
if (list.size() > errorInfo.size()){ |
|
|
|
Map<String, Long> groupByName = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getName, Collectors.counting())); |
|
|
|
groupByName.forEach((name,count) -> { |
|
|
|
if (Integer.valueOf(count.toString()).compareTo(1) != 0){ |
|
|
|
for (IcVaccinePrarmeterImportExcel i : list) { |
|
|
|
if (name.equals(i.getName()) && !i.getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(i,"数据重复",i.getNum())); |
|
|
|
i.setAddStatus(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
Map<Boolean, List<IcVaccinePrarmeterImportExcel>> groupByStatus = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getAddStatus)); |
|
|
|
List<IcVaccinePrarmeterImportExcel> needInsert = groupByStatus.get(false); |
|
|
|
if (CollectionUtils.isNotEmpty(needInsert)){ |
|
|
|
List<IcVaccinePrarmeterEntity> entities = ConvertUtils.sourceToTarget(needInsert, IcVaccinePrarmeterEntity.class); |
|
|
|
entities.forEach(e -> { |
|
|
|
// 设置客户ID
|
|
|
|
e.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
// 设置审核状态为待审核
|
|
|
|
e.setCheckState("0"); |
|
|
|
}); |
|
|
|
insertBatch(entities); |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(errorInfo)){ |
|
|
|
String url = importOssUpload(errorInfo, IcVaccinePrarmeterImportErrorModel.class); |
|
|
|
closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,url); |
|
|
|
}else { |
|
|
|
closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,""); |
|
|
|
} |
|
|
|
}catch (Exception e){ |
|
|
|
log.error(e.getMessage()); |
|
|
|
closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 校验空单元格以及网格名称是否正确 |
|
|
|
* @param list |
|
|
|
* @param errorInfo |
|
|
|
* @param tokenDto |
|
|
|
*/ |
|
|
|
public void checkInfo(List<IcVaccinePrarmeterImportExcel> list, List<IcVaccinePrarmeterImportErrorModel> errorInfo, TokenDto tokenDto){ |
|
|
|
LoginUserDetailsFormDTO form = new LoginUserDetailsFormDTO(); |
|
|
|
form.setUserId(tokenDto.getUserId()); |
|
|
|
form.setClient(tokenDto.getClient()); |
|
|
|
form.setApp(tokenDto.getApp()); |
|
|
|
LoginUserDetailsResultDTO userDetailsResultDTO = getResultDataOrThrowsException(userOpenFeignClient.getLoginUserDetails(form), ServiceConstant.EPMET_USER_SERVER, |
|
|
|
EpmetErrorCode.SERVER_ERROR.getCode(), |
|
|
|
"获取当前登录人组织id失败", |
|
|
|
null); |
|
|
|
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
list.get(i).setNum(i+1); |
|
|
|
if (StringUtils.isBlank(list.get(i).getGridName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "所属网格不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getVillageName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "所属小区不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getBuildName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "所属楼宇不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getUnitName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "单元不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getHomeName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "门牌号不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getName()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "姓名不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "证件号不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getMobile()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "咨询电话不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getIsVaccination()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "是否接种不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if("0".equals(list.get(i).getIsVaccination())){ |
|
|
|
// 未接种 判断是否填写原因
|
|
|
|
if (StringUtils.isBlank(list.get(i).getReason()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "选择未接种时,原因不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if("其他原因".equals(list.get(i).getReason())){ |
|
|
|
// 未接种原因选择其他,判断是否填写备注
|
|
|
|
if (StringUtils.isBlank(list.get(i).getNote()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "选择其他原因时,备注不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 已接种 判断是否填写接种时间地点
|
|
|
|
if (StringUtils.isBlank(list.get(i).getFirstVacTime()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第一次接种时间不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getFirstVacSite()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第一次接种地点不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getSecondVacTime()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第二次接种时间不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getSecondVacSite()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第二次接种地点不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getThirdVacTime()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第三次接种时间不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(list.get(i).getThirdVacSite()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "第三次接种地点不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 校验所属网格通过名称能否匹配到ID
|
|
|
|
GridInfoVaccinePrarmeterFormDTO formDTO = new GridInfoVaccinePrarmeterFormDTO(); |
|
|
|
formDTO.setGridName(list.get(i).getGridName()); |
|
|
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
formDTO.setAgencyId(userDetailsResultDTO.getAgencyId()); |
|
|
|
Result<GridInfoByNameResultDTO> resultDTOResult = govOrgFeignClient.getGridInfoByGridName(formDTO); |
|
|
|
GridInfoByNameResultDTO gridInfoByNameResultDTO = resultDTOResult.getData(); |
|
|
|
if(gridInfoByNameResultDTO == null && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "所属网格匹配失败",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
}else{ |
|
|
|
list.get(i).setGridId(gridInfoByNameResultDTO.getDeptId()); |
|
|
|
list.get(i).setAgencyId(gridInfoByNameResultDTO.getPid()); |
|
|
|
list.get(i).setPids(gridInfoByNameResultDTO.getPids()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 文件上传并返回url |
|
|
|
* @param errorRows |
|
|
|
* @param tClass |
|
|
|
* @author wgf |
|
|
|
* @date 2022/8/23 09:16 |
|
|
|
*/ |
|
|
|
public <T> String importOssUpload(Collection<?> errorRows, Class<T> tClass) throws IOException { |
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"), |
|
|
|
tClass, errorRows); |
|
|
|
|
|
|
|
// 文件名
|
|
|
|
String resultDescFileName = UUID.randomUUID().toString().concat(".xls"); |
|
|
|
|
|
|
|
FileItemFactory factory = new DiskFileItemFactory(16, null); |
|
|
|
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName); |
|
|
|
OutputStream os = fileItem.getOutputStream(); |
|
|
|
Result<UploadImgResultDTO> uploadResult = null; |
|
|
|
try { |
|
|
|
workbook.write(os); |
|
|
|
uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); |
|
|
|
} catch (Exception e) { |
|
|
|
String errormsg = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
log.error("上传错误描述文件:{}", errormsg); |
|
|
|
} finally { |
|
|
|
try { |
|
|
|
os.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
String errormsg = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
log.error("上传错误描述文件关闭输出流:{}", errormsg); |
|
|
|
} |
|
|
|
try { |
|
|
|
fileItem.delete(); |
|
|
|
} catch (Exception e) { |
|
|
|
String errormsg = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
log.error("上传错误描述文件删除临时文件:{}", errormsg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (uploadResult == null || !uploadResult.success()) { |
|
|
|
log.error("调用OSS上传结果描述文件失败"); |
|
|
|
return null; |
|
|
|
} |
|
|
|
return uploadResult.getData().getUrl(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 关闭任务 |
|
|
|
* @param taskId |
|
|
|
* @param userId |
|
|
|
* @param status |
|
|
|
* @param url |
|
|
|
* @author wgf |
|
|
|
* @date 2022/8/23 09:05 |
|
|
|
*/ |
|
|
|
public void closeTask(String taskId,String userId,String status,String url){ |
|
|
|
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); |
|
|
|
input.setOperatorId(userId); |
|
|
|
input.setTaskId(taskId); |
|
|
|
input.setProcessStatus(status); |
|
|
|
input.setResultDescFilePath(url); |
|
|
|
commonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 构造错误信息 |
|
|
|
* @param dto |
|
|
|
* @param info |
|
|
|
* @param num |
|
|
|
* @author wgf |
|
|
|
* @date 2022/8/23 17:17 |
|
|
|
*/ |
|
|
|
public IcVaccinePrarmeterImportErrorModel getErrorInfo(IcVaccinePrarmeterImportExcel dto, String info, Integer num){ |
|
|
|
IcVaccinePrarmeterImportErrorModel result = ConvertUtils.sourceToTarget(dto, IcVaccinePrarmeterImportErrorModel.class); |
|
|
|
result.setErrorMsg(info); |
|
|
|
result.setNum(num); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void vaccineCheck(IcVaccineCheckFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(),tokenDto.getUserId()); |
|
|
|
formDTO.setRealName(staffInfo.getRealName()); |
|
|
|
|
|
|
|
// 获取新冠病毒疫苗接种人员信息台账表信息
|
|
|
|
IcVaccinePrarmeterEntity icVaccinePrarmeterEntity = baseDao.selectById(formDTO.getId()); |
|
|
|
|
|
|
|
// 更新审核信息
|
|
|
|
icVaccinePrarmeterEntity.setCheckState(formDTO.getCheckState()); |
|
|
|
icVaccinePrarmeterEntity.setCheckReason(formDTO.getCheckReason()); |
|
|
|
icVaccinePrarmeterEntity.setVillageId(formDTO.getVillageId()); |
|
|
|
icVaccinePrarmeterEntity.setBuildId(formDTO.getBuildId()); |
|
|
|
icVaccinePrarmeterEntity.setUnitId(formDTO.getUnitId()); |
|
|
|
icVaccinePrarmeterEntity.setHomeId(formDTO.getHomeId()); |
|
|
|
|
|
|
|
baseDao.updateById(icVaccinePrarmeterEntity); |
|
|
|
|
|
|
|
// 审核状态:0待审核 1未通过 2已通过
|
|
|
|
if("2".equals(formDTO.getCheckState())){ |
|
|
|
|
|
|
|
String icResiUserId = ""; |
|
|
|
|
|
|
|
// 根据身份证号和房屋ID获取人员信息
|
|
|
|
IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(icVaccinePrarmeterEntity.getIdCard(),icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
|
|
|
|
if(StringUtils.isBlank(icVaccinePrarmeterEntity.getHomeId())){ |
|
|
|
// 新增房屋(新增房屋操作已在审核接口之前,前端调用新增接口实现)
|
|
|
|
// 更新登记表房屋ID
|
|
|
|
icVaccinePrarmeterEntity = updateHomeId(icVaccinePrarmeterEntity,formDTO); |
|
|
|
|
|
|
|
if(userIdCardEntity != null){ |
|
|
|
icResiUserId = userIdCardEntity.getId(); |
|
|
|
// 已存在人员 人员房屋不一致(更新人员信息和变更记录)
|
|
|
|
updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity); |
|
|
|
}else{ |
|
|
|
// 不存在人员
|
|
|
|
icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 更新房屋
|
|
|
|
updateHouseInfo(icVaccinePrarmeterEntity); |
|
|
|
|
|
|
|
Map<String, IcResiUserEntity> userMap = queryOriginUserByHomeId(icVaccinePrarmeterEntity.getHomeId(),icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
if(userIdCardEntity != null){ |
|
|
|
icResiUserId = userIdCardEntity.getId(); |
|
|
|
// 已存在人员
|
|
|
|
if(userMap.containsKey(icVaccinePrarmeterEntity.getIdCard())){ |
|
|
|
// 人员房屋一致(只更新人员信息)
|
|
|
|
updateUserInfo(icVaccinePrarmeterEntity,false,formDTO,userIdCardEntity); |
|
|
|
}else{ |
|
|
|
// 人员房屋不一致(更新人员信息和变更记录)
|
|
|
|
updateUserInfo(icVaccinePrarmeterEntity,true,formDTO,userIdCardEntity); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 不存在人员
|
|
|
|
icResiUserId = insertUserInfo(icVaccinePrarmeterEntity,formDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 同步接种记录 and 疫苗接种记录关系
|
|
|
|
synchronizationVaccineInfo(icVaccinePrarmeterEntity,icResiUserId); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 同步接种记录 and 疫苗接种记录关系 |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
* @param icResiUserId |
|
|
|
*/ |
|
|
|
@SneakyThrows |
|
|
|
private void synchronizationVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId){ |
|
|
|
if(!"1".equals(icVaccinePrarmeterEntity.getIsVaccination())){ |
|
|
|
return; |
|
|
|
} |
|
|
|
// 同步接种记录
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
// 处理第一次接种时间格式
|
|
|
|
String firstTime = icVaccinePrarmeterEntity.getFirstVacTime(); |
|
|
|
if(StringUtils.isBlank(firstTime)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
Date firstDate = sdf.parse(firstTime); |
|
|
|
icVaccinePrarmeterEntity.setFirstVacTime(sdf.format(firstDate)); |
|
|
|
// 查询第一次接种信息
|
|
|
|
List<IcVaccineEntity> icVaccineEntityFirstList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(firstDate)); |
|
|
|
if(icVaccineEntityFirstList.size() > 0){ |
|
|
|
// 更新疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
for(IcVaccineEntity entity : icVaccineEntityFirstList){ |
|
|
|
updateVaccineInfo(entity,icVaccinePrarmeterEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 新增疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 处理第二次接种时间格式
|
|
|
|
String secondTime = icVaccinePrarmeterEntity.getSecondVacTime(); |
|
|
|
if(StringUtils.isBlank(secondTime)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
Date secondDate = sdf.parse(secondTime); |
|
|
|
icVaccinePrarmeterEntity.setSecondVacTime(sdf.format(secondDate)); |
|
|
|
// 查询第二次接种信息
|
|
|
|
List<IcVaccineEntity> icVaccineEntitySecondList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(secondDate)); |
|
|
|
if(icVaccineEntitySecondList.size() > 0){ |
|
|
|
// 更新疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
for(IcVaccineEntity entity : icVaccineEntitySecondList){ |
|
|
|
updateVaccineInfo(entity,icVaccinePrarmeterEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 新增疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 处理第三次接种时间格式
|
|
|
|
String thirdTime = icVaccinePrarmeterEntity.getThirdVacTime(); |
|
|
|
if(StringUtils.isBlank(thirdTime)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
Date thirdDate = sdf.parse(thirdTime); |
|
|
|
icVaccinePrarmeterEntity.setThirdVacTime(sdf.format(thirdDate)); |
|
|
|
// 查询第三次接种信息
|
|
|
|
List<IcVaccineEntity> icVaccineEntityThirdList = icVaccineDao.getVaccineListByIdCard(icVaccinePrarmeterEntity.getIdCard(),sdf.format(thirdDate)); |
|
|
|
if(icVaccineEntityThirdList.size() > 0){ |
|
|
|
// 更新疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
for(IcVaccineEntity entity : icVaccineEntityThirdList){ |
|
|
|
updateVaccineInfo(entity,icVaccinePrarmeterEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 新增疫苗接种记录 and 疫苗接种记录关系
|
|
|
|
insertVaccineInfo(icVaccinePrarmeterEntity,icResiUserId,firstDate); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新疫苗接种记录 and 疫苗接种记录关系 |
|
|
|
* @param entity |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
*/ |
|
|
|
private void updateVaccineInfo(IcVaccineEntity entity,IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){ |
|
|
|
// 更新疫苗接种记录
|
|
|
|
entity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite()); |
|
|
|
entity.setUserType("prarmeter"); |
|
|
|
entity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
icVaccineDao.updateById(entity); |
|
|
|
|
|
|
|
// 更新疫苗接种记录关系
|
|
|
|
IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); |
|
|
|
icVaccineRelationEntity.setIcVaccineId(entity.getId()); |
|
|
|
icVaccineRelationEntity.setUserType("prarmeter"); |
|
|
|
icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
icVaccineRelationDao.updateRelationInfoByVaccineId(icVaccineRelationEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增疫苗接种记录 and 疫苗接种记录关系 |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
* @param icResiUserId |
|
|
|
* @param time |
|
|
|
*/ |
|
|
|
private void insertVaccineInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,String icResiUserId,Date time){ |
|
|
|
IcVaccineEntity icVaccineEntity = new IcVaccineEntity(); |
|
|
|
icVaccineEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
icVaccineEntity.setName(icVaccinePrarmeterEntity.getName()); |
|
|
|
icVaccineEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); |
|
|
|
icVaccineEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); |
|
|
|
icVaccineEntity.setIsResiUser("1"); |
|
|
|
icVaccineEntity.setUserType("prarmeter"); |
|
|
|
icVaccineEntity.setUserId(icResiUserId); |
|
|
|
icVaccineEntity.setInoculateTime(time); |
|
|
|
icVaccineEntity.setInoculateAddress(icVaccinePrarmeterEntity.getFirstVacSite()); |
|
|
|
icVaccineDao.insert(icVaccineEntity); |
|
|
|
|
|
|
|
// 新增关系
|
|
|
|
IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); |
|
|
|
icVaccineRelationEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
icVaccineRelationEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); |
|
|
|
icVaccineRelationEntity.setPids(icVaccinePrarmeterEntity.getPids()); |
|
|
|
icVaccineRelationEntity.setIcVaccineId(icVaccineEntity.getId()); |
|
|
|
icVaccineRelationEntity.setUserType("prarmeter"); |
|
|
|
icVaccineRelationDao.insert(icVaccineRelationEntity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新新冠病毒疫苗接种人员信息台账表房屋ID |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private IcVaccinePrarmeterEntity updateHomeId(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){ |
|
|
|
|
|
|
|
// fegin获取房屋信息
|
|
|
|
GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); |
|
|
|
getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getUnitId()); |
|
|
|
getHouseInfoToCollectFormDTO.setDoorName(formDTO.getHomeName()); |
|
|
|
Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); |
|
|
|
IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); |
|
|
|
|
|
|
|
// 新增房屋后需要collect更新上房屋ID
|
|
|
|
// log
|
|
|
|
icVaccinePrarmeterEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); |
|
|
|
baseDao.updateById(icVaccinePrarmeterEntity); |
|
|
|
return icVaccinePrarmeterEntity; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新房屋信息 |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
*/ |
|
|
|
private void updateHouseInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity){ |
|
|
|
CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); |
|
|
|
collectHouseFormDTO.setId(icVaccinePrarmeterEntity.getHomeId()); |
|
|
|
|
|
|
|
|
|
|
|
// fegin获取房屋信息
|
|
|
|
GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); |
|
|
|
getHouseInfoToCollectFormDTO.setBuildingUnitId(icVaccinePrarmeterEntity.getUnitId()); |
|
|
|
getHouseInfoToCollectFormDTO.setDoorName(icVaccinePrarmeterEntity.getHomeName()); |
|
|
|
Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); |
|
|
|
IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); |
|
|
|
|
|
|
|
collectHouseFormDTO.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
collectHouseFormDTO.setResiNumber((icHouseInfoCollectResultDTO.getResiNumber() + 1)); |
|
|
|
collectHouseFormDTO.setRentFlag(icHouseInfoCollectResultDTO.getRentFlag()); |
|
|
|
collectHouseFormDTO.setOwnerName(icHouseInfoCollectResultDTO.getOwnerName()); |
|
|
|
govOrgFeignClient.updateCollect(collectHouseFormDTO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取人员信息 |
|
|
|
* @param idCard |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private IcResiUserEntity queryOriginUserByIdCard(String idCard,String customerId) { |
|
|
|
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
query.eq(IcResiUserEntity::getIdCard, idCard); |
|
|
|
query.eq(IcResiUserEntity::getCustomerId, customerId); |
|
|
|
IcResiUserEntity originUser = icResiUserDao.selectOne(query); |
|
|
|
return originUser; |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) { |
|
|
|
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>(); |
|
|
|
query.eq(IcResiUserEntity::getHomeId, homeId); |
|
|
|
query.eq(IcResiUserEntity::getCustomerId, customerId); |
|
|
|
List<IcResiUserEntity> originUserList = icResiUserDao.selectList(query); |
|
|
|
Map<String, IcResiUserEntity> memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity())); |
|
|
|
return memMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新人员信息 |
|
|
|
* @param icVaccinePrarmeterEntity 登记信息 |
|
|
|
* @param isUpdateLog 是否更新记录 |
|
|
|
* @param formDTO 入参 |
|
|
|
* @param userEntity 根据身份证号查询到的user信息 |
|
|
|
*/ |
|
|
|
private void updateUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,Boolean isUpdateLog, |
|
|
|
IcVaccineCheckFormDTO formDTO,IcResiUserEntity userEntity){ |
|
|
|
|
|
|
|
userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身
|
|
|
|
userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); |
|
|
|
userEntity.setGridId(icVaccinePrarmeterEntity.getGridId()); |
|
|
|
userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId()); |
|
|
|
userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId()); |
|
|
|
userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId()); |
|
|
|
userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId()); |
|
|
|
userEntity.setName(icVaccinePrarmeterEntity.getName()); |
|
|
|
userEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); |
|
|
|
userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); |
|
|
|
icResiUserDao.updateById(userEntity); |
|
|
|
|
|
|
|
// 判断是否需要更新记录
|
|
|
|
if(isUpdateLog){ |
|
|
|
//变更记录表
|
|
|
|
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
changeRecordEntity.setOperatorId(formDTO.getUserId()); |
|
|
|
changeRecordEntity.setIcUserId(userEntity.getId()); |
|
|
|
changeRecordEntity.setOperatorName(formDTO.getRealName()); |
|
|
|
changeRecordEntity.setIcUserName(userEntity.getName()); |
|
|
|
changeRecordEntity.setType("update"); |
|
|
|
changeRecordEntity.setTypeName("修改"); |
|
|
|
changeRecordEntity.setBeforeChangeName("-"); |
|
|
|
changeRecordEntity.setAfterChangeName("-"); |
|
|
|
changeRecordEntity.setChangeTime(new java.util.Date()); |
|
|
|
icUserChangeRecordService.insert(changeRecordEntity); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增人员信息 |
|
|
|
* @param icVaccinePrarmeterEntity |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
private String insertUserInfo(IcVaccinePrarmeterEntity icVaccinePrarmeterEntity,IcVaccineCheckFormDTO formDTO){ |
|
|
|
|
|
|
|
// 新增人员
|
|
|
|
IcResiUserEntity userEntity = new IcResiUserEntity(); |
|
|
|
userEntity.setPids(icVaccinePrarmeterEntity.getPids()); // ic_resi_user表的组织的pids 含agencyId本身
|
|
|
|
userEntity.setAgencyId(icVaccinePrarmeterEntity.getAgencyId()); |
|
|
|
userEntity.setGridId(icVaccinePrarmeterEntity.getGridId()); |
|
|
|
userEntity.setVillageId(icVaccinePrarmeterEntity.getVillageId()); |
|
|
|
userEntity.setBuildId(icVaccinePrarmeterEntity.getBuildId()); |
|
|
|
userEntity.setUnitId(icVaccinePrarmeterEntity.getUnitId()); |
|
|
|
userEntity.setHomeId(icVaccinePrarmeterEntity.getHomeId()); |
|
|
|
userEntity.setName(icVaccinePrarmeterEntity.getName()); |
|
|
|
userEntity.setMobile(icVaccinePrarmeterEntity.getMobile()); |
|
|
|
userEntity.setIdCard(icVaccinePrarmeterEntity.getIdCard()); |
|
|
|
userEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
icResiUserDao.insert(userEntity); |
|
|
|
|
|
|
|
//变更记录表
|
|
|
|
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
changeRecordEntity.setCustomerId(icVaccinePrarmeterEntity.getCustomerId()); |
|
|
|
changeRecordEntity.setOperatorId(formDTO.getUserId()); |
|
|
|
changeRecordEntity.setIcUserId(userEntity.getId()); |
|
|
|
changeRecordEntity.setOperatorName(formDTO.getRealName()); |
|
|
|
changeRecordEntity.setIcUserName(userEntity.getName()); |
|
|
|
changeRecordEntity.setType("add"); |
|
|
|
changeRecordEntity.setTypeName("新增"); |
|
|
|
changeRecordEntity.setBeforeChangeName("-"); |
|
|
|
changeRecordEntity.setAfterChangeName("-"); |
|
|
|
changeRecordEntity.setChangeTime(new java.util.Date()); |
|
|
|
icUserChangeRecordService.insert(changeRecordEntity); |
|
|
|
|
|
|
|
return userEntity.getId(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|