This commit is contained in:
gaojiabao
2023-05-18 15:40:37 +08:00
parent f42ae9764c
commit c3df9d0345
@@ -6,8 +6,10 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result; import com.adc.da.http.Result;
import com.adc.da.slrs.sarStandIssueControlProduct.entity.SarStandIssueControlProduct; import com.adc.da.slrs.sarStandIssueControlProduct.entity.SarStandIssueControlProduct;
import com.adc.da.slrs.sarStandIssueControlProduct.entity.StandIssueControlProductExcelVO; import com.adc.da.slrs.sarStandIssueControlProduct.entity.StandIssueControlProductExcelVO;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO; import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExcelVO; import com.adc.da.slrs.sarStandWarning.entity.WarningExcelVO;
import com.adc.da.slrs.sarStandWarning.entity.WarningExportVO;
import com.adc.da.slrs.sarStandWarning.service.Impl.EarlyWarningEOServiceImpl; import com.adc.da.slrs.sarStandWarning.service.Impl.EarlyWarningEOServiceImpl;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
@@ -29,144 +31,144 @@ import java.util.*;
@RestController @RestController
@RequestMapping("/${restPath}/sys/EarlyWarning") @RequestMapping("/${restPath}/sys/EarlyWarning")
@Api(tags = "sarStandWarning") @Api(tags = "sarStandWarning")
public class EarlyWarningEOController { public class EarlyWarningEOController extends BaseController<EarlyWarningEO> {
@Resource @Resource
private EarlyWarningEOServiceImpl earlyWarningEOService; private EarlyWarningEOServiceImpl earlyWarningEOService;
// /** /**
// * *
// * @param newStandPage * @param newStandPage
// * @param newStandPageSize * @param newStandPageSize
// * @param oldStandPage * @param oldStandPage
// * @param oldStandPageSize * @param oldStandPageSize
// * @param newItemsPage * @param newItemsPage
// * @param newItemsPageSize * @param newItemsPageSize
// * @param oldItemsPage * @param oldItemsPage
// * @param oldItemsPageSize * @param oldItemsPageSize
// * @return * @return
// * @author zj * @author zj
// * date 2021-06-15 * date 2021-06-15
// **/ **/
// @GetMapping("/${restPath}/StandWarning") @GetMapping("/${restPath}/StandWarning")
// @ApiOperation("标准预警查询") @ApiOperation("标准预警查询")
// public ResponseMessage newPageInfo(@RequestParam(defaultValue = "1", value = "newStandPage")int newStandPage, @RequestParam(defaultValue = "10", value = "newStandPageSize") int newStandPageSize, public ResponseMessage newPageInfo(@RequestParam(defaultValue = "1", value = "newStandPage")int newStandPage, @RequestParam(defaultValue = "10", value = "newStandPageSize") int newStandPageSize,
// @RequestParam(defaultValue = "1", value = "oldStandPage")int oldStandPage, @RequestParam(defaultValue = "10", value = "oldStandPageSize") int oldStandPageSize, @RequestParam(defaultValue = "1", value = "oldStandPage")int oldStandPage, @RequestParam(defaultValue = "10", value = "oldStandPageSize") int oldStandPageSize,
// @RequestParam(defaultValue = "1", value = "newItemsPage")int newItemsPage, @RequestParam(defaultValue = "10", value = "newItemsPageSize") int newItemsPageSize, @RequestParam(defaultValue = "1", value = "newItemsPage")int newItemsPage, @RequestParam(defaultValue = "10", value = "newItemsPageSize") int newItemsPageSize,
// @RequestParam(defaultValue = "1", value = "oldItemsPage")int oldItemsPage, @RequestParam(defaultValue = "10", value = "oldItemsPageSize") int oldItemsPageSize,EarlyWarningEO earlyWarningEO) { @RequestParam(defaultValue = "1", value = "oldItemsPage")int oldItemsPage, @RequestParam(defaultValue = "10", value = "oldItemsPageSize") int oldItemsPageSize,EarlyWarningEO earlyWarningEO) {
// IPage<EarlyWarningEO> list1 = earlyWarningEOService.newStandQuery(newStandPage,newStandPageSize,earlyWarningEO);//新车标准预警 IPage<EarlyWarningEO> list1 = earlyWarningEOService.newStandQuery(newStandPage,newStandPageSize,earlyWarningEO);//新车标准预警
// IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldStandQuery(oldStandPage,oldStandPageSize,earlyWarningEO);//在产车标准预警 IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldStandQuery(oldStandPage,oldStandPageSize,earlyWarningEO);//在产车标准预警
// IPage<EarlyWarningEO> list3 = earlyWarningEOService.newItemsQuery(newItemsPage,newItemsPageSize,earlyWarningEO);//新车条款预警 IPage<EarlyWarningEO> list3 = earlyWarningEOService.newItemsQuery(newItemsPage,newItemsPageSize,earlyWarningEO);//新车条款预警
// IPage<EarlyWarningEO> list4 = earlyWarningEOService.oldItemsQuery(oldItemsPage,oldItemsPageSize,earlyWarningEO);//在产车条款预警 IPage<EarlyWarningEO> list4 = earlyWarningEOService.oldItemsQuery(oldItemsPage,oldItemsPageSize,earlyWarningEO);//在产车条款预警
// return getResponseMessage(list1, list2, list3, list4); return getResponseMessage(list1, list2, list3, list4);
// } }
//
// @GetMapping("/getStandWarning") @GetMapping("/getStandWarning")
// @ApiOperation("标准预警查询") @ApiOperation("标准预警查询")
// public ResponseMessage<IPage<StandWarningEO>> getStandWaring(StandWarningEO queryPageEO){ public ResponseMessage<IPage<StandWarningEO>> getStandWaring(StandWarningEO queryPageEO){
// IPage<StandWarningEO> standWarning = earlyWarningEOService.getStandWarning(queryPageEO); IPage<StandWarningEO> standWarning = earlyWarningEOService.getStandWarning(queryPageEO);
// standWarning.getRecords().forEach(item->{ standWarning.getRecords().forEach(item->{
//
// Optional.ofNullable(item.getSSRQ()) Optional.ofNullable(item.getSSRQ())
// .ifPresent(SSRQ -> item.setSSRQ(item.getSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", ""))); .ifPresent(SSRQ -> item.setSSRQ(item.getSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
// Optional.ofNullable(item.getXCXSSRQ()) Optional.ofNullable(item.getXCXSSRQ())
// .ifPresent(SSRQ ->item.setXCXSSRQ(item.getXCXSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", ""))); .ifPresent(SSRQ ->item.setXCXSSRQ(item.getXCXSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
// Optional.ofNullable(item.getZCCSSRQ()) Optional.ofNullable(item.getZCCSSRQ())
// .ifPresent(SSRQ ->item.setZCCSSRQ(item.getZCCSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", ""))); .ifPresent(SSRQ ->item.setZCCSSRQ(item.getZCCSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
//
// }); });
// return Result.success(standWarning); return Result.success(standWarning);
// } }
//
//
//
// private ResponseMessage getResponseMessage(IPage<EarlyWarningEO> list1, IPage<EarlyWarningEO> list2, IPage<EarlyWarningEO> list3, IPage<EarlyWarningEO> list4) { private ResponseMessage getResponseMessage(IPage<EarlyWarningEO> list1, IPage<EarlyWarningEO> list2, IPage<EarlyWarningEO> list3, IPage<EarlyWarningEO> list4) {
// List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>(); List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
// Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
// map.put("newStand", list1); map.put("newStand", list1);
// map.put("oldStand", list2); map.put("oldStand", list2);
// map.put("newItems", list3); map.put("newItems", list3);
// map.put("oldItems", list4); map.put("oldItems", list4);
// listMap .add(map); listMap .add(map);
// return Result.success("200",listMap); return Result.success("200",listMap);
// } }
// /** /**
// * *
// * @param id * @param id
// * @return * @return
// * @author zj * @author zj
// * date 2021-06-15 * date 2021-06-15
// **/ **/
// @GetMapping("/ChangePermissions") @GetMapping("/ChangePermissions")
// @ApiOperation("取消预警") @ApiOperation("取消预警")
// public ResponseMessage ChangePermissions(String id) { public ResponseMessage ChangePermissions(String id) {
// String power = earlyWarningEOService.ChangePermissions(id); String power = earlyWarningEOService.ChangePermissions(id);
// return Result.success("200",power); return Result.success("200",power);
// } }
// /** /**
// * *
// * @param newPolicyPage * @param newPolicyPage
// * @param newPolicyPageSize * @param newPolicyPageSize
// * @param oldPolicyPage * @param oldPolicyPage
// * @param oldPolicyPageSize * @param oldPolicyPageSize
// * @return * @return
// * @author zj * @author zj
// * date 2021-06-15 * date 2021-06-15
// **/ **/
// @GetMapping("/PolicyWarning") @GetMapping("/PolicyWarning")
// @ApiOperation("政策预警查询") @ApiOperation("政策预警查询")
// public ResponseMessage newPolicyPageInfo(@RequestParam(defaultValue = "1", value = "newPolicyPage")int newPolicyPage, @RequestParam(defaultValue = "10", value = "newPolicyPageSize") int newPolicyPageSize, public ResponseMessage newPolicyPageInfo(@RequestParam(defaultValue = "1", value = "newPolicyPage")int newPolicyPage, @RequestParam(defaultValue = "10", value = "newPolicyPageSize") int newPolicyPageSize,
// @RequestParam(defaultValue = "1", value = "oldPolicyPage")int oldPolicyPage, @RequestParam(defaultValue = "10", value = "oldPolicyPageSize") int oldPolicyPageSize) { @RequestParam(defaultValue = "1", value = "oldPolicyPage")int oldPolicyPage, @RequestParam(defaultValue = "10", value = "oldPolicyPageSize") int oldPolicyPageSize) {
// IPage<EarlyWarningEO> list1 = earlyWarningEOService.newPolicyQuery(newPolicyPage,newPolicyPageSize); IPage<EarlyWarningEO> list1 = earlyWarningEOService.newPolicyQuery(newPolicyPage,newPolicyPageSize);
// IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldPolicyQuery(oldPolicyPage,oldPolicyPageSize); IPage<EarlyWarningEO> list2 = earlyWarningEOService.oldPolicyQuery(oldPolicyPage,oldPolicyPageSize);
// List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>(); List<Map<String, Object>> listMap = new ArrayList<Map<String,Object>>();
// Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
// map.put("newPolicy", list1); map.put("newPolicy", list1);
// map.put("oldPolicy", list2); map.put("oldPolicy", list2);
// System.out.println(map); System.out.println(map);
// listMap .add(map); listMap .add(map);
// System.out.println(listMap); System.out.println(listMap);
// return Result.success("200",listMap); return Result.success("200",listMap);
// } }
// @GetMapping("/exportWarning") @GetMapping("/exportWarning")
// @ApiOperation("导出预警") @ApiOperation("导出预警")
// public void exportStandardsInfoExcel(WarningExcelVO excelVO, HttpServletResponse response) throws Exception { public void exportStandardsInfoExcel(WarningExcelVO excelVO, HttpServletResponse response) throws Exception {
//
//
// // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
// try { try {
// response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
// response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
// // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
// if(excelVO.getExportName()==null){ if(excelVO.getExportName()==null){
// excelVO.setExportName("标准预警"); excelVO.setExportName("标准预警");
// } }
// String fileName = URLEncoder.encode(excelVO.getExportName(), "UTF-8").replaceAll("\\+", "%20"); String fileName = URLEncoder.encode(excelVO.getExportName(), "UTF-8").replaceAll("\\+", "%20");
// response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
//
//// List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO); // List<StandWarningEO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
// List<WarningExportVO> exportExcel = earlyWarningEOService.getExportExcel(excelVO); List<WarningExportVO> exportExcel = earlyWarningEOService.getExportExcel(excelVO);
// for (WarningExportVO warningExportVO : exportExcel){ for (WarningExportVO warningExportVO : exportExcel){
// String condition = warningExportVO.getTermsConditions(); String condition = warningExportVO.getTermsConditions();
// if (condition != null && condition.length() > 32001){ if (condition != null && condition.length() > 32001){
// condition = condition.substring(0,32000); condition = condition.substring(0,32000);
// warningExportVO.setTermsConditions(condition); warningExportVO.setTermsConditions(condition);
// } }
// } }
//
// // 这里需要设置不关闭流 // 这里需要设置不关闭流
// EasyExcel.write(response.getOutputStream(), WarningExportVO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1") EasyExcel.write(response.getOutputStream(), WarningExportVO.class).autoCloseStream(Boolean.FALSE).sheet("sheet1")
// .doWrite(exportExcel); .doWrite(exportExcel);
// } catch (Exception e) { } catch (Exception e) {
// System.out.println(e); System.out.println(e);
// // 重置response // 重置response
// response.reset(); response.reset();
// response.setContentType("application/json"); response.setContentType("application/json");
// response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
// response.getWriter().println(JSON.toJSONString(Result.error())); response.getWriter().println(JSON.toJSONString(Result.error()));
// } }
// } }
} }