|
@@ -1,16 +1,13 @@
|
|
|
package com.dragoninfo.dcuc.app.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.dragoninfo.dcuc.app.dto.AppEventDTO;
|
|
|
import com.dragoninfo.dcuc.app.dto.ApplyInfoDTO;
|
|
|
-import com.dragoninfo.dcuc.app.dto.UpdateUserInfoEventDTO;
|
|
|
import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
import com.dragoninfo.dcuc.app.entity.ManufacturerInfo;
|
|
|
-import com.dragoninfo.dcuc.app.enumresources.AppMsgTypeEnum;
|
|
|
-import com.dragoninfo.dcuc.app.event.EventPublisher;
|
|
|
import com.dragoninfo.dcuc.app.mapper.ApplyInfoMapper;
|
|
|
import com.dragoninfo.dcuc.app.service.IApplyInfoService;
|
|
|
import com.dragoninfo.dcuc.app.service.IApplyOauthService;
|
|
@@ -21,15 +18,13 @@ import com.dragoninfo.dcuc.common.utils.LangUtil;
|
|
|
import com.dragoninfo.dcuc.duceap.facade.IDuceapUploadFacade;
|
|
|
import com.dragoninfo.dcuc.duceap.upload.dto.DocContentDTO;
|
|
|
import com.dragoninfo.dcuc.duceap.upload.dto.FileUploadDTO;
|
|
|
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
|
|
|
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
|
|
|
+import com.dragoninfo.dcuc.user.entity.org.OrgInfo;
|
|
|
+import com.dragoninfo.dcuc.user.facade.org.IOrgInfoFacade;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
import com.dragonsoft.duceap.base.entity.uploader.FileHolder;
|
|
|
import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
-import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
-import com.dragonsoft.duceap.mybaitsplus.core.services.BaseMybatisService;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
@@ -39,6 +34,9 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.cache.annotation.CacheConfig;
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -52,26 +50,21 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @author huangzqa
|
|
|
* @date 2020/10/27
|
|
|
*/
|
|
|
-@Transactional(rollbackFor = Exception.class)
|
|
|
+@CacheConfig(cacheNames = "DCUC-APP-APP")
|
|
|
@Service
|
|
|
-public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String> implements IApplyInfoService {
|
|
|
+public class ApplyInfoServiceImpl implements IApplyInfoService {
|
|
|
|
|
|
- private final ApplyInfoMapper applyInfoMapper;
|
|
|
+ @Autowired
|
|
|
+ private ApplyInfoMapper applyInfoMapper;
|
|
|
|
|
|
@Resource
|
|
|
private IDuceapUploadFacade uploadhandler;
|
|
|
|
|
|
- public ApplyInfoServiceImpl(ApplyInfoMapper applyInfoMapper) {
|
|
|
- super(applyInfoMapper);
|
|
|
- this.applyInfoMapper = applyInfoMapper;
|
|
|
- }
|
|
|
-
|
|
|
@Autowired
|
|
|
private IManufacturerInfoService manufacturerInfoService;
|
|
|
|
|
@@ -81,135 +74,112 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
@Autowired
|
|
|
private IDuceapUploadFacade uploadHandler;
|
|
|
|
|
|
- @Autowired
|
|
|
- private EventPublisher eventPublisher;
|
|
|
-
|
|
|
@Autowired
|
|
|
private IPermissionNotificationFacade permissionNotificationFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private IOrgInfoFacade orgInfoFacade;
|
|
|
|
|
|
+ @Cacheable(key = "targetClass +#p0")
|
|
|
@Override
|
|
|
public ApplyInfo applyDetail(String id) {
|
|
|
return applyInfoMapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Page<ApplyInfo> applyInfoPage(SearchDTO searchDTO) {
|
|
|
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
searchable.addSort(Sort.Direction.DESC, "SORT");
|
|
|
searchable.addSort(Sort.Direction.DESC, "REGISTRATION_TIME");
|
|
|
- // searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.TRUE.getValue());
|
|
|
return applyInfoMapper.pagingBySearchable(searchable);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public ApplyInfo saveAppIy(ApplyInfoDTO applyInfoDTO) {
|
|
|
- ApplyInfo applyInfo = new ApplyInfo();
|
|
|
- BeanUtils.copyProperties(applyInfoDTO, applyInfo);
|
|
|
-
|
|
|
- List<FileHolder> file = applyInfoDTO.getFile();
|
|
|
-
|
|
|
- String manufacturerId = applyInfo.getManufacturerId();
|
|
|
- if(StringUtils.isNotBlank(manufacturerId)) {
|
|
|
- ManufacturerInfo manufacturerInfo = manufacturerInfoService.getOne(manufacturerId);
|
|
|
- if (manufacturerInfo != null) {
|
|
|
- String manufacturerName = manufacturerInfo.getManufacturerName();
|
|
|
- applyInfo.setManufacturerName(manufacturerName);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 校验数据是否为空
|
|
|
+ *
|
|
|
+ * @param cell
|
|
|
+ * @param i
|
|
|
+ * @param row
|
|
|
+ */
|
|
|
+ private static void checkServiceResourceCellData(Cell cell, int i, int row) {
|
|
|
+ if (!(cell == null || StringUtils.isEmpty(cell.getStringCellValue()))) {
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
- String applyCode = applyInfo.getApplyCode();
|
|
|
- String secretKey = getApiKeys(applyCode);
|
|
|
- String apiKey = getApiKeys(applyCode);
|
|
|
-
|
|
|
- applyInfo.setSecretKey(secretKey);
|
|
|
- applyInfo.setApiKey(apiKey);
|
|
|
- applyInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
-
|
|
|
- applyInfoMapper.insert(applyInfo);
|
|
|
- // 保存 appId
|
|
|
- applyOauthService.saveOauth(applyInfo);
|
|
|
- String id = applyInfo.getId();
|
|
|
- // 保存图片
|
|
|
- if(null != file) {
|
|
|
- saveOrUpdateFile(id, file);
|
|
|
+ switch (i) {
|
|
|
+ case 0:
|
|
|
+ throw new NumberFormatException("第" + (row + 1) + "行'应用系统名称'为空!");
|
|
|
+ case 1:
|
|
|
+ throw new NumberFormatException("第" + (row + 1) + "行'应用系统编号'为空!");
|
|
|
+ case 2:
|
|
|
+ throw new NumberFormatException("第" + (row + 1) + "行'应用系统英文名称'为空!");
|
|
|
+ case 3:
|
|
|
+ throw new NumberFormatException("第" + (row + 1) + "行'系统在用标识'为空!");
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
- sendMessage(applyInfo, "应用表信息新增", AppMsgTypeEnum.SAVE);
|
|
|
-
|
|
|
- return applyInfo;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Override
|
|
|
- public ApplyInfo updateApply(ApplyInfoDTO applyInfoDTO) {
|
|
|
- ApplyInfo applyInfo = new ApplyInfo();
|
|
|
- BeanUtils.copyProperties(applyInfoDTO, applyInfo);
|
|
|
- List<FileHolder> file = applyInfoDTO.getFile();
|
|
|
-
|
|
|
- String manufacturerId = applyInfo.getManufacturerId();
|
|
|
- if (!StringUtils.isEmpty(manufacturerId)) {
|
|
|
- ManufacturerInfo manufacturerInfo = manufacturerInfoService.getOne(manufacturerId);
|
|
|
- if (manufacturerInfo != null) {
|
|
|
- String manufacturerName = manufacturerInfo.getManufacturerName();
|
|
|
- applyInfo.setManufacturerName(manufacturerName);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 校验列头
|
|
|
+ *
|
|
|
+ * @param r
|
|
|
+ */
|
|
|
+ private static void checkRowTitle(Row r) {
|
|
|
+ if (!r.getCell(0).getStringCellValue().equals("应用系统名称")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统名称'列!");
|
|
|
}
|
|
|
-
|
|
|
- String id = applyInfo.getId();
|
|
|
- String orgId = applyInfo.getOrgId();
|
|
|
- //旧应用
|
|
|
- ApplyInfo oldApplyInfo = applyInfoMapper.selectById(id);
|
|
|
- if(null == oldApplyInfo) {
|
|
|
- return null;
|
|
|
+ if (!r.getCell(1).getStringCellValue().equals("应用系统编号")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统编号'列!");
|
|
|
}
|
|
|
- String oldOrgId = oldApplyInfo.getOrgId();
|
|
|
-
|
|
|
- applyInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
-
|
|
|
- applyOauthService.updateOauth(applyInfo);
|
|
|
- applyInfoMapper.updateById(applyInfo);
|
|
|
-
|
|
|
- // 更新施工人员冗余信息
|
|
|
- if (StringUtils.isNotBlank(orgId) && StringUtils.isNotBlank(oldOrgId) && !oldOrgId.equals(orgId)) {
|
|
|
- eventPublisher.publishUpdateUserInfoEvent(new UpdateUserInfoEventDTO(applyInfo));
|
|
|
+ if (!r.getCell(2).getStringCellValue().equals("应用系统英文名称")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统英文名称'列!");
|
|
|
}
|
|
|
- if (CollectionUtils.isNotEmpty(file)) {
|
|
|
- saveOrUpdateFile(id, file);
|
|
|
+ if (!r.getCell(3).getStringCellValue().equals("系统在用标识")) {
|
|
|
+ throw new NumberFormatException("缺少'系统在用标识'列!");
|
|
|
}
|
|
|
-
|
|
|
- //发送消息
|
|
|
- sendMessage(applyInfo, "应用表信息修改", AppMsgTypeEnum.UPDATE);
|
|
|
- //权限变更通知
|
|
|
- boolean isNotification = StringUtils.isNotEmpty(oldApplyInfo.getApplyUrl())&&( !oldApplyInfo.getApplyUrl().equals(applyInfo.getApplyUrl())
|
|
|
- || !oldApplyInfo.getApplyStatus().equals(applyInfo.getApplyStatus()));
|
|
|
- // 应用 url 当发送变更时进行通知
|
|
|
- if (isNotification) {
|
|
|
- permissionNotificationFacade.sendAppAppUpdate(id);
|
|
|
+ if (!r.getCell(4).getStringCellValue().equals("上线日期")) {
|
|
|
+ throw new NumberFormatException("缺少'上线日期'列!");
|
|
|
+ }
|
|
|
+ if (!r.getCell(5).getStringCellValue().equals("应用负责人")) {
|
|
|
+ throw new NumberFormatException("缺少'应用负责人'列!");
|
|
|
+ }
|
|
|
+ if (!r.getCell(6).getStringCellValue().equals("应用系统事权单位代码")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统事权单位代码'列!");
|
|
|
+ }
|
|
|
+ if (!r.getCell(7).getStringCellValue().equals("应用系统管理单位名称")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统管理单位名称'列!");
|
|
|
+ }
|
|
|
+ if (!r.getCell(8).getStringCellValue().equals("应用系统运维单位名称")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统运维单位名称'列!");
|
|
|
+ }
|
|
|
+ if (!r.getCell(9).getStringCellValue().equals("应用系统说明")) {
|
|
|
+ throw new NumberFormatException("缺少'应用系统说明'列!");
|
|
|
}
|
|
|
- return applyInfo;
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void del(String id) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
|
applyInfo.setDeleted(BooleanEnum.TRUE.getValue());
|
|
|
|
|
|
applyInfoMapper.deleteById(id);
|
|
|
- sendMessage(applyInfo, "应用表信息删除", AppMsgTypeEnum.DELETED);
|
|
|
-
|
|
|
// 进行权限通知
|
|
|
permissionNotificationFacade.sendAppAppUpdate(id);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public String getNewSort() {
|
|
|
return applyInfoMapper.getNewSort();
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String startOrStop(String id) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
@@ -226,12 +196,13 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
}
|
|
|
|
|
|
applyInfoMapper.updateById(applyInfo);
|
|
|
- sendMessage(applyInfo, "应用启动或停止", AppMsgTypeEnum.STATUS);
|
|
|
// 进行权限通知
|
|
|
permissionNotificationFacade.sendAppAppUpdate(id);
|
|
|
return message;
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void sortApp(String id, String target) {
|
|
|
ApplyInfo applyInfo = applyInfoMapper.selectById(id);
|
|
@@ -249,6 +220,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
applyInfoMapper.updateById(targetApplyInfo);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public String codeConvertToId(String appCode) {
|
|
|
|
|
@@ -268,6 +240,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public String convertIdsToNames(String projectIds) {
|
|
|
|
|
@@ -286,6 +259,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return LangUtil.array2String(stringList, StrUtil.COMMA);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass +methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getAppByCode(String appCode) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -295,11 +269,13 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppById(List<String> ids) {
|
|
|
return applyInfoMapper.selectBatchIds(ids);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppByAppNameLike(String applyName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -307,27 +283,126 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getAppByAppUrl(String applyUrl) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(ApplyInfo::getApplyUrl,applyUrl);
|
|
|
+ queryWrapper.eq(ApplyInfo::getApplyUrl, applyUrl);
|
|
|
List<ApplyInfo> applyInfos = applyInfoMapper.selectList(queryWrapper);
|
|
|
- if(CollectionUtils.isNotEmpty(applyInfos)){
|
|
|
+ if (CollectionUtils.isNotEmpty(applyInfos)) {
|
|
|
return applyInfos.get(0);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getIdsByCodes(List<String> appCodes) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.select(ApplyInfo::getId,ApplyInfo::getApplyCode)
|
|
|
- .in(ApplyInfo::getApplyCode,appCodes);
|
|
|
+ queryWrapper.select(ApplyInfo::getId, ApplyInfo::getApplyCode)
|
|
|
+ .in(ApplyInfo::getApplyCode, appCodes);
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ApplyInfo getOne(String id) {
|
|
|
+ return applyInfoMapper.selectById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ApplyInfo> findAll() {
|
|
|
+ return applyInfoMapper.selectList(Wrappers.emptyWrapper());
|
|
|
+ }
|
|
|
+
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public ApplyInfo saveAppIy(ApplyInfoDTO applyInfoDTO) {
|
|
|
+ ApplyInfo applyInfo = new ApplyInfo();
|
|
|
+ BeanUtils.copyProperties(applyInfoDTO, applyInfo);
|
|
|
+
|
|
|
+ List<FileHolder> file = applyInfoDTO.getFile();
|
|
|
+
|
|
|
+ String manufacturerId = applyInfo.getManufacturerId();
|
|
|
+ if (StringUtils.isNotBlank(manufacturerId)) {
|
|
|
+ ManufacturerInfo manufacturerInfo = manufacturerInfoService.getOne(manufacturerId);
|
|
|
+ if (manufacturerInfo != null) {
|
|
|
+ String manufacturerName = manufacturerInfo.getManufacturerName();
|
|
|
+ applyInfo.setManufacturerName(manufacturerName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String applyCode = applyInfo.getApplyCode();
|
|
|
+ String secretKey = applyInfoDTO.getSecretKey();
|
|
|
+ if (StrUtil.isBlank(secretKey)) {
|
|
|
+ secretKey = getApiKeys(applyCode);
|
|
|
+ }
|
|
|
+ String apiKey = applyInfoDTO.getApiKey();
|
|
|
+ if (StrUtil.isBlank(apiKey)) {
|
|
|
+ apiKey = getApiKeys(applyCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ applyInfo.setSecretKey(secretKey);
|
|
|
+ applyInfo.setApiKey(apiKey);
|
|
|
+ applyInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+
|
|
|
+ applyInfoMapper.insert(applyInfo);
|
|
|
+ // 保存 appId
|
|
|
+ applyOauthService.saveOauth(applyInfo);
|
|
|
+ String id = applyInfo.getId();
|
|
|
+ // 保存图片
|
|
|
+ if (null != file) {
|
|
|
+ saveOrUpdateFile(id, file);
|
|
|
+ }
|
|
|
+
|
|
|
+ return applyInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public ApplyInfo updateApply(ApplyInfoDTO applyInfoDTO) {
|
|
|
+ ApplyInfo applyInfo = new ApplyInfo();
|
|
|
+ BeanUtils.copyProperties(applyInfoDTO, applyInfo);
|
|
|
+ List<FileHolder> file = applyInfoDTO.getFile();
|
|
|
+
|
|
|
+ String manufacturerId = applyInfo.getManufacturerId();
|
|
|
+ if (!StringUtils.isEmpty(manufacturerId)) {
|
|
|
+ ManufacturerInfo manufacturerInfo = manufacturerInfoService.getOne(manufacturerId);
|
|
|
+ if (manufacturerInfo != null) {
|
|
|
+ String manufacturerName = manufacturerInfo.getManufacturerName();
|
|
|
+ applyInfo.setManufacturerName(manufacturerName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String id = applyInfo.getId();
|
|
|
+ //旧应用
|
|
|
+ ApplyInfo oldApplyInfo = applyInfoMapper.selectById(id);
|
|
|
+ if (null == oldApplyInfo) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ applyInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+ applyOauthService.updateOauth(applyInfo);
|
|
|
+ applyInfoMapper.updateById(applyInfo);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(file)) {
|
|
|
+ saveOrUpdateFile(id, file);
|
|
|
+ }
|
|
|
+
|
|
|
+ //发送消息
|
|
|
+ //权限变更通知
|
|
|
+ boolean isNotification = StringUtils.isNotEmpty(oldApplyInfo.getApplyUrl()) && (!oldApplyInfo.getApplyUrl().equals(applyInfo.getApplyUrl())
|
|
|
+ || !oldApplyInfo.getApplyStatus().equals(applyInfo.getApplyStatus()));
|
|
|
+ // 应用 url 当发送变更时进行通知
|
|
|
+ if (isNotification) {
|
|
|
+ permissionNotificationFacade.sendAppAppUpdate(id);
|
|
|
+ }
|
|
|
+ return applyInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
@Override
|
|
|
public ResponseStatus impExcel(String fileId) {
|
|
|
try {
|
|
@@ -335,114 +410,76 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
byte[] fileData = fileContent.getFileData();
|
|
|
InputStream inputStream = new ByteArrayInputStream(fileData);
|
|
|
List<ApplyInfo> list = loadInfo(inputStream);
|
|
|
- if(list.size() > 1000) {
|
|
|
- return ResponseStatus.fail("300","导入数据超过1000行");
|
|
|
+ if (list.size() > 1000) {
|
|
|
+ return ResponseStatus.fail("300", "导入数据超过1000行");
|
|
|
}
|
|
|
//设置事权单位id和code
|
|
|
setOrgInfos(list);
|
|
|
- saveAll(list);
|
|
|
- }catch (IOException e) {
|
|
|
- return ResponseStatus.fail("300","导入文件类型错误");
|
|
|
+ for (ApplyInfo applyInfo : list) {
|
|
|
+ applyInfoMapper.insert(applyInfo);
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ return ResponseStatus.fail("300", "导入文件类型错误");
|
|
|
} catch (NumberFormatException e) {
|
|
|
- return ResponseStatus.fail("300",e.getMessage());
|
|
|
+ return ResponseStatus.fail("300", e.getMessage());
|
|
|
} catch (Exception e) {
|
|
|
- return ResponseStatus.fail("300","导入失败");
|
|
|
+ return ResponseStatus.fail("300", "导入失败");
|
|
|
}
|
|
|
return ResponseStatus.success();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void setOrgInfos(List<ApplyInfo> list) {
|
|
|
- if(CollectionUtils.isEmpty(list)) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
return;
|
|
|
}
|
|
|
List<ApplyInfo> apps = list.stream()
|
|
|
.filter(item -> StringUtils.isNotBlank(item.getOrgCode()))
|
|
|
.collect(Collectors.toList());
|
|
|
List<String> orgCodes = apps.stream().map(ApplyInfo::getOrgCode).collect(Collectors.toList());
|
|
|
- if(CollectionUtils.isNotEmpty(orgCodes)) {
|
|
|
+ if (CollectionUtils.isNotEmpty(orgCodes)) {
|
|
|
List<OrgInfo> orgInfos = orgInfoFacade.getOrgsByCodes(orgCodes);
|
|
|
- Map<String, OrgInfo> map = orgInfos.stream().collect(Collectors.toMap(OrgInfo::getCode, item->item, (old,last)->last));
|
|
|
+ Map<String, OrgInfo> map = orgInfos.stream().collect(Collectors.toMap(OrgInfo::getCode, item -> item, (old, last) -> last));
|
|
|
for (ApplyInfo app : apps) {
|
|
|
String orgCode = app.getOrgCode();
|
|
|
OrgInfo orgInfo = map.get(orgCode);
|
|
|
- if(orgInfo != null) {
|
|
|
- app.setOrgId(orgInfo.getId());
|
|
|
+ if (orgInfo != null) {
|
|
|
app.setOrgName(orgInfo.getFullName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<ApplyInfo> findList(String applyStatus) {
|
|
|
- LambdaQueryWrapper<ApplyInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<ApplyInfo> wrapper = queryWrapper.select();
|
|
|
- if(StringUtils.isNotBlank(applyStatus)){
|
|
|
- wrapper.eq(ApplyInfo::getApplyStatus,applyStatus);
|
|
|
- }
|
|
|
- return applyInfoMapper.selectList(wrapper);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<ApplyInfo> getListByCodes(List<String> appCodes) {
|
|
|
- LambdaQueryWrapper<ApplyInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- LambdaQueryWrapper<ApplyInfo> wrapper = queryWrapper.select().in(ApplyInfo::getApplyCode,appCodes);
|
|
|
- return applyInfoMapper.selectList(wrapper);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public List<ApplyInfo> appInfoSearch(SearchDTO searchDTO) {
|
|
|
return applyInfoMapper.findBySearchable(Searchable.toSearchable(searchDTO));
|
|
|
}
|
|
|
|
|
|
- private List<ApplyInfo> loadInfo(InputStream inputStream) throws IOException, ParseException {
|
|
|
- //根据指定的文件输入流导入Excel从而产生Workbook对象
|
|
|
- Workbook wb0 = new HSSFWorkbook(inputStream);
|
|
|
- //获取Excel文档中的第一个表单
|
|
|
- Sheet sht0 = wb0.getSheetAt(0);
|
|
|
- List<ApplyInfo> list = new ArrayList<>();
|
|
|
- List<String> codeList = new ArrayList<>();
|
|
|
- for (Row r : sht0) {
|
|
|
- if (r.getRowNum() == 0) {
|
|
|
- checkRowTitle(r);
|
|
|
- continue;
|
|
|
- }else {
|
|
|
- //循环每行的每一列
|
|
|
- ApplyInfo entity = new ApplyInfo();
|
|
|
- boolean isAllEmpty = true;
|
|
|
- for (int i = 0; i < 10; i++){
|
|
|
- Cell cell = r.getCell(i);
|
|
|
- if (cell != null){
|
|
|
- r.getCell(i).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- }
|
|
|
- if (cell != null && StringUtils.isNotEmpty(cell.getStringCellValue())){
|
|
|
- isAllEmpty = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!isAllEmpty){
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
- Cell cell = r.getCell(i);
|
|
|
- if (cell != null){
|
|
|
- r.getCell(i).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- }
|
|
|
- checkServiceResourceCellData(cell, i, r.getRowNum());
|
|
|
- checkServiceResourceCellDataValid(cell, i, r.getRowNum(), entity, codeList);
|
|
|
- }
|
|
|
- entity.setDeleted(YesNotEnum.NO.getValue());
|
|
|
- list.add(entity);
|
|
|
- }
|
|
|
-
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Override
|
|
|
+ public void updateOrgInfos(String targetOrgCode, String fullName, String code) {
|
|
|
+ LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(ApplyInfo::getOrgCode, targetOrgCode);
|
|
|
|
|
|
- }
|
|
|
+ ApplyInfo applyInfo = new ApplyInfo();
|
|
|
+ applyInfo.setOrgName(fullName);
|
|
|
|
|
|
+ if (!targetOrgCode.equals(code)) {
|
|
|
+ applyInfo.setOrgCode(code);
|
|
|
}
|
|
|
-
|
|
|
- return list;
|
|
|
+ applyInfoMapper.update(applyInfo, queryWrapper);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public List<ApplyInfo> findList(String applyStatus) {
|
|
|
+ LambdaQueryWrapper<ApplyInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<ApplyInfo> wrapper = queryWrapper.select();
|
|
|
+ if (StringUtils.isNotBlank(applyStatus)) {
|
|
|
+ wrapper.eq(ApplyInfo::getApplyStatus, applyStatus);
|
|
|
+ }
|
|
|
+ wrapper.eq(ApplyInfo::getDeleted, BooleanEnum.FALSE.value);
|
|
|
+ return applyInfoMapper.selectList(wrapper);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -481,25 +518,29 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return ResponseStatus.success();
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void updateOrgInfos(String orgId, String orgName) {
|
|
|
- applyInfoMapper.updateOrgInfo(orgId, orgName);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<String> getAppIdsByOrgId(String orgId) {
|
|
|
-
|
|
|
- LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
-
|
|
|
- queryWrapper.eq(ApplyInfo::getOrgId, orgId)
|
|
|
- .eq(ApplyInfo::getDeleted, BooleanEnum.FALSE.getValue());
|
|
|
-
|
|
|
- List<ApplyInfo> applyInfos = applyInfoMapper.selectList(queryWrapper);
|
|
|
-
|
|
|
- return applyInfos.stream().map(ApplyInfo::getId)
|
|
|
- .collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
+// @CacheEvict(allEntries = true)
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// @Override
|
|
|
+// public void updateOrgInfos(String orgId, String orgName) {
|
|
|
+// applyInfoMapper.updateOrgInfo(orgId, orgName);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
+// @Override
|
|
|
+// public List<String> getAppIdsByOrgId(String orgId) {
|
|
|
+//
|
|
|
+// LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+//
|
|
|
+// queryWrapper.eq(ApplyInfo::getOrgId, orgId)
|
|
|
+// .eq(ApplyInfo::getDeleted, BooleanEnum.FALSE.getValue());
|
|
|
+//
|
|
|
+// List<ApplyInfo> applyInfos = applyInfoMapper.selectList(queryWrapper);
|
|
|
+//
|
|
|
+// return applyInfos.stream().map(ApplyInfo::getId)
|
|
|
+// .collect(Collectors.toList());
|
|
|
+// }
|
|
|
+
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> fzxmList(String userId) {
|
|
|
|
|
@@ -511,6 +552,8 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @CacheEvict(allEntries = true)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void saveDutyMan(String dutyProject, String userId, String mobileWork) {
|
|
|
Object[] projectIdArray = dutyProject.split(StrUtil.COMMA);
|
|
@@ -523,6 +566,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
applyInfoMapper.update(new ApplyInfo(), updateWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public Map<String, String> findAppNameMap() {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -537,15 +581,16 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Page<ApplyInfo> findApplyList(SearchDTO searchDTO) {
|
|
|
- // todo 逻辑
|
|
|
Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
searchable.removeSearchFilter("userBusiness_eq");
|
|
|
searchable.addSort(Sort.Direction.DESC, "sort");
|
|
|
return applyInfoMapper.pagingBySearchable(searchable);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public Integer countByManufacturerId(String manufacturerId) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -555,6 +600,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectCount(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public List<ApplyInfo> getAppListByManufacturerId(String manufacturerId) {
|
|
|
|
|
@@ -565,6 +611,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName")
|
|
|
@Override
|
|
|
public Map<String, String> getAllIdNameMap() {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -576,6 +623,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
.collect(Collectors.toMap(ApplyInfo::getId, ApplyInfo::getApplyName));
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0+#p1")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByCodeAndName(String appCode, String appName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -584,6 +632,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0 +#p1")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByNameAndManufacturerId(String applyName, String manufacturerId) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -593,6 +642,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return applyInfoMapper.selectOne(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(key = "targetClass + methodName+#p0")
|
|
|
@Override
|
|
|
public ApplyInfo getOneByName(String applyName) {
|
|
|
LambdaQueryWrapper<ApplyInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
@@ -616,21 +666,6 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
return value + num;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 消息发送
|
|
|
- *
|
|
|
- * @param applyInfo 应用信息
|
|
|
- */
|
|
|
- private void sendMessage(ApplyInfo applyInfo, String content, AppMsgTypeEnum appMsgTypeEnum) {
|
|
|
- AppEventDTO appEventDTO = new AppEventDTO();
|
|
|
- appEventDTO.setBaseSecurityUser(ContextUtils.getUserInfo());
|
|
|
- appEventDTO.setApplyInfo(applyInfo);
|
|
|
- appEventDTO.setContent(content);
|
|
|
- appEventDTO.setAppMsgTypeEnum(appMsgTypeEnum);
|
|
|
-
|
|
|
- eventPublisher.publishAppEvent(appEventDTO);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 保存或者更新文件
|
|
|
*
|
|
@@ -638,6 +673,9 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
* @param fileHolderList 文件
|
|
|
*/
|
|
|
private void saveOrUpdateFile(String busiId, List<FileHolder> fileHolderList) {
|
|
|
+ if (CollectionUtil.isEmpty(fileHolderList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
FileHolder[] fileHolders = fileHolderList.toArray(new FileHolder[]{});
|
|
|
|
|
|
String busiType = "";
|
|
@@ -645,17 +683,71 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
uploadHandler.saveOrUpdate(fileUploadDTO);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ApplyInfo> getListByCodes(List<String> appCodes) {
|
|
|
+ LambdaQueryWrapper<ApplyInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<ApplyInfo> wrapper = queryWrapper.select().in(ApplyInfo::getApplyCode, appCodes);
|
|
|
+ return applyInfoMapper.selectList(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ApplyInfo> loadInfo(InputStream inputStream) throws IOException, ParseException {
|
|
|
+ //根据指定的文件输入流导入Excel从而产生Workbook对象
|
|
|
+ Workbook wb0 = new HSSFWorkbook(inputStream);
|
|
|
+ //获取Excel文档中的第一个表单
|
|
|
+ Sheet sht0 = wb0.getSheetAt(0);
|
|
|
+ List<ApplyInfo> list = new ArrayList<>();
|
|
|
+ List<String> codeList = new ArrayList<>();
|
|
|
+ for (Row r : sht0) {
|
|
|
+ if (r.getRowNum() == 0) {
|
|
|
+ checkRowTitle(r);
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ //循环每行的每一列
|
|
|
+ ApplyInfo entity = new ApplyInfo();
|
|
|
+ boolean isAllEmpty = true;
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ Cell cell = r.getCell(i);
|
|
|
+ if (cell != null) {
|
|
|
+ r.getCell(i).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
+ }
|
|
|
+ if (cell != null && StringUtils.isNotEmpty(cell.getStringCellValue())) {
|
|
|
+ isAllEmpty = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isAllEmpty) {
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
+ Cell cell = r.getCell(i);
|
|
|
+ if (cell != null) {
|
|
|
+ r.getCell(i).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
+ }
|
|
|
+ checkServiceResourceCellData(cell, i, r.getRowNum());
|
|
|
+ checkServiceResourceCellDataValid(cell, i, r.getRowNum(), entity, codeList);
|
|
|
+ }
|
|
|
+ entity.setDeleted(YesNotEnum.NO.getValue());
|
|
|
+ list.add(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 校验参数和设置参数
|
|
|
+ *
|
|
|
* @param cell
|
|
|
* @param num
|
|
|
* @param row
|
|
|
* @param resource
|
|
|
*/
|
|
|
private void checkServiceResourceCellDataValid(Cell cell, int num, int row, ApplyInfo resource, List<String> codeList) {
|
|
|
- if (cell == null)
|
|
|
+ if (cell == null) {
|
|
|
return;
|
|
|
+ }
|
|
|
String value = cell.getStringCellValue();
|
|
|
switch (num) {
|
|
|
case 0:
|
|
@@ -666,10 +758,10 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
break;
|
|
|
case 1:
|
|
|
ApplyInfo applyInfo = getAppByCode(value);
|
|
|
- if (applyInfo != null){
|
|
|
+ if (applyInfo != null) {
|
|
|
throw new NumberFormatException("第" + (row + 1) + "行'应用系统编号'已存在!");
|
|
|
}
|
|
|
- if (codeList.contains(value)){
|
|
|
+ if (codeList.contains(value)) {
|
|
|
throw new NumberFormatException("第" + (row + 1) + "行'应用系统编号'重复!");
|
|
|
}
|
|
|
codeList.add(value);
|
|
@@ -683,13 +775,13 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
break;
|
|
|
case 3:
|
|
|
String activeCode = null;
|
|
|
- if (value.equals("停用")){
|
|
|
+ if (value.equals("停用")) {
|
|
|
activeCode = "1";
|
|
|
}
|
|
|
- if (value.equals("启用")){
|
|
|
+ if (value.equals("启用")) {
|
|
|
activeCode = "0";
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(activeCode)){
|
|
|
+ if (StringUtils.isEmpty(activeCode)) {
|
|
|
throw new NumberFormatException("第" + (row + 1) + "行'系统在用标识'不存在!");
|
|
|
}
|
|
|
resource.setApplyStatus(activeCode);
|
|
@@ -697,7 +789,7 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
break;
|
|
|
case 4:
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(value)){
|
|
|
+ if (StringUtils.isNotEmpty(value)) {
|
|
|
try {
|
|
|
SimpleDateFormat importFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -744,66 +836,4 @@ public class ApplyInfoServiceImpl extends BaseMybatisService<ApplyInfo, String>
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 校验数据是否为空
|
|
|
- * @param cell
|
|
|
- * @param i
|
|
|
- * @param row
|
|
|
- */
|
|
|
- private static void checkServiceResourceCellData(Cell cell, int i, int row) {
|
|
|
- if (!(cell == null || StringUtils.isEmpty(cell.getStringCellValue()))) {
|
|
|
- return;
|
|
|
- }
|
|
|
- switch (i) {
|
|
|
- case 0:
|
|
|
- throw new NumberFormatException("第" + (row + 1) + "行'应用系统名称'为空!");
|
|
|
- case 1:
|
|
|
- throw new NumberFormatException("第" + (row + 1) + "行'应用系统编号'为空!");
|
|
|
- case 2:
|
|
|
- throw new NumberFormatException("第" + (row + 1) + "行'应用系统英文名称'为空!");
|
|
|
- case 3:
|
|
|
- throw new NumberFormatException("第" + (row + 1) + "行'系统在用标识'为空!");
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 校验列头
|
|
|
- * @param r
|
|
|
- */
|
|
|
- private static void checkRowTitle(Row r) {
|
|
|
- if (!r.getCell(0).getStringCellValue().equals("应用系统名称")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统名称'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(1).getStringCellValue().equals("应用系统编号")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统编号'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(2).getStringCellValue().equals("应用系统英文名称")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统英文名称'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(3).getStringCellValue().equals("系统在用标识")) {
|
|
|
- throw new NumberFormatException("缺少'系统在用标识'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(4).getStringCellValue().equals("上线日期")) {
|
|
|
- throw new NumberFormatException("缺少'上线日期'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(5).getStringCellValue().equals("应用负责人")) {
|
|
|
- throw new NumberFormatException("缺少'应用负责人'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(6).getStringCellValue().equals("应用系统事权单位代码")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统事权单位代码'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(7).getStringCellValue().equals("应用系统管理单位名称")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统管理单位名称'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(8).getStringCellValue().equals("应用系统运维单位名称")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统运维单位名称'列!");
|
|
|
- }
|
|
|
- if (!r.getCell(9).getStringCellValue().equals("应用系统说明")) {
|
|
|
- throw new NumberFormatException("缺少'应用系统说明'列!");
|
|
|
- }
|
|
|
- }
|
|
|
}
|