2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-05-27 feac6e0c2db4e60d55417fde1971a0bc6d703566
fix
已修改7个文件
120 ■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/enums/OrderByEnums.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/PoleMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/ClientController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/GetListOnBindingController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/enums/OrderByEnums.java
@@ -44,11 +44,24 @@
    IP_VOLUME_MISSION_CREATE_TIME("create_time"),
    /**
     * 管理员列表
     */
    //创建时间
    CLIENT_CREATE_TIME("create_time"),
    /**
     * 音柱素材列表
     */
    //创建时间
    IP_VOLUME_FILE_CREATE_TIME("create_time"),
    /**
     * 灯杆列表
     */
    POLE_NAME("pole_name"),
    POLE_ID("id"),
    POLE_CREATE_TIME("create_time"),
dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java
@@ -15,7 +15,7 @@
    boolean updateDeviceCode(Long id);
    List<Pole> queryPoleOnLineStatesList(Long userid, Integer isTrue, Integer bingStates, Long groupid, String keyword);
    List<Pole> queryPoleOnLineStatesList(Long userid, Integer isTrue, Integer bingStates, Long groupid, String keyword, String orderBy);
}
dao/src/main/resources/mapper/PoleMapper.xml
@@ -70,5 +70,8 @@
            </if>
        </where>
        GROUP BY t1.id
        <if test="orderBy != null">
            ORDER BY  ${orderBy}
        </if>
    </select>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/ClientController.java
