|
|
@ -4,7 +4,6 @@ import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.epmet.bean.PersonHelpTypeBean; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
@ -30,15 +29,14 @@ import com.epmet.dto.result.lingshan.LingShanHelpCrowdScreenQtyOfSubOrgRstDTO; |
|
|
|
import com.epmet.dto.result.lingshan.LingShanHelpCrowdStatusByCateRstDTO; |
|
|
|
import com.epmet.dto.result.lingshan.LingshanHelpCrowdDetailRstDTO; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.enums.LingShanHelpCrowdCommonEnums; |
|
|
|
import com.epmet.enums.LingShanHelpCrowdTypeEnum; |
|
|
|
import com.epmet.enums.LingShanSpecialCrowdTypeEnums; |
|
|
|
import com.epmet.excel.data.*; |
|
|
|
import com.epmet.excel.handler.*; |
|
|
|
import com.epmet.exceptions.ReadExcelHeaderOnlyException; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
import com.epmet.processor.AbstractLingshanHelpCrowdCallbackProcessor; |
|
|
|
import com.epmet.remote.EpmetUserRemoteService; |
|
|
|
import com.epmet.service.LingShanHelpCrowdService; |
|
|
|
import com.epmet.utils.ImportTaskUtils; |
|
|
@ -46,7 +44,6 @@ import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -115,8 +112,18 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
|
|
|
|
private Map<Class, AbstractLingshanHelpCrowdCallbackProcessor> processorMap; |
|
|
|
|
|
|
|
private String[] COPY_IGNORED_FIELDS = { "id", "customerId", "resiId", "idCard", "createdTime", "createdBy" }; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
public LingShanHelpCrowdServiceImpl(List<AbstractLingshanHelpCrowdCallbackProcessor> processors) { |
|
|
|
|
|
|
|
processorMap = processors |
|
|
|
.stream() |
|
|
|
.collect(Collectors.toMap(p -> p.getEntityClass(), Function.identity())); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String validate(LingShanHelpCrowdBaseExcelData row) { |
|
|
|
String idCard = row.getIdCard(); |
|
|
@ -357,7 +364,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdCanjiEntity> entities, LingshanHelpCrowdCanjiEntity t) { |
|
|
|
public void save(List<LingshanHelpCrowdCanjiEntity> entities, LingshanHelpCrowdCanjiEntity t, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdCanjiEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdCanjiEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdCanjiEntity::getResiId, entity.getResiId()); |
|
|
@ -367,17 +374,19 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
// 如果信息已存在
|
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdCanjiDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
// 如果信息不存在
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
lingshanHelpCrowdCanjiDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
// 如果信息不存在
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
lingshanHelpCrowdCanjiDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdDabingEntity> entities, LingshanHelpCrowdDabingEntity t) { |
|
|
|
public void save(List<LingshanHelpCrowdDabingEntity> entities, LingshanHelpCrowdDabingEntity t, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdDabingEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdDabingEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdDabingEntity::getResiId, entity.getResiId()); |
|
|
@ -386,16 +395,18 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdDabingDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdDabingDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
lingshanHelpCrowdDabingDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
lingshanHelpCrowdDabingDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdDibaoEntity> entities, LingshanHelpCrowdDibaoEntity lingshanHelpCrowdDibaoEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdDibaoEntity> entities, LingshanHelpCrowdDibaoEntity lingshanHelpCrowdDibaoEntity, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdDibaoEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdDibaoEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdDibaoEntity::getResiId, entity.getResiId()); |
|
|
@ -404,17 +415,19 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdDibaoDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdDibaoDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} else { |
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
lingshanHelpCrowdDibaoDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
lingshanHelpCrowdDibaoDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdDujuEntity> entities, LingshanHelpCrowdDujuEntity lingshanHelpCrowdDujuEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdDujuEntity> entities, LingshanHelpCrowdDujuEntity lingshanHelpCrowdDujuEntity, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdDujuEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdDujuEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdDujuEntity::getResiId, entity.getResiId()); |
|
|
@ -423,18 +436,21 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdDujuDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdDujuDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
// entity.setId(IdWorker.getIdStr());
|
|
|
|
|
|
|
|
lingshanHelpCrowdDujuDao.insert(entity); |
|
|
|
lingshanHelpCrowdDujuDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdGaolingEntity> entities, LingshanHelpCrowdGaolingEntity lingshanHelpCrowdGaolingEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdGaolingEntity> entities, LingshanHelpCrowdGaolingEntity lingshanHelpCrowdGaolingEntity, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdGaolingEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdGaolingEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdGaolingEntity::getResiId, entity.getResiId()); |
|
|
@ -443,15 +459,18 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdGaolingDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdGaolingDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
|
|
|
|
lingshanHelpCrowdGaolingDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
lingshanHelpCrowdGaolingDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdKongchaoEntity> entities, LingshanHelpCrowdKongchaoEntity lingshanHelpCrowdKongchaoEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdKongchaoEntity> entities, LingshanHelpCrowdKongchaoEntity lingshanHelpCrowdKongchaoEntity, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdKongchaoEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdKongchaoEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdKongchaoEntity::getResiId, entity.getResiId()); |
|
|
@ -460,15 +479,18 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdKongchaoDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdKongchaoDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
|
|
|
|
lingshanHelpCrowdKongchaoDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
lingshanHelpCrowdKongchaoDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdLiushouEntity> entities, LingshanHelpCrowdLiushouEntity lingshanHelpCrowdLiushouEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdLiushouEntity> entities, LingshanHelpCrowdLiushouEntity lingshanHelpCrowdLiushouEntity, String headPhoto) { |
|
|
|
for (LingshanHelpCrowdLiushouEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdLiushouEntity> q = new LambdaQueryWrapper<>(); |
|
|
|
q.eq(LingshanHelpCrowdLiushouEntity::getResiId, entity.getResiId()); |
|
|
@ -477,15 +499,18 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdLiushouDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdLiushouDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
|
|
|
|
lingshanHelpCrowdLiushouDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
lingshanHelpCrowdLiushouDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void save(List<LingshanHelpCrowdTekunEntity> entities, LingshanHelpCrowdTekunEntity lingshanHelpCrowdTekunEntity) { |
|
|
|
public void save(List<LingshanHelpCrowdTekunEntity> entities, LingshanHelpCrowdTekunEntity lingshanHelpCrowdTekunEntity, String headPhoto) { |
|
|
|
|
|
|
|
for (LingshanHelpCrowdTekunEntity entity : entities) { |
|
|
|
LambdaQueryWrapper<LingshanHelpCrowdTekunEntity> q = new LambdaQueryWrapper<>(); |
|
|
@ -495,10 +520,13 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
if ((existsOne = lingshanHelpCrowdTekunDao.selectOne(q)) != null) { |
|
|
|
BeanUtils.copyProperties(entity, existsOne, COPY_IGNORED_FIELDS); |
|
|
|
lingshanHelpCrowdTekunDao.updateById(existsOne); |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
|
|
|
|
lingshanHelpCrowdTekunDao.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
lingshanHelpCrowdTekunDao.insert(entity); |
|
|
|
// 钩子
|
|
|
|
processorMap.get(entity.getClass()).onSaveSpecialCrowdDetail(entity); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -592,7 +620,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
canjiEntity.setResiId(resiId); |
|
|
|
canjiEntity.setOrgIdPath(orgIdPath); |
|
|
|
canjiEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(canjiEntity), canjiEntity); |
|
|
|
save(Arrays.asList(canjiEntity), canjiEntity, headPhoto); |
|
|
|
} else { |
|
|
|
// 说明这个类别被取消了,就得删除
|
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdCanjiEntity.class); |
|
|
@ -605,7 +633,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
dujuEntity.setResiId(resiId); |
|
|
|
dujuEntity.setOrgIdPath(orgIdPath); |
|
|
|
dujuEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(dujuEntity), dujuEntity); |
|
|
|
save(Arrays.asList(dujuEntity), dujuEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdDujuEntity.class); |
|
|
|
} |
|
|
@ -617,7 +645,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
dibaoEntity.setResiId(resiId); |
|
|
|
dibaoEntity.setOrgIdPath(orgIdPath); |
|
|
|
dibaoEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(dibaoEntity), dibaoEntity); |
|
|
|
save(Arrays.asList(dibaoEntity), dibaoEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdDibaoEntity.class); |
|
|
|
} |
|
|
@ -629,7 +657,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
dabingEntity.setResiId(resiId); |
|
|
|
dabingEntity.setOrgIdPath(orgIdPath); |
|
|
|
dabingEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(dabingEntity), dabingEntity); |
|
|
|
save(Arrays.asList(dabingEntity), dabingEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdDabingEntity.class); |
|
|
|
} |
|
|
@ -641,7 +669,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
gaolingEntity.setResiId(resiId); |
|
|
|
gaolingEntity.setOrgIdPath(orgIdPath); |
|
|
|
gaolingEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(gaolingEntity), gaolingEntity); |
|
|
|
save(Arrays.asList(gaolingEntity), gaolingEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdGaolingEntity.class); |
|
|
|
} |
|
|
@ -653,7 +681,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
kongchaoEntity.setResiId(resiId); |
|
|
|
kongchaoEntity.setOrgIdPath(orgIdPath); |
|
|
|
kongchaoEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(kongchaoEntity), kongchaoEntity); |
|
|
|
save(Arrays.asList(kongchaoEntity), kongchaoEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdKongchaoEntity.class); |
|
|
|
} |
|
|
@ -665,7 +693,7 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
liushouEntity.setResiId(resiId); |
|
|
|
liushouEntity.setOrgIdPath(orgIdPath); |
|
|
|
liushouEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(liushouEntity), liushouEntity); |
|
|
|
save(Arrays.asList(liushouEntity), liushouEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdLiushouEntity.class); |
|
|
|
} |
|
|
@ -677,13 +705,16 @@ public class LingShanHelpCrowdServiceImpl implements LingShanHelpCrowdService, R |
|
|
|
tekunEntity.setResiId(resiId); |
|
|
|
tekunEntity.setOrgIdPath(orgIdPath); |
|
|
|
tekunEntity.setIdCard(idCard); |
|
|
|
save(Arrays.asList(tekunEntity), tekunEntity); |
|
|
|
save(Arrays.asList(tekunEntity), tekunEntity, headPhoto); |
|
|
|
} else { |
|
|
|
deleteByResiId(resiId, LingshanHelpCrowdTekunEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
// 保存类别,hard=true:没有传递过来,但是数据库中有的类别,将会被删除,说明工作人员是要取消改居民这个类别的数据
|
|
|
|
savePersonAndTypes(types, true); |
|
|
|
|
|
|
|
// 保存居民基础信息回调
|
|
|
|
processorMap.get(LingshanHelpCrowdBaseEntity.class).onSaveResiBaseInfo(resiId, form); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|