SMT-ERP 项目初始提交

This commit is contained in:
2026-10-13 16:15:00 +08:00
commit d8643761f5
876 changed files with 198756 additions and 0 deletions

4
smtERP-boot/.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
*.js linguist-language=Java
*.css linguist-language=Java
*.html linguist-language=Java
*.sh text eol=lf

21
smtERP-boot/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
*.iml
# Package Files #
*.jar
*.war
*.ear
*.zip
*.log
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea
/target
**/*.iml

View File

@@ -0,0 +1,88 @@
# 资产管理模块
## 原 n2tpm 盘点接口兼容
当前服务保留自身 `/apis` 上下文,并提供原盘点协议的以下 POST 接口:
- `/apis/n2tpm/webmvc/Inventory/Login`
- `/apis/n2tpm/webmvc/Inventory/GetInventory`
- `/apis/n2tpm/webmvc/Inventory/GetInventoryDetail`
- `/apis/n2tpm/webmvc/Inventory/SaveDeviceInventoryInfo`
- `/apis/n2tpm/webmvc/Inventory/AccepteOrHandoverDocForInventory`
- `/apis/n2tpm/webmvc/Inventory/UploadPicture`
- `/apis/n2tpm/webmvc/Inventory/GetDevice`
接口请求字段、响应中的业务字段及 `code/msg/data` 包装与原项目一致。若外部设备必须继续访问
`/n2tpm/webmvc/Inventory/**`,请在网关将该路径转发到本服务的
`/apis/n2tpm/webmvc/Inventory/**`,无需修改前端和现有 `/apis` 接口。
## 部署
1. 执行 `src/main/resources/db/migration/V20260918__asset_management.sql`。
2. 重启后端并重新登录前端,使动态菜单和角色权限重新加载。
3. 管理员菜单中会出现“资产管理”,包含“资产台账”“设备台账”“资产盘点”。
## 盘点流程
盘点状态依次为:草稿(DRAFT)→ 盘点中(IN_PROGRESS)→ 待审核(PENDING_AUDIT)→ 已完成(COMPLETED)→ 已关结(CLOSED)。
创建盘点单时会把当前资产/设备台账固化为盘点快照。盘点支持按明细操作,也支持输入或扫描资产、设备编号定位明细。实盘数量和账面数量不一致时会自动判断盘盈或盘亏;部门、地点变化时会判断为异常,也可人工指定结果。
## 协同服务接口
推荐接口:
```http
POST /apis/assetInventory/collaboration/create
Content-Type: application/json
```
```json
{
"externalRequestId": "外部系统唯一请求号",
"planName": "月度设备盘点",
"scopeType": "DEVICE",
"deadline": "2026-09-30 18:00:00",
"remark": "由协同服务创建"
}
```
`externalRequestId` 是租户内幂等键,外部服务重试时会返回原盘点单,不会重复建单。接口沿用系统登录会话和租户隔离机制。
为兼容参考工程中的调用路径,同时保留:
```http
POST /apis/tpmDouble/cteatePdTasks
```
该兼容接口固定以全部设备台账创建盘点任务,可选传入 `externalRequestId`、`planName`、`deadline` 和 `remark`。
### 外部服务回传单项盘点结果
推荐使用:
```http
POST /apis/assetInventory/collaboration/record
Content-Type: application/json
```
为兼容原设备项目的调用路径,同时支持:
```http
POST /apis/deviceInventory/doDevicePlan
Content-Type: application/json
```
按盘点单号和设备编码回传示例:
```json
{
"inventoryNo": "PD20260918131230171",
"deviceSn": "QC-SPI-01",
"remark": "外部采集服务确认设备在位"
}
```
也可以传 `inventoryId` 与 `detailId`,或者使用 `targetCode`、`deviceCode`、`assetCode` 作为对象编码。回传成功后,明细由“未盘点”更新为“已盘点”,主单自动进入“盘点中”并刷新已盘数量。重复回传同一明细按幂等成功处理,不会重复计数。若外部系统能够判断差异,可将 `inventoryStatus` 传为 `NORMAL`、`SURPLUS`、`SHORTAGE` 或 `ABNORMAL`。
接口沿用本系统认证与租户隔离,外部服务调用时需携带有效登录令牌或会话。

View File

@@ -0,0 +1,45 @@
-- 客户分类表
CREATE TABLE IF NOT EXISTS `tbl_customer_category` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`category_name` varchar(100) DEFAULT NULL COMMENT '分类名称',
`parent_id` bigint(20) DEFAULT 0 COMMENT '父分类ID,0表示顶级',
`level` int(11) DEFAULT 1 COMMENT '层级',
`sort` varchar(20) DEFAULT NULL COMMENT '排序',
`description` varchar(500) DEFAULT NULL COMMENT '描述',
`enabled` tinyint(1) DEFAULT 1 COMMENT '是否启用',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_parent_id` (`parent_id`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户分类表';
-- 客户联系人表
CREATE TABLE IF NOT EXISTS `tbl_customer_contact` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
`contact_name` varchar(50) DEFAULT NULL COMMENT '联系人姓名',
`position` varchar(50) DEFAULT NULL COMMENT '岗位(采购、财务等)',
`phone` varchar(30) DEFAULT NULL COMMENT '手机号',
`telephone` varchar(30) DEFAULT NULL COMMENT '座机',
`email` varchar(100) DEFAULT NULL COMMENT '邮箱',
`wechat` varchar(50) DEFAULT NULL COMMENT '微信',
`qq` varchar(30) DEFAULT NULL COMMENT 'QQ',
`is_primary` tinyint(1) DEFAULT 0 COMMENT '是否主要联系人',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
`delete_flag` varchar(1) DEFAULT '0' COMMENT '删除标记',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_customer_id` (`customer_id`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='客户联系人表';
-- 给 tbl_supplier 添加分类字段
ALTER TABLE `tbl_supplier` ADD COLUMN `category_id` bigint(20) DEFAULT NULL COMMENT '客户分类ID' AFTER `type`;
ALTER TABLE `tbl_supplier` ADD INDEX `idx_category_id` (`category_id`);

View File

@@ -0,0 +1,60 @@
-- 客户分类表 - 支持多级分类
DROP TABLE IF EXISTS `jsh_customer_category`;
CREATE TABLE `jsh_customer_category` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`category_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '分类名称',
`parent_id` bigint(20) DEFAULT 0 COMMENT '父级ID,0表示顶级分类',
`level` int(11) DEFAULT 1 COMMENT '层级,从1开始',
`sort` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '排序',
`description` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述',
`enabled` bit(1) DEFAULT b'1' COMMENT '启用状态',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_parent_id`(`parent_id`) USING BTREE,
INDEX `idx_tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户分类表' ROW_FORMAT = Dynamic;
-- 客户联系人表 - 支持多个联系人
DROP TABLE IF EXISTS `jsh_customer_contact`;
CREATE TABLE `jsh_customer_contact` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`customer_id` bigint(20) NOT NULL COMMENT '客户ID',
`contact_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '联系人姓名',
`position` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '岗位/职位',
`phone` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '手机号码',
`telephone` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系电话',
`email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '电子邮箱',
`wechat` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '微信号',
`qq` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'QQ号',
`is_primary` bit(1) DEFAULT b'0' COMMENT '是否主要联系人,0否,1是',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户ID',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_customer_id`(`customer_id`) USING BTREE,
INDEX `idx_tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户联系人表' ROW_FORMAT = Dynamic;
-- 为供应商表(jsh_supplier)添加分类ID字段
ALTER TABLE `jsh_supplier` ADD COLUMN `category_id` bigint(20) DEFAULT NULL COMMENT '客户分类ID' AFTER `type`;
ALTER TABLE `jsh_supplier` ADD INDEX `idx_category_id`(`category_id`) USING BTREE;
-- 插入示例数据:客户分类
INSERT INTO `jsh_customer_category` VALUES
(1, '企业客户', 0, 1, '1', '大型企业、中小企业等', b'1', 63, 63, '0', NOW(), NOW()),
(2, '个人客户', 0, 1, '2', '个人消费者', b'1', 63, 63, '0', NOW(), NOW()),
(3, '政府机构', 0, 1, '3', '政府部门、事业单位', b'1', 63, 63, '0', NOW(), NOW()),
(4, '大型企业', 1, 2, '1', '大型企业客户', b'1', 63, 63, '0', NOW(), NOW()),
(5, '中小企业', 1, 2, '2', '中小型企业客户', b'1', 63, 63, '0', NOW(), NOW());
-- 插入示例数据:客户联系人(假设客户ID为58的客户1)
INSERT INTO `jsh_customer_contact` VALUES
(1, 58, '张三', '采购经理', '13800138001', '', 'zhangsan@example.com', '', '', b'1', '主要负责采购事务', 63, 63, '0', NOW(), NOW()),
(2, 58, '李四', '财务主管', '13800138002', '', 'lisi@example.com', '', '', b'0', '负责财务结算', 63, 63, '0', NOW(), NOW());

View File

@@ -0,0 +1,89 @@
# 2026-10-12 代码审查修复及上线说明
本次以不改变正常业务计算、单据状态流转和原有数据为原则。认证变化已获调用方同步调整的确认。没有连接生产数据库、轮换真实凭据或发布服务。
## 审查项处理结果
| 审查项 | 本次处理 | 兼容性与剩余事项 |
| --- | --- | --- |
| C1 明文凭据 | application.yml 的数据库用户名、数据库密码、Redis 密码改为外部注入;生成器配置移除默认用户名及密码 | 部署前配置环境变量;已泄露的真实口令仍须由部署人员轮换,Git 历史中的旧值没有清除 |
| C2 LIKE 注入 | 4 个 Mapper、14 处表达式改为 `concat('%', #{参数}, '%')` | 保留模糊搜索、中文、单引号和 `%` / `_` 通配符语义,不对合法搜索词做截断或删字符 |
| C3 匿名同步 | 两个 sync 接口仅接受独立 API Key 或已有 ERP 登录会话 | 外部调用方必须增加请求头,未配置密钥不允许匿名通过 |
| C3 旧盘点 | Login 返回独立短期 token;盘点业务接口要求认证;校验 USER_ID 和当前身份、盘点单所属盘点人;沿用登录失败限流 | 保留原大写字段和响应包装,增加 TOKEN 字段;禁止伪造他人身份与跨盘点人操作 |
| C3 白名单 | 移除匿名 tenantClean;白名单前缀加路径边界;同步路径精确匹配 | 静态 Excel 模板仅精确 GET 公开,保留原 `<a>` / `window.open` 下载;模板不含业务数据 |
| C4 eval | WebSocket 使用 JSON.parse;菜单占位符使用显式映射 | 非 JSON 消息会被忽略;未知菜单表达式原样保留且不执行,见下文支持列表 |
| H1 MD5/弱默认密码 | 完成入口核对及迁移设计,尚未改动存储与登录协议 | 现有库 password 为 varchar(50),不能直接存 BCrypt;详见迁移步骤。此风险尚未关闭 |
| H2 排序/Example | 保留已存在的 4 处字段及方向白名单,新增真实 MyBatis BoundSql 回归;分页排序加强为字段/方向语法校验 | Example 条件由内部方法构造,未发现 Controller 接收外部 Example;不机械替换生成器 `${criterion.condition}` |
| H3 公告 XSS | 使用 DOMPurify 3.4.16 在展示时净化 HTML | 保留普通 HTML 排版;历史记录不改写;后端存储端的富文本策略需覆盖其他消费者后再实施 |
| H4 老依赖 | JDBC 关闭 allowMultiQueries;新增 DOMPurify;修复 Java 11 测试工具兼容 | Mapper 静态检查未发现分号批量语句;Spring Boot、axios、jQuery、fastjson 大版本升级仍需专项回归,未宣称已消除所有依赖漏洞 |
| H5 会话/插件 | Redis 会话有效期支持配置,默认沿用原 259200 秒 | 报告中的 servlet 36000 秒不是实际 ERP token 有效期;插件安装原本就校验管理员,不是普通登录用户可安装 |
| M1 异常 | HTTP 关闭失败记录日志、保留 POST 异常原因;日期格式试探仅捕获 ParseException;盘点内部错误记录日志而不向客户端暴露堆栈 | 日期格式依次尝试是合理流程,全部失败仍按原逻辑抛出业务错误;不改日期解析宽松程度 |
| M2 API 权限 | 补齐本次同步与盘点入口及盘点身份/数据归属校验 | 全系统按钮权限到 API 权限的映射尚未实施,需要单独梳理角色、租户、共享数据和插件接口 |
| M3 测试 | 新增认证、盘点权限、SQL、前端 XSS/eval 回归;移除 Maven 跳过测试编译配置;升级测试插件和测试 mock 工具以支持 Java 11 | 不使用真实数据库和 Redis,不等同于完整业务验收 |
| L1/L2 | printStackTrace 改结构化日志;保持局部 SimpleDateFormat | 局部实例无共享线程安全问题;替换日期 API 可能改变宽松解析、时区等行为,本次不做无必要重构 |
## 部署前配置
使用服务管理器、容器配置或配置中心注入:
| 变量 | 用途 | 默认 |
| --- | --- | --- |
| DB_USERNAME | 数据库账号 | 无,必填 |
| DB_PASSWORD | 数据库密码 | 无,必填 |
| REDIS_PASSWORD | Redis 密码 | 无,必填;无密码的 Redis 显式配置为空 |
| SYNC_API_KEY | 外部入库同步专用密钥 | 空;空值时仅 ERP 会话可以调用 sync |
| INVENTORY_TOKEN_TTL_SECONDS | 旧盘点 token 绝对有效期 | 3600 秒;最低 60 秒 |
| ERP_SESSION_TIMEOUT_SECONDS | ERP Redis 会话滑动有效期 | 259200 秒,与原值一致;最低 60 秒 |
也可继续通过外部 Spring 配置覆盖 `spring.datasource.*` / `spring.redis.*`。不要把真实凭据重新写入仓库。MyBatis Generator 的 `${DB_USERNAME}` / `${DB_PASSWORD}` 是 Java 系统属性替换,运行生成器时需由本地构建配置提供这两个系统属性,不能假定它会自动读取同名环境变量。
生产数据库/Redis 凭据轮换应与服务配置更新一起安排,确认连接成功后撤销旧凭据;本次没有自行操作线上账号。同步请求和登录请求须经 HTTPS 或受保护的内部连接,不能在访问日志中记录认证头。
## 同步调用方改造
两个地址保持不变:
- `POST /apis/smtInbound/sync`
- `POST /apis/headquartersInbound/sync`
请求体和成功返回结构不变,增加 `X-Sync-Api-Key: <SYNC_API_KEY>`。密钥仅允许上述两个 POST 接口,不赋予其他接口权限。已有 `X-Access-Token` ERP 会话仍可调用。未提供认证、密钥错误或密钥未配置时返回 HTTP 401。
静态下载 `/apis/smtInbound/template`、`/apis/headquartersInbound/template` 保持匿名 GET;其他方法以及名称相似的路径不放行。`tenantClean` 现在必须登录,相关插件调用方需要携带原 ERP 会话头。
## 旧盘点客户端改造
1. 原样 POST `/apis/n2tpm/webmvc/Inventory/Login` 或 `/apis/webmvc/Inventory/Login`,继续传 USER_NAME、PASSWORD。没有 context path 的部署同样支持这两个路径。
2. 成功响应仍是 `{code, msg, data}`;`data.RESULT`、`data.USER_ID`、`data.DATA_AUTH` 保留,新增 `data.TOKEN`。
3. 后续所有查询、保存、接单、上传请求增加 `X-Inventory-Token: <data.TOKEN>`。HTTP 401 时重新登录,不能只凭 USER_ID 重试。
4. USER_ID 必须是当前登录用户;盘点单必须分配给该用户;批量 DATA 中每条操作都校验。管理员如需代盘,应先通过原 ERP 分配流程调整盘点人,不能伪造 USER_ID。
5. token 使用独立 Redis 命名空间并绝对过期,读取不会续期,不能当作 ERP 的 X-Access-Token 使用。也支持使用已有 ERP 会话调用盘点接口;同时提供两个头时优先验证盘点 token,避免身份混淆。
6. 用户被停用/删除后,即使 token 未到期,业务服务也会拒绝操作。错误密码沿用现有 ERP 的账号限流策略。
## 菜单 URL 兼容范围
支持 `{{ window._CONFIG.domianURL }}`、其单/双引号方括号形式,以及 `window.location.origin`、`window.location.host`、`window.location.protocol`。普通菜单 URL 不变。其他自定义表达式不执行,需在核实数据库菜单配置后将确实需要的非敏感值增加到 `menuUrl.js` 的显式映射。
公告展示依赖 [DOMPurify 官方发行版](https://github.com/cure53/DOMPurify/releases/tag/3.4.16)。当前使用 HTML profile,SVG/MathML/脚本等内容不保留。现有项目忽略 package-lock.json,本次遵循仓库规则,新增依赖在 package.json 中固定版本。
## H1:口令迁移实施顺序(尚未执行)
1. 先在预发布验证并扩展 password 至至少 varchar(100),增加算法标识或采用带算法前缀的存储格式;增加 must_change_password 标记。备份用户表,禁止批量覆盖旧口令。
2. 当前网页在登录、注册、改密时发送 MD5,旧盘点发送明文后由服务端转 MD5,微信绑定也用 SQL 等值比较密码。必须把验证集中到同一密码服务,覆盖所有入口和密码写入路径,不能只改 insertUser。
3. 过渡期可在服务端对旧协议的 MD5 凭据做 BCrypt,并在成功验证旧记录时有条件升级存储;明确这只改善数据库泄露风险,网络中的 MD5 仍是可重放凭据,必须配合 HTTPS。不得把 BCrypt 值写回仍按 MD5 等值比较的旧程序。
4. 新协议传原始密码并由服务端 BCrypt/Argon2 校验;使用明确协议版本区分,不根据密码是否“看起来像 MD5”猜测。提供兼容期,统计旧客户端后再停用旧协议。
5. 新建/重置用户使用单次临时随机密码或管理员指定强密码,返回一次并强制首次改密。先补管理界面的交付流程,避免用户创建成功却无法得知初始密码。旧弱口令账号的会话限制和强制改密需要前后端一起实现。
6. 回归:旧账号、新账号、改密、重置、停用、限流、默认密码提醒、注册、微信绑定/登录、旧盘点,以及并发登录时的条件升级。升级后回滚代码必须继续能验证新哈希,不能直接回滚到只支持 MD5 的旧包。
## H4/M2 后续专项范围(尚未执行)
- 框架升级先验证插件框架 2.2.1、MyBatis 扩展、Redis、Swagger 与目标 Spring/JDK 的兼容矩阵,再选择受支持目标版本,不在这次安全补丁中跨代替换依赖。
- axios/jQuery 升级需要覆盖拦截器、错误对象、上传下载、请求取消,以及打印、图片预览等依赖插件;fastjson 迁移需要验证实体绑定、日期/数值和插件序列化。
- API 权限按现有菜单/按钮建立“HTTP 方法 + 路由 + 操作权限”映射,再覆盖管理员、普通用户、租户和插件接口的正反用例;不要直接把前端菜单可见性当成完整数据授权。
## 验证方式及边界
本地验证:后端 23 个测试通过;前端 3 组安全回归通过;生产构建成功退出。前端构建仍提示资源体积超限及 sass-loader 缺失,这些警告未在本次安全修复中处理。修改文件通过 UTF-8、BOM/替换字符和 `git diff --check` 检查。
后端运行 `mvn -B test`;前端运行 `npm run test:security` 和 `npm run build`。后端测试使用真实 MyBatis XML 生成 SQL,验证 14 个 LIKE 参数不进入 SQL 文本、正常排序继续生效、注入排序不生效;认证与盘点用例使用 mock,不连接外部服务。
上线前仍需在预发布环境完成:正常 ERP 登录、入库同步、新/旧盘点登录、本人盘点单接收和保存、图片上传、查询排序、模板下载、公告展示、插件管理员操作。自测通过不能保证所有业务完全无影响,尤其是外部客户端与数据库中的自定义菜单配置。

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
-- 为“角色管理”菜单增加“权限管理”按钮权限(按钮编号 8)
-- 当前项目 Mapper 使用 tbl_function;如部署库仍使用旧表名 jsh_function,请替换表名后执行。
UPDATE `tbl_function`
SET `push_btn` = CASE
WHEN `push_btn` IS NULL OR `push_btn` = '' THEN '8'
WHEN FIND_IN_SET('8', `push_btn`) = 0 THEN CONCAT(`push_btn`, ',8')
ELSE `push_btn`
END
WHERE `number` = '000102'
AND IFNULL(`delete_flag`, '0') != '1';
-- 执行后使用 admin 登录,在“角色管理 -> 分配按钮”中,
-- 给需要管理全部菜单的角色勾选“权限管理”。

View File

@@ -0,0 +1,221 @@
-- ----------------------------
-- 生产管理模块建表脚本(P0)
-- 执行方式:在 MySQL 8.0 中执行本脚本
-- ----------------------------
-- ----------------------------
-- 1、包装BOM主表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_pack_bom`;
CREATE TABLE `jsh_pack_bom` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`bom_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方案编号',
`bom_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方案名称',
`product_material_id` bigint(0) NULL DEFAULT NULL COMMENT '待包装产品商品id',
`product_material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '待包装产品扩展id',
`product_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '待包装产品多属性',
`output_material_id` bigint(0) NULL DEFAULT NULL COMMENT '成品SKU商品id',
`output_material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '成品扩展id',
`output_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '成品多属性',
`output_number` decimal(24, 6) NULL DEFAULT NULL COMMENT '单位待包装产品产出成品数量',
`version` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'V1' COMMENT '版本',
`enabled` bit(1) NULL DEFAULT b'1' COMMENT '启用状态',
`remark` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`creator` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `product_material_id`(`product_material_id`) USING BTREE,
INDEX `output_material_id`(`output_material_id`) USING BTREE,
INDEX `tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '包装BOM主表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 2、包装BOM包材明细表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_pack_bom_item`;
CREATE TABLE `jsh_pack_bom_item` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`bom_id` bigint(0) NOT NULL COMMENT '包装BOM id',
`material_id` bigint(0) NOT NULL COMMENT '包材商品id',
`material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '商品扩展id',
`material_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '多属性',
`unit` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
`quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '用量(每产出1单位成品所需包材数量)',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `bom_id`(`bom_id`) USING BTREE,
INDEX `material_id`(`material_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '包装BOM包材明细表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 3、生产工单主表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_order`;
CREATE TABLE `jsh_production_order` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单号',
`source_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '来源类型(销售订单/手工备货)',
`source_id` bigint(0) NULL DEFAULT NULL COMMENT '来源单据id(销售订单depot_head.id)',
`source_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '来源单据号(销售订单号)',
`product_material_id` bigint(0) NULL DEFAULT NULL COMMENT '待包装产品商品id',
`product_material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '待包装产品扩展id',
`product_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '待包装产品多属性',
`bom_id` bigint(0) NULL DEFAULT NULL COMMENT '包装BOM id',
`output_material_id` bigint(0) NULL DEFAULT NULL COMMENT '成品SKU商品id',
`output_material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '成品扩展id',
`output_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '成品多属性',
`order_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '工单数量(待包装产品)',
`output_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '预计成品数量',
`finished_quantity` decimal(24, 6) NULL DEFAULT 0.000000 COMMENT '已完工良品数',
`plan_start_date` datetime(0) NULL DEFAULT NULL COMMENT '计划开工日期',
`plan_end_date` datetime(0) NULL DEFAULT NULL COMMENT '计划完工日期',
`actual_start_date` datetime(0) NULL DEFAULT NULL COMMENT '实际开工日期',
`actual_end_date` datetime(0) NULL DEFAULT NULL COMMENT '实际完工日期',
`priority` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '优先级,0普通、1紧急',
`status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态,0已创建、1已下达、2生产中、3已完工、4已关闭',
`audit_by` bigint(0) NULL DEFAULT NULL COMMENT '审批人',
`audit_time` datetime(0) NULL DEFAULT NULL COMMENT '审批时间',
`release_by` bigint(0) NULL DEFAULT NULL COMMENT '下达人',
`release_time` datetime(0) NULL DEFAULT NULL COMMENT '下达时间',
`close_reason` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关闭原因',
`remark` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`creator` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `order_number`(`order_number`) USING BTREE,
INDEX `source_number`(`source_number`) USING BTREE,
INDEX `status`(`status`) USING BTREE,
INDEX `tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '生产工单主表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 4、工单操作日志表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_order_log`;
CREATE TABLE `jsh_production_order_log` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_id` bigint(0) NULL DEFAULT NULL COMMENT '工单id',
`order_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单号',
`operation_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作类型(创建/修改/审批下达/开工/生成领料/发料/完工/关闭等)',
`operation_desc` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作描述',
`operator` bigint(0) NULL DEFAULT NULL COMMENT '操作人',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `order_id`(`order_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工单操作日志表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 5、生产领料单主表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_requisition`;
CREATE TABLE `jsh_production_requisition` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`requisition_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料单号',
`order_id` bigint(0) NULL DEFAULT NULL COMMENT '工单id',
`order_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单号',
`depot_id` bigint(0) NULL DEFAULT NULL COMMENT '发料仓库id',
`status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态,0待确认、1已发料、2已驳回',
`confirm_by` bigint(0) NULL DEFAULT NULL COMMENT '确认人',
`confirm_time` datetime(0) NULL DEFAULT NULL COMMENT '确认时间',
`remark` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`creator` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `requisition_number`(`requisition_number`) USING BTREE,
INDEX `order_id`(`order_id`) USING BTREE,
INDEX `status`(`status`) USING BTREE,
INDEX `tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '生产领料单主表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 6、生产领料单明细表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_requisition_item`;
CREATE TABLE `jsh_production_requisition_item` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`requisition_id` bigint(0) NOT NULL COMMENT '领料单id',
`depot_id` bigint(0) NULL DEFAULT NULL COMMENT '发料仓库id',
`material_id` bigint(0) NOT NULL COMMENT '物料商品id',
`material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '商品扩展id',
`material_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '多属性',
`unit` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
`required_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '申请数量(BOM定额)',
`issued_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '实发数量',
`unit_price` decimal(24, 6) NULL DEFAULT NULL COMMENT '参考单价',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `requisition_id`(`requisition_id`) USING BTREE,
INDEX `depot_id`(`depot_id`) USING BTREE,
INDEX `material_id`(`material_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '生产领料单明细表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 7、完工报告主表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_report`;
CREATE TABLE `jsh_production_report` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`report_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报告号',
`order_id` bigint(0) NULL DEFAULT NULL COMMENT '工单id',
`order_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工单号',
`finished_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '实际良品数',
`defect_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '不良品数',
`qualified_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '质检结果,0未检、1合格、2不合格',
`depot_id` bigint(0) NULL DEFAULT NULL COMMENT '入库仓库id',
`in_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产入库单号',
`audit_status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '审核状态,0待审核、1已审核、2已驳回',
`audit_by` bigint(0) NULL DEFAULT NULL COMMENT '审核人',
`audit_time` datetime(0) NULL DEFAULT NULL COMMENT '审核时间',
`report_by` bigint(0) NULL DEFAULT NULL COMMENT '报工人',
`report_date` datetime(0) NULL DEFAULT NULL COMMENT '报工日期',
`remark` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`creator` bigint(0) NULL DEFAULT NULL COMMENT '创建人',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `report_number`(`report_number`) USING BTREE,
INDEX `order_id`(`order_id`) USING BTREE,
INDEX `audit_status`(`audit_status`) USING BTREE,
INDEX `tenant_id`(`tenant_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '完工报告主表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 8、完工报告物料消耗明细表
-- ----------------------------
DROP TABLE IF EXISTS `jsh_production_report_item`;
CREATE TABLE `jsh_production_report_item` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '主键',
`report_id` bigint(0) NOT NULL COMMENT '完工报告id',
`material_id` bigint(0) NOT NULL COMMENT '物料商品id',
`material_extend_id` bigint(0) NULL DEFAULT NULL COMMENT '商品扩展id',
`material_sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '多属性',
`unit` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位',
`consumption_quantity` decimal(24, 6) NULL DEFAULT NULL COMMENT '实际消耗数量',
`remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`tenant_id` bigint(0) NULL DEFAULT NULL COMMENT '租户id',
`delete_flag` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标记,0未删除,1删除',
PRIMARY KEY (`id`) USING BTREE,
INDEX `report_id`(`report_id`) USING BTREE,
INDEX `material_id`(`material_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '完工报告物料消耗明细表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- 9、生产管理菜单(jsh_function)
-- ----------------------------
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('0901', '生产管理', '0', '/production', '/layouts/TabLayout', b'0', '0480', b'1', '电脑版', '', 'cluster', '0');
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('090101', '包装方案', '0901', '/production/pack_bom', '/production/PackBomList', b'0', '0481', b'1', '电脑版', '1,2,3', 'profile', '0');
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('090102', '生产工单', '0901', '/production/order', '/production/OrderList', b'0', '0482', b'1', '电脑版', '1,2,3', 'profile', '0');
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('090103', '领料管理', '0901', '/production/requisition', '/production/RequisitionList', b'0', '0483', b'1', '电脑版', '1,2,3', 'profile', '0');
INSERT INTO `jsh_function` (`number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('090104', '完工报工', '0901', '/production/report', '/production/ReportList', b'0', '0484', b'1', '电脑版', '1,2,3', 'profile', '0');

219
smtERP-boot/pom.xml Normal file
View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.reallin</groupId>
<artifactId>smt-erp</artifactId>
<version>1.0.0</version>
<description>smt-erp</description>
<name>smt-erp</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<mockito.version>2.28.2</mockito.version>
<byte-buddy.version>1.9.10</byte-buddy.version>
</properties>
<dependencies>
<dependency>
<groupId>com.gitee.starblues</groupId>
<artifactId>springboot-plugin-framework</artifactId>
<version>2.2.1-RELEASE</version>
</dependency>
<dependency>
<groupId>com.gitee.starblues</groupId>
<artifactId>springboot-plugin-framework-extension-mybatis</artifactId>
<version>2.2.1-RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<!--http-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
<!-- 日志 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.15.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.25</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.3.RELEASE</version>
<executions>
<execution>
<id>build-info</id>
<phase>generate-sources</phase>
<goals>
<goal>build-info</goal>
</goals>
</execution>
<execution>
<id>repackage</id>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>com.reallin.smt.ErpApplication</mainClass>
<layout>JAR</layout>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>./dist</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<configurationFile>${basedir}/src/test/resources/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,194 @@
param(
[string]$BaseUrl = 'https://sms.smt.com.my/sas/api',
[string]$DatabaseHost = '127.0.0.1',
[int]$DatabasePort = 3306,
[string]$DatabaseName = 'app072',
[string]$DatabaseUser = 'root',
[string]$MySqlPath = 'D:\Program Files\mysql\MySQL Server 8.0\bin\mysql.exe'
)
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrWhiteSpace($env:SAS_USERNAME) -or [string]::IsNullOrWhiteSpace($env:SAS_PASSWORD)) {
throw 'Please set SAS_USERNAME and SAS_PASSWORD.'
}
if ([string]::IsNullOrWhiteSpace($env:MYSQL_PWD)) {
throw 'Please set MYSQL_PWD.'
}
function ConvertTo-SqlValue($value) {
if ($null -eq $value -or [string]::IsNullOrWhiteSpace([string]$value)) { return 'NULL' }
return "'" + ([string]$value).Replace("'", "''") + "'"
}
function Limit-Text($value, [int]$length) {
if ($null -eq $value) { return $null }
$text = [string]$value
if ($text.Length -le $length) { return $text }
return $text.Substring(0, $length)
}
function ConvertTo-IsoDate($value) {
if ($null -eq $value -or [string]::IsNullOrWhiteSpace([string]$value)) { return $null }
return ([DateTime]::Parse([string]$value)).ToString('yyyy-MM-dd')
}
function Join-Present([object[]]$values, [string]$separator) {
return (($values | Where-Object { $null -ne $_ -and -not [string]::IsNullOrWhiteSpace([string]$_) }) -join $separator)
}
$loginBody = @{
username = $env:SAS_USERNAME
password = $env:SAS_PASSWORD
} | ConvertTo-Json
$login = Invoke-RestMethod -Uri "$BaseUrl/auth/login" -Method Post -ContentType 'application/json' -Body $loginBody
if (-not $login.token) { throw 'SAS login did not return a token.' }
$headers = @{ Authorization = "Bearer $($login.token)" }
$hardware = (Invoke-RestMethod -Uri "$BaseUrl/hardware?limit=9999&page=1" -Headers $headers).data
$software = (Invoke-RestMethod -Uri "$BaseUrl/software?limit=9999&page=1" -Headers $headers).data
$simCards = (Invoke-RestMethod -Uri "$BaseUrl/sim?limit=9999&page=1" -Headers $headers).data
$sql = New-Object System.Text.StringBuilder
[void]$sql.AppendLine('SET NAMES utf8mb4; START TRANSACTION;')
[void]$sql.AppendLine("SET @cat_hardware=(SELECT id FROM tbl_asset_category WHERE category_code='HARDWARE' LIMIT 1);")
[void]$sql.AppendLine("SET @cat_software=(SELECT id FROM tbl_asset_category WHERE category_code='SOFTWARE' LIMIT 1);")
[void]$sql.AppendLine("SET @cat_sim=(SELECT id FROM tbl_asset_category WHERE category_code='SIM_CARD' LIMIT 1);")
[void]$sql.AppendLine("SET @creator=(SELECT id FROM tbl_user WHERE IFNULL(delete_flag,'0')!='1' ORDER BY id LIMIT 1);")
foreach ($item in $hardware) {
$code = if ([string]::IsNullOrWhiteSpace([string]$item.asset_code)) { "SAS-HW-$($item.id)" } else { [string]$item.asset_code }
$name = Join-Present @($item.brand, $item.model) ' '
if ([string]::IsNullOrWhiteSpace($name)) { $name = Join-Present @($item.type, "硬件资产 $($item.id)") ' ' }
$specification = Limit-Text (Join-Present @(
$item.type, $item.brand, $item.model, $item.operating_system, $item.cpu,
$item.memory_capacity, $item.storage_capacity
) ' / ') 150
$status = switch ([string]$item.status) {
'Dormant' { 'IDLE' }
'Spoil' { 'REPAIR' }
'Dispose' { 'SCRAPPED' }
default { 'IN_USE' }
}
$remark = Limit-Text (Join-Present @(
$(if ($item.serial_number) { "序列号: $($item.serial_number)" }),
$(if ($item.mac_address) { "MAC: $($item.mac_address)" }),
$(if ($item.purpose) { "用途: $($item.purpose)" }),
$(if ($item.remarks) { "原备注: $($item.remarks)" })
) ';') 500
$values = @(
(ConvertTo-SqlValue (Limit-Text $code 64)),
(ConvertTo-SqlValue (Limit-Text $name 150)),
'@cat_hardware',
(ConvertTo-SqlValue '硬件资产'),
(ConvertTo-SqlValue $specification),
(ConvertTo-SqlValue '台'),
'1', '0',
(ConvertTo-SqlValue (ConvertTo-IsoDate $item.date_of_purchase)),
(ConvertTo-SqlValue (Limit-Text $item.department 100)),
(ConvertTo-SqlValue (Limit-Text $item.person_in_charge 100)),
(ConvertTo-SqlValue (Limit-Text $item.location 255)),
(ConvertTo-SqlValue $status),
(ConvertTo-SqlValue 'SAS'),
(ConvertTo-SqlValue 'HARDWARE'),
(ConvertTo-SqlValue ([string]$item.id)),
(ConvertTo-SqlValue $remark),
'@creator', "'0'", 'NOW()', 'NOW()'
) -join ','
$statement = "INSERT INTO tbl_asset " +
"(asset_code,asset_name,category_id,asset_category,specification,unit,quantity,original_value,purchase_date,use_department,keeper,location,status,source,external_source,external_id,remark,creator,delete_flag,create_time,update_time) " +
"VALUES($values) ON DUPLICATE KEY UPDATE " +
"asset_code=VALUES(asset_code),asset_name=VALUES(asset_name),category_id=VALUES(category_id)," +
"asset_category=VALUES(asset_category),specification=VALUES(specification),purchase_date=VALUES(purchase_date)," +
"use_department=VALUES(use_department),keeper=VALUES(keeper),location=VALUES(location),status=VALUES(status)," +
"remark=VALUES(remark),updater=@creator,delete_flag='0',update_time=NOW();"
[void]$sql.AppendLine($statement)
}
foreach ($item in $software) {
$code = "SAS-SW-$($item.id)"
$name = if ([string]::IsNullOrWhiteSpace([string]$item.description)) { "软件资产 $($item.id)" } else { [string]$item.description }
$specification = Limit-Text (Join-Present @($item.vendor, $item.cd_cert) ' / ') 150
$quantity = if ($null -eq $item.quantity -or [decimal]$item.quantity -le 0) { [decimal]1 } else { [decimal]$item.quantity }
$originalValue = if ($null -eq $item.price) { [decimal]0 } else { [decimal]$item.price * $quantity }
$quantityText = $quantity.ToString([System.Globalization.CultureInfo]::InvariantCulture)
$valueText = $originalValue.ToString([System.Globalization.CultureInfo]::InvariantCulture)
$remark = Limit-Text (Join-Present @(
$(if ($item.vendor) { "供应商: $($item.vendor)" }),
$(if ($item.license_key) { "许可证: $($item.license_key)" }),
$(if ($item.invoice_no) { "发票号: $($item.invoice_no)" }),
$(if ($item.remark) { "原备注: $($item.remark)" })
) ';') 500
$values = @(
(ConvertTo-SqlValue $code),
(ConvertTo-SqlValue (Limit-Text $name 150)),
'@cat_software',
(ConvertTo-SqlValue '软件资产'),
(ConvertTo-SqlValue $specification),
(ConvertTo-SqlValue '套'),
$quantityText, $valueText,
(ConvertTo-SqlValue (ConvertTo-IsoDate $item.invoice_date)),
(ConvertTo-SqlValue (Limit-Text $item.department 100)),
'NULL', 'NULL',
(ConvertTo-SqlValue 'IN_USE'),
(ConvertTo-SqlValue 'SAS'),
(ConvertTo-SqlValue 'SOFTWARE'),
(ConvertTo-SqlValue ([string]$item.id)),
(ConvertTo-SqlValue $remark),
'@creator', "'0'", 'NOW()', 'NOW()'
) -join ','
$statement = "INSERT INTO tbl_asset " +
"(asset_code,asset_name,category_id,asset_category,specification,unit,quantity,original_value,purchase_date,use_department,keeper,location,status,source,external_source,external_id,remark,creator,delete_flag,create_time,update_time) " +
"VALUES($values) ON DUPLICATE KEY UPDATE " +
"asset_name=VALUES(asset_name),category_id=VALUES(category_id),asset_category=VALUES(asset_category)," +
"specification=VALUES(specification),quantity=VALUES(quantity),original_value=VALUES(original_value)," +
"purchase_date=VALUES(purchase_date),use_department=VALUES(use_department),status=VALUES(status)," +
"remark=VALUES(remark),updater=@creator,delete_flag='0',update_time=NOW();"
[void]$sql.AppendLine($statement)
}
foreach ($item in $simCards) {
$code = if ([string]::IsNullOrWhiteSpace([string]$item.sim_number)) { "SAS-SIM-$($item.id)" } else { "SIM-$($item.sim_number)" }
$name = if ([string]::IsNullOrWhiteSpace([string]$item.sim_number)) { "SIM卡 $($item.id)" } else { "SIM卡 $($item.sim_number)" }
$specification = Limit-Text (Join-Present @($item.ip_address, $item.comm_device, $item.comm_device_serial) ' / ') 150
$status = if ([string]$item.status -eq 'Eliminated') { 'SCRAPPED' } else { 'IN_USE' }
$remark = Limit-Text (Join-Present @(
$(if ($item.comm_device_serial) { "设备序列号: $($item.comm_device_serial)" }),
$(if ($item.meter_serial) { "电表序列号: $($item.meter_serial)" }),
$(if ($item.duration) { "使用期限: $($item.duration)" }),
$(if ($item.date_activation) { "启用日期: $(ConvertTo-IsoDate $item.date_activation)" })
) ';') 500
$values = @(
(ConvertTo-SqlValue (Limit-Text $code 64)),
(ConvertTo-SqlValue (Limit-Text $name 150)),
'@cat_sim',
(ConvertTo-SqlValue 'SIM卡'),
(ConvertTo-SqlValue $specification),
(ConvertTo-SqlValue '张'),
'1', '0',
(ConvertTo-SqlValue (ConvertTo-IsoDate $item.date_activation)),
'NULL',
(ConvertTo-SqlValue (Limit-Text $item.owner 100)),
(ConvertTo-SqlValue (Limit-Text $item.location 255)),
(ConvertTo-SqlValue $status),
(ConvertTo-SqlValue 'SAS'),
(ConvertTo-SqlValue 'SIM'),
(ConvertTo-SqlValue ([string]$item.id)),
(ConvertTo-SqlValue $remark),
'@creator', "'0'", 'NOW()', 'NOW()'
) -join ','
$statement = "INSERT INTO tbl_asset " +
"(asset_code,asset_name,category_id,asset_category,specification,unit,quantity,original_value,purchase_date,use_department,keeper,location,status,source,external_source,external_id,remark,creator,delete_flag,create_time,update_time) " +
"VALUES($values) ON DUPLICATE KEY UPDATE " +
"asset_code=VALUES(asset_code),asset_name=VALUES(asset_name),category_id=VALUES(category_id)," +
"asset_category=VALUES(asset_category),specification=VALUES(specification),purchase_date=VALUES(purchase_date)," +
"keeper=VALUES(keeper),location=VALUES(location),status=VALUES(status),remark=VALUES(remark)," +
"updater=@creator,delete_flag='0',update_time=NOW();"
[void]$sql.AppendLine($statement)
}
[void]$sql.AppendLine('COMMIT;')
$OutputEncoding = New-Object System.Text.UTF8Encoding($false)
$sql.ToString() | & $MySqlPath -h $DatabaseHost -P $DatabasePort -u $DatabaseUser -D $DatabaseName --default-character-set=utf8mb4
if ($LASTEXITCODE -ne 0) { throw "MySQL synchronization failed with exit code $LASTEXITCODE." }
Write-Output "SYNCED hardware=$($hardware.Count) software=$($software.Count) sim=$($simCards.Count)"

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
http://maven.apache.org/xsd/assembly-1.1.0.xsd ">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/target</directory>
<includes>
<include>*.jar</include>
</includes>
<outputDirectory>/lib</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>*.properties</include>
<include>*.yml</include>
<include>*.yaml</include>
<include>*.xml</include>
</includes>
<outputDirectory>/config</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/bin</directory>
<outputDirectory>/bin</outputDirectory>
<includes>
<include>run-manage.sh</include>
</includes>
<lineEnding>lf</lineEnding>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/bin/</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>start.bat</include>
<include>restart.sh</include>
<include>start.sh</include>
<include>stop.sh</include>
<include>status.sh</include>
</includes>
</fileSet>
<fileSet>
<directory>docs</directory>
<outputDirectory>/docs</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>*.md</include>
<include>*.txt</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1 @@
./bin/run-manage.sh restart

View File

@@ -0,0 +1,133 @@
#!/bin/bash
SERVER_NAME=jshERP
readonly APP_HOME=${FILE_PATH:-$(dirname $(cd `dirname $0`; pwd))}
#readonly JAVA_HOME=""
readonly CONFIG_HOME="$APP_HOME/config/"
readonly LIB_HOME="$APP_HOME/lib"
readonly LOGS_HOME="$APP_HOME/logs"
readonly PID_FILE="$LOGS_HOME/application.pid"
readonly APP_MAIN_CLASS="jshERP.jar"
readonly LOG_CONFIG="$CONFIG_HOME/logback-spring.xml"
readonly JAVA_RUN="-Dlogs.home=$LOGS_HOME -Dlogging.config=$LOG_CONFIG -Dspring.config.location=file:$CONFIG_HOME -Dspring.pid.file=$PID_FILE -Dspring.pid.fail-on-write-error=true"
readonly JAVA_OPTS="-server -Xms128m -Xmx320m -XX:PermSize=128M -XX:MaxPermSize=256M $JAVA_RUN"
readonly JAVA="java"
PID=0
if [ ! -x "$LOGS_HOME" ]
then
mkdir $LOGS_HOME
fi
chmod +x -R "$JAVA_HOME/bin/"
functions="/etc/functions.sh"
if test -f $functions ; then
. $functions
else
success()
{
echo " SUCCESS! $@"
}
failure()
{
echo " ERROR! $@"
}
warning()
{
echo "WARNING! $@"
}
fi
function checkpid() {
PID=$(ps -ef | grep $APP_MAIN_CLASS | grep -v 'grep' | awk '{print int($2)}')
if [[ -n "$PID" ]]
then
return 0
else
return 1
fi
}
function start() {
checkpid
if [[ $? -eq 0 ]]
then
warning "[$APP_MAIN_CLASS]: already started! (PID=$PID)"
else
echo -n "[$APP_MAIN_CLASS]: Starting ..."
JAVA_CMD="nohup $JAVA $JAVA_OPTS -jar $LIB_HOME/$APP_MAIN_CLASS > /dev/null 2>&1 &"
# echo "Exec cmmand : $JAVA_CMD"
sh -c "$JAVA_CMD"
sleep 3
checkpid
if [[ $? -eq 0 ]]
then
success "(PID=$PID) "
else
failure " "
fi
fi
}
function stop() {
checkpid
if [[ $? -eq 0 ]];
then
echo -n "[$APP_MAIN_CLASS]: Shutting down ...(PID=$PID) "
kill -9 $PID
if [[ $? -eq 0 ]];
then
echo 0 > $PID_FILE
success " "
else
failure " "
fi
else
warning "[$APP_MAIN_CLASS]: is not running ..."
fi
}
function status() {
checkpid
if [[ $? -eq 0 ]]
then
success "[$APP_MAIN_CLASS]: is running! (PID=$PID)"
return 0
else
failure "[$APP_MAIN_CLASS]: is not running"
return 1
fi
}
function info() {
echo "System Information:"
echo
echo "****************************"
echo `head -n 1 /etc/issue`
echo `uname -a`
echo
echo "JAVA_HOME=$JAVA_HOME"
echo
echo "JAVA Environment Information:"
echo `$JAVA -version`
echo
echo "APP_HOME=$APP_HOME"
echo "APP_MAIN_CLASS=$APP_MAIN_CLASS"
echo
echo "****************************"
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'status')
status
;;
'info')
info
;;
*)
echo "Usage: $0 {help|start|stop|restart|status|info}"
;;
esac
exit 0

View File

@@ -0,0 +1,6 @@
@echo off
title jshERP
java -Xms1000m -Xmx2000m -jar .\lib\jshERP.jar
pause over

View File

@@ -0,0 +1 @@
./bin/run-manage.sh start

View File

@@ -0,0 +1 @@
./bin/run-manage.sh status

View File

@@ -0,0 +1 @@
./bin/run-manage.sh stop

View File

@@ -0,0 +1,28 @@
package com.reallin.smt;
import com.reallin.smt.utils.ComputerInfo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.IOException;
@SpringBootApplication
@MapperScan("com.reallin.smt.datasource.mappers")
@ServletComponentScan
@EnableScheduling
@EnableAsync
public class ErpApplication{
public static void main(String[] args) throws IOException {
ConfigurableApplicationContext context = SpringApplication.run(ErpApplication.class, args);
Environment environment = context.getBean(Environment.class);
System.out.println("启动成功,后端服务API地址:http://" + ComputerInfo.getIpAddr() + ":"
+ environment.getProperty("server.port") + "/jshERP-boot/doc.html");
System.out.println("您还需启动前端服务,启动命令:yarn run serve 或 npm run serve,测试用户:admin,密码:123456");
}
}

View File

@@ -0,0 +1,164 @@
package com.reallin.smt.aspect;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.reallin.smt.datasource.entities.Log;
import com.reallin.smt.service.LogService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.Tools;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.CodeSignature;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.validation.BindingResult;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
/**
* 统一记录 Controller 的 URL、入参和出参。
*/
@Aspect
@Component
public class ApiLogAspect {
private static final int MAX_TEXT_LENGTH = 20000;
private static final String MASKED = "******";
private static final ValueFilter SENSITIVE_VALUE_FILTER = (object, name, value) ->
isSensitive(name) ? MASKED : value;
@Resource
private LogService logService;
@Resource
private UserService userService;
@Around("execution(public * com.reallin.smt.controller..*(..)) && " +
"!within(com.reallin.smt.controller.LogController)")
public Object recordApiLog(ProceedingJoinPoint joinPoint) throws Throwable {
HttpServletRequest request = currentRequest(joinPoint.getArgs());
Object result = null;
Throwable failure = null;
try {
result = joinPoint.proceed();
return result;
} catch (Throwable throwable) {
failure = throwable;
throw throwable;
} finally {
if (request != null) {
saveLog(joinPoint, request, result, failure);
}
}
}
private void saveLog(ProceedingJoinPoint joinPoint, HttpServletRequest request,
Object result, Throwable failure) {
try {
Log log = new Log();
try {
log.setUserId(userService.getUserId(request));
} catch (Exception ignored) {
// 登录等匿名接口允许 user_id 为空。
}
log.setOperation("接口日志");
log.setContent(joinPoint.getSignature().toShortString());
log.setClientIp(Tools.getLocalIp(request));
log.setCreateTime(new Date());
log.setStatus((byte) (failure == null ? 0 : 1));
log.setRequestUrl(buildRequestUrl(request));
log.setRequestParams(toJson(buildArguments(joinPoint)));
log.setResponseParams(failure == null
? toJson(result)
: limit(failure.getClass().getName() + ": " + failure.getMessage()));
logService.insertApiLog(log);
} catch (Exception e) {
LoggerFactory.getLogger(ApiLogAspect.class).warn("采集接口请求日志失败", e);
}
}
private HttpServletRequest currentRequest(Object[] arguments) {
for (Object argument : arguments) {
if (argument instanceof HttpServletRequest) {
return (HttpServletRequest) argument;
}
}
ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return attributes == null ? null : attributes.getRequest();
}
private String buildRequestUrl(HttpServletRequest request) {
return limit(request.getMethod() + " " + request.getRequestURI());
}
private Map<String, Object> buildArguments(ProceedingJoinPoint joinPoint) {
String[] names = ((CodeSignature) joinPoint.getSignature()).getParameterNames();
Object[] values = joinPoint.getArgs();
Map<String, Object> arguments = new LinkedHashMap<>();
for (int i = 0; i < values.length; i++) {
Object value = values[i];
if (value instanceof ServletRequest || value instanceof ServletResponse
|| value instanceof BindingResult) {
continue;
}
String name = names != null && names.length > i ? names[i] : "arg" + i;
if (value instanceof MultipartFile) {
MultipartFile file = (MultipartFile) value;
Map<String, Object> fileInfo = new LinkedHashMap<>();
fileInfo.put("name", file.getOriginalFilename());
fileInfo.put("size", file.getSize());
arguments.put(name, fileInfo);
} else {
arguments.put(name, value);
}
}
return arguments;
}
private String toJson(Object value) {
if (value == null) {
return null;
}
try {
if (value instanceof String) {
String text = ((String) value).trim();
if ((text.startsWith("{") && text.endsWith("}"))
|| (text.startsWith("[") && text.endsWith("]"))) {
return limit(JSON.toJSONString(JSON.parse(text), SENSITIVE_VALUE_FILTER));
}
}
return limit(JSON.toJSONString(value, SENSITIVE_VALUE_FILTER));
} catch (Exception e) {
return limit(String.valueOf(value));
}
}
private String limit(String value) {
if (value == null || value.length() <= MAX_TEXT_LENGTH) {
return value;
}
return value.substring(0, MAX_TEXT_LENGTH) + "...[已截断]";
}
private static boolean isSensitive(String name) {
if (name == null) {
return false;
}
String normalized = name.toLowerCase(Locale.ROOT);
return normalized.contains("password") || normalized.contains("passwd")
|| normalized.contains("pwd") || normalized.contains("token")
|| normalized.contains("secret") || normalized.contains("authorization");
}
}