@@ -32,6 +32,7 @@
import com.sandu.ximon.dao.domain.ClientRoleRelation;
import com.sandu.ximon.dao.enums.AdministratorEnums;
import com.sandu.ximon.dao.enums.MenuEnum;
import com.sandu.ximon.dao.enums.OrderByEnums;
import eu.bitwalker.useragentutils.Browser;
import eu.bitwalker.useragentutils.OperatingSystem;
import eu.bitwalker.useragentutils.UserAgent;
@@ -135,12 +136,15 @@
    }
    @GetMapping("/list")
    public ResponseVO<Object> listLikeClient(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
    public ResponseVO<Object> listLikeClient(BaseConditionVO baseConditionVO,
                                             @RequestParam(value = "keyword", required = false) String keyword,
                                             @RequestParam(value = "order", required = false) Integer order,
                                             @RequestParam(value = "seq", required = false) Integer seq) {
        if (!permissionConfig.check(MenuEnum.CLIENT_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
        LambdaQueryWrapper<Client> wrapper = Wrappers.lambdaQuery(Client.class);
        if (AdministratorEnums.NORMAL.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
            wrapper.eq(Client::getSuperiorId, SecurityUtils.getUserId()).or(w -> w.eq(
@@ -152,9 +156,37 @@
                    .or(w1 -> w1.like(Client::getMobile, keyword))
                    .or(w2 -> w2.like(Client::getLinkMan, keyword));
        }
        List<Client> clientList = clientService.list(wrapper);
        List<ClientDto> clientDtoList = new ArrayList<>();
        //排序字段
        String orderByResult = OrderByEnums.CLIENT_CREATE_TIME.getCode();
        //正序、倒叙
        String orderBySeq = OrderByEnums.ASC.getCode();
        if (order != null) {
            switch (order) {
                case 1:
                    orderByResult = OrderByEnums.CLIENT_CREATE_TIME.getCode();
                    break;
                default:
            }
        }
        if (seq != null) {
            switch (seq) {
                case 1:
                    orderBySeq = OrderByEnums.ASC.getCode();
                    break;
                case 2:
                    orderBySeq = OrderByEnums.DESC.getCode();
                    break;
                default:
                    break;
            }
        }
        //排序方式
        String orderBy = orderByResult + " " + orderBySeq;
        PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
        List<Client> clientList = clientService.list(wrapper);
        List<ClientDto> clientDtoList = new ArrayList<>();
        for (Client demo : clientList) {
            ClientDto clientDto = new ClientDto();
            BeanUtil.copyProperties(demo, clientDto);
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/GetListOnBindingController.java
@@ -69,9 +69,9 @@
    public ResponseVO<Object> getPoleList() {
        List<Pole> poleList;
        if (SecurityUtils.getClientId() == null) {
            poleList = poleMapper.queryPoleOnLineStatesList(null, null, null, null, null);
            poleList = poleMapper.queryPoleOnLineStatesList(null, null, null, null, null, null);
        } else {
            poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(), null, null, null, null);
            poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(), null, null, null, null, null);
        }
        List<Map> mapList = new ArrayList<>();
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -71,11 +71,14 @@
    }
    @PostMapping("/listDetail")
    public ResponseVO<Object> listPoleDetail(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
    public ResponseVO<Object> listPoleDetail(BaseConditionVO baseConditionVO,
                                             @RequestBody PoleStatesParam param,
                                             @RequestParam(value = "order", required = false) Integer order,
                                             @RequestParam(value = "seq", required = false) Integer seq) {
        if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
        CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param, order, seq);
        List<Pole> listCommonPage = (List<Pole>) commonPage.getList();
        List<PoleBindVO> listResult = new ArrayList<>();
@@ -89,11 +92,14 @@
    }
    @PostMapping("/list")
    public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
    public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO,
                                       @RequestBody PoleStatesParam param,
                                       @RequestParam(value = "order", required = false) Integer order,
                                       @RequestParam(value = "seq", required = false) Integer seq) {
        if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
            return ResponseUtil.fail("缺少对应用户权限");
        }
        CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
        CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param, order, seq);
        return ResponseUtil.success(commonPage);
    }
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -38,6 +38,7 @@
import com.sandu.ximon.admin.vo.PoleBindVO;
import com.sandu.ximon.dao.bo.*;
import com.sandu.ximon.dao.domain.*;
import com.sandu.ximon.dao.enums.OrderByEnums;
import com.sandu.ximon.dao.mapper.PoleMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -285,16 +286,51 @@
        return result;
    }
    public CommonPage queryAllStatesAndList(Integer pageNo, Integer pageSize, PoleStatesParam param) {
    public CommonPage queryAllStatesAndList(Integer pageNo, Integer pageSize, PoleStatesParam param, Integer order, Integer seq) {
        if (param == null) {
            param = new PoleStatesParam();
        }
        System.out.println(param);
        //排序字段
        String orderByResult = OrderByEnums.POLE_ID.getCode();
        //正序、倒叙
        String orderBySeq = OrderByEnums.ASC.getCode();
        if (order != null) {
            switch (order) {
                case 1:
                    orderByResult = OrderByEnums.POLE_NAME.getCode();
                    break;
                case 2:
                    orderByResult = OrderByEnums.POLE_ID.getCode();
                    break;
                case 3:
                    orderByResult = OrderByEnums.POLE_CREATE_TIME.getCode();
                    break;
                default:
            }
        }
        if (seq != null) {
            switch (seq) {
                case 1:
                    orderBySeq = OrderByEnums.ASC.getCode();
                    break;
                case 2:
                    orderBySeq = OrderByEnums.DESC.getCode();
                    break;
                default:
                    break;
            }
        }
        //排序方式
        String orderBy = "t1." + orderByResult + " " + orderBySeq;
        List<Pole> poleList;
        if (SecurityUtils.getClientId() == null) {
            poleList = poleMapper.queryPoleOnLineStatesList(null, param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword());
            poleList = poleMapper.queryPoleOnLineStatesList(null, param.getIsTrue(),
                    param.getBingStates(), param.getGroupid(), param.getKeyword(), orderBy);
        } else {
            poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(), param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword());
            poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(),
                    param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword(), orderBy);
        }
        List<Pole> PoleResult = isOnLine(poleList, param);