whycrzg
2021-02-03 f3e160c4c6690232da3258adb42c1f702cd8bb07
update battInf#
4个文件已修改
142 ■■■■■ 已修改文件
src/main/java/com/fgkj/controller/BattInfController.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattInfServices.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/BattInfController.java
@@ -420,47 +420,70 @@
        return service.serchAllStation(u);
    }
    //搜索机房或电池组
    @GetMapping("stationOrBattGroup")
    @ApiOperation(notes = "",value="搜索机房或电池组")
    public ServiceModel serchStationOrBattgroup(@RequestBody BattInf binf){
        // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
    //搜索机房或电池组
    @PostMapping("stationOrBattGroup")
    @ApiOperation(notes = "num:1 机房;0电池组 两种状态 stationName9 模糊查询条件", value = "搜索机房或电池组")
    public ServiceModel serchStationOrBattgroup(@ApiParam(value = "1 机房;0 电池组",required = true) @RequestParam Integer num,@RequestParam String stationName9) {
        BattInf binf = new BattInf();
        binf.setNum(num);
        binf.setStationName9(stationName9);
        return service.serchStationOrBattgroup(binf);
    }
    //根据机房id查询机房下的电池组信息
    @GetMapping("battByStationId")
    @PostMapping("battByStationId")
    @ApiOperation(notes = "",value="机房id查询机房下的电池组信息")
    public ServiceModel serchBattByStation(@RequestBody BattInf binf){
        // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
        // result = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").toJson(model);
    public ServiceModel serchBattByStation(@RequestParam String stationId){
        ServiceModel model = new ServiceModel();
        BattInf binf = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        binf.setStationId(stationId);
        return service.serchBattByStation(binf);
    }
    
    //查询所有的电池组数
    @GetMapping("battCount")
    @ApiOperation(notes = "",value="查询所有的电池组数")
    public ServiceModel serchAllBatt(){
    public ServiceModelOnce serchAllBatt(){
        User_inf u = (User_inf)ActionUtil.getUser();
        return service.serchAllBatt(u);
    }
    //查站点下的所有设备名称
    @GetMapping("devNameByStationName3")
    @ApiOperation(notes = "",value="查站点下的所有设备名称")
    public ServiceModel searchDevByStationName3(@RequestBody BattInf binf){
        // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
    //查站点下的所有设备名称
    @PostMapping("devNameByStationName3")
    @ApiOperation(notes = "模糊查询", value = "查站点下的所有设备名称")
    public ServiceModel searchDevByStationName3(@ApiParam(value = "省", required = true) @RequestParam String stationName1, @ApiParam(value = "市", required = true) @RequestParam String stationName2,
                                                @ApiParam(value = "机房", required = true) @RequestParam String stationName3, @ApiParam(value = "区", required = true) @RequestParam String stationName5) {
        BattInf binf = new BattInf();
        binf.setStationName1(stationName1);
        binf.setStationName2(stationName2);
        binf.setStationName3(stationName3);
        binf.setStationName5(stationName5);
        return service.searchDevByStationName3(binf);
    }
    
    //首页上根据stationid查询电池组的机历卡
    @GetMapping("battAllInfoByStationId")
    @PostMapping("battAllInfoByStationId")
    @ApiOperation(notes = "",value="首页上根据stationid查询电池组的机历卡")
    public ServiceModel serchBattAllInfoByStationId(@RequestBody BattInf binf){
        // BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
    public ServiceModel serchBattAllInfoByStationId(@RequestParam String stationId){
        ServiceModel model = new ServiceModel();
        BattInf binf = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        binf.setStationId(stationId);
        return service.serchBattAllInfoByStationId(binf);
    }
    //跨域访问获取所有电池组的信息<-------跨域----------->
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java
@@ -937,13 +937,24 @@
    public List<BattInf> serchAllStation(User_inf obj);
    //根据机房id查询机房下的电池组信息
    public List serchBattByStation(Object obj);
    @Select("select DISTINCT StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice,Load_curr,DisCurrMax " +
            "from db_battinf.tb_battinf  where stationid=#{stationId} " +
            "ORDER BY StationName1,battgroupId ")
    public List<BattInf> serchBattByStation(BattInf obj);
    //搜索机房或电池组
    public List serchStationOrBattgroup(Object obj);
    public List<BattInf> serchStationOrBattgroup(BattInf obj);
    //查询所有的电池组数
    public int serchAllBatt(Object obj);
    @Select("select count(distinct battgroupid) as nums from db_battinf.tb_battinf " +
            " where battgroupid in(" +
            " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.battgroupid from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  and db_user.tb_user_battgroup_baojigroup_usr.uId=#{uId}" +
            " ) " +
            " and stationid in(" +
            " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.stationid from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  and db_user.tb_user_battgroup_baojigroup_usr.uId=#{uId}" +
            " ) " +
            " limit 1")
    public int serchAllBatt(User_inf obj);
    
    //添加电池组时查询出最大的机房id和电池组id
    @Select("select max(StationId) as id from db_battinf.tb_battinf  limit 1")
@@ -955,15 +966,19 @@
    //查询出当前存在内存中最大的电池组id(很重要**********)
    @Select(" select max(battgroupId) as id from db_battinf.tb_battinf limit 1")
    public int searchMaxBattgroupId_zj();
    //查站点下的所有设备名称
    public List searchDevByStationName3(Object obj);
    @Select(" select distinct(stationName4) from db_battinf.tb_battinf " +
            "where stationname1 like '%${stationName1}%' and stationname2 like '%${stationName2}%' " +
            "and stationname5 like '%${stationName5}%' and stationname3 like '%${stationName3}%' ")
    public List<String> searchDevByStationName3(BattInf obj);
    
    //根据维护区和机房名称查询电池组信息(电池组信息配置)<-------跨域->
    public List searchInform_ky();
    //首页上根据stationid查询电池组的机历卡
    public List serchBattAllInfoByStationId(Object obj);
    @Select("select * from db_battinf.tb_battinf  where db_battinf.tb_battinf.stationId=#{stationId} order by db_battinf.tb_battinf.battgroupid")
    public List<BattInf> serchBattAllInfoByStationId(BattInf obj);
    //-查询电池组信息<大屏显示>
    public List serchBatt_DP(Object obj);
src/main/java/com/fgkj/services/BattInfServices.java
@@ -1171,7 +1171,8 @@
        return model;
    }
    //搜索机房或电池组
    public ServiceModel serchStationOrBattgroup(Object obj){
    public ServiceModel serchStationOrBattgroup(BattInf obj){
        ServiceModel model = new ServiceModel();
        List list=mapper.serchStationOrBattgroup(obj);
        if (list != null && list.size() > 0) {
            model.setCode(1);
@@ -1179,14 +1180,14 @@
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setData(list);
            model.setMsg("查询失败!");
        }
        //System.out.println(list.size());
        return model;
    }
    //根据机房id查询机房下的电池组信息
    public ServiceModel serchBattByStation(Object obj){
    public ServiceModel serchBattByStation(BattInf obj){
        ServiceModel model = new ServiceModel();
        List list=mapper.serchBattByStation(obj);
        if (list != null && list.size() > 0) {
            model.setCode(1);
@@ -1194,18 +1195,17 @@
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setData(list);
            model.setMsg("查询失败!");
        }
        //System.out.println(model);
        return model;
    }
    //查询所有的电池组数
    public ServiceModel serchAllBatt(Object obj){
        int nums=mapper.serchAllBatt(obj);
    public ServiceModelOnce serchAllBatt(User_inf obj) {
        ServiceModelOnce model = new ServiceModelOnce();
        int nums = mapper.serchAllBatt(obj);
        model.setCode(1);
        //TODO perry
        // model.setSum(nums);
        model.setSum(nums);
        model.setMsg("查询成功!");
        //System.out.println(model);
        return model;
@@ -1263,8 +1263,9 @@
        return model;
    }
    //查站点下的所有设备名称
    public ServiceModel searchDevByStationName3(Object obj) {
        List<BattInf> list=mapper.searchDevByStationName3(obj);
    public ServiceModel searchDevByStationName3(BattInf obj) {
        ServiceModel model = new ServiceModel();
        List list=mapper.searchDevByStationName3(obj);
        if (list != null && list.size() > 0) {
            model.setCode(1);
            model.setData(list);
@@ -1278,9 +1279,15 @@
    }
    
    //首页上根据stationid查询电池组的机历卡
    public ServiceModel serchBattAllInfoByStationId(Object obj){
        List list=mapper.serchBattAllInfoByStationId(obj);
    public ServiceModel serchBattAllInfoByStationId(BattInf obj){
        ServiceModel model = new ServiceModel();
        List<BattInf> list=mapper.serchBattAllInfoByStationId(obj);
        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                BattInf battInf = list.get(i);
                int BattGuarantDayCount = battInf.getBattGuarantDayCount() - ActionUtil.daysBetween(battInf.getBattInUseDate(), new Date());//剩余保修天数
                list.get(i).setBattGuarantDayCount(BattGuarantDayCount);
            }
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
src/main/resources/mapper/BattInfMapper.xml
@@ -4709,15 +4709,26 @@
<!--    <select id="serchMonAll" resultType="java.lang.Integer"></select>-->
    <select id="searchStationId" resultType="java.util.List"></select>
<!--    <select id="serchAllStation" resultType="java.util.List"></select>-->
    <select id="serchBattByStation" resultType="java.util.List"></select>
    <select id="serchStationOrBattgroup" resultType="java.util.List"></select>
    <select id="serchAllBatt" resultType="java.lang.Integer"></select>
<!--    <select id="serchBattByStation" resultType="java.util.List"></select>-->
    <select id="serchStationOrBattgroup" resultType="BattInf">
        <if test="num==1">
            select DISTINCT stationid,StationName,StationName1 FROM db_battinf.tb_battinf where
            stationname like '%${stationName9}%'
        </if>
        <if test="num!=1">
            select DISTINCT stationid,battgroupid,battgroupname,StationName,StationName1 FROM db_battinf.tb_battinf
            where battgroupname like '%${stationName9}%'
        </if>
    </select>
<!--    <select id="serchAllBatt" resultType="java.lang.Integer"></select>-->
<!--    <select id="searchMaxId_zj" resultType="java.lang.Integer"></select>-->
    <select id="searchMaxdevId_binf_zj" resultType="java.lang.Integer"></select>
<!--    <select id="searchMaxBattgroupId_zj" resultType="java.lang.Integer"></select>-->
    <select id="searchDevByStationName3" resultType="java.util.List"></select>
<!--    <select id="searchDevByStationName3" resultType="java.util.List"></select>-->
    <select id="searchInform_ky" resultType="java.util.List"></select>
    <select id="serchBattAllInfoByStationId" resultType="java.util.List"></select>
<!--    <select id="serchBattAllInfoByStationId" resultType="java.util.List"></select>-->
    <select id="serchBatt_DP" resultType="java.util.List"></select>
    <select id="searchStationList" resultType="java.util.List"></select>
</mapper>