|
@@ -3,6 +3,7 @@ package com.jpsoft.employment.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.employment.config.OSSConfig;
|
|
|
+import com.jpsoft.employment.modules.base.entity.GenerateReport;
|
|
|
import com.jpsoft.employment.modules.base.entity.JobInformationInfo;
|
|
|
import com.jpsoft.employment.modules.base.entity.RecruitInformationInfo;
|
|
|
import com.jpsoft.employment.modules.base.entity.RecruitPersonRelation;
|
|
@@ -58,10 +59,13 @@ public class ReportController {
|
|
|
@Autowired
|
|
|
private OSSConfig ossConfig;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GenerateReportService generateReportService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "日报表")
|
|
|
@RequestMapping(value = "dailyReport", method = RequestMethod.POST)
|
|
|
- public MessageResult<Object> dailyReport(String dateRange,@RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag) {
|
|
|
+ public MessageResult<Object> dailyReport(String dateRange, @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag) {
|
|
|
|
|
|
MessageResult<Object> msgResult = new MessageResult<>();
|
|
|
|
|
@@ -186,8 +190,7 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
- }
|
|
|
- catch (Exception ex) {
|
|
|
+ } catch (Exception ex) {
|
|
|
logger.error(ex.getMessage(), ex);
|
|
|
msgResult.setResult(false);
|
|
|
}
|
|
@@ -205,8 +208,8 @@ public class ReportController {
|
|
|
//表头
|
|
|
Row rowTitle = sheet.createRow(0);
|
|
|
|
|
|
- String[] titles = new String[]{"序号", "新增登录人数", "累计登录人数", "今日注册人数","累计注册人数", "新增求职登记人数", "累计求职登记人数", "累计简历数",
|
|
|
- "新增线上认证企业数量", "累计认证企业数量","新增岗位发布数量","实时发布岗位数","累计发布岗位数","岗位需求人数","累计岗位需求人数","今日报名人数"};
|
|
|
+ String[] titles = new String[]{"序号", "新增登录人数", "累计登录人数", "今日注册人数", "累计注册人数", "新增求职登记人数", "累计求职登记人数", "累计简历数",
|
|
|
+ "新增线上认证企业数量", "累计认证企业数量", "新增岗位发布数量", "实时发布岗位数", "累计发布岗位数", "岗位需求人数", "累计岗位需求人数", "今日报名人数"};
|
|
|
|
|
|
for (int i = 0; i < titles.length; i++) {
|
|
|
Cell cell = rowTitle.createCell(i);
|
|
@@ -254,21 +257,20 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@ApiOperation(value = "分组日报表")
|
|
|
@RequestMapping(value = "dailyGroupReport", method = RequestMethod.POST)
|
|
|
- public MessageResult<Object> dailyGroupReport(String dateRange,@RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag) {
|
|
|
+ public MessageResult<Object> dailyGroupReport(String dateRange, @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag) {
|
|
|
|
|
|
MessageResult<Object> msgResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
String[] dateArr = dateRange.split(",");
|
|
|
|
|
|
- List<String> dayList = getTwoDaysDayDes(dateArr[0],dateArr[1]);
|
|
|
+ List<String> dayList = getTwoDaysDayDes(dateArr[0], dateArr[1]);
|
|
|
|
|
|
List<Map> mapList = new ArrayList<>();
|
|
|
|
|
|
- for (String date:dayList) {
|
|
|
+ for (String date : dayList) {
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
|
|
Map<String, Object> searchParams1 = new HashMap<>();
|
|
@@ -282,7 +284,7 @@ public class ReportController {
|
|
|
searchParams1.put("endTime", endTime);
|
|
|
|
|
|
Map map = new HashMap();
|
|
|
- map.put("date",date);
|
|
|
+ map.put("date", date);
|
|
|
|
|
|
//登录人数,新增人数
|
|
|
Integer loginNum = personLoginLogService.dailyReportList(searchParams);
|
|
@@ -384,8 +386,7 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
msgResult.setResult(true);
|
|
|
- }
|
|
|
- catch (Exception ex) {
|
|
|
+ } catch (Exception ex) {
|
|
|
logger.error(ex.getMessage(), ex);
|
|
|
msgResult.setResult(false);
|
|
|
}
|
|
@@ -394,7 +395,6 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private String groupExportXls(List<Map> mapList) {
|
|
|
String downloadUrl = "";
|
|
|
|
|
@@ -404,8 +404,8 @@ public class ReportController {
|
|
|
//表头
|
|
|
Row rowTitle = sheet.createRow(0);
|
|
|
|
|
|
- String[] titles = new String[]{"序号", "日期", "新增登录人数", "累计登录人数", "今日注册人数","累计注册人数", "新增求职登记人数", "累计求职登记人数", "累计简历数",
|
|
|
- "新增线上认证企业数量", "累计认证企业数量","新增岗位发布数量","实时发布岗位数","累计发布岗位数","岗位需求人数","累计岗位需求人数","今日报名人数"};
|
|
|
+ String[] titles = new String[]{"序号", "日期", "新增登录人数", "累计登录人数", "今日注册人数", "累计注册人数", "新增求职登记人数", "累计求职登记人数", "累计简历数",
|
|
|
+ "新增线上认证企业数量", "累计认证企业数量", "新增岗位发布数量", "实时发布岗位数", "累计发布岗位数", "岗位需求人数", "累计岗位需求人数", "今日报名人数"};
|
|
|
|
|
|
for (int i = 0; i < titles.length; i++) {
|
|
|
Cell cell = rowTitle.createCell(i);
|
|
@@ -454,10 +454,9 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 根据一段时间获取该段时间的所有日期 正序排序
|
|
|
+ *
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return
|
|
@@ -484,6 +483,7 @@ public class ReportController {
|
|
|
|
|
|
/**
|
|
|
* 根据一段时间获取该段时间的所有日期 倒序排序
|
|
|
+ *
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @return yyyy-MM-dd
|
|
@@ -509,4 +509,127 @@ public class ReportController {
|
|
|
return dateList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation(value = "分组日报表测试")
|
|
|
+ @RequestMapping(value = "dailyGroupReportTest", method = RequestMethod.POST)
|
|
|
+ public void dailyGroupReportTest() {
|
|
|
+ try {
|
|
|
+ Date now = new Date();
|
|
|
+
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(now);
|
|
|
+ cal.add(Calendar.DATE, -1);
|
|
|
+ Date yesterday = cal.getTime();
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String date = sdf.format(yesterday);
|
|
|
+
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParams1 = new HashMap<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(date)) {
|
|
|
+ String startTime = date + " 00:00:00";
|
|
|
+ String endTime = date + " 23:59:59";
|
|
|
+ searchParams.put("startTime", startTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
+
|
|
|
+
|
|
|
+ searchParams1.put("endTime", endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ GenerateReport currGenerateReport = generateReportService.findByDate(searchParams);
|
|
|
+
|
|
|
+ if (currGenerateReport == null) {
|
|
|
+
|
|
|
+ //登录人数,新增人数
|
|
|
+ Integer loginNum = personLoginLogService.dailyReportList(searchParams);
|
|
|
+
|
|
|
+ //登录人数,累计人数
|
|
|
+ List<String> personIdList = personLoginLogService.totalDailyReportList(searchParams1);
|
|
|
+ Integer totalLoginNum = personIdList.size();
|
|
|
+
|
|
|
+ //今日注册人数
|
|
|
+ Integer dailyPersonRegNum = personInfoService.dailyPersonReg(searchParams);
|
|
|
+
|
|
|
+ //累计注册人数
|
|
|
+ Integer totalPersonRegNum = personInfoService.dailyPersonReg(searchParams1);
|
|
|
+
|
|
|
+ //认证人数,新增人数
|
|
|
+ Integer personNum = personInfoService.dailyReportList(searchParams);
|
|
|
+
|
|
|
+ //认证人数,累计人数
|
|
|
+ Integer totalPersonNum = personInfoService.dailyReportList(searchParams1);
|
|
|
+
|
|
|
+ //简历数 累计简历数
|
|
|
+ Integer totalJobInformation = jobInformationInfoService.countList(searchParams1);
|
|
|
+
|
|
|
+ //认证企业数,新增数
|
|
|
+ Integer enterpriseNum = enterpriseInfoService.dailyReportList(searchParams);
|
|
|
+
|
|
|
+ //认证企业数,累计数
|
|
|
+ Integer totalEnterpriseNum = enterpriseInfoService.dailyReportList(searchParams1);
|
|
|
+
|
|
|
+ //累计岗位数量
|
|
|
+ Integer totalRecruitStatusNum = recruitInformationInfoService.dailyReportList(searchParams1);
|
|
|
+
|
|
|
+ //累计岗位需求人数
|
|
|
+ Integer totalJobRequirementNum = recruitInformationInfoService.sumJobRequirementNum(searchParams1);
|
|
|
+
|
|
|
+ //新增岗位数量
|
|
|
+ searchParams.put("status", "1");
|
|
|
+ searchParams.put("isOnline", true);
|
|
|
+ searchParams.put("delFlag", false);
|
|
|
+ Integer recruitNum = recruitInformationInfoService.dailyReportList(searchParams);
|
|
|
+
|
|
|
+ //实时岗位数量
|
|
|
+ searchParams1.put("status", "1");
|
|
|
+ searchParams1.put("isOnline", true);
|
|
|
+ searchParams1.put("delFlag", false);
|
|
|
+
|
|
|
+ //岗位需求人数
|
|
|
+ Integer jobRequirementNum = recruitInformationInfoService.sumJobRequirementNum(searchParams1);
|
|
|
+
|
|
|
+
|
|
|
+ Integer totalRecruitNum = recruitInformationInfoService.dailyReportList(searchParams1);
|
|
|
+
|
|
|
+ //今日报名人数
|
|
|
+ searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(date)) {
|
|
|
+ String startTime = date + " 00:00:00";
|
|
|
+ String endTime = date + " 23:59:59";
|
|
|
+ searchParams.put("startTime", startTime);
|
|
|
+ searchParams.put("endTime", endTime);
|
|
|
+ }
|
|
|
+ Integer jobInformationNum = recruitPersonRelationService.dailyReportList(searchParams);
|
|
|
+
|
|
|
+ GenerateReport generateReport = new GenerateReport();
|
|
|
+ generateReport.setId(UUID.randomUUID().toString());
|
|
|
+ generateReport.setCreateTime(new Date());
|
|
|
+ generateReport.setDelFlag(false);
|
|
|
+ generateReport.setDate(sdf.parse(date));
|
|
|
+ generateReport.setLoginNum(loginNum);
|
|
|
+ generateReport.setTotalLoginNum(totalLoginNum);
|
|
|
+ generateReport.setDailyPersonRegNum(dailyPersonRegNum);
|
|
|
+ generateReport.setTotalPersonRegNum(totalPersonRegNum);
|
|
|
+ generateReport.setPersonNum(personNum);
|
|
|
+ generateReport.setTotalPersonNum(totalPersonNum);
|
|
|
+ generateReport.setTotalJobInformation(totalJobInformation);
|
|
|
+ generateReport.setEnterpriseNum(enterpriseNum);
|
|
|
+ generateReport.setTotalEnterpriseNum(totalEnterpriseNum);
|
|
|
+ generateReport.setTotalRecruitStatusNum(totalRecruitStatusNum);
|
|
|
+ generateReport.setTotalJobRequirementNum(totalJobRequirementNum);
|
|
|
+ generateReport.setRecruitNum(recruitNum);
|
|
|
+ generateReport.setJobRequirementNum(jobRequirementNum);
|
|
|
+ generateReport.setTotalRecruitNum(totalRecruitNum);
|
|
|
+ generateReport.setJobInformationNum(jobInformationNum);
|
|
|
+
|
|
|
+ int count = generateReportService.insert(generateReport);
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|