package com.fgkj.controller;
|
|
import com.fgkj.util.*;
|
|
import com.fgkj.dto.*;
|
import com.fgkj.services.BattDischarge_planService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
import javax.annotation.Resource;
|
|
@RequestMapping("battDischargePlan")
|
@RestController
|
@Api(tags = "battDischargePlan接口")
|
public class BattDischarge_planController{
|
|
@Resource
|
private BattDischarge_planService service;
|
|
@PostMapping("/")
|
@ApiOperation(notes = "",value="新增")
|
public ServiceModel add(@RequestBody BattDischarge_plan plan){
|
// BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
|
ServiceModel model =service.add(plan);
|
|
return model;
|
}
|
|
//8.1批量添加电池计划
|
@PostMapping("/batch")
|
@ApiOperation(notes = "",value="批量添加电池计划")
|
public ServiceModel addPro(@RequestBody List<BattDischarge_plan> plans){
|
// List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
|
ServiceModel model = service.addPro(plans);
|
|
return model;
|
}
|
|
@PutMapping("/")
|
@ApiOperation(notes = "",value="修改")
|
public ServiceModel update(@RequestBody BattDischarge_plan plan){
|
// BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
|
ServiceModel model = service.update(plan);///---------
|
|
return model;
|
}
|
|
//8.1批量修改放电计划的开始时间
|
@PutMapping("/batch")
|
@ApiOperation(notes = "",value="批量修改放电计划的开始时间")
|
public ServiceModel updatePro(@RequestBody List<BattDischarge_plan> plans){
|
// List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
|
ServiceModel model = service.updatePro(plans);///---------
|
|
return model;
|
}
|
|
@DeleteMapping("/")
|
@ApiOperation(notes = "",value="删除")
|
public ServiceModel del(@RequestBody BattDischarge_plan plan){
|
// BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
|
ServiceModel model = service.del(plan);
|
|
return model;
|
}
|
|
@GetMapping("all")
|
@ApiOperation(notes = "",value="all")
|
public ServiceModel searchAll(){
|
ServiceModel model = service.searchAll();
|
|
return model;
|
}
|
|
//8.1放电计划查询
|
@GetMapping("byCondition")
|
@ApiOperation(notes = "",value="放电计划查询")
|
public ServiceModel serchByCondition(@RequestBody Batt_Maint_Dealarm bmd){
|
// Batt_Maint_Dealarm bmd = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_Maint_Dealarm.class);
|
User_inf uinf=(User_inf) ActionUtil.getUser();
|
bmd.setUinf(uinf);
|
ServiceModel model = service.serchByCondition(bmd);
|
|
return model;
|
}
|
/*//8.1放电计划管理中查询
|
public ServiceModel serchBattgroupinfo(){
|
BattInf binf = ActionUtil.getGson("yyyy-MM-dd").fromJson(json, BattInf.class);
|
ServiceModel model = service.serchBattgroupinfo(binf);
|
|
return model;
|
}*/
|
//8.1放电计划管理中进页面查询
|
@GetMapping("battGroupInfo")
|
@ApiOperation(notes = "",value="放电计划管理中进页面查询")
|
public ServiceModel serchBattgroupinfo(){
|
User_inf uinf=(User_inf) ActionUtil.getUser();
|
ServiceModel model = service.serchBattgroupinfo(uinf);
|
|
return model;
|
}
|
//新版添加放电计划查询<排除设置过放电计划的电池组>
|
@GetMapping("battPlan")
|
@ApiOperation(notes = "",value="新版添加放电计划查询<排除设置过放电计划的电池组>")
|
public ServiceModel serchBattPlan(@RequestBody BattInf binf){
|
// BattInf binf= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,BattInf.class);
|
User_inf uinf=(User_inf) ActionUtil.getUser();
|
binf.setNum(uinf.getuId());
|
ServiceModel model = service.serchBattPlan(binf);
|
|
return model;
|
}
|
//8.1查询未开始放电的放电计划总数
|
@GetMapping("nums")
|
@ApiOperation(notes = "",value="查询未开始放电的放电计划总数")
|
public ServiceModel searchNums() {
|
User_inf uinf=(User_inf) ActionUtil.getUser();
|
ServiceModel model = service.searchNums(uinf);
|
|
return model;
|
}
|
|
//8.1放电计划管理中饼状图(放电计划统计查询)
|
/*BattIndexInFbs:未放电
|
*Preset_time:放电延时
|
*Preset_cap: 放电完成
|
*Preset_monvol:放电进行中
|
*Preset_groupvol:放电失败
|
*num: 总数*/
|
@GetMapping("state")
|
@ApiOperation(notes = "",value="放电计划管理中饼状图(放电计划统计查询)")
|
public ServiceModel searchState(){
|
User_inf uinf=(User_inf) ActionUtil.getUser();
|
ServiceModel model = service.searchState(uinf);
|
|
return model;
|
}
|
|
//8.1批量添加作业计划/修改作业计划时时先检测计划的可行性
|
/*原则:
|
*1.同机房(或设备)同一时间只能一组电池组放电
|
*2.同机房(或设备)内电池组放电时间相隔至少3天*/
|
@GetMapping("/judgePlan")
|
@ApiOperation(notes = "原则:\n" +
|
"\t\t\t *1.同机房(或设备)同一时间只能一组电池组放电\n" +
|
"\t\t\t *2.同机房(或设备)内电池组放电时间相隔至少3天",value="批量添加作业计划/修改作业计划时时先检测计划的可行性")
|
public ServiceModel judgePlan(@RequestBody List<BattDischarge_plan> listAll){
|
// List<BattDischarge_plan> listAll= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
|
ServiceModel model = service.judgePlan(listAll);
|
|
return model;
|
|
}
|
|
}
|