diff --git a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java index affb187..89d15d3 100644 --- a/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java +++ b/src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/parklotmanage/ParkLotManageController.java @@ -1,35 +1,53 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.parklotmanage; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.StringUtil; +import org.apache.poi.xssf.usermodel.XSSFSheet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.alibaba.dubbo.common.utils.CollectionUtils; +import com.alibaba.fastjson.JSONObject; import com.clouds.common.cache.park.ParkingLotCacheUtil; import com.clouds.common.entity.UserInfo; import com.clouds.common.utils.ResultUtils; +import com.clouds.common.utils.excle.ExcelUtil; +import com.clouds.common.utils.excle.ExcleFillDateManager; +import com.clouds.common.utils.excle.Layouter; +import com.clouds.common.web.BizController; import com.clouds.common.web.SessionCommUtil; import com.clouds.common.web.vo.BizResultVO; +import com.clouds.common.web.vo.EasyUIDataGridVO; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.zteits.clouds.api.apibase.bean.BizResult; +import com.zteits.clouds.api.apibase.bean.PageBean; import com.zteits.clouds.api.apibase.constants.ErrorType; import com.zteits.clouds.api.apibase.exception.BizException; import com.zteits.clouds.api.dto.park.dto.ParkingLotDTO; +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoDeleteRequest; +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoSaveRequest; +import com.zteits.clouds.api.dto.park.param.ParkingLotInfoUpdateRequest; import com.zteits.clouds.api.dto.park.param.QueryParkLotInfoByPkNoRequest; -import com.zteits.clouds.api.dto.pay.param.TdCompanyParkQueryRequest; +import com.zteits.clouds.api.dto.park.param.QueryParkingLotByParkRequest; import com.zteits.clouds.api.service.park.ParkingLotQueryService; +import com.zteits.clouds.api.service.park.ParkingLotService; import com.zteits.clouds.api.service.pay.TdCustCompanyService; import io.swagger.annotations.Api; @@ -53,7 +71,7 @@ import io.swagger.annotations.ApiOperation; @Api(value="停车场管理",description="停车场管理") @RestController @RequestMapping("parkLotManage") -public class ParkLotManageController{ +public class ParkLotManageController extends BizController{ private Logger logger = LoggerFactory.getLogger(ParkLotManageController.class); @Autowired private HttpSession session; @@ -63,6 +81,8 @@ public class ParkLotManageController{ private TdCustCompanyService tdCustCompanyService; @Autowired private ParkingLotQueryService parkingLotQueryService; + @Autowired + private ParkingLotService parkingLotService; /** * 根据登录人权限获取停车场名称列表 * @return @@ -111,4 +131,113 @@ public class ParkLotManageController{ } return plNos; } + /** + * xiejp 2017-08-30 + * @param request + * @return + * @throws Exception + */ + @ApiOperation("分页查询停车场列表") + @PostMapping("/queryParkingLotPageByPark") + public BizResultVO> queryParkingLotByPark(@RequestBody QueryParkingLotByParkRequest request) throws Exception { + logger.info("调用分页获取停车场列表dubbo服务入参:request={}"+JSONObject.toJSONString(request)); + if (request == null) { + throw new BizException(ErrorType.PARAMM_NULL, "请求对象"); + } + BizResult> bizResult = parkingLotQueryService.queryParkingLotByPark(request,request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize()); + return returnJqGridData(bizResult, ParkingLotDTO.class); + } + /** + * 添加停车场信息 + * @param request + * @return + */ + @ApiOperation("添加停车场信息") + @PostMapping("/saveParkingLotInfo") + public BizResultVO SaveParkingLotInfo(@RequestBody ParkingLotInfoSaveRequest request){ + logger.info("调用添加停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); + BizResult bizResult = parkingLotService.SaveParkingLotInfo(request); + return new BizResultVO(bizResult); + } + /** + * 修改停车场信息 + * @param request + * @return + */ + @ApiOperation("修改停车场信息") + @PostMapping("/updateParkingLotInfo") + public BizResultVO UpdateParkingLotInfo(@RequestBody ParkingLotInfoUpdateRequest request){ + logger.info("调用修改停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); + BizResult bizResult = parkingLotService.UpdateParkingLotInfo(request); + return new BizResultVO(bizResult); + } + /** + * 根据停车场编号查询停车场信息 + * @param request + * @return + */ + @ApiOperation("根据停车场编号查询停车场信息") + @PostMapping("/queryParkingLotByPkNo") + public BizResultVO QueryParkingLotByPkNo(@RequestBody QueryParkLotInfoByPkNoRequest request){ + logger.info("调用根据停车场编号查询停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); + BizResult bizResult = parkingLotQueryService.QueryParkingLotByPkNo(request); + return new BizResultVO(bizResult); + } + /** + * 删除停车场信息 + * @param request + * @return + */ + @ApiOperation("删除停车场信息") + @PostMapping("/deleteParkingLotInfoByPlIds") + public BizResultVO DeleteParkingLotInfoByPlIds(@RequestBody ParkingLotInfoDeleteRequest request){ + logger.info("调用删除停车场信息dubbo服务入参:request={}"+JSONObject.toJSONString(request)); + BizResult bizResult = parkingLotService.DeleteParkingLotInfoByPlIds(request); + return new BizResultVO(bizResult); + } + /** + * 导出 + * @param request + * @param response + * @throws Exception + */ + @ApiOperation("导出停车场信息") + @RequestMapping("/parkingToExcleForPage") + public void parkingToExcleForPage(@RequestParam List plNos,@RequestParam List plAreaBlockIds,@RequestParam Integer plType + ,HttpServletRequest request,HttpServletResponse response) throws Exception{ + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + QueryParkingLotByParkRequest queryParking = new QueryParkingLotByParkRequest(); + queryParking.setSysCode("1001"); + queryParking.getBaseRequest().setPageSize(0); + queryParking.setPlNos(plNos); + queryParking.setPlAreaBlockIds(plAreaBlockIds); + queryParking.setPlType(plType); + BizResult> bizResult = parkingLotQueryService.queryParkingLotByPark(queryParking,0,0); + + String[] title = new String[]{"停车场编号","停车场名称"}; + String sheetName="停车场"; + String fileName = "停车场信息"; + // 1.创建excel信息 + XSSFSheet workSheet = ExcelUtil.createExcel(sheetName); + // 2.设置excel表头和表体 + Layouter.buildReport(workSheet,title,0, 0); + //3.填充数据 + List contentList=new ArrayList(); + List list = bizResult.getData().getDataList(); + if(!CollectionUtils.isEmpty(list)){ + for (ParkingLotDTO e: list) { + Object[] obj=new Object[title.length]; + int index=0; + obj[index++]=e.getPlNo(); + obj[index++]=e.getPlName(); + + contentList.add(obj); + } + } + ExcleFillDateManager fillUserManager=new ExcleFillDateManager(); + fillUserManager.fillSalesOrga(workSheet,title,contentList,2); + // 4.excel输出配置 + ExcelUtil.write(response, workSheet, fileName); + } + }