|
|
|
@ -4,10 +4,7 @@ import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|
|
|
import com.zdxt.auth.framework.web.domain.AjaxResult; |
|
|
|
import com.zdxt.auth.project.system.dept.service.IDeptService; |
|
|
|
import com.zdxt.auth.project.system.dict.mapper.DictDataMapper; |
|
|
|
import com.zdxt.code.domain.ComplaintStatistics; |
|
|
|
import com.zdxt.code.domain.EnterpriseComplaint; |
|
|
|
import com.zdxt.code.domain.SearchType; |
|
|
|
import com.zdxt.code.domain.StatisticsIndicator; |
|
|
|
import com.zdxt.code.domain.*; |
|
|
|
import com.zdxt.code.service.ComplaintStatisticsService; |
|
|
|
import com.zdxt.code.service.IEnterpriseComplaintService; |
|
|
|
import com.zdxt.common.controller.BaseController; |
|
|
|
@ -15,16 +12,15 @@ import com.zdxt.common.util.TableDataInfo; |
|
|
|
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|
|
|
import com.zdxt.domain.auth.Dept; |
|
|
|
import com.zdxt.domain.auth.DictData; |
|
|
|
import org.apache.poi.hssf.usermodel.*; |
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.ui.Model; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.lang.reflect.Array; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.time.LocalDate; |
|
|
|
@ -100,26 +96,8 @@ public class ComplaintStaticController extends BaseController { |
|
|
|
@ResponseBody |
|
|
|
public TableDataInfo complaint1(SearchType searchType) { |
|
|
|
ComplaintStatistics complaintStatistics=dateMake(searchType); |
|
|
|
if(searchType.getCType()!=null&&!"".equals(searchType.getCType())) { |
|
|
|
complaintStatistics.setComplaintType(Integer.parseInt(searchType.getCType())); |
|
|
|
} |
|
|
|
Map<String, Dept> deptMap=new HashMap<>(); |
|
|
|
if(searchType.getName()!=null&&!"".equals(searchType.getName())){//搜索条件内有投诉对象时
|
|
|
|
List<Dept> deptList=iDeptService.selectDeptByDeptName(searchType.getName()); |
|
|
|
deptMap=deptList.stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); |
|
|
|
complaintStatistics.setComplaintDepartmentIdList(new ArrayList<>(deptMap.keySet())); |
|
|
|
}else { |
|
|
|
deptMap=iDeptService.selectDeptAll().stream().collect(Collectors.toMap(Dept::getDeptId, Function.identity())); |
|
|
|
} |
|
|
|
startPage(); |
|
|
|
List<ComplaintStatistics> complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsGroup(complaintStatistics); |
|
|
|
for (int i=0;i<complaintStatisticsList.size();i++){ |
|
|
|
if(deptMap.containsKey(complaintStatisticsList.get(i).complaintDepartmentId)){ |
|
|
|
complaintStatisticsList.get(i).setComplaintDepartment(deptMap.get(complaintStatisticsList.get(i).complaintDepartmentId).getDeptName()); |
|
|
|
}/*else { |
|
|
|
complaintStatisticsList.get(i).setComplaintDepartment(complaintStatisticsList.get(i).getComplaintDepartmentId()); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
/*startPage();*/ |
|
|
|
List<ComplaintStatistics> complaintStatisticsList=complaintStatisticsService.list1(searchType,complaintStatistics); |
|
|
|
return getDataTable(complaintStatisticsList); |
|
|
|
} |
|
|
|
@RequiresPermissions("code:complaintStatic:list") |
|
|
|
@ -153,28 +131,7 @@ public class ComplaintStaticController extends BaseController { |
|
|
|
public TableDataInfo complaint2(SearchType searchType) { |
|
|
|
ComplaintStatistics complaintStatistics=dateMake(searchType); |
|
|
|
List<ComplaintStatistics> complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsList(complaintStatistics);//权限
|
|
|
|
int number=complaintStatisticsList.size(); |
|
|
|
Map<Integer,Long> map=complaintStatisticsList.stream().collect(Collectors.groupingBy(item->item.getComplaintType()==null?100:item.getComplaintType(),Collectors.counting())); |
|
|
|
Map<String,String> dictDataMap=dictDataMapper.selectDictDataByType("caseType").stream().collect(Collectors.toMap(DictData::getDictValue,DictData::getDictLabel)); |
|
|
|
List<StatisticsIndicator> list=new ArrayList<>(); |
|
|
|
for(int i:map.keySet()){ |
|
|
|
StatisticsIndicator s=new StatisticsIndicator(); |
|
|
|
if(i==100){ |
|
|
|
s.setName(""); |
|
|
|
s.setNumInt(Integer.parseInt(map.get(100)+"")); |
|
|
|
s.setPercentage((double)map.get(100)/number); |
|
|
|
}else { |
|
|
|
if(dictDataMap.containsKey(i+"")){ |
|
|
|
s.setName(dictDataMap.get(i+"")); |
|
|
|
}else { |
|
|
|
s.setName(i+""); |
|
|
|
} |
|
|
|
s.setNumInt(Integer.parseInt(map.get(i)+"")); |
|
|
|
s.setPercentage((double)map.get(i)/number); |
|
|
|
} |
|
|
|
list.add(s); |
|
|
|
} |
|
|
|
return getDataTable(list); |
|
|
|
return getDataTable(complaintStatisticsService.type(complaintStatisticsList)); |
|
|
|
} |
|
|
|
@RequiresPermissions("code:complaintStatic:list") |
|
|
|
@PostMapping("/eType") |
|
|
|
@ -184,6 +141,67 @@ public class ComplaintStaticController extends BaseController { |
|
|
|
complaintStatistics.setComplaintDepartmentId(iDeptService.selectDeptByDeptName2(searchType.getName()).getDeptId()); |
|
|
|
return complaintStatisticsService.selectComplaintStatisticsGroupByType(complaintStatistics); |
|
|
|
} |
|
|
|
@PostMapping("/export1") |
|
|
|
@ResponseBody |
|
|
|
public void export1(HttpServletResponse httpServletResponse,@RequestBody SearchType searchType) throws IOException { |
|
|
|
ComplaintStatistics complaintStatistics=dateMake(searchType); |
|
|
|
List<ComplaintStatistics> complaintStatisticsList=complaintStatisticsService.list1(searchType,complaintStatistics); |
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook(); |
|
|
|
HSSFSheet sheet = workbook.createSheet("执法投诉统计"); |
|
|
|
//设置文件名称
|
|
|
|
String fileName = "执法投诉统计.xls"; |
|
|
|
//设置表头
|
|
|
|
String[] headerList = {"被投诉对象", "投诉数量"}; |
|
|
|
HSSFRow headerRow = sheet.createRow(0); |
|
|
|
for (int i = 0; i < headerList.length; i++) { |
|
|
|
HSSFCell cell = headerRow.createCell(i); |
|
|
|
HSSFRichTextString text = new HSSFRichTextString(headerList[i]); |
|
|
|
cell.setCellValue(text); |
|
|
|
} |
|
|
|
for(int i=0;i<complaintStatisticsList.size();i++){ |
|
|
|
HSSFRow row = sheet.createRow(i+1); |
|
|
|
row.createCell(0).setCellValue(complaintStatisticsList.get(i).getComplaintDepartment()); |
|
|
|
row.createCell(1).setCellValue(complaintStatisticsList.get(i).getTotal()); |
|
|
|
} |
|
|
|
httpServletResponse.setCharacterEncoding("UTF-8"); |
|
|
|
httpServletResponse.setContentType("application/vnd.ms-excel"); |
|
|
|
httpServletResponse.setHeader("Content-disposition", "attachment;filename=" + fileName); |
|
|
|
httpServletResponse.flushBuffer(); |
|
|
|
workbook.write(httpServletResponse.getOutputStream()); |
|
|
|
workbook.close(); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/export2") |
|
|
|
@ResponseBody |
|
|
|
public void export2(HttpServletResponse httpServletResponse,@RequestBody SearchType searchType) throws IOException { |
|
|
|
ComplaintStatistics complaintStatistics=dateMake(searchType); |
|
|
|
List<ComplaintStatistics> complaintStatisticsList=complaintStatisticsService.selectComplaintStatisticsList(complaintStatistics);//权限
|
|
|
|
List<StatisticsIndicator> statisticsIndicatorList=complaintStatisticsService.type(complaintStatisticsList); |
|
|
|
HSSFWorkbook workbook = new HSSFWorkbook(); |
|
|
|
HSSFSheet sheet = workbook.createSheet("投诉类型统计"); |
|
|
|
//设置文件名称
|
|
|
|
String fileName = "投诉类型统计.xls"; |
|
|
|
//设置表头
|
|
|
|
String[] headerList = {"企业类型", "企业数量", "占比"}; |
|
|
|
HSSFRow headerRow = sheet.createRow(0); |
|
|
|
for (int i = 0; i < headerList.length; i++) { |
|
|
|
HSSFCell cell = headerRow.createCell(i); |
|
|
|
HSSFRichTextString text = new HSSFRichTextString(headerList[i]); |
|
|
|
cell.setCellValue(text); |
|
|
|
} |
|
|
|
for(int i=0;i<statisticsIndicatorList.size();i++){ |
|
|
|
HSSFRow row = sheet.createRow(i+1); |
|
|
|
row.createCell(0).setCellValue(statisticsIndicatorList.get(i).getName()); |
|
|
|
row.createCell(1).setCellValue(statisticsIndicatorList.get(i).getNumInt()); |
|
|
|
row.createCell(2).setCellValue(statisticsIndicatorList.get(i).getPercentage()); |
|
|
|
} |
|
|
|
httpServletResponse.setCharacterEncoding("UTF-8"); |
|
|
|
httpServletResponse.setContentType("application/vnd.ms-excel"); |
|
|
|
httpServletResponse.setHeader("Content-disposition", "attachment;filename=" + fileName); |
|
|
|
httpServletResponse.flushBuffer(); |
|
|
|
workbook.write(httpServletResponse.getOutputStream()); |
|
|
|
workbook.close(); |
|
|
|
} |
|
|
|
|
|
|
|
private ComplaintStatistics dateMake(SearchType searchType){ |
|
|
|
LocalDate localDate=LocalDate.now(); |
|
|
|
|