Commit b328a090 authored by 陈明豪's avatar 陈明豪

改进隔离点人员的导出空模板,导入功能

parent c5555ce3
......@@ -2,6 +2,7 @@ package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
......@@ -166,40 +167,69 @@ public class GldryServiceImpl implements IGldryService
Gldry hldryQuerry = new Gldry();
hldryQuerry.setCardNo(gldry.getCardNo());
List<Gldry> gldries = gldryMapper.selectGldryList(hldryQuerry);
if (StringUtils.isNotEmpty(gldry.getArea())) {
List<SysDictData> dictDataList = sysDictDataMapper.selectDictDataByType("residential_area");
String area = gldry.getArea();
int isExist = 0;
for (SysDictData sysDictData : dictDataList) {
if (sysDictData.getDictLabel().equals(area)) {
area = sysDictData.getDictValue();
isExist = 1;
}
// 校验 隔离点名称
if (StringUtils.isNotEmpty(gldry.getGlPlace())){
List<SysDictData> isolation_point = DictUtils.getDictCache("isolation_point");
List<String> values = isolation_point.stream().filter(l->gldry.getGlPlace().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
gldry.setGlPlace(values.get(0));
else {
failureList.add(gldry);
continue;
}
if (isExist == 1){
gldry.setArea(area);
}else {
}
// 校验四级联动是否对应字典的值
// 校验 所在区
if (StringUtils.isNotEmpty(gldry.getArea())){
List<SysDictData> residential_area = DictUtils.getDictCache("residential_area");
List<String> values = residential_area.stream().filter(l->gldry.getArea().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
gldry.setArea(values.get(0));
else {
failureList.add(gldry);
continue;
}
}
// 校验 街道/镇
if (StringUtils.isNotEmpty(gldry.getStreet())){
List<SysDictData> street_town = DictUtils.getDictCache("street_town");
List<String> values = street_town.stream().filter(l->gldry.getStreet().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
gldry.setStreet(values.get(0));
else {
failureList.add(gldry);
continue;
}
}
if (StringUtils.isNotEmpty(gldry.getStreet())) {
List<SysDictData> dictDataList = sysDictDataMapper.selectDictDataByType("street_town");
String street = gldry.getStreet();
int isExist = 0;
for (SysDictData sysDictData : dictDataList) {
if (sysDictData.getDictLabel().equals(street)) {
street = sysDictData.getDictValue();
isExist = 1;
}
// 校验 居委会
if (StringUtils.isNotEmpty(gldry.getCommittee())){
List<SysDictData> committee = DictUtils.getDictCache("committee");
List<String> values = committee.stream().filter(l->gldry.getCommittee().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
gldry.setCommittee(values.get(0));
else {
failureList.add(gldry);
continue;
}
if (isExist == 1){
gldry.setStreet(street);
}else {
}
// 校验 小区/村名称
if (StringUtils.isNotEmpty(gldry.getCommunity())){
List<SysDictData> community = DictUtils.getDictCache("community");
List<String> values = community.stream().filter(l->gldry.getCommunity().equals(l.getDictLabel()))
.map(SysDictData::getDictValue).collect(Collectors.toList());
if (!values.isEmpty())
gldry.setCommunity(values.get(0));
else {
failureList.add(gldry);
continue;
}
}
if (!gldries.isEmpty()){
for (Gldry gldryUpdate:gldries){
gldry.setId(gldryUpdate.getId());
......@@ -221,7 +251,8 @@ public class GldryServiceImpl implements IGldryService
if (!trueList.isEmpty()){
for (Gldry gldry:trueList){
gldry.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
String createBy = DataUtils.getValue(gldry.getArea(),gldry.getStreet(),gldry.getCommittee());
gldry.setCreateBy(createBy);
gldry.setCreateTime(DateUtils.getNowDate());
gldryMapper.insertGldry(gldry);
}
......
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