|
@ -1,10 +1,23 @@ |
|
|
package com.epmet.controller; |
|
|
package com.epmet.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.CustomerTitleHandler; |
|
|
|
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy; |
|
|
|
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; |
|
|
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; |
|
@ -12,14 +25,23 @@ import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; |
|
|
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; |
|
|
|
|
|
import com.epmet.excel.HistoryScoreDetailExcel; |
|
|
|
|
|
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService; |
|
|
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService; |
|
|
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.io.PrintWriter; |
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 平阴历史得分主表 |
|
|
* 平阴历史得分主表 |
|
|
* |
|
|
* |
|
@ -32,6 +54,8 @@ public class ScreenPyHistoryScoreController { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ScreenPyHistoryScoreService screenPyHistoryScoreService; |
|
|
private ScreenPyHistoryScoreService screenPyHistoryScoreService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ScreenPyHistoryScoreDetailService screenPyHistoryScoreDetailService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("list") |
|
|
@RequestMapping("list") |
|
@ -76,32 +100,39 @@ public class ScreenPyHistoryScoreController { |
|
|
return new Result<HistoryScoreDetailResultDTO>().ok(screenPyHistoryScoreService.detail(formDTO)); |
|
|
return new Result<HistoryScoreDetailResultDTO>().ok(screenPyHistoryScoreService.detail(formDTO)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*@PostMapping("export") |
|
|
@PostMapping("export") |
|
|
public void export(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO, HttpServletResponse response) throws IOException { |
|
|
public void export(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO, HttpServletResponse response) throws IOException { |
|
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
|
|
|
|
|
|
formDTO.setIsPage(false); |
|
|
formDTO.setIsPage(false); |
|
|
ExcelWriter excelWriter = null; |
|
|
ExcelWriter excelWriter = null; |
|
|
formDTO.setPageNo(NumConstant.ONE); |
|
|
formDTO.setPageNo(NumConstant.ONE); |
|
|
formDTO.setPageSize(NumConstant.TEN_THOUSAND); |
|
|
formDTO.setPageSize(NumConstant.FIVE_HUNDRED); |
|
|
try { |
|
|
try { |
|
|
String fileName = "迁入管理" + DateUtils.format(new Date()) + ".xlsx"; |
|
|
String fileName = "历史得分" + DateUtils.format(new Date()) + ".xlsx"; |
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcMoveInRecordExcel.class).build(); |
|
|
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), HistoryScoreDetailExcel.class).build(); |
|
|
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); |
|
|
//String title= "11月-12月";
|
|
|
PageData<IcMoveInListResultDTO> data = null; |
|
|
PageData<HistoryScoreDetailResultDTO> data = null; |
|
|
List<IcMoveInRecordExcel> list = null; |
|
|
List<HistoryScoreDetailExcel> list = null; |
|
|
do { |
|
|
do { |
|
|
data = screenPyHistoryScoreService.list(formDTO); |
|
|
data = screenPyHistoryScoreDetailService.selectScoreDetailList(formDTO); |
|
|
list = ConvertUtils.sourceToTarget(data.getList(), IcMoveInRecordExcel.class); |
|
|
|
|
|
|
|
|
for (HistoryScoreDetailResultDTO d : data.getList()){ |
|
|
|
|
|
list = ConvertUtils.sourceToTarget(d.getDetailList(), HistoryScoreDetailExcel.class); |
|
|
|
|
|
//一跳一条记录一个sheet页
|
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet(d.getTitle()).registerWriteHandler(new FreezeAndFilter()).build(); |
|
|
|
|
|
//WriteSheet writeSheet = EasyExcel.writerSheet(d.getTitle()).registerWriteHandler(new CustomerTitleHandler(title)).build();
|
|
|
|
|
|
excelWriter.write(list, writeSheet); |
|
|
|
|
|
} |
|
|
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|
|
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); |
|
|
excelWriter.write(list, writeSheet); |
|
|
|
|
|
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); |
|
|
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); |
|
|
} catch (EpmetException e) { |
|
|
} catch (EpmetException e) { |
|
|
response.reset(); |
|
|
response.reset(); |
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|
|
response.setHeader("content-type", "application/json; charset=UTF-8"); |
|
|
PrintWriter printWriter = response.getWriter(); |
|
|
PrintWriter printWriter = response.getWriter(); |
|
|
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); |
|
|
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); |
|
|
printWriter.write(JSON.toJSONString(result)); |
|
|
printWriter.write(JSON.toJSONString(result)); |
|
|
printWriter.close(); |
|
|
printWriter.close(); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
@ -111,7 +142,7 @@ public class ScreenPyHistoryScoreController { |
|
|
excelWriter.finish(); |
|
|
excelWriter.finish(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}*/ |
|
|
} |
|
|
|
|
|
|
|
|
@RequestMapping("computescore") |
|
|
@RequestMapping("computescore") |
|
|
public Result<HistoryScoreComputeResultDTO> computeScore(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreComputeFormDTO formDTO) { |
|
|
public Result<HistoryScoreComputeResultDTO> computeScore(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreComputeFormDTO formDTO) { |
|
|