Merge branch 'master' into docker_package
This commit is contained in:
commit
2d722cbb68
|
@ -505,9 +505,6 @@ public class CensusController {
|
|||
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
|
||||
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
||||
}
|
||||
// else if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) { // 超级管理员
|
||||
//
|
||||
// }
|
||||
ArrayList<Map> resultList = (ArrayList<Map>) resourceDao.selectCensusResourceTable(params);
|
||||
List<List<Object>> date = resultList.stream().map(index -> {
|
||||
List<Object> data = new ArrayList<>();
|
||||
|
|
|
@ -16,11 +16,15 @@ import io.renren.modules.resource.dataResource.DataResourceFactory;
|
|||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.excel.ResourceExcelImportListener;
|
||||
import io.renren.modules.resource.excel.census.config.CustomCellWriteHeightConfig;
|
||||
import io.renren.modules.resource.excel.census.config.CustomCellWriteWeightConfig;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.resource.videoPreview.AbstractVideoPreviewService;
|
||||
import io.renren.modules.resource.videoPreview.VideoPreviewFactory;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -41,8 +45,10 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -109,6 +115,9 @@ public class ResourceController {
|
|||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Autowired
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Resource(name = "${hisense.gateway.name}")
|
||||
private ApiGateway apiGateway;
|
||||
|
||||
|
@ -146,6 +155,82 @@ public class ResourceController {
|
|||
return new Result<PageData<ResourceDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出资源")
|
||||
@LogOperation("导出资源")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
|
||||
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
|
||||
})
|
||||
public void exportSelectCensusResourceTable(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
|
||||
// UserDetail user = SecurityUser.getUser();
|
||||
// if (user.getDeptId() != null) {
|
||||
// SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
|
||||
// params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
|
||||
// }
|
||||
List<ResourceDTO> result = resourceService.list(params);
|
||||
List<List<Object>> date = result.stream().map(index -> {
|
||||
List<Object> data = new ArrayList<>();
|
||||
data.add(index.getName());
|
||||
data.add(index.getDescription());
|
||||
Optional<SysDeptDTO> sysDeptDTOOptional = Optional.ofNullable(sysDeptService.get(index.getDeptId() == null ? 0l : index.getDeptId()));
|
||||
if (sysDeptDTOOptional.isPresent()) {
|
||||
data.add(sysDeptDTOOptional.get().getName());
|
||||
} else {
|
||||
data.add("--");
|
||||
}
|
||||
Optional<String> yyly = index.getInfoList().stream().filter(index_ -> index_.getAttrType().equals("应用领域") && index_.getDelFlag().intValue() == 0).map(index_ -> index_.getAttrValue()).findFirst();
|
||||
if (yyly.isPresent()) {
|
||||
data.add(yyly.get());
|
||||
} else {
|
||||
data.add("--");
|
||||
}
|
||||
data.add(index.getCreateDate() == null ? "--" : index.getCreateDate().toString());
|
||||
|
||||
SysUserDTO userDTO = sysUserService.get(index.getCreator() == null ? 0l : index.getCreator());
|
||||
if (userDTO != null) {
|
||||
data.add(userDTO.getUsername());
|
||||
} else {
|
||||
data.add("--");
|
||||
}
|
||||
return data;
|
||||
}).collect(Collectors.toList());
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("资源导出_" + System.currentTimeMillis(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
EasyExcel.write(response.getOutputStream()).head(exportSelectCensusResourceTableHead())
|
||||
.registerWriteHandler(new CustomCellWriteWeightConfig())
|
||||
.registerWriteHandler(new CustomCellWriteHeightConfig())
|
||||
.sheet("上架情况").doWrite(date);
|
||||
}
|
||||
|
||||
private List<List<String>> exportSelectCensusResourceTableHead() {
|
||||
List<List<String>> list = new ArrayList<>();
|
||||
List<String> head0 = new ArrayList<>();
|
||||
head0.add("名称");
|
||||
List<String> head1 = new ArrayList<>();
|
||||
head1.add("描述");
|
||||
List<String> head2 = new ArrayList<>();
|
||||
head2.add("归属部门");
|
||||
List<String> head3 = new ArrayList<>();
|
||||
head3.add("应用领域");
|
||||
List<String> head4 = new ArrayList<>();
|
||||
head4.add("上架时间");
|
||||
List<String> head5 = new ArrayList<>();
|
||||
head4.add("上架账号");
|
||||
list.add(head0);
|
||||
list.add(head1);
|
||||
list.add(head2);
|
||||
list.add(head3);
|
||||
list.add(head4);
|
||||
list.add(head5);
|
||||
return list;
|
||||
}
|
||||
|
||||
@PostMapping("/pageWithAttrs")
|
||||
@ApiOperation("分页查询资源信息2")
|
||||
@LogOperation("分页查询资源信息2")
|
||||
|
@ -444,8 +529,8 @@ public class ResourceController {
|
|||
@ApiOperation("资源列表转发")
|
||||
@LogOperation("资源列表转发")
|
||||
public Result yaweiApproveStatus(@ApiParam("页数") Integer page,
|
||||
@ApiParam("页大小") Integer size,
|
||||
@ApiParam("资源模糊搜索") String title) {
|
||||
@ApiParam("页大小") Integer size,
|
||||
@ApiParam("资源模糊搜索") String title) {
|
||||
|
||||
if (page == null) page = 1;
|
||||
if (size == null) size = 10;
|
||||
|
|
Loading…
Reference in New Issue