zhitong.yu
7 天以前 7fc9c42987a13c1d8d2159591a5803e70518827f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.hxzk.gps.service.impl.FzRadar;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzk.gps.controller.Radar.dto.TableSearchResult.TableSearchResult;
import com.hxzk.gps.controller.System.SystemLogUtil;
import com.hxzk.gps.entity.FzRadar.TbFzanchor;
import com.hxzk.gps.mapper.FzRadar.TbFzanchorMapper;
import com.hxzk.gps.result.ListDataResult;
import com.hxzk.gps.result.ResultTable;
import com.hxzk.gps.result.table;
import com.hxzk.gps.service.FzRadar.TbFzanchorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzk.gps.util.GetUser.UserInfoUtil;
import com.hxzk.gps.util.MessageUtils.MessageUtils;
import com.hxzk.gps.util.Result.ReturnMessage;
 
import com.hxzk.gps.util.UDP.UDP_FzAnchor;
import com.hxzk.gps.util.UDP.UDP_Person;
import org.springframework.stereotype.Service;
 
import java.util.Optional;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author YuZhiTong
 * @since 2025-05-22
 */
@Service
public class TbFzanchorServiceImpl extends ServiceImpl<TbFzanchorMapper, TbFzanchor> implements TbFzanchorService {
 
    @Override
    public ResultTable FindRadarInfo(TableSearchResult TableSearchResult) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company", UserInfoUtil.getUserCompany());
        Optional.ofNullable(TableSearchResult.getFzanchor().getAchorid()).ifPresent(achorid -> queryWrapper.like("achorid", achorid));
        PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize());
        PageInfo<TbFzanchor> info = new PageInfo<>(baseMapper.selectList(queryWrapper));
        table<TbFzanchor> achortable = new table<>(info.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),info.getTotal());
        return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
    }
 
    @Override
    public ReturnMessage add(TbFzanchor fzanchor) {
        /*
        声明操作状态
        * */
        boolean isSuccess = false;
        try {
            /*
            发送指令到CS
            * */
            UDP_FzAnchor.AddFzAnchor(fzanchor);
            isSuccess = true;
        }catch (Exception e){
 
        }
        return SystemLogUtil.handleAddResult(isSuccess,"RadarAdd",fzanchor.getAchorid());
    }
 
    @Override
    public ReturnMessage update(TbFzanchor fzanchor) {
         /*
        声明操作状态
        * */
        boolean isSuccess = false;
        try {
            /*
            发送指令到CS
            * */
            UDP_FzAnchor.UpFzAnchor(fzanchor);
            isSuccess = true;
        }catch (Exception e){
 
        }
        return SystemLogUtil.handleUpdateResult(isSuccess,"RadarUpdate",fzanchor.getAchorid());
    }
 
    @Override
    public ReturnMessage delete(TbFzanchor fzanchor) {
          /*
        声明操作状态
        * */
        boolean isSuccess = false;
        try {
            /*
            发送指令到CS
            * */
            UDP_FzAnchor.DeFzAnchor(fzanchor);
            isSuccess = true;
        }catch (Exception e){
 
        }
        return SystemLogUtil.handleDeleteResult(isSuccess,"RadarDelete",fzanchor.getAchorid());
    }
}