|
@@ -0,0 +1,142 @@
|
|
|
+package com.bz.smart_city.controller.pay;
|
|
|
+
|
|
|
+import com.bz.smart_city.commom.model.AjaxMessage;
|
|
|
+import com.bz.smart_city.commom.model.Pagination;
|
|
|
+import com.bz.smart_city.commom.model.ResultStatus;
|
|
|
+import com.bz.smart_city.dto.pay.PayControlRecordDto;
|
|
|
+import com.bz.smart_city.entity.pay.PayControlRecord;
|
|
|
+import com.bz.smart_city.service.pay.PayControlRecordService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.math.BigInteger;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by ZJY on 2021-01-18 9:09
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("PayControlRecord")
|
|
|
+@Api(tags = "计费系统-阀控记录")
|
|
|
+public class PayControlRecordController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PayControlRecordService payControlRecordService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/findList")
|
|
|
+ @ApiOperation(value="查询阀控记录,分页",notes=",分页")
|
|
|
+ public AjaxMessage<List<PayControlRecord>> findList(
|
|
|
+ @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) String accountId,
|
|
|
+ @ApiParam(value = "水表ID", required = false) @RequestParam(required = false) String meterId,
|
|
|
+ @ApiParam(value = "阀控规则", required = false) @RequestParam(required = false) String controlRuleId,
|
|
|
+ @ApiParam(value = "操作类型 0关阀 1开阀", required = false) @RequestParam(required = false) String type,
|
|
|
+ @ApiParam(value = "操作结果 0执行中 1成功 2失败", required = false) @RequestParam(required = false) String result,
|
|
|
+ @ApiParam(value = "阀门状态 0关阀 1开阀 2异常", required = false) @RequestParam(required = false) String state,
|
|
|
+ @ApiParam(value = "开始时间yyyyMMdd", required = false) @RequestParam(required = false) String beginTime,
|
|
|
+ @ApiParam(value = "结束时间yyyyMMdd", required = false) @RequestParam(required = false) String endTime
|
|
|
+ ){
|
|
|
+ try {
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
|
|
+ PayControlRecordDto payControlRecordDto = new PayControlRecordDto();
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(accountId)){
|
|
|
+ payControlRecordDto.setAccountId(new BigInteger(accountId));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(meterId)){
|
|
|
+ payControlRecordDto.setMeterId(new BigInteger(meterId));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(controlRuleId)){
|
|
|
+ payControlRecordDto.setControlRuleId(new Integer(controlRuleId));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(type)){
|
|
|
+ payControlRecordDto.setType(new Integer(type));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(result)){
|
|
|
+ payControlRecordDto.setResult(new Integer(result));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(state)){
|
|
|
+ payControlRecordDto.setResult(new Integer(state));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(beginTime)){
|
|
|
+ beginTime = beginTime +"000000";
|
|
|
+ payControlRecordDto.setBeginTime( LocalDateTime.parse(beginTime,df));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(endTime)){
|
|
|
+ endTime = endTime + "235959";
|
|
|
+ payControlRecordDto.setEndTime(LocalDateTime.parse(endTime, df));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PayControlRecord> payControlRecordList = payControlRecordService.findList(payControlRecordDto);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,payControlRecordList);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ return new AjaxMessage<>(-99,ex.getMessage(),null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/findPage")
|
|
|
+ @ApiOperation(value="查询阀控记录,分页",notes="查询阀控记录,分页")
|
|
|
+ public AjaxMessage<Pagination<PayControlRecord>> findPage(
|
|
|
+ @ApiParam(value = "用户ID", required = false) @RequestParam(required = false) String accountId,
|
|
|
+ @ApiParam(value = "水表ID", required = false) @RequestParam(required = false) String meterId,
|
|
|
+ @ApiParam(value = "阀控规则", required = false) @RequestParam(required = false) String controlRuleId,
|
|
|
+ @ApiParam(value = "操作类型 0关阀 1开阀", required = false) @RequestParam(required = false) String type,
|
|
|
+ @ApiParam(value = "操作结果 0执行中 1成功 2失败", required = false) @RequestParam(required = false) String result,
|
|
|
+ @ApiParam(value = "阀门状态 0关阀 1开阀 2异常", required = false) @RequestParam(required = false) String state,
|
|
|
+ @ApiParam(value = "开始时间yyyyMMdd", required = false) @RequestParam(required = false) String beginTime,
|
|
|
+ @ApiParam(value = "结束时间yyyyMMdd", required = false) @RequestParam(required = false) String endTime,
|
|
|
+ @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
|
|
|
+ @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") int pageSize
|
|
|
+ ){
|
|
|
+ try {
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
|
|
+ PayControlRecordDto payControlRecordDto = new PayControlRecordDto();
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(accountId)){
|
|
|
+ payControlRecordDto.setAccountId(new BigInteger(accountId));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(meterId)){
|
|
|
+ payControlRecordDto.setMeterId(new BigInteger(meterId));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(controlRuleId)){
|
|
|
+ payControlRecordDto.setControlRuleId(new Integer(controlRuleId));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(type)){
|
|
|
+ payControlRecordDto.setType(new Integer(type));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(result)){
|
|
|
+ payControlRecordDto.setResult(new Integer(result));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(state)){
|
|
|
+ payControlRecordDto.setResult(new Integer(state));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(beginTime)){
|
|
|
+ beginTime = beginTime +"000000";
|
|
|
+ payControlRecordDto.setBeginTime( LocalDateTime.parse(beginTime,df));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(endTime)){
|
|
|
+ endTime = endTime + "235959";
|
|
|
+ payControlRecordDto.setEndTime(LocalDateTime.parse(endTime, df));
|
|
|
+ }
|
|
|
+
|
|
|
+ Pagination<PayControlRecord> payControlRecordPagination = payControlRecordService.findPage(payControlRecordDto,pageNum,pageSize);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,payControlRecordPagination);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ return new AjaxMessage<>(-99,ex.getMessage(),null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|