puzhibing
2026-09-29 a70433b2ee5bb37823ab73422a01251343cb5f58
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
package com.ruoyi.other.service;
 
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.other.api.domain.TGroupCompany;
 
import java.math.BigDecimal;
 
/**
 * <p>
 * 公司(企业)管理 服务类
 * </p>
 *
 * @author mxcd
 * @since 2026-09-22
 */
public interface TGroupCompanyService extends IService<TGroupCompany> {
 
    /**
     * 公司详情(企业概况附带车队数量、本月充值金额统计)
     *
     * @param id 公司ID
     * @return 公司详情;公司不存在时返回 null
     */
    TGroupCompany getDetail(Integer id);
 
    /**
     * 公司详情并聚合充电用户信息(VIN码/刷卡/白名单三类合并列表)。
     * 仅供管理后台公司详情接口使用;远程 remoteGet 保持 getDetail 不聚合,避免跨服务循环调用。
     *
     * @param id 公司ID
     * @return 公司详情(含充电用户信息列表)
     */
    TGroupCompany getDetailWithChargingUsers(Integer id);
 
    /**
     * 添加公司并同步创建登录账号(sys_user,roleType=5)
     *
     * @param company 公司(含账号、密码)
     * @return 操作结果
     */
    AjaxResult addCompany(TGroupCompany company);
 
    /**
     * 编辑公司并同步登录账号资料(不修改密码)
     *
     * @param company 公司
     * @return 操作结果
     */
    AjaxResult editCompany(TGroupCompany company);
 
    /**
     * 删除公司并停用其登录账号(delFlag=2)
     *
     * @param id 公司ID
     * @return 操作结果
     */
    AjaxResult delCompany(Integer id);
 
    /**
     * 修改公司账户模式(公司管理-账户模式弹窗使用)
     *
     * @param id          公司ID
     * @param accountMode 账户模式(1=共享模式,2=分配模式)
     * @return 操作结果
     */
    AjaxResult updateAccountMode(Integer id, Integer accountMode);
 
    /**
     * 结算公司余额(解锁锁定额并按实际消费扣减,允许扣成负数)
     * <p>订单号非空时按订单号幂等:公司余额变更与账户侧消费流水配套写入,
     * 结算失败回退订单状态后的补偿重试不会重复结算。</p>
     *
     * @param companyId    公司ID
     * @param lockedAmount 申请时锁定额(用于释放)
     * @param actualAmount 实际消费金额
     * @param orderCode    充电订单号(幂等键,可为空)
     * @param userInfo     分配对象(共享模式为企业名称)
     * @param userName     分配对象名称
     * @param remark       备注
     * @return 结算后可用余额
     */
    BigDecimal settleBalance(Integer companyId, BigDecimal lockedAmount, BigDecimal actualAmount, String orderCode,
                             String userInfo, String userName, String remark);
 
}