Browse Source

export

master
zxc 4 years ago
parent
commit
a2b688a360
  1. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  2. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java
  3. 27
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

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

@ -35,6 +35,7 @@ import com.epmet.dto.form.EditCommunitySelfOrganizationFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.excel.ExportCommunitySelfOrganizationExcel;
import com.epmet.excel.IcCommunitySelfOrganizationExcel;
import com.epmet.service.IcCommunitySelfOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
@ -100,6 +101,12 @@ public class IcCommunitySelfOrganizationController {
ExcelUtils.exportExcelToTarget(response, null, list, IcCommunitySelfOrganizationExcel.class);
}
@PostMapping("exportcommunityselforganization")
public void exportCommunitySelfOrganization(HttpServletResponse response,@LoginUser TokenDto tokenDto,@RequestBody CommunitySelfOrganizationListFormDTO formDTO) throws Exception {
CommunitySelfOrganizationListResultDTO resultDTO = icCommunitySelfOrganizationService.communitySelfOrganizationList(tokenDto, formDTO);
ExcelUtils.exportExcelToTarget(response, null, resultDTO.getList(), ExportCommunitySelfOrganizationExcel.class);
}
/**
* @Description 添加社区自组织
* @param tokenDto

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java

@ -0,0 +1,31 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.CellStyler;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class ExportCommunitySelfOrganizationExcel {
@Excel(name = "排序")
private Integer sort;
@Excel(name = "组织名称", width = 40)
private String organizationName;
@Excel(name = "组织人数", width = 20)
private Integer organizationPersonCount;
@Excel(name = "负责人姓名", width = 20)
private String principalName;
@Excel(name = "负责人电话", width = 20)
private String principalPhone;
@Excel(name = "服务事项", width = 60)
private String serviceItem;
@Excel(name = "社区自组织创建时间", width = 20)
private String organizationCreatedTime;
}

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

@ -43,6 +43,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
@ -213,14 +214,26 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
formDTO.setCustomerId(tokenDto.getCustomerId());
final int[] i = {(formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE};
CommunitySelfOrganizationListResultDTO result = new CommunitySelfOrganizationListResultDTO();
PageInfo<CommunitySelfOrganizationListDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO));
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){
objectPageInfo.getList().forEach(l -> {
l.setSort(i[NumConstant.ZERO]);
i[NumConstant.ZERO]++;
if (formDTO.getIsPage()){
PageInfo<CommunitySelfOrganizationListDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO));
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){
objectPageInfo.getList().forEach(l -> {
l.setSort(i[NumConstant.ZERO]);
i[NumConstant.ZERO]++;
});
result.setList(objectPageInfo.getList());
}
return result;
}
List<CommunitySelfOrganizationListDTO> resultDTOs = baseDao.selectCommunitySelfOrganizationList(formDTO);
if (CollectionUtils.isNotEmpty(resultDTOs)){
result.setTotal(resultDTOs.size());
AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE);
resultDTOs.forEach(r -> {
r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE));
});
result.setList(objectPageInfo.getList());
result.setList(resultDTOs);
}
return result;
}

Loading…
Cancel
Save