|
@ -41,13 +41,18 @@ import com.epmet.service.IcPartyActivityService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.io.FilenameUtils; |
|
|
import org.apache.commons.io.FilenameUtils; |
|
|
|
|
|
import org.apache.commons.io.IOUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.CompletableFuture; |
|
@ -214,4 +219,30 @@ public class IcPartyActivityController { |
|
|
PageData<IcPartyActivityDTO> page = icPartyActivityService.getActivityList(tokenDto, formDTO); |
|
|
PageData<IcPartyActivityDTO> page = icPartyActivityService.getActivityList(tokenDto, formDTO); |
|
|
return new Result<PageData<IcPartyActivityDTO>>().ok(page); |
|
|
return new Result<PageData<IcPartyActivityDTO>>().ok(page); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 下载联建活动导入模板 |
|
|
|
|
|
* @param response |
|
|
|
|
|
* @throws IOException |
|
|
|
|
|
*/ |
|
|
|
|
|
@RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
|
|
public void downloadTemplate(HttpServletResponse response) throws IOException { |
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); |
|
|
|
|
|
//response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.ms-excel");
|
|
|
|
|
|
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
|
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("联建活动导入模板", "UTF-8") + ".xlsx"); |
|
|
|
|
|
|
|
|
|
|
|
InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/icpartyactivity_import_tem.xlsx"); |
|
|
|
|
|
try { |
|
|
|
|
|
ServletOutputStream os = response.getOutputStream(); |
|
|
|
|
|
IOUtils.copy(is, os); |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (is != null) { |
|
|
|
|
|
is.close(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|