| | |
| | | import com.fgkj.mapper.BattTestData; |
| | | import com.fgkj.mapper.impl.BattDischarge_planMapper; |
| | | import com.fgkj.mapper.impl.BattInfMapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | /*原则: |
| | | *1.同机房(或设备)同一时间只能一组电池组放电 |
| | | *2.同机房(或设备)内电池组放电时间相隔至少3天*/ |
| | | public ServiceModel judgePlan(Object obj){ |
| | | List<BattDischarge_plan> listAll=(List<BattDischarge_plan>) obj; |
| | | public ServiceModelOnce judgePlan(List<BattDischarge_plan> listAll){ |
| | | ServiceModelOnce model = new ServiceModelOnce(); |
| | | List<BattDischarge_plan> list = new ArrayList();//存放满足计划设定条件的可行计划 |
| | | if(listAll!=null&&listAll.size()>0){ |
| | | for(int i=0;i<listAll.size();i++){ |
| | | int flag=mapper.judgePlan(listAll.get(i)); |
| | | int flag=1; |
| | | List<String> strings = mapper.judgePlan(listAll.get(i)); |
| | | if (strings!=null&&strings.size()>0){ |
| | | flag=0; |
| | | }; |
| | | if(flag==1){//判断通过是否数据库存在同机房放电计划,满足条件 |
| | | if(list.size()>0){ |
| | | int judge=judgeList(listAll.get(i), list); |
| | |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | //TODO perry |
| | | // model.setSum(list.size());//可以添加的总数 |
| | | model.setSum(list.size());//可以添加的总数 |
| | | }else{ |
| | | model.setCode(0); |
| | | //TODO perry |
| | | // model.setSum(0); |
| | | model.setSum(0); |
| | | } |
| | | //System.out.println(model); |
| | | return model; |
| | |
| | | } |
| | | |
| | | //8.1放电计划查询 |
| | | public ServiceModel serchByCondition(Object obj){ |
| | | List list=mapper.serchByCondition(obj); |
| | | if(list!=null&&list.size()>0){ |
| | | public ServiceModel serchByCondition(Batt_Maint_Dealarm bmd) { |
| | | ServiceModel model = new ServiceModel(); |
| | | PageBean pageBean = bmd.getPageBean(); |
| | | PageHelper.startPage(pageBean.getPageNum(),pageBean.getPageSize(),true); |
| | | List<Batt_Maint_Dealarm> list = mapper.serchByCondition(bmd); |
| | | if (list != null && list.size() > 0) { |
| | | PageInfo<Batt_Maint_Dealarm> pageInfo = new PageInfo<>(list); |
| | | model.setCode(1); |
| | | model.setMsg("查询成功!"); |
| | | model.setData(list); |
| | | }else{ |
| | | model.setData(pageInfo); |
| | | } else { |
| | | model.setCode(0); |
| | | model.setMsg("查询失败!"); |
| | | } |
| | | return model; |
| | | } |
| | | //8.1放电计划管理中查询 |
| | | public ServiceModel serchBattgroupinfo(Object obj){ |
| | | public ServiceModel serchBattgroupinfo(User_inf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List<BattInf> list=battInfMapper.serchBattgroupinfo(obj); |
| | | if(list!=null&&list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | return model; |
| | | } |
| | | //新版添加放电计划查询<排除设置过放电计划的电池组> |
| | | public ServiceModel serchBattPlan(Object obj){ |
| | | public ServiceModel serchBattPlan(BattInf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=battInfMapper.serchBattPlan(obj); |
| | | if(list!=null&&list.size()>0){ |
| | | model.setCode(1); |
| | |
| | | return model; |
| | | } |
| | | //8.1查询未开始放电的放电计划总数 |
| | | public ServiceModel searchNums(Object obj) { |
| | | int nums= mapper.searchNums(obj); |
| | | //TODO perry |
| | | // model.setSum(nums); |
| | | public ServiceModelOnce searchNums(User_inf obj) { |
| | | ServiceModelOnce model = new ServiceModelOnce(); |
| | | int nums = mapper.searchNums(obj); |
| | | model.setSum(nums); |
| | | return model; |
| | | } |
| | | //8.1放电计划管理中饼状图(放电计划统计查询) |
| | |
| | | *Preset_monvol:放电进行中 |
| | | *Preset_groupvol:放电失败 |
| | | *num: 总数*/ |
| | | public ServiceModel searchState(Object obj){ |
| | | public ServiceModelOnce searchState(User_inf obj){ |
| | | ServiceModelOnce model = new ServiceModelOnce(); |
| | | List<BattDischarge_plan> list=mapper.searchState(obj); |
| | | BattDischarge_plan bplan=new BattDischarge_plan();//存放返回各种放电计划状态对应的值 |
| | | bplan.setBattIndexInFbs(0); |
| | |
| | | model.setData(bplan); |
| | | model.setMsg("查询成功!"); |
| | | //TODO perry |
| | | // model.setSum(sum);//总数 |
| | | model.setSum(sum);//总数 |
| | | }else{ |
| | | model.setCode(0); |
| | | model.setMsg("查询失败!"); |
| | |
| | | return model; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | /* public static void main(String[] args) { |
| | | BattDischarge_planService service = new BattDischarge_planService(); |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setuId(1038); |
| | | service.serchBattgroupinfo(uinf); |
| | | } |
| | | }*/ |
| | | } |