|
|
@ -42,11 +42,13 @@ import com.zdxt.code.mapper.EnterpriseInformationMapper; |
|
|
import com.zdxt.code.service.ISsztJbxx110497Service; |
|
|
import com.zdxt.code.service.ISsztJbxx110497Service; |
|
|
import com.zdxt.code.service.IQrCodeGenerateHistoryService; |
|
|
import com.zdxt.code.service.IQrCodeGenerateHistoryService; |
|
|
import com.zdxt.code.domain.QrCodeGenerateHistory; |
|
|
import com.zdxt.code.domain.QrCodeGenerateHistory; |
|
|
|
|
|
import com.zdxt.auth.project.system.dict.service.IDictDataService; |
|
|
import com.zdxt.common.config.RuoYiConfig; |
|
|
import com.zdxt.common.config.RuoYiConfig; |
|
|
import com.zdxt.common.util.Constants; |
|
|
import com.zdxt.common.util.Constants; |
|
|
import com.zdxt.common.util.DateUtils; |
|
|
import com.zdxt.common.util.DateUtils; |
|
|
import com.zdxt.common.util.StringUtils; |
|
|
import com.zdxt.common.util.StringUtils; |
|
|
import com.zdxt.domain.auth.Dept; |
|
|
import com.zdxt.domain.auth.Dept; |
|
|
|
|
|
import com.zdxt.domain.auth.DictData; |
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
import org.apache.poi.ss.usermodel.*; |
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
@ -93,6 +95,9 @@ public class EnterprisePubQrcodeServiceImpl implements IEnterprisePubQrcodeServi |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IDeptService deptService; |
|
|
private IDeptService deptService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IDictDataService iDictDataService; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISsztJbxx110497Service ssztJbxx110497Service; |
|
|
private ISsztJbxx110497Service ssztJbxx110497Service; |
|
|
|
|
|
|
|
|
@ -217,6 +222,19 @@ public class EnterprisePubQrcodeServiceImpl implements IEnterprisePubQrcodeServi |
|
|
String importFileId = UUID.randomUUID().toString().replace("-", ""); |
|
|
String importFileId = UUID.randomUUID().toString().replace("-", ""); |
|
|
String importFileName = file.getOriginalFilename(); |
|
|
String importFileName = file.getOriginalFilename(); |
|
|
|
|
|
|
|
|
|
|
|
// 预加载区域字典数据:select * from sys_dict_data where dict_type='address_type'
|
|
|
|
|
|
List<DictData> areaDictList = iDictDataService.selectDictDataByType("address_type"); |
|
|
|
|
|
// 预加载街道字典数据:select * from sys_dict_data where dict_type in (select dict_value from sys_dict_data where dict_type='address_type')
|
|
|
|
|
|
List<String> areaDictValues = new ArrayList<>(); |
|
|
|
|
|
for (DictData areaDict : areaDictList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (StrUtil.isNotBlank(areaDict.getDictValue())) |
|
|
|
|
|
{ |
|
|
|
|
|
areaDictValues.add(areaDict.getDictValue()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
List<DictData> streetDictList = areaDictValues.isEmpty() ? new ArrayList<>() : iDictDataService.getDataByDataTypes(areaDictValues); |
|
|
|
|
|
|
|
|
for (int i = 0; i < dataList.size(); i++) |
|
|
for (int i = 0; i < dataList.size(); i++) |
|
|
{ |
|
|
{ |
|
|
EnterprisePubQrcode item = dataList.get(i); |
|
|
EnterprisePubQrcode item = dataList.get(i); |
|
|
@ -242,40 +260,55 @@ public class EnterprisePubQrcodeServiceImpl implements IEnterprisePubQrcodeServi |
|
|
errorMsg.append("第").append(rowNum).append("行,统一社会信用代码格式不正确(应为18位数字和大写字母组合);"); |
|
|
errorMsg.append("第").append(rowNum).append("行,统一社会信用代码格式不正确(应为18位数字和大写字母组合);"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证归属区域
|
|
|
// 验证归属区域(通过字典表 address_type 匹配)
|
|
|
if (StrUtil.isBlank(item.getAreaName())) |
|
|
if (StrUtil.isBlank(item.getAreaName())) |
|
|
{ |
|
|
{ |
|
|
errorMsg.append("第").append(rowNum).append("行,归属区域不能为空;"); |
|
|
errorMsg.append("第").append(rowNum).append("行,归属区域不能为空;"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
Dept areaDept=deptService.selectDeptByDeptName2(item.getAreaName().trim()); |
|
|
DictData matchedArea = null; |
|
|
if (areaDept == null) |
|
|
for (DictData dd : areaDictList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (item.getAreaName().trim().equals(dd.getDictLabel())) |
|
|
|
|
|
{ |
|
|
|
|
|
matchedArea = dd; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (matchedArea == null) |
|
|
{ |
|
|
{ |
|
|
errorMsg.append("第").append(rowNum).append("行,归属区域\"").append(item.getAreaName()).append("\"在系统中未找到;"); |
|
|
errorMsg.append("第").append(rowNum).append("行,归属区域\"").append(item.getAreaName()).append("\"在系统中未找到;"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
item.setAreaId(areaDept.getDeptId()); |
|
|
item.setAreaId(matchedArea.getDictValue()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证归属街道
|
|
|
// 验证归属街道(通过字典表匹配,dict_type为区域的dict_value)
|
|
|
if (StrUtil.isBlank(item.getStreetName())) |
|
|
if (StrUtil.isBlank(item.getStreetName())) |
|
|
{ |
|
|
{ |
|
|
errorMsg.append("第").append(rowNum).append("行,归属街道不能为空;"); |
|
|
errorMsg.append("第").append(rowNum).append("行,归属街道不能为空;"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
List<Dept> deptList=deptService.selectDeptByDeptName(item.getStreetName().trim()); |
|
|
DictData matchedStreet = null; |
|
|
if (deptList == null || deptList.isEmpty()) |
|
|
for (DictData dd : streetDictList) |
|
|
|
|
|
{ |
|
|
|
|
|
if (item.getStreetName().trim().equals(dd.getDictLabel())) |
|
|
|
|
|
{ |
|
|
|
|
|
matchedStreet = dd; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (matchedStreet == null) |
|
|
{ |
|
|
{ |
|
|
errorMsg.append("第").append(rowNum).append("行,归属街道\"").append(item.getStreetName()).append("\"在系统中未找到;"); |
|
|
errorMsg.append("第").append(rowNum).append("行,归属街道\"").append(item.getStreetName()).append("\"在系统中未找到;"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
Dept streetDept = deptList.get(0); |
|
|
item.setStreetId(matchedStreet.getDictValue()); |
|
|
item.setStreetId(streetDept.getDeptId()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -330,7 +363,7 @@ public class EnterprisePubQrcodeServiceImpl implements IEnterprisePubQrcodeServi |
|
|
item.setUserName(currentUser.getUserName()); |
|
|
item.setUserName(currentUser.getUserName()); |
|
|
item.setUserId(currentUser.getUserId()); |
|
|
item.setUserId(currentUser.getUserId()); |
|
|
item.setCreateBy(currentUser.getUserName()); |
|
|
item.setCreateBy(currentUser.getUserName()); |
|
|
item.setDeptName(currentUser.getDeptName()); |
|
|
item.setDeptName(currentUser.getDept().getDeptName()); |
|
|
item.setDeptId(currentUser.getDeptId()); |
|
|
item.setDeptId(currentUser.getDeptId()); |
|
|
enterprisePubQrcodeMapper.insertEnterprisePubQrcode(item); |
|
|
enterprisePubQrcodeMapper.insertEnterprisePubQrcode(item); |
|
|
insertCount++; |
|
|
insertCount++; |
|
|
|