新增 xiaoqu-agent-service:P1 骨架(Spring Boot 3.5.16 + Spring AI 1.1.8 MCP Streamable,三数据源连通,codegen 生成 m0/m2 实体,sys.ping/agent.count demo 工具实测调通)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* xiaoqu-agent-service:面向 MCP 客户端(Kimi/Claude)的业务数据服务。
|
||||
* P1 骨架:三数据源连通 + MCP Streamable HTTP 端点 + demo 工具。
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class AgentServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AgentServiceApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 管理后台REST,用户/token、作用域、审计(P4)
|
||||
*/
|
||||
package me.iiv.agent.admin;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 审计AOP、限流、结果包装(P2+)
|
||||
*/
|
||||
package me.iiv.agent.common;
|
||||
@@ -0,0 +1,42 @@
|
||||
package me.iiv.agent.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* m0 数据源(权限库 xiaoqu_comples_d:user/agent/authority 等)。
|
||||
* 参考老项目 app-db.xml 的多 SqlSessionFactory 模式,JavaConfig 重写。
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "me.iiv.agent.mapper.m0", sqlSessionFactoryRef = "m0SqlSessionFactory")
|
||||
public class M0DataSourceConfig {
|
||||
|
||||
@Primary
|
||||
@Bean(name = "m0DataSource")
|
||||
@ConfigurationProperties(prefix = "app.datasource.m0")
|
||||
public DataSource m0DataSource() {
|
||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "m0SqlSessionFactory")
|
||||
public SqlSessionFactory m0SqlSessionFactory(@Qualifier("m0DataSource") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
bean.setConfiguration(configuration);
|
||||
return bean.getObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package me.iiv.agent.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* m1 数据源(商城库 xiaoqu_mall_d,按需启用)。
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "me.iiv.agent.mapper.m1", sqlSessionFactoryRef = "m1SqlSessionFactory")
|
||||
public class M1DataSourceConfig {
|
||||
|
||||
@Bean(name = "m1DataSource")
|
||||
@ConfigurationProperties(prefix = "app.datasource.m1")
|
||||
public DataSource m1DataSource() {
|
||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
@Bean(name = "m1SqlSessionFactory")
|
||||
public SqlSessionFactory m1SqlSessionFactory(@Qualifier("m1DataSource") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
bean.setConfiguration(configuration);
|
||||
return bean.getObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package me.iiv.agent.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* m2 数据源(业务库 xiaoqu_franchisee_d:warehouse_agent_auth 等)。
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "me.iiv.agent.mapper.m2", sqlSessionFactoryRef = "m2SqlSessionFactory")
|
||||
public class M2DataSourceConfig {
|
||||
|
||||
@Bean(name = "m2DataSource")
|
||||
@ConfigurationProperties(prefix = "app.datasource.m2")
|
||||
public DataSource m2DataSource() {
|
||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
||||
}
|
||||
|
||||
@Bean(name = "m2SqlSessionFactory")
|
||||
public SqlSessionFactory m2SqlSessionFactory(@Qualifier("m2DataSource") DataSource dataSource) throws Exception {
|
||||
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
bean.setConfiguration(configuration);
|
||||
return bean.getObject();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.iiv.agent.config;
|
||||
|
||||
import me.iiv.agent.mcp.tool.AgentTools;
|
||||
import me.iiv.agent.mcp.tool.SysTools;
|
||||
import org.springframework.ai.tool.ToolCallbackProvider;
|
||||
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* MCP 工具注册:@Tool 注解方法 → ToolCallbackProvider,
|
||||
* 由 spring-ai-starter-mcp-server-webmvc 自动暴露到 /mcp 端点。
|
||||
*/
|
||||
@Configuration
|
||||
public class McpToolConfig {
|
||||
|
||||
@Bean
|
||||
public ToolCallbackProvider xiaoquTools(SysTools sysTools, AgentTools agentTools) {
|
||||
return MethodToolCallbackProvider.builder()
|
||||
.toolObjects(sysTools, agentTools)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package me.iiv.agent.entity.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代理商表
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Agent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 类型(0:区域主管1:代理2:物业,3....)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 渠道编号(Z:总部;F:分公司;D:代理)
|
||||
*/
|
||||
private String channelNo;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
private Long supervisorId;
|
||||
|
||||
/**
|
||||
* 上级代理
|
||||
*/
|
||||
private String supervisorName;
|
||||
|
||||
/**
|
||||
* 企业地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 企业联系方式
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 县
|
||||
*/
|
||||
private String countyseat;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 联系人邮箱
|
||||
*/
|
||||
private String mail;
|
||||
|
||||
/**
|
||||
* 代理地区
|
||||
*/
|
||||
private String agencyarea;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
private Long parentsId;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private String serialnumber;
|
||||
|
||||
/**
|
||||
* 代理级别(0:总部;1:一级代理;2:二级代理)
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 户名
|
||||
*/
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 账户号
|
||||
*/
|
||||
private String accountNo;
|
||||
|
||||
/**
|
||||
* 开户行
|
||||
*/
|
||||
private String accountBank;
|
||||
|
||||
/**
|
||||
* 纳税人识别号
|
||||
*/
|
||||
private String identificationNumber;
|
||||
|
||||
/**
|
||||
* 纳税人类型(0:一般纳税人;1:小规模纳税人;2:个人)
|
||||
*/
|
||||
private Integer taxpayerType;
|
||||
|
||||
/**
|
||||
* 纳税人税点
|
||||
*/
|
||||
private Double taxpayerPoint;
|
||||
|
||||
/**
|
||||
* 代理商承担手续费
|
||||
*/
|
||||
private Double taxpayerServiceCharge;
|
||||
|
||||
/**
|
||||
* 订单出库验证0:不验证;1:验证
|
||||
*/
|
||||
private Integer orderOutCheck;
|
||||
|
||||
/**
|
||||
* 开票名称
|
||||
*/
|
||||
private String invoiceName;
|
||||
|
||||
/**
|
||||
* 身份编码
|
||||
*/
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String shortName;
|
||||
|
||||
/**
|
||||
* 金蝶客户编号
|
||||
*/
|
||||
private String jindieCustid;
|
||||
|
||||
/**
|
||||
* 销售id
|
||||
*/
|
||||
private Long saleId;
|
||||
|
||||
/**
|
||||
* 销售名称
|
||||
*/
|
||||
private String saleName;
|
||||
|
||||
/**
|
||||
* 销售组织
|
||||
*/
|
||||
private String saleOrgId;
|
||||
|
||||
/**
|
||||
* 金蝶内码
|
||||
*/
|
||||
private Long jindieInternalId;
|
||||
|
||||
/**
|
||||
* 组织内码
|
||||
*/
|
||||
private String saleOrgInternalId;
|
||||
|
||||
/**
|
||||
* 客户分组
|
||||
*/
|
||||
private String custerGroupNo;
|
||||
|
||||
/**
|
||||
* 金蝶供应商编号
|
||||
*/
|
||||
private String supplierNo;
|
||||
|
||||
/**
|
||||
* 开票通讯地址
|
||||
*/
|
||||
private String invoiceAddress;
|
||||
|
||||
/**
|
||||
* 开票联系电话
|
||||
*/
|
||||
private String invoiceContact;
|
||||
|
||||
/**
|
||||
* 金蝶客户名称
|
||||
*/
|
||||
private String jinideName;
|
||||
|
||||
/**
|
||||
* 最后开票时间
|
||||
*/
|
||||
private Date lastInvoiceTime;
|
||||
|
||||
/**
|
||||
* 发票抬头类型(0:企业单位;1:个人|非企业)
|
||||
*/
|
||||
private Integer invoiceType;
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package me.iiv.agent.entity.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代管权限
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("agent_manage_district_auth")
|
||||
public class AgentManageDistrictAuth implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String districtName;
|
||||
|
||||
/**
|
||||
* 站点ID
|
||||
*/
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 所属物业
|
||||
*/
|
||||
private Long propertyId;
|
||||
|
||||
/**
|
||||
* 原代理商id
|
||||
*/
|
||||
private Long agentId;
|
||||
|
||||
/**
|
||||
* 管理代理商id
|
||||
*/
|
||||
private Long manageAgentId;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package me.iiv.agent.entity.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限组
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Authority implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 权限组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属代理
|
||||
*/
|
||||
private Long agentId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 父关联
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 行权限
|
||||
*/
|
||||
private Integer isagent;
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package me.iiv.agent.entity.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 物业表
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Properyt implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 销售id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 销售名称
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 类型(0:区域主管1:代理2:物业,3....)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 金蝶客户名称
|
||||
*/
|
||||
private String jinideName;
|
||||
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 代理商id
|
||||
*/
|
||||
private Long agentId;
|
||||
|
||||
/**
|
||||
* 代理名称
|
||||
*/
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 企业地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 企业联系方式
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 上级id
|
||||
*/
|
||||
private Long supervisorId;
|
||||
|
||||
/**
|
||||
* 物业编号
|
||||
*/
|
||||
private String serialnumber;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 县
|
||||
*/
|
||||
private String countyseat;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 联系人邮箱
|
||||
*/
|
||||
private String mail;
|
||||
|
||||
/**
|
||||
* 客户id自动生成
|
||||
*/
|
||||
private String customerId;
|
||||
|
||||
/**
|
||||
* 上线站点数
|
||||
*/
|
||||
private Integer districtOnCount;
|
||||
|
||||
/**
|
||||
* 上线设备数
|
||||
*/
|
||||
private Integer hardOnCount;
|
||||
|
||||
/**
|
||||
* 物业账号数
|
||||
*/
|
||||
private Integer userCount;
|
||||
|
||||
/**
|
||||
* 户名
|
||||
*/
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String accountNo;
|
||||
|
||||
/**
|
||||
* 开户行
|
||||
*/
|
||||
private String accountBank;
|
||||
|
||||
/**
|
||||
* 纳税人识别号
|
||||
*/
|
||||
private String identificationNumber;
|
||||
|
||||
/**
|
||||
* 开票名称
|
||||
*/
|
||||
private String invoiceName;
|
||||
|
||||
/**
|
||||
* 金蝶客户编号
|
||||
*/
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* 金蝶内码
|
||||
*/
|
||||
private Long jindieInternalId;
|
||||
|
||||
/**
|
||||
* 开票通讯地址
|
||||
*/
|
||||
private String invoiceAddress;
|
||||
|
||||
/**
|
||||
* 开票联系电话
|
||||
*/
|
||||
private String invoiceContact;
|
||||
|
||||
/**
|
||||
* 最后开票时间
|
||||
*/
|
||||
private Date lastInvoiceTime;
|
||||
|
||||
/**
|
||||
* 发票抬头类型(0:企业单位;1:个人|非企业)
|
||||
*/
|
||||
private Integer invoiceType;
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
package me.iiv.agent.entity.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态(0:启用:1:删除)
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 管理员账号(例如:8534715)
|
||||
*/
|
||||
private String loginAccount;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 所属公司名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 极光推送id/个推
|
||||
*/
|
||||
private String registrationId;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
private Date lastLoginTime;
|
||||
|
||||
/**
|
||||
* 角色类别
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 企业类别1:代理;2:物业
|
||||
*/
|
||||
private Integer enterpriseType;
|
||||
|
||||
/**
|
||||
* 账号角色类型1:运维;2:保洁;3:富士康;4:老化;5:物业;6:代理
|
||||
*/
|
||||
private Integer approle;
|
||||
|
||||
/**
|
||||
* 系统权限0:管理权限;1:普通权限
|
||||
*/
|
||||
private Integer roleType;
|
||||
|
||||
/**
|
||||
* 如果是保洁存储当前设置的站点
|
||||
*/
|
||||
private Long districtId;
|
||||
|
||||
/**
|
||||
* 代理ID
|
||||
*/
|
||||
private Long agentId;
|
||||
|
||||
/**
|
||||
* 物业ID
|
||||
*/
|
||||
private Long propertyId;
|
||||
|
||||
/**
|
||||
* 推送标记
|
||||
*/
|
||||
private Long supervisorId;
|
||||
|
||||
/**
|
||||
* 考勤状态0:上班;1:下班;2:请假;3休息
|
||||
*/
|
||||
private Integer workStatus;
|
||||
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
private String emailMask;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idcard;
|
||||
|
||||
/**
|
||||
* 性别(男,女)
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 是否推送rfid变化
|
||||
*/
|
||||
private Long rfidFlag;
|
||||
|
||||
/**
|
||||
* 备注(职位信息等)
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 日志开关
|
||||
*/
|
||||
private Integer logFlag;
|
||||
|
||||
/**
|
||||
* 备用机开关 0:否;1:是
|
||||
*/
|
||||
private Integer backHardFlag;
|
||||
|
||||
/**
|
||||
* 权限id
|
||||
*/
|
||||
private Long authorityId;
|
||||
|
||||
/**
|
||||
* 0:否;1:是
|
||||
*/
|
||||
private Integer weixinBindFlag;
|
||||
|
||||
/**
|
||||
* 微信openid
|
||||
*/
|
||||
private String weixinOpenid;
|
||||
|
||||
/**
|
||||
* 0:否;1:是
|
||||
*/
|
||||
private Integer authenticationFlag;
|
||||
|
||||
private String weixinName;
|
||||
|
||||
/**
|
||||
* ota升级开关0:关;1:开
|
||||
*/
|
||||
private Integer otaFlag;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private String birthday;
|
||||
|
||||
/**
|
||||
* 聘用日期
|
||||
*/
|
||||
private String employDate;
|
||||
|
||||
/**
|
||||
* 终止日期
|
||||
*/
|
||||
private String terminationDate;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 编辑人
|
||||
*/
|
||||
private String modifyName;
|
||||
|
||||
/**
|
||||
* 物业权限id
|
||||
*/
|
||||
private Long propertyAuthorityId;
|
||||
|
||||
/**
|
||||
* 钉钉平台用户ID
|
||||
*/
|
||||
private String dingUserId;
|
||||
|
||||
/**
|
||||
* 工作中状态0:作业;1:转场;2:空闲;3:休息
|
||||
*/
|
||||
private Integer workAtStatus;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
|
||||
/**
|
||||
* 试用期保护0:未启用;1:启用
|
||||
*/
|
||||
private Integer probationProtection;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 上班时间
|
||||
*/
|
||||
private String onTime;
|
||||
|
||||
/**
|
||||
* 下班时间
|
||||
*/
|
||||
private String offTime;
|
||||
|
||||
/**
|
||||
* 出纸机权限
|
||||
*/
|
||||
private Integer czjAuth;
|
||||
|
||||
/**
|
||||
* 空感权限
|
||||
*/
|
||||
private Integer kgAuth;
|
||||
|
||||
/**
|
||||
* 信标权限
|
||||
*/
|
||||
private Integer xbAuth;
|
||||
|
||||
/**
|
||||
* 电商价格权限0:不展示;1:展示;
|
||||
*/
|
||||
private Integer priceAuth;
|
||||
|
||||
/**
|
||||
* 空感设置权限0:关闭;1:打开;
|
||||
*/
|
||||
private Integer kongganAuth;
|
||||
|
||||
/**
|
||||
* 出纸机功能权限0:否;1:是
|
||||
*/
|
||||
private Integer czjFunctionAuth;
|
||||
|
||||
/**
|
||||
* 空感功能权限0:否;1:是
|
||||
*/
|
||||
private Integer kgFunctionAuth;
|
||||
|
||||
/**
|
||||
* 未清理已用卷数0:关闭;1:打开;
|
||||
*/
|
||||
private Integer noCleanUsePaperAuth;
|
||||
|
||||
/**
|
||||
* 产品清单操作功能0:关闭;1:打开;
|
||||
*/
|
||||
private Integer productOpAuth;
|
||||
|
||||
/**
|
||||
* 金蝶人员销售订单编号
|
||||
*/
|
||||
private String jindieSalerid;
|
||||
|
||||
/**
|
||||
* 泡沫机APP显示0:关闭;1:打开;
|
||||
*/
|
||||
private Integer foamFunctionAuth;
|
||||
|
||||
/**
|
||||
* 金蝶内码
|
||||
*/
|
||||
private String jindieInternalId;
|
||||
|
||||
/**
|
||||
* 主任部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 主任部门
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 主任岗位
|
||||
*/
|
||||
private Long postId;
|
||||
|
||||
/**
|
||||
* 主任岗位
|
||||
*/
|
||||
private String postName;
|
||||
|
||||
/**
|
||||
* 工作流设置功能0:关闭;1:打开;
|
||||
*/
|
||||
private Integer flowAuth;
|
||||
|
||||
/**
|
||||
* xiaoqu-ai 用户ID
|
||||
*/
|
||||
private Long xiaoquAiUserId;
|
||||
|
||||
/**
|
||||
* 同步到 xiaoqu-ai 的时间
|
||||
*/
|
||||
private Date xiaoquAiSyncedAt;
|
||||
|
||||
/**
|
||||
* 0待回填/1已解析/2歧义/3悬空;property_id非空→初始UPDATE=1
|
||||
*/
|
||||
private Byte tenantResolveStatus;
|
||||
|
||||
/**
|
||||
* 0正常/1身份待核(冲突fail-closed锁B3人证比对;⊥tenant_resolve_status,不进PEP单路)
|
||||
*/
|
||||
private Byte idcardResolveStatus;
|
||||
|
||||
/**
|
||||
* AES-256-GCM(IV‖ct‖tag);canonical后加密;明文绝不落盘
|
||||
*/
|
||||
private byte[] idcardEnc;
|
||||
|
||||
/**
|
||||
* keyed HMAC-SHA256(canonical idcard);等值/dedup/唯一
|
||||
*/
|
||||
private byte[] idcardBidx;
|
||||
|
||||
/**
|
||||
* 存储预算掩码 前3后4(默认零解密展示)
|
||||
*/
|
||||
private String idcardMask;
|
||||
|
||||
/**
|
||||
* AES-256-GCM
|
||||
*/
|
||||
private byte[] mobileEnc;
|
||||
|
||||
/**
|
||||
* keyed HMAC-SHA256(canonical mobile);等值查找(非唯一)
|
||||
*/
|
||||
private byte[] mobileBidx;
|
||||
|
||||
/**
|
||||
* 展示掩码 前3后4
|
||||
*/
|
||||
private String mobileMask;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package me.iiv.agent.entity.m2;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库代理权限
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("warehouse_agent_auth")
|
||||
public class WarehouseAgentAuth implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 修改id
|
||||
*/
|
||||
private Long modifyId;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String modifyName;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 数据状态
|
||||
*/
|
||||
private Integer softDelete;
|
||||
|
||||
/**
|
||||
* 负责人ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 管理公司ID
|
||||
*/
|
||||
private Long managerAgentId;
|
||||
|
||||
/**
|
||||
* 管理公司
|
||||
*/
|
||||
private String managerAgentName;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m0.AgentManageDistrictAuth;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代管权限 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface AgentManageDistrictAuthMapper extends BaseMapper<AgentManageDistrictAuth> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m0.Agent;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代理商表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface AgentMapper extends BaseMapper<Agent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m0.Authority;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限组 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface AuthorityMapper extends BaseMapper<Authority> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m0.Properyt;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 物业表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface ProperytMapper extends BaseMapper<Properyt> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m0;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m0.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* m1商城库Mapper包,按需生成实体后启用
|
||||
*/
|
||||
package me.iiv.agent.mapper.m1;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package me.iiv.agent.mapper.m2;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import me.iiv.agent.entity.m2.WarehouseAgentAuth;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓库代理权限 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2026-09-03
|
||||
*/
|
||||
public interface WarehouseAgentAuthMapper extends BaseMapper<WarehouseAgentAuth> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.iiv.agent.mcp.tool;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import me.iiv.agent.entity.m0.Agent;
|
||||
import me.iiv.agent.mapper.m0.AgentMapper;
|
||||
import org.springframework.ai.tool.annotation.Tool;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代理商域 demo 工具:证明 m0 数据源连通(真实查库)。
|
||||
*/
|
||||
@Component
|
||||
public class AgentTools {
|
||||
|
||||
final AgentMapper agentMapper;
|
||||
|
||||
public AgentTools(AgentMapper agentMapper) {
|
||||
this.agentMapper = agentMapper;
|
||||
}
|
||||
|
||||
@Tool(name = "agent.count", description = "统计 m0 库 agent 表中 soft_delete=0 的代理商总数")
|
||||
public Map<String, Object> agentCount() {
|
||||
Long count = agentMapper.selectCount(
|
||||
new LambdaQueryWrapper<Agent>().eq(Agent::getSoftDelete, 0));
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("count", count);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package me.iiv.agent.mcp.tool;
|
||||
|
||||
import org.springframework.ai.tool.annotation.Tool;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统级 demo 工具:证明 MCP 链路连通。
|
||||
*/
|
||||
@Component
|
||||
public class SysTools {
|
||||
|
||||
@Value("${spring.application.name}")
|
||||
String appName;
|
||||
|
||||
@Value("${spring.ai.mcp.server.version}")
|
||||
String appVersion;
|
||||
|
||||
final StringRedisTemplate redisTemplate;
|
||||
|
||||
public SysTools(StringRedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
@Tool(name = "sys.ping", description = "服务自检:返回服务名、版本、当前时间与 Redis 连通性")
|
||||
public Map<String, Object> ping() {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("service", appName);
|
||||
result.put("version", appVersion);
|
||||
result.put("time", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
try {
|
||||
String pong = redisTemplate.getConnectionFactory().getConnection().ping();
|
||||
result.put("redis", pong);
|
||||
} catch (Exception e) {
|
||||
result.put("redis", "ERROR: " + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 行级数据权限引擎,移植getByIsAgent规则(P2)
|
||||
*/
|
||||
package me.iiv.agent.permission;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* ak鉴权Filter、身份上下文、scope校验(P2)
|
||||
*/
|
||||
package me.iiv.agent.security;
|
||||
Reference in New Issue
Block a user