1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- package com.hb.proj.data.controller;
- import java.util.Date;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import com.hb.proj.data.service.LiquidService;
- import com.hb.proj.model.LiquidPO;
- import com.hb.proj.model.LiquidVO;
- import com.hb.proj.utils.RespVO;
- import com.hb.proj.utils.RespVOBuilder;
- import com.hb.xframework.dao.util.PageModel;
- import com.hb.xframework.util.DateUtil;
- import jakarta.validation.constraints.NotBlank;
- @RestController
- @RequestMapping("/liquid")
- @Validated
- public class LiquidController {
- @Autowired
- private LiquidService service;
-
-
- /**
- * 分页查询指定井的动液面数据
- * @param wellId
- * @param startTime
- * @param endTime
- * @param pageNum
- * @param pageSize
- * @return
- */
- @RequestMapping("/query")
- public RespVO<PageModel<LiquidVO>> query(@NotBlank(message="井号不能为空") String wellId,
- Date startTime,Date endTime,
- @RequestParam(value = "currentPage", defaultValue = "1") Integer pageNum,
- @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize) {
- String nowstr=DateUtil.format(new Date(), "yyyy-MM-dd");
- if(startTime==null) {
- startTime=DateUtil.parse(nowstr+" 00:00:00");
- }
- if(endTime==null) {
- endTime=DateUtil.parse(nowstr+" 23:59:59");
- }
- return RespVOBuilder.ok(service.query(wellId, startTime,endTime,pageNum, pageSize));
- }
-
- /**
- * 获得动液面单个记录明细数据
- * @param dataId
- * @return
- */
- @RequestMapping("/get")
- public RespVO<LiquidPO> get(@NotBlank(message="记录号不能为空") String dataId){
- return RespVOBuilder.ok(service.getDtl(dataId));
- }
-
-
- /**
- * 保存计算结果
- * @param liquid
- * @return
- */
- @RequestMapping("/save")
- public RespVO<Object> save(@Validated LiquidPO liquid){
- service.saveCalculate(liquid);
- return RespVOBuilder.ok();
- }
-
- /**
- * 逻辑删除单个记录
- * @param liquid
- * @return
- */
- @RequestMapping("/delete")
- public RespVO<Object> delete(@NotBlank(message="记录号不能为空") String dataId){
- service.delete(dataId);
- return RespVOBuilder.ok();
- }
- }
|