| | |
| | | package com.fgkj.controller; |
| | | |
| | | import com.fgkj.util.*; |
| | | |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.Batt_electricity; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_log; |
| | | import com.fgkj.mapper.UinfDaoFactory; |
| | | import com.fgkj.services.Batt_electricityService; |
| | | import com.fgkj.services.User_logService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("battElectricity") |
| | | @RestController |
| | | @Api |
| | | @Api(tags = "battElectricity接口") |
| | | public class Batt_electricityController{ |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private Batt_electricityService service; |
| | | @Resource |
| | | private User_logService uservice; |
| | | |
| | | @PostMapping("/") |
| | | @ApiOperation(notes = "{ \"dev_id\": 12112, \"dev_name\": \"91000012\", \"dev_recordtime\": \"2020-12-28 08:18:11\", \"dev_electricity_CM\": 0.0, \"dev_electricity_CT\": 0.0, \"dev_electricity_CU\": 0.0, \"note\": \"test\" }",value="新增") |
| | | public ServiceModel add(@RequestBody Batt_electricity be){ |
| | | // Batt_electricity be = getGson().fromJson(json, Batt_electricity.class); |
| | | ServiceModel model = service.add(be); |
| | | |
| | | if (model.getCode().equals(1)){ |
| | | String msg="添加对"+be.getDev_name()+"设备的记录"; |
| | | User_log ulog= UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg); |
| | | uservice.add(ulog);//将用户的操作记录下来 |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | @PutMapping("/") |
| | | @ApiOperation(notes = "{ \"num\": 39284, \"dev_id\": 0, \"dev_name\": \"\", \"dev_recordtime\": \"2020-12-29 08:21:43\", \"dev_electricity_CM\": 0.0, \"dev_electricity_CT\": 0.0, \"dev_electricity_CU\": 0.0, \"note\": \"uu\" }",value="修改") |
| | | public ServiceModel update(@RequestBody Batt_electricity be){ |
| | | // Batt_electricity be = getGson().fromJson(json, Batt_electricity.class); |
| | | ServiceModel model = service.update(be); |
| | |
| | | return model; |
| | | } |
| | | @DeleteMapping("/") |
| | | public ServiceModel del(@RequestBody Batt_electricity be){ |
| | | // Batt_electricity be = getGson().fromJson(json, Batt_electricity.class); |
| | | @ApiOperation(notes = "",value="删除") |
| | | public ServiceModel del(@RequestParam Integer num) { |
| | | Batt_electricity be = new Batt_electricity(); |
| | | be.setNum(num); |
| | | ServiceModel model = service.del(be); |
| | | |
| | | return model; |
| | | } |
| | | @GetMapping("all") |
| | | @ApiOperation(notes = "",value="all") |
| | | public ServiceModel searchAll(){ |
| | | ServiceModel model = service.searchAll(); |
| | | |
| | |
| | | * 记录时间放在battinf的battproducer |
| | | * 统计方式放在battinf 的signalname 中 1 - 月 2-季度 3-年份 |
| | | * */ |
| | | @GetMapping("byCondition") |
| | | public List serchByCondition(@RequestBody BattInf binf){ |
| | | // BattInf binf = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | @PostMapping("byCondition") |
| | | @ApiOperation(notes = "根据设备id连battinf和batt_devdischarge表 ",value="查询电度") |
| | | public List serchByCondition(@ApiParam(value = "设备id 42010007" ,required = true)@RequestParam String stationId, @ApiParam(value = "生产日期 格式2016/12/29 08:21:43" ,required = true)@RequestParam Date battProductDate,@ApiParam(value = "生产日期" ,required = true)@RequestParam Date battProductDate1){ |
| | | BattInf binf = new BattInf(); |
| | | binf.setStationId(stationId); |
| | | binf.setBattProductDate(battProductDate); |
| | | binf.setBattProductDate1(battProductDate1); |
| | | List list = service.serchByCondition(binf); |
| | | //System.out.println(result); |
| | | return list; |
| | | } |
| | | |
| | | //9.1机房主控中用电量的统计的折线图 |
| | | @GetMapping("byInfo") |
| | | public ServiceModel serchByInfo(@RequestBody BattInf binf){ |
| | | // BattInf binf = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | @PostMapping("byInfo") |
| | | @ApiOperation(notes = "",value="机房主控中用电量的统计的折线图") |
| | | public ServiceModel serchByInfo(@ApiParam(value = "设备id 42010007" ,required = true)@RequestParam String stationId, @ApiParam(value = "生产日期 格式2016/12/29 08:21:43" ,required = true)@RequestParam Date battProductDate,@ApiParam(value = "生产日期" ,required = true)@RequestParam Date battProductDate1){ |
| | | BattInf binf = new BattInf(); |
| | | binf.setStationId(stationId); |
| | | binf.setBattProductDate(battProductDate); |
| | | binf.setBattProductDate1(battProductDate1); |
| | | //System.out.println(binf); |
| | | ServiceModel model = service.serchByInfo(binf); |
| | | |