|
@@ -2,19 +2,21 @@ package com.ygtx.gxt.controller;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
|
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import javax.servlet.ServletOutputStream;
|
|
import javax.servlet.ServletOutputStream;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.ygtx.common.utils.DictUtils;
|
|
import com.ygtx.common.utils.DictUtils;
|
|
|
import com.ygtx.common.utils.SecurityUtils;
|
|
import com.ygtx.common.utils.SecurityUtils;
|
|
|
import com.ygtx.gxt.domain.*;
|
|
import com.ygtx.gxt.domain.*;
|
|
|
|
|
+import com.ygtx.gxt.domain.vo.GxtCompanyRankingVo;
|
|
|
import com.ygtx.gxt.service.IGxtOrderScoreService;
|
|
import com.ygtx.gxt.service.IGxtOrderScoreService;
|
|
|
import com.ygtx.gxt.service.IGxtWorkOrderService;
|
|
import com.ygtx.gxt.service.IGxtWorkOrderService;
|
|
|
import com.ygtx.system.service.ISysConfigService;
|
|
import com.ygtx.system.service.ISysConfigService;
|
|
@@ -431,6 +433,44 @@ public class GxtRepairOrderController extends BaseController
|
|
|
return success(result);
|
|
return success(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 导出排名列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @Log(title = "导出排名列表", businessType = BusinessType.EXPORT)
|
|
|
|
|
+ @PostMapping("/exportCompanyRank")
|
|
|
|
|
+ @ApiOperation("导出排名列表")
|
|
|
|
|
+ public void exportCompanyRanking(HttpServletResponse response, GxtUserScore userScore) {
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
+ String monthPeriod = sdf.format(calendar.getTime());
|
|
|
|
|
+ List<GxtUserScore> list = gxtRepairOrderService.getCompanyRankingList();
|
|
|
|
|
+ List<GxtCompanyRankingVo> ranks = new ArrayList<>();
|
|
|
|
|
+ int currentRank = 1; // 当前排名
|
|
|
|
|
+ BigDecimal prevScore = null;
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ GxtUserScore item = list.get(i);
|
|
|
|
|
+ if (i==0) {
|
|
|
|
|
+ prevScore = item.getFinalScore();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (prevScore.compareTo(item.getFinalScore())>0) {
|
|
|
|
|
+ currentRank = i + 1; // 分数变化,更新排名
|
|
|
|
|
+ }
|
|
|
|
|
+ // 相同分数排名相同
|
|
|
|
|
+ GxtCompanyRankingVo vo = new GxtCompanyRankingVo();
|
|
|
|
|
+ vo.setName(item.getNickName());
|
|
|
|
|
+ vo.setStation(item.getDeptName());
|
|
|
|
|
+ vo.setFinalScore(item.getFinalScore());
|
|
|
|
|
+ vo.setMonthPeriod(monthPeriod);
|
|
|
|
|
+ vo.setRank(currentRank); // 设置排名
|
|
|
|
|
+ ranks.add(vo);
|
|
|
|
|
+ prevScore = item.getFinalScore(); // 更新上一个分数
|
|
|
|
|
+ }
|
|
|
|
|
+ ExcelUtil<GxtCompanyRankingVo> util = new ExcelUtil<GxtCompanyRankingVo>(GxtCompanyRankingVo.class);
|
|
|
|
|
+
|
|
|
|
|
+ util.exportExcel(response, ranks, "公司排名数据");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 撤回维修工单
|
|
* 撤回维修工单
|
|
|
*/
|
|
*/
|