package com.fgkj.actions; import java.util.ArrayList; import java.util.List; import com.fgkj.dao.BattTestData; import com.fgkj.dao.impl.BattDischarge_planImpl; import com.fgkj.dto.BattDischarge_plan; import com.fgkj.dto.BattInf; import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.ServiceModel; import com.fgkj.dto.User_inf; import com.fgkj.services.BattDischarge_planService; import com.google.gson.reflect.TypeToken; public class BattDischarge_planAction extends ActionUtil{ private BattDischarge_planService service = new BattDischarge_planService(); private String json; private String result; public String add(){ BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class); ServiceModel model =service.add(plan); result = tojson(model); return SUCCESS; } //8.1批量添加电池计划 public String addPro(){ List plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken>(){}.getType()); ServiceModel model = service.addPro(plans); result = tojson(model); return SUCCESS; } public String update(){ BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class); ServiceModel model = service.updatePro(plan);///--------- result = tojson(model); return SUCCESS; } //8.1批量修改放电计划的开始时间 public String updatePro(){ List plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken>(){}.getType()); ServiceModel model = service.updatePro(plans);///--------- result = tojson(model); return SUCCESS; } public String del(){ BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class); ServiceModel model = service.del(plan); result = tojson(model); return SUCCESS; } public String searchAll(){ ServiceModel model = service.searchAll(); result = tojson(model); return SUCCESS; } //8.1放电计划查询 public String serchByCondition(){ 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); result = tojson(model); return SUCCESS; } /*//8.1放电计划管理中查询 public String serchBattgroupinfo(){ BattInf binf = ActionUtil.getGson("yyyy-MM-dd").fromJson(json, BattInf.class); ServiceModel model = service.serchBattgroupinfo(binf); result = tojson(model); return SUCCESS; }*/ //8.1放电计划管理中进页面查询 public String serchBattgroupinfo(){ User_inf uinf=(User_inf) getUser(); ServiceModel model = service.serchBattgroupinfo(uinf); result = tojson(model); return SUCCESS; } //8.1查询未开始放电的放电计划总数 public String searchNums() { User_inf uinf=(User_inf) ActionUtil.getUser(); ServiceModel model = service.searchNums(uinf); result = tojson(model); return SUCCESS; } //8.1放电计划管理中饼状图(放电计划统计查询) /*BattIndexInFbs:未放电 *Preset_time:放电延时 *Preset_cap: 放电完成 *Preset_monvol:放电进行中 *Preset_groupvol:放电失败 *num: 总数*/ public String searchState(){ User_inf uinf=(User_inf) getUser(); ServiceModel model = service.searchState(uinf); result = tojson(model); return SUCCESS; } //8.1批量添加作业计划/修改作业计划时时先检测计划的可行性 /*原则: *1.同机房(或设备)同一时间只能一组电池组放电 *2.同机房(或设备)内电池组放电时间相隔至少3天*/ public String judgePlan(){ List listAll= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken>(){}.getType()); ServiceModel model = service.judgePlan(listAll); result = tojson(model); return SUCCESS; } public String getResult() { return result; } public void setJson(String json) { this.json = json; } }