| | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | List<BaojigroupUsr> list=bjUsrmapper.selectList(wrapper); |
| | | return list.size()>0?1:0 ; |
| | | } |
| | | //标记包机组是否为班组 |
| | | public Response setBaojiTeam(Integer id, Integer teamFalg) { |
| | | UpdateWrapper wrapper=new UpdateWrapper(); |
| | | wrapper.eq("baoji_group_id",id); |
| | | wrapper.set("team_flag",teamFalg); |
| | | int bl=mapper.update(null,wrapper); |
| | | return new Response().set(1,bl>0,"修改包机组班组成功"); |
| | | //设置包机组标记 |
| | | public Response updateTeamFlag(Integer baoJiGroupId, Integer flag) { |
| | | if(flag==1) { |
| | | //查询要设置的包机组的站点 |
| | | QueryWrapper<BaojigroupPower> query = Wrappers.query(); |
| | | query.select("baoji_group_id", "station_id").eq("baoji_group_id", baoJiGroupId); |
| | | List<BaojigroupPower> stationIdList = bjPowermapper.selectList(query); |
| | | stationIdList = stationIdList.stream().distinct().collect(Collectors.toList()); |
| | | //查询其他的组,包含的所有站点 |
| | | List<BaojigroupPower> stationIdListWithDischargePlanFlag = bjPowermapper.getStationIdListWithDischargePlanFlag(); |
| | | stationIdListWithDischargePlanFlag = stationIdListWithDischargePlanFlag.stream().distinct().collect(Collectors.toList()); |
| | | List<BaojigroupPower> repeatedStationIdList = new LinkedList<>(); |
| | | for (int i = 0; i < stationIdList.size(); i++) { |
| | | BaojigroupPower baojiGroupBattGroup = stationIdList.get(i); |
| | | for (int j = 0; j < stationIdListWithDischargePlanFlag.size(); j++) { |
| | | BaojigroupPower baojiGroupBattGroupWithFlag = stationIdListWithDischargePlanFlag.get(j); |
| | | if (baojiGroupBattGroupWithFlag.getStationId().equals(baojiGroupBattGroup.getStationId())) { |
| | | repeatedStationIdList.add(baojiGroupBattGroupWithFlag); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | //查询重复站点的信息 |
| | | if (repeatedStationIdList.size() > 0) { |
| | | return new Response().setII(1, false, repeatedStationIdList, "设置失败"); |
| | | } |
| | | } |
| | | UpdateWrapper<Baojigroup> update = Wrappers.update(); |
| | | update.set("team_flag",flag).eq("baoji_group_id",baoJiGroupId); |
| | | mapper.update((Baojigroup) ActionUtil.objeNull,update); |
| | | return new Response().set(1,true,"设置完成"); |
| | | } |
| | | } |