Browse Source

党员风采和社会自组织上传改为异步

dev
sunyuchao 4 years ago
parent
commit
57a269bf44
  1. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  3. 5
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java
  4. 4
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java

8
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java

@ -17,10 +17,6 @@
package com.epmet.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.poi.excel.ExcelUtil;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.exception.RenException;
@ -143,7 +139,7 @@ public class IcCommunitySelfOrganizationController {
* @date 2021/11/25 9:03 上午
*/
@PostMapping("importcommunityselforganization")
public void importCommunitySelfOrganization(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws Exception {
public Result importCommunitySelfOrganization(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws Exception {
if (file.isEmpty()) {
throw new RenException("请上传文件");
}
@ -164,6 +160,8 @@ public class IcCommunitySelfOrganizationController {
}
//2.执行导入程序
icCommunitySelfOrganizationService.importCommunitySelfOrganization(tokenDto, response, file, result.getData().getTaskId());
return new Result();
}
/**

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -57,6 +57,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -80,6 +82,7 @@ import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
*/
@Service
@Slf4j
@EnableAsync
public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCommunitySelfOrganizationDao, IcCommunitySelfOrganizationEntity> implements IcCommunitySelfOrganizationService {
@Autowired
@ -472,6 +475,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Async
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException {
List<CommunitySelfOrgImportExcel> fileList = new ArrayList<>();
CommunitySelfOrgImportExcel excel = null;

5
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java

@ -17,6 +17,7 @@
package com.epmet.modules.partymember.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
@ -124,7 +125,7 @@ public class IcPartymemberStyleController {
}
@PostMapping("import")
public void importData(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws IOException {
public Result importData(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws IOException {
// 校验文件类型
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (!"xls".equals(extension) && !"xlsx".equals(extension)) {
@ -141,6 +142,8 @@ public class IcPartymemberStyleController {
}
//2.执行导入程序
icPartymemberStyleService.importData(tokenDto, response, file, result.getData().getTaskId());
return new Result();
}
/**

4
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java

@ -71,6 +71,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -92,6 +94,7 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
@EnableAsync
public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymemberStyleDao, IcPartymemberStyleEntity> implements IcPartymemberStyleService {
@Resource
@ -255,6 +258,7 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Async
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException {
List<PartyMemberImportExcel> fileList = new ArrayList<>();
PartyMemberImportExcel excel = null;

Loading…
Cancel
Save