View File

@@ -0,0 +1,228 @@
package com.reallin.smt.base;
import com.reallin.smt.utils.StringUtil;
import java.util.HashMap;
import java.util.Objects;
/**
* 操作消息提醒
*
* @author ji-sheng-hua
*/
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* 状态类型
*/
public enum Type
{
/** 成功 */
SUCCESS(0),
/** 警告 */
WARN(301),
/** 错误 */
ERROR(500);
private final int value;
Type(int value)
{
this.value = value;
}
public int value()
{
return this.value;
}
}
/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public AjaxResult()
{
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param type 状态类型
* @param msg 返回内容
*/
public AjaxResult(Type type, String msg)
{
super.put(CODE_TAG, type.value);
super.put(MSG_TAG, msg);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param type 状态类型
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(Type type, String msg, Object data)
{
super.put(CODE_TAG, type.value);
super.put(MSG_TAG, msg);
if (StringUtil.isNotNull(data))
{
super.put(DATA_TAG, data);
}
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public static AjaxResult success()
{
return AjaxResult.success("操作成功");
}
/**
* 返回成功数据
*
* @return 成功消息
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @return 成功消息
*/
public static AjaxResult success(String msg)
{
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data)
{
return new AjaxResult(Type.SUCCESS, msg, data);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult warn(String msg)
{
return AjaxResult.warn(msg, null);
}
/**
* 返回警告消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult warn(String msg, Object data)
{
return new AjaxResult(Type.WARN, msg, data);
}
/**
* 返回错误消息
*
* @return
*/
public static AjaxResult error()
{
return AjaxResult.error("操作失败");
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult error(String msg)
{
return AjaxResult.error(msg, null);
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(Type.ERROR, msg, data);
}
/**
* 是否为成功消息
*
* @return 结果
*/
public boolean isSuccess()
{
return Objects.equals(Type.SUCCESS.value, this.get(CODE_TAG));
}
/**
* 是否为警告消息
*
* @return 结果
*/
public boolean isWarn()
{
return Objects.equals(Type.WARN.value, this.get(CODE_TAG));
}
/**
* 是否为错误消息
*
* @return 结果
*/
public boolean isError()
{
return Objects.equals(Type.ERROR.value, this.get(CODE_TAG));
}
/**
* 方便链式调用
*
* @param key 键
* @param value 值
* @return 数据对象
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}

View File

@@ -0,0 +1,158 @@
package com.reallin.smt.base;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.reallin.smt.utils.PageUtils;
import com.reallin.smt.utils.ServletUtils;
import com.reallin.smt.utils.SqlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* web层通用数据处理
*
* @author ji-sheng-hua
*/
public class BaseController
{
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 设置请求分页数据
*/
protected void startPage()
{
PageUtils.startPage();
}
/**
* 设置请求排序数据
*/
protected void startOrderBy()
{
PageDomain pageDomain = TableSupport.buildPageRequest();
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
{
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
PageHelper.orderBy(orderBy);
}
}
/**
* 清理分页的线程变量
*/
protected void clearPage()
{
PageUtils.clearPage();
}
/**
* 获取request
*/
public HttpServletRequest getRequest()
{
return ServletUtils.getRequest();
}
/**
* 获取response
*/
public HttpServletResponse getResponse()
{
return ServletUtils.getResponse();
}
/**
* 获取session
*/
public HttpSession getSession()
{
return getRequest().getSession();
}
/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
Map<String, Object> data = new HashMap<>();
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(200);
data.put("rows", list);
data.put("total", new PageInfo(list).getTotal());
rspData.setData(data);
return rspData;
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? success() : error();
}
/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/**
* 返回成功
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
* 返回失败消息
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
* 返回成功数据
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
}

View File

@@ -0,0 +1,87 @@
package com.reallin.smt.base;
import com.reallin.smt.utils.StringUtil;
/**
* 分页数据
*
* @author ji-sheng-hua
*/
public class PageDomain
{
/** 当前记录起始索引 */
private Integer currentPage;
/** 每页显示记录数 */
private Integer pageSize;
/** 排序列 */
private String orderByColumn;
/** 排序的方向desc或者asc */
private String isAsc = "asc";
/** 分页参数合理化 */
private Boolean reasonable = true;
public String getOrderBy()
{
if (StringUtil.isEmpty(orderByColumn))
{
return "";
}
return StringUtil.toUnderScoreCase(orderByColumn) + " " + isAsc;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getPageSize()
{
return pageSize;
}
public void setPageSize(Integer pageSize)
{
this.pageSize = pageSize;
}
public String getOrderByColumn()
{
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn)
{
this.orderByColumn = orderByColumn;
}
public String getIsAsc()
{
return isAsc;
}
public void setIsAsc(String isAsc)
{
this.isAsc = isAsc;
}
public Boolean getReasonable()
{
if (StringUtil.isNull(reasonable))
{
return Boolean.TRUE;
}
return reasonable;
}
public void setReasonable(Boolean reasonable)
{
this.reasonable = reasonable;
}
}

View File

@@ -0,0 +1,44 @@
package com.reallin.smt.base;
import java.io.Serializable;
/**
* 表格分页数据对象
*
* @author ji-sheng-hua
*/
public class TableDataInfo implements Serializable
{
private static final long serialVersionUID = 1L;
/** 消息状态码 */
private int code;
/** 消息状态码 */
private Object data;
/**
* 表格数据对象
*/
public TableDataInfo()
{
}
public int getCode()
{
return code;
}
public void setCode(int code)
{
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

View File

@@ -0,0 +1,56 @@
package com.reallin.smt.base;
import com.reallin.smt.utils.Convert;
import com.reallin.smt.utils.ServletUtils;
/**
* 表格数据处理
*
* @author ji-sheng-hua
*/
public class TableSupport
{
/**
* 当前记录起始索引
*/
public static final String CURRENT_PAGE = "currentPage";
/**
* 每页显示记录数
*/
public static final String PAGE_SIZE = "pageSize";
/**
* 排序列
*/
public static final String ORDER_BY_COLUMN = "orderByColumn";
/**
* 排序的方向 "desc" 或者 "asc".
*/
public static final String IS_ASC = "isAsc";
/**
* 分页参数合理化
*/
public static final String REASONABLE = "reasonable";
/**
* 封装分页对象
*/
public static PageDomain getPageDomain()
{
PageDomain pageDomain = new PageDomain();
pageDomain.setCurrentPage(Convert.toInt(ServletUtils.getParameter(CURRENT_PAGE), 1));
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
return pageDomain;
}
public static PageDomain buildPageRequest()
{
return getPageDomain();
}
}

View File

@@ -0,0 +1,24 @@
package com.reallin.smt.config;
import com.gitee.starblues.extension.mybatis.SpringBootMybatisExtension;
import com.gitee.starblues.integration.application.AutoPluginApplication;
import com.gitee.starblues.integration.application.PluginApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author: jishenghua
* @Version: 1.0
* @Create Date Time: 2019-05-30 15:53
* @Update Date Time:
* @see
*/
@Configuration
public class PluginBeanConfig {
@Bean
public PluginApplication pluginApplication(){
PluginApplication pluginApplication = new AutoPluginApplication();
pluginApplication.addExtension(new SpringBootMybatisExtension());
return pluginApplication;
}
}

View File

@@ -0,0 +1,104 @@
package com.reallin.smt.config;
import com.gitee.starblues.integration.DefaultIntegrationConfiguration;
import org.pf4j.RuntimeMode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Description:
* @Author: jishenghua
* @Version: 1.0
* @Create Date Time: 2019-05-25 12:36
* @Update Date Time:
* @see
*/
@Component
@ConfigurationProperties(prefix = "plugin")
public class PluginConfiguration extends DefaultIntegrationConfiguration {
/**
* 运行模式
* 开发环境: development、dev
* 生产/部署 环境: deployment、prod
*/
@Value("${runMode:dev}")
private String runMode;
@Value("${pluginPath:plugins}")
private String pluginPath;
@Value("${pluginConfigFilePath:pluginConfigs}")
private String pluginConfigFilePath;
@Override
public RuntimeMode environment() {
return RuntimeMode.byName(runMode);
}
@Override
public String pluginPath() {
return pluginPath;
}
@Override
public String pluginConfigFilePath() {
return pluginConfigFilePath;
}
@Override
public String uploadTempPath() {
return "temp";
}
@Override
public String backupPath() {
return "backupPlugin";
}
@Override
public String pluginRestControllerPathPrefix() {
return "/api/plugin";
}
@Override
public boolean enablePluginIdRestControllerPathPrefix() {
return true;
}
public String getRunMode() {
return runMode;
}
public void setRunMode(String runMode) {
this.runMode = runMode;
}
public String getPluginPath() {
return pluginPath;
}
public void setPluginPath(String pluginPath) {
this.pluginPath = pluginPath;
}
public String getPluginConfigFilePath() {
return pluginConfigFilePath;
}
public void setPluginConfigFilePath(String pluginConfigFilePath) {
this.pluginConfigFilePath = pluginConfigFilePath;
}
@Override
public String toString() {
return "PluginArgConfiguration{" +
"runMode='" + runMode + '\'' +
", pluginPath='" + pluginPath + '\'' +
", pluginConfigFilePath='" + pluginConfigFilePath + '\'' +
'}';
}
}

View File

@@ -0,0 +1,44 @@
package com.reallin.smt.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* 插件集成配置
*
* @author jishenghua
* @version 1.0
*/
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(this.apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("SMT Restful Api")
.description("SMT接口描述")
.termsOfServiceUrl("http://127.0.0.1")
.contact(new Contact("jishenghua", "", ""))
.version("3.0")
.build();
}
}

View File

@@ -0,0 +1,38 @@
package com.reallin.smt.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
@Service
public class TenantConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
/**
* 相当于顶部的:
* {@code @MapperScan("com.reallin.smt.datasource.mappers*")}
* 这里可以扩展,比如使用配置文件来配置扫描Mapper的路径
*/
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
scannerConfigurer.setBasePackage("com.reallin.smt.datasource.mappers*");
return scannerConfigurer;
}
/**
* 性能分析拦截器,不建议生产使用
*/
// @Bean
// public PerformanceInterceptor performanceInterceptor(){
// return new PerformanceInterceptor();
// }
}

View File

@@ -0,0 +1,288 @@
package com.reallin.smt.constants;
/**
* @ClassName:BusinessConstants
* @Description 业务字典类
* @Author qiankunpingtai
* @Date 2019-3-6 17:58
* @Version 1.0
**/
public class BusinessConstants {
/**
* 默认的日期格式
*/
public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 一天的初始时间
*/
public static final String DAY_FIRST_TIME = " 00:00:00";
/**
* 一天的结束时间
*/
public static final String DAY_LAST_TIME = " 23:59:59";
/**
* 默认的分页起始页页码
*/
public static final Integer DEFAULT_PAGINATION_PAGE_NUMBER = 1;
/**
* 无数据时列表返回的默认数据条数
*/
public static final Long DEFAULT_LIST_NULL_NUMBER = 0L;
/**
* 默认的分页条数
*/
public static final Integer DEFAULT_PAGINATION_PAGE_SIZE = 10;
/**
* 单据主表出入库类型 type 入库 出库 其它
* depothead
* */
public static final String DEPOTHEAD_TYPE_IN = "入库";
public static final String DEPOTHEAD_TYPE_OUT = "出库";
public static final String DEPOTHEAD_TYPE_OTHER = "其它";
/**
* 付款类型 payType //现付/预付款
* */
public static final String PAY_TYPE_PREPAID = "预付款";
public static final String PAY_TYPE_BY_CASH = "现付";
/**
* 删除标记 deleteFlag '0'未删除 '1'已删除
* */
public static final String DELETE_FLAG_DELETED = "1";
public static final String DELETE_FLAG_EXISTS = "0";
/**
* 是否卖出 isSell '0'未卖出 '1'已卖出
* */
public static final String IS_SELL_SELLED = "1";
public static final String IS_SELL_HOLD = "0";
/**
* 商品是否开启序列号标识enableSerialNumber '0'未启用 '1'启用
* */
public static final String ENABLE_SERIAL_NUMBER_ENABLED = "1";
public static final String ENABLE_SERIAL_NUMBER_NOT_ENABLED = "0";
/**
* 商品是否开启批号标识enableBatchNumber '0'未启用 '1'启用
* */
public static final String ENABLE_BATCH_NUMBER_ENABLED = "1";
public static final String ENABLE_BATCH_NUMBER_NOT_ENABLED = "0";
/**
* 单据状态 billsStatus '0'未审核 '1'审核 '2'完成采购|销售 '3'部分采购|销售
* */
public static final String BILLS_STATUS_UN_AUDIT = "0";
public static final String BILLS_STATUS_AUDIT = "1";
public static final String BILLS_STATUS_SKIPED = "2";
public static final String BILLS_STATUS_SKIPING = "3";
/**
* 单据-采购状态 purchaseStatus '0'未采购、'2'完成采购、'3'部分采购
* */
public static final String PURCHASE_STATUS_UN_AUDIT = "0";
public static final String PURCHASE_STATUS_SKIPED = "2";
public static final String PURCHASE_STATUS_SKIPING = "3";
/**
* 出入库分类
* 请购单、采购、采购退货、其它、零售、销售、调拨、盘点复盘等
* */
public static final String SUB_TYPE_PURCHASE_APPLY = "请购单";
public static final String SUB_TYPE_PURCHASE_ORDER = "采购订单";
public static final String SUB_TYPE_PURCHASE = "采购";
public static final String SUB_TYPE_PURCHASE_RETURN = "采购退货";
public static final String SUB_TYPE_OTHER = "其它";
public static final String SUB_TYPE_RETAIL = "零售";
public static final String SUB_TYPE_RETAIL_RETURN = "零售退货";
public static final String SUB_TYPE_SALES_ORDER = "销售订单";
public static final String SUB_TYPE_SALES = "销售";
public static final String SUB_TYPE_SALES_RETURN = "销售退货";
public static final String SUB_TYPE_TRANSFER = "调拨";
public static final String SUB_TYPE_CHECK_ENTER = "盘点录入";
public static final String SUB_TYPE_REPLAY = "盘点复盘";
public static final String SUB_TYPE_ASSEMBLE = "组装单";
public static final String SUB_TYPE_DISASSEMBLE = "拆卸单";
/**
* 生产类型分类
* 生产领料出库
* */
public static final String SUB_TYPE_PRODUCE_REQUISITION = "生产领料";
/**
* 生产工单状态
* 0已创建、1已下达、2生产中、3已完工、4已关闭
* */
public static final String PRODUCTION_ORDER_STATUS_CREATED = "0";
public static final String PRODUCTION_ORDER_STATUS_RELEASED = "1";
public static final String PRODUCTION_ORDER_STATUS_PRODUCING = "2";
public static final String PRODUCTION_ORDER_STATUS_FINISHED = "3";
public static final String PRODUCTION_ORDER_STATUS_CLOSED = "4";
/**
* 生产领料单状态
* 0待确认、1已发料、2已驳回
* */
public static final String PRODUCTION_REQUISITION_STATUS_WAIT = "0";
public static final String PRODUCTION_REQUISITION_STATUS_ISSUED = "1";
public static final String PRODUCTION_REQUISITION_STATUS_REJECT = "2";
/**
* 完工报告审核状态
* 0待审核、1已审核、2已驳回
* */
public static final String PRODUCTION_REPORT_AUDIT_WAIT = "0";
public static final String PRODUCTION_REPORT_AUDIT_PASS = "1";
public static final String PRODUCTION_REPORT_AUDIT_REJECT = "2";
/**
* 生产类型分类
* 生产入库
* */
public static final String BILL_TYPE_PRODUCE_IN = "生产入库";
/**
* 财务单据分类
* 收款、付款、转账
* */
public static final String TYPE_MONEY_IN = "收款";
public static final String TYPE_MONEY_OUT = "付款";
public static final String TYPE_GIRO = "转账";
/**
* 批量插入sql时最大的数据条数
* */
public static final int BATCH_INSERT_MAX_NUMBER = 500;
/**
* sequence名称
* */
//sequence返回字符串的最小长度
public static final Long SEQ_TO_STRING_MIN_LENGTH = 10000000000L;
//sequence长度小于基准长度时前追加基础值
public static final String SEQ_TO_STRING_LESS_INSERT = "0";
//单据编号
public static final String DEPOT_NUMBER_SEQ = "depot_number_seq";
/**
* 商品类别根目录id
* */
/**
* create by: qiankunpingtai
* create time: 2019/3/14 11:41
* description:
* 为了使用户可以自己建初始目录,设定根目录的父级目录id为-1
*
*/
public static final Long MATERIAL_CATEGORY_ROOT_PARENT_ID = -1L;
/**
* 商品类别状态
* 0系统默认,1启用,2删除
* */
public static final String MATERIAL_CATEGORY_STATUS_DEFAULT = "0";
public static final String MATERIAL_CATEGORY_STATUS_ENABLE = "1";
public static final String MATERIAL_CATEGORY_STATUS_DELETE = "2";
/**
* 部门状态
* 1未营业、2正常营业、3暂停营业、4终止营业,5已除名
* */
public static final String ORGANIZATION_STCD_NOT_OPEN = "1";
public static final String ORGANIZATION_STCD_OPEN = "2";
public static final String ORGANIZATION_STCD_BUSINESS_SUSPENDED = "3";
public static final String ORGANIZATION_STCD_BUSINESS_TERMINATED = "4";
public static final String ORGANIZATION_STCD_REMOVED = "5";
/**
* 根部门父级编号
* 根机父级构编号默认为-1
* */
public static final String ORGANIZATION_ROOT_PARENT_NO = "-1";
/**
* 新增用户默认密码
* */
public static final String USER_DEFAULT_PASSWORD = "123456";
/**
* 用户是否系统自带
* 0、非系统自带,1系统自带
* */
public static final byte USER_NOT_SYSTEM = 0;
public static final byte USER_IS_SYSTEM = 1;
/**
* 用户是否为管理者
* 0、管理者,1员工
* */
public static final byte USER_IS_MANAGER = 0;
public static final byte USER_NOT_MANAGER = 1;
/**
* 用户状态
* 0:正常,2封禁
* */
public static final byte USER_STATUS_NORMAL = 0;
public static final byte USER_STATUS_BANNED = 2;
/**
* 日志操作
* 新增、修改、删除、登录、导入
* */
public static final String LOG_OPERATION_TYPE_ADD = "新增";
public static final String LOG_OPERATION_TYPE_BATCH_ADD = "批量新增";
public static final String LOG_OPERATION_TYPE_EDIT = "修改";
public static final String LOG_OPERATION_TYPE_DELETE = "删除";
public static final String LOG_OPERATION_TYPE_LOGIN = "登录";
public static final String LOG_OPERATION_TYPE_IMPORT = "导入";
public static final String LOG_OPERATION_TYPE_ENABLED = "更新状态";
/**
* 数据数量单位
* 条
* */
public static final String LOG_DATA_UNIT = "条";
/**
* 删除类型
* 1正常删除
* 2强制删除
* */
public static final String DELETE_TYPE_NORMAL = "1";
public static final String DELETE_TYPE_FORCE = "2";
/**
* 默认管理员账号
*/
public static final String DEFAULT_MANAGER = "admin";
/**
* 权限管理按钮所属菜单地址
*/
public static final String PERMISSION_MANAGEMENT_URL = "/system/role";
/**
* 权限管理按钮编号
*/
public static final String PERMISSION_MANAGEMENT_BUTTON = "8";
public static final String ROLE_TYPE_PRIVATE = "个人数据";
public static final String ROLE_TYPE_THIS_ORG = "本部门数据";
public static final String ROLE_TYPE_PUBLIC = "全部数据";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/**
* redis相关
* */
//session的生命周期,秒
public static final Long MAX_SESSION_IN_SECONDS=60*60*24*3L;
/**
* 验证码 redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/**
* 验证码有效期(分钟)
*/
public static final Integer CAPTCHA_EXPIRATION = 2;
/**
* 微信登录接口
*/
public static final String WEIXIN_LOGIN = "/sns/jscode2session";
/**
* 微信获取token接口
*/
public static final String WEIXIN_TOKEN = "/cgi-bin/token";
/**
* 微信发送订阅消息接口
*/
public static final String WEIXIN_MESSAGE_SEND = "/cgi-bin/message/subscribe/send";
}

View File

@@ -0,0 +1,633 @@
package com.reallin.smt.constants;
import com.alibaba.fastjson.JSONObject;
public class ExceptionConstants {
/**
* code 格式 type+五位数字,例如3500000
* ResourceInfo(value = "inOutItem", type = 35)
*
* */
public static final String GLOBAL_RETURNS_CODE = "code";
public static final String GLOBAL_RETURNS_MESSAGE = "msg";
public static final String GLOBAL_RETURNS_DATA = "data";
/**
* 正常返回/操作成功
**/
public static final int SERVICE_SUCCESS_CODE = 200;
public static final String SERVICE_SUCCESS_MSG = "操作成功";
/**
* 数据查询异常
*/
public static final int DATA_READ_FAIL_CODE = 300;
public static final String DATA_READ_FAIL_MSG = "数据查询异常";
/**
* 数据写入异常
*/
public static final int DATA_WRITE_FAIL_CODE = 301;
public static final String DATA_WRITE_FAIL_MSG = "数据写入异常";
/**
* 系统运行时未知错误
**/
public static final int SERVICE_SYSTEM_ERROR_CODE = 500;
public static final String SERVICE_SYSTEM_ERROR_MSG = "未知异常";
/**
* 检测到存在依赖数据,是否强制删除?
**/
public static final int DELETE_FORCE_CONFIRM_CODE = 601;
public static final String DELETE_FORCE_CONFIRM_MSG = "检测到存在依赖数据,不能删除!";
/**
* 文件扩展名必须为xls
**/
public static final int FILE_EXTENSION_ERROR_CODE = 701;
public static final String FILE_EXTENSION_ERROR_MSG = "文件扩展名必须为xls";
/**
* 用户信息
* type = 5
* */
//添加用户信息失败
public static final int USER_ADD_FAILED_CODE = 500000;
public static final String USER_ADD_FAILED_MSG = "添加用户信息失败";
//删除用户信息失败
public static final int USER_DELETE_FAILED_CODE = 500001;
public static final String USER_DELETE_FAILED_MSG = "删除用户信息失败";
//修改用户信息失败
public static final int USER_EDIT_FAILED_CODE = 500002;
public static final String USER_EDIT_FAILED_MSG = "修改用户信息失败";
//登录名已存在
public static final int USER_LOGIN_NAME_ALREADY_EXISTS_CODE = 500003;
public static final String USER_LOGIN_NAME_ALREADY_EXISTS_MSG = "登录名在本系统已存在";
//用户录入数量超出限制
public static final int USER_OVER_LIMIT_FAILED_CODE = 500004;
public static final String USER_OVER_LIMIT_FAILED_MSG = "用户录入数量超出限制,请联系平台管理员";
//此用户名限制使用
public static final int USER_NAME_LIMIT_USE_CODE = 500005;
public static final String USER_NAME_LIMIT_USE_MSG = "此用户名限制使用";
//启用的用户数量超出限制
public static final int USER_ENABLE_OVER_LIMIT_FAILED_CODE = 500006;
public static final String USER_ENABLE_OVER_LIMIT_FAILED_MSG = "启用的用户数量超出限制,请联系平台管理员";
//租户不能被删除
public static final int USER_LIMIT_TENANT_DELETE_CODE = 500008;
public static final String USER_LIMIT_TENANT_DELETE_MSG = "抱歉,租户不能被删除";
//当前部门已经存在经理
public static final int USER_LEADER_IS_EXIST_CODE = 500009;
public static final String USER_LEADER_IS_EXIST_MSG = "抱歉,当前部门已经存在经理";
//验证码错误
public static final int USER_JCAPTCHA_ERROR_CODE = 500010;
public static final String USER_JCAPTCHA_ERROR_MSG = "验证码错误";
//验证码已失效
public static final int USER_JCAPTCHA_EXPIRE_CODE = 500011;
public static final String USER_JCAPTCHA_EXPIRE_MSG = "验证码已失效";
//验证码不能为空
public static final int USER_JCAPTCHA_EMPTY_CODE = 500012;
public static final String USER_JCAPTCHA_EMPTY_MSG = "验证码不能为空";
//当前角色的数据类型是本部门数据,所以必须选择部门
public static final int USER_ROLE_ORGA_EMPTY_CODE = 500013;
public static final String USER_ROLE_ORGA_EMPTY_MSG = "当前角色的数据类型是本部门数据,所以必须选择部门";
/**
* 角色信息
* type = 10
* */
//添加角色信息失败
public static final int ROLE_ADD_FAILED_CODE = 1000000;
public static final String ROLE_ADD_FAILED_MSG = "添加角色信息失败";
//删除角色信息失败
public static final int ROLE_DELETE_FAILED_CODE = 1000001;
public static final String ROLE_DELETE_FAILED_MSG = "删除角色信息失败";
//修改角色信息失败
public static final int ROLE_EDIT_FAILED_CODE = 1000002;
public static final String ROLE_EDIT_FAILED_MSG = "修改角色信息失败";
/**
* 应用信息
* type = 15
* */
//添加角色信息失败
public static final int APP_ADD_FAILED_CODE = 1500000;
public static final String APP_ADD_FAILED_MSG = "添加应用信息失败";
//删除角色信息失败
public static final int APP_DELETE_FAILED_CODE = 1500001;
public static final String APP_DELETE_FAILED_MSG = "删除应用信息失败";
//修改角色信息失败
public static final int APP_EDIT_FAILED_CODE = 1500002;
public static final String APP_EDIT_FAILED_MSG = "修改应用信息失败";
/**
* 仓库信息
* type = 20
* */
//添加仓库信息失败
public static final int DEPOT_ADD_FAILED_CODE = 2000000;
public static final String DEPOT_ADD_FAILED_MSG = "添加仓库信息失败";
//删除仓库信息失败
public static final int DEPOT_DELETE_FAILED_CODE = 2000001;
public static final String DEPOT_DELETE_FAILED_MSG = "删除仓库信息失败";
//修改仓库信息失败
public static final int DEPOT_EDIT_FAILED_CODE = 2000002;
public static final String DEPOT_EDIT_FAILED_MSG = "修改仓库信息失败";
/**
* 功能模块信息
* type = 30
* */
//添加角色信息失败
public static final int FUNCTIONS_ADD_FAILED_CODE = 3000000;
public static final String FUNCTIONS_ADD_FAILED_MSG = "添加功能模块信息失败";
//删除角色信息失败
public static final int FUNCTIONS_DELETE_FAILED_CODE = 3000001;
public static final String FUNCTIONS_DELETE_FAILED_MSG = "删除功能模块信息失败";
//修改角色信息失败
public static final int FUNCTIONS_EDIT_FAILED_CODE = 3000002;
public static final String FUNCTIONS_EDIT_FAILED_MSG = "修改功能模块信息失败";
/**
* 收支项目信息
* type = 35
* */
//添加收支项目信息失败
public static final int IN_OUT_ITEM_ADD_FAILED_CODE = 3500000;
public static final String IN_OUT_ITEM_ADD_FAILED_MSG = "添加收支项目信息失败";
//删除收支项目信息失败
public static final int IN_OUT_ITEM_DELETE_FAILED_CODE = 3500001;
public static final String IN_OUT_ITEM_DELETE_FAILED_MSG = "删除收支项目信息失败";
//修改收支项目信息失败
public static final int IN_OUT_ITEM_EDIT_FAILED_CODE = 3500002;
public static final String IN_OUT_ITEM_EDIT_FAILED_MSG = "修改收支项目信息失败";
//该收支项目的名称已经存在
public static final int IN_OUT_ITEM_NAME_EXIST_FAILED_CODE = 3500003;
public static final String IN_OUT_ITEM_NAME_EXIST_FAILED_MSG = "该收支项目的名称已经存在,请修改!";
/**
* 多单位信息
* type = 40
* */
//添加多单位信息失败
public static final int UNIT_ADD_FAILED_CODE = 4000000;
public static final String UNIT_ADD_FAILED_MSG = "添加多单位信息失败";
//删除多单位信息失败
public static final int UNIT_DELETE_FAILED_CODE = 4000001;
public static final String UNIT_DELETE_FAILED_MSG = "删除多单位信息失败";
//修改多单位信息失败
public static final int UNIT_EDIT_FAILED_CODE = 4000002;
public static final String UNIT_EDIT_FAILED_MSG = "修改多单位信息失败";
/**
* 经手人信息
* type = 45
* */
//添加经手人信息失败
public static final int PERSON_ADD_FAILED_CODE = 4500000;
public static final String PERSON_ADD_FAILED_MSG = "添加经手人信息失败";
//删除经手人信息失败
public static final int PERSON_DELETE_FAILED_CODE = 4500001;
public static final String PERSON_DELETE_FAILED_MSG = "删除经手人信息失败";
//修改经手人信息失败
public static final int PERSON_EDIT_FAILED_CODE = 4500002;
public static final String PERSON_EDIT_FAILED_MSG = "修改经手人信息失败";
/**
* 用户角色模块关系信息
* type = 50
* */
//添加用户角色模块关系信息失败
public static final int USER_BUSINESS_ADD_FAILED_CODE = 5000000;
public static final String USER_BUSINESS_ADD_FAILED_MSG = "添加用户角色模块关系信息失败";
//删除用户角色模块关系信息失败
public static final int USER_BUSINESS_DELETE_FAILED_CODE = 5000001;
public static final String USER_BUSINESS_DELETE_FAILED_MSG = "删除用户角色模块关系信息失败";
//修改用户角色模块关系信息失败
public static final int USER_BUSINESS_EDIT_FAILED_CODE = 5000002;
public static final String USER_BUSINESS_EDIT_FAILED_MSG = "修改用户角色模块关系信息失败";
/**
* 系统参数信息
* type = 55
* */
//添加系统参数信息失败
public static final int SYSTEM_CONFIG_ADD_FAILED_CODE = 5500000;
public static final String SYSTEM_CONFIG_ADD_FAILED_MSG = "添加系统参数信息失败";
//删除系统参数信息失败
public static final int SYSTEM_CONFIG_DELETE_FAILED_CODE = 5500001;
public static final String SYSTEM_CONFIG_DELETE_FAILED_MSG = "删除系统参数信息失败";
//修改系统参数信息失败
public static final int SYSTEM_CONFIG_EDIT_FAILED_CODE = 5500002;
public static final String SYSTEM_CONFIG_EDIT_FAILED_MSG = "修改系统参数信息失败";
/**
* 商品扩展信息
* type = 60
* */
//添加商品扩展信息失败
public static final int MATERIAL_PROPERTY_ADD_FAILED_CODE = 6000000;
public static final String MATERIAL_PROPERTY_ADD_FAILED_MSG = "添加商品扩展信息失败";
//删除商品扩展信息失败
public static final int MATERIAL_PROPERTY_DELETE_FAILED_CODE = 6000001;
public static final String MATERIAL_PROPERTY_DELETE_FAILED_MSG = "删除商品扩展信息失败";
//修改商品扩展信息失败
public static final int MATERIAL_PROPERTY_EDIT_FAILED_CODE = 6000002;
public static final String MATERIAL_PROPERTY_EDIT_FAILED_MSG = "修改商品扩展信息失败";
/**
* 账户信息
* type = 65
* */
//添加账户信息失败
public static final int ACCOUNT_ADD_FAILED_CODE = 6500000;
public static final String ACCOUNT_ADD_FAILED_MSG = "添加账户信息失败";
//删除账户信息失败
public static final int ACCOUNT_DELETE_FAILED_CODE = 6500001;
public static final String ACCOUNT_DELETE_FAILED_MSG = "删除账户信息失败";
//修改账户信息失败
public static final int ACCOUNT_EDIT_FAILED_CODE = 6500002;
public static final String ACCOUNT_EDIT_FAILED_MSG = "修改账户信息失败";
/**
* 供应商信息
* type = 70
* */
//添加供应商信息失败
public static final int SUPPLIER_ADD_FAILED_CODE = 7000000;
public static final String SUPPLIER_ADD_FAILED_MSG = "添加供应商信息失败";
//删除供应商信息失败
public static final int SUPPLIER_DELETE_FAILED_CODE = 7000001;
public static final String SUPPLIER_DELETE_FAILED_MSG = "删除供应商信息失败";
//修改供应商信息失败
public static final int SUPPLIER_EDIT_FAILED_CODE = 7000002;
public static final String SUPPLIER_EDIT_FAILED_MSG = "修改供应商信息失败";
/**
* 商品类别信息
* type = 75
* */
//添加商品类别信息失败
public static final int MATERIAL_CATEGORY_ADD_FAILED_CODE = 7500000;
public static final String MATERIAL_CATEGORY_ADD_FAILED_MSG = "添加商品类别信息失败";
//删除商品类别信息失败
public static final int MATERIAL_CATEGORY_DELETE_FAILED_CODE = 7500001;
public static final String MATERIAL_CATEGORY_DELETE_FAILED_MSG = "删除商品类别信息失败";
//修改商品类别信息失败
public static final int MATERIAL_CATEGORY_EDIT_FAILED_CODE = 7500002;
public static final String MATERIAL_CATEGORY_EDIT_FAILED_MSG = "修改商品类别信息失败";
//商品类别编号已存在
public static final int MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE = 7500003;
public static final String MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG = "商品类别编号已存在";
//根类别不支持修改
public static final int MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE = 7500004;
public static final String MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG = "根类别不支持修改";
//根类别不支持删除
public static final int MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE = 7500005;
public static final String MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG = "根类别不支持删除";
//该类别存在下级不允许删除
public static final int MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE = 7500006;
public static final String MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG = "该类别存在下级不允许删除";
/**
* 商品信息
* type = 80
* */
//商品信息不存在
public static final int MATERIAL_NOT_EXISTS_CODE = 8000000;
public static final String MATERIAL_NOT_EXISTS_MSG = "商品信息不存在";
//商品信息不唯一
public static final int MATERIAL_NOT_ONLY_CODE = 8000001;
public static final String MATERIAL_NOT_ONLY_MSG = "商品信息不唯一";
//该商品未开启序列号
public static final int MATERIAL_NOT_ENABLE_SERIAL_NUMBER_CODE = 8000002;
public static final String MATERIAL_NOT_ENABLE_SERIAL_NUMBER_MSG = "该商品未开启序列号功能";
//商品的序列号不能为空
public static final int MATERIAL_SERIAL_NUMBERE_EMPTY_CODE = 8000003;
public static final String MATERIAL_SERIAL_NUMBERE_EMPTY_MSG = "抱歉,商品条码:%s的序列号不能为空";
//商品库存不足
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
//商品条码重复
public static final int MATERIAL_BARCODE_EXISTS_CODE = 8000005;
public static final String MATERIAL_BARCODE_EXISTS_MSG = "商品条码:%s重复";
//商品-单位匹配不上
public static final int MATERIAL_UNIT_MATE_CODE = 8000006;
public static final String MATERIAL_UNIT_MATE_MSG = "抱歉,商品条码:%s的单位匹配不上,请完善多单位信息!";
//商品条码长度应该为4到40位
public static final int MATERIAL_BARCODE_LENGTH_ERROR_CODE = 8000007;
public static final String MATERIAL_BARCODE_LENGTH_ERROR_MSG = "商品条码:%s的长度应该为4到40位";
//序列号和批号只能有一项
public static final int MATERIAL_ENABLE_MUST_ONE_CODE = 8000008;
public static final String MATERIAL_ENABLE_MUST_ONE_MSG = "抱歉,商品条码:%s的序列号和批号不能同时填1";
//名称为空
public static final int MATERIAL_NAME_EMPTY_CODE = 8000010;
public static final String MATERIAL_NAME_EMPTY_MSG = "第%s行名称为空";
//基本单位为空
public static final int MATERIAL_UNIT_EMPTY_CODE = 8000011;
public static final String MATERIAL_UNIT_EMPTY_MSG = "第%s行基本单位为空";
//状态格式错误
public static final int MATERIAL_ENABLED_ERROR_CODE = 8000012;
public static final String MATERIAL_ENABLED_ERROR_MSG = "第%s行状态格式错误";
//单次导入超出1000条
public static final int MATERIAL_IMPORT_OVER_LIMIT_CODE = 8000013;
public static final String MATERIAL_IMPORT_OVER_LIMIT_MSG = "抱歉,单次导入不能超出1000条";
//基础重量格式错误
public static final int MATERIAL_WEIGHT_NOT_DECIMAL_CODE = 8000014;
public static final String MATERIAL_WEIGHT_NOT_DECIMAL_MSG = "第%s行基础重量格式错误";
//保质期格式错误
public static final int MATERIAL_EXPIRY_NUM_NOT_INTEGER_CODE = 8000015;
public static final String MATERIAL_EXPIRY_NUM_NOT_INTEGER_MSG = "第%s行保质期格式错误";
//比例格式错误
public static final int MATERIAL_RATIO_NOT_INTEGER_CODE = 8000016;
public static final String MATERIAL_RATIO_NOT_INTEGER_MSG = "第%s行比例格式错误";
//组装拆卸单不能选择批号或序列号商品
public static final int MATERIAL_ASSEMBLE_SELECT_ERROR_CODE = 80000017;
public static final String MATERIAL_ASSEMBLE_SELECT_ERROR_MSG = "抱歉,组装拆卸单不能选择批号或序列号商品:%s";
//调拨单不能选择批号或序列号商品
public static final int MATERIAL_TRANSFER_SELECT_ERROR_CODE = 80000018;
public static final String MATERIAL_TRANSFER_SELECT_ERROR_MSG = "抱歉,调拨单不能选择批号或序列号商品:%s,建议走其它入库和出库单";
//盘点业务不能选择批号或序列号商品
public static final int MATERIAL_STOCK_CHECK_ERROR_CODE = 80000019;
public static final String MATERIAL_STOCK_CHECK_ERROR_MSG = "抱歉,盘点业务不能选择批号或序列号商品:%s,建议走其它入库和出库单";
//EXCEL中存在重复的商品
public static final int MATERIAL_EXCEL_IMPORT_EXIST_CODE = 80000020;
public static final String MATERIAL_EXCEL_IMPORT_EXIST_MSG = "抱歉,EXCEL中存在重复的商品,具体信息为:%s";
//EXCEL中存在重复的条码
public static final int MATERIAL_EXCEL_IMPORT_BARCODE_EXIST_CODE = 80000021;
public static final String MATERIAL_EXCEL_IMPORT_BARCODE_EXIST_MSG = "抱歉,EXCEL中存在重复的条码,具体条码为:%s";
//名称长度超出
public static final int MATERIAL_NAME_OVER_CODE = 8000022;
public static final String MATERIAL_NAME_OVER_MSG = "第%s行名称长度超出100个字符";
//规格长度超出
public static final int MATERIAL_STANDARD_OVER_CODE = 8000023;
public static final String MATERIAL_STANDARD_OVER_MSG = "第%s行规格长度超出100个字符";
//型号长度超出
public static final int MATERIAL_MODEL_OVER_CODE = 8000024;
public static final String MATERIAL_MODEL_OVER_MSG = "第%s行型号长度超出100个字符";
//多属性商品不能输入库存,建议进行盘点录入
public static final int MATERIAL_SKU_BEGIN_STOCK_FAILED_CODE = 8000025;
public static final String MATERIAL_SKU_BEGIN_STOCK_FAILED_MSG = "多属性商品%s不能输入库存,建议进行盘点录入";
//商品条码不存在,请重新选择
public static final int MATERIAL_BARCODE_IS_NOT_EXIST_CODE = 8000026;
public static final String MATERIAL_BARCODE_IS_NOT_EXIST_MSG = "商品条码%s不存在,请重新选择";
//基本条码为空
public static final int MATERIAL_BARCODE_EMPTY_CODE = 8000027;
public static final String MATERIAL_BARCODE_EMPTY_MSG = "第%s行基本条码为空";
//EXCEL中有副条码在系统中已存在(除自身商品之外)
public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028;
public static final String MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG = "抱歉,EXCEL中有副条码在系统中已存在,具体副条码为:%s";
//单据中商品库存不足
public static final int BILL_MATERIAL_STOCK_NOT_ENOUGH_CODE = 80000029;
public static final String BILL_MATERIAL_STOCK_NOT_ENOUGH_MSG = "单据:%s中商品:%s库存不足";
/**
* 单据信息
* type = 85
* */
//添加单据信息失败
public static final int DEPOT_HEAD_ADD_FAILED_CODE = 8500000;
public static final String DEPOT_HEAD_ADD_FAILED_MSG = "添加单据信息失败";
//删除单据信息失败
public static final int DEPOT_HEAD_DELETE_FAILED_CODE = 8500001;
public static final String DEPOT_HEAD_DELETE_FAILED_MSG = "删除单据信息失败";
//修改单据信息失败
public static final int DEPOT_HEAD_EDIT_FAILED_CODE = 8500002;
public static final String DEPOT_HEAD_EDIT_FAILED_MSG = "修改单据信息失败";
//单据录入-仓库不能为空
public static final int DEPOT_HEAD_DEPOT_FAILED_CODE = 8500004;
public static final String DEPOT_HEAD_DEPOT_FAILED_MSG = "仓库不能为空";
//单据录入-调入仓库不能为空
public static final int DEPOT_HEAD_ANOTHER_DEPOT_FAILED_CODE = 8500005;
public static final String DEPOT_HEAD_ANOTHER_DEPOT_FAILED_MSG = "调入仓库不能为空";
//单据录入-明细不能为空
public static final int DEPOT_HEAD_ROW_FAILED_CODE = 8500006;
public static final String DEPOT_HEAD_ROW_FAILED_MSG = "单据明细不能为空";
//单据录入-账户不能为空
public static final int DEPOT_HEAD_ACCOUNT_FAILED_CODE = 8500007;
public static final String DEPOT_HEAD_ACCOUNT_FAILED_MSG = "结算账户不能为空";
//单据录入-请修改多账户的结算金额
public static final int DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE = 8500008;
public static final String DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG = "请修改多账户的结算金额";
//单据录入-调入仓库与原仓库不能重复
public static final int DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_CODE = 8500010;
public static final String DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_MSG = "调入仓库与原仓库不能重复";
//单据删除-只有未审核的单据才能删除,请先进行反审核
public static final int DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_CODE = 8500011;
public static final String DEPOT_HEAD_UN_AUDIT_DELETE_FAILED_MSG = "抱歉,只有未审核的单据才能删除,请先进行反审核";
//单据审核-只有未审核的单据才能审核
public static final int DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE = 8500012;
public static final String DEPOT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG = "抱歉,只有未审核的单据才能审核";
//单据反审核-只有已审核的单据才能反审核
public static final int DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE = 8500013;
public static final String DEPOT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG = "抱歉,只有已审核的单据才能反审核";
//单据录入-商品条码XXX的数量需要修改下
public static final int DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE = 85000014;
public static final String DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG = "商品条码%s的数量需要修改下";
//单据录入-商品的批号不能为空
public static final int DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE = 8500015;
public static final String DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG = "抱歉,商品条码:%s的批号不能为空";
//单据录入-会员预付款余额不足
public static final int DEPOT_HEAD_MEMBER_PAY_LACK_CODE = 8500016;
public static final String DEPOT_HEAD_MEMBER_PAY_LACK_MSG = "抱歉,会员预付款余额不足";
//单据录入-累计订金超出原订单中的订金
public static final int DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE = 8500017;
public static final String DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG = "抱歉,累计订金超出原订单中的订金";
//单据录入-商品条码XXX的单价低于最低售价
public static final int DEPOT_HEAD_UNIT_PRICE_LOW_CODE = 8500018;
public static final String DEPOT_HEAD_UNIT_PRICE_LOW_MSG = "商品条码%s的单价低于最低售价";
//单据录入-单据明细中必须要有组合件和普通子件
public static final int DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE = 8500020;
public static final String DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG = "抱歉,单据明细中必须要有组合件和普通子件";
//单据录入-商品条码XXX的数量与序列号不一致
public static final int DEPOT_HEAD_SN_NUMBERE_FAILED_CODE = 8500021;
public static final String DEPOT_HEAD_SN_NUMBERE_FAILED_MSG = "抱歉,商品条码:%s的数量与序列号不一致";
//单据录入-单据编号已经存在
public static final int DEPOT_HEAD_BILL_NUMBER_EXIST_CODE = 8500022;
public static final String DEPOT_HEAD_BILL_NUMBER_EXIST_MSG = "抱歉,单据编号已经存在";
//单据录入-单据当前状态下不能修改
public static final int DEPOT_HEAD_BILL_CANNOT_EDIT_CODE = 8500023;
public static final String DEPOT_HEAD_BILL_CANNOT_EDIT_MSG = "抱歉,单据当前状态下不能修改";
//单据删除-单据中的序列号已经出库,不能删除
public static final int DEPOT_HEAD_SERIAL_IS_SELL_CODE = 8500024;
public static final String DEPOT_HEAD_SERIAL_IS_SELL_MSG = "抱歉,单据%s的序列号已经出库,不能删除";
//单据录入-单据附件不能超过规定数量
public static final int DEPOT_HEAD_FILE_NUM_LIMIT_CODE = 8500025;
public static final String DEPOT_HEAD_FILE_NUM_LIMIT_MSG = "抱歉,单据附件不能超过%s份";
//单据录入-完成采购的单据不能进行反审核
public static final int DEPOT_HEAD_PURCHASE_STATUS_TWO_CODE = 8500026;
public static final String DEPOT_HEAD_PURCHASE_STATUS_TWO_MSG = "抱歉,完成采购的单据不能进行反审核";
//单据录入-部分采购的单据不能进行反审核
public static final int DEPOT_HEAD_PURCHASE_STATUS_THREE_CODE = 8500027;
public static final String DEPOT_HEAD_PURCHASE_STATUS_THREE_MSG = "抱歉,部分采购的单据不能进行反审核";
//单据录入-单据中存在部分状态,需要到新增界面关联单据
public static final int DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_CODE = 8500028;
public static final String DEPOT_ITEM_EXIST_PARTIALLY_STATUS_FAILED_MSG = "抱歉,单据:%s是部分%s状态,需要到新增界面关联单据";
//单据录入-关联请购单号和关联订单号不能同时录入
public static final int DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_CODE = 8500029;
public static final String DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_MSG = "抱歉,关联请购单号和关联订单号不能同时录入";
//单据录入-单据最新状态不能进行批量操作
public static final int DEPOT_ITEM_EXIST_NEW_STATUS_FAILED_CODE = 8500030;
public static final String DEPOT_ITEM_EXIST_NEW_STATUS_FAILED_MSG = "抱歉,单据:%s最新状态不能进行批量操作";
//单据录入-单据在该状态不能强制结单
public static final int DEPOT_HEAD_FORCE_CLOSE_FAILED_CODE = 8500031;
public static final String DEPOT_HEAD_FORCE_CLOSE_FAILED_MSG = "抱歉,单据:%s在该状态不能强制结单";
//单据录入-请勿频繁提交单据
public static final int DEPOT_HEAD_SUBMIT_REPEAT_FAILED_CODE = 8500032;
public static final String DEPOT_HEAD_SUBMIT_REPEAT_FAILED_MSG = "抱歉,请不要频繁提交单据";
//单据录入-单据明细中存在重复的序列号
public static final int DEPOT_HEAD_CHECK_SERIAL_NUMBER_REPEAT_CODE = 8500033;
public static final String DEPOT_HEAD_CHECK_SERIAL_NUMBER_REPEAT_MSG = "抱歉,单据明细中存在重复的序列号:%s";
//单据录入-序列号已被出库,不允许修改该单据
public static final int DEPOT_HEAD_SN_NOT_ALLOW_UPDATE_CODE = 8500035;
public static final String DEPOT_HEAD_SN_NOT_ALLOW_UPDATE_MSG = "抱歉,序列号:%s已被出库,不允许修改该单据";
//单据录入-单据被财务单据关联,不允许单独删除
public static final int DEPOT_HEAD_FINANCIAL_ASSOCIATED_CODE = 8500036;
public static final String DEPOT_HEAD_FINANCIAL_ASSOCIATED_MSG = "单据:%s被财务单据:%s关联,不允许单独删除";
/**
* 单据明细信息
* type = 90
* */
//添加单据明细信息失败
public static final int DEPOT_ITEM_ADD_FAILED_CODE = 9000000;
public static final String DEPOT_ITEM_ADD_FAILED_MSG = "添加单据明细信息失败";
//删除单据明细信息失败
public static final int DEPOT_ITEM_DELETE_FAILED_CODE = 9000001;
public static final String DEPOT_ITEM_DELETE_FAILED_MSG = "删除单据明细信息失败";
//修改单据明细信息失败
public static final int DEPOT_ITEM_EDIT_FAILED_CODE = 9000002;
public static final String DEPOT_ITEM_EDIT_FAILED_MSG = "修改单据明细信息失败";
//单据明细-明细中商品不存在
public static final int DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE = 9000003;
public static final String DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG = "抱歉,商品条码:%s在商品管理中不存在";
//单据明细-明细中仓库不存在
public static final int DEPOT_ITEM_DEPOTNAME_IS_NOT_EXIST_CODE = 9000004;
public static final String DEPOT_ITEM_DEPOTNAME_IS_NOT_EXIST_MSG = "抱歉,仓库:%s在基础资料-仓库信息中不存在";
//单据明细-单据中存在序列号,需要到新增界面关联单据
public static final int DEPOT_ITEM_EXIST_SERIAL_NUMBER_FAILED_CODE = 9000005;
public static final String DEPOT_ITEM_EXIST_SERIAL_NUMBER_FAILED_MSG = "抱歉,单据:%s里面存在序列号,需要到新增界面关联单据";
//单据明细-单据中存在批号,需要到新增界面关联单据
public static final int DEPOT_ITEM_EXIST_BATCH_NUMBER_FAILED_CODE = 9000006;
public static final String DEPOT_ITEM_EXIST_BATCH_NUMBER_FAILED_MSG = "抱歉,单据:%s里面存在批号,需要到新增界面关联单据";
//原关联单据已被修改,请重新关联
public static final int DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE = 9000007;
public static final String DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG = "抱歉,原关联单据已被修改,请重新关联";
/**
* 财务信息
* type = 95
* */
//添加财务信息失败
public static final int ACCOUNT_HEAD_ADD_FAILED_CODE = 9500000;
public static final String ACCOUNT_HEAD_ADD_FAILED_MSG = "添加财务信息失败";
//删除财务信息失败
public static final int ACCOUNT_HEAD_DELETE_FAILED_CODE = 9500001;
public static final String ACCOUNT_HEAD_DELETE_FAILED_MSG = "删除财务信息失败";
//修改财务信息失败
public static final int ACCOUNT_HEAD_EDIT_FAILED_CODE = 9500002;
public static final String ACCOUNT_HEAD_EDIT_FAILED_MSG = "修改财务信息失败";
//单据录入-明细不能为空
public static final int ACCOUNT_HEAD_ROW_FAILED_CODE = 9500003;
public static final String ACCOUNT_HEAD_ROW_FAILED_MSG = "单据明细不能为空";
//单据删除-只有未审核的单据才能删除,请先进行反审核
public static final int ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_CODE = 9500004;
public static final String ACCOUNT_HEAD_UN_AUDIT_DELETE_FAILED_MSG = "抱歉,只有未审核的单据才能删除,请先进行反审核";
//财务信息录入-单据编号已经存在
public static final int ACCOUNT_HEAD_BILL_NO_EXIST_CODE = 9500005;
public static final String ACCOUNT_HEAD_BILL_NO_EXIST_MSG = "抱歉,单据编号已经存在";
//财务信息录入-付款账户和明细中的账户重复
public static final int ACCOUNT_HEAD_ACCOUNT_REPEAT_CODE = 9500006;
public static final String ACCOUNT_HEAD_ACCOUNT_REPEAT_MSG = "抱歉,付款账户:%s和明细中的账户重复";
//财务信息审核-只有未审核的单据才能审核
public static final int ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_CODE = 9500007;
public static final String ACCOUNT_HEAD_UN_AUDIT_TO_AUDIT_FAILED_MSG = "抱歉,只有未审核的单据才能审核";
//财务信息反审核-只有已审核的单据才能反审核
public static final int ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_CODE = 9500008;
public static final String ACCOUNT_HEAD_AUDIT_TO_UN_AUDIT_FAILED_MSG = "抱歉,只有已审核的单据才能反审核";
/**
* 财务明细信息
* type = 100
* */
//添加财务明细信息失败
public static final int ACCOUNT_ITEM_ADD_FAILED_CODE = 10000000;
public static final String ACCOUNT_ITEM_ADD_FAILED_MSG = "添加财务明细信息失败";
//删除财务明细信息失败
public static final int ACCOUNT_ITEM_DELETE_FAILED_CODE = 10000001;
public static final String ACCOUNT_ITEM_DELETE_FAILED_MSG = "删除财务明细信息失败";
//修改财务明细信息失败
public static final int ACCOUNT_ITEM_EDIT_FAILED_CODE = 10000002;
public static final String ACCOUNT_ITEM_EDIT_FAILED_MSG = "修改财务明细信息失败";
/**
* 序列号
* type = 105
* */
/**序列号已存在*/
public static final int SERIAL_NUMBERE_ALREADY_EXISTS_CODE = 10500000;
public static final String SERIAL_NUMBERE_ALREADY_EXISTS_MSG = "序列号:%s已存在";
/**序列号不存在或者已经出库*/
public static final int SERIAL_NUMBERE_NOT_EXISTS_CODE = 10500001;
public static final String SERIAL_NUMBERE_NOT_EXISTS_MSG = "序列号:%s不存在或者已经出库";
/**
* 部门信息
* type = 110
* */
//添加部门信息失败
public static final int ORGANIZATION_ADD_FAILED_CODE = 11000000;
public static final String ORGANIZATION_ADD_FAILED_MSG = "添加部门信息失败";
//删除部门信息失败
public static final int ORGANIZATION_DELETE_FAILED_CODE = 11000001;
public static final String ORGANIZATION_DELETE_FAILED_MSG = "删除部门信息失败";
//修改部门信息失败
public static final int ORGANIZATION_EDIT_FAILED_CODE = 11000002;
public static final String ORGANIZATION_EDIT_FAILED_MSG = "修改部门信息失败";
//部门编号已存在
public static final int ORGANIZATION_NO_ALREADY_EXISTS_CODE = 11000003;
public static final String ORGANIZATION_NO_ALREADY_EXISTS_MSG = "部门编号已存在";
//根部门不允许删除
public static final int ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_CODE = 11000004;
public static final String ORGANIZATION_ROOT_NOT_ALLOWED_DELETE_MSG = "根部门不允许删除";
//根部门不允许修改
public static final int ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE = 11000005;
public static final String ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG = "根部门不允许修改";
//该部门存在下级不允许删除
public static final int ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE = 11000006;
public static final String ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG = "该部门存在下级不允许删除";
/**
* 部门用户关联关系
* type = 115
* */
//添加部门用户关联关系失败
public static final int ORGA_USER_REL_ADD_FAILED_CODE = 11500000;
public static final String ORGA_USER_REL_ADD_FAILED_MSG = "添加部门用户关联关系失败";
//删除部门用户关联关系失败
public static final int ORGA_USER_REL_DELETE_FAILED_CODE = 11500001;
public static final String ORGA_USER_REL_DELETE_FAILED_MSG = "删除部门用户关联关系失败";
//修改部门用户关联关系失败
public static final int ORGA_USER_REL_EDIT_FAILED_CODE = 11500002;
public static final String ORGA_USER_REL_EDIT_FAILED_MSG = "修改部门用户关联关系失败";
//进销存统计,如果有权限的仓库数量太多则提示要选择仓库
public static final int REPORT_TWO_MANY_DEPOT_FAILED_CODE = 510;
public static final String REPORT_TWO_MANY_DEPOT_FAILED_MSG = "请选择仓库,再进行查询";
/**
* 生成单据编号
* type = 120
* */
//获取唯一单据编号失败
public static final int SEQUENCE_ONLY_FAILED_CODE = 12000001;
public static final String SEQUENCE_ONLY_FAILED_MSG = "获取唯一单据编号失败,请稍后重试";
//获取唯一单据编号操作被中断
public static final int SEQUENCE_ONLY_BREAK_CODE = 12000002;
public static final String SEQUENCE_ONLY_BREAK_MSG = "获取唯一单据编号操作被中断";
/**
* 字典
* type = 125
* */
//字典类型已分配,不能删除
public static final int DICT_TYPE_ALREADY_USED_CODE = 12500001;
public static final String DICT_TYPE_ALREADY_USED_MSG = "%s已分配,不能删除";
//演示用户禁止操作
public static final int SYSTEM_CONFIG_TEST_USER_CODE = -1;
public static final String SYSTEM_CONFIG_TEST_USER_MSG = "演示用户禁止操作";
/**
* 标准正常返回/操作成功返回
* @return
*/
public static JSONObject standardSuccess () {
JSONObject success = new JSONObject();
success.put(GLOBAL_RETURNS_CODE, SERVICE_SUCCESS_CODE);
success.put(GLOBAL_RETURNS_MESSAGE, SERVICE_SUCCESS_MSG);
return success;
}
}

View File

@@ -0,0 +1,304 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.datasource.entities.Account;
import com.reallin.smt.datasource.vo.AccountVo4InOutList;
import com.reallin.smt.datasource.vo.AccountVo4List;
import com.reallin.smt.service.AccountService;
import com.reallin.smt.service.SystemConfigService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author jishenghua 75271*8920
*/
@RestController
@RequestMapping(value = "/account")
@Api(tags = {"账户管理"})
public class AccountController extends BaseController {
private Logger logger = LoggerFactory.getLogger(AccountController.class);
@Resource
private AccountService accountService;
@Resource
private SystemConfigService systemConfigService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Account account = accountService.getAccount(id);
Map<String, Object> objectMap = new HashMap<>();
if(account != null) {
objectMap.put("info", account);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String serialNo = StringUtil.getInfo(search, "serialNo");
String remark = StringUtil.getInfo(search, "remark");
List<AccountVo4List> list = accountService.select(name, serialNo, remark);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = accountService.insertAccount(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = accountService.updateAccount(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = accountService.deleteAccount(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = accountService.batchDeleteAccount(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = accountService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 查找结算账户信息-下拉框
* @param request
* @return
*/
@GetMapping(value = "/findBySelect")
@ApiOperation(value = "查找结算账户信息-下拉框")
public String findBySelect(HttpServletRequest request) throws Exception {
String res = null;
try {
List<Account> dataList = accountService.findBySelect();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Account account : dataList) {
JSONObject item = new JSONObject();
item.put("Id", account.getId());
//结算账户名称
item.put("AccountName", account.getName());
dataArray.add(item);
}
}
res = dataArray.toJSONString();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "获取数据失败";
}
return res;
}
/**
* 获取所有结算账户
* @param request
* @return
*/
@GetMapping(value = "/getAccount")
@ApiOperation(value = "获取所有结算账户")
public BaseResponseInfo getAccount(HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Account> accountList = accountService.getAccount();
map.put("accountList", accountList);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 账户流水信息
* @param currentPage
* @param pageSize
* @param accountId
* @param initialAmount
* @param request
* @return
*/
@GetMapping(value = "/findAccountInOutList")
@ApiOperation(value = "账户流水信息")
public BaseResponseInfo findAccountInOutList(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("accountId") Long accountId,
@RequestParam("initialAmount") BigDecimal initialAmount,
@RequestParam(value = "number",required = false) String number,
@RequestParam(value = "beginTime",required = false) String beginTime,
@RequestParam(value = "endTime",required = false) String endTime,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<AccountVo4InOutList> dataList = accountService.findAccountInOutList(accountId, StringUtil.toNull(number),
beginTime, endTime, forceFlag, (currentPage-1)*pageSize, pageSize);
int total = accountService.findAccountInOutListCount(accountId, StringUtil.toNull(number),
beginTime, endTime, forceFlag);
map.put("total", total);
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (AccountVo4InOutList aEx : dataList) {
String type = aEx.getType().replace("其它", "");
aEx.setType(type);
String operTime = aEx.getOperTime();
BigDecimal balance = accountService.getAccountSum(accountId, null, operTime, forceFlag)
.add(accountService.getAccountSumByHead(accountId, null, operTime, forceFlag))
.add(accountService.getAccountSumByDetail(accountId, null, operTime, forceFlag))
.add(accountService.getManyAccountSum(accountId, null, operTime, forceFlag)).add(initialAmount);
aEx.setBalance(balance);
aEx.setAccountId(accountId);
dataArray.add(aEx);
}
}
map.put("rows", dataArray);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 更新默认账户
* @param object
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/updateIsDefault")
@ApiOperation(value = "更新默认账户")
public String updateIsDefault(@RequestBody JSONObject object,
HttpServletRequest request) throws Exception{
Long accountId = object.getLong("id");
Map<String, Object> objectMap = new HashMap<>();
int res = accountService.updateIsDefault(accountId);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 获取带余额的报表
* @param request
* @return
*/
@GetMapping(value = "/listWithBalance")
@ApiOperation(value = "获取带余额的报表")
public TableDataInfo listWithBalance(@RequestParam("name") String name,
@RequestParam("serialNo") String serialNo,
HttpServletRequest request) throws Exception {
List<AccountVo4List> list = accountService.listWithBalance(StringUtil.toNull(name), StringUtil.toNull(serialNo));
return getDataTable(list);
}
/**
* 结算账户的统计
* @param request
* @return
*/
@GetMapping(value = "/getStatistics")
@ApiOperation(value = "结算账户的统计")
public BaseResponseInfo getStatistics(@RequestParam("name") String name,
@RequestParam("serialNo") String serialNo,
HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> map = accountService.getStatistics(StringUtil.toNull(name), StringUtil.toNull(serialNo));
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = accountService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,197 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.constants.ExceptionConstants;
import com.reallin.smt.datasource.entities.AccountHead;
import com.reallin.smt.datasource.entities.AccountHeadVo4Body;
import com.reallin.smt.datasource.entities.AccountHeadVo4ListEx;
import com.reallin.smt.service.AccountHeadService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author jishenghua 752*718*920
*/
@RestController
@RequestMapping(value = "/accountHead")
@Api(tags = {"财务管理"})
public class AccountHeadController extends BaseController {
private Logger logger = LoggerFactory.getLogger(AccountHeadController.class);
@Resource
private AccountHeadService accountHeadService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
AccountHead accountHead = accountHeadService.getAccountHead(id);
Map<String, Object> objectMap = new HashMap<>();
if(accountHead != null) {
objectMap.put("info", accountHead);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String type = StringUtil.getInfo(search, "type");
String billNo = StringUtil.getInfo(search, "billNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
Long handsPersonId = StringUtil.parseStrLong(StringUtil.getInfo(search, "handsPersonId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String status = StringUtil.getInfo(search, "status");
String remark = StringUtil.getInfo(search, "remark");
String number = StringUtil.getInfo(search, "number");
Long inOutItemId = StringUtil.parseStrLong(StringUtil.getInfo(search, "inOutItemId"));
List<AccountHeadVo4ListEx> list = accountHeadService.select(type, billNo, beginTime, endTime, organId, creator,
handsPersonId, accountId, status, remark, number, inOutItemId);
return getDataTable(list);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = accountHeadService.deleteAccountHead(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = accountHeadService.batchDeleteAccountHead(ids, request);
return returnStr(objectMap, delete);
}
/**
* 批量设置状态-审核或者反审核
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态-审核或者反审核")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception{
Map<String, Object> objectMap = new HashMap<>();
String status = jsonObject.getString("status");
String ids = jsonObject.getString("ids");
int res = accountHeadService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 新增财务主表及财务子表信息
* @param body
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/addAccountHeadAndDetail")
@ApiOperation(value = "新增财务主表及财务子表信息")
public Object addAccountHeadAndDetail(@RequestBody AccountHeadVo4Body body, HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
String beanJson = body.getInfo();
String rows = body.getRows();
accountHeadService.addAccountHeadAndDetail(beanJson,rows, request);
return result;
}
/**
* 更新财务主表及财务子表信息
* @param body
* @param request
* @return
* @throws Exception
*/
@PutMapping(value = "/updateAccountHeadAndDetail")
@ApiOperation(value = "更新财务主表及财务子表信息")
public Object updateAccountHeadAndDetail(@RequestBody AccountHeadVo4Body body, HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
String beanJson = body.getInfo();
String rows = body.getRows();
accountHeadService.updateAccountHeadAndDetail(beanJson,rows,request);
return result;
}
/**
* 根据编号查询单据信息
* @param billNo
* @param request
* @return
*/
@GetMapping(value = "/getDetailByNumber")
@ApiOperation(value = "根据编号查询单据信息")
public BaseResponseInfo getDetailByNumber(@RequestParam("billNo") String billNo,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
AccountHeadVo4ListEx ahl = new AccountHeadVo4ListEx();
try {
List<AccountHeadVo4ListEx> list = accountHeadService.getDetailByNumber(billNo);
if(list.size()>0) {
ahl = list.get(0);
}
res.code = 200;
res.data = ahl;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据出入库单据id查询收付款单号
* @param billId
* @param request
* @return
*/
@GetMapping(value = "/getFinancialBillNoByBillId")
@ApiOperation(value = "根据编号查询单据信息")
public BaseResponseInfo getFinancialBillNoByBillId(@RequestParam("billId") Long billId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<AccountHead> list = accountHeadService.getFinancialBillNoByBillId(billId);
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,93 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.datasource.vo.AccountItemVo4List;
import com.reallin.smt.service.AccountHeadService;
import com.reallin.smt.service.AccountItemService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author ji sheng hua 752*718*920
*/
@RestController
@RequestMapping(value = "/accountItem")
@Api(tags = {"财务明细"})
public class AccountItemController {
private Logger logger = LoggerFactory.getLogger(AccountItemController.class);
@Resource
private AccountItemService accountItemService;
@Resource
private AccountHeadService accountHeadService;
@GetMapping(value = "/getDetailList")
@ApiOperation(value = "明细列表")
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String type = null;
List<AccountItemVo4List> dataList = new ArrayList<>();
if(headerId != 0) {
dataList = accountItemService.getDetailList(headerId);
type = accountHeadService.getAccountHead(headerId).getType();
}
JSONObject outer = new JSONObject();
outer.put("total", dataList.size());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (AccountItemVo4List ai : dataList) {
JSONObject item = new JSONObject();
item.put("accountId", ai.getAccountId());
item.put("accountName", ai.getAccountName());
item.put("inOutItemId", ai.getInOutItemId());
item.put("inOutItemName", ai.getInOutItemName());
if(StringUtil.isNotEmpty(ai.getBillNumber())) {
item.put("billNumber", ai.getBillNumber());
} else {
item.put("billNumber", "QiChu");
}
item.put("needDebt", ai.getNeedDebt());
item.put("finishDebt", ai.getFinishDebt());
BigDecimal eachAmount = ai.getEachAmount();
if(BusinessConstants.TYPE_MONEY_IN.equals(type)) {
item.put("eachAmount", eachAmount);
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(type)) {
item.put("eachAmount", BigDecimal.ZERO.subtract(eachAmount));
} else {
item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount);
}
item.put("remark", ai.getRemark());
dataArray.add(item);
}
}
outer.put("rows", dataArray);
res.code = 200;
res.data = outer;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,108 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Asset;
import com.reallin.smt.service.AssetManagementService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
@RestController
@RequestMapping("/asset")
@Api(tags = "资产台账")
public class AssetController extends BaseController {
@Resource
private AssetManagementService service;
@GetMapping("/list")
@ApiOperation("资产台账列表")
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) throws Exception {
List<Asset> list = service.listAssets(value(search, "keyword"), longValue(search, "categoryId"), value(search, "status"));
return getDataTable(list);
}
@GetMapping("/dashboard")
@ApiOperation("资产汇总统计")
public String dashboard() throws Exception {
return returnJson(service.assetDashboard(), "成功", 200);
}
@GetMapping("/options")
public String options() throws Exception {
Map<String, Object> data = new HashMap<>();
data.put("rows", service.assetOptions());
return returnJson(data, "成功", 200);
}
@GetMapping("/category/options")
public String categoryOptions() throws Exception {
Map<String, Object> data = new HashMap<>();
data.put("rows", service.assetCategoryOptions());
return returnJson(data, "成功", 200);
}
@GetMapping("/category/list")
public String categoryList(@RequestParam(value = Constants.SEARCH, required = false) String search) throws Exception {
Map<String, Object> data = new HashMap<>();
data.put("rows", service.listAssetCategories(value(search, "keyword")));
return returnJson(data, "成功", 200);
}
@PostMapping("/category/add")
public String addCategory(@RequestBody JSONObject json) throws Exception {
json.remove("id");
return returnStr(new HashMap<>(), service.saveAssetCategory(json));
}
@PutMapping("/category/update")
public String updateCategory(@RequestBody JSONObject json) throws Exception {
return returnStr(new HashMap<>(), service.saveAssetCategory(json));
}
@DeleteMapping("/category/delete")
public String deleteCategory(@RequestParam Long id) throws Exception {
return returnStr(new HashMap<>(), service.deleteAssetCategory(id));
}
@PostMapping("/add")
public String add(@RequestBody JSONObject json) throws Exception {
json.remove("id");
return returnStr(new HashMap<>(), service.saveAsset(json));
}
@PutMapping("/update")
public String update(@RequestBody JSONObject json) throws Exception {
return returnStr(new HashMap<>(), service.saveAsset(json));
}
@DeleteMapping("/delete")
public String delete(@RequestParam Long id) throws Exception {
return returnStr(new HashMap<>(), service.deleteAsset(id));
}
private static String value(String search, String key) {
return StringUtil.getInfo(search, key);
}
private static Long longValue(String search, String key) {
String value = value(search, key);
if (value == null || value.trim().isEmpty()) return null;
try {
return Long.valueOf(value.trim());
} catch (NumberFormatException ignored) {
return null;
}
}
}

View File

@@ -0,0 +1,62 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.AssetDevice;
import com.reallin.smt.service.AssetManagementService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
@RestController
@RequestMapping("/assetDevice")
@Api(tags = "设备台账")
public class AssetDeviceController extends BaseController {
@Resource
private AssetManagementService service;
@GetMapping("/list")
@ApiOperation("设备台账列表")
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) throws Exception {
List<AssetDevice> list = service.listDevices(value(search, "keyword"), value(search, "deviceCategory"), value(search, "status"));
return getDataTable(list);
}
@GetMapping("/options")
public String options() throws Exception {
Map<String, Object> data = new HashMap<>();
data.put("rows", service.deviceOptions());
return returnJson(data, "成功", 200);
}
@PostMapping("/add")
public String add(@RequestBody JSONObject json) throws Exception {
json.remove("id");
return returnStr(new HashMap<>(), service.saveDevice(json));
}
@PutMapping("/update")
public String update(@RequestBody JSONObject json) throws Exception {
return returnStr(new HashMap<>(), service.saveDevice(json));
}
@DeleteMapping("/delete")
public String delete(@RequestParam Long id) throws Exception {
return returnStr(new HashMap<>(), service.deleteDevice(id));
}
private static String value(String search, String key) {
return StringUtil.getInfo(search, key);
}
}

View File

@@ -0,0 +1,120 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.AssetInventory;
import com.reallin.smt.datasource.entities.AssetInventoryDetail;
import com.reallin.smt.datasource.vo.InventoryOperatorOption;
import com.reallin.smt.service.AssetManagementService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
@RestController
@RequestMapping("/assetInventory")
@Api(tags = "资产盘点")
public class AssetInventoryController extends BaseController {
@Resource
private AssetManagementService service;
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) throws Exception {
List<AssetInventory> list = service.listInventories(value(search, "keyword"), value(search, "status"),
value(search, "scopeType"), value(search, "plannedStart"), value(search, "plannedEnd"),
longValue(search, "inventoryUserId"));
return getDataTable(list);
}
@GetMapping({"/operatorOptions", "/personOptions"})
public String operatorOptions() throws Exception {
List<InventoryOperatorOption> rows = service.inventoryOperatorOptions();
Map<String, Object> data = new HashMap<>();
data.put("rows", rows);
return returnJson(data, "成功", 200);
}
@GetMapping("/details")
public TableDataInfo details(@RequestParam Long inventoryId,
@RequestParam(required = false) String inventoryStatus,
@RequestParam(required = false) String keyword) throws Exception {
List<AssetInventoryDetail> list = service.listInventoryDetails(inventoryId, inventoryStatus, keyword);
return getDataTable(list);
}
@PostMapping("/create")
@ApiOperation("创建盘点任务并生成台账快照")
public String create(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.createInventory(json, "MANUAL"));
}
@PostMapping("/start")
public String start(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.startInventory(json.getLong("id")));
}
@PostMapping("/record")
@ApiOperation("登记单条资产或设备盘点结果,也支持按编码扫码盘点")
public String record(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.recordInventory(json));
}
@PostMapping("/submit")
public String submit(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.submitInventory(json.getLong("id")));
}
@PostMapping("/audit")
public String audit(@RequestBody JSONObject json) throws Exception {
Boolean approved = json.getBoolean("approved");
return inventoryResult(service.auditInventory(json.getLong("id"), approved == null || approved,
json.getString("remark")));
}
@PostMapping("/close")
public String close(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.closeInventory(json.getLong("id")));
}
@DeleteMapping("/delete")
public String delete(@RequestParam Long id) throws Exception {
return returnStr(new HashMap<>(), service.deleteInventory(id));
}
@PostMapping("/collaboration/create")
@ApiOperation("供协同服务调用:幂等创建盘点任务")
public String collaborationCreate(@RequestBody(required = false) JSONObject json) throws Exception {
return inventoryResult(service.createInventory(json == null ? new JSONObject() : json, "COLLABORATION"));
}
@PostMapping("/collaboration/record")
@ApiOperation("供协同服务调用:按盘点单和资产/设备编码回传盘点结果")
public String collaborationRecord(@RequestBody JSONObject json) throws Exception {
return inventoryResult(service.recordInventoryFromCollaboration(json));
}
private String inventoryResult(AssetInventory inventory) {
Map<String, Object> data = new HashMap<>();
data.put("inventory", inventory);
return returnJson(data, "成功", 200);
}
private static String value(String search, String key) {
return StringUtil.getInfo(search, key);
}
private static Long longValue(String search, String key) {
String value = value(search, key);
return value == null || value.trim().isEmpty() ? null : Long.valueOf(value);
}
}

View File

@@ -0,0 +1,102 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.datasource.entities.CustomerCategory;
import com.reallin.smt.service.CustomerCategoryService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 客户分类管理
*/
@RestController
@RequestMapping(value = "/customerCategory")
@Api(tags = {"客户分类管理"})
public class CustomerCategoryController extends BaseController {
private Logger logger = LoggerFactory.getLogger(CustomerCategoryController.class);
@Resource
private CustomerCategoryService customerCategoryService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getInfo(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
CustomerCategory category = customerCategoryService.getCustomerCategory(id);
Map<String, Object> objectMap = new HashMap<>();
if (category != null) {
objectMap.put("info", category);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String categoryName = StringUtil.getInfo(search, "categoryName");
String parentId = StringUtil.getInfo(search, "parentId");
List<CustomerCategory> list = customerCategoryService.select(categoryName,
parentId != null && !parentId.isEmpty() ? Long.parseLong(parentId) : null);
return getDataTable(list);
}
@GetMapping(value = "/treeList")
@ApiOperation(value = "获取树形列表")
public String getTreeList(HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
List<CustomerCategory> list = customerCategoryService.getTreeList();
objectMap.put("data", list);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String add(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = customerCategoryService.insertCustomerCategory(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String update(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = customerCategoryService.updateCustomerCategory(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String delete(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = customerCategoryService.deleteCustomerCategory(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDelete(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = customerCategoryService.batchDeleteByIds(ids, request);
return returnStr(objectMap, delete);
}
}

View File

@@ -0,0 +1,111 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.datasource.entities.CustomerContact;
import com.reallin.smt.service.CustomerContactService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 客户联系人管理
*/
@RestController
@RequestMapping(value = "/customerContact")
@Api(tags = {"客户联系人管理"})
public class CustomerContactController extends BaseController {
private Logger logger = LoggerFactory.getLogger(CustomerContactController.class);
@Resource
private CustomerContactService customerContactService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getInfo(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
CustomerContact contact = customerContactService.getCustomerContact(id);
Map<String, Object> objectMap = new HashMap<>();
if (contact != null) {
objectMap.put("info", contact);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String customerId = StringUtil.getInfo(search, "customerId");
String contactName = StringUtil.getInfo(search, "contactName");
List<CustomerContact> list = customerContactService.select(
customerId != null && !customerId.isEmpty() ? Long.parseLong(customerId) : null,
contactName);
return getDataTable(list);
}
@GetMapping(value = "/listByCustomerId")
@ApiOperation(value = "根据客户ID获取联系人列表")
public String getListByCustomerId(@RequestParam("customerId") Long customerId, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
List<CustomerContact> list = customerContactService.selectByCustomerId(customerId);
objectMap.put("data", list);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String add(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = customerContactService.insertCustomerContact(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String update(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = customerContactService.updateCustomerContact(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String delete(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = customerContactService.deleteCustomerContact(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDelete(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = customerContactService.batchDeleteByIds(ids, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteByCustomerId")
@ApiOperation(value = "根据客户ID删除所有联系人")
public String deleteByCustomerId(@RequestParam("customerId") Long customerId, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = customerContactService.deleteByCustomerId(customerId, request);
return returnStr(objectMap, delete);
}
}

View File

@@ -0,0 +1,29 @@
package com.reallin.smt.controller;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.service.DashboardService;
import com.reallin.smt.utils.BaseResponseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/dashboard")
@Api(tags = {"首页看板"})
public class DashboardController extends BaseController {
@Resource
private DashboardService dashboardService;
@GetMapping("/operationOverview")
@ApiOperation(value = "获取首页业务运营概览")
public BaseResponseInfo operationOverview() {
BaseResponseInfo response = new BaseResponseInfo();
response.code = 200;
response.data = dashboardService.getOperationOverview();
return response;
}
}

View File

@@ -0,0 +1,93 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.DeliveryPlanItem;
import com.reallin.smt.datasource.vo.DeliveryPlanVo4List;
import com.reallin.smt.service.DeliveryPlanService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
@RestController
@RequestMapping(value = "/deliveryPlan")
@Api(tags = {"交货计划管理"})
public class DeliveryPlanController extends BaseController {
@Resource
private DeliveryPlanService deliveryPlanService;
@GetMapping(value = "/list")
@ApiOperation(value = "交货计划列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) {
String planNumber = StringUtil.getInfo(search, "planNumber");
String sourceBillNumber = StringUtil.getInfo(search, "sourceBillNumber");
String saleOrderNumber = StringUtil.getInfo(search, "saleOrderNumber");
String sourceType = StringUtil.getInfo(search, "sourceType");
String status = StringUtil.getInfo(search, "status");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
List<DeliveryPlanVo4List> list = deliveryPlanService.select(planNumber, sourceBillNumber, saleOrderNumber,
sourceType, status, beginTime, endTime);
return getDataTable(list);
}
@GetMapping(value = "/detail")
@ApiOperation(value = "交货计划详情")
public BaseResponseInfo getDetail(@RequestParam("id") Long id, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
res.code = 200;
res.data = deliveryPlanService.getDetail(id);
return res;
}
@GetMapping(value = "/sourceItems")
@ApiOperation(value = "出库单可计划明细")
public BaseResponseInfo getSourceItems(@RequestParam("sourceBillId") Long sourceBillId, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
List<DeliveryPlanItem> rows = deliveryPlanService.getSourceItems(sourceBillId);
JSONObject data = new JSONObject();
data.put("rows", rows);
res.code = 200;
res.data = data;
return res;
}
@PostMapping(value = "/createFromSourceBill")
@ApiOperation(value = "从销售/零售出库单创建交货计划")
public String createFromSourceBill(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = deliveryPlanService.createFromSourceBill(obj, request);
return returnStr(objectMap, insert);
}
@PostMapping(value = "/batchCreateFromSourceBill")
@ApiOperation(value = "批量从销售/零售出库单创建交货计划")
public String batchCreateFromSourceBill(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = deliveryPlanService.batchCreateFromSourceBill(obj, request);
objectMap.put("message", "已生成" + insert + "张交货计划");
return returnStr(objectMap, insert);
}
@PostMapping(value = "/adjust")
@ApiOperation(value = "调整交货计划")
public String adjustPlan(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = deliveryPlanService.adjustPlan(obj, request);
return returnStr(objectMap, update);
}
}

View File

@@ -0,0 +1,305 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Depot;
import com.reallin.smt.datasource.entities.DepotEx;
import com.reallin.smt.datasource.entities.MaterialInitialStock;
import com.reallin.smt.datasource.entities.User;
import com.reallin.smt.service.DepotService;
import com.reallin.smt.service.MaterialService;
import com.reallin.smt.service.UserBusinessService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua 752*718*920
*/
@RestController
@RequestMapping(value = "/depot")
@Api(tags = {"仓库管理"})
public class DepotController extends BaseController {
private Logger logger = LoggerFactory.getLogger(DepotController.class);
@Resource
private DepotService depotService;
@Resource
private UserBusinessService userBusinessService;
@Resource
private MaterialService materialService;
@Resource
private UserService userService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Depot depot = depotService.getDepot(id);
Map<String, Object> objectMap = new HashMap<>();
if(depot != null) {
objectMap.put("info", depot);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
Integer type = StringUtil.parseInteger(StringUtil.getInfo(search, "type"));
String remark = StringUtil.getInfo(search, "remark");
List<DepotEx> list = depotService.select(name, type, remark);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = depotService.insertDepot(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = depotService.updateDepot(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = depotService.deleteDepot(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = depotService.batchDeleteDepot(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = depotService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 仓库列表
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllList")
@ApiOperation(value = "仓库列表")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
List<Depot> depotList = depotService.getAllList();
res.code = 200;
res.data = depotList;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 用户对应仓库显示
* @param type
* @param keyId
* @param request
* @return
*/
@GetMapping(value = "/findUserDepot")
@ApiOperation(value = "用户对应仓库显示")
public JSONArray findUserDepot(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request) throws Exception{
JSONArray arr = new JSONArray();
try {
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, keyId);
List<Depot> dataList = depotService.findUserDepot();
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 0);
outer.put("key", 0);
outer.put("value", 0);
outer.put("title", "仓库列表");
outer.put("attributes", "仓库列表");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Depot depot : dataList) {
JSONObject item = new JSONObject();
item.put("id", depot.getId());
item.put("key", depot.getId());
item.put("value", depot.getId());
item.put("title", depot.getName());
item.put("attributes", depot.getName());
Boolean flag = ubValue.contains("[" + depot.getId().toString() + "]");
if (flag) {
item.put("checked", true);
}
dataArray.add(item);
}
}
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 获取当前用户拥有权限的仓库列表
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/findDepotByCurrentUser")
@ApiOperation(value = "获取当前用户拥有权限的仓库列表")
public BaseResponseInfo findDepotByCurrentUser(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONArray arr = depotService.findDepotByCurrentUser();
res.code = 200;
res.data = arr;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 更新默认仓库
* @param object
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/updateIsDefault")
@ApiOperation(value = "更新默认仓库")
public String updateIsDefault(@RequestBody JSONObject object,
HttpServletRequest request) throws Exception{
Long depotId = object.getLong("id");
Map<String, Object> objectMap = new HashMap<>();
int res = depotService.updateIsDefault(depotId);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 仓库列表-带库存
* @param mId
* @param request
* @return
*/
@GetMapping(value = "/getAllListWithStock")
@ApiOperation(value = "仓库列表-带库存")
public BaseResponseInfo getAllList(@RequestParam("mId") Long mId,
HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<Depot> list = depotService.getAllList();
List<DepotEx> depotList = new ArrayList<DepotEx>();
for(Depot depot: list) {
DepotEx de = new DepotEx();
if(mId!=0) {
BigDecimal initStock = materialService.getInitStock(mId, depot.getId());
BigDecimal currentStock = materialService.getCurrentStockByMaterialIdAndDepotId(mId, depot.getId());
de.setInitStock(initStock);
de.setCurrentStock(currentStock);
MaterialInitialStock materialInitialStock = materialService.getSafeStock(mId, depot.getId());
de.setLowSafeStock(materialInitialStock.getLowSafeStock());
de.setHighSafeStock(materialInitialStock.getHighSafeStock());
} else {
de.setInitStock(BigDecimal.ZERO);
de.setCurrentStock(BigDecimal.ZERO);
}
de.setId(depot.getId());
de.setName(depot.getName());
depotList.add(de);
}
res.code = 200;
res.data = depotList;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = depotService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,864 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.constants.ExceptionConstants;
import com.reallin.smt.datasource.entities.DepotHead;
import com.reallin.smt.datasource.entities.DepotHeadVo4Body;
import com.reallin.smt.datasource.vo.DepotHeadVo4InDetail;
import com.reallin.smt.datasource.vo.DepotHeadVo4InOutMCount;
import com.reallin.smt.datasource.vo.DepotHeadVo4List;
import com.reallin.smt.datasource.vo.DepotHeadVo4StatementAccount;
import com.reallin.smt.service.DepotService;
import com.reallin.smt.service.DepotHeadService;
import com.reallin.smt.service.MaterialService;
import com.reallin.smt.service.SystemConfigService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji-sheng-hua 752*718*920
*/
@RestController
@RequestMapping(value = "/depotHead")
@Api(tags = {"单据管理"})
public class DepotHeadController extends BaseController {
private Logger logger = LoggerFactory.getLogger(DepotHeadController.class);
@Resource
private DepotHeadService depotHeadService;
@Resource
private DepotService depotService;
@Resource
private MaterialService materialService;
@Resource
private SystemConfigService systemConfigService;
@Resource
private UserService userService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
DepotHead depotHead = depotHeadService.getDepotHead(id);
Map<String, Object> objectMap = new HashMap<>();
if(depotHead != null) {
objectMap.put("info", depotHead);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String hasDebt = StringUtil.getInfo(search, "hasDebt");
String hasLastDebt = StringUtil.getInfo(search, "hasLastDebt");
String status = StringUtil.getInfo(search, "status");
String purchaseStatus = StringUtil.getInfo(search, "purchaseStatus");
String number = StringUtil.getInfo(search, "number");
String linkApply = StringUtil.getInfo(search, "linkApply");
String linkNumber = StringUtil.getInfo(search, "linkNumber");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String materialParam = StringUtil.getInfo(search, "materialParam");
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
Long accountId = StringUtil.parseStrLong(StringUtil.getInfo(search, "accountId"));
String salesMan = StringUtil.getInfo(search, "salesMan");
String remark = StringUtil.getInfo(search, "remark");
List<DepotHeadVo4List> list = depotHeadService.select(type, subType, hasDebt, hasLastDebt, status, purchaseStatus, number, linkApply, linkNumber,
beginTime, endTime, materialParam, organId, creator, depotId, accountId, salesMan, remark);
return getDataTable(list);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = depotHeadService.deleteDepotHead(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = depotHeadService.batchDeleteDepotHead(ids, request);
return returnStr(objectMap, delete);
}
@PostMapping(value = "/forceCloseBatch")
@ApiOperation(value = "强制结单")
public String forceCloseBatch(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String ids = jsonObject.getString("ids");
int res = depotHeadService.batchForceClose(ids, request);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/forceClosePurchaseBatch")
@ApiOperation(value = "强制结单-以销定购")
public String forceClosePurchaseBatch(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String ids = jsonObject.getString("ids");
int res = depotHeadService.batchForceClosePurchase(ids, request);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/batchSetLastDebt")
@ApiOperation(value = "修正最终欠款")
public String batchSetLastDebt(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String ids = jsonObject.getString("ids");
int res = depotHeadService.batchSetLastDebt(ids, request);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/batchSetLastDeposit")
@ApiOperation(value = "修正剩余订金")
public String batchSetLastDeposit(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String ids = jsonObject.getString("ids");
int res = depotHeadService.batchSetLastDeposit(ids, request);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 批量设置状态-审核或者反审核
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态-审核或者反审核")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception{
Map<String, Object> objectMap = new HashMap<>();
String status = jsonObject.getString("status");
String ids = jsonObject.getString("ids");
int res = depotHeadService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 入库出库明细接口
* @param currentPage
* @param pageSize
* @param oId
* @param number
* @param materialParam
* @param depotId
* @param beginTime
* @param endTime
* @param type
* @param request
* @return
*/
@GetMapping(value = "/findInOutDetail")
@ApiOperation(value = "入库出库明细接口")
public BaseResponseInfo findInOutDetail(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@RequestParam(value = "creator", required = false) Long creator,
@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("remark") String remark,
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
List<DepotHeadVo4InDetail> resList = new ArrayList<DepotHeadVo4InDetail>();
String [] creatorArray = depotHeadService.getCreatorArray();
if(creatorArray == null && organizationId != null) {
creatorArray = depotHeadService.getCreatorArrayByOrg(organizationId);
}
String subType = "出库".equals(type)? "销售" : "";
String [] organArray = depotHeadService.getOrganArray(subType, "");
List<Long> categoryList = new ArrayList<>();
if(categoryId != null){
categoryList = materialService.getListByParentId(categoryId);
}
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
List<DepotHeadVo4InDetail> list = depotHeadService.findInOutDetail(beginTime, endTime, type, creatorArray, organArray, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark,
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutDetailCount(beginTime, endTime, type, creatorArray, organArray, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark);
map.put("total", total);
//存放数据json数组
if (null != list) {
resList.addAll(list);
}
map.put("rows", resList);
DepotHeadVo4InDetail statistic = depotHeadService.findInOutDetailStatistic(beginTime, endTime, type, creatorArray, organArray, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, oId, StringUtil.toNull(number), creator, remark);
map.put("operNumberTotal", statistic.getOperNumber());
map.put("allPriceTotal", statistic.getAllPrice());
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 入库出库汇总接口
* @param currentPage
* @param pageSize
* @param oId
* @param materialParam
* @param depotId
* @param beginTime
* @param endTime
* @param type
* @param request
* @return
*/
@GetMapping(value = "/findInOutMaterialCount")
@ApiOperation(value = "入库出库汇总接口")
public BaseResponseInfo findInOutMaterialCount(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "organId", required = false) Integer oId,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("type") String type,
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
List<Long> categoryList = new ArrayList<>();
if(categoryId != null){
categoryList = materialService.getListByParentId(categoryId);
}
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
List<DepotHeadVo4InOutMCount> list = depotHeadService.findInOutMaterialCount(beginTime, endTime, type, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, organizationId, oId, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order),
(currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findInOutMaterialCountTotal(beginTime, endTime, type, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, organizationId, oId);
map.put("total", total);
map.put("rows", list);
DepotHeadVo4InOutMCount statistic = depotHeadService.findInOutMaterialCountStatistic(beginTime, endTime, type, categoryList, forceFlag, inOutManageFlag,
StringUtil.toNull(materialParam), depotList, organizationId, oId);
map.put("numSumTotal", statistic.getNumSum());
map.put("priceSumTotal", statistic.getPriceSum());
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 调拨明细统计
* @param currentPage
* @param pageSize
* @param number
* @param materialParam
* @param depotIdF 调出仓库
* @param depotId 调入仓库
* @param beginTime
* @param endTime
* @param subType
* @param request
* @return
*/
@GetMapping(value = "/findAllocationDetail")
@ApiOperation(value = "调拨明细统计")
public BaseResponseInfo findallocationDetail(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("number") String number,
@RequestParam("materialParam") String materialParam,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "depotIdF", required = false) Long depotIdF,
@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam("subType") String subType,
@RequestParam("remark") String remark,
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Long> depotList = new ArrayList<>();
List<Long> depotFList = new ArrayList<>();
if(depotId != null) {
depotList.add(depotId);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
if(depotIdF != null) {
depotFList.add(depotIdF);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotFList.add(object.getLong("id"));
}
}
String [] creatorArray = depotHeadService.getCreatorArray();
if(creatorArray == null && organizationId != null) {
creatorArray = depotHeadService.getCreatorArrayByOrg(organizationId);
}
List<Long> categoryList = new ArrayList<>();
if(categoryId != null){
categoryList = materialService.getListByParentId(categoryId);
}
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotHeadVo4InDetail> list = depotHeadService.findAllocationDetail(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, categoryList, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark,
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.findAllocationDetailCount(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, categoryList, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark);
map.put("rows", list);
map.put("total", total);
DepotHeadVo4InDetail statistic = depotHeadService.findAllocationStatistic(beginTime, endTime, subType, StringUtil.toNull(number),
creatorArray, categoryList, forceFlag, StringUtil.toNull(materialParam), depotList, depotFList, remark);
map.put("operNumberTotal", statistic.getOperNumber());
map.put("allPriceTotal", statistic.getAllPrice());
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 对账单接口
* @param currentPage
* @param pageSize
* @param beginTime
* @param endTime
* @param organId
* @param hasDebt 1-有欠款 0-无欠款
* @param supplierType
* @param request
* @return
*/
@GetMapping(value = "/getStatementAccount")
@ApiOperation(value = "对账单接口")
public BaseResponseInfo getStatementAccount(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("beginTime") String beginTime,
@RequestParam("endTime") String endTime,
@RequestParam(value = "organId", required = false) Integer organId,
@RequestParam(value = "hasDebt", required = false) Integer hasDebt,
@RequestParam("supplierType") String supplierType,
@RequestParam(value = "billDirection", required = false) String billDirection,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
String type = "";
String subType = "";
String typeBack = "";
String subTypeBack = "";
String billType = "";
if (("供应商").equals(supplierType)) {
type = "入库";
subType = "采购";
typeBack = "出库";
subTypeBack = "采购退货";
billType = "付款";
} else if (("客户").equals(supplierType)) {
type = "出库";
subType = "销售";
typeBack = "入库";
subTypeBack = "销售退货";
billType = "收款";
} else if (("会员").equals(supplierType)) {
if (("付款").equals(billDirection)) {
type = "入库";
subType = "零售退货";
billType = "付款";
} else {
type = "出库";
subType = "零售";
billType = "收款";
}
}
String [] organArray = depotHeadService.getOrganArray(subType, "");
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
List<DepotHeadVo4StatementAccount> list = depotHeadService.getStatementAccount(beginTime, endTime, organId, organArray,
hasDebt, supplierType, type, subType,typeBack, subTypeBack, billType, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.getStatementAccountCount(beginTime, endTime, organId, organArray,
hasDebt, supplierType, type, subType,typeBack, subTypeBack, billType);
for(DepotHeadVo4StatementAccount item: list) {
//期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreReturnDebtMoney()).subtract(item.getPreBackMoney());
item.setPreNeed(preNeed);
//实际欠款 = 本期欠款-本期退货的欠款金额
BigDecimal realDebtMoney = item.getDebtMoney().subtract(item.getReturnDebtMoney());
item.setDebtMoney(realDebtMoney);
//期末 = 期初+实际欠款-本期收款
BigDecimal allNeedGet = preNeed.add(realDebtMoney).subtract(item.getBackMoney());
item.setAllNeed(allNeedGet);
}
map.put("rows", list);
map.put("total", total);
List<DepotHeadVo4StatementAccount> totalPayList = depotHeadService.getStatementAccountTotalPay(beginTime, endTime, organId, organArray,
hasDebt, supplierType, type, subType, typeBack, subTypeBack, billType);
if(totalPayList.size()>0) {
DepotHeadVo4StatementAccount totalPayItem = totalPayList.get(0);
BigDecimal firstMoney = BigDecimal.ZERO;
BigDecimal lastMoney = BigDecimal.ZERO;
if(totalPayItem!=null) {
//期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
firstMoney = totalPayItem.getBeginNeed().add(totalPayItem.getPreDebtMoney()).subtract(totalPayItem.getPreReturnDebtMoney()).subtract(totalPayItem.getPreBackMoney());
//期末 = 期初+本期欠款-本期退货的欠款金额-本期收款
lastMoney = firstMoney.add(totalPayItem.getDebtMoney()).subtract(totalPayItem.getReturnDebtMoney()).subtract(totalPayItem.getBackMoney());
}
map.put("firstMoney", firstMoney); //期初
map.put("lastMoney", lastMoney); //期末
}
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 获取待收款或付款的条数
* @param request
* @return
*/
@GetMapping(value = "/getNeedCount")
@ApiOperation(value = "获取待收款或付款的条数")
public BaseResponseInfo getNeedCount(@RequestParam("type") String type, HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
String supplierType = "";
if (("vendor").equals(type)) {
supplierType = "供应商";
} else if (("customer").equals(type)) {
supplierType = "客户";
}
int needCount = depotHeadService.getNeedCount(supplierType);
map.put("needCount", needCount);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据编号查询单据信息
* @param number
* @param request
* @return
*/
@GetMapping(value = "/getDetailByNumber")
@ApiOperation(value = "根据编号查询单据信息")
public BaseResponseInfo getDetailByNumber(@RequestParam("number") String number,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
DepotHeadVo4List dhl = new DepotHeadVo4List();
try {
List<DepotHeadVo4List> list = depotHeadService.getDetailByNumber(number, request);
if(list.size()>0) {
dhl = list.get(0);
}
res.code = 200;
res.data = dhl;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据原单号查询关联的单据列表
* @param number
* @param request
* @return
*/
@GetMapping(value = "/getBillListByLinkNumber")
@ApiOperation(value = "根据原单号查询关联的单据列表")
public BaseResponseInfo getBillListByLinkNumber(@RequestParam("number") String number,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
DepotHead dh = new DepotHead();
try {
List<DepotHead> list = depotHeadService.getBillListByLinkNumber(number);
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 新增单据主表及单据子表信息
* @param body
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/addDepotHeadAndDetail")
@ApiOperation(value = "新增单据主表及单据子表信息")
public Object addDepotHeadAndDetail(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
String beanJson = body.getInfo();
String rows = body.getRows();
depotHeadService.addDepotHeadAndDetail(beanJson, rows, request);
return result;
}
/**
* 更新单据主表及单据子表信息
* @param body
* @param request
* @return
* @throws Exception
*/
@PutMapping(value = "/updateDepotHeadAndDetail")
@ApiOperation(value = "更新单据主表及单据子表信息")
public Object updateDepotHeadAndDetail(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
String beanJson = body.getInfo();
String rows = body.getRows();
depotHeadService.updateDepotHeadAndDetail(beanJson,rows,request);
return result;
}
/**
* 统计今日采购额、昨日采购额、本月采购额、今年采购额|销售额|零售额
* @param request
* @return
*/
@GetMapping(value = "/getBuyAndSaleStatistics")
@ApiOperation(value = "统计今日采购额、昨日采购额、本月采购额、今年采购额|销售额|零售额")
public BaseResponseInfo getBuyAndSaleStatistics(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> map = new HashMap<>();
String today = Tools.getNow() + BusinessConstants.DAY_FIRST_TIME;
String monthFirstDay = Tools.firstDayOfMonth(Tools.getCurrentMonth()) + BusinessConstants.DAY_FIRST_TIME;
String yesterdayBegin = Tools.getYesterday() + BusinessConstants.DAY_FIRST_TIME;
String yesterdayEnd = Tools.getYesterday() + BusinessConstants.DAY_LAST_TIME;
String yearBegin = Tools.getYearBegin() + BusinessConstants.DAY_FIRST_TIME;
String yearEnd = Tools.getYearEnd() + BusinessConstants.DAY_LAST_TIME;
map = depotHeadService.getBuyAndSaleStatistics(today, monthFirstDay, yesterdayBegin, yesterdayEnd, yearBegin, yearEnd, request);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据当前用户获取操作员数组,用于控制当前用户的数据权限,限制可以看到的单据范围
* 注意:该接口提供给部分插件使用,勿删
* @param request
* @return
*/
@GetMapping(value = "/getCreatorByCurrentUser")
@ApiOperation(value = "根据当前用户获取操作员数组")
public BaseResponseInfo getCreatorByCurrentUser(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
String creator = depotHeadService.getCreatorByCurrentUser();
res.code = 200;
res.data = creator;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查询存在欠款的单据
* @param search
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/debtList")
@ApiOperation(value = "查询存在欠款的单据")
public String debtList(@RequestParam(value = Constants.SEARCH, required = false) String search,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
Long organId = StringUtil.parseStrLong(StringUtil.getInfo(search, "organId"));
String materialParam = StringUtil.getInfo(search, "materialParam");
String number = StringUtil.getInfo(search, "number");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String status = StringUtil.getInfo(search, "status");
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime,
status, type, subType, (currentPage-1)*pageSize, pageSize);
int total = depotHeadService.debtListCount(organId, materialParam, number, beginTime, endTime, status, type, subType);
if (list != null) {
objectMap.put("rows", list);
objectMap.put("total", total);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
objectMap.put("rows", new ArrayList<>());
objectMap.put("total", 0);
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
}
/**
* 导出存在欠款的单据
* @param organId
* @param materialParam
* @param number
* @param type
* @param subType
* @param beginTime
* @param endTime
* @param status
* @param mpList
* @param request
* @param response
* @throws Exception
*/
@GetMapping(value = "/debtExport")
@ApiOperation(value = "导出存在欠款的单据")
public void debtExport(@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "materialParam", required = false) String materialParam,
@RequestParam(value = "number", required = false) String number,
@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "subType", required = false) String subType,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "mpList", required = false) String mpList,
HttpServletRequest request, HttpServletResponse response)throws Exception {
try {
depotHeadService.debtExport(organId, materialParam, number, type, subType, beginTime, endTime,
status, mpList, request, response);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* 查询等待入库或出库的单据
* @param search
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/waitBillList")
@ApiOperation(value = "查询等待入库或出库的单据")
public String waitBillList(@RequestParam(value = Constants.SEARCH, required = false) String search,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String number = StringUtil.getInfo(search, "number");
String materialParam = StringUtil.getInfo(search, "materialParam");
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String status = StringUtil.getInfo(search, "status");
List<DepotHeadVo4List> list = depotHeadService.waitBillList(number, materialParam, type, subType, beginTime, endTime,
status, (currentPage-1)*pageSize, pageSize);
long total = depotHeadService.waitBillCount(number, materialParam, type, subType, beginTime, endTime, status);
if (list != null) {
objectMap.put("rows", list);
objectMap.put("total", total);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
objectMap.put("rows", new ArrayList<>());
objectMap.put("total", 0);
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
}
/**
* 查询等待入库或出库的单据数量
* @param search
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/waitBillCount")
@ApiOperation(value = "查询等待入库或出库的单据数量")
public String waitBillCount(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String number = StringUtil.getInfo(search, "number");
String materialParam = StringUtil.getInfo(search, "materialParam");
String type = StringUtil.getInfo(search, "type");
String subType = StringUtil.getInfo(search, "subType");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String status = StringUtil.getInfo(search, "status");
long total = depotHeadService.waitBillCount(number, materialParam, type, subType, beginTime, endTime, status);
objectMap.put("total", total);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 批量新增入库或出库单据
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchAddDepotHeadAndDetail")
@ApiOperation(value = "批量新增入库或出库单据")
public Object batchAddDepotHeadAndDetail(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
String ids = jsonObject.getString("ids");
depotHeadService.batchAddDepotHeadAndDetail(ids, request);
return result;
}
/**
* 快捷编辑单据
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PutMapping(value = "/quickEdit")
@ApiOperation(value = "快捷编辑单据")
public Object quickEdit(@RequestBody JSONObject jsonObject, HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
Long id = jsonObject.getLong("id");
String remark = jsonObject.getString("remark");
depotHeadService.quickEditDepotHead(id, remark, request);
return result;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.AssetInventory;
import com.reallin.smt.service.AssetManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
/**
* 兼容原设备管理项目的设备盘点回传路径。
*/
@RestController
@RequestMapping("/deviceInventory")
@Api(tags = "设备盘点外部兼容接口")
public class DeviceInventoryCompatibilityController {
@Resource
private AssetManagementService service;
@PostMapping("/doDevicePlan")
@ApiOperation("兼容原接口:外部服务回传单台设备已盘点")
public String doDevicePlan(@RequestBody JSONObject json) throws Exception {
AssetInventory inventory = service.recordInventoryFromCollaboration(json);
Map<String, Object> data = new HashMap<>();
data.put("inventory", inventory);
return returnJson(data, "盘点成功", 200);
}
}

View File

@@ -0,0 +1,361 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.*;
import com.reallin.smt.service.FunctionService;
import com.reallin.smt.service.SystemConfigService;
import com.reallin.smt.service.UserBusinessService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji-sheng-hua jshERP
*/
@RestController
@RequestMapping(value = "/function")
@Api(tags = {"功能管理"})
public class FunctionController extends BaseController {
private Logger logger = LoggerFactory.getLogger(FunctionController.class);
@Resource
private FunctionService functionService;
@Resource
private UserService userService;
@Resource
private UserBusinessService userBusinessService;
@Resource
private SystemConfigService systemConfigService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Function function = functionService.getFunction(id);
Map<String, Object> objectMap = new HashMap<>();
if(function != null) {
objectMap.put("info", function);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String nameEn = StringUtil.getInfo(search, "nameEn");
String type = StringUtil.getInfo(search, "type");
List<FunctionEx> list = functionService.select(name, nameEn, type);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = functionService.insertFunction(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = functionService.updateFunction(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = functionService.deleteFunction(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = functionService.batchDeleteFunction(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = functionService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@GetMapping(value = "/checkIsNumberExist")
@ApiOperation(value = "检查编号是否存在")
public String checkIsNumberExist(@RequestParam Long id,
@RequestParam(value ="number", required = false) String number,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int exist = functionService.checkIsNumberExist(id, number);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 根据父编号查询菜单
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/findMenuByPNumber")
@ApiOperation(value = "根据父编号查询菜单")
public JSONArray findMenuByPNumber(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
String pNumber = jsonObject.getString("pNumber");
String userId = jsonObject.getString("userId");
//存放数据json数组
JSONArray dataArray = new JSONArray();
try {
Long roleId = 0L;
String fc = "";
List<UserBusiness> roleList = userBusinessService.getBasicData(userId, "UserRole");
if(roleList!=null && roleList.size()>0){
String value = roleList.get(0).getValue();
if(StringUtil.isNotEmpty(value)){
String roleIdStr = value.replace("[", "").replace("]", "");
roleId = Long.parseLong(roleIdStr);
}
}
//当前用户所拥有的功能列表,格式如:[1][2][5]
List<UserBusiness> funList = userBusinessService.getBasicData(roleId.toString(), "RoleFunctions");
if(funList!=null && funList.size()>0){
fc = funList.get(0).getValue();
}
//获取系统配置信息-是否开启多级审核
String approvalFlag = "0";
List<SystemConfig> list = systemConfigService.getSystemConfig();
if(list.size()>0) {
approvalFlag = list.get(0).getMultiLevelApprovalFlag();
}
List<Function> dataList = functionService.getRoleFunction(pNumber);
if (dataList.size() != 0) {
User userInfo = userService.getCurrentUser();
Map<Long, Long> funIdMap = null;
dataArray = getMenuByFunction(dataList, fc, approvalFlag, funIdMap, userInfo);
//增加首页菜单项
JSONObject homeItem = new JSONObject();
homeItem.put("id", 0);
homeItem.put("text", "首页");
homeItem.put("textEn", "Home");
homeItem.put("icon", "home");
homeItem.put("url", "/dashboard/analysis");
homeItem.put("component", "/layouts/TabLayout");
dataArray.add(0,homeItem);
}
} catch (DataAccessException e) {
logger.error(">>>>>>>>>>>>>>>>>>>查找异常", e);
}
return dataArray;
}
public JSONArray getMenuByFunction(List<Function> dataList, String fc, String approvalFlag, Map<Long, Long> funIdMap, User userInfo) throws Exception {
JSONArray dataArray = new JSONArray();
for (Function function : dataList) {
// 取消租户概念后,移除租户权限校验
// if("admin".equals(userInfo.getLoginName()) || userInfo.getId().equals(userInfo.getTenantId()) || funIdMap.get(function.getId())!=null) {
//如果关闭多级审核,遇到任务审核菜单直接跳过
if("0".equals(approvalFlag) && "/workflow".equals(function.getUrl())) {
continue;
}
JSONObject item = new JSONObject();
List<Function> newList = functionService.getRoleFunction(function.getNumber());
item.put("id", function.getId());
item.put("text", function.getName());
item.put("textEn", function.getNameEn());
item.put("icon", function.getIcon());
item.put("url", function.getUrl());
item.put("component", function.getComponent());
if (newList.size()>0) {
JSONArray childrenArr = getMenuByFunction(newList, fc, approvalFlag, funIdMap, userInfo);
if(childrenArr.size()>0) {
item.put("children", childrenArr);
dataArray.add(item);
}
} else {
if (fc.indexOf("[" + function.getId().toString() + "]") != -1) {
dataArray.add(item);
}
}
// }
}
return dataArray;
}
/**
* 角色对应功能显示
* @param request
* @return
*/
@GetMapping(value = "/findRoleFunction")
@ApiOperation(value = "角色对应功能显示")
public JSONArray findRoleFunction(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
User userInfo = userService.getCurrentUser();
//拥有“权限管理”按钮权限的用户可分配全部菜单;其他用户只能分配自身已有菜单
List<Long> funIdList = userService.hasPermissionManagement()
? null : functionService.getCurrentUserFunIdList();
List<Function> dataListFun = functionService.findRoleFunction("0", null);
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 0);
outer.put("key", 0);
outer.put("value", 0);
outer.put("title", "功能列表");
outer.put("attributes", "功能列表");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataListFun) {
// 取消租户概念后,不再过滤系统管理菜单
// 根据条件从列表里面移除"系统管理"
List<Function> dataList = new ArrayList<>();
for (Function fun : dataListFun) {
dataList.add(fun);
}
dataArray = getFunctionList(dataList, type, keyId, funIdList);
outer.put("children", dataArray);
}
arr.add(outer);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return arr;
}
public JSONArray getFunctionList(List<Function> dataList, String type, String keyId, List<Long> funIdList) throws Exception {
JSONArray dataArray = new JSONArray();
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, keyId);
if (null != dataList) {
for (Function function : dataList) {
JSONObject item = new JSONObject();
item.put("id", function.getId());
item.put("key", function.getId());
item.put("value", function.getId());
item.put("title", function.getName());
item.put("titleEn", function.getNameEn());
item.put("attributes", function.getName());
List<Function> funList = functionService.findRoleFunction(function.getNumber(), funIdList);
if(funList.size()>0) {
JSONArray funArr = getFunctionList(funList, type, keyId, funIdList);
item.put("children", funArr);
dataArray.add(item);
} else {
Boolean flag = ubValue.contains("[" + function.getId().toString() + "]");
item.put("checked", flag);
dataArray.add(item);
}
}
}
return dataArray;
}
/**
* 根据id列表查找功能信息
* @param roleId
* @param request
* @return
*/
@GetMapping(value = "/findRoleFunctionsById")
@ApiOperation(value = "根据id列表查找功能信息")
public BaseResponseInfo findByIds(@RequestParam("roleId") Long roleId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<UserBusiness> list = userBusinessService.getBasicData(roleId.toString(), "RoleFunctions");
if(null!=list && list.size()>0) {
//按钮
Map<Long,String> btnMap = new HashMap<>();
String btnStr = list.get(0).getBtnStr();
if(StringUtil.isNotEmpty(btnStr)) {
JSONArray btnArr = JSONArray.parseArray(btnStr);
for(Object obj: btnArr) {
JSONObject btnObj = JSONObject.parseObject(obj.toString());
if(btnObj.get("funId")!=null && btnObj.get("btnStr")!=null) {
btnMap.put(btnObj.getLong("funId"), btnObj.getString("btnStr"));
}
}
}
//菜单
String funIds = list.get(0).getValue();
funIds = funIds.substring(1, funIds.length() - 1);
funIds = funIds.replace("][",",");
List<Function> dataList = functionService.findByIds(funIds);
JSONObject outer = new JSONObject();
User userInfo = userService.getCurrentUser();
// 取消租户概念后,移除权限校验
// Map<Long, Long> funIdMap = functionService.getCurrentUserFunIdMap();
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Function function : dataList) {
// 取消租户概念后,不再校验租户权限
// if("admin".equals(userInfo.getLoginName()) || funIdMap.get(function.getId())!=null) {
JSONObject item = new JSONObject();
item.put("id", function.getId());
item.put("name", function.getName());
item.put("pushBtn", function.getPushBtn());
item.put("btnStr", btnMap.get(function.getId()));
dataArray.add(item);
// }
}
}
outer.put("rows", dataArray);
outer.put("total", dataArray.size());
res.code = 200;
res.data = outer;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,76 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.DepotHeadVo4Body;
import com.reallin.smt.service.DepotHeadService;
import com.reallin.smt.service.SmtInboundService;
import com.reallin.smt.utils.BaseResponseInfo;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@RequestMapping("/headquartersInbound")
public class HeadquartersInboundController {
@Resource private SmtInboundService inboundService;
@Resource private DepotHeadService depotHeadService;
@GetMapping("/nextNumber")
public BaseResponseInfo nextNumber(@RequestParam(required = false) String businessDate) {
return ok(Collections.singletonMap("number", inboundService.nextNumber(businessDate)));
}
@RequestMapping(value = "/save", method = {RequestMethod.POST, RequestMethod.PUT})
public BaseResponseInfo save(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) {
Long id = inboundService.save(JSONObject.parseObject(body.getInfo()), JSONArray.parseArray(body.getRows()), inboundService.creatorId(request));
return ok(Collections.singletonMap("id", id));
}
@GetMapping("/details")
public BaseResponseInfo details(@RequestParam Long headerId) {
List<Map<String, Object>> rows = inboundService.details(headerId);
Map<String, Object> data = new HashMap<>();
data.put("rows", rows); data.put("total", rows.size());
return ok(data);
}
@PostMapping("/importExcel")
public BaseResponseInfo importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws Exception {
return ok(inboundService.importExcel(file, inboundService.creatorId(request)));
}
@GetMapping("/template")
public void template(HttpServletResponse response) throws Exception { inboundService.exportTemplate(response); }
@PostMapping("/sync")
public BaseResponseInfo sync(@RequestBody List<JSONObject> payload, HttpServletRequest request) {
return ok(inboundService.sync(payload, inboundService.creatorId(request)));
}
@PostMapping("/createMaterial")
public BaseResponseInfo createMaterial(@RequestBody JSONObject item) {
return ok(inboundService.createMaterialIfMissing(item));
}
@PostMapping("/batchSetStatus")
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public BaseResponseInfo batchSetStatus(@RequestBody JSONObject body) throws Exception {
String status = body.getString("status");
String ids = body.getString("ids");
if ("1".equals(status)) {
for (String id : ids.split(",")) if (!id.trim().isEmpty()) inboundService.prepareForApproval(Long.valueOf(id.trim()));
}
depotHeadService.batchSetStatus(status, ids);
return ok(null);
}
private BaseResponseInfo ok(Object data) {
BaseResponseInfo response = new BaseResponseInfo(); response.code = 200; response.data = data; return response;
}
}

View File

@@ -0,0 +1,161 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.InOutItem;
import com.reallin.smt.service.InOutItemService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author jishenghua jshERP 2018年12月25日14:38:08
*/
@RestController
@RequestMapping(value = "/inOutItem")
@Api(tags = {"收支项目"})
public class InOutItemController extends BaseController {
private Logger logger = LoggerFactory.getLogger(InOutItemController.class);
@Resource
private InOutItemService inOutItemService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
InOutItem inOutItem = inOutItemService.getInOutItem(id);
Map<String, Object> objectMap = new HashMap<>();
if(inOutItem != null) {
objectMap.put("info", inOutItem);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
String remark = StringUtil.getInfo(search, "remark");
List<InOutItem> list = inOutItemService.select(name, type, remark);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = inOutItemService.insertInOutItem(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = inOutItemService.updateInOutItem(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = inOutItemService.deleteInOutItem(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = inOutItemService.batchDeleteInOutItem(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在-后续废弃")
public String checkIsNameExist(@RequestParam Long id,
@RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = inOutItemService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 查找收支项目信息-下拉框
* @param request
* @return
*/
@GetMapping(value = "/findBySelect")
@ApiOperation(value = "查找收支项目信息")
public String findBySelect(@RequestParam("type") String type, HttpServletRequest request) throws Exception{
String res = null;
try {
List<InOutItem> dataList = inOutItemService.findBySelect(type);
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (InOutItem inOutItem : dataList) {
JSONObject item = new JSONObject();
item.put("id", inOutItem.getId());
//收支项目名称
item.put("name", inOutItem.getName());
dataArray.add(item);
}
}
res = dataArray.toJSONString();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "获取数据失败";
}
return res;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = inOutItemService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,90 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.exception.LegacyInventoryBusinessException;
import com.reallin.smt.service.LegacyInventoryService;
import com.reallin.smt.utils.LegacyInventoryResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* 兼容原 n2tpm 设备盘点客户端的大写字段接口。
*/
@RestController
@RequestMapping({"/n2tpm/webmvc/Inventory", "/webmvc/Inventory"})
public class LegacyInventoryController {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(LegacyInventoryController.class);
@Resource
private LegacyInventoryService legacyInventoryService;
@PostMapping("/Login")
public LegacyInventoryResponse login(@RequestBody JSONObject input) {
return execute(() -> legacyInventoryService.login(input));
}
@PostMapping("/GetInventory")
public LegacyInventoryResponse getInventory(@RequestBody JSONObject input) {
return execute(() -> legacyInventoryService.getInventory(input));
}
@PostMapping("/GetInventoryDetail")
public LegacyInventoryResponse getInventoryDetail(@RequestBody JSONObject input) {
return execute(() -> legacyInventoryService.getInventoryDetail(input));
}
@PostMapping("/SaveDeviceInventoryInfo")
public LegacyInventoryResponse saveDeviceInventoryInfo(@RequestBody JSONObject input) {
return execute(() -> legacyInventoryService.saveDeviceInventoryInfo(input));
}
@PostMapping("/AccepteOrHandoverDocForInventory")
public LegacyInventoryResponse acceptInventory(@RequestBody JSONObject input) {
return execute(() -> legacyInventoryService.acceptInventory(input));
}
@PostMapping("/UploadPicture")
public LegacyInventoryResponse uploadPicture(HttpServletRequest request) {
return execute(() -> {
if (!(request instanceof MultipartHttpServletRequest)) {
throw new LegacyInventoryBusinessException("请求必须为 multipart/form-data");
}
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<MultipartFile> files = new ArrayList<>();
multipartRequest.getMultiFileMap().values().forEach(files::addAll);
return legacyInventoryService.uploadPicture(
request.getParameter("USER_ID"), request.getParameter("DATA_AUTH"),
request.getParameter("INVENTORY_DOC"), request.getParameter("DEVICE_SN"),
files, request);
});
}
@PostMapping({"/GetDevice", "/GetDevic"})
public LegacyInventoryResponse getDevice(@RequestBody(required = false) JSONObject input) {
return execute(() -> legacyInventoryService.getDevice(input));
}
private LegacyInventoryResponse execute(Action action) {
try {
return LegacyInventoryResponse.success(action.run());
} catch (LegacyInventoryBusinessException e) {
return LegacyInventoryResponse.fail(e.getMessage());
} catch (Exception e) {
logger.error("盘点接口处理失败", e);
return LegacyInventoryResponse.fail("处理失败,请联系管理员");
}
}
@FunctionalInterface
private interface Action {
Object run() throws Exception;
}
}

View File

@@ -0,0 +1,101 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Log;
import com.reallin.smt.datasource.vo.LogVo4List;
import com.reallin.smt.service.LogService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua 752*718*920
*/
@RestController
@RequestMapping(value = "/log")
@Api(tags = {"日志管理"})
public class LogController extends BaseController {
private Logger logger = LoggerFactory.getLogger(LogController.class);
@Resource
private LogService logService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Log log = logService.getLog(id);
Map<String, Object> objectMap = new HashMap<>();
if(log != null) {
objectMap.put("info", log);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String operation = StringUtil.getInfo(search, "operation");
String userInfo = StringUtil.getInfo(search, "userInfo");
String clientIp = StringUtil.getInfo(search, "clientIp");
String tenantLoginName = StringUtil.getInfo(search, "tenantLoginName");
String tenantType = StringUtil.getInfo(search, "tenantType");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
String content = StringUtil.getInfo(search, "content");
List<LogVo4List> list = logService.select(operation, userInfo, clientIp, tenantLoginName, tenantType, beginTime, endTime, content);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int insert = logService.insertLog(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = logService.updateLog(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = logService.deleteLog(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = logService.batchDeleteLog(ids, request);
return returnStr(objectMap, delete);
}
}

View File

@@ -0,0 +1,151 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.MaterialAttribute;
import com.reallin.smt.service.MaterialAttributeService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua jshERP
*/
@RestController
@RequestMapping(value = "/materialAttribute")
@Api(tags = {"商品属性"})
public class MaterialAttributeController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialAttributeController.class);
@Resource
private MaterialAttributeService materialAttributeService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialAttribute materialAttribute = materialAttributeService.getMaterialAttribute(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialAttribute != null) {
objectMap.put("info", materialAttribute);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String attributeName = StringUtil.getInfo(search, "attributeName");
String attributeValue = StringUtil.getInfo(search, "attributeValue");
List<MaterialAttribute> list = materialAttributeService.select(attributeName, attributeValue);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialAttributeService.insertMaterialAttribute(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialAttributeService.updateMaterialAttribute(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialAttributeService.deleteMaterialAttribute(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialAttributeService.batchDeleteMaterialAttribute(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialAttributeService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 获取商品属性的名称列表
* @param request
* @return
*/
@GetMapping(value = "/getNameList")
@ApiOperation(value = "获取商品属性的名称列表")
public JSONArray getNameList(HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
List<MaterialAttribute> materialAttributeList = materialAttributeService.getMaterialAttribute();
if (null != materialAttributeList) {
for (MaterialAttribute materialAttribute : materialAttributeList) {
JSONObject item = new JSONObject();
item.put("value", materialAttribute.getId().toString());
item.put("name", materialAttribute.getAttributeName());
dataArray.add(item);
}
}
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return dataArray;
}
/**
* 获取id查询属性的值列表
* @param request
* @return
*/
@GetMapping(value = "/getValueListById")
@ApiOperation(value = "获取id查询属性的值列表")
public JSONArray getValueListById(@RequestParam("id") Long id,
HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
dataArray = materialAttributeService.getValueArrById(id);
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return dataArray;
}
}

View File

@@ -0,0 +1,192 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.MaterialCategory;
import com.reallin.smt.datasource.vo.TreeNode;
import com.reallin.smt.service.MaterialCategoryService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji—sheng—hua jshERP
*/
@RestController
@RequestMapping(value = "/materialCategory")
@Api(tags = {"商品类别"})
public class MaterialCategoryController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialCategoryController.class);
@Resource
private MaterialCategoryService materialCategoryService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialCategory materialCategory = materialCategoryService.getMaterialCategory(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialCategory != null) {
objectMap.put("info", materialCategory);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
List<MaterialCategory> list = materialCategoryService.select(name, parentId);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialCategoryService.insertMaterialCategory(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialCategoryService.updateMaterialCategory(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialCategoryService.deleteMaterialCategory(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialCategoryService.batchDeleteMaterialCategory(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id,
@RequestParam(value ="name", required = false) String name,
@RequestParam(value ="parentId", required = false) Long parentId,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialCategoryService.checkIsNameExist(id, name, parentId);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 获取全部商品类别
* @param parentId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllList")
@ApiOperation(value = "获取全部商品类别")
public BaseResponseInfo getAllList(@RequestParam("parentId") Long parentId, HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> materialCategoryList = materialCategoryService.getAllList(parentId);
res.code = 200;
res.data = materialCategoryList;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据id来查询商品名称
* @param id
* @param request
* @return
*/
@GetMapping(value = "/findById")
@ApiOperation(value = "根据id来查询商品名称")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialCategory> dataList = materialCategoryService.findById(id);
JSONObject outer = new JSONObject();
if (null != dataList) {
for (MaterialCategory mc : dataList) {
outer.put("id", mc.getId());
outer.put("name", mc.getName());
outer.put("parentId", mc.getParentId());
List<MaterialCategory> dataParentList = materialCategoryService.findById(mc.getParentId());
if(dataParentList!=null&&dataParentList.size()>0){
outer.put("parentName", dataParentList.get(0).getName());
}
outer.put("sort", mc.getSort());
outer.put("serialNo", mc.getSerialNo());
outer.put("remark", mc.getRemark());
}
}
res.code = 200;
res.data = outer;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 获取商品类别树数据
* @Param:
* @return com.alibaba.fastjson.JSONArray
*/
@RequestMapping(value = "/getMaterialCategoryTree")
@ApiOperation(value = "获取商品类别树数据")
public JSONArray getMaterialCategoryTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree(id);
if(materialCategoryTree!=null&&materialCategoryTree.size()>0){
for(TreeNode node:materialCategoryTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
}

View File

@@ -0,0 +1,904 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.*;
import com.reallin.smt.datasource.vo.MaterialDepotStock;
import com.reallin.smt.service.*;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji|sheng|hua jshERP
*/
@RestController
@RequestMapping(value = "/material")
@Api(tags = {"商品管理"})
public class MaterialController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialController.class);
@Resource
private MaterialService materialService;
@Resource
private DepotItemService depotItemService;
@Resource
private SystemConfigService systemConfigService;
@Resource
private UnitService unitService;
@Resource
private DepotService depotService;
@Resource
private RoleService roleService;
@Resource
private UserService userService;
@Resource
private SupplierService supplierService;
@Value(value="${file.uploadType}")
private Long fileUploadType;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Material material = materialService.getMaterial(id);
Map<String, Object> objectMap = new HashMap<>();
if(material != null) {
objectMap.put("info", material);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String otherField1 = StringUtil.getInfo(search, "otherField1");
String otherField2 = StringUtil.getInfo(search, "otherField2");
String otherField3 = StringUtil.getInfo(search, "otherField3");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String position = StringUtil.getInfo(search, "position");
String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, mfrs, otherField1, otherField2,
otherField3, weight, expiryNum, enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialService.insertMaterial(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialService.updateMaterial(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialService.deleteMaterial(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialService.batchDeleteMaterial(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 检查商品是否存在
* @param id
* @param name
* @param model
* @param color
* @param standard
* @param mfrs
* @param otherField1
* @param otherField2
* @param otherField3
* @param unit
* @param unitId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/checkIsExist")
@ApiOperation(value = "检查商品是否存在")
public String checkIsExist(@RequestParam("id") Long id, @RequestParam("name") String name,
@RequestParam("model") String model, @RequestParam("color") String color,
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
@RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
@RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int exist = materialService.checkIsExist(id, name, StringUtil.toNull(model), StringUtil.toNull(color),
StringUtil.toNull(standard), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1),
StringUtil.toNull(otherField2), StringUtil.toNull(otherField3), StringUtil.toNull(unit), unitId);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态-启用或者禁用")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = materialService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 根据id来查询商品名称
* @param id
* @param request
* @return
*/
@GetMapping(value = "/findById")
@ApiOperation(value = "根据id来查询商品名称")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialVo4Unit> list = materialService.findById(id);
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据meId来查询商品名称
* @param meId
* @param request
* @return
*/
@GetMapping(value = "/findByIdWithBarCode")
@ApiOperation(value = "根据meId来查询商品名称")
public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId,
@RequestParam("mpList") String mpList,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
String[] mpArr = mpList.split(",");
MaterialVo4Unit mu = new MaterialVo4Unit();
List<MaterialVo4Unit> list = materialService.findByIdWithBarCode(meId);
if(list!=null && list.size()>0) {
mu = list.get(0);
mu.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mu));
}
res.code = 200;
res.data = mu;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据关键词查找商品信息-条码、名称、规格、型号
* @param q
* @param request
* @return
*/
@GetMapping(value = "/getMaterialByParam")
@ApiOperation(value = "根据关键词查找商品信息")
public BaseResponseInfo getMaterialByParam(@RequestParam("q") String q,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONArray arr = materialService.getMaterialByParam(q);
res.code = 200;
res.data = arr;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查找商品信息-下拉框
* @param mpList
* @param request
* @return
*/
@GetMapping(value = "/findBySelect")
@ApiOperation(value = "查找商品信息")
public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "q", required = false) String q,
@RequestParam(value = "standardOrModel", required = false) String standardOrModel,
@RequestParam(value = "mpList", required = false) String mpList,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam(value = "color", required = false) String color,
@RequestParam(value = "brand", required = false) String brand,
@RequestParam(value = "mfrs", required = false) String mfrs,
@RequestParam(value = "otherField1", required = false) String otherField1,
@RequestParam(value = "otherField2", required = false) String otherField2,
@RequestParam(value = "otherField3", required = false) String otherField3,
@RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
@RequestParam("page") Integer currentPage,
@RequestParam("rows") Integer pageSize,
HttpServletRequest request) throws Exception{
JSONObject object = new JSONObject();
try {
String[] mpArr = new String[]{};
if(StringUtil.isNotEmpty(mpList)){
mpArr= mpList.split(",");
}
List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1), StringUtil.toNull(otherField2), StringUtil.toNull(otherField3),
enableSerialNumber, enableBatchNumber, (currentPage-1)*pageSize, pageSize);
int total = materialService.findBySelectWithBarCodeCount(categoryId, q, StringUtil.toNull(standardOrModel),
StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1), StringUtil.toNull(otherField2), StringUtil.toNull(otherField3),
enableSerialNumber, enableBatchNumber);
object.put("total", total);
JSONArray dataArray = new JSONArray();
//存放数据json数组
if (null != dataList) {
for (MaterialVo4Unit material : dataList) {
JSONObject item = new JSONObject();
item.put("id", material.getMeId()); //商品扩展表的id
String ratioStr = ""; //比例
Unit unit = new Unit();
if (material.getUnitId() == null) {
ratioStr = "";
} else {
unit = unitService.getUnit(material.getUnitId());
//拼接副单位的比例
String commodityUnit = material.getCommodityUnit();
if(StringUtil.isNotEmpty(commodityUnit) && unit!=null) {
if(commodityUnit.equals(unit.getBasicUnit())) {
ratioStr = "[基本]";
}
if(commodityUnit.equals(unit.getOtherUnit()) && unit.getRatio()!=null) {
ratioStr = "[" + unit.getRatio().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
}
if(commodityUnit.equals(unit.getOtherUnitTwo()) && unit.getRatioTwo()!=null) {
ratioStr = "[" + unit.getRatioTwo().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
}
if(commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree()!=null) {
ratioStr = "[" + unit.getRatioThree().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
}
}
}
item.put("mBarCode", material.getmBarCode());
item.put("name", material.getName());
item.put("mnemonic", material.getMnemonic());
item.put("categoryName", material.getCategoryName());
item.put("standard", material.getStandard());
item.put("model", material.getModel());
item.put("color", material.getColor());
item.put("brand", material.getBrand());
item.put("mfrs", material.getMfrs());
item.put("unit", material.getCommodityUnit() + ratioStr);
item.put("sku", material.getSku());
item.put("enableSerialNumber", material.getEnableSerialNumber());
item.put("enableBatchNumber", material.getEnableBatchNumber());
BigDecimal stock;
if(StringUtil.isNotEmpty(material.getSku())){
stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
} else {
stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
if (material.getUnitId()!=null){
String commodityUnit = material.getCommodityUnit();
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
}
}
item.put("stock", stock);
item.put("expand", materialService.getMaterialOtherByParam(mpArr, material));
item.put("otherField1", material.getOtherField1());
item.put("otherField2", material.getOtherField2());
item.put("otherField3", material.getOtherField3());
item.put("imgName", material.getImgName());
if(fileUploadType == 2) {
item.put("imgSmall", "small");
item.put("imgLarge", "large");
} else {
item.put("imgSmall", "");
item.put("imgLarge", "");
}
dataArray.add(item);
}
}
object.put("rows", dataArray);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return object;
}
/**
* 根据商品id查找商品信息
* @param meId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaterialByMeId")
@ApiOperation(value = "根据商品id查找商品信息")
public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
@RequestParam("mpList") String mpList,
HttpServletRequest request) throws Exception{
JSONObject item = new JSONObject();
try {
String[] mpArr = mpList.split(",");
List<MaterialVo4Unit> materialList = materialService.getMaterialByMeId(meId);
if(materialList!=null && materialList.size()!=1) {
return item;
} else if(materialList.size() == 1) {
MaterialVo4Unit material = materialList.get(0);
item.put("Id", material.getMeId()); //商品扩展表的id
String ratio; //比例
if (material.getUnitId() == null || material.getUnitId().equals("")) {
ratio = "";
} else {
ratio = material.getUnitName();
ratio = ratio.substring(ratio.indexOf("("));
}
//名称/型号/扩展信息/包装
String MaterialName = "";
MaterialName = MaterialName + material.getmBarCode() + "_" + material.getName()
+ ((material.getStandard() == null || material.getStandard().equals("")) ? "" : "(" + material.getStandard() + ")");
String expand = materialService.getMaterialOtherByParam(mpArr, material); //扩展信息
MaterialName = MaterialName + expand + ((material.getUnit() == null || material.getUnit().equals("")) ? "" : "(" + material.getUnit() + ")") + ratio;
item.put("MaterialName", MaterialName);
item.put("name", material.getName());
item.put("expand", expand);
item.put("model", material.getModel());
item.put("standard", material.getStandard());
item.put("unit", material.getUnit() + ratio);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return item;
}
/**
* 生成excel表格
* @param categoryId
* @param materialParam
* @param color
* @param weight
* @param expiryNum
* @param enabled
* @param enableSerialNumber
* @param enableBatchNumber
* @param remark
* @param mpList
* @param request
* @param response
*/
@GetMapping(value = "/exportExcel")
@ApiOperation(value = "生成excel表格")
public void exportExcel(@RequestParam(value = "categoryId", required = false) String categoryId,
@RequestParam(value = "materialParam", required = false) String materialParam,
@RequestParam(value = "color", required = false) String color,
@RequestParam(value = "materialOther", required = false) String materialOther,
@RequestParam(value = "weight", required = false) String weight,
@RequestParam(value = "expiryNum", required = false) String expiryNum,
@RequestParam(value = "enabled", required = false) String enabled,
@RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
@RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
@RequestParam(value = "remark", required = false) String remark,
@RequestParam(value = "mpList", required = false) String mpList,
HttpServletRequest request, HttpServletResponse response) {
try {
materialService.exportExcel(StringUtil.toNull(categoryId), StringUtil.toNull(materialParam), StringUtil.toNull(color),
StringUtil.toNull(materialOther), StringUtil.toNull(weight),
StringUtil.toNull(expiryNum), StringUtil.toNull(enabled), StringUtil.toNull(enableSerialNumber),
StringUtil.toNull(enableBatchNumber), StringUtil.toNull(remark), mpList, response);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* excel表格导入产品(含初始库存)
* @param file
* @param request
* @param response
* @return
*/
@PostMapping(value = "/importExcel")
@ApiOperation(value = "excel表格导入产品")
public BaseResponseInfo importExcel(MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
res = materialService.importExcel(file, request);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return res;
}
/**
* 获取商品序列号
* @param q
* @param currentPage
* @param pageSize
* @param request
* @param response
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaterialEnableSerialNumberList")
@ApiOperation(value = "获取商品序列号")
public JSONObject getMaterialEnableSerialNumberList(
@RequestParam(value = "q", required = false) String q,
@RequestParam("page") Integer currentPage,
@RequestParam("rows") Integer pageSize,
HttpServletRequest request,
HttpServletResponse response)throws Exception {
JSONObject object= new JSONObject();
try {
List<MaterialVo4Unit> list = materialService.getMaterialEnableSerialNumberList(q, (currentPage-1)*pageSize, pageSize);
Long count = materialService.getMaterialEnableSerialNumberCount(q);
object.put("rows", list);
object.put("total", count);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return object;
}
/**
* 获取最大条码
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaxBarCode")
@ApiOperation(value = "获取最大条码")
public BaseResponseInfo getMaxBarCode() throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String barCode = materialService.getMaxBarCode();
map.put("barCode", barCode);
res.code = 200;
res.data = map;
return res;
}
/**
* 商品名称模糊匹配
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaterialNameList")
@ApiOperation(value = "商品名称模糊匹配")
public JSONArray getMaterialNameList() throws Exception {
JSONArray arr = new JSONArray();
try {
List<String> list = materialService.getMaterialNameList();
for (String s : list) {
JSONObject item = new JSONObject();
item.put("value", s);
item.put("text", s);
arr.add(item);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 根据条码查询商品信息
* @return
* @throws Exception
*/
@GetMapping(value = "/getMaterialByBarCode")
@ApiOperation(value = "根据条码查询商品信息")
public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode,
@RequestParam(value = "organId", required = false) Long organId,
@RequestParam(value = "depotId", required = false) Long depotId,
@RequestParam("mpList") String mpList,
@RequestParam(required = false, value = "prefixNo") String prefixNo,
HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Long userId = userService.getUserId(request);
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
String[] mpArr = mpList.split(",");
//支持序列号查询,先根据序列号查询条码,如果查不到就直接查条码
MaterialExtend materialExtend = materialService.getMaterialExtendBySerialNumber(barCode);
if(materialExtend!=null && StringUtil.isNotEmpty(materialExtend.getBarCode())) {
barCode = materialExtend.getBarCode();
}
//查下供应商或者客户的信息
Supplier supplier = organId!=null ? supplierService.getSupplier(organId) : null;
List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
if(list!=null && list.size()>0) {
for(MaterialVo4Unit mvo: list) {
mvo.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mvo));
if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
//零售价
mvo.setBillPrice(mvo.getCommodityDecimal());
} else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
//采购价
mvo.setBillPrice(mvo.getPurchaseDecimal());
} else if("QTRK".equals(prefixNo) || "QTCK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
|| "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
//采购价-给录入界面按权限屏蔽
mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
} else if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo)) {
//销售价
if(organId == null) {
mvo.setBillPrice(mvo.getWholesaleDecimal());
} else {
if(systemConfigService.getCustomerStaticPriceFlag()) {
//已经开启了客户静态单价的开关
mvo.setBillPrice(mvo.getWholesaleDecimal());
} else {
//查询最后一单的销售价,实现不同的客户不同的销售价
BigDecimal lastUnitPrice = depotItemService.getLastUnitPriceByParam(organId, mvo.getMeId(), prefixNo);
mvo.setBillPrice(lastUnitPrice!=null? lastUnitPrice : mvo.getWholesaleDecimal());
}
}
//销售价-给录入界面按权限屏蔽价格
if("QTCK".equals(prefixNo)) {
mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
}
} else if ("other".equals(prefixNo)) {
//其它需要填充商品采购价或者成本价的场景
if(systemConfigService.getMoveAvgPriceFlag()) {
BigDecimal currentUnitPrice = materialService.getCurrentUnitPriceByMaterialId(mvo.getId());
mvo.setBillPrice(currentUnitPrice);
} else {
mvo.setBillPrice(mvo.getPurchaseDecimal());
}
}
//仓库id
if (depotId == null) {
JSONArray depotArr = depotService.findDepotByCurrentUser();
for (Object obj : depotArr) {
JSONObject depotObj = JSONObject.parseObject(obj.toString());
if (depotObj.get("isDefault") != null) {
Boolean isDefault = depotObj.getBoolean("isDefault");
if (isDefault) {
Long id = depotObj.getLong("id");
if (!"CGDD".equals(prefixNo) && !"XSDD".equals(prefixNo)) {
//除订单之外的单据才有仓库
mvo.setDepotId(id);
}
getStockByMaterialInfo(mvo);
}
}
}
} else {
mvo.setDepotId(depotId);
getStockByMaterialInfo(mvo);
}
//税率
BigDecimal taxRate = BigDecimal.ZERO;
if(supplier!=null && supplier.getTaxRate()!=null) {
taxRate = supplier.getTaxRate();
}
mvo.setTaxRate(taxRate);
//税额
BigDecimal taxMoney = BigDecimal.ZERO;
if(taxRate.compareTo(BigDecimal.ZERO) != 0 && mvo.getBillPrice()!=null) {
if(systemConfigService.getMaterialPriceTaxFlag()) {
//商品价格含税-开启
BigDecimal taxRatePercent = taxRate.divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
taxMoney = mvo.getBillPrice().divide(BigDecimal.ONE.add(taxRatePercent), 2, BigDecimal.ROUND_HALF_UP)
.multiply(taxRatePercent).setScale(2, BigDecimal.ROUND_HALF_UP);
} else {
taxMoney = taxRate.multiply(mvo.getBillPrice()).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
}
}
mvo.setTaxMoney(taxMoney);
//价税合计
BigDecimal taxLastMoney = BigDecimal.ZERO;
if(mvo.getBillPrice()!=null) {
if(systemConfigService.getMaterialPriceTaxFlag()) {
//商品价格含税-开启
taxLastMoney = mvo.getBillPrice();
} else {
taxLastMoney = mvo.getBillPrice().add(taxMoney);
}
}
mvo.setTaxLastMoney(taxLastMoney);
}
}
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据商品信息获取库存,进行赋值
* @param mvo
* @throws Exception
*/
private void getStockByMaterialInfo(MaterialVo4Unit mvo) throws Exception {
BigDecimal stock;
if (StringUtil.isNotEmpty(mvo.getSku())) {
stock = depotItemService.getSkuStockByParam(mvo.getDepotId(), mvo.getMeId(), null, null);
} else {
stock = depotItemService.getCurrentStockByParam(mvo.getDepotId(), mvo.getId());
if (mvo.getUnitId() != null) {
Unit unit = unitService.getUnit(mvo.getUnitId());
String commodityUnit = mvo.getCommodityUnit();
stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
}
}
mvo.setStock(stock);
}
/**
* 商品库存查询
* @param currentPage
* @param pageSize
* @param depotIds
* @param categoryId
* @param materialParam
* @param zeroStock
* @param column
* @param order
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getListWithStock")
@ApiOperation(value = "商品库存查询")
public BaseResponseInfo getListWithStock(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "depotIds", required = false) String depotIds,
@RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "position", required = false) String position,
@RequestParam("materialParam") String materialParam,
@RequestParam("zeroStock") Integer zeroStock,
@RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
@RequestParam(value = "order", required = false, defaultValue = "desc") String order,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
List<Long> idList = new ArrayList<>();
List<Long> depotList = new ArrayList<>();
if(categoryId != null){
idList = materialService.getListByParentId(categoryId);
}
if(StringUtil.isNotEmpty(depotIds)) {
depotList = StringUtil.strToLongList(depotIds);
} else {
//未选择仓库时默认为当前用户有权限的仓库
JSONArray depotArr = depotService.findDepotByCurrentUser();
for(Object obj: depotArr) {
JSONObject object = JSONObject.parseObject(obj.toString());
depotList.add(object.getLong("id"));
}
}
Long userId = userService.getUserId(request);
String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
Boolean moveAvgPriceFlag = systemConfigService.getMoveAvgPriceFlag();
List<MaterialVo4Unit> dataList = materialService.getListWithStock(priceLimit, depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam),
moveAvgPriceFlag, zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize, request);
int total = materialService.getListWithStockCount(priceLimit, depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), zeroStock);
MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(priceLimit, depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), request);
map.put("total", total);
map.put("currentStock", materialVo4Unit.getCurrentStock()!=null?materialVo4Unit.getCurrentStock():BigDecimal.ZERO);
if(moveAvgPriceFlag) {
map.put("currentStockPrice", materialVo4Unit.getCurrentStockMovePrice()!=null?materialVo4Unit.getCurrentStockMovePrice():BigDecimal.ZERO);
} else {
map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice()!=null?materialVo4Unit.getCurrentStockPrice():BigDecimal.ZERO);
}
map.put("currentWeight", materialVo4Unit.getCurrentWeight()!=null?materialVo4Unit.getCurrentWeight():BigDecimal.ZERO);
boolean showStockPrice = true;
if(StringUtil.isNotEmpty(priceLimit)) {
if(priceLimit.contains("7")) {
showStockPrice = false;
}
}
map.put("showStockPrice", showStockPrice);
map.put("moveAvgPriceFlag", moveAvgPriceFlag);
map.put("rows", dataList);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 批量设置商品当前的实时库存(按每个仓库)
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchSetMaterialCurrentStock")
@ApiOperation(value = "批量设置商品当前的实时库存(按每个仓库)")
public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
List<Depot> depotList = depotService.getAllList();
if(depotList.isEmpty()) {
return returnJson(objectMap, "请先创建仓库后再操作", ErpInfo.WARING_MSG.code);
}
int res = materialService.batchSetMaterialCurrentStock(ids, depotList);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 批量设置商品当前的成本价
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchSetMaterialCurrentUnitPrice")
@ApiOperation(value = "批量设置商品当前的成本价")
public String batchSetMaterialCurrentUnitPrice(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = materialService.batchSetMaterialCurrentUnitPrice(ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 批量更新商品信息
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchUpdate")
@ApiOperation(value = "批量更新商品信息")
public String batchUpdate(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int res = materialService.batchUpdate(jsonObject);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 转换名称为拼音
* @param jsonObject
*/
@PostMapping(value = "/changeNameToPinYin")
@ApiOperation(value = "转换名称为拼音")
public BaseResponseInfo changeNameToPinYin(@RequestBody JSONObject jsonObject)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String name = jsonObject.getString("name");
res.code = 200;
res.data = PinYinUtil.getFirstLettersLo(name);
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据仓库和商品查询库存分布情况
* @param mId
* @param request
* @return
*/
@GetMapping(value = "/getMaterialDepotStock")
@ApiOperation(value = "根据仓库和商品查询库存分布情况")
public TableDataInfo getMaterialDepotStock(
@RequestParam(value = "depotIds",required = false) String depotIds,
@RequestParam("materialId") Long mId,
HttpServletRequest request)throws Exception {
List<MaterialDepotStock> list = materialService.getMaterialDepotStock(depotIds, mId, request);
return getDataTable(list);
}
}

View File

@@ -0,0 +1,181 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.MaterialExtend;
import com.reallin.smt.datasource.vo.MaterialExtendVo4List;
import com.reallin.smt.service.MaterialExtendService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author jijiaqing
*/
@RestController
@RequestMapping(value = "/materialsExtend")
@Api(tags = {"商品价格扩展"})
public class MaterialExtendController {
private Logger logger = LoggerFactory.getLogger(MaterialExtendController.class);
@Resource
private MaterialExtendService materialExtendService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialExtend materialExtend = materialExtendService.getMaterialExtend(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialExtend != null) {
objectMap.put("info", materialExtend);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialExtendService.insertMaterialExtend(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialExtendService.updateMaterialExtend(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.deleteMaterialExtend(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getDetailList")
@ApiOperation(value = "价格信息列表")
public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
if(materialId!=0) {
dataList = materialExtendService.getDetailList(materialId);
}
JSONObject outer = new JSONObject();
outer.put("total", dataList.size());
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (MaterialExtendVo4List md : dataList) {
JSONObject item = new JSONObject();
item.put("id", md.getId());
item.put("barCode", md.getBarCode());
item.put("commodityUnit", md.getCommodityUnit());
if(StringUtil.isNotEmpty(md.getSku())){
item.put("sku", md.getSku());
}
item.put("purchaseDecimal", md.getPurchaseDecimal());
item.put("commodityDecimal", md.getCommodityDecimal());
item.put("wholesaleDecimal", md.getWholesaleDecimal());
item.put("lowDecimal", md.getLowDecimal());
dataArray.add(item);
}
}
outer.put("rows", dataArray);
res.code = 200;
res.data = outer;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据条码查询商品信息
* @param barCode
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getInfoByBarCode")
@ApiOperation(value = "根据条码查询商品信息")
public BaseResponseInfo getInfoByBarCode(@RequestParam("barCode") String barCode,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(barCode);
res.code = 200;
res.data = materialExtend;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 校验条码是否存在
* @param id
* @param barCode
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/checkIsBarCodeExist")
@ApiOperation(value = "校验条码是否存在")
public BaseResponseInfo checkIsBarCodeExist(@RequestParam("id") Long id,
@RequestParam("barCode") String barCode,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
int exist = materialExtendService.checkIsBarCodeExist(id, barCode);
if(exist > 0) {
map.put("status", true);
} else {
map.put("status", false);
}
res.code = 200;
res.data = map;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,145 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.MaterialProperty;
import com.reallin.smt.service.MaterialPropertyService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* Description
*
* @Author: jsh
* @Date: 2025/3/25 15:24
*/
@RestController
@RequestMapping(value = "/materialProperty")
@Api(tags = {"商品扩展字段"})
public class MaterialPropertyController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialPropertyController.class);
@Resource
private MaterialPropertyService materialPropertyService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialProperty materialProperty = materialPropertyService.getMaterialProperty(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialProperty != null) {
objectMap.put("info", materialProperty);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
List<MaterialProperty> list = materialPropertyService.select(name);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialPropertyService.insertMaterialProperty(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialPropertyService.updateMaterialProperty(obj, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/addOrUpdate")
@ApiOperation(value = "新增或修改")
public String addOrUpdate(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String nativeName = obj.getString("nativeName");
String anotherName = obj.getString("anotherName");
boolean exist = materialPropertyService.checkIsNativeNameExist(nativeName);
int res;
if(!exist) {
obj.put("id", null);
res = materialPropertyService.insertMaterialProperty(obj, request);
} else {
res = materialPropertyService.updateMaterialPropertyByNativeName(nativeName, anotherName);
}
return returnStr(objectMap, res);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialPropertyService.deleteMaterialProperty(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialPropertyService.batchDeleteMaterialProperty(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialPropertyService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@GetMapping(value = "/getAllList")
@ApiOperation(value = "查询全部商品扩展字段信息")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MaterialProperty> list = materialPropertyService.getMaterialProperty();
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,232 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Msg;
import com.reallin.smt.datasource.entities.MsgEx;
import com.reallin.smt.service.MsgService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua jshERP
*/
@RestController
@RequestMapping(value = "/msg")
@Api(tags = {"消息管理"})
public class MsgController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MsgController.class);
@Resource
private MsgService msgService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Msg msg = msgService.getMsg(id);
Map<String, Object> objectMap = new HashMap<>();
if(msg != null) {
objectMap.put("info", msg);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
List<MsgEx> list = msgService.select(name);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = msgService.insertMsg(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = msgService.updateMsg(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = msgService.deleteMsg(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = msgService.batchDeleteMsg(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = msgService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 根据状态查询消息
* @param status
* @param request
* @return
* @throws Exception
*/
@GetMapping("/getMsgByStatus")
@ApiOperation(value = "根据状态查询消息")
public BaseResponseInfo getMsgByStatus(@RequestParam("status") String status,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<MsgEx> list = msgService.getMsgByStatus(status);
res.code = 200;
res.data = list;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 批量更新状态
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping("/batchUpdateStatus")
@ApiOperation(value = "批量更新状态")
public BaseResponseInfo batchUpdateStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String ids = jsonObject.getString("ids");
String status = jsonObject.getString("status");
msgService.batchUpdateStatus(ids, status);
res.code = 200;
res.data = "更新成功";
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据状态查询数量
* @param status
* @param request
* @return
* @throws Exception
*/
@GetMapping("/getMsgCountByStatus")
@ApiOperation(value = "根据状态查询数量")
public BaseResponseInfo getMsgCountByStatus(@RequestParam("status") String status,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Long> map = new HashMap<String, Long>();
Long count = msgService.getMsgCountByStatus(status);
map.put("count", count);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据类型查询数量
* @param type
* @param request
* @return
* @throws Exception
*/
@GetMapping("/getMsgCountByType")
@ApiOperation(value = "根据类型查询数量")
public BaseResponseInfo getMsgCountByType(@RequestParam("type") String type,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Integer> map = new HashMap<>();
Integer count = msgService.getMsgCountByType(type);
map.put("count", count);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 全部设置未已读
* @param request
* @return
* @throws Exception
*/
@PostMapping("/readAllMsg")
@ApiOperation(value = "全部设置未已读")
public BaseResponseInfo readAllMsg(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
msgService.readAllMsg();
res.code = 200;
res.data = "操作成功!";
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,187 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.datasource.entities.Organization;
import com.reallin.smt.datasource.vo.TreeNode;
import com.reallin.smt.service.OrganizationService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.ErpInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* create by: jsh
*/
@RestController
@RequestMapping(value = "/organization")
@Api(tags = {"部门管理"})
public class OrganizationController {
private Logger logger = LoggerFactory.getLogger(OrganizationController.class);
@Resource
private OrganizationService organizationService;
@Resource
private UserService userService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Organization organization = organizationService.getOrganization(id);
Map<String, Object> objectMap = new HashMap<>();
if(organization != null) {
objectMap.put("info", organization);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = organizationService.insertOrganization(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = organizationService.updateOrganization(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = organizationService.deleteOrganization(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = organizationService.batchDeleteOrganization(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = organizationService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 根据id来查询部门信息
* @param id
* @param request
* @return
*/
@GetMapping(value = "/findById")
@ApiOperation(value = "根据id来查询部门信息")
public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<Organization> dataList = organizationService.findById(id);
JSONObject outer = new JSONObject();
if (null != dataList) {
for (Organization org : dataList) {
outer.put("id", org.getId());
outer.put("orgAbr", org.getOrgAbr());
outer.put("parentId", org.getParentId());
List<Organization> dataParentList = organizationService.findByParentId(org.getParentId());
if(dataParentList!=null&&dataParentList.size()>0){
//父级部门名称显示简称
outer.put("orgParentName", dataParentList.get(0).getOrgAbr());
}
outer.put("orgNo", org.getOrgNo());
outer.put("sort", org.getSort());
outer.put("remark", org.getRemark());
}
}
res.code = 200;
res.data = outer;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 获取部门树数据
* @return
* @throws Exception
*/
@GetMapping(value = "/getOrganizationTree")
@ApiOperation(value = "获取部门树数据")
public JSONArray getOrganizationTree(@RequestParam("id") Long id) throws Exception{
JSONArray arr=new JSONArray();
List<TreeNode> organizationTree= organizationService.getOrganizationTree(id);
if(organizationTree!=null&&organizationTree.size()>0){
for(TreeNode node:organizationTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj);
}
}
return arr;
}
/**
* 根据用户获取全部部门树
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllOrganizationTreeByUser")
@ApiOperation(value = "根据用户获取全部部门树")
public JSONArray getAllOrganizationTreeByUser(HttpServletRequest request) throws Exception{
JSONArray arr = new JSONArray();
Long userId = userService.getUserId(request);
String roleType = userService.getRoleTypeByUserId(userId).getType();
if(BusinessConstants.ROLE_TYPE_PUBLIC.equals(roleType)) {
List<TreeNode> organizationTree = organizationService.getOrganizationTree(null);
if(organizationTree!=null && organizationTree.size()>0){
for(TreeNode node: organizationTree){
String str = JSON.toJSONString(node);
JSONObject obj = JSON.parseObject(str);
arr.add(obj);
}
}
}
return arr;
}
}

View File

@@ -0,0 +1,143 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.PackBom;
import com.reallin.smt.datasource.vo.PackBomVo4List;
import com.reallin.smt.service.PackBomService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 生产方案管理
*/
@RestController
@RequestMapping(value = "/packBom")
@Api(tags = {"生产方案"})
public class PackBomController extends BaseController {
@Resource
private PackBomService packBomService;
@GetMapping(value = "/list")
@ApiOperation(value = "生产方案列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String bomNumber = StringUtil.getInfo(search, "bomNumber");
String bomName = StringUtil.getInfo(search, "bomName");
String outputMaterialParam = StringUtil.getInfo(search, "outputMaterialParam");
String enabledStr = StringUtil.getInfo(search, "enabled");
Boolean enabled = StringUtil.isEmpty(enabledStr) ? null : Boolean.parseBoolean(enabledStr);
List<PackBomVo4List> list = packBomService.select(bomNumber, bomName, outputMaterialParam, enabled);
return getDataTable(list);
}
@PostMapping(value = "/addPackBom")
@ApiOperation(value = "新增生产方案")
public String addPackBom(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = packBomService.addPackBom(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/updatePackBom")
@ApiOperation(value = "修改生产方案")
public String updatePackBom(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = packBomService.updatePackBom(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/deletePackBom")
@ApiOperation(value = "删除生产方案")
public String deletePackBom(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = packBomService.deletePackBom(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/batchDeletePackBom")
@ApiOperation(value = "批量删除生产方案")
public String batchDeletePackBom(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = packBomService.batchDeletePackBom(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getPackBomDetail")
@ApiOperation(value = "获取生产方案详情")
public BaseResponseInfo getPackBomDetail(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONObject detail = packBomService.getPackBomDetail(id);
res.code = 200;
res.data = detail;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置启用状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject, HttpServletRequest request) throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = packBomService.batchSetStatus(status, ids);
if (res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/getBomListByOutput")
@ApiOperation(value = "根据成品查询启用的生产方案列表")
public BaseResponseInfo getBomListByOutput(@RequestParam("outputMaterialId") Long outputMaterialId,
HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<JSONObject> list = packBomService.getBomListByOutput(outputMaterialId);
res.code = 200;
res.data = list;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
@GetMapping(value = "/checkIsNumberExist")
@ApiOperation(value = "检查编号是否存在")
public String checkIsNumberExist(@RequestParam Long id,
@RequestParam(value = "bomNumber", required = false) String bomNumber,
HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = packBomService.checkNumberExist(id, bomNumber);
if (exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
}

View File

@@ -0,0 +1,241 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Person;
import com.reallin.smt.service.PersonService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji|sheng|hua SMT
*/
@RestController
@RequestMapping(value = "/person")
@Api(tags = {"经手人管理"})
public class PersonController extends BaseController {
private Logger logger = LoggerFactory.getLogger(PersonController.class);
@Resource
private PersonService personService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Person person = personService.getPerson(id);
Map<String, Object> objectMap = new HashMap<>();
if(person != null) {
objectMap.put("info", person);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String type = StringUtil.getInfo(search, "type");
List<Person> list = personService.select(name, type);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = personService.insertPerson(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = personService.updatePerson(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = personService.deletePerson(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = personService.batchDeletePerson(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = personService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 全部数据列表
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllList")
@ApiOperation(value = "全部数据列表")
public BaseResponseInfo getAllList(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Person> personList = personService.getPerson();
map.put("personList", personList);
res.code = 200;
res.data = personList;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据Id获取经手人信息
* @param personIds
* @param request
* @return
*/
@GetMapping(value = "/getPersonByIds")
@ApiOperation(value = "根据Id获取经手人信息")
public BaseResponseInfo getPersonByIds(@RequestParam("personIds") String personIds,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Map<Long,String> personMap = personService.getPersonMap();
String names = personService.getPersonByMapAndIds(personMap, personIds);
map.put("names", names);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据类型获取经手人信息
* @param type
* @param request
* @return
*/
@GetMapping(value = "/getPersonByType")
@ApiOperation(value = "根据类型获取经手人信息")
public BaseResponseInfo getPersonByType(@RequestParam("type") String type,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<Person> personList = personService.getPersonByType(type);
map.put("personList", personList);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据类型获取经手人信息 1-销售员,2-仓管员,3-财务员
* @param typeNum
* @param request
* @return
*/
@GetMapping(value = "/getPersonByNumType")
@ApiOperation(value = "根据类型获取经手人信息1-销售员,2-仓管员,3-财务员")
public JSONArray getPersonByNumType(@RequestParam("type") String typeNum,
HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
String type = "";
if (typeNum.equals("1")) {
type = "销售员";
} else if (typeNum.equals("2")) {
type = "仓管员";
} else if (typeNum.equals("3")) {
type = "财务员";
}
List<Person> personList = personService.getPersonByType(type);
if (null != personList) {
for (Person person : personList) {
JSONObject item = new JSONObject();
item.put("value", person.getId().toString());
item.put("text", person.getName());
dataArray.add(item);
}
}
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return dataArray;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = personService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,237 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.PlatformConfig;
import com.reallin.smt.service.PlatformConfigService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji|sheng|hua SMT QQ7827-18920
*/
@RestController
@RequestMapping(value = "/platformConfig")
@Api(tags = {"平台参数"})
public class PlatformConfigController extends BaseController {
private Logger logger = LoggerFactory.getLogger(PlatformConfigController.class);
@Resource
private PlatformConfigService platformConfigService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
PlatformConfig platformConfig = platformConfigService.getPlatformConfig(id);
Map<String, Object> objectMap = new HashMap<>();
if(platformConfig != null) {
objectMap.put("info", platformConfig);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String platformKey = StringUtil.getInfo(search, "platformKey");
List<PlatformConfig> list = platformConfigService.select(platformKey);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = platformConfigService.insertPlatformConfig(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = platformConfigService.updatePlatformConfig(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = platformConfigService.deletePlatformConfig(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = platformConfigService.batchDeletePlatformConfig(ids, request);
return returnStr(objectMap, delete);
}
/**
* 获取平台名称
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/name")
@ApiOperation(value = "获取平台名称")
public String getPlatformName(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "platform_name";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "ERP系统";
}
return res;
}
/**
* 获取官方网站地址
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/url")
@ApiOperation(value = "获取官方网站地址")
public String getPlatformUrl(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "platform_url";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "#";
}
return res;
}
/**
* 获取是否开启注册
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/registerFlag")
@ApiOperation(value = "获取是否开启注册")
public String getPlatformRegisterFlag(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "register_flag";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "#";
}
return res;
}
/**
* 获取是否开启验证码
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/checkcodeFlag")
@ApiOperation(value = "获取是否开启验证码")
public String getPlatformCheckcodeFlag(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "checkcode_flag";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "#";
}
return res;
}
/**
* 获取APP版本
* @param request
* @return
*/
@GetMapping(value = "/getPlatform/appVersion")
@ApiOperation(value = "获取APP版本")
public String getPlatformAppVersion(HttpServletRequest request)throws Exception {
String res;
try {
String platformKey = "app_version";
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res = platformConfig.getPlatformValue();
} catch(Exception e){
logger.error(e.getMessage(), e);
res = "#";
}
return res;
}
/**
* 根据platformKey更新platformValue
* @param object
* @param request
* @return
*/
@PostMapping(value = "/updatePlatformConfigByKey")
@ApiOperation(value = "根据platformKey更新platformValue")
public String updatePlatformConfigByKey(@RequestBody JSONObject object,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String platformKey = object.getString("platformKey");
String platformValue = object.getString("platformValue");
int res = platformConfigService.updatePlatformConfigByKey(platformKey, platformValue);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 根据platformKey查询信息
* @param platformKey
* @param request
* @return
*/
@GetMapping(value = "/getInfoByKey")
@ApiOperation(value = "根据platformKey查询信息")
public BaseResponseInfo getInfoByKey(@RequestParam("platformKey") String platformKey,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
PlatformConfig platformConfig = platformConfigService.getInfoByKey(platformKey);
res.code = 200;
res.data = platformConfig;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,368 @@
package com.reallin.smt.controller;
import com.gitee.starblues.integration.application.PluginApplication;
import com.gitee.starblues.integration.operator.PluginOperator;
import com.gitee.starblues.integration.operator.module.PluginInfo;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.datasource.entities.User;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.ComputerInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.file.Paths;
import java.util.*;
/**
* 插件jar 包测试功能
* @author jishenghua
* @version 1.0
*/
@RestController
@RequestMapping("/plugin")
@Api(tags = {"插件管理"})
public class PluginController {
private Logger logger = LoggerFactory.getLogger(PluginController.class);
@Resource
private UserService userService;
private final PluginOperator pluginOperator;
@Autowired
public PluginController(PluginApplication pluginApplication) {
this.pluginOperator = pluginApplication.getPluginOperator();
}
/**
* 获取插件信息
* @return 返回插件信息
*/
@GetMapping(value = "/list")
@ApiOperation(value = "获取插件信息")
public BaseResponseInfo getPluginInfo(@RequestParam(value = "name",required = false) String name,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<PluginInfo> resList = new ArrayList<>();
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
List<PluginInfo> list = pluginOperator.getPluginInfo();
if (StringUtil.isEmpty(name)) {
resList = list;
} else {
for (PluginInfo pi : list) {
String desc = pi.getPluginDescriptor().getPluginDescription();
if (desc.contains(name)) {
resList.add(pi);
}
}
}
}
map.put("rows", resList);
map.put("total", resList.size());
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 获取插件jar文件名
* @return 获取插件文件名。只在生产环境显示
*/
@GetMapping("/files")
@ApiOperation(value = "获取插件jar文件名")
public Set<String> getPluginFilePaths(){
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
return pluginOperator.getPluginFilePaths();
} else {
return null;
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return null;
}
}
/**
* 根据插件id停止插件
* @param id 插件id
* @return 返回操作结果
*/
@PostMapping("/stop/{id}")
@ApiOperation(value = "根据插件id停止插件")
public BaseResponseInfo stop(@PathVariable("id") String id){
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String message = "";
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.stop(id)) {
message = "plugin '" + id + "' stop success";
} else {
message = "plugin '" + id + "' stop failure";
}
} else {
message = "power is limit";
}
map.put("message", message);
res.code = 200;
res.data = map;
} catch (Exception e) {
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' stop failure. " + e.getMessage());
res.code = 500;
res.data = map;
}
return res;
}
/**
* 根据插件id启动插件
* @param id 插件id
* @return 返回操作结果
*/
@PostMapping("/start/{id}")
@ApiOperation(value = "根据插件id启动插件")
public BaseResponseInfo start(@PathVariable("id") String id){
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String message = "";
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.start(id)) {
message = "plugin '" + id + "' start success";
} else {
message = "plugin '" + id + "' start failure";
}
} else {
message = "power is limit";
}
map.put("message", message);
res.code = 200;
res.data = map;
} catch (Exception e) {
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' start failure. " + e.getMessage());
res.code = 500;
res.data = map;
}
return res;
}
/**
* 根据插件id卸载插件
* @param id 插件id
* @return 返回操作结果
*/
@PostMapping("/uninstall/{id}")
@ApiOperation(value = "根据插件id卸载插件")
public BaseResponseInfo uninstall(@PathVariable("id") String id){
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
String message = "";
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.uninstall(id, true)) {
message = "plugin '" + id + "' uninstall success";
} else {
message = "plugin '" + id + "' uninstall failure";
}
} else {
message = "power is limit";
}
map.put("message", message);
res.code = 200;
res.data = map;
} catch (Exception e) {
logger.error(e.getMessage(), e);
map.put("message", "plugin '" + id +"' uninstall failure. " + e.getMessage());
res.code = 500;
res.data = map;
}
return res;
}
/**
* 根据插件路径安装插件。该插件jar必须在服务器上存在。注意: 该操作只适用于生产环境
* @param path 插件路径名称
* @return 操作结果
*/
@PostMapping("/installByPath")
@ApiOperation(value = "根据插件路径安装插件")
public String install(@RequestParam("path") String path){
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.install(Paths.get(path))) {
return "installByPath success";
} else {
return "installByPath failure";
}
} else {
return "installByPath failure";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "installByPath failure : " + e.getMessage();
}
}
/**
* 上传并安装插件。注意: 该操作只适用于生产环境
* @param file 上传文件 multipartFile
* @return 操作结果
*/
@PostMapping("/uploadInstallPluginJar")
@ApiOperation(value = "上传并安装插件")
public BaseResponseInfo install(MultipartFile file, HttpServletRequest request, HttpServletResponse response){
BaseResponseInfo res = new BaseResponseInfo();
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
pluginOperator.uploadPluginAndStart(file);
res.code = 200;
res.data = "导入成功";
} else {
res.code = 500;
res.data = "抱歉,无操作权限!";
}
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
return res;
}
/**
* 上传插件的配置文件。注意: 该操作只适用于生产环境
* @param multipartFile 上传文件 multipartFile
* @return 操作结果
*/
@PostMapping("/uploadPluginConfigFile")
@ApiOperation(value = "上传插件的配置文件")
public String uploadConfig(@RequestParam("configFile") MultipartFile multipartFile){
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.uploadConfigFile(multipartFile)) {
return "uploadConfig success";
} else {
return "uploadConfig failure";
}
} else {
return "installByPath failure";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "uploadConfig failure : " + e.getMessage();
}
}
/**
* 备份插件。注意: 该操作只适用于生产环境
* @param pluginId 插件id
* @return 操作结果
*/
@PostMapping("/back/{pluginId}")
@ApiOperation(value = "备份插件")
public String backupPlugin(@PathVariable("pluginId") String pluginId){
try {
User userInfo = userService.getCurrentUser();
if(BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
if (pluginOperator.backupPlugin(pluginId, "testBack")) {
return "backupPlugin success";
} else {
return "backupPlugin failure";
}
} else {
return "backupPlugin failure";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return "backupPlugin failure : " + e.getMessage();
}
}
/**
* 获取加密后的mac
* @return
*/
@GetMapping("/getMacWithSecret")
@ApiOperation(value = "获取加密后的mac")
public BaseResponseInfo getMacWithSecret(){
BaseResponseInfo res = new BaseResponseInfo();
try {
String mac = ComputerInfo.getMacAddress();
res.code = 200;
res.data = DigestUtils.md5DigestAsHex(mac.getBytes());
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 根据插件标识判断是否存在
* @param pluginIds 多个用逗号隔开
* @return
*/
@GetMapping("/checkByPluginId")
@ApiOperation(value = "根据插件标识判断是否存在")
public BaseResponseInfo checkByTag(@RequestParam("pluginIds") String pluginIds){
BaseResponseInfo res = new BaseResponseInfo();
try {
boolean data = false;
if(StringUtil.isNotEmpty(pluginIds)) {
String[] pluginIdList = pluginIds.split(",");
List<PluginInfo> list = pluginOperator.getPluginInfo();
for (PluginInfo pi : list) {
String info = pi.getPluginDescriptor().getPluginId();
for (int i = 0; i < pluginIdList.length; i++) {
if (pluginIdList[i].equals(info)) {
data = true;
}
}
}
}
res.code = 200;
res.data = data;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,142 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.vo.ProductionOrderVo4List;
import com.reallin.smt.service.ProductionOrderService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 生产工单管理
*/
@RestController
@RequestMapping(value = "/productionOrder")
@Api(tags = {"生产工单"})
public class ProductionOrderController extends BaseController {
@Resource
private ProductionOrderService productionOrderService;
@GetMapping(value = "/list")
@ApiOperation(value = "生产工单列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String orderNumber = StringUtil.getInfo(search, "orderNumber");
String sourceNumber = StringUtil.getInfo(search, "sourceNumber");
String status = StringUtil.getInfo(search, "status");
String priority = StringUtil.getInfo(search, "priority");
String productMaterialParam = StringUtil.getInfo(search, "productMaterialParam");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
List<ProductionOrderVo4List> list = productionOrderService.select(orderNumber, sourceNumber, status,
priority, productMaterialParam, beginTime, endTime);
return getDataTable(list);
}
@PostMapping(value = "/createOrder")
@ApiOperation(value = "创建工单")
public String createOrder(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = productionOrderService.createOrder(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/updateOrder")
@ApiOperation(value = "修改工单")
public String updateOrder(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = productionOrderService.updateOrder(obj, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/approveRelease")
@ApiOperation(value = "审批下达")
public String approveRelease(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
Map<String, Object> objectMap = new HashMap<>();
int update = productionOrderService.approveRelease(id, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/startProduce")
@ApiOperation(value = "开工")
public String startProduce(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
Map<String, Object> objectMap = new HashMap<>();
int update = productionOrderService.startProduce(id, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/closeOrder")
@ApiOperation(value = "关闭工单")
public String closeOrder(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
String closeReason = obj.getString("closeReason");
Map<String, Object> objectMap = new HashMap<>();
int update = productionOrderService.closeOrder(id, closeReason, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/deleteOrder")
@ApiOperation(value = "删除工单")
public String deleteOrder(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = productionOrderService.deleteOrder(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/batchDeleteOrder")
@ApiOperation(value = "批量删除工单")
public String batchDeleteOrder(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = productionOrderService.batchDeleteOrder(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getOrderDetail")
@ApiOperation(value = "工单详情")
public BaseResponseInfo getOrderDetail(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONObject detail = productionOrderService.getOrderDetail(id);
res.code = 200;
res.data = detail;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
@GetMapping(value = "/checkIsNumberExist")
@ApiOperation(value = "检查工单号是否存在")
public String checkIsNumberExist(@RequestParam Long id,
@RequestParam(value = "orderNumber", required = false) String orderNumber,
HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = productionOrderService.checkNumberExist(id, orderNumber);
if (exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
}

View File

@@ -0,0 +1,89 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.vo.ProductionReportVo4List;
import com.reallin.smt.service.ProductionReportService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 完工报告管理
*/
@RestController
@RequestMapping(value = "/productionReport")
@Api(tags = {"完工报工"})
public class ProductionReportController extends BaseController {
@Resource
private ProductionReportService productionReportService;
@GetMapping(value = "/list")
@ApiOperation(value = "完工报告列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String reportNumber = StringUtil.getInfo(search, "reportNumber");
String orderNumber = StringUtil.getInfo(search, "orderNumber");
String auditStatus = StringUtil.getInfo(search, "auditStatus");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
List<ProductionReportVo4List> list = productionReportService.select(reportNumber, orderNumber,
auditStatus, beginTime, endTime);
return getDataTable(list);
}
@PostMapping(value = "/addReport")
@ApiOperation(value = "新增完工报告")
public String addReport(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = productionReportService.addReport(obj, request);
return returnStr(objectMap, insert);
}
@PostMapping(value = "/auditReport")
@ApiOperation(value = "审核完工报告")
public String auditReport(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
String auditResult = obj.getString("auditResult");
Map<String, Object> objectMap = new HashMap<>();
int update = productionReportService.auditReport(id, auditResult, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/deleteReport")
@ApiOperation(value = "删除完工报告")
public String deleteReport(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = productionReportService.deleteReport(id, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getDetail")
@ApiOperation(value = "完工报告详情")
public BaseResponseInfo getDetail(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONObject detail = productionReportService.getDetail(id);
res.code = 200;
res.data = detail;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,109 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.vo.ProductionRequisitionVo4List;
import com.reallin.smt.service.ProductionRequisitionService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 生产领料管理
*/
@RestController
@RequestMapping(value = "/productionRequisition")
@Api(tags = {"生产领料"})
public class ProductionRequisitionController extends BaseController {
@Resource
private ProductionRequisitionService productionRequisitionService;
@GetMapping(value = "/list")
@ApiOperation(value = "领料单列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) throws Exception {
String requisitionNumber = StringUtil.getInfo(search, "requisitionNumber");
String orderNumber = StringUtil.getInfo(search, "orderNumber");
String status = StringUtil.getInfo(search, "status");
Long depotId = StringUtil.parseStrLong(StringUtil.getInfo(search, "depotId"));
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
List<ProductionRequisitionVo4List> list = productionRequisitionService.select(requisitionNumber,
orderNumber, status, depotId, beginTime, endTime);
return getDataTable(list);
}
@PostMapping(value = "/generateRequisition")
@ApiOperation(value = "从工单生成领料单")
public String generateRequisition(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long orderId = obj.getLong("orderId");
Long depotId = obj.getLong("depotId");
Map<String, Object> objectMap = new HashMap<>();
int insert = productionRequisitionService.generateRequisition(orderId, depotId, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/updateRequisition")
@ApiOperation(value = "修改领料单")
public String updateRequisition(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = productionRequisitionService.updateRequisition(obj, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/confirmIssue")
@ApiOperation(value = "确认发料")
public String confirmIssue(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
Map<String, Object> objectMap = new HashMap<>();
int update = productionRequisitionService.confirmIssue(id, request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/rejectRequisition")
@ApiOperation(value = "驳回领料单")
public String rejectRequisition(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Long id = obj.getLong("id");
String rejectReason = obj.getString("rejectReason");
Map<String, Object> objectMap = new HashMap<>();
int update = productionRequisitionService.rejectRequisition(id, rejectReason, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/deleteRequisition")
@ApiOperation(value = "删除领料单")
public String deleteRequisition(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = productionRequisitionService.deleteRequisition(id, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getDetail")
@ApiOperation(value = "领料单详情")
public BaseResponseInfo getDetail(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
JSONObject detail = productionRequisitionService.getDetail(id);
res.code = 200;
res.data = detail;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,178 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Role;
import com.reallin.smt.datasource.entities.RoleEx;
import com.reallin.smt.service.RoleService;
import com.reallin.smt.service.UserBusinessService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji sheng hua jshERP
*/
@RestController
@RequestMapping(value = "/role")
@Api(tags = {"角色管理"})
public class RoleController extends BaseController {
private Logger logger = LoggerFactory.getLogger(RoleController.class);
@Resource
private RoleService roleService;
@Resource
private UserBusinessService userBusinessService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Role role = roleService.getRole(id);
Map<String, Object> objectMap = new HashMap<>();
if(role != null) {
objectMap.put("info", role);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
String description = StringUtil.getInfo(search, "description");
List<RoleEx> list = roleService.select(name, description);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = roleService.insertRole(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = roleService.updateRole(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = roleService.deleteRole(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = roleService.batchDeleteRole(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = roleService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 角色对应应用显示
* @param request
* @return
*/
@GetMapping(value = "/findUserRole")
@ApiOperation(value = "查询用户的角色")
public JSONArray findUserRole(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, keyId);
List<Role> dataList = roleService.findUserRole();
if (null != dataList) {
for (Role role : dataList) {
JSONObject item = new JSONObject();
item.put("id", role.getId());
item.put("text", role.getName());
Boolean flag = ubValue.contains("[" + role.getId().toString() + "]");
if (flag) {
item.put("checked", true);
}
arr.add(item);
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return arr;
}
@GetMapping(value = "/allList")
@ApiOperation(value = "查询全部角色列表")
public List<Role> allList(HttpServletRequest request)throws Exception {
return roleService.allList();
}
@GetMapping(value = "/tenantRoleList")
@ApiOperation(value = "查询租户角色列表")
public List<Role> tenantRoleList(HttpServletRequest request)throws Exception {
return roleService.tenantRoleList();
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = roleService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,130 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.SaleShipmentItem;
import com.reallin.smt.datasource.vo.SaleShipmentVo4List;
import com.reallin.smt.service.SaleShipmentService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
@RestController
@RequestMapping(value = "/saleShipment")
@Api(tags = {"销售发货管理"})
public class SaleShipmentController extends BaseController {
@Resource
private SaleShipmentService saleShipmentService;
@GetMapping(value = "/list")
@ApiOperation(value = "发货通知列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request) {
String shipmentNumber = StringUtil.getInfo(search, "shipmentNumber");
String saleOutNumber = StringUtil.getInfo(search, "saleOutNumber");
String saleOrderNumber = StringUtil.getInfo(search, "saleOrderNumber");
String status = StringUtil.getInfo(search, "status");
String logisticsNo = StringUtil.getInfo(search, "logisticsNo");
String beginTime = StringUtil.getInfo(search, "beginTime");
String endTime = StringUtil.getInfo(search, "endTime");
List<SaleShipmentVo4List> list = saleShipmentService.select(shipmentNumber, saleOutNumber, saleOrderNumber,
status, logisticsNo, beginTime, endTime);
return getDataTable(list);
}
@GetMapping(value = "/detail")
@ApiOperation(value = "发货通知详情")
public BaseResponseInfo getDetail(@RequestParam("id") Long id, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
res.code = 200;
res.data = saleShipmentService.getDetail(id);
return res;
}
@GetMapping(value = "/saleOutItems")
@ApiOperation(value = "销售出库可发货明细")
public BaseResponseInfo getSaleOutItems(@RequestParam("saleOutId") Long saleOutId, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
List<SaleShipmentItem> rows = saleShipmentService.getSaleOutItems(saleOutId);
JSONObject data = new JSONObject();
data.put("rows", rows);
res.code = 200;
res.data = data;
return res;
}
@GetMapping(value = "/deliveryPlanItems")
@ApiOperation(value = "交货计划可发货明细")
public BaseResponseInfo getDeliveryPlanItems(@RequestParam("deliveryPlanId") Long deliveryPlanId, HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
List<SaleShipmentItem> rows = saleShipmentService.getDeliveryPlanItems(deliveryPlanId);
JSONObject data = new JSONObject();
data.put("rows", rows);
res.code = 200;
res.data = data;
return res;
}
@PostMapping(value = "/createFromSaleOut")
@ApiOperation(value = "从销售出库创建发货通知")
public String createFromSaleOut(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = saleShipmentService.createFromSaleOut(obj, request);
return returnStr(objectMap, insert);
}
@PostMapping(value = "/createFromDeliveryPlan")
@ApiOperation(value = "从交货计划创建发货通知")
public String createFromDeliveryPlan(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = saleShipmentService.createFromDeliveryPlan(obj, request);
return returnStr(objectMap, insert);
}
@PostMapping(value = "/batchCreateFromSaleOut")
@ApiOperation(value = "批量从销售出库创建发货通知")
public String batchCreateFromSaleOut(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = saleShipmentService.batchCreateFromSaleOut(obj, request);
objectMap.put("message", "已生成" + insert + "张发货通知单");
return returnStr(objectMap, insert);
}
@PostMapping(value = "/approve")
@ApiOperation(value = "审批发货通知")
public String approve(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = saleShipmentService.approve(obj.getLong("id"), obj.getBoolean("pass"),
obj.getString("approveRemark"), request);
return returnStr(objectMap, update);
}
@PostMapping(value = "/confirmShipment")
@ApiOperation(value = "确认实际发货")
public String confirmShipment(@RequestBody JSONObject obj, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = saleShipmentService.confirmShipment(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除发货通知")
public String deleteShipment(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = saleShipmentService.deleteShipment(id, request);
return returnStr(objectMap, delete);
}
}

View File

@@ -0,0 +1,53 @@
package com.reallin.smt.controller;
import com.reallin.smt.service.SequenceService;
import com.reallin.smt.utils.BaseResponseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* @author ji-sheng-hua 752*718*920
*/
@RestController
@RequestMapping(value = "/sequence")
@Api(tags = {"单据编号"})
public class SequenceController {
private Logger logger = LoggerFactory.getLogger(SequenceController.class);
@Resource
private SequenceService sequenceService;
/**
* 单据编号生成接口
* @param request
* @return
*/
@GetMapping(value = "/buildNumber")
@ApiOperation(value = "单据编号生成接口")
public BaseResponseInfo buildNumber(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
String number = sequenceService.buildOnlyNumber();
map.put("defaultNumber", number);
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,133 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.DepotItem;
import com.reallin.smt.datasource.entities.SerialNumberEx;
import com.reallin.smt.service.DepotHeadService;
import com.reallin.smt.service.DepotItemService;
import com.reallin.smt.service.SerialNumberService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.StringUtil;
import com.reallin.smt.utils.Tools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* Description
* @Author: jsh
* @Date: 2019/1/22 10:29
*/
@RestController
@RequestMapping(value = "/serialNumber")
@Api(tags = {"序列号管理"})
public class SerialNumberController {
private Logger logger = LoggerFactory.getLogger(SerialNumberController.class);
@Resource
private SerialNumberService serialNumberService;
@Resource
private DepotHeadService depotHeadService;
@Resource
private DepotItemService depotItemService;
/**
* create by: jsh
* @return java.lang.Object
*/
@PostMapping("/batAddSerialNumber")
@ApiOperation(value = "批量添加序列号")
public String batAddSerialNumber(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception{
Map<String, Object> objectMap = new HashMap<>();
String materialCode = jsonObject.getString("materialCode");
String serialNumberPrefix = jsonObject.getString("serialNumberPrefix");
Integer batAddTotal = jsonObject.getInteger("batAddTotal");
String remark = jsonObject.getString("remark");
int insert = serialNumberService.batAddSerialNumber(materialCode,serialNumberPrefix,batAddTotal,remark);
return returnStr(objectMap, insert);
}
/**
* 获取序列号商品
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/getEnableSerialNumberList")
@ApiOperation(value = "获取序列号商品")
public BaseResponseInfo getEnableSerialNumberList(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
String name = jsonObject.getString("name");
Long depotItemId = jsonObject.getLong("depotItemId");
Long depotId = jsonObject.getLong("depotId");
String barCode = jsonObject.getString("barCode");
Integer currentPage = jsonObject.getInteger("page");
Integer pageSize = jsonObject.getInteger("rows");
String number = "";
String [] nameArray = null;
if(depotItemId != null) {
DepotItem depotItem = depotItemService.getDepotItem(depotItemId);
number = depotHeadService.getDepotHead(depotItem.getHeaderId()).getNumber();
}
// 批量查询序列号时,name可能为多个
if(StringUtil.isNotEmpty(name)) {
name = name.replace(",",",");
if(name.contains(",")) {
nameArray = name.split(",");
name = null;
}
}
List<SerialNumberEx> list = serialNumberService.getEnableSerialNumberList(number, name, nameArray, depotId, barCode, (currentPage-1)*pageSize, pageSize);
for(SerialNumberEx serialNumberEx: list) {
serialNumberEx.setCreateTimeStr(Tools.getCenternTime(serialNumberEx.getCreateTime()));
}
Long total = serialNumberService.getEnableSerialNumberCount(number, name, nameArray, depotId, barCode);
List<String> missList = new ArrayList<>();
if(nameArray!=null && nameArray.length>0) {
List<SerialNumberEx> allList = serialNumberService.getEnableSerialNumberList(number, name, nameArray, depotId, barCode, null, null);
if(allList.size() < nameArray.length) {
//说明查出的比查询条件里面的序列号少,此时需要寻找出缺少的序列号
for (String item : nameArray) {
boolean isHave = false;
for (SerialNumberEx serialNumberEx : allList) {
if (item.equals(serialNumberEx.getSerialNumber())) {
isHave = true;
break;
}
}
if (!isHave) {
missList.add(item);
}
}
}
}
map.put("rows", list);
map.put("total", total);
if(!missList.isEmpty()) {
//列出未查询到的序列号
map.put("missInfo", String.join(",", missList));
}
res.code = 200;
res.data = map;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -0,0 +1,88 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.DepotHeadVo4Body;
import com.reallin.smt.service.SmtInboundService;
import com.reallin.smt.utils.BaseResponseInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/smtInbound")
@Api(tags = "SMT其他入库")
public class SmtInboundController {
@Resource
private SmtInboundService smtInboundService;
@GetMapping("/nextNumber")
@ApiOperation("生成SMT单据编号")
public BaseResponseInfo nextNumber(@RequestParam(required = false) String businessDate) {
return ok(single("number", smtInboundService.nextNumber(businessDate)));
}
@PostMapping("/save")
@ApiOperation("新增SMT其他入库")
public BaseResponseInfo save(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) {
JSONObject info = JSONObject.parseObject(body.getInfo());
JSONArray rows = JSONArray.parseArray(body.getRows());
Long id = smtInboundService.save(info, rows, smtInboundService.creatorId(request));
return ok(single("id", id));
}
@PutMapping("/save")
@ApiOperation("修改SMT其他入库")
public BaseResponseInfo update(@RequestBody DepotHeadVo4Body body, HttpServletRequest request) {
return save(body, request);
}
@GetMapping("/details")
@ApiOperation("查询SMT其他入库明细")
public BaseResponseInfo details(@RequestParam Long headerId) {
List<Map<String, Object>> rows = smtInboundService.details(headerId);
Map<String, Object> data = new HashMap<>();
data.put("rows", rows);
data.put("total", rows.size());
return ok(data);
}
@PostMapping("/importExcel")
@ApiOperation("导入SMT出库单Excel")
public BaseResponseInfo importExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) throws Exception {
return ok(smtInboundService.importExcel(file, smtInboundService.creatorId(request)));
}
@GetMapping("/template")
@ApiOperation("下载SMT出库单导入模板")
public void template(HttpServletResponse response) throws Exception {
smtInboundService.exportTemplate(response);
}
@PostMapping("/sync")
@ApiOperation("外部平台JSON同步")
public BaseResponseInfo sync(@RequestBody List<JSONObject> payload, HttpServletRequest request) {
return ok(smtInboundService.sync(payload, smtInboundService.creatorId(request)));
}
private BaseResponseInfo ok(Object data) {
BaseResponseInfo response = new BaseResponseInfo();
response.code = 200;
response.data = data;
return response;
}
private Map<String, Object> single(String key, Object value) {
Map<String, Object> data = new HashMap<>();
data.put(key, value);
return data;
}
}

View File

@@ -0,0 +1,545 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Supplier;
import com.reallin.smt.datasource.entities.User;
import com.reallin.smt.datasource.vo.SupplierSimple;
import com.reallin.smt.exception.BusinessRunTimeException;
import com.reallin.smt.service.SupplierService;
import com.reallin.smt.service.SystemConfigService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.service.UserBusinessService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji|sheng|hua SMT
*/
@RestController
@RequestMapping(value = "/supplier")
@Api(tags = {"商家管理"})
public class SupplierController extends BaseController {
private Logger logger = LoggerFactory.getLogger(SupplierController.class);
@Resource
private SupplierService supplierService;
@Resource
private UserBusinessService userBusinessService;
@Resource
private SystemConfigService systemConfigService;
@Resource
private UserService userService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Supplier supplier = supplierService.getSupplier(id);
Map<String, Object> objectMap = new HashMap<>();
if(supplier != null) {
objectMap.put("info", supplier);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String supplier = StringUtil.getInfo(search, "supplier");
String type = StringUtil.getInfo(search, "type");
String contacts = StringUtil.getInfo(search, "contacts");
String phonenum = StringUtil.getInfo(search, "phonenum");
String telephone = StringUtil.getInfo(search, "telephone");
String categoryIdStr = StringUtil.getInfo(search, "categoryId");
Long categoryId = (categoryIdStr != null && !categoryIdStr.isEmpty()) ? Long.parseLong(categoryIdStr) : null;
List<Supplier> list = supplierService.select(supplier, type, contacts, phonenum, telephone, categoryId);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = supplierService.insertSupplier(obj, request);
if(insert > 0 && obj.containsKey("id")) {
objectMap.put("id", obj.getLong("id"));
}
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = supplierService.updateSupplier(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = supplierService.deleteSupplier(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = supplierService.batchDeleteSupplier(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = supplierService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@GetMapping(value = "/checkIsNameAndTypeExist")
@ApiOperation(value = "检查名称和类型是否存在")
public String checkIsNameAndTypeExist(@RequestParam Long id,
@RequestParam(value ="name", required = false) String name,
@RequestParam(value ="type") String type,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = supplierService.checkIsNameAndTypeExist(id, name, type);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 查找客户信息-下拉框
* @param request
* @return
*/
@PostMapping(value = "/findBySelect_cus")
@ApiOperation(value = "查找客户信息")
public JSONArray findBySelectCus(@RequestBody JSONObject jsonObject,
HttpServletRequest request) {
JSONArray arr = new JSONArray();
try {
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
String type = "UserCustomer";
Long userId = userService.getUserId(request);
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
List<Supplier> supplierList = supplierService.findBySelectCus(key, organId, limit);
JSONArray dataArray = new JSONArray();
if (null != supplierList) {
boolean customerFlag = systemConfigService.getCustomerFlag();
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
Boolean flag = ubValue.contains("[" + supplier.getId().toString() + "]");
if (!customerFlag || flag) {
item.put("id", supplier.getId());
item.put("supplier", supplier.getSupplier()); //客户名称
item.put("categoryId", supplier.getCategoryId());
dataArray.add(item);
}
}
}
arr = dataArray;
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 查找供应商信息-下拉框
* @param request
* @return
*/
@PostMapping(value = "/findBySelect_sup")
@ApiOperation(value = "查找供应商信息")
public JSONArray findBySelectSup(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception{
JSONArray arr = new JSONArray();
try {
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId, limit);
JSONArray dataArray = new JSONArray();
if (null != supplierList) {
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
item.put("id", supplier.getId());
//供应商名称
item.put("supplier", supplier.getSupplier());
dataArray.add(item);
}
}
arr = dataArray;
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 查找往来单位,含供应商和客户信息-下拉框
* @param request
* @return
*/
@PostMapping(value = "/findBySelect_organ")
@ApiOperation(value = "查找往来单位,含供应商和客户信息")
public JSONArray findBySelectOrgan(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception{
JSONArray arr = new JSONArray();
try {
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
JSONArray dataArray = new JSONArray();
//1、获取供应商信息
List<Supplier> supplierList = supplierService.findBySelectSup(key, organId, limit);
if (null != supplierList) {
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
item.put("id", supplier.getId());
item.put("supplier", supplier.getSupplier() + "[供应商]"); //供应商名称
dataArray.add(item);
}
}
//2、获取客户信息
String type = "UserCustomer";
Long userId = userService.getUserId(request);
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, userId.toString());
List<Supplier> customerList = supplierService.findBySelectCus(key, organId, limit);
if (null != customerList) {
boolean customerFlag = systemConfigService.getCustomerFlag();
for (Supplier supplier : customerList) {
JSONObject item = new JSONObject();
Boolean flag = ubValue.contains("[" + supplier.getId().toString() + "]");
if (!customerFlag || flag) {
item.put("id", supplier.getId());
item.put("supplier", supplier.getSupplier() + "[客户]"); //客户名称
dataArray.add(item);
}
}
}
arr = dataArray;
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 查找会员信息-下拉框
* @param request
* @return
*/
@PostMapping(value = "/findBySelect_retail")
@ApiOperation(value = "查找会员信息")
public JSONArray findBySelectRetail(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
JSONArray arr = new JSONArray();
try {
String key = jsonObject.get("key")!=null ? jsonObject.getString("key") : null;
Long organId = jsonObject.get("organId")!=null ? jsonObject.getLong("organId") : null;
Integer limit = jsonObject.get("limit")!=null ? jsonObject.getInteger("limit") : null;
List<Supplier> supplierList = supplierService.findBySelectRetail(key, organId, limit);
JSONArray dataArray = new JSONArray();
if (null != supplierList) {
for (Supplier supplier : supplierList) {
JSONObject item = new JSONObject();
item.put("id", supplier.getId());
//客户名称
item.put("supplier", supplier.getSupplier());
item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额
dataArray.add(item);
}
}
arr = dataArray;
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = supplierService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 获取全部客户信息
* @param search
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllCustomer")
@ApiOperation(value = "获取全部客户信息")
public TableDataInfo getAllCustomer(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
List<SupplierSimple> list = supplierService.getAllCustomer();
return getDataTable(list);
}
/**
* 获取用户对应客户的关系数组
* @param type
* @param keyId
* @param request
* @return
*/
@GetMapping(value = "/getUserCustomerValue")
@ApiOperation(value = "获取用户对应客户的关系数组")
public JSONObject getUserCustomerValue(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
HttpServletRequest request) throws Exception{
JSONObject obj = new JSONObject();
try {
//获取权限信息
String ubValue = userBusinessService.getUBValueByTypeAndKeyId(type, keyId);
if(StringUtil.isNotEmpty(ubValue)) {
String ubStr = ubValue.substring(1, ubValue.length()-1);
String [] ubArr = ubStr.split("]\\[");
Long[] ubLongArray = new Long[ubArr.length];
for (int i = 0; i < ubArr.length; i++) {
ubLongArray[i] = Long.parseLong(ubArr[i]);
}
obj.put("data", ubLongArray);
} else {
obj.put("data", null);
}
obj.put("code", 200);
} catch (Exception e) {
obj.put("code", 500);
obj.put("data", "服务内部错误");
logger.error(e.getMessage(), e);
}
return obj;
}
/**
* 根据客户或供应商查询期初、期初已收等信息
* @param organId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getBeginNeedByOrganId")
@ApiOperation(value = "根据客户或供应商查询期初、期初已收等信息")
public BaseResponseInfo getBeginNeedByOrganId(@RequestParam("organId") Long organId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> map = supplierService.getBeginNeedByOrganId(organId);
res.code = 200;
res.data = map;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 导入供应商
* @param file
* @param request
* @param response
* @return
*/
@PostMapping(value = "/importVendor")
@ApiOperation(value = "导入供应商")
public BaseResponseInfo importVendor(MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
supplierService.checkFileExt(file);
supplierService.importVendor(file, request);
res.code = 200;
res.data = "导入成功";
} catch(BusinessRunTimeException e) {
res.code = e.getCode();
res.data = e.getData().get("message");
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
return res;
}
/**
* 导入客户
* @param file
* @param request
* @param response
* @return
*/
@PostMapping(value = "/importCustomer")
@ApiOperation(value = "导入客户")
public BaseResponseInfo importCustomer(MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
supplierService.checkFileExt(file);
supplierService.importCustomer(file, request);
res.code = 200;
res.data = "导入成功";
} catch(BusinessRunTimeException e) {
res.code = e.getCode();
res.data = e.getData().get("message");
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
return res;
}
/**
* 导入会员
* @param file
* @param request
* @param response
* @return
*/
@PostMapping(value = "/importMember")
@ApiOperation(value = "导入会员")
public BaseResponseInfo importMember(MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
supplierService.checkFileExt(file);
supplierService.importMember(file, request);
res.code = 200;
res.data = "导入成功";
} catch(BusinessRunTimeException e) {
res.code = e.getCode();
res.data = e.getData().get("message");
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "导入失败";
}
return res;
}
/**
* 生成excel表格
* @param supplier
* @param type
* @param phonenum
* @param telephone
* @param request
* @param response
* @return
*/
@GetMapping(value = "/exportExcel")
public void exportExcel(@RequestParam(value = "supplier", required = false) String supplier,
@RequestParam("type") String type,
@RequestParam(value = "phonenum", required = false) String phonenum,
@RequestParam(value = "telephone", required = false) String telephone,
HttpServletRequest request, HttpServletResponse response) {
try {
List<Supplier> dataList = supplierService.findByAll(supplier, type, phonenum, telephone);
File file = supplierService.exportExcel(dataList, type);
ExcelUtils.downloadExcel(file, file.getName(), response);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* 批量设置会员当前的预付款
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchSetAdvanceIn")
@ApiOperation(value = "批量设置会员当前的预付款")
public String batchSetAdvanceIn(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = supplierService.batchSetAdvanceIn(ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/getInfoByName")
@ApiOperation(value = "根据名称获取信息")
public String getInfoByName(@RequestParam("name") String name,
@RequestParam("type") String type,
HttpServletRequest request) throws Exception {
Supplier supplier = supplierService.getInfoByName(name, type);
Map<String, Object> objectMap = new HashMap<>();
if(supplier != null) {
objectMap.put("info", supplier);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,124 @@
package com.reallin.smt.controller;
import com.reallin.smt.base.AjaxResult;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.SysDictData;
import com.reallin.smt.service.SysDictDataService;
import com.reallin.smt.service.SysDictTypeService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 数据字典信息
*
* @author jishenghua
*/
@RestController
@RequestMapping("/dict/data")
public class SysDictDataController extends BaseController {
@Resource
private SysDictDataService dictDataService;
@Resource
private SysDictTypeService dictTypeService;
@Resource
private UserService userService;
@GetMapping("/list")
@ApiOperation(value = "查询列表")
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) {
SysDictData dictData = new SysDictData();
dictData.setDictType(StringUtil.getInfo(search, "dictType"));
dictData.setDictLabel(StringUtil.getInfo(search, "dictLabel"));
dictData.setStatus(StringUtil.getInfo(search, "status"));
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
/**
* 查询字典数据详细
*/
@GetMapping(value = "/{dictCode}")
@ApiOperation(value = "查询字典数据详细")
public AjaxResult getInfo(@PathVariable Long dictCode) {
return success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
@ApiOperation(value = "根据字典类型查询字典数据信息")
public AjaxResult dictType(@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtil.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return success(data);
}
/**
* 新增字典数据
*/
@ApiOperation(value = "新增字典数据")
@PostMapping(value = "/add")
public String add(@Validated @RequestBody SysDictData dict) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
dict.setCreateBy(userService.getCurrentUser().getLoginName());
return returnStr(objectMap, dictDataService.insertDictData(dict));
}
/**
* 修改保存字典数据
*/
@ApiOperation(value = "修改保存字典数据")
@PutMapping(value = "/update")
public String edit(@Validated @RequestBody SysDictData dict) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
dict.setUpdateBy(userService.getCurrentUser().getLoginName());
return returnStr(objectMap, dictDataService.updateDictData(dict));
}
/**
* 删除字典数据
*/
@DeleteMapping("/{dictCodes}")
@ApiOperation(value = "删除字典数据")
public AjaxResult remove(@PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = dictDataService.deleteDictData(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = dictDataService.batchDeleteDictData(ids, request);
return returnStr(objectMap, delete);
}
}

View File

@@ -0,0 +1,129 @@
package com.reallin.smt.controller;
import com.reallin.smt.base.AjaxResult;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.SysDictType;
import com.reallin.smt.service.SysDictTypeService;
import com.reallin.smt.service.UserService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* 数据字典信息
*
* @author jishenghua
*/
@Api(tags = "字典管理")
@RestController
@RequestMapping("/dict/type")
public class SysDictTypeController extends BaseController {
@Resource
private SysDictTypeService dictTypeService;
@Resource
private UserService userService;
@ApiOperation("获取字典分页列表")
@GetMapping("/list")
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) {
SysDictType dictType = new SysDictType();
dictType.setDictName(StringUtil.getInfo(search, "dictName"));
dictType.setDictType(StringUtil.getInfo(search, "dictType"));
dictType.setStatus(StringUtil.getInfo(search, "status"));
Map<String, Object> params = new HashMap<>();
params.put("beginTime", StringUtil.getInfo(search, "beginTime"));
params.put("endTime", StringUtil.getInfo(search, "endTime"));
dictType.setParams(params);
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
/**
* 查询字典类型详细
*/
@ApiOperation("查询字典类型详细")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) {
return success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@ApiOperation("新增字典类型")
@PostMapping(value = "/add")
public String add(@Validated @RequestBody SysDictType dict) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
if (!dictTypeService.checkDictTypeUnique(dict)) {
return returnJson(objectMap, "新增字典'" + dict.getDictName() + "'失败,字典类型已存在", ErpInfo.ERROR.code);
}
dict.setCreateBy(userService.getCurrentUser().getLoginName());
return returnStr(objectMap, dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@ApiOperation("修改字典类型")
@PutMapping(value = "/update")
public String edit(@Validated @RequestBody SysDictType dict) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
if (!dictTypeService.checkDictTypeUnique(dict)) {
return returnJson(objectMap, "修改字典'" + dict.getDictName() + "'失败,字典类型已存在", ErpInfo.ERROR.code);
}
dict.setUpdateBy(userService.getCurrentUser().getLoginName());
return returnStr(objectMap, dictTypeService.updateDictType(dict));
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = dictTypeService.deleteDictType(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = dictTypeService.batchDeleteDictType(ids, request);
return returnStr(objectMap, delete);
}
/**
* 刷新字典缓存
*/
@ApiOperation("刷新字典缓存")
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache() {
dictTypeService.resetDictCache();
return success();
}
/**
* 获取字典选择框列表
*/
@ApiOperation("获取字典选择框列表")
@GetMapping("/optionselect")
public AjaxResult optionselect() {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes);
}
}

View File

@@ -0,0 +1,370 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.SystemConfig;
import com.reallin.smt.service.SystemConfigService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.HandlerMapping;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* Description
* @Author: jishenghua
* @Date: 2021-3-13 0:01
*/
@RestController
@RequestMapping(value = "/systemConfig")
@Api(tags = {"系统参数"})
public class SystemConfigController extends BaseController {
private Logger logger = LoggerFactory.getLogger(SystemConfigController.class);
@Resource
private SystemConfigService systemConfigService;
@Value(value="${file.uploadType}")
private Long fileUploadType;
@Value(value="${file.path}")
private String filePath;
@Value(value="${spring.servlet.multipart.max-file-size}")
private Long maxFileSize;
@Value(value="${spring.servlet.multipart.max-request-size}")
private Long maxRequestSize;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
SystemConfig systemConfig = systemConfigService.getSystemConfig(id);
Map<String, Object> objectMap = new HashMap<>();
if(systemConfig != null) {
objectMap.put("info", systemConfig);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String companyName = StringUtil.getInfo(search, "companyName");
List<SystemConfig> list = systemConfigService.select(companyName);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = systemConfigService.insertSystemConfig(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = systemConfigService.updateSystemConfig(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = systemConfigService.deleteSystemConfig(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = systemConfigService.batchDeleteSystemConfig(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = systemConfigService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 获取当前租户的配置信息
* @param request
* @return
*/
@GetMapping(value = "/getCurrentInfo")
@ApiOperation(value = "获取当前租户的配置信息")
public BaseResponseInfo getCurrentInfo(HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try{
List<SystemConfig> list = systemConfigService.getSystemConfig();
res.code = 200;
if(list.size()>0) {
res.data = list.get(0);
}
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 获取文件大小限制
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/fileSizeLimit")
@ApiOperation(value = "获取文件大小限制")
public BaseResponseInfo fileSizeLimit(HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try{
Long limit = 0L;
if(maxFileSize<maxRequestSize) {
limit = maxFileSize;
} else {
limit = maxRequestSize;
}
res.code = 200;
res.data = limit;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 文件上传统一方法
* @param request
* @param response
* @return
*/
@PostMapping(value = "/upload")
@ApiOperation(value = "文件上传统一方法")
public BaseResponseInfo upload(HttpServletRequest request, HttpServletResponse response) {
BaseResponseInfo res = new BaseResponseInfo();
try {
String savePath = "";
String bizPath = request.getParameter("biz");
if ("bill".equals(bizPath) || "financial".equals(bizPath) || "material".equals(bizPath)) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
if(fileUploadType == 1) {
savePath = systemConfigService.uploadLocal(file, bizPath, request);
} else if(fileUploadType == 2) {
savePath = systemConfigService.uploadAliOss(file, bizPath, request);
}
if(StringUtil.isNotEmpty(savePath)){
res.code = 200;
res.data = savePath;
}else {
res.code = 500;
res.data = "上传失败!";
}
} else {
res.code = 505;
res.data = "文件分类错误!";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "上传失败!";
}
return res;
}
/**
* 预览图片&下载文件
* 请求地址:http://localhost:8080/common/static/{financial/afsdfasdfasdf_1547866868179.txt}
*
* @param request
* @param response
*/
@GetMapping(value = "/static/**")
@ApiOperation(value = "预览图片&下载文件")
public void view(HttpServletRequest request, HttpServletResponse response) {
// ISO-8859-1 ==> UTF-8 进行编码转换
String imgPath = extractPathFromPattern(request);
if(StringUtil.isEmpty(imgPath) || imgPath=="null"){
return;
}
// 其余处理略
InputStream inputStream = null;
OutputStream outputStream = null;
try {
imgPath = imgPath.replace("..", "");
if (imgPath.endsWith(",")) {
imgPath = imgPath.substring(0, imgPath.length() - 1);
}
String fileUrl = "";
if(fileUploadType == 1) {
fileUrl = systemConfigService.getFileUrlLocal(imgPath);
inputStream = new BufferedInputStream(new FileInputStream(fileUrl));
} else if(fileUploadType == 2) {
fileUrl = systemConfigService.getFileUrlAliOss(imgPath);
URL url = new URL(fileUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5 * 1000);
inputStream = conn.getInputStream();// 通过输入流获取图片数据
}
outputStream = response.getOutputStream();
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
response.flushBuffer();
} catch (IOException e) {
logger.error("预览文件失败" + e.getMessage());
response.setStatus(404);
logger.error(e.getMessage(), e);
} catch (Exception e) {
response.setStatus(404);
logger.error(e.getMessage(), e);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
}
}
/**
* 预览缩略图&下载文件
* @param request
* @param response
*/
@GetMapping(value = "/static/mini/**")
@ApiOperation(value = "预览缩略图&下载文件")
public void viewMini(HttpServletRequest request, HttpServletResponse response) {
// ISO-8859-1 ==> UTF-8 进行编码转换
String imgPath = extractPathFromPattern(request);
if(StringUtil.isEmpty(imgPath) || imgPath=="null"){
return;
}
InputStream inputStream = null;
OutputStream outputStream = null;
try {
imgPath = imgPath.replace("..", "");
if (imgPath.endsWith(",")) {
imgPath = imgPath.substring(0, imgPath.length() - 1);
}
String fileUrl = "";
if(fileUploadType == 1) {
fileUrl = systemConfigService.getFileUrlLocal(imgPath);
inputStream = new BufferedInputStream(new FileInputStream(fileUrl));
} else if(fileUploadType == 2) {
fileUrl = systemConfigService.getFileUrlAliOss(imgPath);
URL url = new URL(fileUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5 * 1000);
inputStream = conn.getInputStream();// 通过输入流获取图片数据
}
int index = fileUrl.lastIndexOf(".");
String ext = fileUrl.substring(index + 1);
BufferedImage image = systemConfigService.getImageMini(inputStream, 80);
outputStream = response.getOutputStream();
ImageIO.write(image, ext, outputStream);
response.flushBuffer();
} catch (Exception e) {
response.setStatus(404);
logger.error(e.getMessage(), e);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
}
}
/**
* Excel导出统一接口
* @param response
*/
@PostMapping(value = "/exportExcelByParam")
@ApiOperation(value = "生成excel表格")
public void exportExcelByParam(@RequestBody JSONObject jsonObject,
HttpServletResponse response) {
try {
String title = jsonObject.getString("title");
String head = jsonObject.getString("head");
String tip = jsonObject.getString("tip");
JSONArray arr = jsonObject.getJSONArray("list");
systemConfigService.exportExcelByParam(title, head, tip, arr, response);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
/**
* 把指定URL后的字符串全部截断当成参数
* 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题
* @param request
* @return
*/
private static String extractPathFromPattern(final HttpServletRequest request) {
String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path);
}
}

View File

@@ -0,0 +1,128 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Tenant;
import com.reallin.smt.datasource.entities.TenantEx;
import com.reallin.smt.service.TenantService;
import com.reallin.smt.utils.Constants;
import com.reallin.smt.utils.ErpInfo;
import com.reallin.smt.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji_sheng_hua SMT
*/
@RestController
@RequestMapping(value = "/tenant")
@Api(tags = {"租户管理"})
public class TenantController extends BaseController {
@Resource
private TenantService tenantService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Tenant tenant = tenantService.getTenant(id);
Map<String, Object> objectMap = new HashMap<>();
if(tenant != null) {
objectMap.put("info", tenant);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String loginName = StringUtil.getInfo(search, "loginName");
String type = StringUtil.getInfo(search, "type");
String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark");
List<TenantEx> list = tenantService.select(loginName, type, enabled, remark);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = tenantService.insertTenant(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = tenantService.updateTenant(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = tenantService.deleteTenant(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = tenantService.batchDeleteTenant(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = tenantService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = tenantService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,40 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.AssetInventory;
import com.reallin.smt.service.AssetManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
/**
* 参考设备服务的兼容入口。保留原接口的拼写,便于协同服务平滑切换。
*/
@RestController
@RequestMapping("/tpmDouble")
@Api(tags = "盘点协同兼容接口")
public class TpmDoubleController {
@Resource
private AssetManagementService service;
@PostMapping("/cteatePdTasks")
@ApiOperation("一键为全部设备创建盘点任务")
public String createPdTasks(@RequestBody(required = false) JSONObject request) throws Exception {
JSONObject input = request == null ? new JSONObject() : request;
input.put("scopeType", "DEVICE");
input.put("source", "TPM_DOUBLE");
AssetInventory inventory = service.createInventory(input, "TPM_DOUBLE");
Map<String, Object> data = new HashMap<>();
data.put("inventory", inventory);
return returnJson(data, "创建成功", 200);
}
}

View File

@@ -0,0 +1,150 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.datasource.entities.Unit;
import com.reallin.smt.service.UnitService;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* Description
*
* @Author: qiankunpingtai
* @Date: 2019/4/1 15:38
*/
@RestController
@RequestMapping(value = "/unit")
@Api(tags = {"单位管理"})
public class UnitController extends BaseController {
private Logger logger = LoggerFactory.getLogger(UnitController.class);
@Resource
private UnitService unitService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Unit unit = unitService.getUnit(id);
Map<String, Object> objectMap = new HashMap<>();
if(unit != null) {
objectMap.put("info", unit);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
List<Unit> list = unitService.select(name);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = unitService.insertUnit(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = unitService.updateUnit(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = unitService.deleteUnit(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = unitService.batchDeleteUnit(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = unitService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 单位列表
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getAllList")
@ApiOperation(value = "单位列表")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
List<Unit> unitList = unitService.getUnit();
res.code = 200;
res.data = unitList;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Boolean status = jsonObject.getBoolean("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = unitService.batchSetStatus(status, ids);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}

View File

@@ -0,0 +1,199 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.datasource.entities.UserBusiness;
import com.reallin.smt.service.UserBusinessService;
import com.reallin.smt.utils.BaseResponseInfo;
import com.reallin.smt.utils.ErpInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji_sheng_hua jshERP
*/
@RestController
@RequestMapping(value = "/userBusiness")
@Api(tags = {"用户角色模块的关系"})
public class UserBusinessController {
private Logger logger = LoggerFactory.getLogger(UserBusinessController.class);
@Resource
private UserBusinessService userBusinessService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
UserBusiness userBusiness = userBusinessService.getUserBusiness(id);
Map<String, Object> objectMap = new HashMap<>();
if(userBusiness != null) {
objectMap.put("info", userBusiness);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = userBusinessService.insertUserBusiness(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = userBusinessService.updateUserBusiness(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = userBusinessService.deleteUserBusiness(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = userBusinessService.batchDeleteUserBusiness(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = userBusinessService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 获取信息
* @param keyId
* @param type
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getBasicData")
@ApiOperation(value = "获取信息")
public BaseResponseInfo getBasicData(@RequestParam(value = "KeyId") String keyId,
@RequestParam(value = "Type") String type,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
List<UserBusiness> list = userBusinessService.getBasicData(keyId, type);
Map<String, List> mapData = new HashMap<String, List>();
mapData.put("userBusinessList", list);
res.code = 200;
res.data = mapData;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "查询权限失败";
}
return res;
}
/**
* 校验存在
* @param type
* @param keyId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/checkIsValueExist")
@ApiOperation(value = "校验存在")
public String checkIsValueExist(@RequestParam(value ="type", required = false) String type,
@RequestParam(value ="keyId", required = false) String keyId,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
Long id = userBusinessService.checkIsValueExist(type, keyId);
objectMap.put("id", id);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 更新角色的按钮权限
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/updateBtnStr")
@ApiOperation(value = "更新角色的按钮权限")
public BaseResponseInfo updateBtnStr(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String roleId = jsonObject.getString("roleId");
String btnStr = jsonObject.getString("btnStr");
String keyId = roleId;
String type = "RoleFunctions";
int back = userBusinessService.updateBtnStr(keyId, type, btnStr);
if(back > 0) {
res.code = 200;
res.data = "成功";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "更新权限失败";
}
return res;
}
/**
* 根据KeyId和类型更新一个值
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/updateOneValueByKeyIdAndType")
@ApiOperation(value = "根据KeyId和类型更新一个值")
public BaseResponseInfo updateOneValueByKeyIdAndType(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String type = jsonObject.getString("type");
JSONArray keyIdArr = jsonObject.getJSONArray("keyIds");
String oneValue = jsonObject.getString("oneValue");
int back = userBusinessService.updateOneValueByKeyIdAndType(type, keyIdArr, oneValue);
if(back > 0) {
res.code = 200;
res.data = "成功";
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "更新权限失败";
}
return res;
}
}

View File

@@ -0,0 +1,609 @@
package com.reallin.smt.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.reallin.smt.base.BaseController;
import com.reallin.smt.base.TableDataInfo;
import com.reallin.smt.constants.BusinessConstants;
import com.reallin.smt.constants.ExceptionConstants;
import com.reallin.smt.datasource.entities.User;
import com.reallin.smt.datasource.entities.UserEx;
import com.reallin.smt.datasource.vo.TreeNodeEx;
import com.reallin.smt.exception.BusinessRunTimeException;
import com.reallin.smt.service.*;
import com.reallin.smt.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.reallin.smt.utils.ResponseJsonUtil.returnJson;
import static com.reallin.smt.utils.ResponseJsonUtil.returnStr;
/**
* @author ji_sheng_hua SMT
*/
@RestController
@RequestMapping(value = "/user")
@Api(tags = {"用户管理"})
public class UserController extends BaseController {
private Logger logger = LoggerFactory.getLogger(UserController.class);
@Value("${manage.roleId}")
private Integer manageRoleId;
@Resource
private UserService userService;
@Resource
private RoleService roleService;
@Resource
private UserBusinessService userBusinessService;
@Resource
private RedisService redisService;
private static String SUCCESS = "操作成功";
private static String ERROR = "操作失败";
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
User user = userService.getUser(id);
Map<String, Object> objectMap = new HashMap<>();
if(user != null) {
objectMap.put("info", user);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String userName = StringUtil.getInfo(search, "userName");
String loginName = StringUtil.getInfo(search, "loginName");
List<UserEx> list = userService.select(userName, loginName);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = userService.insertUser(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = userService.updateUser(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = userService.deleteUser(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = userService.batchDeleteUser(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = userService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@PostMapping(value = "/login")
@ApiOperation(value = "登录")
public BaseResponseInfo login(@RequestBody UserEx userParam, HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
userService.validateCaptcha(userParam.getCode(), userParam.getUuid());
Map<String, Object> data = userService.login(userParam.getLoginName().trim(), userParam.getPassword().trim(), request);
res.code = 200;
res.data = data;
} catch (BusinessRunTimeException e) {
throw new BusinessRunTimeException(e.getCode(), e.getMessage());
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "用户登录失败";
}
return res;
}
@PostMapping(value = "/weixinLogin")
@ApiOperation(value = "微信登录")
public BaseResponseInfo weixinLogin(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
String weixinCode = jsonObject.getString("weixinCode");
User user = userService.getUserByWeixinCode(weixinCode);
if(user == null) {
res.code = 501;
res.data = "微信未绑定";
} else {
logger.info("微信登录:" + user.getLoginName());
Map<String, Object> data = userService.login(user.getLoginName().trim(), user.getPassword().trim(), request);
res.code = 200;
res.data = data;
}
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "用户登录失败";
}
return res;
}
@PostMapping(value = "/weixinBind")
@ApiOperation(value = "绑定微信")
public String weixinBind(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
String loginName = jsonObject.getString("loginName");
String password = jsonObject.getString("password");
String weixinCode = jsonObject.getString("weixinCode");
int res = userService.weixinBind(loginName, password, weixinCode);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/getUserSession")
@ApiOperation(value = "获取用户信息")
public BaseResponseInfo getSessionUser(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
Long userId = Long.parseLong(redisService.getObjectFromSessionByKey(request,"userId").toString());
User user = userService.getUser(userId);
user.setPassword(null);
data.put("user", user);
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取session失败";
}
return res;
}
@GetMapping(value = "/logout")
@ApiOperation(value = "退出")
public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
redisService.deleteObjectBySession(request,"userId");
redisService.deleteObjectBySession(request,"clientIp");
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "退出失败";
}
return res;
}
@PostMapping(value = "/resetPwd")
@ApiOperation(value = "重置密码")
public String resetPwd(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
Long id = jsonObject.getLong("id");
String md5Pwd = jsonObject.getString("password");
int update = userService.resetPwd(md5Pwd, id, request);
if(update > 0) {
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ERROR, ErpInfo.ERROR.code);
}
}
@PutMapping(value = "/updatePwd")
@ApiOperation(value = "更新密码")
public String updatePwd(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Integer flag = 0;
Map<String, Object> objectMap = new HashMap<String, Object>();
try {
String info = "";
Long userId = jsonObject.getLong("userId");
String oldpwd = jsonObject.getString("oldpassword");
String password = jsonObject.getString("password");
User user = userService.getUser(userId);
//必须和原始密码一致才可以更新密码
if (oldpwd.equalsIgnoreCase(user.getPassword())) {
user.setPassword(password);
flag = userService.updateUserByObj(user, request); //1-成功
info = "修改成功";
} else {
flag = 2; //原始密码输入错误
info = "原始密码输入错误";
}
objectMap.put("status", flag);
if(flag > 0) {
return returnJson(objectMap, info, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ERROR, ErpInfo.ERROR.code);
}
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>修改用户ID为 : " + jsonObject.getLong("userId") + "密码信息失败", e);
flag = 3;
objectMap.put("status", flag);
return returnJson(objectMap, ERROR, ErpInfo.ERROR.code);
}
}
/**
* 用户列表,用于用户下拉框
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getUserList")
@ApiOperation(value = "用户列表")
public JSONArray getUserList(HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
List<User> dataList = userService.getUser(request);
if (null != dataList) {
for (User user : dataList) {
JSONObject item = new JSONObject();
item.put("id", user.getId());
item.put("userName", user.getUsername());
dataArray.add(item);
}
}
} catch(Exception e){
logger.error(e.getMessage(), e);
}
return dataArray;
}
/**
* create by: cjl
* description:
* 新增用户及部门和用户关系
* create time: 2019/3/8 16:06
* @Param: beanJson
* @return java.lang.Object
*/
@PostMapping("/addUser")
@ApiOperation(value = "新增用户")
@ResponseBody
public Object addUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
UserEx ue= JSONObject.parseObject(obj.toJSONString(), UserEx.class);
userService.addUserAndOrgUserRel(ue, request);
return result;
}
/**
* create by: cjl
* description:
* 修改用户及部门和用户关系
* create time: 2019/3/8 16:06
* @Param: beanJson
* @return java.lang.Object
*/
@PutMapping("/updateUser")
@ApiOperation(value = "修改用户")
@ResponseBody
public Object updateUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
UserEx ue= JSONObject.parseObject(obj.toJSONString(), UserEx.class);
userService.updateUserAndOrgUserRel(ue, request);
return result;
}
/**
* 分配用户角色
* @param obj
* @param request
* @return
* @throws Exception
*/
@PostMapping("/updateUserRole")
@ApiOperation(value = "分配用户角色")
@ResponseBody
public BaseResponseInfo updateUserRole(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
try {
Long userId = obj.getLong("id");
Long roleId = obj.getLong("roleId");
if(userId == null || roleId == null) {
res.code = 500;
res.data = "参数错误";
return res;
}
User user = userService.getUser(userId);
if(user == null) {
res.code = 500;
res.data = "用户不存在";
return res;
}
//更新用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", userId);
ubObj.put("value", "[" + roleId + "]");
Long ubId = userBusinessService.checkIsValueExist("UserRole", userId.toString());
if(ubId != null) {
ubObj.put("id", ubId);
userBusinessService.updateUserBusiness(ubObj, request);
} else {
userBusinessService.insertUserBusiness(ubObj, request);
}
res.code = 200;
res.data = "操作成功";
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "操作失败";
}
return res;
}
/**
* 注册用户
* @param ue
* @return
* @throws Exception
*/
@PostMapping(value = "/registerUser")
@ApiOperation(value = "注册用户")
public Object registerUser(@RequestBody UserEx ue,
HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
ue.setUsername(ue.getLoginName());
userService.validateCaptcha(ue.getCode(), ue.getUuid());
userService.checkLoginName(ue); //检查登录名
userService.registerUser(ue,manageRoleId,request);
return result;
}
/**
* 获取部门用户树
* @return
* @throws Exception
*/
@RequestMapping("/getOrganizationUserTree")
@ApiOperation(value = "获取部门用户树")
public JSONArray getOrganizationUserTree()throws Exception{
JSONArray arr=new JSONArray();
List<TreeNodeEx> organizationUserTree= userService.getOrganizationUserTree();
if(organizationUserTree!=null&&organizationUserTree.size()>0){
for(TreeNodeEx node:organizationUserTree){
String str=JSON.toJSONString(node);
JSONObject obj=JSON.parseObject(str);
arr.add(obj) ;
}
}
return arr;
}
@GetMapping(value = "/getCurrentPriceLimit")
@ApiOperation(value = "查询当前用户的价格屏蔽")
public BaseResponseInfo getCurrentPriceLimit(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
String priceLimit = roleService.getCurrentPriceLimit(request);
data.put("priceLimit", priceLimit);
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取session失败";
}
return res;
}
/**
* 获取当前用户的角色类型
* @param request
* @return
*/
@GetMapping("/getRoleTypeByCurrentUser")
@ApiOperation(value = "获取当前用户的角色类型")
public BaseResponseInfo getRoleTypeByCurrentUser(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<String, Object>();
Long userId = userService.getUserId(request);
String roleType = userService.getRoleTypeByUserId(userId).getType(); //角色类型
data.put("roleType", roleType);
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
return res;
}
/**
* 获取当前用户的按钮权限
* @param request
* @return
*/
@GetMapping("/getUserBtnByCurrentUser")
@ApiOperation(value = "获取当前用户的按钮权限")
public BaseResponseInfo getUserBtnByCurrentUser(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
Long userId = userService.getUserId(request);
JSONArray btnStrArr = userService.getBtnStrArrById(userId);
data.put("userBtn", btnStrArr);
res.code = 200;
res.data = data;
} catch(Exception e){
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
return res;
}
/**
* 获取对应的用户显示
* @param type
* @param oneValue
* @param request
* @return
*/
@GetMapping(value = "/getUserWithChecked")
@ApiOperation(value = "获取对应的用户显示")
public JSONArray getUserWithChecked(@RequestParam("UBType") String type, @RequestParam("UBValue") String oneValue,
HttpServletRequest request) throws Exception{
JSONArray arr = new JSONArray();
try {
//获取权限信息
List<Long> keyIdList = userBusinessService.getUBKeyIdByTypeAndOneValue(type, oneValue);
Map<Long, Long> keyIdMap = keyIdList.stream().collect(Collectors.toMap(Function.identity(),Function.identity()));
List<User> dataList = userService.getUser(request);
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 0);
outer.put("key", 0);
outer.put("value", 0);
outer.put("title", "用户列表");
outer.put("attributes", "用户列表");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (User user : dataList) {
JSONObject item = new JSONObject();
item.put("id", user.getId());
item.put("key", user.getId());
item.put("value", user.getId());
item.put("title", user.getLoginName() + "(" + user.getUsername() + ")");
item.put("attributes", user.getLoginName());
if (keyIdMap.get(user.getId())!=null) {
item.put("checked", true);
}
dataArray.add(item);
}
}
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return arr;
}
/**
* 获取随机校验码
* @param response
* @return
*/
@GetMapping(value = "/randomImage")
@ApiOperation(value = "获取随机校验码")
public BaseResponseInfo randomImage(HttpServletResponse response){
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
String uuid = UUID.randomUUID().toString().replaceAll("-", "") + "";
String verifyKey = BusinessConstants.CAPTCHA_CODE_KEY + uuid;
String codeNum = Tools.getCharAndNum(4);
redisService.storageCaptchaObject(verifyKey, codeNum);
String base64 = RandImageUtil.generate(codeNum);
data.put("uuid", uuid);
data.put("base64", base64);
res.code = 200;
res.data = data;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
return res;
}
/**
* 批量设置状态-启用或者禁用
* @param jsonObject
* @param request
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Byte status = jsonObject.getByte("status");
String ids = jsonObject.getString("ids");
Map<String, Object> objectMap = new HashMap<>();
int res = userService.batchSetStatus(status, ids, request);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 获取当前用户的用户数量和租户信息
* @param request
* @return
*/
@GetMapping(value = "/infoWithTenant")
@ApiOperation(value = "获取当前用户数量")
public BaseResponseInfo infoWithTenant(HttpServletRequest request){
BaseResponseInfo res = new BaseResponseInfo();
try {
Map<String, Object> data = new HashMap<>();
Long userId = Long.parseLong(redisService.getObjectFromSessionByKey(request,"userId").toString());
int userCurrentNum = userService.getUser(request).size();
data.put("userCurrentNum", userCurrentNum);
res.code = 200;
res.data = data;
} catch (Exception e) {
logger.error(e.getMessage(), e);
res.code = 500;
res.data = "获取失败";
}
return res;
}
}

View File

@@ -0,0 +1,115 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
public class Account {
private Long id;
private String name;
private String serialNo;
private BigDecimal initialAmount;
private BigDecimal currentAmount;
private String remark;
private Boolean enabled;
private String sort;
private Boolean isDefault;
private Long tenantId;
private String deleteFlag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSerialNo() {
return serialNo;
}
public void setSerialNo(String serialNo) {
this.serialNo = serialNo == null ? null : serialNo.trim();
}
public BigDecimal getInitialAmount() {
return initialAmount;
}
public void setInitialAmount(BigDecimal initialAmount) {
this.initialAmount = initialAmount;
}
public BigDecimal getCurrentAmount() {
return currentAmount;
}
public void setCurrentAmount(BigDecimal currentAmount) {
this.currentAmount = currentAmount;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

View File

@@ -0,0 +1,910 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class AccountExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AccountExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSerialNoIsNull() {
addCriterion("serial_no is null");
return (Criteria) this;
}
public Criteria andSerialNoIsNotNull() {
addCriterion("serial_no is not null");
return (Criteria) this;
}
public Criteria andSerialNoEqualTo(String value) {
addCriterion("serial_no =", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoNotEqualTo(String value) {
addCriterion("serial_no <>", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoGreaterThan(String value) {
addCriterion("serial_no >", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoGreaterThanOrEqualTo(String value) {
addCriterion("serial_no >=", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoLessThan(String value) {
addCriterion("serial_no <", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoLessThanOrEqualTo(String value) {
addCriterion("serial_no <=", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoLike(String value) {
addCriterion("serial_no like", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoNotLike(String value) {
addCriterion("serial_no not like", value, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoIn(List<String> values) {
addCriterion("serial_no in", values, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoNotIn(List<String> values) {
addCriterion("serial_no not in", values, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoBetween(String value1, String value2) {
addCriterion("serial_no between", value1, value2, "serialNo");
return (Criteria) this;
}
public Criteria andSerialNoNotBetween(String value1, String value2) {
addCriterion("serial_no not between", value1, value2, "serialNo");
return (Criteria) this;
}
public Criteria andInitialAmountIsNull() {
addCriterion("initial_amount is null");
return (Criteria) this;
}
public Criteria andInitialAmountIsNotNull() {
addCriterion("initial_amount is not null");
return (Criteria) this;
}
public Criteria andInitialAmountEqualTo(BigDecimal value) {
addCriterion("initial_amount =", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountNotEqualTo(BigDecimal value) {
addCriterion("initial_amount <>", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountGreaterThan(BigDecimal value) {
addCriterion("initial_amount >", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("initial_amount >=", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountLessThan(BigDecimal value) {
addCriterion("initial_amount <", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("initial_amount <=", value, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountIn(List<BigDecimal> values) {
addCriterion("initial_amount in", values, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountNotIn(List<BigDecimal> values) {
addCriterion("initial_amount not in", values, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("initial_amount between", value1, value2, "initialAmount");
return (Criteria) this;
}
public Criteria andInitialAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("initial_amount not between", value1, value2, "initialAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountIsNull() {
addCriterion("current_amount is null");
return (Criteria) this;
}
public Criteria andCurrentAmountIsNotNull() {
addCriterion("current_amount is not null");
return (Criteria) this;
}
public Criteria andCurrentAmountEqualTo(BigDecimal value) {
addCriterion("current_amount =", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountNotEqualTo(BigDecimal value) {
addCriterion("current_amount <>", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountGreaterThan(BigDecimal value) {
addCriterion("current_amount >", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("current_amount >=", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountLessThan(BigDecimal value) {
addCriterion("current_amount <", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("current_amount <=", value, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountIn(List<BigDecimal> values) {
addCriterion("current_amount in", values, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountNotIn(List<BigDecimal> values) {
addCriterion("current_amount not in", values, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("current_amount between", value1, value2, "currentAmount");
return (Criteria) this;
}
public Criteria andCurrentAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("current_amount not between", value1, value2, "currentAmount");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andEnabledIsNull() {
addCriterion("enabled is null");
return (Criteria) this;
}
public Criteria andEnabledIsNotNull() {
addCriterion("enabled is not null");
return (Criteria) this;
}
public Criteria andEnabledEqualTo(Boolean value) {
addCriterion("enabled =", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledNotEqualTo(Boolean value) {
addCriterion("enabled <>", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledGreaterThan(Boolean value) {
addCriterion("enabled >", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledGreaterThanOrEqualTo(Boolean value) {
addCriterion("enabled >=", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledLessThan(Boolean value) {
addCriterion("enabled <", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledLessThanOrEqualTo(Boolean value) {
addCriterion("enabled <=", value, "enabled");
return (Criteria) this;
}
public Criteria andEnabledIn(List<Boolean> values) {
addCriterion("enabled in", values, "enabled");
return (Criteria) this;
}
public Criteria andEnabledNotIn(List<Boolean> values) {
addCriterion("enabled not in", values, "enabled");
return (Criteria) this;
}
public Criteria andEnabledBetween(Boolean value1, Boolean value2) {
addCriterion("enabled between", value1, value2, "enabled");
return (Criteria) this;
}
public Criteria andEnabledNotBetween(Boolean value1, Boolean value2) {
addCriterion("enabled not between", value1, value2, "enabled");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(String value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(String value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(String value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(String value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(String value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(String value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLike(String value) {
addCriterion("sort like", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotLike(String value) {
addCriterion("sort not like", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<String> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<String> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(String value1, String value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(String value1, String value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andIsDefaultIsNull() {
addCriterion("is_default is null");
return (Criteria) this;
}
public Criteria andIsDefaultIsNotNull() {
addCriterion("is_default is not null");
return (Criteria) this;
}
public Criteria andIsDefaultEqualTo(Boolean value) {
addCriterion("is_default =", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultNotEqualTo(Boolean value) {
addCriterion("is_default <>", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultGreaterThan(Boolean value) {
addCriterion("is_default >", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_default >=", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultLessThan(Boolean value) {
addCriterion("is_default <", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultLessThanOrEqualTo(Boolean value) {
addCriterion("is_default <=", value, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultIn(List<Boolean> values) {
addCriterion("is_default in", values, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultNotIn(List<Boolean> values) {
addCriterion("is_default not in", values, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultBetween(Boolean value1, Boolean value2) {
addCriterion("is_default between", value1, value2, "isDefault");
return (Criteria) this;
}
public Criteria andIsDefaultNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_default not between", value1, value2, "isDefault");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNull() {
addCriterion("delete_flag is null");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNotNull() {
addCriterion("delete_flag is not null");
return (Criteria) this;
}
public Criteria andDeleteFlagEqualTo(String value) {
addCriterion("delete_flag =", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotEqualTo(String value) {
addCriterion("delete_flag <>", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThan(String value) {
addCriterion("delete_flag >", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
addCriterion("delete_flag >=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThan(String value) {
addCriterion("delete_flag <", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
addCriterion("delete_flag <=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLike(String value) {
addCriterion("delete_flag like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotLike(String value) {
addCriterion("delete_flag not like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagIn(List<String> values) {
addCriterion("delete_flag in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotIn(List<String> values) {
addCriterion("delete_flag not in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagBetween(String value1, String value2) {
addCriterion("delete_flag between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
addCriterion("delete_flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,176 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
import java.util.Date;
public class AccountHead {
private Long id;
private String type;
private Long organId;
private Long handsPersonId;
private Long creator;
private BigDecimal changeAmount;
private BigDecimal discountMoney;
private BigDecimal totalPrice;
private Long accountId;
private String billNo;
private Date billTime;
private String remark;
private String fileName;
private String status;
private String source;
private Long tenantId;
private String deleteFlag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public Long getOrganId() {
return organId;
}
public void setOrganId(Long organId) {
this.organId = organId;
}
public Long getHandsPersonId() {
return handsPersonId;
}
public void setHandsPersonId(Long handsPersonId) {
this.handsPersonId = handsPersonId;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public BigDecimal getChangeAmount() {
return changeAmount;
}
public void setChangeAmount(BigDecimal changeAmount) {
this.changeAmount = changeAmount;
}
public BigDecimal getDiscountMoney() {
return discountMoney;
}
public void setDiscountMoney(BigDecimal discountMoney) {
this.discountMoney = discountMoney;
}
public BigDecimal getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(BigDecimal totalPrice) {
this.totalPrice = totalPrice;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getBillNo() {
return billNo;
}
public void setBillNo(String billNo) {
this.billNo = billNo == null ? null : billNo.trim();
}
public Date getBillTime() {
return billTime;
}
public void setBillTime(Date billTime) {
this.billTime = billTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName == null ? null : fileName.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

View File

@@ -0,0 +1,34 @@
package com.reallin.smt.datasource.entities;
public class AccountHeadVo4Body {
private Long id;
private String info;
private String rows;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getRows() {
return rows;
}
public void setRows(String rows) {
this.rows = rows;
}
}

View File

@@ -0,0 +1,81 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
import java.util.Date;
public class AccountHeadVo4ListEx extends AccountHead{
private String organName;
private String handsPersonName;
private String userName;
private String accountName;
private String billTimeStr;
private String sourceType;
private String sourceNumber;
private String sourceTime;
private String sourceUser;
public String getOrganName() {
return organName;
}
public void setOrganName(String organName) {
this.organName = organName;
}
public String getHandsPersonName() {
return handsPersonName;
}
public void setHandsPersonName(String handsPersonName) {
this.handsPersonName = handsPersonName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getBillTimeStr() {
return billTimeStr;
}
public void setBillTimeStr(String billTimeStr) {
this.billTimeStr = billTimeStr;
}
public String getSourceType() { return sourceType; }
public void setSourceType(String sourceType) { this.sourceType = sourceType; }
public String getSourceNumber() { return sourceNumber; }
public void setSourceNumber(String sourceNumber) { this.sourceNumber = sourceNumber; }
public String getSourceTime() { return sourceTime; }
public void setSourceTime(String sourceTime) { this.sourceTime = sourceTime; }
public String getSourceUser() { return sourceUser; }
public void setSourceUser(String sourceUser) { this.sourceUser = sourceUser; }
}

View File

@@ -0,0 +1,115 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
public class AccountItem {
private Long id;
private Long headerId;
private Long accountId;
private Long inOutItemId;
private Long billId;
private BigDecimal needDebt;
private BigDecimal finishDebt;
private BigDecimal eachAmount;
private String remark;
private Long tenantId;
private String deleteFlag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getHeaderId() {
return headerId;
}
public void setHeaderId(Long headerId) {
this.headerId = headerId;
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public Long getInOutItemId() {
return inOutItemId;
}
public void setInOutItemId(Long inOutItemId) {
this.inOutItemId = inOutItemId;
}
public Long getBillId() {
return billId;
}
public void setBillId(Long billId) {
this.billId = billId;
}
public BigDecimal getNeedDebt() {
return needDebt;
}
public void setNeedDebt(BigDecimal needDebt) {
this.needDebt = needDebt;
}
public BigDecimal getFinishDebt() {
return finishDebt;
}
public void setFinishDebt(BigDecimal finishDebt) {
this.finishDebt = finishDebt;
}
public BigDecimal getEachAmount() {
return eachAmount;
}
public void setEachAmount(BigDecimal eachAmount) {
this.eachAmount = eachAmount;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

View File

@@ -0,0 +1,880 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class AccountItemExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AccountItemExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andHeaderIdIsNull() {
addCriterion("header_id is null");
return (Criteria) this;
}
public Criteria andHeaderIdIsNotNull() {
addCriterion("header_id is not null");
return (Criteria) this;
}
public Criteria andHeaderIdEqualTo(Long value) {
addCriterion("header_id =", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdNotEqualTo(Long value) {
addCriterion("header_id <>", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdGreaterThan(Long value) {
addCriterion("header_id >", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdGreaterThanOrEqualTo(Long value) {
addCriterion("header_id >=", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdLessThan(Long value) {
addCriterion("header_id <", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdLessThanOrEqualTo(Long value) {
addCriterion("header_id <=", value, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdIn(List<Long> values) {
addCriterion("header_id in", values, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdNotIn(List<Long> values) {
addCriterion("header_id not in", values, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdBetween(Long value1, Long value2) {
addCriterion("header_id between", value1, value2, "headerId");
return (Criteria) this;
}
public Criteria andHeaderIdNotBetween(Long value1, Long value2) {
addCriterion("header_id not between", value1, value2, "headerId");
return (Criteria) this;
}
public Criteria andAccountIdIsNull() {
addCriterion("account_id is null");
return (Criteria) this;
}
public Criteria andAccountIdIsNotNull() {
addCriterion("account_id is not null");
return (Criteria) this;
}
public Criteria andAccountIdEqualTo(Long value) {
addCriterion("account_id =", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotEqualTo(Long value) {
addCriterion("account_id <>", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdGreaterThan(Long value) {
addCriterion("account_id >", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdGreaterThanOrEqualTo(Long value) {
addCriterion("account_id >=", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdLessThan(Long value) {
addCriterion("account_id <", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdLessThanOrEqualTo(Long value) {
addCriterion("account_id <=", value, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdIn(List<Long> values) {
addCriterion("account_id in", values, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotIn(List<Long> values) {
addCriterion("account_id not in", values, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdBetween(Long value1, Long value2) {
addCriterion("account_id between", value1, value2, "accountId");
return (Criteria) this;
}
public Criteria andAccountIdNotBetween(Long value1, Long value2) {
addCriterion("account_id not between", value1, value2, "accountId");
return (Criteria) this;
}
public Criteria andInOutItemIdIsNull() {
addCriterion("in_out_item_id is null");
return (Criteria) this;
}
public Criteria andInOutItemIdIsNotNull() {
addCriterion("in_out_item_id is not null");
return (Criteria) this;
}
public Criteria andInOutItemIdEqualTo(Long value) {
addCriterion("in_out_item_id =", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdNotEqualTo(Long value) {
addCriterion("in_out_item_id <>", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdGreaterThan(Long value) {
addCriterion("in_out_item_id >", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("in_out_item_id >=", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdLessThan(Long value) {
addCriterion("in_out_item_id <", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdLessThanOrEqualTo(Long value) {
addCriterion("in_out_item_id <=", value, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdIn(List<Long> values) {
addCriterion("in_out_item_id in", values, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdNotIn(List<Long> values) {
addCriterion("in_out_item_id not in", values, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdBetween(Long value1, Long value2) {
addCriterion("in_out_item_id between", value1, value2, "inOutItemId");
return (Criteria) this;
}
public Criteria andInOutItemIdNotBetween(Long value1, Long value2) {
addCriterion("in_out_item_id not between", value1, value2, "inOutItemId");
return (Criteria) this;
}
public Criteria andBillIdIsNull() {
addCriterion("bill_id is null");
return (Criteria) this;
}
public Criteria andBillIdIsNotNull() {
addCriterion("bill_id is not null");
return (Criteria) this;
}
public Criteria andBillIdEqualTo(Long value) {
addCriterion("bill_id =", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotEqualTo(Long value) {
addCriterion("bill_id <>", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdGreaterThan(Long value) {
addCriterion("bill_id >", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdGreaterThanOrEqualTo(Long value) {
addCriterion("bill_id >=", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdLessThan(Long value) {
addCriterion("bill_id <", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdLessThanOrEqualTo(Long value) {
addCriterion("bill_id <=", value, "billId");
return (Criteria) this;
}
public Criteria andBillIdIn(List<Long> values) {
addCriterion("bill_id in", values, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotIn(List<Long> values) {
addCriterion("bill_id not in", values, "billId");
return (Criteria) this;
}
public Criteria andBillIdBetween(Long value1, Long value2) {
addCriterion("bill_id between", value1, value2, "billId");
return (Criteria) this;
}
public Criteria andBillIdNotBetween(Long value1, Long value2) {
addCriterion("bill_id not between", value1, value2, "billId");
return (Criteria) this;
}
public Criteria andNeedDebtIsNull() {
addCriterion("need_debt is null");
return (Criteria) this;
}
public Criteria andNeedDebtIsNotNull() {
addCriterion("need_debt is not null");
return (Criteria) this;
}
public Criteria andNeedDebtEqualTo(BigDecimal value) {
addCriterion("need_debt =", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtNotEqualTo(BigDecimal value) {
addCriterion("need_debt <>", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtGreaterThan(BigDecimal value) {
addCriterion("need_debt >", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("need_debt >=", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtLessThan(BigDecimal value) {
addCriterion("need_debt <", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtLessThanOrEqualTo(BigDecimal value) {
addCriterion("need_debt <=", value, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtIn(List<BigDecimal> values) {
addCriterion("need_debt in", values, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtNotIn(List<BigDecimal> values) {
addCriterion("need_debt not in", values, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("need_debt between", value1, value2, "needDebt");
return (Criteria) this;
}
public Criteria andNeedDebtNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("need_debt not between", value1, value2, "needDebt");
return (Criteria) this;
}
public Criteria andFinishDebtIsNull() {
addCriterion("finish_debt is null");
return (Criteria) this;
}
public Criteria andFinishDebtIsNotNull() {
addCriterion("finish_debt is not null");
return (Criteria) this;
}
public Criteria andFinishDebtEqualTo(BigDecimal value) {
addCriterion("finish_debt =", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtNotEqualTo(BigDecimal value) {
addCriterion("finish_debt <>", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtGreaterThan(BigDecimal value) {
addCriterion("finish_debt >", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("finish_debt >=", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtLessThan(BigDecimal value) {
addCriterion("finish_debt <", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtLessThanOrEqualTo(BigDecimal value) {
addCriterion("finish_debt <=", value, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtIn(List<BigDecimal> values) {
addCriterion("finish_debt in", values, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtNotIn(List<BigDecimal> values) {
addCriterion("finish_debt not in", values, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("finish_debt between", value1, value2, "finishDebt");
return (Criteria) this;
}
public Criteria andFinishDebtNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("finish_debt not between", value1, value2, "finishDebt");
return (Criteria) this;
}
public Criteria andEachAmountIsNull() {
addCriterion("each_amount is null");
return (Criteria) this;
}
public Criteria andEachAmountIsNotNull() {
addCriterion("each_amount is not null");
return (Criteria) this;
}
public Criteria andEachAmountEqualTo(BigDecimal value) {
addCriterion("each_amount =", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountNotEqualTo(BigDecimal value) {
addCriterion("each_amount <>", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountGreaterThan(BigDecimal value) {
addCriterion("each_amount >", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("each_amount >=", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountLessThan(BigDecimal value) {
addCriterion("each_amount <", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("each_amount <=", value, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountIn(List<BigDecimal> values) {
addCriterion("each_amount in", values, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountNotIn(List<BigDecimal> values) {
addCriterion("each_amount not in", values, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("each_amount between", value1, value2, "eachAmount");
return (Criteria) this;
}
public Criteria andEachAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("each_amount not between", value1, value2, "eachAmount");
return (Criteria) this;
}
public Criteria andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNull() {
addCriterion("delete_flag is null");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNotNull() {
addCriterion("delete_flag is not null");
return (Criteria) this;
}
public Criteria andDeleteFlagEqualTo(String value) {
addCriterion("delete_flag =", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotEqualTo(String value) {
addCriterion("delete_flag <>", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThan(String value) {
addCriterion("delete_flag >", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
addCriterion("delete_flag >=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThan(String value) {
addCriterion("delete_flag <", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
addCriterion("delete_flag <=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLike(String value) {
addCriterion("delete_flag like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotLike(String value) {
addCriterion("delete_flag not like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagIn(List<String> values) {
addCriterion("delete_flag in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotIn(List<String> values) {
addCriterion("delete_flag not in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagBetween(String value1, String value2) {
addCriterion("delete_flag between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
addCriterion("delete_flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,47 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
public class AccountVo4Sum {
private Long id;
private BigDecimal accountSum;
private BigDecimal accountSumByHead;
private BigDecimal accountSumByDetail;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public BigDecimal getAccountSum() {
return accountSum;
}
public void setAccountSum(BigDecimal accountSum) {
this.accountSum = accountSum;
}
public BigDecimal getAccountSumByHead() {
return accountSumByHead;
}
public void setAccountSumByHead(BigDecimal accountSumByHead) {
this.accountSumByHead = accountSumByHead;
}
public BigDecimal getAccountSumByDetail() {
return accountSumByDetail;
}
public void setAccountSumByDetail(BigDecimal accountSumByDetail) {
this.accountSumByDetail = accountSumByDetail;
}
}

View File

@@ -0,0 +1,39 @@
package com.reallin.smt.datasource.entities;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 资产台账。
*/
@Data
public class Asset {
private Long id;
private String assetCode;
private String assetName;
private Long categoryId;
private String categoryCode;
private String assetCategory;
private String specification;
private String unit;
private BigDecimal quantity;
private BigDecimal originalValue;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date purchaseDate;
private String useDepartment;
private String keeper;
private String location;
private String status;
private String source;
private String externalSource;
private String externalId;
private String remark;
private Long creator;
private Long updater;
private String deleteFlag;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,23 @@
package com.reallin.smt.datasource.entities;
import lombok.Data;
import java.util.Date;
/**
* 资产种类。
*/
@Data
public class AssetCategory {
private Long id;
private String categoryCode;
private String categoryName;
private String description;
private Integer sort;
private Boolean enabled;
private Long creator;
private Long updater;
private String deleteFlag;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,38 @@
package com.reallin.smt.datasource.entities;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 设备台账,一个资产可关联多台设备。
*/
@Data
public class AssetDevice {
private Long id;
private Long assetId;
private String assetCode;
private String deviceCode;
private String deviceName;
private String deviceCategory;
private String model;
private String serialNumber;
private String manufacturer;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date purchaseDate;
private Date enabledDate;
private String useDepartment;
private String keeper;
private String location;
private String status;
private Date lastInventoryTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date nextMaintenanceDate;
private String remark;
private Long creator;
private Long updater;
private String deleteFlag;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,37 @@
package com.reallin.smt.datasource.entities;
import lombok.Data;
import java.util.Date;
/**
* 资产盘点单。
*/
@Data
public class AssetInventory {
private Long id;
private String inventoryNo;
private String planName;
private String scopeType;
private Date plannedAt;
private Date deadline;
private String status;
private Integer totalCount;
private Integer inventoriedCount;
private Integer normalCount;
private Integer abnormalCount;
private Long inventoryUserId;
private String inventoryUserName;
private Date startedAt;
private Date completedAt;
private Long auditUserId;
private Date auditTime;
private String source;
private String externalRequestId;
private String remark;
private Long creator;
private Long updater;
private String deleteFlag;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,36 @@
package com.reallin.smt.datasource.entities;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
/**
* 资产盘点快照明细。
*/
@Data
public class AssetInventoryDetail {
private Long id;
private Long inventoryId;
private String targetType;
private Long targetId;
private String targetCode;
private String targetName;
private String model;
private BigDecimal bookQuantity;
private BigDecimal actualQuantity;
private String inventoryStatus;
private String bookDepartment;
private String actualDepartment;
private String bookLocation;
private String actualLocation;
private Date inventoryTime;
private Long inventoryUserId;
private String inventoryUserName;
private String remark;
private String imageGroupId;
private List<String> imageUrls;
private Date createTime;
private Date updateTime;
}

View File

@@ -0,0 +1,152 @@
package com.reallin.smt.datasource.entities;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Entity基类
*
* @author jishenghua
*/
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 搜索值
*/
@TableField(exist = false)
@ApiModelProperty("搜索值")
@JsonIgnore
private String searchValue;
/**
* 创建者
*/
@ApiModelProperty("创建者")
private String createBy;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新者
*/
@ApiModelProperty("更新者")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 当前记录起始索引 默认值
*/
public static final int DEFAULT_PAGE_NUM = 1;
/**
* 每页显示记录数 默认值 默认查全部
*/
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
/**
* 请求参数
*/
@TableField(exist = false)
@ApiModelProperty("请求参数")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public String getSearchValue() {
return searchValue;
}
public void setSearchValue(String searchValue) {
this.searchValue = searchValue;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
}

View File

@@ -0,0 +1,128 @@
package com.reallin.smt.datasource.entities;
import java.util.Date;
/**
* 客户分类实体类
*/
public class CustomerCategory {
private Long id;
private String categoryName;
private Long parentId;
private Integer level;
private String sort;
private String description;
private Boolean enabled;
private Long creator;
private Long tenantId;
private String deleteFlag;
private Date createTime;
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName == null ? null : categoryName.trim();
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -0,0 +1,168 @@
package com.reallin.smt.datasource.entities;
import java.util.Date;
/**
* 客户联系人实体类
*/
public class CustomerContact {
private Long id;
private Long customerId;
private String contactName;
private String position;
private String phone;
private String telephone;
private String email;
private String wechat;
private String qq;
private Boolean isPrimary;
private String remark;
private Long creator;
private Long tenantId;
private String deleteFlag;
private Date createTime;
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getContactName() {
return contactName;
}
public void setContactName(String contactName) {
this.contactName = contactName == null ? null : contactName.trim();
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position == null ? null : position.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim();
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email == null ? null : email.trim();
}
public String getWechat() {
return wechat;
}
public void setWechat(String wechat) {
this.wechat = wechat == null ? null : wechat.trim();
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq == null ? null : qq.trim();
}
public Boolean getIsPrimary() {
return isPrimary;
}
public void setIsPrimary(Boolean isPrimary) {
this.isPrimary = isPrimary;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -0,0 +1,144 @@
package com.reallin.smt.datasource.entities;
import java.util.Date;
/**
* 交货计划主表
*/
public class DeliveryPlan {
private Long id;
private String planNumber;
private String sourceType;
private Long sourceBillId;
private String sourceBillNumber;
private String saleOrderNumber;
private Long customerId;
private String status;
private Date plannedDeliveryTime;
private String adjustReason;
private String remark;
private Date createTime;
private Long creator;
private Long tenantId;
private String deleteFlag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPlanNumber() {
return planNumber;
}
public void setPlanNumber(String planNumber) {
this.planNumber = planNumber == null ? null : planNumber.trim();
}
public String getSourceType() {
return sourceType;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType == null ? null : sourceType.trim();
}
public Long getSourceBillId() {
return sourceBillId;
}
public void setSourceBillId(Long sourceBillId) {
this.sourceBillId = sourceBillId;
}
public String getSourceBillNumber() {
return sourceBillNumber;
}
public void setSourceBillNumber(String sourceBillNumber) {
this.sourceBillNumber = sourceBillNumber == null ? null : sourceBillNumber.trim();
}
public String getSaleOrderNumber() {
return saleOrderNumber;
}
public void setSaleOrderNumber(String saleOrderNumber) {
this.saleOrderNumber = saleOrderNumber == null ? null : saleOrderNumber.trim();
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Date getPlannedDeliveryTime() {
return plannedDeliveryTime;
}
public void setPlannedDeliveryTime(Date plannedDeliveryTime) {
this.plannedDeliveryTime = plannedDeliveryTime;
}
public String getAdjustReason() {
return adjustReason;
}
public void setAdjustReason(String adjustReason) {
this.adjustReason = adjustReason == null ? null : adjustReason.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreator() {
return creator;
}
public void setCreator(Long creator) {
this.creator = creator;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

View File

@@ -0,0 +1,171 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
/**
* 交货计划明细
*/
public class DeliveryPlanItem {
private Long id;
private Long planId;
private Long sourceItemId;
private Long materialId;
private Long materialExtendId;
private String barCode;
private String materialName;
private String standard;
private String model;
private String unit;
private String batchNumber;
private String snList;
private BigDecimal planQuantity;
private BigDecimal shippedQuantity;
private Long depotId;
private String remark;
private Long tenantId;
private String deleteFlag;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getPlanId() {
return planId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getSourceItemId() {
return sourceItemId;
}
public void setSourceItemId(Long sourceItemId) {
this.sourceItemId = sourceItemId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialExtendId() {
return materialExtendId;
}
public void setMaterialExtendId(Long materialExtendId) {
this.materialExtendId = materialExtendId;
}
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode == null ? null : barCode.trim();
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName == null ? null : materialName.trim();
}
public String getStandard() {
return standard;
}
public void setStandard(String standard) {
this.standard = standard == null ? null : standard.trim();
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model == null ? null : model.trim();
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit == null ? null : unit.trim();
}
public String getBatchNumber() {
return batchNumber;
}
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber == null ? null : batchNumber.trim();
}
public String getSnList() {
return snList;
}
public void setSnList(String snList) {
this.snList = snList == null ? null : snList.trim();
}
public BigDecimal getPlanQuantity() {
return planQuantity;
}
public void setPlanQuantity(BigDecimal planQuantity) {
this.planQuantity = planQuantity;
}
public BigDecimal getShippedQuantity() {
return shippedQuantity;
}
public void setShippedQuantity(BigDecimal shippedQuantity) {
this.shippedQuantity = shippedQuantity;
}
public Long getDepotId() {
return depotId;
}
public void setDepotId(Long depotId) {
this.depotId = depotId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
}

View File

@@ -0,0 +1,135 @@
package com.reallin.smt.datasource.entities;
import java.math.BigDecimal;
public class Depot {
private Long id;
private String name;
private String address;
private BigDecimal warehousing;
private BigDecimal truckage;
private Integer type;
private String sort;
private String remark;
private Long principal;
private Boolean enabled;
private Long tenantId;
private String deleteFlag;
private Boolean isDefault;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public BigDecimal getWarehousing() {
return warehousing;
}
public void setWarehousing(BigDecimal warehousing) {
this.warehousing = warehousing;
}
public BigDecimal getTruckage() {
return truckage;
}
public void setTruckage(BigDecimal truckage) {
this.truckage = truckage;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort == null ? null : sort.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Long getPrincipal() {
return principal;
}
public void setPrincipal(Long principal) {
this.principal = principal;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
}

View File

@@ -0,0 +1,26 @@
package com.reallin.smt.datasource.entities;
import lombok.Data;
import java.math.BigDecimal;
/**
* Description
*
* @Author: cjl
* @Date: 2019/2/25 11:40
*/
@Data
public class DepotEx extends Depot{
//负责人名字
private String principalName;
private BigDecimal initStock;
private BigDecimal currentStock;
private BigDecimal lowSafeStock;
private BigDecimal highSafeStock;
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More