|
@@ -3,6 +3,7 @@ package com.zhongshu.card.server.core.service.school;
|
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.zhongshu.card.client.model.org.OidAboutInfo;
|
|
import com.zhongshu.card.client.model.org.OidAboutInfo;
|
|
|
import com.zhongshu.card.client.model.school.*;
|
|
import com.zhongshu.card.client.model.school.*;
|
|
|
import com.github.microservice.net.ResultContent;
|
|
import com.github.microservice.net.ResultContent;
|
|
@@ -10,6 +11,7 @@ import com.github.microservice.net.ResultMessage;
|
|
|
import com.zhongshu.card.client.type.school.CardType;
|
|
import com.zhongshu.card.client.type.school.CardType;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.school.CardInfoPoolDao;
|
|
import com.zhongshu.card.server.core.dao.school.CardInfoPoolDao;
|
|
|
|
|
+import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
import com.zhongshu.card.server.core.domain.school.CardInfoPool;
|
|
import com.zhongshu.card.server.core.domain.school.CardInfoPool;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
@@ -29,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author TRX
|
|
* @author TRX
|
|
@@ -58,6 +61,10 @@ public class CardInfoPoolService extends SuperService {
|
|
|
CardInfoPool entity = null;
|
|
CardInfoPool entity = null;
|
|
|
// 这是学校的oid
|
|
// 这是学校的oid
|
|
|
String oid = param.getOid();
|
|
String oid = param.getOid();
|
|
|
|
|
+ Organization organization = organizationDao.findTopByOid(oid);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(organization)) {
|
|
|
|
|
+ return ResultContent.buildFail(String.format("机构不存在:%s", param.getOid()));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
OidAboutInfo oidAboutInfo = organizationService.getOidAboutOrgInfo(oid);
|
|
OidAboutInfo oidAboutInfo = organizationService.getOidAboutOrgInfo(oid);
|
|
|
|
|
|
|
@@ -156,8 +163,7 @@ public class CardInfoPoolService extends SuperService {
|
|
|
* @param file
|
|
* @param file
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public ResultContent<ImportResultModel> importCardPool(HttpServletRequest request,
|
|
|
|
|
- HttpServletResponse response, MultipartFile file) {
|
|
|
|
|
|
|
+ public ResultContent<ImportResultModel> importCardPool(HttpServletRequest request, HttpServletResponse response, MultipartFile file) {
|
|
|
String oid = getCurrentOid();
|
|
String oid = getCurrentOid();
|
|
|
Assert.hasText(oid, "oid不能为空");
|
|
Assert.hasText(oid, "oid不能为空");
|
|
|
|
|
|
|
@@ -170,8 +176,7 @@ public class CardInfoPoolService extends SuperService {
|
|
|
try {
|
|
try {
|
|
|
int startRow = 2;
|
|
int startRow = 2;
|
|
|
ImportParams params = new ImportParams();
|
|
ImportParams params = new ImportParams();
|
|
|
- List<CardInfoPoolImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(),
|
|
|
|
|
- CardInfoPoolImportParam.class, params);
|
|
|
|
|
|
|
+ List<CardInfoPoolImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(), CardInfoPoolImportParam.class, params);
|
|
|
model.setTotal(list.size());
|
|
model.setTotal(list.size());
|
|
|
|
|
|
|
|
List<String> failDetails = new ArrayList<>();
|
|
List<String> failDetails = new ArrayList<>();
|
|
@@ -221,6 +226,24 @@ public class CardInfoPoolService extends SuperService {
|
|
|
return ResultContent.buildSuccess(model);
|
|
return ResultContent.buildSuccess(model);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 搜索卡片
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public ResultContent<List<CardInfoPoolSimpleModel>> queryPoolCard(CardInfoPoolQueryParam param) {
|
|
|
|
|
+ if (StringUtils.isEmpty(param.getCode())) {
|
|
|
|
|
+ return ResultContent.buildSuccess(Lists.newArrayList());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<CardInfoPool> list = cardInfoPoolDao.findTop10BySchoolOidAndCodeLike(param.getSchoolOid(), param.getCode());
|
|
|
|
|
+ List<CardInfoPoolSimpleModel> models = new ArrayList<>();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
+ models = list.stream().map(this::toSimpleModel).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResultContent.buildSuccess(models);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public CardInfoPoolModel toModel(CardInfoPool entity) {
|
|
public CardInfoPoolModel toModel(CardInfoPool entity) {
|
|
|
CardInfoPoolModel model = null;
|
|
CardInfoPoolModel model = null;
|
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
if (ObjectUtils.isNotEmpty(entity)) {
|
|
@@ -229,4 +252,14 @@ public class CardInfoPoolService extends SuperService {
|
|
|
}
|
|
}
|
|
|
return model;
|
|
return model;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public CardInfoPoolSimpleModel toSimpleModel(CardInfoPool entity) {
|
|
|
|
|
+ CardInfoPoolSimpleModel model = null;
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(entity)) {
|
|
|
|
|
+ model = new CardInfoPoolSimpleModel();
|
|
|
|
|
+ BeanUtils.copyProperties(entity, model);
|
|
|
|
|
+ }
|
|
|
|
|
+ return model;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|