287 Commits
Author SHA1 Message Date
zhaoqing 0c71c4e661 fix(oms):出库单号/预约单生成修改,预约确认生成单号修改 2026-07-25 09:43:05 +08:00
zhaoqing 69e54bb2c6 fix(oms):出库单号/预约单生成修改 2026-07-24 18:09:27 +08:00
zhaoqing d268718f9b fix(oms):入库/出库 预约/业务单号生成 2026-07-23 17:53:32 +08:00
王奎兴 fc16c1edf2 发30 2026-07-23 14:54:15 +08:00
王奎兴 4bd655e4da nc推送改造(进行中); 2026-07-23 14:51:14 +08:00
zhaoqing 8681042a32 发测试 2026-07-23 11:47:53 +08:00
高正杨 44c9953875 oms启动报错 2026-07-23 11:00:06 +08:00
zhaoqing c48b8aa39a fix(oms):预约确认后,物料明细查询问题 2026-07-23 10:50:57 +08:00
王奎兴 36b31e5d52 Merge branch 'dev' into dev_crkbh_260721
# Conflicts:
#	mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java
#	mhd_oms/src/main/resources/bootstrap.yml
2026-07-23 10:44:31 +08:00
秦鸿展 f5c096fe39 发30 2026-07-23 00:39:52 +08:00
秦鸿展 75e77c0476 发31 2026-07-23 00:18:41 +08:00
王奎兴 709b151e3f 参数类型 2026-07-22 22:45:08 +08:00
王奎兴 fa731e1fa5 发30 2026-07-22 22:44:26 +08:00
王奎兴 d1448b2746 发30 2026-07-22 22:42:39 +08:00
王奎兴 32d38b7721 发30 2026-07-22 22:08:21 +08:00
王奎兴 ebc7bee5be 发31 2026-07-22 22:06:05 +08:00
王奎兴 19ca4bbe6c 物料根据组织查询; 2026-07-22 21:53:09 +08:00
王奎兴 2f6988abac 修改预约单更新预约数量 2026-07-22 21:46:28 +08:00
王奎兴 e322e28d05 修改预约单更新预约数量 2026-07-22 21:44:22 +08:00
zhaoqing 9f70b236a0 fix(oms):修改导入的单号 2026-07-22 21:35:29 +08:00
秦鸿展 7dcedab498 委托方导入修改 2026-07-22 21:03:07 +08:00
zhaoqing e2f5896be2 fix(oms):修改预约确认的单号生成 2026-07-22 20:14:19 +08:00
秦鸿展 effa681709 导入修改 2026-07-22 19:01:18 +08:00
秦鸿展 8ea6a82acd 发测试 2026-07-22 16:26:45 +08:00
秦鸿展 e7f2a79dee 委托方导入修改 2026-07-22 14:31:15 +08:00
秦鸿展 8a78122fcb 委托方导入修改以及OMS库存查询调整 2026-07-22 14:10:29 +08:00
zhaoqing 49b3722328 发测试 2026-07-22 13:43:29 +08:00
zhaoqing cb96a3700d 区分预约单和业务单 2026-07-22 11:45:06 +08:00
秦鸿展 9250d03ab1 委托方导入 2026-07-22 11:26:19 +08:00
秦鸿展 494f49ee1b 库存查询按照过期日期来过滤查询 2026-07-22 10:39:34 +08:00
zhaoqing be597775d9 fix(oms):修改预约单 2026-07-21 22:10:27 +08:00
zhaoqing 9eff15e483 fix(oms):修改orderNo 2026-07-21 21:51:33 +08:00
zhaoqing 496548558b fix(oms):出入库预约单单号 2026-07-21 21:20:56 +08:00
zhaoqing 7bd2e0b87c fix(oms):出入库执行单修改 2026-07-21 20:29:38 +08:00
zhaoqing 266d416912 fix(oms):出入库预约确认 2026-07-21 20:00:06 +08:00
zhaoqing f2216adb06 fix(oms):出库执行修改 2026-07-21 19:08:43 +08:00
zhaoqing b825f1a789 fix(oms):入库执行修改 2026-07-21 18:51:53 +08:00
zhaoqing 6177b70b34 feat(oms):出库预约单号 2026-07-21 17:57:35 +08:00
zhaoqing 30dd4abe43 feat(oms):入库预约单号 2026-07-21 17:34:24 +08:00
王奎兴 5dd23e9f42 Merge branch 'dev_jinji' into dev 2026-07-21 16:53:01 +08:00
秦鸿展 f91a2248af 调整账单时间为保存修改 2026-07-21 16:49:53 +08:00
王奎兴 b4db0a8cdb 修改预约单更新预约数量 2026-07-21 15:42:52 +08:00
秦鸿展 65fd1e6a19 31 2026-07-20 16:18:19 +08:00
秦鸿展 bab7f048eb 31 2026-07-20 16:18:12 +08:00
秦鸿展 f543c4a00f 新增费用科目BUG修改 2026-07-20 16:16:33 +08:00
秦鸿展 98004ba989 30 2026-07-20 15:40:18 +08:00
秦鸿展 76c8b1f5aa 备注字段修改 2026-07-20 15:38:34 +08:00
秦鸿展 8542a25238 31 2026-07-20 14:43:33 +08:00
秦鸿展 22590abbb8 调整账单报错 2026-07-20 14:40:11 +08:00
秦鸿展 bb68e118fa 30 2026-07-20 12:51:19 +08:00
秦鸿展 1d28170d46 新增账单金额不一致报错 2026-07-20 12:47:00 +08:00
秦鸿展 1b85098063 发31 2026-07-17 22:18:59 +08:00
秦鸿展 d6d9ee1d5e 发30 2026-07-17 22:14:14 +08:00
秦鸿展 2d9a4eaad2 发30 2026-07-17 21:44:52 +08:00
秦鸿展 1423d5d140 发30 2026-07-17 21:39:53 +08:00
秦鸿展 80e1639b83 发测试 2026-07-17 20:37:17 +08:00
秦鸿展 07862301e6 应收账单新增报错 2026-07-17 20:31:35 +08:00
秦鸿展 d6fae412cd 应收账单新增报错 2026-07-17 20:17:04 +08:00
秦鸿展 7ee70dd06c 应收账单新增报错 2026-07-17 20:11:34 +08:00
秦鸿展 6f33fc3b64 应收账单添加明细报错 2026-07-17 19:40:49 +08:00
王奎兴 a9e3d6cb6b Merge branch 'dev' into dev_jinji 2026-07-17 18:06:41 +08:00
王奎兴 5fe5ce7e82 复核添加货主id查询; 2026-07-17 18:04:56 +08:00
秦鸿展 5cc987c2c4 应收账单明细修改 2026-07-17 16:14:21 +08:00
秦鸿展 9ed1797b59 紧急任务修改 2026-07-17 15:32:11 +08:00
秦鸿展 2373be59e6 紧急任务修改 2026-07-17 15:27:17 +08:00
王奎兴 587550025d 发30 2026-07-17 14:29:43 +08:00
王奎兴 9dfcf4ef5a 发31 2026-07-17 14:22:38 +08:00
秦鸿展 914957e683 新增账单 2026-07-17 11:41:39 +08:00
王奎兴 a852c0844e 发测试 2026-07-17 01:55:08 +08:00
王奎兴 50b10ad19f 发30 2026-07-17 01:51:20 +08:00
王奎兴 aff19e1536 发30 2026-07-17 01:48:15 +08:00
王奎兴 4c58838842 发30 2026-07-17 00:48:43 +08:00
王奎兴 d27cca0217 发31 2026-07-17 00:44:34 +08:00
王奎兴 6f5fa138d9 添加批次号; 2026-07-17 00:11:53 +08:00
王奎兴 cf0a42ec8a 添加批次号; 2026-07-16 23:13:30 +08:00
王奎兴 5c591d3b57 添加批次号; 2026-07-16 22:53:45 +08:00
王奎兴 165927bc3d 执行单下发分发组织; 2026-07-16 20:55:11 +08:00
王奎兴 2d03084f0c 分批上架多余数据处理; 2026-07-16 19:00:49 +08:00
王奎兴 1f0703bc64 分批上架多余数据处理; 2026-07-16 18:35:32 +08:00
王奎兴 9bb5a7c2cf 库位条码; 2026-07-16 18:19:15 +08:00
王奎兴 a7eed8590f 库位条码; 2026-07-16 14:11:33 +08:00
王奎兴 4fad415cb7 库位条码; 2026-07-16 13:51:59 +08:00
王奎兴 a23a4acef3 发测试 2026-07-16 12:21:57 +08:00
王奎兴 0cd0a9535d Merge branch 'dev' into cangmapda_260710 2026-07-16 12:18:51 +08:00
王奎兴 71765b339f 明细上架单号为空问题; 2026-07-16 10:10:51 +08:00
王奎兴 521e4ca5bd 生成任务; 2026-07-16 09:50:09 +08:00
王奎兴 47688bfe34 生成任务; 2026-07-16 09:44:13 +08:00
王奎兴 b0999402cd 生成任务; 2026-07-16 08:58:00 +08:00
高正杨 dde4698fc6 更新1 2026-07-15 22:34:27 +08:00
秦鸿展 5513b0af08 31 2026-07-15 21:19:25 +08:00
秦鸿展 357fb0bd65 30 2026-07-15 21:17:42 +08:00
秦鸿展 16627950e2 港澳服务专区增加字段 2026-07-15 19:06:35 +08:00
王奎兴 81dc017b68 生成任务; 2026-07-15 18:17:46 +08:00
王奎兴 80b96b0f17 复核逻辑修改; 2026-07-15 16:34:03 +08:00
王奎兴 d683774b88 复核逻辑修改; 2026-07-15 16:19:46 +08:00
王奎兴 20f60d490f 复核逻辑修改; 2026-07-15 16:07:16 +08:00
王奎兴 73f7bbd803 复核逻辑修改; 2026-07-15 15:14:45 +08:00
王奎兴 5029ae8d42 复核逻辑修改; 2026-07-15 15:10:51 +08:00
王奎兴 87eea6a8cd 复核逻辑修改; 2026-07-15 14:56:58 +08:00
王奎兴 72b2a153a0 复核逻辑修改; 2026-07-15 14:41:21 +08:00
王奎兴 7326407d13 复核逻辑修改; 2026-07-15 14:36:19 +08:00
王奎兴 4091f20e7a pda任务下发; 2026-07-14 18:09:53 +08:00
王奎兴 7bcf11baaf pda任务下发; 2026-07-14 18:08:28 +08:00
王奎兴 11ad2ea20f 回显出库重量等; 2026-07-14 17:54:17 +08:00
王奎兴 b303c78b39 回显出库重量等; 2026-07-14 17:53:09 +08:00
王奎兴 2fb7d117c0 回显出库重量等; 2026-07-14 17:30:35 +08:00
王奎兴 cdb21fe961 回显出库重量等; 2026-07-14 17:18:57 +08:00
王奎兴 2151555f31 发测试; 2026-07-14 15:10:17 +08:00
王奎兴 ce4f56962f 拣货数量 2026-07-14 15:07:37 +08:00
王奎兴 c3b4923ce9 类型转换异常 2026-07-14 13:52:36 +08:00
王奎兴 c536d2c5c6 类型转换异常 2026-07-14 09:33:45 +08:00
王奎兴 fad5eb66fa 类型转换异常 2026-07-14 09:29:02 +08:00
王奎兴 52172dc3d7 简易模式收货及上架; 2026-07-13 18:04:43 +08:00
王奎兴 34a146514f 简易模式收货及上架; 2026-07-13 17:45:22 +08:00
秦鸿展 8377d9f2a5 同步过滤逻辑修改3 2026-07-13 17:42:04 +08:00
王奎兴 0f2e2e769b 简易模式收货及上架; 2026-07-13 17:34:44 +08:00
王奎兴 73b1a76cb6 简易模式收货及上架; 2026-07-13 16:47:05 +08:00
王奎兴 81c30d752d 简易模式收货及上架; 2026-07-13 16:42:18 +08:00
秦鸿展 38b2de852b 同步过滤逻辑修改2 2026-07-13 16:18:53 +08:00
王奎兴 35122c0fca 简易模式收货及上架; 2026-07-13 15:17:16 +08:00
秦鸿展 f1c7dd453b 同步过滤逻辑修改1 2026-07-13 14:47:10 +08:00
秦鸿展 f1aa799809 同步过滤逻辑修改 2026-07-13 11:36:06 +08:00
秦鸿展 d5dfa96859 查询三方主数据接口修复1 2026-07-13 11:27:51 +08:00
秦鸿展 23fe5eca9c 查询三方主数据接口修复 2026-07-13 11:15:08 +08:00
赵辉 69d5276bd9 30财务 2026-07-11 20:09:21 +08:00
王奎兴 876430874c 发31 2026-07-11 19:32:17 +08:00
王奎兴 24c234bcb7 发30 2026-07-11 19:30:34 +08:00
王奎兴 c52b9f092e 发31 2026-07-11 19:21:11 +08:00
赵辉 61b68804f0 测试 2026-07-11 18:11:58 +08:00
赵辉 23bffb32b3 测试 2026-07-11 18:01:42 +08:00
秦鸿展 9f9b0867ac 客商BUG修复 2026-07-11 16:49:21 +08:00
赵辉 1a309cb042 客商修改 2026-07-11 13:58:37 +08:00
赵辉 226360ef3a 客商修改 2026-07-11 11:48:35 +08:00
王奎兴 444b6add0a 移除任务人员空指针处理; 2026-07-11 10:51:14 +08:00
王奎兴 46757ed2f1 移除任务人员空指针处理; 2026-07-11 10:39:32 +08:00
王奎兴 1548a28c9e 移除任务人员空指针处理; 2026-07-11 10:32:33 +08:00
王奎兴 2755ed1a33 出入库移交任务及移除任务项; 2026-07-10 17:08:24 +08:00
王奎兴 5030ca2a8a 出入库移交任务及移除任务项; 2026-07-10 17:06:29 +08:00
王奎兴 4852b4496a pda任务接收 2026-07-10 16:30:49 +08:00
王奎兴 e2bfb032a7 作业人员名称 2026-07-10 16:20:53 +08:00
王奎兴 762c9d4bf4 配送明细客户id值; 2026-07-10 15:57:01 +08:00
王奎兴 f4f2573af7 仓码pda改造; 2026-07-10 15:26:06 +08:00
王奎兴 1381bcee72 入库单pda查询; 2026-07-10 14:17:46 +08:00
王奎兴 bbe8ce3523 入库单pda查询; 2026-07-10 14:15:34 +08:00
王奎兴 7ae6ed2aac 出入库添加物料数量; 2026-07-10 10:42:38 +08:00
王奎兴 d45206a644 按客户预约库存分配库存; 2026-07-09 18:11:02 +08:00
王奎兴 f7faed5e44 Merge remote-tracking branch 'origin/dev' into dev 2026-07-09 16:00:24 +08:00
王奎兴 fa5f8d68cc 按客户预约库存分配库存; 2026-07-09 16:00:11 +08:00
赵辉 b0a28a101e 30 2026-07-09 15:18:12 +08:00
赵辉 b24d02f4a6 正式环境单点登录地址修改 2026-07-09 15:05:57 +08:00
赵辉 a9aba71e0c 31 2026-07-09 11:12:58 +08:00
赵辉 687404b47f 测试 2026-07-08 19:03:51 +08:00
赵辉 d4e3b36974 30 2026-07-08 18:55:34 +08:00
赵辉 162f35b752 31 2026-07-08 18:47:32 +08:00
赵辉 9cb99c915d oss单点登录 2026-07-08 18:42:53 +08:00
王奎兴 9a58a7b41c 发31 2026-07-07 14:04:44 +08:00
王奎兴 3c594d4a91 库存查询报错; 2026-07-07 13:58:17 +08:00
王奎兴 dc9d491d61 pda查询报错; 2026-07-07 10:00:09 +08:00
王奎兴 d0cde81dcd 发30 2026-07-07 09:39:17 +08:00
王奎兴 81cd4b3317 发31 2026-07-07 09:34:59 +08:00
王奎兴 442ca4977c 发31 2026-07-07 09:14:30 +08:00
王奎兴 2abdb6e8d1 发31 2026-07-07 09:09:37 +08:00
王奎兴 53e9f977a1 库存查询报错; 2026-07-07 09:08:18 +08:00
王奎兴 1dcd38aaa2 30 2026-07-06 22:50:42 +08:00
王奎兴 50b7be1e4f 回显客户预约物料名; 2026-07-06 22:42:52 +08:00
王奎兴 4ce7b3afec 回显客户预约物料名; 2026-07-06 22:00:46 +08:00
王奎兴 aeff793901 发30 2026-07-06 21:40:13 +08:00
王奎兴 187bddc820 发31 o 2026-07-06 21:35:50 +08:00
王奎兴 360cb8d95c 发30 2026-07-06 21:22:09 +08:00
王奎兴 a589cfd3af 预约单组织修改; 2026-07-06 21:19:30 +08:00
秦鸿展 f80b0bbddb 关务推送增加字段 2026-07-06 20:59:55 +08:00
王奎兴 76596ac927 预约单组织修改; 2026-07-06 20:55:09 +08:00
秦鸿展 2a33823ef2 关务推送增加字段 2026-07-06 20:45:27 +08:00
秦鸿展 930894b37e 关务推送增加字段,发测试 2026-07-06 19:56:54 +08:00
王奎兴 02acda9e23 预约单组织修改; 2026-07-06 19:01:30 +08:00
赵辉 41fa3991d9 31 2026-07-06 18:50:08 +08:00
赵辉 a221c05ec9 31 2026-07-06 18:44:02 +08:00
王奎兴 57fb245715 发测试; 2026-07-06 17:45:50 +08:00
王奎兴 79cda62fb4 发测试; 2026-07-06 17:32:48 +08:00
王奎兴 0fba417b77 Merge remote-tracking branch 'origin/dev' into dev 2026-07-06 17:23:41 +08:00
王奎兴 ed8d3fafd9 bug; 2026-07-06 17:23:23 +08:00
秦鸿展 fea9ac6277 30 2026-07-06 13:02:23 +08:00
秦鸿展 8e1cd9b185 31 2026-07-06 12:48:46 +08:00
秦鸿展 bc2fc833a2 财务结算结算币种按照组织管理来查询 2026-07-06 11:41:18 +08:00
王奎兴 196410331b 测试o 2026-07-04 01:07:56 +08:00
赵辉 9351bd8816 30 2026-07-04 00:24:31 +08:00
赵辉 429c279b78 Merge remote-tracking branch 'origin/dev' into dev 2026-07-04 00:08:36 +08:00
赵辉 4a6421c9cf 31 2026-07-04 00:08:18 +08:00
王奎兴 9e71401716 Merge remote-tracking branch 'origin/dev' into dev 2026-07-04 00:01:34 +08:00
王奎兴 fceaf38db9 测试o 2026-07-04 00:01:21 +08:00
赵辉 4a90bbd9ad user30 2026-07-03 23:50:22 +08:00
赵辉 4ced5f9b65 user30 2026-07-03 23:01:46 +08:00
赵辉 07d43b393d w30 2026-07-03 22:44:22 +08:00
王奎兴 ab0c0fdc17 测试o 2026-07-03 22:40:22 +08:00
王奎兴 0425b41cf4 Merge remote-tracking branch 'origin/dev' into dev 2026-07-03 22:37:40 +08:00
王奎兴 9e3cedb596 账单调整计算税额; 2026-07-03 22:37:29 +08:00
赵辉 5678399a34 w31 2026-07-03 22:36:59 +08:00
赵辉 dc0416510b w31 2026-07-03 22:10:48 +08:00
王奎兴 cf85ffa37f Merge remote-tracking branch 'origin/dev' into dev 2026-07-03 22:08:48 +08:00
王奎兴 7d26d7915c 账单调整计算税额; 2026-07-03 22:08:34 +08:00
赵辉 185b68bde9 w30 2026-07-03 22:07:24 +08:00
赵辉 553e0eebee bug修改 2026-07-03 22:05:37 +08:00
王奎兴 fb4c508873 新增预约单查不到; 2026-07-03 21:57:17 +08:00
王奎兴 ebfd3c3f2e 收款单同步失败 2026-07-03 21:37:50 +08:00
王奎兴 62ecfddb95 账单修改; 2026-07-03 21:04:19 +08:00
王奎兴 19696cbb6a bug修改; 2026-07-03 19:15:14 +08:00
王奎兴 40c16f17cc bug修改; 2026-07-03 19:10:27 +08:00
王奎兴 bd2170e0be Merge remote-tracking branch 'origin/dev' into dev 2026-07-03 17:49:55 +08:00
王奎兴 e4a3835ee0 bug修改; 2026-07-03 17:49:31 +08:00
赵辉 98e94682eb 30 2026-07-03 16:51:52 +08:00
赵辉 eb07b799f6 nc修改 2026-07-03 16:49:27 +08:00
赵辉 615e0d34e4 nc修改 2026-07-03 15:11:41 +08:00
王奎兴 8b66aea296 Merge remote-tracking branch 'origin/dev' into dev 2026-07-03 11:29:38 +08:00
王奎兴 eec6752b9a 物料查询历史数据; 2026-07-03 11:29:24 +08:00
秦鸿展 2907a55c96 O新增订单增加字段 2026-07-03 11:01:18 +08:00
王奎兴 08762490dd 测试 2026-07-03 09:53:37 +08:00
王奎兴 9e2d84fc5c 测试 2026-07-02 19:51:45 +08:00
王奎兴 1c2bb30c44 Merge branch 'dev' into dev_v3.0.5 2026-07-02 19:39:40 +08:00
王奎兴 268c00074f 多仓 2026-07-02 19:38:43 +08:00
赵辉 7f38da20e1 bms修改 2026-07-02 19:29:23 +08:00
王奎兴 176bdbc633 Merge branch 'dev' into dev_user0622
# Conflicts:
#	mhd_wms/src/main/resources/mapper/pickingOrder/PickingOrderMapper.xml
2026-07-02 19:09:31 +08:00
王奎兴 c2a4b981e6 Merge branch 'dev' into dev_v3.0.5 2026-07-02 19:07:55 +08:00
王奎兴 ecd5e89172 3.0.5 2026-07-02 18:32:23 +08:00
王奎兴 22ff97e045 3.0.5 2026-07-02 17:44:36 +08:00
王奎兴 afc26a798f 3.0.5 2026-07-02 17:25:09 +08:00
王奎兴 b5914940df 3.0.5 2026-07-02 16:22:49 +08:00
王奎兴 01ec70e3c2 3.0.5 2026-07-02 15:59:58 +08:00
王奎兴 b178e79c8f 3.0.5 2026-07-02 15:04:20 +08:00
王奎兴 0d70cc8b4c 入库业务单编辑报错; 2026-07-02 09:09:43 +08:00
王奎兴 55f089a7d6 入库业务单编辑报错; 2026-07-02 09:03:15 +08:00
王奎兴 b432ab0ac3 入库业务单编辑报错; 2026-07-02 08:56:55 +08:00
王奎兴 08b930e6d4 Merge branch 'dev_v3.0.4' into dev_user0622 2026-07-02 08:35:43 +08:00
赵辉 1ed10bf71b Merge remote-tracking branch 'origin/dev_user0622' into dev_user0622 2026-07-01 21:04:25 +08:00
赵辉 4772395daf 发31 2026-07-01 21:04:08 +08:00
秦鸿展 11fa915e0e 发31 2026-07-01 20:57:18 +08:00
秦鸿展 8c9ef2f083 默认用户是本组织的 2026-07-01 19:34:28 +08:00
王奎兴 193db96e63 v3.0.5 2026-07-01 18:19:03 +08:00
秦鸿展 ec43b3be8a 发30 2026-07-01 18:16:19 +08:00
秦鸿展 9511a38946 一般贸易推送添加字段 2026-07-01 15:28:30 +08:00
秦鸿展 bc962c3131 复核数量检验 2026-07-01 14:20:57 +08:00
王奎兴 4f24096a0c Merge branch 'dev' into dev_user0622 2026-07-01 13:45:20 +08:00
王奎兴 20a7978729 上架报错; 2026-07-01 11:43:32 +08:00
王奎兴 7c18ccf3bb 上架报错; 2026-07-01 11:36:59 +08:00
王奎兴 78c9ab191a 出库拣货单打印 2026-07-01 11:35:22 +08:00
王奎兴 8bec065f69 物料编辑货主查询匹配多组织信息; 2026-07-01 10:14:19 +08:00
王奎兴 d82abe15bf 业务单到执行单不分发组织; 2026-07-01 09:47:23 +08:00
王奎兴 4017c0a60d v3.0.4 2026-06-30 18:06:42 +08:00
秦鸿展 da0dae5f40 发测试包 2026-06-30 14:55:08 +08:00
秦鸿展 8b186907e1 发测试包 2026-06-29 20:05:58 +08:00
王奎兴 183c84cb5b Merge remote-tracking branch 'refs/remotes/origin/dev' into dev_user0622
# Conflicts:
#	mhd-user-center/src/main/resources/bootstrap.yml
2026-06-29 18:24:48 +08:00
王奎兴 9ca77a7d57 出库单执行生成拣货单及取消执行删除拣货单; 2026-06-29 18:04:51 +08:00
王奎兴 40ff9808b8 出库单执行生成拣货单及取消执行删除拣货单; 2026-06-29 18:02:40 +08:00
秦鸿展 4afe929020 APP菜单权限 2026-06-29 17:21:09 +08:00
秦鸿展 d982cc41c3 小程序登录同步YMS用户BUG修改1 2026-06-29 15:47:24 +08:00
秦鸿展 0497d8e96e 小程序登录同步YMS用户BUG修改 2026-06-29 15:32:48 +08:00
秦鸿展 b51bc17838 小程序登录同步YMS用户BUG修改 2026-06-29 15:27:11 +08:00
秦鸿展 2516d86226 小程序新增默认角色信息BUG修改 2026-06-29 15:04:15 +08:00
秦鸿展 287575c622 小程序新增默认角色BUG修改1 2026-06-29 14:55:33 +08:00
秦鸿展 374b26d023 小程序新增默认角色BUG修改 2026-06-29 14:34:38 +08:00
王奎兴 a5489ceb5a 新增修改库存添加组织信息; 2026-06-29 11:07:57 +08:00
王奎兴 de1ef5dec7 预约改造;pda报错; 2026-06-29 10:56:57 +08:00
秦鸿展 8be0813e21 新增角色BUG修改 2026-06-27 19:00:43 +08:00
秦鸿展 dc589fdf3f 新增角色 2026-06-27 18:17:43 +08:00
王奎兴 8f0e71fe2a 预约单改造; 2026-06-27 18:06:31 +08:00
秦鸿展 c6366ef728 司机APP注册是默认用户角色 2026-06-27 17:22:27 +08:00
秦鸿展 2d424847c3 对接微信小程序接口 2026-06-27 14:06:34 +08:00
王奎兴 8893eda62d 执行及取消执行;nc推送客户nc编码查询逻辑修改; 2026-06-26 18:27:24 +08:00
王奎兴 293fedda12 执行及取消执行; 2026-06-26 14:15:33 +08:00
王奎兴 ed4d6111a5 执行及取消执行; 2026-06-26 10:52:57 +08:00
王奎兴 92acdb4f20 货主更新角色变管理员处理; 2026-06-25 14:37:03 +08:00
王奎兴 f933aa9234 货主更新角色变管理员处理; 2026-06-25 14:35:55 +08:00
王奎兴 f704038362 根据组织ids查询仓库; 2026-06-25 11:04:58 +08:00
王奎兴 3e90a8c5c4 货主查询组织; 2026-06-25 10:36:34 +08:00
王奎兴 db198dd2a2 货主查询组织; 2026-06-25 10:28:29 +08:00
王奎兴 a6e727e04a 仓储执行单; 2026-06-24 17:45:44 +08:00
赵辉 ce8e340116 同步委托方修改 2026-06-24 16:07:56 +08:00
王奎兴 42e9f79b10 Merge branch 'dev' into dev_user0622 2026-06-24 13:58:38 +08:00
王奎兴 e966726a0c 加货主是否支持多仓;物料组织模糊查询; 2026-06-24 09:57:20 +08:00
王奎兴 89c3f398b8 加货主是否支持多仓; 2026-06-24 09:48:08 +08:00
王奎兴 84174a6639 Merge remote-tracking branch 'origin/dev' into dev_user0622 2026-06-24 09:39:56 +08:00
赵辉 0ae37ac795 信用修改 2026-06-23 14:39:05 +08:00
赵辉 a14c7776e8 信用修改 2026-06-23 14:00:32 +08:00
赵辉 41fc2d1805 修改字段 2026-06-23 11:30:30 +08:00
赵辉 7ccb06ad79 测试环境 2026-06-23 11:11:11 +08:00
赵辉 21aab4f17e 三方信用修改 2026-06-23 10:27:57 +08:00
赵辉 3224e87814 三方信用修改 2026-06-23 10:14:06 +08:00
赵辉 31247d7faa 委托方增加组织代码,与查询修改 2026-06-23 08:57:06 +08:00
318 changed files with 29627 additions and 1254 deletions
@@ -357,6 +357,10 @@ public interface SystemServiceFeign {
@GetMapping("/contractManageApi/getInfoByCustomer") @GetMapping("/contractManageApi/getInfoByCustomer")
public AjaxResult getInfoByCustomer(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType); public AjaxResult getInfoByCustomer(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType);
@ApiOperation("根据结算主体和费用科目获取合同信息")
@GetMapping(value = "/contractManageApi/getInfoByCustomerAndSecondSubjectCode")
public AjaxResult getInfoByCustomerAndSecondSubjectCode(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("firstSubjectCode") String firstSubjectCode,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId);
/** /**
* 根据结算主体获取合同信息 * 根据结算主体获取合同信息
*/ */
@@ -223,4 +223,7 @@ public interface UserServiceFeign {
@ApiOperation("查询赊销额度") @ApiOperation("查询赊销额度")
@PostMapping("/userShipperApi/querySaleCreditLimitFeign") @PostMapping("/userShipperApi/querySaleCreditLimitFeign")
public AjaxResult querySaleCreditLimitFeign(@RequestBody UserShipperFeignDTO userShipperDTO); public AjaxResult querySaleCreditLimitFeign(@RequestBody UserShipperFeignDTO userShipperDTO);
@GetMapping("/userApi/getUserByUserAccount")
R<LoginUser> getUserByUserAccount(@RequestParam("userAccount") String account);
} }
@@ -1,5 +1,6 @@
package com.mhd.system.api; package com.mhd.system.api;
import cn.hutool.json.JSONUtil;
import com.mhd.common.core.constant.ServiceNameConstants; import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.web.domain.AjaxResult; import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo; import com.mhd.common.core.web.page.TableDataInfo;
@@ -97,6 +98,18 @@ public interface WmsServiceFeign {
@PostMapping(value = "/stockInOrderApi/omsInOrderAdd") @PostMapping(value = "/stockInOrderApi/omsInOrderAdd")
public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder); public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder);
@ApiOperation("oms取消下发单保存")
@PostMapping(value = "/stockOutOrderApi/cancelExecutionOrder")
public void omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder);
@ApiOperation("oms取消下发单自动分配")
@PostMapping(value = "/stockOutOrderApi/omsAutoAssign")
public void omsAutoAssign(@RequestBody StockOutOrderDTO stockOutOrderDTO);
@ApiOperation("oms出库执行")
@PostMapping(value = "/stockOutOrderApi/execution")
public AjaxResult execution(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
/** /**
* oms下发单明细保存 * oms下发单明细保存
*/ */
@@ -121,4 +134,11 @@ public interface WmsServiceFeign {
*/ */
@GetMapping("/materialBaseInfoApi/getBatchByIds") @GetMapping("/materialBaseInfoApi/getBatchByIds")
public TableDataInfo getBatchByIds(@RequestParam("materialBaseInfoIds") List<Long> materialBaseInfoIds); public TableDataInfo getBatchByIds(@RequestParam("materialBaseInfoIds") List<Long> materialBaseInfoIds);
/**
* 生成拣货单
*/
@ApiOperation("生成拣货单")
@PostMapping("/stockOutOrderApi/genPickingOrderByOms")
public AjaxResult genPickingOrderByOms(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
} }
@@ -84,4 +84,6 @@ public class MaterialInventoryOmsParamDO extends BaseVOEntity {
//过期日期 //过期日期
private Date expiryDate; private Date expiryDate;
private String executioOrderNumber;
} }
@@ -0,0 +1,486 @@
package com.mhd.system.api.domain;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 出库单对象 stock_out_order
*
* @author gen
* @date 2024-05-28
*/
@Data
public class StockOutOrderDTO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("出库单id")
private Long outOrderId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("通知单号")
@Excel(name = "通知单号")
private String noticeNumber;
@ApiModelProperty("出库单号")
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
private Integer status;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@Excel(name = "出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
private Integer auditStatus;
@ApiModelProperty("出库单审核备注")
@Excel(name = "出库单审核备注")
private String auditRemark;
@ApiModelProperty("出库单审核人")
@Excel(name = "出库单审核人")
private Long auditBy;
@ApiModelProperty("出库单审核人姓名")
@Excel(name = "出库单审核人姓名")
private String auditByName;
@ApiModelProperty("出库单审核时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "出库单审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date auditTime;
@ApiModelProperty("仓库id")
@Excel(name = "仓库id")
private Long warehouseId;
@ApiModelProperty("仓库编码")
@Excel(name = "仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
@Excel(name = "仓库名称")
private String warehouseName;
@ApiModelProperty("货主id")
@Excel(name = "货主id")
private Long shipperId;
@ApiModelProperty("货主编码")
@Excel(name = "货主编码")
private String shipperCode;
@ApiModelProperty("货主名称")
@Excel(name = "货主名称")
private String shipperName;
@ApiModelProperty("出库单类型编码")
@Excel(name = "出库单类型编码")
private String orderTypeCode;
@ApiModelProperty("出库单类型名称")
@Excel(name = "出库单类型名称")
private String orderTypeName;
@ApiModelProperty("客户id")
@Excel(name = "客户id")
private Long customerId;
@ApiModelProperty("客户编码")
@Excel(name = "客户编码")
private String customerCode;
@ApiModelProperty("客户名称")
@Excel(name = "客户名称")
private String customerName;
@ApiModelProperty("预计出货时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "预计出货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date expectTime;
@ApiModelProperty("供应链订单号")
@Excel(name = "供应链订单号")
private String supplyChainNumber;
@ApiModelProperty("优先级别编码")
@Excel(name = "优先级别编码")
private String priorityLevelCode;
@ApiModelProperty("优先级别名称")
@Excel(name = "优先级别名称")
private String priorityLevelName;
@ApiModelProperty("是否直接出库: 1-是 2-否")
@Excel(name = "是否直接出库: 1-是 2-否")
private Integer directWarehouse;
@ApiModelProperty("是否复核: 1-是 2-否")
@Excel(name = "是否复核: 1-是 2-否")
private Integer review;
@ApiModelProperty("附件url")
@Excel(name = "附件url")
private String annexUrl;
@ApiModelProperty("物料种数")
@Excel(name = "物料种数")
private Integer materialQuantity;
@ApiModelProperty("计划数量")
@Excel(name = "计划数量")
private BigDecimal quantity;
@ApiModelProperty("净重 单位:千克")
@Excel(name = "净重 单位:千克")
private BigDecimal weightLimit;
@ApiModelProperty("体积 单位:立方米")
@Excel(name = "体积 单位:立方米")
private BigDecimal volumeLimit;
@ApiModelProperty("分配数量")
@Excel(name = "分配数量")
private BigDecimal allocationQuantity;
@ApiModelProperty("已生成拣货单数量")
@Excel(name = "已生成拣货单分配数量")
private BigDecimal alreadyAllocationQuantity;
@ApiModelProperty("拣货数量")
@Excel(name = "拣货数量")
private BigDecimal pickingQuantity;
@ApiModelProperty("复核数量")
@Excel(name = "复核数量")
private BigDecimal checkQuantity;
@ApiModelProperty("是否取消订单: 1-是 2-否")
@Excel(name = "是否取消订单: 1-是 2-否")
private Integer cancelOrder;
@ApiModelProperty("取消订单备注")
@Excel(name = "取消订单备注")
private String cancelRemark;
@ApiModelProperty("取消订单人")
@Excel(name = "取消订单人")
private Long cancelBy;
@ApiModelProperty("取消订单人姓名")
@Excel(name = "取消订单人姓名")
private String cancelByName;
@ApiModelProperty("取消订单时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cancelTime;
@ApiModelProperty("是否关闭订单: 1-是 2-否")
@Excel(name = "是否关闭订单: 1-是 2-否")
private Integer closeOrder;
@ApiModelProperty("关闭订单备注")
@Excel(name = "关闭订单备注")
private String closeRemark;
@ApiModelProperty("关闭订单人")
@Excel(name = "关闭订单人")
private Long closeBy;
@ApiModelProperty("关闭订单人姓名")
@Excel(name = "关闭订单人姓名")
private String closeByName;
@ApiModelProperty("关闭订单时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date closeTime;
@ApiModelProperty("复核状态: 1-未复核 2-复核中 3-已复核")
@Excel(name = "复核状态: 1-未复核 2-复核中 3-已复核")
private Integer checkStatus;
@ApiModelProperty("复核任务是否下发: 1-是 2-否")
@Excel(name = "复核任务是否下发: 1-是 2-否")
private Integer checkTaskDistribution;
@ApiModelProperty("复核任务下发时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "复核任务下发时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date checkTaskDistributionTime;
@ApiModelProperty("复核作业人用户ID")
@Excel(name = "复核作业人用户ID")
@JsonAlias({"checkOperatorId", "operatorId"})
private Long checkOperatorsBy;
@ApiModelProperty("复核作业人姓名")
@Excel(name = "复核作业人姓名")
private String checkOperatorsName;
@ApiModelProperty("调度单号")
@Excel(name = "调度单号")
private String mobilizeCode;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
@ApiModelProperty("出库单id集合")
private List<Long> outOrderIds;
// @ApiModelProperty("物料明细")
// private List<OutMaterialDetailDTO> materialDetailList;
@ApiModelProperty("物料条形码")
@Excel(name = "物料条形码")
private String barCode;
@ApiModelProperty("物料审核数量")
@Excel(name = "物料审核数量")
private BigDecimal actualQuantity;
@ApiModelProperty("波次类型编码")
private String waveOrderTypeCode;
@ApiModelProperty("大于复核状态: 1-未复核 2-复核中 3-已复核")
private Integer gtCheckStatus;
@ApiModelProperty("小于复核状态: 1-未复核 2-复核中 3-已复核")
private Integer ltCheckStatus;
@ApiModelProperty("PDA复核查询tab: 1-列表(待复核) 2-历史记录(已复核)")
private Integer tabType;
@ApiModelProperty("to")
@Excel(name = "to")
private String to;
@ApiModelProperty("联系人")
@Excel(name = "联系人")
private String contactPerson;
@ApiModelProperty("车型及车牌")
@Excel(name = "车型及车牌")
private String vehicleModelPlate;
@ApiModelProperty("委托编号")
@Excel(name = "委托编号")
private String entrustNo;
@ApiModelProperty("Tel")
@Excel(name = "Tel")
private String tel;
@ApiModelProperty("司机签名")
@Excel(name = "司机签名")
private String driverSign;
@ApiModelProperty("Fax")
@Excel(name = "Fax")
private String fax;
@ApiModelProperty("申报地关区")
@Excel(name = "申报地关区")
private String declareCustoms;
@ApiModelProperty("生产商")
@Excel(name = "生产商")
private String manufacturer;
@ApiModelProperty("报关员姓名及联系方式")
@Excel(name = "报关员姓名及联系方式")
private String customsDeclarerInfo;
@ApiModelProperty("送货地址")
@Excel(name = "送货地址")
private String deliveryAddr;
@ApiModelProperty("进出境关别")
@Excel(name = "进出境关别")
private String entryExitCustoms;
@ApiModelProperty("起运/运抵国(地区)")
@Excel(name = "起运/运抵国(地区)")
private String departureArrivalCountry;
@ApiModelProperty("承运商")
@Excel(name = "承运商")
private String carrier;
@ApiModelProperty("柜号")
@Excel(name = "柜号")
private String containerNo;
@ApiModelProperty("")
@Excel(name = "")
private String containerNoName;
@ApiModelProperty("出仓日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date outboundDate;
@ApiModelProperty("完成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date completeTime;
@ApiModelProperty("orderDate")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "orderDate", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date orderDate;
@ApiModelProperty("运输方式")
@Excel(name = "运输方式")
private String transportModeCode;
@ApiModelProperty("运输方式")
@Excel(name = "运输方式")
private String transportModeName;
@ApiModelProperty("监管方式")
@Excel(name = "监管方式")
private String supervisionModeCode;
@ApiModelProperty("监管方式")
@Excel(name = "监管方式")
private String supervisionModeName;
@ApiModelProperty("海关是否查验货物")
@Excel(name = "海关是否查验货物")
private String customsInspectionFlag;
@ApiModelProperty("是否需要报关")
@Excel(name = "是否需要报关")
private String needDeclareFlag;
@ApiModelProperty("是否需要运输")
@Excel(name = "是否需要运输")
private String needTransportFlag;
@ApiModelProperty(name = "创建时间查询条件开始日期")
private String createTimeStart;
@ApiModelProperty(name = "创建时间查询条件结束日期")
private String createTimeEnd;
@ApiModelProperty(name = "审核时间查询条件开始日期")
private String auditTimeStart;
@ApiModelProperty(name = "审核时间查询条件结束日期")
private String auditTimeEnd;
@ApiModelProperty("出库明细-物料名称(商品名称),模糊匹配,与前端参数 materialName 一致")
private String materialName;
@ApiModelProperty("出库明细-物料编码,模糊匹配,与前端参数 materialCode 一致")
private String materialCode;
@ApiModelProperty("出库交接图片,PDA出库交接时上传的照片,多张图片以逗号隔开")
private String pictureApp;
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String businessOrderNo;
@ApiModelProperty("业务类型")
@Excel(name = "业务类型")
private String businessType;
@ApiModelProperty("制单人")
@Excel(name = "制单人")
private String documentCreator;
@ApiModelProperty("制单人名称")
@Excel(name = "制单人名称")
private String documentCreatorName;
@ApiModelProperty("制单日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date documentDate;
@ApiModelProperty("承运商名称")
@Excel(name = "承运商名称")
private String carrierName;
@ApiModelProperty("计费信息")
private String billingJson;
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
// @ApiModelProperty("费用")
// List<ReceiptOrderAccount> receiptOrderAccountList;
@ApiModelProperty("退货数量")
@Excel(name = "退货数量")
private BigDecimal returnQuantity;
/**
* 提货单打印所选模版(与图5单选项文案一致即可)。可传副标题如「谷丰--营销部」,或整段「提货单--谷丰--营销部」;不传则标题为「提货单」
*/
@ApiModelProperty("提货单打印模版名/弹窗选项全文;后端生成 printTitle(-- 会规范为 ——)")
private String noticePrintTemplateName;
@ApiModelProperty("车次")
@Excel(name = "车次")
private Integer trainNo;
@ApiModelProperty("推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
private Integer pushStatus;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("推送时间")
private Date pushTime;
@ApiModelProperty("推送人")
private Long pushBy;
@ApiModelProperty("推送人姓名")
private String pushByName;
@ApiModelProperty(value = "推送时间起")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pushTimeFrom;
@ApiModelProperty(value = "推送时间止")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pushTimeTo;
@ApiModelProperty(value = "推送时间起")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeFrom;
@ApiModelProperty(value = "推送时间止")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeTo;
}
@@ -46,8 +46,8 @@ TmsOrderAddDTO implements Serializable {
@ApiModelProperty(value = "装货电话") @ApiModelProperty(value = "装货电话")
private String loadingPhone=""; private String loadingPhone="";
@ApiModelProperty(value = "装货时间日期(年月日)",required = true) @ApiModelProperty(value = "装货时间日期(年月日)",required = true)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date loadingDate; private java.util.Date loadingDate;
// @ApiModelProperty(value = "装货时间(上午、下午、24小时)") // @ApiModelProperty(value = "装货时间(上午、下午、24小时)")
// private String loadingTime=""; // private String loadingTime="";
@@ -116,6 +116,12 @@ public class WarehouseFeignPO extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是") @Excel(name = "是否作废: 1-否 2-是")
private Integer nullify; private Integer nullify;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
} }
@@ -284,6 +284,10 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
return AjaxResult.error("查询失败"); return AjaxResult.error("查询失败");
} }
@Override
public AjaxResult getInfoByCustomerAndSecondSubjectCode(String settlementCustomersCode, Integer contractType, String firstSubjectCode, Long topOrganizationId, Long organizationId) {
return null;
}
@Override @Override
public AjaxResult getInfoByCustomer2(String settlementCustomersCode, Integer contractType, Long topOrganizationId) { public AjaxResult getInfoByCustomer2(String settlementCustomersCode, Integer contractType, Long topOrganizationId) {
return AjaxResult.error("查询失败"); return AjaxResult.error("查询失败");
@@ -170,6 +170,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
return R.fail("获取组织用户失败:" + throwable.getMessage()); return R.fail("获取组织用户失败:" + throwable.getMessage());
} }
@Override
public R<LoginUser> getUserByUserAccount(String userAccount) {
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override @Override
public R<LoginUser> getUserByTopOrganizationUserPhone(@RequestBody UserDTO userDTO, String source) { public R<LoginUser> getUserByTopOrganizationUserPhone(@RequestBody UserDTO userDTO, String source) {
return R.fail("获取组织用户失败:" + throwable.getMessage()); return R.fail("获取组织用户失败:" + throwable.getMessage());
@@ -73,6 +73,21 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
public void omsInOrderAdd(StockInOrder stockInOrder) { public void omsInOrderAdd(StockInOrder stockInOrder) {
} }
@Override
public void omsCancelExecutionOrder(StockOutOrder stockOutOrder) {
}
@Override
public void omsAutoAssign(StockOutOrderDTO stockOutOrderDTO) {
}
@Override
public AjaxResult execution(StockOutOrderDTO stockOutOrderDTO) {
return AjaxResult.error(cause.getMessage());
}
@Override @Override
public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) { public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
} }
@@ -99,6 +114,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
tableDataInfo.setCode(500); tableDataInfo.setCode(500);
return tableDataInfo; return tableDataInfo;
} }
@Override
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
return null;
}
}; };
} }
} }
@@ -40,6 +40,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -107,11 +108,14 @@ public class TokenLoginApplicationService {
//租户一级组织ID //租户一级组织ID
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class); SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
Long topOrganizationId = sysTenantsPo.getOrganizationId(); Long topOrganizationId = sysTenantsPo.getOrganizationId();
// 获取用户选择的组织ID,未选则使用一级组织ID
Long selectedOrgId = loginDTO.getOrganizationId();
Long organizationId = (selectedOrgId != null) ? selectedOrgId : topOrganizationId;
//获取用户信息,组装dto //获取用户信息,组装dto
UserDTO userDTO = new UserDTO(); UserDTO userDTO = new UserDTO();
userDTO.setUserPhone(userPhone); userDTO.setUserPhone(userPhone);
userDTO.setTopOrganizationId(topOrganizationId); userDTO.setTopOrganizationId(topOrganizationId);
userDTO.setOrganizationId(topOrganizationId); userDTO.setOrganizationId(organizationId);
// 查询用户信息,查询组织下用户是否存在 // 查询用户信息,查询组织下用户是否存在
R<LoginUser> userResult = userServiceFeign.getUserByTopOrganizationUserPhone(userDTO, SecurityConstants.INNER); R<LoginUser> userResult = userServiceFeign.getUserByTopOrganizationUserPhone(userDTO, SecurityConstants.INNER);
if (R.FAIL == userResult.getCode()) { if (R.FAIL == userResult.getCode()) {
@@ -153,7 +157,8 @@ public class TokenLoginApplicationService {
}else { }else {
userDTO.setBusinessType(4); userDTO.setBusinessType(4);
} }
userDTO.setOrganizationName(sysTenantsPo.getOrganizationName()); userDTO.setOrganizationName(StringUtils.isNotBlank(loginDTO.getOrganizationName())
? loginDTO.getOrganizationName() : sysTenantsPo.getOrganizationName());
userResult = userServiceFeign.registerAddUser(userDTO, SecurityConstants.INNER); userResult = userServiceFeign.registerAddUser(userDTO, SecurityConstants.INNER);
userInfo = userResult.getData(); userInfo = userResult.getData();
} else { } else {
@@ -379,6 +384,10 @@ public class TokenLoginApplicationService {
throw new ServiceException("用户不存在/密码错误"); throw new ServiceException("用户不存在/密码错误");
} }
} }
// 验证码登录时 userInfo.getUserPo() 可能为null,加保护
if (userInfo == null || userInfo.getUserPo() == null || userInfo.getUserPo().getOrganizationId() == null) {
throw new ServiceException("登录用户组织信息不完整,请联系管理员");
}
R<OrganizationPo> organizationInfo = organizationServiceFeign.getInfoForIdList(userInfo.getUserPo().getOrganizationId()); R<OrganizationPo> organizationInfo = organizationServiceFeign.getInfoForIdList(userInfo.getUserPo().getOrganizationId());
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) { if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
throw new ServiceException("登录用户组织不存在"); throw new ServiceException("登录用户组织不存在");
@@ -569,4 +578,29 @@ public class TokenLoginApplicationService {
sysPasswordService.validateByWms(userPo, verificationCode, 1); sysPasswordService.validateByWms(userPo, verificationCode, 1);
return userInfo; return userInfo;
} }
/**
* 根据域名获取组织信息(免Token,供司机APP注册时选择组织用)
*/
public AjaxResult getOrganizationByPath(String path) {
if (StringUtils.isBlank(path)) {
return AjaxResult.error("域名不能为空");
}
try {
AjaxResult result = organizationServiceFeign.getOrganizationByPath(path);
if (ObjectUtil.isNull(result) || ObjectUtil.isNull(result.get("data"))) {
return AjaxResult.error("未找到对应组织");
}
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(result.get("data")), SysTenantsPo.class);
Long topOrganizationId = sysTenantsPo.getOrganizationId();
// 返回一级组织ID和名称,前端可据此展示组织选择
Map<String, Object> data = new java.util.HashMap<>();
data.put("organizationId", topOrganizationId);
data.put("organizationName", sysTenantsPo.getOrganizationName());
return AjaxResult.success(data);
} catch (Exception e) {
log.error("获取组织信息失败, path={}", path, e);
return AjaxResult.error("获取组织信息失败:" + e.getMessage());
}
}
} }
@@ -34,4 +34,10 @@ public class LoginDTO {
@ApiModelProperty(name = "APP包名") @ApiModelProperty(name = "APP包名")
private String appMark; private String appMark;
@ApiModelProperty(name = "组织ID(司机选择组织,不传默认一级组织)")
private Long organizationId;
@ApiModelProperty(name = "组织名称(司机选择组织时传入)")
private String organizationName;
} }
@@ -9,11 +9,13 @@ import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.utils.JwtUtils; import com.mhd.common.core.utils.JwtUtils;
import com.mhd.common.core.utils.StringUtils; import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.web.controller.BaseController; import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.annotation.RepeatSubmit; import com.mhd.common.security.annotation.RepeatSubmit;
import com.mhd.common.security.auth.AuthUtil; import com.mhd.common.security.auth.AuthUtil;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -75,6 +77,15 @@ public class AppTokenController extends BaseController {
return R.ok(); return R.ok();
} }
/**
* 根据域名获取组织信息(免Token,供司机APP注册时选择组织用)
*/
@ApiOperation("根据域名获取组织信息")
@GetMapping("/getOrganizationByPath/{path}")
public AjaxResult getOrganizationByPath(@PathVariable("path") String path) {
return tokenLoginApplicationService.getOrganizationByPath(path);
}
/** /**
* @Description wms 新登录接口 * @Description wms 新登录接口
@@ -0,0 +1,89 @@
package com.mhd.auth.system.controller;
import com.mhd.auth.system.service.SsoAuthorizeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
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.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
* SSO单点登录控制器
* 子系统端实现:接收中台传递的签名参数,验签后自动登录并重定向
*
* @author mhd
*/
@Slf4j
@RestController
@RequestMapping("/auth")
@CrossOrigin
public class SsoAuthorizeController {
@Autowired
private SsoAuthorizeService ssoAuthorizeService;
/**
* SSO单点登录授权接口
* 中台点击子系统链接后,将签名参数传递给此接口
* 验签通过后自动登录并重定向到前端页面,携带token
*
* @param signature 签名信息(Base64编码后再URL编码),签名源数据格式:appkey=xxx&account=xxx&timestamp=xxxxxx
* @param appkey 对方的应用key,值固定为nanguang
* @param account 账号
* @param timestamp 当前时间戳(毫秒),用于防止签名被盗用,超过24小时视为失效
*/
@GetMapping("/sso-authorize")
public void ssoAuthorize(@RequestParam("signature") String signature,
@RequestParam("appkey") String appkey,
@RequestParam("account") String account,
@RequestParam("timestamp") Long timestamp,
HttpServletResponse response) throws IOException {
log.info("SSO单点登录请求, appkey={}, account={}, timestamp={}", appkey, account, timestamp);
String redirectUrl = ssoAuthorizeService.getRedirectUrl();
try {
// 1. 校验时间戳是否超过24小时,防止签名被盗用
long ONE_DAY_MILLIS = 24L * 60 * 60 * 1000;
long currentTime = System.currentTimeMillis();
if ((currentTime - timestamp) > ONE_DAY_MILLIS) {
log.warn("SSO签名已过期, appkey={}, account={}, timestamp={}, 距今{}小时",
appkey, account, timestamp, (currentTime - timestamp) / (60 * 60 * 1000));
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:签名已超过24小时,请重新发起", StandardCharsets.UTF_8.name()));
return;
}
// 2. 构造签名源数据(包含timestamp)
String sourceData = "appkey=" + appkey + "&account=" + account + "&timestamp=" + timestamp;
// 3. 验证签名
boolean verifyResult = ssoAuthorizeService.verifySignature(sourceData, signature);
if (!verifyResult) {
log.warn("SSO验签失败, appkey={}, account={}, timestamp={}", appkey, account, timestamp);
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:签名验证不通过", StandardCharsets.UTF_8.name()));
return;
}
// 4. 验签通过,使用account进行登录,获取token
Map<String, Object> loginResult = ssoAuthorizeService.ssoLogin(account);
String accessToken = (String) loginResult.get("access_token");
// 5. 重定向到前端页面,token通过URL参数传递
// 前端页面需读取URL中的token参数并存入localStorage
log.info("SSO单点登录成功, account={}", account);
response.sendRedirect(redirectUrl + "?token=" + URLEncoder.encode(accessToken, StandardCharsets.UTF_8.name()));
} catch (Exception e) {
log.error("SSO单点登录异常, appkey={}, account={}, timestamp={}", appkey, account, timestamp, e);
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:" + e.getMessage(), StandardCharsets.UTF_8.name()));
}
}
}
@@ -0,0 +1,200 @@
package com.mhd.auth.system.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.mhd.common.core.constant.CacheConstants;
import com.mhd.common.core.constant.Constants;
import com.mhd.common.core.constant.SecurityConstants;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.domain.po.OrganizationPo;
import com.mhd.common.core.domain.po.RolePO;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.enums.UserStatus;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.ServletUtils;
import com.mhd.common.core.utils.ip.IpUtil;
import com.mhd.common.core.utils.ip.IpUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.log.service.AsyncLogService;
import com.mhd.common.security.service.TokenService;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.domain.UserDTO;
import com.mhd.system.api.domain.UserUpdateDTO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.Signature;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* SSO单点登录服务
*
* @author mhd
*/
@Slf4j
@Service
public class SsoAuthorizeService {
@Value("${sso.public-key}")
private String publicKeyStr;
@Value("https://diglog.namkwong.com.mo/main_app/sso")
private String redirectUrl;
@Resource
private UserServiceFeign userServiceFeign;
@Resource
private TokenService tokenService;
@Autowired
private AsyncLogService asyncLogService;
@Autowired
private SystemServiceFeign systemServiceFeign;
@Resource
private com.mhd.auth.app.infrastructure.feign.OrganizationServiceFeign organizationServiceFeign;
/**
* 验证RSA签名
*
* @param sourceData 签名源数据,格式:appkey=xxx&account=xxx&timestamp=xxxxxx
* @param signatureStr Base64编码的签名(可能经过URL编码)
* @return 验签结果
*/
public boolean verifySignature(String sourceData, String signatureStr) {
try {
// Spring @RequestParam 已自动完成 URL 解码,此处直接 Base64 解码即可
byte[] signatureBytes = Base64.getDecoder().decode(signatureStr);
PublicKey publicKey = generatePublicKey(publicKeyStr);
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initVerify(publicKey);
signature.update(sourceData.getBytes("UTF-8"));
return signature.verify(signatureBytes);
} catch (Exception e) {
log.error("SSO验签失败, sourceData={}, signature={}", sourceData, signatureStr, e);
return false;
}
}
/**
* 根据公钥字符串生成PublicKey对象
*/
private PublicKey generatePublicKey(String keyStr) throws Exception {
// 去除头尾标记和空白字符
String publicKeyContent = keyStr
.replace("-----BEGIN PUBLIC KEY-----", "")
.replace("-----END PUBLIC KEY-----", "")
.replaceAll("\\s+", "");
byte[] keyBytes = Base64.getDecoder().decode(publicKeyContent);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
java.security.spec.X509EncodedKeySpec keySpec = new java.security.spec.X509EncodedKeySpec(keyBytes);
return keyFactory.generatePublic(keySpec);
}
/**
* SSO登录:根据account查找用户并创建token
*
* @param account 账号
* @return 包含token等信息的Map
*/
public Map<String, Object> ssoLogin(String account) {
// 根据账号查找用户(SSO登录不区分组织,仅通过userAccount查询)
R<LoginUser> userResult = userServiceFeign.getUserByUserAccount(account);
if (R.FAIL == userResult.getCode()) {
throw new ServiceException(userResult.getMsg());
}
if (userResult.getData() == null) {
throw new ServiceException("SSO登录用户不存在:" + account);
}
LoginUser userInfo = userResult.getData();
UserPo userPo = userInfo.getUserPo();
// 校验用户状态
if (userPo == null) {
throw new ServiceException("SSO登录用户信息异常:" + account);
}
// 删除标记
if (UserStatus.DELETED.getCode().equals(String.valueOf(userPo.getDelFlag()))) {
throw new ServiceException("对不起,您的账号:" + account + " 已被删除");
}
// 用户状态
if (UserStatus.DELETED.getCode().equals(String.valueOf(userPo.getUserStatus()))) {
throw new ServiceException("对不起,您的账号:" + account + " 已停用");
}
// 获取组织信息
com.mhd.common.core.domain.entity.R<OrganizationPo> organizationInfo = organizationServiceFeign.getInfoForIdList(userPo.getOrganizationId());
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
throw new ServiceException("登录用户组织不存在");
}
userInfo.setOrganizationPo(organizationInfo.getData());
// 查询用户角色
AjaxResult roleListAjaxResult = userServiceFeign.getRoleListByUserId(userPo.getUserId());
if ("200".equals(String.valueOf(roleListAjaxResult.get("code"))) && ObjectUtil.isNotNull(roleListAjaxResult.get("data"))) {
List<RolePO> rolePOS = JSONUtil.toList(JSONUtil.toJsonStr(roleListAjaxResult.get("data")), RolePO.class);
if (rolePOS != null && !rolePOS.isEmpty()) {
userInfo.setRoleList(rolePOS.stream().map(RolePO::getRoleName).collect(Collectors.toList()));
userInfo.setRoleIdList(rolePOS.stream().map(RolePO::getRoleId).collect(Collectors.toList()));
}
}
// 更新登录信息
UserUpdateDTO userUpdateDTO = new UserUpdateDTO();
userUpdateDTO.setLastLoginTime(new Date());
userUpdateDTO.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
userUpdateDTO.setUserName(account);
userServiceFeign.updateWhenLogin(userUpdateDTO, SecurityConstants.INNER);
// 创建token
Map<String, Object> result = tokenService.createTokenApi(userInfo);
// 记录登录日志
recordLogininfor(userPo, Constants.LOGIN_SUCCESS, "SSO单点登录成功", 1);
return result;
}
/**
* 记录登录信息
*/
private void recordLogininfor(UserPo userPo, String status, String message, Integer behaviorType) {
com.mhd.system.api.domain.SysLogininforPo logininfor = new com.mhd.system.api.domain.SysLogininforPo();
logininfor.setUserAccount(userPo.getUserAccount());
logininfor.setUserName(userPo.getUserName());
logininfor.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
logininfor.setLocation(StrUtil.isNotEmpty(logininfor.getIpaddr()) ? IpUtil.getLocationSplicing(logininfor.getIpaddr()) : "");
logininfor.setBehaviorType(behaviorType);
logininfor.setMsg(message);
logininfor.setOrganizationId(userPo.getOrganizationId());
logininfor.setOrganizationName(userPo.getOrganizationName());
logininfor.setTopOrganizationId(userPo.getTopOrganizationId());
logininfor.setAccessTime(cn.hutool.core.date.DateUtil.date());
if (org.apache.commons.lang3.StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) {
logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
} else if (Constants.LOGIN_FAIL.equals(status)) {
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
}
asyncLogService.saveLogininfor(logininfor);
}
public String getRedirectUrl() {
return redirectUrl;
}
}
+20 -2
View File
@@ -14,7 +14,8 @@ spring:
discovery: discovery:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
#线上正式环境 #线上正式环境
@@ -23,8 +24,9 @@ spring:
# password: manhuoda@2023 # password: manhuoda@2023
config: config:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
server-addr: 10.102.192.30:6848
# 测试环境配置 容器名+端口号 # 测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.5:6848 # server-addr: 10.102.192.5:6848
username: nacos username: nacos
@@ -35,3 +37,19 @@ spring:
# 共享配置 # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# SSO单点登录配置
sso:
# RSA公钥(由中台openssl私钥导出)
public-key: |
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62dYkl2Nvy2wW9028dQ7
HdxFNhwEriFNzFMFq+m1jTvZWdU6e9a1iCGWTVV2fTo4PWSyhjWyzv2ZBEuanWBq
y/bfh/jOTjT/tlWvMeJZ1TV4suCbigHq5TGxDsY6ZC6if9ULhU3NWkgnPNn6HfO9
NVvBTfx9MgWtCtT33kq30KgxC6LqVdCe08+gD0KB3df0DK8OJorVFfxYVc7TjGEL
xqUuE7PcgZgDb8KvdgO66OxBqFIB0qfc73oALKGoq/8kvjrqE/amaIZPv3jE2Rc7
0rIhGHrFcoA3W01nNRGQKY/E/VKOGBn/uDNdi5iMXsFjKxiBbXB07bBxdhUH7698
AwIDAQAB
-----END PUBLIC KEY-----
# SSO登录成功后跳转的前端页面地址
redirect-url: "/"
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone; package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -17,6 +18,7 @@ import java.util.List;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel("BI-港澳服务专区") @ApiModel("BI-港澳服务专区")
public class HkMacaoServiceZoneVO { public class HkMacaoServiceZoneVO {
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone; package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -11,6 +12,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel("BI-港澳服务专区-地图点位") @ApiModel("BI-港澳服务专区-地图点位")
public class HkMapPointVO { public class HkMapPointVO {
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone; package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -38,4 +39,24 @@ public class HkVehicleDetailsVO {
@JsonProperty("update_time") @JsonProperty("update_time")
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
private String updateTime; private String updateTime;
@ApiModelProperty("状态")
private String status;
@ApiModelProperty("运输方向")
private String direction;
@ApiModelProperty("货物类型")
private String cargo;
@ApiModelProperty("预计到达时间")
private String eta;
@JsonProperty("transportion_number")
@ApiModelProperty("运单号")
private String transportionNumber;
@JsonProperty("cargo_source")
@ApiModelProperty("货源")
private String cargoSource;
} }
@@ -32,8 +32,8 @@ public class TmsAddressMultiDTO {
@ApiModelProperty(value = "装卸货联系人电话") @ApiModelProperty(value = "装卸货联系人电话")
private String contactPhone; private String contactPhone;
@ApiModelProperty(value = "装卸货日期(年月日)") @ApiModelProperty(value = "装卸货日期(年月日)")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date layDate; private Date layDate;
@ApiModelProperty(value = "装卸货时间(上午、下午、24小时)") @ApiModelProperty(value = "装卸货时间(上午、下午、24小时)")
private String layTime; private String layTime;
@@ -271,4 +271,8 @@ public class UserShipperPo {
@ApiModelProperty("货主code") @ApiModelProperty("货主code")
private String roleCodeShipper; private String roleCodeShipper;
@ApiModelProperty(name = "是否校验信用")
private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
} }
@@ -46,6 +46,9 @@ public class MdmMerchantRecordDTO implements Serializable {
@ApiModelProperty("电子邮件") @ApiModelProperty("电子邮件")
private String desc16; private String desc16;
@ApiModelProperty("nc编码")
private String desc17;
@ApiModelProperty("身份证号") @ApiModelProperty("身份证号")
private String desc23; private String desc23;
@@ -95,21 +95,12 @@ public final class MdmMerchantSyncFilter {
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode, public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode,
Long syncOrganizationId, Long topOrganizationId) { Long syncOrganizationId, Long topOrganizationId) {
if (record == null || StringUtils.isEmpty(record.getCode())) { if (StringUtils.isEmpty(trim(record.getDesc17()))) {
return SkipReason.EMPTY_CODE; return SkipReason.EMPTY_CODE;
} }
if (!isCustomer(record)) {
return SkipReason.NOT_CUSTOMER;
}
if (StringUtils.isNotEmpty(orgNcCode) && !orgNcCode.equals(trim(record.getCode()))) {
return SkipReason.ORG_MISMATCH;
}
if (StringUtils.isEmpty(trim(record.getDesc1()))) { if (StringUtils.isEmpty(trim(record.getDesc1()))) {
return SkipReason.MISSING_NAME; return SkipReason.MISSING_NAME;
} }
if (isDisabled(record)) {
return SkipReason.DISABLED;
}
return null; return null;
} }
@@ -191,6 +191,7 @@ public class AuthFilter implements GlobalFilter, Ordered
/** /**
* 获取请求token * 获取请求token
* 优先从 Authorization 请求头获取,其次从 URL 参数 token 获取(SSO场景)
*/ */
private String getToken(ServerHttpRequest request) private String getToken(ServerHttpRequest request)
{ {
@@ -200,6 +201,11 @@ public class AuthFilter implements GlobalFilter, Ordered
{ {
token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY);
} }
// 兜底:从URL参数中获取token(SSO单点登录场景,前端尚未存入localStorage时)
if (StringUtils.isEmpty(token))
{
token = request.getQueryParams().getFirst("token");
}
return token; return token;
} }
+8 -8
View File
@@ -13,24 +13,24 @@ spring:
cloud: cloud:
nacos: nacos:
discovery: discovery:
# server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.31:6848 # server-addr: 10.102.192.31:6848
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
#线上正式环境 #线上正式环境
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848 # server-addr: 10.102.192.31:6848
username: nacos # username: nacos
password: manhuoda@2023 # password: manhuoda@2023
config: config:
# server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
#线上正式环境 #线上正式环境
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848 # server-addr: 10.102.192.31:6848
username: nacos # username: nacos
password: manhuoda@2023 # password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties file-extension: yml #默认properties
# 共享配置 # 共享配置
@@ -268,12 +268,25 @@ public class ContractManageApplicationService {
Long organizationId = contractManageDTO.getOrganizationId(); Long organizationId = contractManageDTO.getOrganizationId();
String sunjectCode = contractManageDTO.getSubjectCode(); String sunjectCode = contractManageDTO.getSubjectCode();
Long topOrganizationId = contractManageDTO.getTopOrganizationId(); Long topOrganizationId = contractManageDTO.getTopOrganizationId();
List<ContractManage> UserContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>() ContractManageDO contractManageDO = new ContractManageDO();
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId) contractManageDO.setOrganizationId(organizationId);
.eq(ContractManage::getDelFlag, 1) contractManageDO.setSettlementCustomersId(settlementCustomersId);
.eq(ContractManage::getOrganizationId, organizationId) contractManageDO.setTopOrganizationId(topOrganizationId);
.eq(ContractManage::getTopOrganizationId, topOrganizationId) contractManageDO.setCommonContractFlag(2);
.eq(ContractManage::getCommonContractFlag, 2)); contractManageDO.setDelFlag(1);
contractManageDO.setFirstSubjectCode(sunjectCode);
List<ContractManagePO> contractManagePOS = contractManageMapper.queryList(contractManageDO);
if (contractManagePOS != null && contractManagePOS.size() > 1) {
throw new RuntimeException("同一费用科目存在多条合同,请检查");
}
List<ContractManage> UserContractManages = new ArrayList<>();
if (contractManagePOS != null) {
for (ContractManagePO po : contractManagePOS) {
ContractManage contractManage = new ContractManage();
BeanUtils.copyProperties(po, contractManage);
UserContractManages.add(contractManage);
}
}
if (UserContractManages != null && UserContractManages.size() > 0) { if (UserContractManages != null && UserContractManages.size() > 0) {
//用户合同计费策略 //用户合同计费策略
calucateSubjectAndPriceStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result); calucateSubjectAndPriceStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result);
@@ -595,7 +608,8 @@ public class ContractManageApplicationService {
通用合同:同一时间段、同一合同类型,只能存在一个 通用合同:同一时间段、同一合同类型,只能存在一个
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个 特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
*/ */
checkContract(contractManageDO); //20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
handleData(contractManageDO); handleData(contractManageDO);
handleDict(contractManageDO); handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT")); contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
@@ -603,7 +617,7 @@ public class ContractManageApplicationService {
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO); boolean flag = contractManageDomainService.insert(contractManageDO);
handleDetils(contractManageDO); handleDetils(contractManageDO, true);
return flag; return flag;
} }
@@ -737,7 +751,7 @@ public class ContractManageApplicationService {
/** /**
* 处理合同详情 * 处理合同详情
*/ */
private void handleDetils(ContractManageDO contractManageDO) { private void handleDetils(ContractManageDO contractManageDO, boolean isInsert) {
//获取当前登录人信息 //获取当前登录人信息
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) { if (ObjectUtil.isNull(loginUser)) {
@@ -745,6 +759,10 @@ public class ContractManageApplicationService {
} }
//根据合同编码查询保存合同信息 //根据合同编码查询保存合同信息
ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode1(contractManageDO.getOriginalContractNumber()); ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode1(contractManageDO.getOriginalContractNumber());
//修改时,不管前端是否传明细,都需要先删除该合同原有的明细,避免明细为空时老明细仍在
if (!isInsert) {
contractManageDetailMapper.delete(new LambdaQueryWrapper<ContractManageDetail>().eq(ContractManageDetail::getContractManageId, contractManageDO.getContractManageId()));
}
//保存合同详情科目 //保存合同详情科目
List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList(); List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList();
if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){ if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){
@@ -813,10 +831,13 @@ public class ContractManageApplicationService {
} }
} }
if(null != contractManagePO){ if (isInsert) {
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId()); // 新增/复制时使用新插入的合同ID
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
} else {
// 修改时使用当前正在修改的合同ID,不能用 getInfoByCode1 查到的(避免多条合同 originalContractNumber 相同导致明细错绑)
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
} }
//contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); contractManageDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
@@ -831,9 +852,9 @@ public class ContractManageApplicationService {
@Transactional @Transactional
public Boolean update(ContractManageDO contractManageDO) { public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType()); validateContractType(contractManageDO.getContractType());
checkContract(contractManageDO); //checkContract(contractManageDO);
handleData(contractManageDO); handleData(contractManageDO);
handleDetils(contractManageDO); handleDetils(contractManageDO, false);
handleDict(contractManageDO); handleDict(contractManageDO);
return contractManageDomainService.update(contractManageDO); return contractManageDomainService.update(contractManageDO);
} }
@@ -935,6 +956,79 @@ public class ContractManageApplicationService {
return resultContract; return resultContract;
} }
public ContractManagePO getInfoByCustomerAndSecondSubjectCode(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId,String firstSubjectCode) {
/*
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser) && topOrganizationId == null) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
if(contractType==null){
throw new ServiceException("合同类型不能为空");
}
ContractManagePO resultContract = new ContractManagePO();
//查询当前日期在有效期内的合同
ContractManageDO queryParam = new ContractManageDO();
queryParam.setNowDateString(DateUtil.format(new Date(),"yyyy-MM-dd"));
queryParam.setFirstSubjectCode(firstSubjectCode);
queryParam.setOrganizationId(organizationId);
queryParam.setTopOrganizationId(topOrganizationId);
List<ContractManagePO> contractManagePOList = contractManageDomainService.queryList(queryParam);
List<ContractManagePO> contractManagePOs = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode)
&& Objects.equals(item.getContractType(), contractType))
.collect(Collectors.toList());
if (contractManagePOs != null && contractManagePOs.size() > 1) {
resultContract.setIsMany("1");
return resultContract;
}
if(contractManagePOList != null && contractManagePOList.size()>0){
if(StringUtils.isNotEmpty(settlementCustomersCode)){
//根据结算对象,及合同的类型 查询对应合同信息
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
resultContract = findGeneralContract(contractManagePOList, contractType);
}else {
resultContract = contractManagePO;
}
}else {
resultContract = findGeneralContract(contractManagePOList, contractType);
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
}
//得到合同后,查询合同明细
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(resultContract.getContractManageId());
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
//将临时合同中没有,但是通用合同中有的数据过滤出(使用 ObjectUtil.equal 避免 firstSubjectCode/secondSubjectCode 为 null 时 NPE
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().noneMatch(item1 -> ObjectUtil.equal(item1.getFirstSubjectCode(), item.getFirstSubjectCode()) && ObjectUtil.equal(item1.getSecondSubjectCode(), item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
//首先根据结算科目类型将临时合同过滤出
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
if(ObjectUtil.equal(contractManageDetailPO.getFirstSubjectCode(), manageDetailPO.getFirstSubjectCode()) && ObjectUtil.equal(contractManageDetailPO.getSecondSubjectCode(), manageDetailPO.getSecondSubjectCode())){
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
DateTime now = DateUtil.beginOfDay(DateUtil.date());
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
contractManageDetailSaveList.add(manageDetailPO);
}
}
}
}
}
resultContract.setContractManageDetailPOList(contractManageDetailSaveList);
}
return resultContract;
}
/** /**
* 根据结算主体获取合同信息 * 根据结算主体获取合同信息
* @param settlementCustomersCode 结算主体code * @param settlementCustomersCode 结算主体code
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.mhd.common.core.utils.StringUtils; import com.mhd.common.core.utils.StringUtils;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -98,6 +99,13 @@ public class WarehouseApplicationService {
} }
} }
} }
String orgIds = warehouseDO.getOrgIds();
if (StringUtils.isNotEmpty(orgIds)) {
String[] orgIdArray = orgIds.split(",");
List<Long> orgIdList = Arrays.stream(orgIdArray).map(Long::valueOf).collect(Collectors.toList());
warehouseDO.setOrgIdList(orgIdList);
warehouseDO.setOrganizationId(null);
}
return warehouseDomainService.queryList(warehouseDO); return warehouseDomainService.queryList(warehouseDO);
} }
@@ -23,7 +23,7 @@ public interface IContractManageService extends IService<ContractManage>
/** /**
* 新增合同管理 * 新增合同管理
*/ */
public Boolean insert(ContractManageDO contractManageDO); public Long insert(ContractManageDO contractManageDO);
/** /**
* 修改合同管理 * 修改合同管理
@@ -37,10 +37,11 @@ public class ContractManageImpl extends ServiceImpl<ContractManageMapper, Contra
* 新增合同管理 * 新增合同管理
*/ */
@Override @Override
public Boolean insert(ContractManageDO contractManageDO) { public Long insert(ContractManageDO contractManageDO) {
ContractManage contractManage = new ContractManage(); ContractManage contractManage = new ContractManage();
BeanUtils.copyProperties(contractManageDO,contractManage); BeanUtils.copyProperties(contractManageDO,contractManage);
return this.save(contractManage); this.save(contractManage);
return contractManage.getContractManageId();
} }
/** /**
@@ -183,5 +183,5 @@ public class ContractManagePO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)") @ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts; private Integer transportationCosts;
private String isMany;
} }
@@ -214,4 +214,6 @@ public class ContractManageDO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)") @ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts; private Integer transportationCosts;
@ApiModelProperty("一级费用科目code")
private String firstSubjectCode;
} }
@@ -60,8 +60,9 @@ public class ContractManageDomainService {
* 新增合同管理 * 新增合同管理
*/ */
public Boolean insert(ContractManageDO contractManageDO) { public Boolean insert(ContractManageDO contractManageDO) {
Long contractManageId = contractManageService.insert(contractManageDO);
return contractManageService.insert(contractManageDO); contractManageDO.setContractManageId(contractManageId);
return true;
} }
/** /**
@@ -148,6 +149,7 @@ public class ContractManageDomainService {
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ContractManage::getOriginalContractNumber,contractNumber); queryWrapper.eq(ContractManage::getOriginalContractNumber,contractNumber);
queryWrapper.eq(ContractManage::getDelFlag,1); queryWrapper.eq(ContractManage::getDelFlag,1);
queryWrapper.last("LIMIT 1");
ContractManage contractManage = contractManageService.getOne(queryWrapper); ContractManage contractManage = contractManageService.getOne(queryWrapper);
if(null != contractManage){ if(null != contractManage){
BeanUtils.copyProperties(contractManage,contractManagePO); BeanUtils.copyProperties(contractManage,contractManagePO);
@@ -165,6 +165,8 @@ public class StorageLocation extends BaseVOEntity{
@ApiModelProperty("是否作废: 1-否 2-是") @ApiModelProperty("是否作废: 1-否 2-是")
@Excel(name = "是否作废: 1-否 2-是") @Excel(name = "是否作废: 1-否 2-是")
private Integer nullify; private Integer nullify;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
} }
@@ -165,6 +165,8 @@ public class StorageLocationPO extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是") @Excel(name = "是否作废: 1-否 2-是")
private Integer nullify; private Integer nullify;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
} }
@@ -204,4 +204,8 @@ public class StorageLocationDO extends BaseVOEntity{
@ApiModelProperty("坐标-层 终止") @ApiModelProperty("坐标-层 终止")
@Excel(name = "坐标-层 终止") @Excel(name = "坐标-层 终止")
private String coordinateLayerEnd; private String coordinateLayerEnd;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
} }
@@ -68,6 +68,20 @@ public class StorageSectionDomainService {
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null); storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null);
//设置仓库 //设置仓库
setWarehouseInfo(storageSectionDO); setWarehouseInfo(storageSectionDO);
String storageCode = storageSectionDO.getStorageCode();
String storageName = storageSectionDO.getStorageName();
Long warehouseId = storageSectionDO.getWarehouseId();
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageCode, storageCode)
.eq(StorageSection::getWarehouseId, warehouseId)
.eq(StorageSection::getDelFlag, 1));
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageName, storageName)
.eq(StorageSection::getWarehouseId, warehouseId)
.eq(StorageSection::getDelFlag, 1));
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
throw new ServiceException("库区编码或名称已存在");
}
return storageSectionService.insert(storageSectionDO); return storageSectionService.insert(storageSectionDO);
} }
@@ -86,6 +100,22 @@ public class StorageSectionDomainService {
storageSectionDO.getStorageSectionId()); storageSectionDO.getStorageSectionId());
//设置仓库 //设置仓库
setWarehouseInfo(storageSectionDO); setWarehouseInfo(storageSectionDO);
String storageCode = storageSectionDO.getStorageCode();
String storageName = storageSectionDO.getStorageName();
Long warehouseId = storageSectionDO.getWarehouseId();
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageCode, storageCode)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageName, storageName)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
throw new ServiceException("库区编码或名称已存在");
}
return storageSectionService.update(storageSectionDO); return storageSectionService.update(storageSectionDO);
} }
@@ -122,5 +122,12 @@ public class Warehouse extends BaseVOEntity{
@Excel(name = "是否启用: 1-否 2-是") @Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable; private Integer isEnable;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
} }
@@ -124,5 +124,11 @@ public class WarehousePO extends BaseVOEntity{
private Integer isEnable; private Integer isEnable;
@ApiModelProperty("库区集合") @ApiModelProperty("库区集合")
private List<StorageSectionPO> storageSectionList; private List<StorageSectionPO> storageSectionList;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
} }
@@ -127,4 +127,16 @@ public class WarehouseDO extends BaseVOEntity{
private Integer isEnable; private Integer isEnable;
@ApiModelProperty("仓库id 集合") @ApiModelProperty("仓库id 集合")
private List<Long> warehouseIds; private List<Long> warehouseIds;
@ApiModelProperty("组织id 集合")
private String orgIds;
@ApiModelProperty("组织id 集合")
private List<Long> orgIdList;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
} }
@@ -212,6 +212,10 @@ public class StorageLocationDTO extends BaseVOEntity{
@Excel(name = "坐标-层 终止") @Excel(name = "坐标-层 终止")
private String coordinateLayerEnd; private String coordinateLayerEnd;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
public interface Edit {} public interface Edit {}
public interface BatchInsert {} public interface BatchInsert {}
@@ -132,4 +132,16 @@ public class WarehouseDTO extends BaseVOEntity{
@ApiModelProperty("是否启用: 1-否 2-是") @ApiModelProperty("是否启用: 1-否 2-是")
@Excel(name = "是否启用: 1-否 2-是") @Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable; private Integer isEnable;
@ApiModelProperty("组织id 集合")
private String orgIds;
@ApiModelProperty("组织id 集合")
private List<Long> orgIdList;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
} }
@@ -160,6 +160,13 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(contractManageApplicationService.getInfoByCustomer(settlementCustomersCode,contractType,null)); return AjaxResult.success(contractManageApplicationService.getInfoByCustomer(settlementCustomersCode,contractType,null));
} }
@ApiOperation("根据结算主体和费用科目获取合同信息")
@GetMapping(value = "/getInfoByCustomerAndSecondSubjectCode")
public AjaxResult getInfoByCustomerAndSecondSubjectCode(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("firstSubjectCode") String firstSubjectCode,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId)
{
return AjaxResult.success(contractManageApplicationService.getInfoByCustomerAndSecondSubjectCode(settlementCustomersCode,contractType,topOrganizationId,organizationId,firstSubjectCode));
}
@ApiOperation("根据结算主体获取合同信息") @ApiOperation("根据结算主体获取合同信息")
@GetMapping(value = "/getInfoByCustomer2") @GetMapping(value = "/getInfoByCustomer2")
public AjaxResult getInfoByCustomer2(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId) public AjaxResult getInfoByCustomer2(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId)
@@ -14,18 +14,18 @@ spring:
nacos: nacos:
discovery: discovery:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.30:6848 server-addr: 10.102.192.31:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
#线上正式环境 #线上正式环境
# server-addr: 10.102.192.105:6848 # server-addr: 10.102.192.105:6848
config: config:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.30:6848 server-addr: 10.102.192.31:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
#线上正式环境 #线上正式环境
@@ -6,11 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectContractManagePo"> <sql id="selectContractManagePo">
select SELECT DISTINCT a.*
* FROM CONTRACT_MANAGE a
from contract_manage left JOIN CONTRACT_MANAGE_DETAIL b
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
where where
del_flag = 1 a.del_flag = 1
</sql> </sql>
<sql id="selectContractManagePo1"> <sql id="selectContractManagePo1">
@@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and contract_state = #{contractState} and contract_state = #{contractState}
</if> </if>
<if test="signingUnit != null and signingUnit != ''"> <if test="signingUnit != null and signingUnit != ''">
and signing_unit = #{signingUnit} and asigning_unit = #{signingUnit}
</if> </if>
<if test="settlementCustomers != null and settlementCustomers != ''"> <if test="settlementCustomers != null and settlementCustomers != ''">
and settlement_customers = #{settlementCustomers} and settlement_customers = #{settlementCustomers}
@@ -108,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="theyOperatorPhone != null and theyOperatorPhone != ''"> <if test="theyOperatorPhone != null and theyOperatorPhone != ''">
and they_operator_phone = #{theyOperatorPhone} and they_operator_phone = #{theyOperatorPhone}
</if> </if>
</where> </where>
</sql> </sql>
@@ -132,72 +134,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="common_where"> <sql id="common_where">
<if test="contractManageDO.contractNumber != null and contractManageDO.contractNumber != ''"> <if test="contractManageDO.contractNumber != null and contractManageDO.contractNumber != ''">
and contract_number like concat('%', #{contractManageDO.contractNumber}, '%') and a.contract_number like concat('%', #{contractManageDO.contractNumber}, '%')
</if> </if>
<if test="contractManageDO.originalContractNumber != null and contractManageDO.originalContractNumber != ''"> <if test="contractManageDO.originalContractNumber != null and contractManageDO.originalContractNumber != ''">
and original_contract_number like concat('%', #{contractManageDO.originalContractNumber}, '%') and a.original_contract_number like concat('%', #{contractManageDO.originalContractNumber}, '%')
</if> </if>
<if test="contractManageDO.commonContractFlag != null"> <if test="contractManageDO.commonContractFlag != null">
and common_contract_flag = #{contractManageDO.commonContractFlag} and a.common_contract_flag = #{contractManageDO.commonContractFlag}
</if> </if>
<if test="contractManageDO.contractType != null"> <if test="contractManageDO.contractType != null">
and contract_type = #{contractManageDO.contractType} and a.contract_type = #{contractManageDO.contractType}
</if> </if>
<if test="contractManageDO.settlementCustomers != null and contractManageDO.settlementCustomers != '' " > <if test="contractManageDO.settlementCustomers != null and contractManageDO.settlementCustomers != '' " >
and settlement_customers like concat('%', #{contractManageDO.settlementCustomers}, '%') and a.settlement_customers like concat('%', #{contractManageDO.settlementCustomers}, '%')
</if> </if>
<if test="contractManageDO.settlementCustomersCode != null"> <if test="contractManageDO.settlementCustomersCode != null">
and settlement_customers_code = #{contractManageDO.settlementCustomersCode} and a.settlement_customers_code = #{contractManageDO.settlementCustomersCode}
</if> </if>
<if test="contractManageDO.signingUnit != null and contractManageDO.signingUnit != ''"> <if test="contractManageDO.signingUnit != null and contractManageDO.signingUnit != ''">
and signing_unit like concat('%', #{contractManageDO.signingUnit}, '%') and a.signing_unit like concat('%', #{contractManageDO.signingUnit}, '%')
</if> </if>
<if test="contractManageDO.contractName != null and contractManageDO.contractName != ''"> <if test="contractManageDO.contractName != null and contractManageDO.contractName != ''">
and contract_name like concat('%', #{contractManageDO.contractName}, '%') and a.contract_name like concat('%', #{contractManageDO.contractName}, '%')
</if> </if>
<if test="contractManageDO.contractState != null"> <if test="contractManageDO.contractState != null">
and contract_state = #{contractManageDO.contractState} and a.contract_state = #{contractManageDO.contractState}
</if> </if>
<if test="contractManageDO.signingDateStart != null and contractManageDO.signingDateStart != ''"> <if test="contractManageDO.signingDateStart != null and contractManageDO.signingDateStart != ''">
AND date_format(signing_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.signingDateStart} AND date_format(a.signing_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.signingDateStart}
</if> </if>
<if test="contractManageDO.signingDateEnd != null and contractManageDO.signingDateEnd != ''"> <if test="contractManageDO.signingDateEnd != null and contractManageDO.signingDateEnd != ''">
AND date_format(signing_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.signingDateEnd} AND date_format(a.signing_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.signingDateEnd}
</if> </if>
<if test="contractManageDO.effectiveDateStart != null and contractManageDO.effectiveDateStart != ''"> <if test="contractManageDO.effectiveDateStart != null and contractManageDO.effectiveDateStart != ''">
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateStart} AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateStart}
</if> </if>
<if test="contractManageDO.effectiveDateEnd != null and contractManageDO.effectiveDateEnd != ''"> <if test="contractManageDO.effectiveDateEnd != null and contractManageDO.effectiveDateEnd != ''">
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.effectiveDateEnd} AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.effectiveDateEnd}
</if> </if>
<if test="contractManageDO.expirationDateStart != null and contractManageDO.expirationDateStart != ''"> <if test="contractManageDO.expirationDateStart != null and contractManageDO.expirationDateStart != ''">
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.expirationDateStart} AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.expirationDateStart}
</if> </if>
<if test="contractManageDO.expirationDateEnd != null and contractManageDO.expirationDateEnd != ''"> <if test="contractManageDO.expirationDateEnd != null and contractManageDO.expirationDateEnd != ''">
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateEnd} AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateEnd}
</if> </if>
<!-- 时间段重叠判断:只有当已有合同与传入的有效期真正有交集时才算冲突 <!-- 时间段重叠判断:只有当已有合同与传入的有效期真正有交集时才算冲突
条件:已有合同开始日期 <= 新合同结束日期 且 已有合同结束日期 >= 新合同开始日期 --> 条件:已有合同开始日期 <= 新合同结束日期 且 已有合同结束日期 >= 新合同开始日期 -->
<if test="contractManageDO.effectiveDateString != null and contractManageDO.effectiveDateString != '' <if test="contractManageDO.effectiveDateString != null and contractManageDO.effectiveDateString != ''
and contractManageDO.expirationDateString != null and contractManageDO.expirationDateString != ''"> and contractManageDO.expirationDateString != null and contractManageDO.expirationDateString != ''">
AND ( AND (
date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString} date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString}
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString} AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString}
) )
</if> </if>
<if test="contractManageDO.nowDateString != null and contractManageDO.nowDateString != ''"> <if test="contractManageDO.nowDateString != null and contractManageDO.nowDateString != ''">
AND ( AND (
date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString} date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString}
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString} AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
) )
</if> </if>
<if test="contractManageDO.organizationId != null"> <if test="contractManageDO.organizationId != null">
and organization_id = #{contractManageDO.organizationId} and a.organization_id = #{contractManageDO.organizationId}
</if> </if>
<if test="contractManageDO.topOrganizationId != null"> <if test="contractManageDO.topOrganizationId != null">
and top_organization_id = #{contractManageDO.topOrganizationId} and a.top_organization_id = #{contractManageDO.topOrganizationId}
</if>
<if test="contractManageDO.firstSubjectCode != null and contractManageDO.firstSubjectCode != ''">
and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode}
</if> </if>
</sql> </sql>
@@ -107,7 +107,10 @@
<select id="selectCostSubject" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO" <select id="selectCostSubject" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO"
resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO"> resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO">
select select
a.* a.* ,
b.tax_rate,
b.service_items_name,
b.service_items_code
from expense_account a left join service_items_manage b ON a.service_items_manage_id = b.service_items_manage_id from expense_account a left join service_items_manage b ON a.service_items_manage_id = b.service_items_manage_id
where where
a.del_flag = 1 a.del_flag = 1
@@ -118,13 +121,17 @@
<select id="selectAllCostSubject" <select id="selectAllCostSubject"
resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO"> resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO">
select select
* a.* ,
from expense_account b.tax_rate,
b.service_items_name,
b.service_items_code
from expense_account a
left join service_items_manage b ON a.service_items_manage_id = b.service_items_manage_id
where where
del_flag = 1 a.del_flag = 1
and status = 1 and a.status = 1
and first_subject_flag = 2 and a.first_subject_flag = 2
and upper_subject_code = #{subjectCode} and a.upper_subject_code = #{subjectCode}
</select> </select>
<select id="getInfoByCode" resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO"> <select id="getInfoByCode" resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO">
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" /> <result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="locationBarCode" column="LOCATION_BAR_CODE" />
</resultMap> </resultMap>
@@ -58,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.storage_location_classify, a.storage_location_classify_name, a.storage_location_type, a.storage_location_type_name, a.storage_location_classify, a.storage_location_classify_name, a.storage_location_type, a.storage_location_type_name,
a.mixing_strategy, a.mixing_strategy_name, a.storage_location_group_id, a.storage_location_group_code, a.storage_location_group_name, a.mixing_strategy, a.mixing_strategy_name, a.storage_location_group_id, a.storage_location_group_code, a.storage_location_group_name,
a.weight_limit, a.volume_limit, a.location_size, a.location_length, a.location_width, a.location_height, a.weight_limit, a.volume_limit, a.location_size, a.location_length, a.location_width, a.location_height,
a.coordinate, a.coordinate_area, a.coordinate_column, a.coordinate_row, a.coordinate_layer, a.remark, a.coordinate, a.coordinate_area, a.coordinate_column, a.coordinate_row, a.coordinate_layer, a.remark, a.LOCATION_BAR_CODE,
a.opening_up, a.nullify, a.status, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag a.opening_up, a.nullify, a.status, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
from storage_location a from storage_location a
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1 LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
@@ -37,11 +37,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateByName" column="update_by_name" /> <result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="isEnable" column="IS_ENABLE" /> <result property="isEnable" column="IS_ENABLE" />
<result property="workMode" column="WORK_MODE" />
<result property="taskMode" column="TASK_MODE" />
</resultMap> </resultMap>
<sql id="selectWarehousePo"> <sql id="selectWarehousePo">
select warehouse_id, organization_id, organization_name, top_organization_id, warehouse_code, warehouse_name, warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name, director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region, usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, IS_ENABLE from warehouse select warehouse_id, organization_id, organization_name, top_organization_id, warehouse_code, warehouse_name,
warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name,
director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region,
usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by,
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE
from warehouse
</sql> </sql>
<sql id="selectWarehousePo1"> <sql id="selectWarehousePo1">
@@ -130,6 +137,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="orgIdList != null and orgIdList.size > 0 ">
and organization_id in
<foreach collection="orgIdList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose> <choose>
<when test="delFlag != null"> and del_flag = #{delFlag} </when> <when test="delFlag != null"> and del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise> <otherwise> and del_flag = 1 </otherwise>
@@ -21,7 +21,7 @@ public class AsyncUserShipperMasterDataSyncService {
@Resource @Resource
private RedisLock redisLock; private RedisLock redisLock;
@Async @Async("taskScheduler")
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) { public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
Long organizationId = loginUser.getUserPo().getOrganizationId(); Long organizationId = loginUser.getUserPo().getOrganizationId();
try { try {
@@ -1860,25 +1860,64 @@ public class UserApplicationService {
userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4)); userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4));
} }
UserEntity userEntity = userDomainService.addUser(userDO); UserEntity userEntity = userDomainService.addUser(userDO);
//同步网货平台员工信息 //给小程序注册用户分配默认普通用户角色must本组织没有则找上级
wlhyDomainService.addOrEditPlatformUser1(userEntity); userEntity.setUserPassword("Aa123456"); // 三方同步需要密码
//同步商城用户 try {
userMallDomainService.syncDriverUserInfo(userEntity); RoleDo mustRoleDo = new RoleDo();
//给用户分配默认普通角色权限 mustRoleDo.setRoleCode(RoleEnum.MUST.getCode());
RoleDo roleDo = new RoleDo(); mustRoleDo.setOrganizationId(userEntity.getOrganizationId());
roleDo.setRoleCode(RoleEnum.DRIVER.getCode()); RoleEntity mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
roleDo.setOrganizationId(userEntity.getOrganizationId()); // 本组织没有找上级组织
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo); if (null == mustRoleEntity && userEntity.getTopOrganizationId() != null
if (null != roleEntity) { && !userEntity.getTopOrganizationId().equals(userEntity.getOrganizationId())) {
UserRoleDo userRoleDo = new UserRoleDo(); mustRoleDo.setOrganizationId(userEntity.getTopOrganizationId());
userRoleDo.setUserId(userEntity.getUserId()); mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
userRoleDo.setRoleId(roleEntity.getRoleId()); }
//判断是否存在当前登录人 if (null != mustRoleEntity) {
LoginUser loginUser = SecurityUtils.getLoginUser(); UserRoleDo mustUserRoleDo = new UserRoleDo();
if (ObjectUtil.isNull(loginUser)) { mustUserRoleDo.setUserId(userEntity.getUserId());
userRoleDomainService.addUserRole(userRoleDo,userEntity); mustUserRoleDo.setRoleId(mustRoleEntity.getRoleId());
}else { LoginUser loginUser = SecurityUtils.getLoginUser();
userRoleDomainService.addUserRole(userRoleDo); if (ObjectUtil.isNull(loginUser)) {
userRoleDomainService.addUserRole(mustUserRoleDo, userEntity);
} else {
userRoleDomainService.addUserRole(mustUserRoleDo);
}
userDO.setRoleCode(RoleEnum.MUST.getCode());
userDO.setRoleName(mustRoleEntity.getRoleName());
userEntity.setRoleCode(RoleEnum.MUST.getCode());
userEntity.setRoleName(mustRoleEntity.getRoleName());
}
} catch (Exception e) {
log.warn("分配默认角色失败,但不影响用户保存: {}", e.getMessage());
}
//更新user表role_code和role_name用mapper直接更新避免需要loginUser
userMapper.update(null, new LambdaUpdateWrapper<UserEntity>()
.set(UserEntity::getRoleCode, userDO.getRoleCode())
.set(UserEntity::getRoleName, userDO.getRoleName())
.eq(UserEntity::getUserId, userEntity.getUserId()));
//同步三方平台放在角色分配之后确保roleCode已设置
try {
wlhyDomainService.addOrEditPlatformUser1(userEntity);
} catch (Exception e) {
log.warn("同步网货平台员工信息失败,但不影响用户保存: {}", e.getMessage());
}
try {
userMallDomainService.syncDriverUserInfo(userEntity);
} catch (Exception e) {
log.warn("同步商城用户失败,但不影响用户保存: {}", e.getMessage());
}
// 只有组织开启园区排队才同步YMS
Integer isQueue = userMapper.getOrdIsQueue(userEntity.getOrganizationId());
if (isQueue != null && isQueue == 1) {
try {
// 截断avatar URLYMS的avatar列长度有限去掉OSS签名参数
if (userEntity.getAvatar() != null && userEntity.getAvatar().contains("?")) {
userEntity.setAvatar(userEntity.getAvatar().substring(0, userEntity.getAvatar().indexOf("?")));
}
ymsDomainService.addOrEditYmsUser(userEntity);
} catch (Exception e) {
log.warn("同步YMS平台员工信息失败,但不影响用户保存: {}", e.getMessage());
} }
} }
//2024年3月27日16:40:15 处理用户验证码注册首次登录redis用户数据不更新问题 //2024年3月27日16:40:15 处理用户验证码注册首次登录redis用户数据不更新问题
@@ -1934,6 +1973,23 @@ public class UserApplicationService {
userDO.setDriverEnterpriseCode(driverEnterpriseCode); userDO.setDriverEnterpriseCode(driverEnterpriseCode);
UserPo userPo = registerAddUser(userDO); UserPo userPo = registerAddUser(userDO);
// 承运企业添加司机补分配driver角色
RoleDo driverRoleDo = new RoleDo();
driverRoleDo.setRoleCode(RoleEnum.DRIVER.getCode());
driverRoleDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
RoleEntity driverRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(driverRoleDo);
if (null != driverRoleEntity) {
UserRoleDo driverUserRoleDo = new UserRoleDo();
driverUserRoleDo.setUserId(userPo.getUserId());
driverUserRoleDo.setRoleId(driverRoleEntity.getRoleId());
userRoleDomainService.addUserRole(driverUserRoleDo);
// 更新user表role_code和role_name为driver承运企业司机不需要must
userMapper.update(null, new LambdaUpdateWrapper<UserEntity>()
.set(UserEntity::getRoleCode, RoleEnum.DRIVER.getCode())
.set(UserEntity::getRoleName, RoleEnum.DRIVER.getName())
.eq(UserEntity::getUserId, userPo.getUserId()));
}
//20240314 运输企业添加司机默认生成一条空的司机信息方便列表查询 //20240314 运输企业添加司机默认生成一条空的司机信息方便列表查询
UserDriverDO userDriverDO = new UserDriverDO(); UserDriverDO userDriverDO = new UserDriverDO();
userDriverDO.setUserId(userPo.getUserId()); userDriverDO.setUserId(userPo.getUserId());
@@ -2886,6 +2942,33 @@ public class UserApplicationService {
return null; return null;
} }
/**
* 仅根据用户登录账号获取用户信息不区分组织SSO等场景使用
*/
public LoginUser getUserByUserAccount(String userAccount) {
UserPo userPo = userDomainService.findByUserAccount(userAccount);
if (ObjectUtil.isNotNull(userPo)) {
LoginUser sysUser = new LoginUser();
sysUser.setUserid(userPo.getUserId());
sysUser.setUsername(userPo.getUserAccount());
UserDriverPo userDriverPo = userDriverDomainService.selectByUserId(userPo.getUserId());
UserShipperPo userShipperPo = userShipperDomainService.selectByUserId(userPo.getUserId());
sysUser.setUserPo(userPo);
com.mhd.common.core.domain.po.UserDriverPo userDriverPo1 = new com.mhd.common.core.domain.po.UserDriverPo();
if(userDriverPo != null){
BeanUtils.copyProperties(userDriverPo, userDriverPo1);
}
sysUser.setUserDriverPo(userDriverPo1);
com.mhd.common.core.domain.po.UserShipperPo userShipperPo1 = new com.mhd.common.core.domain.po.UserShipperPo();
if (userShipperPo != null){
BeanUtils.copyProperties(userShipperPo, userShipperPo1);
}
sysUser.setUserShipperPo(userShipperPo1);
return sysUser;
}
return null;
}
/** /**
* @Description 根据用户账号和组织账号获取组织用户信息 * @Description 根据用户账号和组织账号获取组织用户信息
* @Author Alex * @Author Alex
@@ -359,6 +359,95 @@ public class UserShipperApplicationService {
return result; return result;
} }
/**
* Excel 导入委托方
* 模版列登录账号公司名称联系人联系电话地址详细地址备注结算币种
*/
public com.mhd.common.core.web.domain.AjaxResult importShipperFromExcel(org.springframework.web.multipart.MultipartFile file) {
if (file == null || file.isEmpty()) {
return com.mhd.common.core.web.domain.AjaxResult.error("文件不能为空");
}
try {
org.apache.poi.ss.usermodel.Workbook workbook = org.apache.poi.ss.usermodel.WorkbookFactory.create(file.getInputStream());
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);
int total = 0, success = 0, failed = 0;
java.util.List<String> errors = new java.util.ArrayList<>();
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
org.apache.poi.ss.usermodel.Row row = sheet.getRow(i);
if (row == null) continue;
String userAccount = getCellStr(row.getCell(0));
String companyName = getCellStr(row.getCell(1));
if (org.springframework.util.StringUtils.isEmpty(companyName)) continue;
total++;
try {
// 先按公司名称查是否已存在委托方
UserShipperEntity existingShipper = findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
if (existingShipper != null && existingShipper.getShipperId() != null) {
// 已存在只更新NC客户编码和org_code
appendOrganizationToExistingShipper(existingShipper,
SecurityUtils.getLoginUser().getUserPo().getOrganizationId(),
SecurityUtils.getLoginUser().getUserPo().getOrganizationName(),
userAccount, SecurityUtils.getLoginUser());
success++;
} else {
UserShipperDO shipperDO = new UserShipperDO();
shipperDO.setShipperType(2);
shipperDO.setDataSource(2);
shipperDO.setUserAccount(userAccount);
shipperDO.setShipperEnterpriseName(companyName);
// 登录账号同时作为NC客户编码
shipperDO.setCustomerNcCode(userAccount);
String contactName = getCellStr(row.getCell(2));
String contactPhone = getCellStr(row.getCell(3));
// 联系人 -> user表 user_name + user_shipper表 user_name_shipper
shipperDO.setUserName(contactName);
shipperDO.setUserNameShipper(contactName);
// 联系电话 -> user表 user_phone
shipperDO.setUserPhone(contactPhone);
// 地址 -> user表 user_area_name详细地址 -> user表 user_area_address
shipperDO.setUserAreaName(getCellStr(row.getCell(4)));
shipperDO.setUserAreaAddress(getCellStr(row.getCell(5)));
shipperDO.setRemark(getCellStr(row.getCell(6)));
shipperDO.setSettlementCurrency(getCellStr(row.getCell(7)));
// 初始化 orgCode记录当前组织信息和NC客户编码
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
LoginUser loginUser = SecurityUtils.getLoginUser();
orgItem.put("name", loginUser.getUserPo().getOrganizationName());
orgItem.put("code", loginUser.getUserPo().getOrganizationId());
orgItem.put("ncCustomer", userAccount);
orgItem.put("names", loginUser.getUserPo().getOrganizationId());
orgCodeArray.add(orgItem);
shipperDO.setOrgCode(orgCodeArray.toJSONString());
addShipper(shipperDO);
success++;
}
} catch (Exception e) {
failed++;
errors.add("" + (i + 1) + "行[" + companyName + "]导入失败:" + e.getMessage());
log.error("导入委托方第{}行失败", i + 1, e);
}
}
workbook.close();
java.util.Map<String, Object> result = new java.util.HashMap<>();
result.put("total", total);
result.put("success", success);
result.put("failed", failed);
result.put("errorMessages", errors);
return com.mhd.common.core.web.domain.AjaxResult.success("导入完成", result);
} catch (Exception e) {
log.error("解析Excel失败", e);
return com.mhd.common.core.web.domain.AjaxResult.error("解析Excel失败:" + e.getMessage());
}
}
private String getCellStr(org.apache.poi.ss.usermodel.Cell cell) {
if (cell == null) return null;
cell.setCellType(org.apache.poi.ss.usermodel.CellType.STRING);
String v = cell.getStringCellValue();
return v == null ? null : v.trim();
}
/** /**
* 个人货主认证 * 个人货主认证
* *
@@ -521,6 +610,7 @@ public class UserShipperApplicationService {
userShipperDO.setUpdateBy(loginUserPo.getUserId()); userShipperDO.setUpdateBy(loginUserPo.getUserId());
userShipperDO.setUpdateByName(loginUserPo.getUserName()); userShipperDO.setUpdateByName(loginUserPo.getUserName());
userShipperDO.setUpdateTime(new Date()); userShipperDO.setUpdateTime(new Date());
userShipperDO.setRoleCode("ownerCargo");
updateUserInformation(userShipperDO); updateUserInformation(userShipperDO);
//保存托运人信息 //保存托运人信息
userShipperDomainService.saveUserShipper(userShipperDO); userShipperDomainService.saveUserShipper(userShipperDO);
@@ -583,6 +673,7 @@ public class UserShipperApplicationService {
refreshShipperDictData(userShipperDO); refreshShipperDictData(userShipperDO);
UserDO userDO = new UserDO(); UserDO userDO = new UserDO();
BeanUtils.copyProperties(userShipperDO, userDO, IgnoreNullUtil.getNullPropertyNames(userShipperDO)); BeanUtils.copyProperties(userShipperDO, userDO, IgnoreNullUtil.getNullPropertyNames(userShipperDO));
//修改用户表信息 //修改用户表信息
UserPo userPo = userApplicationService.updateUser(userDO); UserPo userPo = userApplicationService.updateUser(userDO);
@@ -1347,6 +1438,82 @@ public class UserShipperApplicationService {
organizationId); organizationId);
} }
/**
* 按公司名跨组织查询第一个未删除的委托方包含 orgCode
* 用于 MDM 同步时同公司名可能在不同组织下 nc 编码不同但本地是同一条委托方记录
*/
public UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(String shipperEnterpriseName) {
if (StringUtils.isEmpty(shipperEnterpriseName)) {
return null;
}
return userShipperMapper.findFirstByShipperEnterpriseNameAcrossOrgs(shipperEnterpriseName.trim());
}
/**
* 在已存在的同公司名委托方可能属于其他组织 orgCode JSON 数组中追加当前组织信息
* 若目标组织已存在于数组中则跳过不重复追加
*
* @param existingShipper 本地已存在的同公司名委托方
* @param targetOrganizationId 当前同步组织 ID
* @param targetOrganizationName 当前同步组织名称
* @param ncCustomerCode MDM 客商 code作为该组织下的 ncCustomer 记录
* @param loginUser 登录用户用于写入 updateBy
* @return true 表示实际写入新增组织或已存在都返回 true方便调用方统计false 表示参数无效
*/
public boolean appendOrganizationToExistingShipper(UserShipperEntity existingShipper,
Long targetOrganizationId, String targetOrganizationName,
String ncCustomerCode, LoginUser loginUser) {
if (existingShipper == null) {
return false;
}
String existingOrgCode = existingShipper.getOrgCode();
boolean hasOrg = false;
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
if (StringUtils.isNotEmpty(existingOrgCode)) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
// 检查是否已包含当前组织
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (targetOrganizationId != null && targetOrganizationId.equals(itemCode)) {
hasOrg = true;
break;
}
}
} catch (Exception e) {
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
}
}
if (!hasOrg) {
// 添加新组织到orgCode数组
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("name", targetOrganizationName);
newOrgItem.put("code", targetOrganizationId);
newOrgItem.put("ncCustomer", ncCustomerCode);
newOrgItem.put("names", targetOrganizationId);
orgCodeArray.add(newOrgItem);
// 更新委托方的orgCode字段
existingShipper.setOrgCode(orgCodeArray.toJSONString());
if (loginUser != null && loginUser.getUserPo() != null) {
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
}
existingShipper.setUpdateTime(new Date());
userShipperMapper.updateById(existingShipper);
log.info("委托方已存在,添加新组织到orgCodecustomerNcCode={},新增组织code={}name={}",
ncCustomerCode, targetOrganizationId, targetOrganizationName);
} else {
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
ncCustomerCode, targetOrganizationId);
}
return true;
}
public static String buildMasterDataMatchKey(String ncCode, String companyName) { public static String buildMasterDataMatchKey(String ncCode, String companyName) {
return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName); return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName);
} }
@@ -1372,6 +1539,9 @@ public class UserShipperApplicationService {
throw new ServiceException("获取组织配置失败"); throw new ServiceException("获取组织配置失败");
} }
// 按公司名跨组织匹配已存在委托方的逻辑已迁移到 doSync 先调用 appendOrganizationToExistingShipper
// 走到这里说明按 ncCode+companyName 与公司名均未匹配到本方法只负责"新增"
// 不存在相同的委托方执行新增逻辑
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser, UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
targetOrganizationId, targetOrganizationName, targetTopOrganizationId); targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
userShipperDO.setDataSource(1); userShipperDO.setDataSource(1);
@@ -1383,6 +1553,16 @@ public class UserShipperApplicationService {
userShipperDO.setAuthType(2); userShipperDO.setAuthType(2);
userShipperDO.setShipperAuthStatus(3); userShipperDO.setShipperAuthStatus(3);
// 初始化 orgCode新加的客商属于当前组织将当前组织信息写入 orgCode JSON 数组
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
orgItem.put("name", targetOrganizationName);
orgItem.put("code", targetOrganizationId);
orgItem.put("ncCustomer", record.getCode());
orgItem.put("names", targetOrganizationId);
orgCodeArray.add(orgItem);
userShipperDO.setOrgCode(orgCodeArray.toJSONString());
String userAccount = buildMasterDataUserAccount(record.getCode()); String userAccount = buildMasterDataUserAccount(record.getCode());
checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId()); checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId());
userShipperDO.setUserAccount(userAccount); userShipperDO.setUserAccount(userAccount);
@@ -1498,7 +1678,7 @@ public class UserShipperApplicationService {
Long targetOrganizationId, String targetOrganizationName, Long targetOrganizationId, String targetOrganizationName,
Long targetTopOrganizationId) { Long targetTopOrganizationId) {
UserShipperDO userShipperDO = new UserShipperDO(); UserShipperDO userShipperDO = new UserShipperDO();
userShipperDO.setCustomerNcCode(record.getCode()); userShipperDO.setCustomerNcCode(record.getDesc17()); // NC编码用desc17与匹配Key一致
userShipperDO.setUserMemberCode(record.getCode()); userShipperDO.setUserMemberCode(record.getCode());
userShipperDO.setShipperEnterpriseName(record.getDesc1()); userShipperDO.setShipperEnterpriseName(record.getDesc1());
userShipperDO.setUserNameShipper(record.getDesc1()); userShipperDO.setUserNameShipper(record.getDesc1());
@@ -1581,95 +1761,247 @@ public class UserShipperApplicationService {
com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject();
for (UserShipperEntity userShipperEntity : customerNcCodeList) { for (UserShipperEntity userShipperEntity : customerNcCodeList) {
if (StringUtils.isEmpty(userShipperEntity.getCustomerNcCode())) {
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
if (userShipperEntity1 == null) {
log.warn("未找到对应货主,custcode={}", userShipperEntity.getCustomerNcCode());
continue; continue;
} }
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity1.getOrganizationId());
if (StringUtils.isEmpty(orgcode)) {
return AjaxResult.error("组织NC编码不能为空");
}
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
String queryResult = HttpRequest.post(queryUrl) // 解析org_code支持多组织
.header("Content-Type", "application/json") List<Long> orgCodeList = new ArrayList<>();
.header("uap_token", uapToken) if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
.header("uap_usercode", uapUsercode) try {
.header("uap_dataSource", uapDataSource) // 解析JSON数组[{"name":"通宇","code":2830,"ncOrganizationId":"145222101124","names":2830},...]
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D") com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
.body(queryParam.toJSONString()) if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
.execute() for (int i = 0; i < orgCodeArray.size(); i++) {
.body(); com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
log.info("赊销额度查询接口返回,custcode={}result={}", userShipperEntity.getCustomerNcCode(), queryResult); Long code = orgItem.getLong("code");
if (code != null) {
if (StringUtils.isNotEmpty(queryResult)) { orgCodeList.add(code);
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(userShipperEntity.getCustomerNcCode(), resultJson);
// 第三步查询成功更新货主的额度同步时间limitTime
if (userShipperEntity1 != null) {
// 根据查询结果同步数据
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
if (dataJson != null) {
// 同步额度数据limitdatas
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
if (limitdatas != null && !limitdatas.isEmpty()) {
com.alibaba.fastjson.JSONObject limitData = limitdatas.getJSONObject(0);
userShipperEntity1.setLimitTime(new Date());
userShipperEntity1.setAuthorizedQuota(limitData.getBigDecimal("nlimitmny"));
userShipperEntity1.setAuthorizedUsedAmount(limitData.getBigDecimal("nengrossmny"));
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
userShipperMapper.updateById(userShipperEntity1);
log.info("更新货主额度同步成功,custcode={}shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
} else {
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}", userShipperEntity1.getCustomerNcCode());
} }
}
}
log.info("解析org_code成功,custcode={}orgCodeList={}", userShipperEntity.getCustomerNcCode(), orgCodeList);
} catch (Exception e) {
log.error("解析org_code失败,custcode={}orgCode={}", userShipperEntity.getCustomerNcCode(), userShipperEntity1.getOrgCode(), e);
}
}
// 同步协议明细agreedaydatas与limitdatas独立 // 如果org_code为空或解析失败使用原来的organizationId方式
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas"); if (orgCodeList.isEmpty()) {
if (agreedaydatas != null && !agreedaydatas.isEmpty()) { Long organizationId = userShipperEntity1.getOrganizationId();
// 先删除该货主已有的协议明细避免重复 if (organizationId != null) {
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>() orgCodeList.add(organizationId);
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId())); log.info("org_code为空,使用organizationIdcustcode={}organizationId={}", organizationId);
int i; }
for (i = 0; i < agreedaydatas.size(); i++) { }
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
AgreementDetails agreementDetails = new AgreementDetails(); if (orgCodeList.isEmpty()) {
agreementDetails.setShipperId(userShipperEntity1.getShipperId()); log.warn("货主无组织信息,跳过查询,custcode={}");
agreementDetails.setOrgcode(agreeItem.getString("orgcode")); continue;
agreementDetails.setCode(agreeItem.getString("code")); }
agreementDetails.setPday(agreeItem.getString("pday"));
agreementDetails.setPname(agreeItem.getString("pname")); // 遍历每个组织code分别调用接口
agreementDetails.setPtypename(agreeItem.getString("ptypename")); int orgIndex = 0; // 组织循环计数器
agreementDetails.setPcode(agreeItem.getString("pcode")); for (Long orgCode : orgCodeList) {
agreementDetails.setPtype(agreeItem.getString("ptype")); String orgcode = userShipperMapper.getOrgNcCode(orgCode);
agreementDetailsMapper.insert(agreementDetails); if (StringUtils.isEmpty(orgcode)) {
log.warn("组织NC编码为空,跳过查询,custcode={}orgCode={}", orgCode);
orgIndex++;
continue;
}
// 从orgCode数组中获取当前组织的ncCustomer字段
String ncCustomer = null;
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (orgCode.equals(itemCode)) {
ncCustomer = orgItem.getString("ncCustomer");
break;
}
}
} catch (Exception e) {
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
}
}
if (StringUtils.isEmpty(ncCustomer)) {
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode);
orgIndex++;
continue;
}
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}ncCustomer={}orgcode={}", ncCustomer, orgcode);
String queryResult = HttpRequest.post(queryUrl)
.header("Content-Type", "application/json")
.header("uap_token", uapToken)
.header("uap_usercode", uapUsercode)
.header("uap_dataSource", uapDataSource)
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
.body(queryParam.toJSONString())
.execute()
.body();
log.info("赊销额度查询接口返回,custcode={}ncCustomer={}orgcode={}result={}", ncCustomer, orgcode, queryResult);
if (StringUtils.isNotEmpty(queryResult)) {
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
// 第三步查询成功更新货主的额度同步时间limitTime
if (userShipperEntity1 != null) {
// 根据查询结果同步数据
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
if (dataJson != null) {
// 解析现有的orgCode数组
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
} catch (Exception e) {
log.warn("解析现有orgCode失败,将创建新的数组,shipperId={}", userShipperEntity1.getShipperId());
}
} }
userShipperEntity1.setAgreementCount(i);
userShipperMapper.updateById(userShipperEntity1); // 同步额度数据limitdatas
log.info("同步协议明细成功,custcode={}shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId(), agreedaydatas.size()); com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
if (limitdatas != null && !limitdatas.isEmpty()) {
// 将limitdatas按orgcode值合并到orgCode数组中
for (int i = 0; i < limitdatas.size(); i++) {
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
String limitOrgcode = limitItem.getString("orgcode"); // 例如 "NA01"
if (StringUtils.isNotEmpty(limitOrgcode)) {
// 在orgCode数组中查找code匹配的组织注意这里的code是2830, 2839等
boolean found = false;
for (int j = 0; j < orgCodeArray.size(); j++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
String orgItemCode = orgItem.getString("code"); // orgCode数组中的code
// 如果orgCode数组中的code与当前orgCode(如2830)匹配将limitdatas的字段添加到该组织对象中
String currentOrgCodeStr = String.valueOf(orgCode);
if (currentOrgCodeStr.equals(orgItemCode)) {
orgItem.putAll(limitItem);
found = true;
log.info("匹配到code={}的组织,将额度数据(orgcode={})添加到orgCode中,custcode={}", orgItemCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
break;
}
}
// 如果没有找到匹配的组织创建新的组织对象
if (!found) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("code", orgCode); // 使用当前orgCode
newOrgItem.putAll(limitItem);
orgCodeArray.add(newOrgItem);
log.info("未找到code={}的组织,创建新组织并添加额度数据(orgcode={})custcode={}", orgCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
}
}
}
// 使用limitdatas中的数据更新额度字段
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
userShipperEntity1.setLimitTime(new Date());
userShipperEntity1.setAuthorizedQuota(firstLimitData.getBigDecimal("nlimitmny"));
userShipperEntity1.setAuthorizedUsedAmount(firstLimitData.getBigDecimal("nengrossmny"));
userShipperEntity1.setSettlementCurrency(firstLimitData.getString("currencycode"));
userShipperEntity1.setCreditAmount(firstLimitData.getBigDecimal("nbalancemny"));
log.info("更新货主额度同步成功,custcode={}orgcode={}shipperId={}orgCode组织数={}", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), orgCodeArray.size());
} else {
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
}
// 同步协议明细agreedaydatas与limitdatas独立
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
// 只在第一次循环时删除该货主的所有协议明细避免重复
if (orgIndex == 0) {
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
}
// 将agreedaydatas保存到orgCode数组中与code同一级别
String currentOrgCodeStr = String.valueOf(orgCode);
boolean foundOrg = false;
for (int j = 0; j < orgCodeArray.size(); j++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
String orgItemCode = orgItem.getString("code");
// 找到当前组织将agreedaydatas添加到该组织对象中
if (currentOrgCodeStr.equals(orgItemCode)) {
orgItem.put("agreedaydatas", agreedaydatas);
foundOrg = true;
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
break;
}
}
// 如果没找到创建新组织对象
if (!foundOrg) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("code", orgCode);
newOrgItem.put("agreedaydatas", agreedaydatas);
orgCodeArray.add(newOrgItem);
log.info("创建新组织并添加agreedaydatascode={},共{}条", orgCode, agreedaydatas.size());
}
// 同时插入到agreement_details表
for (int i = 0; i < agreedaydatas.size(); i++) {
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
AgreementDetails agreementDetails = new AgreementDetails();
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
agreementDetails.setCode(agreeItem.getString("code"));
agreementDetails.setPday(agreeItem.getString("pday"));
agreementDetails.setPname(agreeItem.getString("pname"));
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
agreementDetails.setPcode(agreeItem.getString("pcode"));
agreementDetails.setPtype(agreeItem.getString("ptype"));
agreementDetailsMapper.insert(agreementDetails);
}
log.info("同步协议明细成功,custcode={}orgcode={}shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), agreedaydatas.size());
} else {
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
}
// 保存更新后的orgCode数组统一在最后保存
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
} else { } else {
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步custcode={}", userShipperEntity1.getCustomerNcCode()); log.info("赊销额度查询无data返回,跳过更新custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
} }
} else { } else {
log.info("赊销额度查询无data返回,跳过更新custcode={}", userShipperEntity1.getCustomerNcCode()); log.warn("未找到对应货主custcode={}orgCode={}", orgCode);
} }
} else { } else {
log.warn("未找到对应货主custcode={}organizationId={}", userShipperEntity1.getCustomerNcCode(), userShipperDTO.getOrganizationId()); log.warn("赊销额度查询返回为空custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
} }
} else { } catch (Exception e) {
log.warn("赊销额度查询返回为空custcode={}", userShipperEntity1.getCustomerNcCode()); log.error("查询赊销额度异常custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode, e);
} finally {
orgIndex++; // 计数器递增
} }
} catch (Exception e) { }
log.error("查询赊销额度异常,custcode={}", userShipperEntity1.getCustomerNcCode(), e);
// 所有组织循环完成后统一更新数据库只更新一次
if (userShipperEntity1 != null) {
userShipperMapper.updateById(userShipperEntity1);
log.info("批量更新货主额度完成,custcode={}shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
} }
} }
return AjaxResult.success(allResults); return AjaxResult.success(allResults);
@@ -1723,89 +2055,243 @@ public class UserShipperApplicationService {
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>() UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode()) .eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId())); .eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity1.getOrganizationId());
if (StringUtils.isEmpty(orgcode)) { if (userShipperEntity1 == null) {
return AjaxResult.error("组织NC编码不能为空"); log.warn("未找到对应货主,custcode={}", userShipperEntity.getCustomerNcCode());
continue;
} }
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
String queryResult = HttpRequest.post(queryUrl) // 解析org_code支持多组织
.header("Content-Type", "application/json") List<Long> orgCodeList = new ArrayList<>();
.header("uap_token", uapToken) if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
.header("uap_usercode", uapUsercode) try {
.header("uap_dataSource", uapDataSource) // 解析JSON数组[{"name":"通宇","code":2830,"ncOrganizationId":"145222101124","names":2830},...]
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D") com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
.body(queryParam.toJSONString()) if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
.execute() for (int i = 0; i < orgCodeArray.size(); i++) {
.body(); com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
log.info("赊销额度查询接口返回,custcode={}result={}", userShipperEntity.getCustomerNcCode(), queryResult); Long code = orgItem.getLong("code");
if (code != null) {
if (StringUtils.isNotEmpty(queryResult)) { orgCodeList.add(code);
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(userShipperEntity.getCustomerNcCode(), resultJson);
// 第三步查询成功更新货主的额度同步时间limitTime
if (userShipperEntity1 != null) {
// 根据查询结果同步数据
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
if (dataJson != null) {
// 同步额度数据limitdatas
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
if (limitdatas != null && !limitdatas.isEmpty()) {
com.alibaba.fastjson.JSONObject limitData = limitdatas.getJSONObject(0);
userShipperEntity1.setLimitTime(new Date());
userShipperEntity1.setAuthorizedQuota(limitData.getBigDecimal("nlimitmny"));
userShipperEntity1.setAuthorizedUsedAmount(limitData.getBigDecimal("nengrossmny"));
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
userShipperMapper.updateById(userShipperEntity1);
log.info("更新货主额度同步成功,custcode={}shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
} else {
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}", userShipperEntity1.getCustomerNcCode());
} }
}
}
log.info("解析org_code成功,custcode={}orgCodeList={}", userShipperEntity.getCustomerNcCode(), orgCodeList);
} catch (Exception e) {
log.error("解析org_code失败,custcode={}orgCode={}", userShipperEntity.getCustomerNcCode(), userShipperEntity1.getOrgCode(), e);
}
}
// 同步协议明细agreedaydatas与limitdatas独立 // 如果org_code为空或解析失败使用原来的organizationId方式
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas"); if (orgCodeList.isEmpty()) {
if (agreedaydatas != null && !agreedaydatas.isEmpty()) { Long organizationId = userShipperEntity1.getOrganizationId();
// 先删除该货主已有的协议明细避免重复 if (organizationId != null) {
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>() orgCodeList.add(organizationId);
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId())); log.info("org_code为空,使用organizationIdcustcode={}organizationId={}", userShipperEntity.getCustomerNcCode(), organizationId);
int i; }
for (i = 0; i < agreedaydatas.size(); i++) { }
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
AgreementDetails agreementDetails = new AgreementDetails(); if (orgCodeList.isEmpty()) {
agreementDetails.setShipperId(userShipperEntity1.getShipperId()); log.warn("货主无组织信息,跳过查询,custcode={}", userShipperEntity.getCustomerNcCode());
agreementDetails.setOrgcode(agreeItem.getString("orgcode")); continue;
agreementDetails.setCode(agreeItem.getString("code")); }
agreementDetails.setPday(agreeItem.getString("pday"));
agreementDetails.setPname(agreeItem.getString("pname")); // 遍历每个组织code分别调用接口
agreementDetails.setPtypename(agreeItem.getString("ptypename")); int orgIndex = 0; // 组织循环计数器
agreementDetails.setPcode(agreeItem.getString("pcode")); for (Long orgCode : orgCodeList) {
agreementDetails.setPtype(agreeItem.getString("ptype")); String orgcode = userShipperMapper.getOrgNcCode(orgCode);
agreementDetailsMapper.insert(agreementDetails); if (StringUtils.isEmpty(orgcode)) {
log.warn("组织NC编码为空,跳过查询,custcode={}orgCode={}", userShipperEntity.getCustomerNcCode(), orgCode);
orgIndex++;
continue;
}
// 从orgCode数组中获取当前组织的ncCustomer字段
String ncCustomer = null;
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (orgCode.equals(itemCode)) {
ncCustomer = orgItem.getString("ncCustomer");
break;
}
}
} catch (Exception e) {
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
}
}
if (StringUtils.isEmpty(ncCustomer)) {
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode, userShipperEntity.getCustomerNcCode());
orgIndex++;
continue;
}
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}ncCustomer={}orgcode={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode);
String queryResult = HttpRequest.post(queryUrl)
.header("Content-Type", "application/json")
.header("uap_token", uapToken)
.header("uap_usercode", uapUsercode)
.header("uap_dataSource", uapDataSource)
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
.body(queryParam.toJSONString())
.execute()
.body();
log.info("赊销额度查询接口返回,custcode={}ncCustomer={}orgcode={}result={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode, queryResult);
if (StringUtils.isNotEmpty(queryResult)) {
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
// 第三步查询成功更新货主的额度同步时间limitTime
if (userShipperEntity1 != null) {
// 根据查询结果同步数据
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
if (dataJson != null) {
// 解析现有的orgCode数组提到外面limitdatas和agreedaydatas共用
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
} catch (Exception e) {
log.warn("解析现有orgCode失败,将创建新的数组,shipperId={}", userShipperEntity1.getShipperId());
}
} }
userShipperEntity1.setAgreementCount(i);
userShipperMapper.updateById(userShipperEntity1); // 同步额度数据limitdatas
log.info("同步协议明细成功,custcode={}shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId(), agreedaydatas.size()); com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
if (limitdatas != null && !limitdatas.isEmpty()) {
// 将limitdatas按orgcode值合并到orgCode数组中
for (int i = 0; i < limitdatas.size(); i++) {
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
String limitOrgcode = limitItem.getString("orgcode"); // 例如 "NA01"
if (StringUtils.isNotEmpty(limitOrgcode)) {
// 在orgCode数组中查找code匹配的组织注意这里的code是2830, 2839等
boolean found = false;
for (int j = 0; j < orgCodeArray.size(); j++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
String orgItemCode = orgItem.getString("code"); // orgCode数组中的code
// 如果orgCode数组中的code与当前orgCode(如2830)匹配将limitdatas的字段添加到该组织对象中
String currentOrgCodeStr = String.valueOf(orgCode);
if (currentOrgCodeStr.equals(orgItemCode)) {
orgItem.putAll(limitItem);
found = true;
log.info("匹配到code={}的组织,将额度数据(orgcode={})添加到orgCode中,custcode={}", orgItemCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
break;
}
}
// 如果没有找到匹配的组织创建新的组织对象
if (!found) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("code", orgCode); // 使用当前orgCode
newOrgItem.putAll(limitItem);
orgCodeArray.add(newOrgItem);
log.info("未找到code={}的组织,创建新组织并添加额度数据(orgcode={})custcode={}", orgCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
}
}
}
// 使用limitdatas中的数据更新额度字段
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
userShipperEntity1.setLimitTime(new Date());
userShipperEntity1.setAuthorizedQuota(firstLimitData.getBigDecimal("nlimitmny"));
userShipperEntity1.setAuthorizedUsedAmount(firstLimitData.getBigDecimal("nengrossmny"));
userShipperEntity1.setSettlementCurrency(firstLimitData.getString("currencycode"));
userShipperEntity1.setCreditAmount(firstLimitData.getBigDecimal("nbalancemny"));
log.info("更新货主额度同步成功,custcode={}orgcode={}shipperId={}orgCode组织数={}", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), orgCodeArray.size());
} else {
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
}
// 同步协议明细agreedaydatas与limitdatas独立
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
// 只在第一次循环时删除该货主的所有协议明细避免重复
if (orgIndex == 0) {
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
}
// 将agreedaydatas保存到orgCode数组中与code同一级别
String currentOrgCodeStr = String.valueOf(orgCode);
boolean foundOrg = false;
for (int j = 0; j < orgCodeArray.size(); j++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
String orgItemCode = orgItem.getString("code");
// 找到当前组织将agreedaydatas添加到该组织对象中
if (currentOrgCodeStr.equals(orgItemCode)) {
orgItem.put("agreedaydatas", agreedaydatas);
foundOrg = true;
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
break;
}
}
// 如果没找到创建新组织对象
if (!foundOrg) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("code", orgCode);
newOrgItem.put("agreedaydatas", agreedaydatas);
orgCodeArray.add(newOrgItem);
log.info("创建新组织并添加agreedaydatascode={},共{}条", orgCode, agreedaydatas.size());
}
// 同时插入到agreement_details表
for (int i = 0; i < agreedaydatas.size(); i++) {
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
AgreementDetails agreementDetails = new AgreementDetails();
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
agreementDetails.setCode(agreeItem.getString("code"));
agreementDetails.setPday(agreeItem.getString("pday"));
agreementDetails.setPname(agreeItem.getString("pname"));
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
agreementDetails.setPcode(agreeItem.getString("pcode"));
agreementDetails.setPtype(agreeItem.getString("ptype"));
agreementDetailsMapper.insert(agreementDetails);
}
log.info("同步协议明细成功,custcode={}orgcode={}shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), agreedaydatas.size());
} else {
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
}
// 保存更新后的orgCode数组统一在最后保存
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
} else { } else {
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步custcode={}", userShipperEntity1.getCustomerNcCode()); log.info("赊销额度查询无data返回,跳过更新custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
} }
} else { } else {
log.info("赊销额度查询无data返回,跳过更新custcode={}", userShipperEntity1.getCustomerNcCode()); log.warn("未找到对应货主custcode={}orgCode={}", userShipperEntity.getCustomerNcCode(), orgCode);
} }
} else { } else {
log.warn("未找到对应货主custcode={}organizationId={}", userShipperEntity1.getCustomerNcCode(), userShipperDTO.getOrganizationId()); log.warn("赊销额度查询返回为空custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
} }
} else { } catch (Exception e) {
log.warn("赊销额度查询返回为空custcode={}", userShipperEntity1.getCustomerNcCode()); log.error("查询赊销额度异常custcode={}orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode, e);
} finally {
orgIndex++; // 计数器递增
} }
} catch (Exception e) { }
log.error("查询赊销额度异常,custcode={}", userShipperEntity1.getCustomerNcCode(), e);
// 所有组织循环完成后统一更新数据库只更新一次
if (userShipperEntity1 != null) {
userShipperMapper.updateById(userShipperEntity1);
log.info("批量更新货主额度完成,custcode={}shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
} }
} }
return AjaxResult.success(allResults); return AjaxResult.success(allResults);
@@ -13,6 +13,7 @@ import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.redis.service.RedisLock; import com.mhd.common.redis.service.RedisLock;
import com.mhd.common.security.utils.SecurityUtils; import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo; import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
import com.mhd.user.domain.userShipperMdmSync.entity.UserShipperMdmSyncEntity; import com.mhd.user.domain.userShipperMdmSync.entity.UserShipperMdmSyncEntity;
import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper; import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper;
@@ -69,13 +70,28 @@ public class UserShipperMasterDataSyncService {
public void syncMasterData() { public void syncMasterData() {
LoginUser loginUser = requireLoginUser(); LoginUser loginUser = requireLoginUser();
Long organizationId = loginUser.getUserPo().getOrganizationId(); Long organizationId = loginUser.getUserPo().getOrganizationId();
String lockKey = LOCK_PREFIX + organizationId; new Thread(() -> {
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES); String lockKey = LOCK_PREFIX + organizationId;
if (!locked) { try {
throw new ServiceException("当前组织正在同步主数据,请稍后再试"); boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
} if (!locked) {
markSyncInProgress(organizationId); log.warn("当前组织正在同步主数据,跳过本次同步");
asyncUserShipperMasterDataSyncService.syncMasterDataAsync(loginUser, lockKey); return;
}
markSyncInProgress(organizationId);
try {
ShipperMasterDataSyncResultVo resultVo = doSync(loginUser);
log.info("MDM同步完成: {}", resultVo);
} catch (Exception e) {
log.error("同步主数据失败, organizationId={}", organizationId, e);
markSyncFailed(organizationId, e.getMessage());
} finally {
redisLock.unlock(lockKey);
}
} catch (Exception e) {
log.error("获取同步锁失败", e);
}
}, "mdm-sync-thread").start();
} }
public ShipperMasterDataSyncResultVo executeSync(LoginUser loginUser) { public ShipperMasterDataSyncResultVo executeSync(LoginUser loginUser) {
@@ -184,14 +200,31 @@ public class UserShipperMasterDataSyncService {
targetOrganizationId, organizationId, topOrganizationId, loginUser); targetOrganizationId, organizationId, topOrganizationId, loginUser);
UserShipperPo existing = existingMap.get(matchKey); UserShipperPo existing = existingMap.get(matchKey);
if (existing == null) { if (existing == null) {
userShipperApplicationService.addEnterpriseShipperFromMasterData( // ncCode+companyName 未匹配到时再按公司名跨组织查询已存在的同公司名委托方
record, loginUser, saveTarget.getOrganizationId(), // 同一个客商在 MDM 中可能属于不同组织nc 编码不同但本地是同一条委托方记录
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId()); // 如果匹配到的委托方属于另外的组织非当前同步组织则不新增
resultVo.setAddCount(resultVo.getAddCount() + 1); // 而是在其 orgCode 上追加当前同步组织的信息连同本组织下的 ncCustomer
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName( UserShipperEntity existingByName = userShipperApplicationService
ncCode, companyName, saveTarget.getOrganizationId()); .findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
if (added != null) { if (existingByName != null
existingMap.put(matchKey, added); && saveTarget.getOrganizationId() != null
&& !saveTarget.getOrganizationId().equals(existingByName.getOrganizationId())) {
userShipperApplicationService.appendOrganizationToExistingShipper(
existingByName, saveTarget.getOrganizationId(),
saveTarget.getOrganizationName(), ncCode, loginUser);
resultVo.setLinkCount(resultVo.getLinkCount() + 1);
log.info("MDM同步按公司名跨组织合并:customerNcCode={}companyName={},本组织code={},已存在委托方shipperId={}(其他组织)",
ncCode, companyName, saveTarget.getOrganizationId(), existingByName.getShipperId());
} else {
userShipperApplicationService.addEnterpriseShipperFromMasterData(
record, loginUser, saveTarget.getOrganizationId(),
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId());
resultVo.setAddCount(resultVo.getAddCount() + 1);
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName(
ncCode, companyName, saveTarget.getOrganizationId());
if (added != null) {
existingMap.put(matchKey, added);
}
} }
} else { } else {
userShipperApplicationService.updateEnterpriseShipperFromMasterData( userShipperApplicationService.updateEnterpriseShipperFromMasterData(
@@ -261,8 +294,9 @@ public class UserShipperMasterDataSyncService {
entity.setLastSyncTime(syncTime); entity.setLastSyncTime(syncTime);
entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1); entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1);
String syncMessage = String.format( String syncMessage = String.format(
"新增%d,更新%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]", "新增%d,更新%d关联%d跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getSkipCount(), resultVo.getFailCount(), resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getLinkCount(),
resultVo.getSkipCount(), resultVo.getFailCount(),
orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther); orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther);
if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) { if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) {
syncMessage += "" + resultVo.getErrorMessages().get(0); syncMessage += "" + resultVo.getErrorMessages().get(0);
@@ -0,0 +1,148 @@
package com.mhd.user.application.service;
import com.alibaba.fastjson.JSONObject;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.user.interfaces.dto.wechat.WxPhoneNumberDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ConcurrentHashMap;
/**
* 微信小程序手机号快速验证
* appId/appSecret bootstrap.yml / Nacos 中配置不同环境配置不同值即可
*/
@Service
@Slf4j
public class WechatMiniAppService {
private static final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
private static final String GET_PHONE_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
@Value("${wechat.miniapp.appId:}")
private String appId;
@Value("${wechat.miniapp.appSecret:}")
private String appSecret;
/** access_token 缓存:{token, expireTime} */
private volatile String cachedToken;
private volatile long tokenExpireTime;
public AjaxResult wxGetPhoneNumber(WxPhoneNumberDTO dto, Long organizationId) {
if (dto == null || dto.getCode() == null || dto.getCode().isEmpty()) {
return AjaxResult.error("code 不能为空");
}
if (appId.isEmpty() || appSecret.isEmpty()) {
return AjaxResult.error("未配置 wechat.miniapp.appId / wechat.miniapp.appSecret");
}
try {
String accessToken = getAccessToken();
String body = "{\"code\":\"" + dto.getCode() + "\"}";
String phoneJson = doPost(String.format(GET_PHONE_URL, accessToken), body);
JSONObject result = JSONObject.parseObject(phoneJson);
int errcode = result.getIntValue("errcode");
if (errcode != 0) {
String errmsg = result.getString("errmsg");
log.error("微信手机号解密失败, errcode={}, errmsg={}", errcode, errmsg);
return AjaxResult.error("获取手机号失败:" + errmsg);
}
JSONObject phoneInfo = result.getJSONObject("phone_info");
if (phoneInfo == null) {
return AjaxResult.error("未获取到手机号信息");
}
JSONObject data = new JSONObject();
data.put("phoneNumber", phoneInfo.getString("phoneNumber"));
data.put("purePhoneNumber", phoneInfo.getString("purePhoneNumber"));
data.put("countryCode", phoneInfo.getString("countryCode"));
return AjaxResult.success(data);
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
log.error("微信手机号验证异常", e);
return AjaxResult.error("微信手机号验证失败:" + e.getMessage());
}
}
private String getAccessToken() {
if (cachedToken != null && System.currentTimeMillis() < tokenExpireTime) {
return cachedToken;
}
synchronized (this) {
if (cachedToken != null && System.currentTimeMillis() < tokenExpireTime) {
return cachedToken;
}
String url = String.format(ACCESS_TOKEN_URL, appId, appSecret);
String response = doGet(url);
JSONObject result = JSONObject.parseObject(response);
if (result.containsKey("errcode") && result.getIntValue("errcode") != 0) {
throw new ServiceException("获取微信 access_token 失败:" + result.getString("errmsg"));
}
cachedToken = result.getString("access_token");
int expiresIn = result.getIntValue("expires_in");
tokenExpireTime = System.currentTimeMillis() + (expiresIn - 300) * 1000L;
return cachedToken;
}
}
private String doGet(String urlStr) {
try {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
return readResponse(conn);
} catch (Exception e) {
throw new ServiceException("微信接口请求失败:" + e.getMessage());
}
}
private String doPost(String urlStr, String body) {
try {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
conn.setConnectTimeout(10000);
conn.setReadTimeout(10000);
try (OutputStream os = conn.getOutputStream()) {
os.write(body.getBytes(StandardCharsets.UTF_8));
os.flush();
}
return readResponse(conn);
} catch (Exception e) {
throw new ServiceException("微信接口请求失败:" + e.getMessage());
}
}
private String readResponse(HttpURLConnection conn) throws Exception {
int code = conn.getResponseCode();
BufferedReader reader = new BufferedReader(new InputStreamReader(
code >= 400 ? conn.getErrorStream() : conn.getInputStream(), StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
sb.append(line);
}
reader.close();
if (code >= 400) {
throw new ServiceException("微信接口 HTTP " + code + "" + sb);
}
return sb.toString();
}
}
@@ -291,4 +291,7 @@ public class UserShipperEntity extends BaseVOEntity {
@ApiModelProperty(name = "是否校验信用") @ApiModelProperty(name = "是否校验信用")
private String isCheckCredit; private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
} }
@@ -31,6 +31,12 @@ public interface UserRepositoryInterface extends IService<UserEntity> {
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO); UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
UserPo findByUserAccount(String userAccount);
UserPo getUserByDingUserId(String dingUserId); UserPo getUserByDingUserId(String dingUserId);
UserPo selectUserShipperList(UserPo userPo); UserPo selectUserShipperList(UserPo userPo);
@@ -33,6 +33,11 @@ public interface UserMapper extends BaseMapper<UserEntity> {
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO); UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
UserPo findByUserAccount(@Param("userAccount") String userAccount);
UserPo getUserByDingUserId(@Param("dingUserId") String dingUserId); UserPo getUserByDingUserId(@Param("dingUserId") String dingUserId);
UserPo findByTopOrganizationIdAndUserPhone(UserDO userDO); UserPo findByTopOrganizationIdAndUserPhone(UserDO userDO);
@@ -52,5 +52,11 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
@Param("companyName") String companyName, @Param("companyName") String companyName,
@Param("organizationId") Long organizationId); @Param("organizationId") Long organizationId);
/**
* 按公司名跨组织查询第一个未删除的委托方包含 orgCode 字段
* 用于 MDM 同步时按"公司名"匹配已存在的委托方可能是其他组织的以便在其 orgCode 上追加新组织
*/
UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(@Param("shipperEnterpriseName") String shipperEnterpriseName);
String getOrgNcCode(Long organizationId); String getOrgNcCode(Long organizationId);
} }
@@ -79,6 +79,11 @@ public class UserRepositoryImpl extends ServiceImpl<UserMapper,UserEntity> imple
return userMapper.findByTopOrganizationIdAndUserAccount(userDO); return userMapper.findByTopOrganizationIdAndUserAccount(userDO);
} }
@Override
public UserPo findByUserAccount(String userAccount) {
return userMapper.findByUserAccount(userAccount);
}
@Override @Override
public UserPo getUserByDingUserId(String dingUserId) { public UserPo getUserByDingUserId(String dingUserId) {
return userMapper.getUserByDingUserId(dingUserId); return userMapper.getUserByDingUserId(dingUserId);
@@ -354,4 +354,6 @@ public class UserShipperPo implements Serializable {
private BigDecimal agreementCount; private BigDecimal agreementCount;
@ApiModelProperty(name = "是否校验信用") @ApiModelProperty(name = "是否校验信用")
private String isCheckCredit; private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
} }
@@ -244,6 +244,12 @@ public class UserShipperDO extends UserDO {
@ApiModelProperty("货主/供应商/客户名称") @ApiModelProperty("货主/供应商/客户名称")
private String userNameShipper; private String userNameShipper;
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("用户电话")
private String userPhone;
@ApiModelProperty("联系人") @ApiModelProperty("联系人")
private String emergencyContactName; private String emergencyContactName;
@@ -322,4 +328,7 @@ public class UserShipperDO extends UserDO {
private String userPassword; private String userPassword;
@ApiModelProperty(name = "是否校验信用") @ApiModelProperty(name = "是否校验信用")
private String isCheckCredit; private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
} }
@@ -82,6 +82,13 @@ public class UserDomainService {
return userRepositoryInterface.findByTopOrganizationIdAndUserAccount(userDO); return userRepositoryInterface.findByTopOrganizationIdAndUserAccount(userDO);
} }
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
public UserPo findByUserAccount(String userAccount) {
return userRepositoryInterface.findByUserAccount(userAccount);
}
public UserPo getUserByDingUserId(String dingUserId) { public UserPo getUserByDingUserId(String dingUserId) {
return userRepositoryInterface.getUserByDingUserId(dingUserId); return userRepositoryInterface.getUserByDingUserId(dingUserId);
} }
@@ -268,4 +268,7 @@ public class UserShipperDTO extends UserDTO {
private String userPassword; private String userPassword;
@ApiModelProperty(name = "是否校验信用") @ApiModelProperty(name = "是否校验信用")
private String isCheckCredit; private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
} }
@@ -0,0 +1,14 @@
package com.mhd.user.interfaces.dto.wechat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 微信小程序手机号快速验证请求参数
*/
@Data
public class WxPhoneNumberDTO {
@ApiModelProperty("wx.getPhoneNumber 返回的 code(注意:非 wx.login 的 code")
private String code;
}
@@ -12,9 +12,11 @@ import com.mhd.common.log.enums.BusinessType;
import com.mhd.user.application.service.UserApplicationService; import com.mhd.user.application.service.UserApplicationService;
import com.mhd.user.application.service.UserDriverApplicationService; import com.mhd.user.application.service.UserDriverApplicationService;
import com.mhd.user.application.service.UserShipperApplicationService; import com.mhd.user.application.service.UserShipperApplicationService;
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
import com.mhd.user.domain.userAggregate.repository.po.UserDocumentWarningQueryPo; import com.mhd.user.domain.userAggregate.repository.po.UserDocumentWarningQueryPo;
import com.mhd.user.domain.userAggregate.repository.todo.*; import com.mhd.user.domain.userAggregate.repository.todo.*;
import com.mhd.user.domain.userAggregate.service.UserRoleDomainService; import com.mhd.user.domain.userAggregate.service.UserRoleDomainService;
import com.mhd.user.interfaces.assember.*; import com.mhd.user.interfaces.assember.*;
import com.mhd.user.interfaces.dto.addDTO.*; import com.mhd.user.interfaces.dto.addDTO.*;
import com.mhd.user.interfaces.dto.queryDTO.UserDataPermissionQueryDTO; import com.mhd.user.interfaces.dto.queryDTO.UserDataPermissionQueryDTO;
@@ -498,6 +500,13 @@ public class UserAPI extends BaseController {
return R.ok(sysUserVo, "操作成功"); return R.ok(sysUserVo, "操作成功");
} }
@ApiOperation("仅根据用户登录账号获取用户信息(不区分组织,SSO等场景)")
@GetMapping("/getUserByUserAccount")
public R<LoginUser> getUserByUserAccount(@RequestParam(value = "userAccount") String userAccount) {
LoginUser sysUserVo = userApplicationService.getUserByUserAccount(userAccount);
return R.ok(sysUserVo, "操作成功");
}
@ApiOperation("根据用户钉钉用户id获取用户信息") @ApiOperation("根据用户钉钉用户id获取用户信息")
@GetMapping("/getUserByDingUserId") @GetMapping("/getUserByDingUserId")
public R<LoginUser> getUserByDingUserId(@RequestParam(value = "dingUserId") String dingUserId) { public R<LoginUser> getUserByDingUserId(@RequestParam(value = "dingUserId") String dingUserId) {
@@ -5,7 +5,9 @@ import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.utils.bean.BeanUtils; import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.log.annotation.Log; import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType; import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.UserShipperFeignDTO; import com.mhd.system.api.domain.UserShipperFeignDTO;
import com.mhd.system.api.model.LoginUser;
import com.mhd.user.application.service.UserApplicationService; import com.mhd.user.application.service.UserApplicationService;
import com.mhd.user.application.service.UserShipperApplicationService; import com.mhd.user.application.service.UserShipperApplicationService;
import com.mhd.user.domain.userAggregate.repository.todo.*; import com.mhd.user.domain.userAggregate.repository.todo.*;
@@ -18,6 +20,7 @@ import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.common.security.annotation.RepeatSubmit; import com.mhd.common.security.annotation.RepeatSubmit;
import com.mhd.common.security.service.TokenService; import com.mhd.common.security.service.TokenService;
import com.mhd.user.application.service.UserShipperMasterDataSyncService; import com.mhd.user.application.service.UserShipperMasterDataSyncService;
import com.mhd.user.application.service.WechatMiniAppService;
import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO; import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO;
import com.mhd.user.interfaces.vo.SettlementInfoQueryVo; import com.mhd.user.interfaces.vo.SettlementInfoQueryVo;
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo; import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo;
@@ -42,6 +45,8 @@ public class UserShipperAPI extends BaseController {
@Resource @Resource
private UserShipperMasterDataSyncService userShipperMasterDataSyncService; private UserShipperMasterDataSyncService userShipperMasterDataSyncService;
@Resource @Resource
private WechatMiniAppService wechatMiniAppService;
@Resource
private UserApplicationService userApplicationService; private UserApplicationService userApplicationService;
@Resource @Resource
private UserShipperAssember userShipperAssember; private UserShipperAssember userShipperAssember;
@@ -342,4 +347,25 @@ public class UserShipperAPI extends BaseController {
} }
return AjaxResult.success(resultMap); return AjaxResult.success(resultMap);
} }
@ApiOperation("微信小程序手机号快速验证")
@PostMapping("/wxGetPhoneNumber")
public AjaxResult wxGetPhoneNumber(@RequestBody com.mhd.user.interfaces.dto.wechat.WxPhoneNumberDTO dto) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long organizationId = (loginUser != null && loginUser.getUserPo() != null)
? loginUser.getUserPo().getOrganizationId() : null;
return wechatMiniAppService.wxGetPhoneNumber(dto, organizationId);
}
@Log(title = "托运人管理-导入", description = "从Excel导入委托方", businessType = BusinessType.IMPORT)
@ApiOperation("导入委托方(Excel批量)")
@PostMapping("/import")
public AjaxResult importShipper(@RequestParam("file") org.springframework.web.multipart.MultipartFile file) {
try {
return userShipperApplicationService.importShipperFromExcel(file);
} catch (Exception e) {
log.error("导入委托方失败", e);
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
} }
@@ -18,6 +18,9 @@ public class ShipperMasterDataSyncResultVo {
@ApiModelProperty("更新条数") @ApiModelProperty("更新条数")
private int updateCount; private int updateCount;
@ApiModelProperty("关联到已存在委托方条数(按公司名跨组织匹配到同公司名委托方,仅在 orgCode 上追加新组织,不新增委托方)")
private int linkCount;
@ApiModelProperty("跳过条数") @ApiModelProperty("跳过条数")
private int skipCount; private int skipCount;
@@ -20,15 +20,15 @@ spring:
discovery: discovery:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
config: config:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -43,3 +43,12 @@ spring:
mybatis-plus: mybatis-plus:
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign:
client:
config:
default:
connectTimeout: 10000
readTimeout: 120000
mhd-third-party-service:
connectTimeout: 10000
readTimeout: 120000
@@ -153,6 +153,13 @@
</if> </if>
limit 1 limit 1
</select> </select>
<!-- 仅根据用户登录账号查询用户(不区分组织,SSO等场景使用) -->
<select id="findByUserAccount" parameterType="java.lang.String"
resultType="com.mhd.common.core.domain.po.UserPo">
<include refid="selectUserVo"/>
and a.user_account = #{userAccount}
limit 1
</select>
<!-- 根据用户钉钉userID查询用户 --> <!-- 根据用户钉钉userID查询用户 -->
<select id="getUserByDingUserId" parameterType="java.lang.String" <select id="getUserByDingUserId" parameterType="java.lang.String"
resultType="com.mhd.common.core.domain.po.UserPo"> resultType="com.mhd.common.core.domain.po.UserPo">
@@ -264,8 +271,8 @@
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 --> <!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
<if test="organizationId != null"> <if test="organizationId != null">
<!-- 如果设置了 organizationId,添加 organization_id 条件 --> <!-- 如果设置了 organizationId,添加 organization_id 条件 -->
and a.organization_id = #{organizationId} and (a.organization_id = #{organizationId}
and a.organization_name IS NOT NULL or b.ORG_CODE like concat('%', to_char(#{organizationId}), '%'))
</if> </if>
<if test="topOrganizationId != null"> <if test="topOrganizationId != null">
<!-- 如果设置了 topOrganizationId,添加 top_organization_id 条件 --> <!-- 如果设置了 topOrganizationId,添加 top_organization_id 条件 -->
@@ -773,7 +780,13 @@
</if> </if>
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/ /*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
<if test="organizationId !=null"> <if test="organizationId !=null">
AND u.organization_id = #{organizationId} AND (
u.organization_id = #{organizationId}
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
)
AND u.organization_name IS NOT NULL AND u.organization_name IS NOT NULL
</if> </if>
GROUP BY u.user_id, u.user_name, u.user_area_address, u.user_area_county_id, u.user_area_name, u.user_phone, u.has_default_address, b.shipper_id, b.shipper_enterprise_name, u.DOCUMENT_PREPARER_NC_CODE, b.CUSTOMER_NC_CODE, u.organization_id, u.top_organization_id, b.settlement_currency GROUP BY u.user_id, u.user_name, u.user_area_address, u.user_area_county_id, u.user_area_name, u.user_phone, u.has_default_address, b.shipper_id, b.shipper_enterprise_name, u.DOCUMENT_PREPARER_NC_CODE, b.CUSTOMER_NC_CODE, u.organization_id, u.top_organization_id, b.settlement_currency
@@ -67,6 +67,7 @@
a.esign_auth_status, a.esign_auth_status,
a.esign_enterprise_status, a.esign_enterprise_status,
a.CUSTOMER_NC_CODE, a.CUSTOMER_NC_CODE,
a.org_code,
a.esign_seal_auth_id a.esign_seal_auth_id
FROM user_shipper a FROM user_shipper a
LEFT JOIN "USER" b ON a.user_id = b.user_id LEFT JOIN "USER" b ON a.user_id = b.user_id
@@ -74,7 +75,9 @@
AND b.del_flag = 1 AND b.del_flag = 1
</sql> </sql>
<sql id="selectShipperVo1"> <sql id="selectShipperVo1">
SELECT b.shipper_id, SELECT b.area,
b.detail_address,
b.shipper_id,
a.user_id, a.user_id,
b.parent_shipper_id, b.parent_shipper_id,
b.shipper_type, b.shipper_type,
@@ -171,7 +174,8 @@
b.LIMIT_TIME, b.LIMIT_TIME,
b.CREDIT_AMOUNT, b.CREDIT_AMOUNT,
b.IS_CHECK_CREDIT, b.IS_CHECK_CREDIT,
b.AGREEMENT_COUNT b.AGREEMENT_COUNT,
b.org_code
FROM "USER" a FROM "USER" a
LEFT JOIN user_shipper b ON a.user_id = b.user_id LEFT JOIN user_shipper b ON a.user_id = b.user_id
left join (select user_id, LISTAGG(DISTINCT r.role_name, '&amp;') WITHIN GROUP(ORDER BY r.role_name) AS roleName left join (select user_id, LISTAGG(DISTINCT r.role_name, '&amp;') WITHIN GROUP(ORDER BY r.role_name) AS roleName
@@ -375,7 +379,13 @@
</if> </if>
/*用户组织ID*/ /*用户组织ID*/
<if test="organizationId !=null"> <if test="organizationId !=null">
and a.organization_id = #{organizationId} AND (
a.organization_id = #{organizationId}
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
)
</if> </if>
/*组织名称*/ /*组织名称*/
<if test="organizationName != null and organizationName != ''"> <if test="organizationName != null and organizationName != ''">
@@ -511,6 +521,7 @@
</foreach> </foreach>
OR a.create_by = #{createBy}) OR a.create_by = #{createBy})
</if> </if>
</sql> </sql>
<select id="getShipperCountByMatter" parameterType="com.mhd.common.core.domain.todo.StatisticalMattersDo" <select id="getShipperCountByMatter" parameterType="com.mhd.common.core.domain.todo.StatisticalMattersDo"
@@ -620,6 +631,22 @@
AND a.organization_id = #{organizationId} AND a.organization_id = #{organizationId}
LIMIT 1 LIMIT 1
</select> </select>
<!-- 按公司名跨组织查询第一个未删除的委托方(包含 orgCode),用于 MDM 同步时按"公司名"匹配已存在委托方 -->
<select id="findFirstByShipperEnterpriseNameAcrossOrgs" resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity">
SELECT b.shipper_id,
b.user_id,
b.customer_nc_code,
b.data_source,
b.shipper_enterprise_name,
b.user_name_shipper,
b.org_code
FROM user_shipper b
WHERE b.del_flag = 1
AND b.shipper_enterprise_name = #{shipperEnterpriseName}
ORDER BY b.shipper_id ASC
LIMIT 1
</select>
<select id="getOrgNcCode" resultType="java.lang.String"> <select id="getOrgNcCode" resultType="java.lang.String">
select NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId} select NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
</select> </select>
@@ -17,6 +17,8 @@ import com.mhd.bms.domain.billManage.service.BillManageDomainService;
import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO; import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService; import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
import com.mhd.bms.domain.billingStatement.entity.BillingStatement; import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService; import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
import com.mhd.bms.domain.ncLog.entity.NcLog; import com.mhd.bms.domain.ncLog.entity.NcLog;
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper; import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
@@ -332,7 +334,10 @@ public class BillManageApplicationService {
BigDecimal billingDiscountAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal billingDiscountAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//比较传来的账单总额账单金额账单优惠金额与计算的是否一致不一致则报错 //比较传来的账单总额账单金额账单优惠金额与计算的是否一致不一致则报错
if(billingTotalAmount.compareTo(billManageDTO.getBillTotalAmount())!=0 || billingAmount.compareTo(billManageDTO.getBillAmount())!=0 || billingDiscountAmount.compareTo(billManageDTO.getBillDiscountAmount())!=0){ if(billingTotalAmount.compareTo(billManageDTO.getBillTotalAmount())!=0 || billingAmount.compareTo(billManageDTO.getBillAmount())!=0 || billingDiscountAmount.compareTo(billManageDTO.getBillDiscountAmount())!=0){
throw new ServiceException("账单金额不一致,调整失败,请重试"); // 金额不一致时用明细累加值覆盖前端传值不再抛异常
billManageDTO.setBillTotalAmount(billingTotalAmount);
billManageDTO.setBillAmount(billingAmount);
billManageDTO.setBillDiscountAmount(billingDiscountAmount);
} }
//将集合中没有计费流水id的过滤到另一个集合将添加费用的集合保存到计费流水并返回计费流水id //将集合中没有计费流水id的过滤到另一个集合将添加费用的集合保存到计费流水并返回计费流水id
List<BillDetailDTO> billDetailDTOListNoBillingStatementId = billDetailDTOList.stream().filter(billDetailDTO -> billDetailDTO.getBillingStatementId()==null).collect(Collectors.toList()); List<BillDetailDTO> billDetailDTOListNoBillingStatementId = billDetailDTOList.stream().filter(billDetailDTO -> billDetailDTO.getBillingStatementId()==null).collect(Collectors.toList());
@@ -368,7 +373,10 @@ public class BillManageApplicationService {
billManageDO.setTailCalculationCode(billManageDTO.getTailCalculationCode()); billManageDO.setTailCalculationCode(billManageDTO.getTailCalculationCode());
billManageDO.setAmountAccuracyCode(billManageDTO.getAmountAccuracyCode()); billManageDO.setAmountAccuracyCode(billManageDTO.getAmountAccuracyCode());
billManageDO.setBillDiscount(billManageDTO.getBillDiscount()); billManageDO.setBillDiscount(billManageDTO.getBillDiscount());
billManageDO.setBillRemark(billManageDTO.getBillRemark());
billManageDO.setBillDiscountLimit(billManageDTO.getBillDiscountLimit()); billManageDO.setBillDiscountLimit(billManageDTO.getBillDiscountLimit());
billManageDO.setCycleBeginTime(billManageDTO.getCycleBeginTime());
billManageDO.setCycleEndTime(billManageDTO.getCycleEndTime());
billManageDO.setCreateTime(billManageDTO.getCreateTime()); billManageDO.setCreateTime(billManageDTO.getCreateTime());
billManageDO.setUpdateTime(new Date()); billManageDO.setUpdateTime(new Date());
billManageDO.setUpdateBy(loginUser.getUserid()); billManageDO.setUpdateBy(loginUser.getUserid());
@@ -384,6 +392,191 @@ public class BillManageApplicationService {
return flag && flagTwo && three; return flag && flagTwo && three;
} }
/**
* 新增账单
*/
@Transactional
public Boolean addBill(BillManageDTO billManageDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
if (billManageDTO.getBillDetailDTOList() == null || billManageDTO.getBillDetailDTOList().size() == 0) {
throw new ServiceException("账单明细不能为空");
}
List<BillDetailDTO> billDetailDTOList = billManageDTO.getBillDetailDTOList();
//计算集合中所有账单总额账单金额账单优惠金额
BigDecimal billingTotalAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal billingAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal billingDiscountAmount = billDetailDTOList.stream().map(BillDetailDTO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//生成账单编号
String billNumber = OrderSequence.getOrderCode("ZD");
//创建账单主记录
BillManageDO billManageDO = new BillManageDO();
BeanUtils.copyProperties(billManageDTO, billManageDO);
billManageDO.setBillNumber(billNumber);
billManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
billManageDO.setBillAmount(billingAmount);
billManageDO.setBillAmountUnsettled(billingAmount);
billManageDO.setBillAmountSettlement(BigDecimal.ZERO);
billManageDO.setBillDiscountAmount(billingDiscountAmount);
billManageDO.setBillTotalAmount(billingTotalAmount);
billManageDO.setBillState(1);
billManageDO.setBillStep(1);
billManageDO.setReconciliationStatus(1);
billManageDO.setCreateTime(new Date());
billManageDO.setCreateBy(loginUser.getUserid());
billManageDO.setCreateByName(loginUser.getUserPo().getUserName());
billManageDO.setUpdateTime(new Date());
billManageDO.setUpdateBy(loginUser.getUserid());
billManageDO.setUpdateByName(loginUser.getUserPo().getUserName());
billManageDomainService.handlData(billManageDO);
Boolean flag = billManageDomainService.insert(billManageDO);
if (!flag) {
throw new ServiceException("新增账单失败");
}
// insert后按账单编号重新查一次拿自增ID
List<BillManage> insertedList = billManageDomainService.queryListLambda(
new LambdaQueryWrapper<BillManage>().eq(BillManage::getBillNumber, billNumber));
if (insertedList != null && !insertedList.isEmpty()) {
billManageDO.setBillManageId(insertedList.get(0).getBillManageId());
}
//将集合中没有计费流水id的过滤到另一个集合将添加费用的集合保存到计费流水并返回计费流水id
List<BillDetailDTO> billDetailDTOListNoBillingStatementId = billDetailDTOList.stream().filter(item -> item.getBillingStatementId() == null).collect(Collectors.toList());
//遍历集合并保存流水
for (BillDetailDTO billDetailDTO : billDetailDTOListNoBillingStatementId) {
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDTO);
billingStatementDTO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementDTO.setBillManageId(billManageDO.getBillManageId());
billingStatementDTO.setBillingState(3);
Long billingStatementId = billingStatementApplicationService.insertAndReturnId(billingStatementDTO);
//遍历billDetailDTOList集合将计费流水号相同的赋值计费流水id
billDetailDTOList.stream().filter(item -> item.getBillingFlow().equals(billDetailDTO.getBillingFlow())).forEach(item -> {
item.setBillingStatementId(billingStatementId);
item.setBillType(billManageDTO.getBillType());
item.setBillManageId(billManageDO.getBillManageId());
item.setBillNumber(billNumber);
item.setInvoiceItem(item.getFirstSubjectCode());
item.setInvoiceItemName(item.getFirstSubjectName());
item.setFeeType(item.getServiceItemsName());
});
}
//保存账单明细
Boolean flagTwo = billDetailDomainService.saveBatch(billDetailDTOList);
//保存操作记录
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
billOperationLogDO.setBillManageId(billManageDO.getBillManageId());
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billNumber, billingAmount));
billOperationLogDO.setOperationType(1);
boolean flagThree = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
return flag && flagTwo && flagThree;
}
/**
* 复制账单
*/
@Transactional
public Boolean copyBill(BillManageDTO billManageDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
if (billManageDTO.getBillManageId() == null) {
throw new ServiceException("原账单id不能为空");
}
// 1. 获取原账单信息
BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId());
if (null == originalBill) {
throw new ServiceException("原账单信息未找到");
}
// 2. 获取原账单明细
List<BillDetailPO> originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
if (originalDetails == null || originalDetails.isEmpty()) {
throw new ServiceException("原账单明细为空,无法复制");
}
// 3. 创建新账单除账单编号外完全复制原账单
String newBillNumber = OrderSequence.getOrderCode("ZD");
BillManage newBill = new BillManage();
BeanUtils.copyProperties(originalBill, newBill);
newBill.setBillManageId(null);
newBill.setBillNumber(newBillNumber);
newBill.setCreateBy(loginUser.getUserPo().getUserId());
newBill.setCreateByName(loginUser.getUserPo().getUserName());
newBill.setCreateTime(new Date());
newBill.setUpdateBy(loginUser.getUserPo().getUserId());
newBill.setUpdateByName(loginUser.getUserPo().getUserName());
newBill.setUpdateTime(new Date());
newBill.setDelFlag(1);
// 复制后重置状态字段为初始值
// 账单状态对账状态发票状态重置
newBill.setBillState(1); // 1-未确认
newBill.setBillStep(1); // 1-发起对账
newBill.setReconciliationStatus(0); // 1-暂未确认
newBill.setIsInvoice(0); // 0-未索取
// 实收=0未收=账单金额
newBill.setActualReceivedAmount(BigDecimal.ZERO);
newBill.setBillAmountUnsettled(newBill.getBillAmount());
newBill.setBillAmountSettlement(BigDecimal.ZERO);
// NC同步状态重置
newBill.setSynchronousStatus(0); // 0-未同步
newBill.setSkSynchronousStatus(0); // 0-未同步
// 清空发票收款推送相关字段
newBill.setApplyNumber(null); // 发票申请单号
newBill.setSettlementTime(null); // 收款时间
newBill.setSynchronousTime(null); // 应收单推送时间
newBill.setSkSynchronousTime(null); // 收款单推送时间
newBill.setInvoiceId(null); // 发票表ID
newBill.setInvoiceMakeTime(null); // 开票时间
newBill.setNcId(null); // nc唯一标识应收
newBill.setSkNcId(null); // nc唯一标识收款
// 保存新账单
boolean flag = billManageDomainService.saveEntity(newBill);
if (!flag) {
throw new ServiceException("复制账单失败,请重试");
}
// 4. 复制账单明细
List<BillDetail> newDetailList = new ArrayList<>();
for (BillDetailPO originalDetail : originalDetails) {
BillDetail newDetail = new BillDetail();
BeanUtils.copyProperties(originalDetail, newDetail);
newDetail.setBillDetailId(null);
newDetail.setBillManageId(newBill.getBillManageId());
newDetail.setBillNumber(newBillNumber);
newDetail.setCreateBy(loginUser.getUserPo().getUserId());
newDetail.setCreateByName(loginUser.getUserPo().getUserName());
newDetail.setCreateTime(new Date());
newDetailList.add(newDetail);
}
Boolean flagTwo = billDetailDomainService.insertBatch(newDetailList);
// 5. 复制计费流水billing_statement
List<BillingStatementPO> originalStatements = billingStatementDomainService.getDetailsByManageId(billManageDTO.getBillManageId());
boolean flagThree = true;
if (originalStatements != null && !originalStatements.isEmpty()) {
List<BillingStatement> newStatementList = new ArrayList<>();
for (BillingStatementPO originalStatement : originalStatements) {
BillingStatement newStatement = new BillingStatement();
BeanUtils.copyProperties(originalStatement, newStatement);
newStatement.setBillingStatementId(null);
newStatement.setBillManageId(newBill.getBillManageId());
newStatement.setCreateBy(loginUser.getUserPo().getUserId());
newStatement.setCreateByName(loginUser.getUserPo().getUserName());
newStatement.setCreateTime(new Date());
newStatementList.add(newStatement);
}
flagThree = billingStatementDomainService.saveEntityBatch(newStatementList);
}
// 6. 保存操作日志
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
billOperationLogDO.setBillManageId(newBill.getBillManageId());
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.copy_bill_text, originalBill.getBillNumber(), newBillNumber));
billOperationLogDO.setOperationType(1);
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
return flag && flagTwo && flagThree && three;
}
/** /**
* 应收账单-客户确认 * 应收账单-客户确认
*/ */
@@ -563,6 +756,76 @@ public class BillManageApplicationService {
return billManageDomainService.synchronousNcSK(businessDocumentDetaliIds); return billManageDomainService.synchronousNcSK(businessDocumentDetaliIds);
} }
/**
* 修改账单明细
*/
@Transactional
public Boolean updateBillDetail(BillManageDTO billManageDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
BillDetailDTO detailDTO = billManageDTO.getBillDetailDTOList() != null && !billManageDTO.getBillDetailDTOList().isEmpty()
? billManageDTO.getBillDetailDTOList().get(0) : null;
if (detailDTO == null || detailDTO.getBillDetailId() == null) {
throw new ServiceException("明细id不能为空");
}
BillDetailPO billDetailPO = billDetailDomainService.getInfo(detailDTO.getBillDetailId());
if (billDetailPO == null) {
throw new ServiceException("明细不存在");
}
BillManagePO billManagePO = billManageDomainService.getInfo(billDetailPO.getBillManageId());
if (billManagePO == null || billManagePO.getBillState() != 1) {
throw new ServiceException("账单状态不为未确认,不可修改明细");
}
BillDetailDO billDetailDO = new BillDetailDO();
BeanUtils.copyProperties(detailDTO, billDetailDO);
billDetailDO.setBillDetailId(detailDTO.getBillDetailId());
billDetailDO.setInvoiceItem(detailDTO.getFirstSubjectCode());
billDetailDO.setInvoiceItemName(detailDTO.getFirstSubjectName());
billDetailDO.setFeeType(detailDTO.getServiceItemsName());
billDetailDO.setUpdateBy(loginUser.getUserid());
billDetailDO.setUpdateByName(loginUser.getUserPo().getUserName());
billDetailDO.setUpdateTime(new Date());
// 同步更新计费流水的费用科目服务项因为这些字段在 billing_statement 不在 bill_detail
if (billDetailPO.getBillingStatementId() != null) {
BillingStatementDO billingStatementDO = new BillingStatementDO();
billingStatementDO.setBillingStatementId(billDetailPO.getBillingStatementId());
billingStatementDO.setFirstSubjectCode(detailDTO.getFirstSubjectCode());
billingStatementDO.setFirstSubjectName(detailDTO.getFirstSubjectName());
billingStatementDO.setServiceItemsCode(detailDTO.getServiceItemsCode());
billingStatementDO.setServiceItemsName(detailDTO.getServiceItemsName());
billingStatementDO.setUpdateBy(loginUser.getUserid());
billingStatementDO.setUpdateByName(loginUser.getUserPo().getUserName());
billingStatementDO.setUpdateTime(new Date());
billingStatementApplicationService.update(billingStatementDO);
}
Boolean flag = billDetailDomainService.update(billDetailDO);
// 重新计算账单总金额并更新主表
List<BillDetailPO> allDetails = billDetailDomainService.getDetailsByBillManageId(billManagePO.getBillManageId());
allDetails = allDetails.stream().map(item -> {
if (item.getBillDetailId().equals(detailDTO.getBillDetailId())) {
item.setBillingTotalAmount(detailDTO.getBillingTotalAmount());
item.setBillingAmount(detailDTO.getBillingAmount());
item.setBillingDiscountAmount(detailDTO.getBillingDiscountAmount());
}
return item;
}).collect(Collectors.toList());
BigDecimal totalAmount = allDetails.stream().map(BillDetailPO::getBillingTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal amount = allDetails.stream().map(BillDetailPO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal discountAmount = allDetails.stream().map(BillDetailPO::getBillingDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BillManageDO billManageDO = new BillManageDO();
billManageDO.setBillManageId(billManagePO.getBillManageId());
billManageDO.setBillTotalAmount(totalAmount);
billManageDO.setBillAmount(amount);
billManageDO.setBillAmountUnsettled(amount);
billManageDO.setBillDiscountAmount(discountAmount);
billManageDO.setUpdateBy(loginUser.getUserid());
billManageDO.setUpdateByName(loginUser.getUserPo().getUserName());
billManageDO.setUpdateTime(new Date());
Boolean flagTwo = billManageDomainService.update(billManageDO);
return flag && flagTwo;
}
} }
@@ -598,6 +598,9 @@ public class BillingStatementApplicationService {
billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId()); billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId()); billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName()); billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
// 默认填充当前登录人为业务员
billingStatementPO.setSalesmanId(String.valueOf(loginUser.getUserid()));
billingStatementPO.setSalesmanName(loginUser.getUserPo().getUserName());
return billingStatementPO; return billingStatementPO;
} }
@@ -7,10 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService; import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService;
import com.mhd.bms.application.server.settlementCustomers.SettlementCustomersApplicationService; import com.mhd.bms.application.server.settlementCustomers.SettlementCustomersApplicationService;
import com.mhd.bms.domain.billManage.entity.BillDetail;
import com.mhd.bms.domain.billManage.entity.BillManage;
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
import com.mhd.bms.domain.billingRules.repository.po.BillingParamsPO; import com.mhd.bms.domain.billingRules.repository.po.BillingParamsPO;
import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO; import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
import com.mhd.bms.domain.billingStatement.repository.mapper.BillingStatementMapper;
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService; import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
import com.mhd.bms.domain.businessDocument.entity.BusinessDocument; import com.mhd.bms.domain.businessDocument.entity.BusinessDocument;
import com.mhd.bms.domain.businessDocument.repository.mapper.BusinessDocumentMapper;
import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO; import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
import com.mhd.bms.domain.businessDocument.repository.todo.BusinessDocumentDO; import com.mhd.bms.domain.businessDocument.repository.todo.BusinessDocumentDO;
import com.mhd.bms.domain.businessDocument.service.BusinessDocumentDomainService; import com.mhd.bms.domain.businessDocument.service.BusinessDocumentDomainService;
@@ -30,6 +38,7 @@ import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO; import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
import com.mhd.bms.interfaces.assembler.businessDocument.BusinessDocumentAssembler; import com.mhd.bms.interfaces.assembler.businessDocument.BusinessDocumentAssembler;
import com.mhd.bms.interfaces.dto.billingRules.CostCalculationDTO; import com.mhd.bms.interfaces.dto.billingRules.CostCalculationDTO;
import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
import com.mhd.bms.interfaces.dto.businessDocument.BusinessDocumentDTO; import com.mhd.bms.interfaces.dto.businessDocument.BusinessDocumentDTO;
import com.mhd.common.core.domain.dto.BusinessDataPushDTO; import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
import com.mhd.common.core.domain.po.OrganizationPo; import com.mhd.common.core.domain.po.OrganizationPo;
@@ -86,6 +95,14 @@ public class BusinessDocumentApplicationService {
private CostCalculationApplicationService costCalculationApplicationService; private CostCalculationApplicationService costCalculationApplicationService;
@Autowired @Autowired
private ISettlementCustomersService settlementCustomersService; private ISettlementCustomersService settlementCustomersService;
@Autowired
private BusinessDocumentMapper businessDocumentMapper;
@Autowired
private BillingStatementMapper billingStatementMapper;
@Autowired
private IBillManageService billManageService;
@Autowired
private IBillDetailService billDetailService;
/** /**
@@ -202,6 +219,123 @@ public class BusinessDocumentApplicationService {
return businessDocumentDomainService.insert(businessDocumentDO); return businessDocumentDomainService.insert(businessDocumentDO);
} }
@Transactional(rollbackFor = Exception.class)
public Boolean manageAddFee(BusinessDocumentDO businessDocumentDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
//先设置组织信息因为handleDate方法中需要使用topOrganizationId
businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
businessDocumentDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
businessDocumentDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
UserPo userPo = loginUser.getUserPo();
businessDocumentDO.setCreateBy(userPo.getUserId());
businessDocumentDO.setCreateByName(userPo.getUserName());
//校验使用的表单是否必填校验
checkDoucumentType(businessDocumentDO);
//处理数据
handleDate(businessDocumentDO);
businessDocumentDO.setDataSources(2);
businessDocumentDO.setBusinessFlow(OrderSequence.getOrderCode("LS"));
//调用费用计算计算费用金额进行保存
CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
costCalculationDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
costCalculationDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
costCalculationDTO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
BillingRulesPO billingRulesPO = billingCostPo.getBillingRulesPO();
List<BillingParamsPO> billingParamsPOList = billingRulesPO.getBillingParamsPOList();
if (ObjectUtil.isNotNull(billingParamsPOList)&&billingParamsPOList.size()>0) {
BillingParamsPO billingParamsPO = billingParamsPOList.get(0);
String billingParamsJson = billingParamsPO.getBillingParamsJson();
String preSetRules = billingParamsPO.getPreSetRules();
String documentFormJson = businessDocumentDO.getDocumentFormJson();
JSONObject paramObj = JSONObject.parseObject(documentFormJson);
List<BillingParamsEntity> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsEntity.class);
for (BillingParamsEntity billingParamsEntity : billingParamsEntityList) {
String isFee = billingParamsEntity.getIsFee();
String fields = billingParamsEntity.getFields();
// 安全获取值并转 BigDecimal不会报错
BigDecimal value = getSafeBigDecimal(paramObj, fields);
if ("1".equals(isFee)) {
businessDocumentDO.setBillingUnitPrice(value.setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
businessDocumentDO.setBillingNum(value.setScale(2, BigDecimal.ROUND_HALF_UP));
}
}
}
BusinessDocument businessDocument = businessDocumentDomainService.insertRetrun(businessDocumentDO);
BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO();
businessDocumentDTO.setBusinessDocumentIds(businessDocument.getBusinessDocumentId().toString());
businessDocumentDTO.setAuditOperation(1);
takeEffectByIds(businessDocumentDTO);
auditByIds(businessDocumentDTO);
List<BillingStatement> billingStatements = billingStatementMapper.selectList(new LambdaQueryWrapper<BillingStatement>()
.eq(BillingStatement::getBusinessDocumentId, businessDocument.getBusinessDocumentId())
.eq(BillingStatement::getDelFlag, 1));
BillingStatement billingStatement = null;
if (ObjectUtil.isNotNull(billingStatements)&&billingStatements.size()>0) {
billingStatement = billingStatements.get(0);
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(billingStatement.getBillingStatementId().toString());
billingStatementDTO.setAuditOperation(1);
billingStatementDomainService.reviewBilling(billingStatementDTO);
billingStatement.setBillManageId(businessDocumentDO.getBillManageId());
billingStatement.setBillingState(3);
billingStatementMapper.updateById(billingStatement);
}
BillManage billManage = billManageService.getById(businessDocumentDO.getBillManageId());
BillDetail billDetail = new BillDetail();
billDetail.setBillManageId(businessDocumentDO.getBillManageId());
billDetail.setBillNumber(billManage.getBillNumber());
billDetail.setBillingStatementId(billingStatement.getBillingStatementId());
billDetail.setBillingFlow(billingStatement.getBillingFlow());
billDetail.setOrganizationId(billManage.getOrganizationId());
billDetail.setOrganizationName(billManage.getOrganizationName());
billDetail.setTopOrganizationId(billManage.getTopOrganizationId());
billDetail.setCreateBy(userPo.getUserId());
billDetail.setCreateByName(userPo.getUserName());
billDetail.setCreateTime(new Date());
billDetail.setDelFlag(1);
billDetail.setBillingTotalAmount(billingStatement.getBillingAmount());
billDetail.setBillingDiscountAmount(BigDecimal.ZERO);
billDetail.setBillingAmount(billingStatement.getBillingAmount());
billDetail.setBillType(1);
billDetail.setBillingExpectedAmount(BigDecimal.ZERO);
billDetail.setFeeType(billingStatement.getServiceItemsName());
billDetail.setInvoiceItem(billingStatement.getFirstSubjectCode());
billDetail.setInvoiceItemName(billingStatement.getFirstSubjectName());
billDetail.setSettlementCurrency(billingStatement.getSettlementCurrency());
billDetail.setTaxAmount(billingStatement.getTaxAmount());
billDetail.setTaxFreeFee(billingStatement.getTaxFreeFee());
billDetail.setTaxRate(billingStatement.getTaxRate());
billDetailService.save(billDetail);
BigDecimal billAmount = billManage.getBillAmount();
BigDecimal amount = billAmount.add(billDetail.getBillingAmount());
billManage.setBillAmount(amount);
billManage.setBillTotalAmount(amount);
BigDecimal billTotalAmount = billManage.getBillTotalAmount();
BigDecimal billAmountSettlement = billManage.getBillAmountSettlement();
BigDecimal subtract = billTotalAmount.subtract(billAmountSettlement);
billManage.setBillAmountUnsettled(subtract);
BigDecimal taxAmount = billManage.getTaxAmount();
billManage.setTaxAmount(taxAmount.add(billDetail.getTaxAmount()));
BigDecimal taxFreeFee = billManage.getTaxFreeFee();
billManage.setTaxFreeFee(taxFreeFee.add(billDetail.getTaxFreeFee()));
billManageService.updateById(billManage);
return true;
}
/** /**
* JSONObject 安全获取 BigDecimal支持 * JSONObject 安全获取 BigDecimal支持
* 数字整数字符串小数字符串null空字符串 * 数字整数字符串小数字符串null空字符串
@@ -484,7 +618,7 @@ public class BusinessDocumentApplicationService {
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){ if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
contractType = 1; contractType = 1;
} }
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndOrganizationId(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId()); AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndSecondSubjectCode(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getFirstSubjectCode() != null ?businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode(),businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))) { if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("合同信息未找到"); throw new ServiceException("合同信息未找到");
} }
@@ -492,6 +626,10 @@ public class BusinessDocumentApplicationService {
if (null == contractPO) { if (null == contractPO) {
throw new ServiceException("合同信息未找到"); throw new ServiceException("合同信息未找到");
} }
String isMany = contractPO.getIsMany();
if ("1".equals(isMany)) {
throw new ServiceException("存在多条相同费用科目的合同,请检查");
}
businessDocumentDO.setContractName(contractPO.getContractName()); businessDocumentDO.setContractName(contractPO.getContractName());
businessDocumentDO.setContractNumber(contractPO.getContractNumber()); businessDocumentDO.setContractNumber(contractPO.getContractNumber());
} }
@@ -25,6 +25,8 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId); String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getCustomerCodeNcJson(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId); String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
String getsalespersonNcCode(@Param("salesmanId") String salesmanId); String getsalespersonNcCode(@Param("salesmanId") String salesmanId);
@@ -1,9 +1,13 @@
package com.mhd.bms.domain.billManage.repository.persistence; package com.mhd.bms.domain.billManage.repository.persistence;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mhd.bms.domain.billManage.entity.BillManage; import com.mhd.bms.domain.billManage.entity.BillManage;
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService; import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
@@ -66,6 +70,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 账单管理Service业务层处理 * 账单管理Service业务层处理
@@ -211,6 +216,26 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> listNc = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (listNc != null && listNc.size() > 0) {
Map<String, Object> targetMap = listNc.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String settlementCurrency=reconciliation.getSettlementCurrency(); String settlementCurrency=reconciliation.getSettlementCurrency();
String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId); String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
@@ -436,6 +461,10 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
reconciliation.setSynchronousStatus(2); reconciliation.setSynchronousStatus(2);
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -490,7 +519,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
if (ncUrl!=null&&ncUrl!="") { if (ncUrl!=null&&ncUrl!="") {
url = ncUrl; url = ncUrl;
} else { } else {
reconciliation.setSynchronousStatus(2); reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
throw new ServiceException("未找到该组织的推送地址!"); throw new ServiceException("未找到该组织的推送地址!");
} }
@@ -528,6 +557,26 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> listNc = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (listNc != null && listNc.size() > 0) {
Map<String, Object> targetMap = listNc.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
String settlementCurrency=reconciliation.getSettlementCurrency(); String settlementCurrency=reconciliation.getSettlementCurrency();
String settlementCurrencyNcCode = settlementCurrency; String settlementCurrencyNcCode = settlementCurrency;
@@ -702,7 +751,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
response.close(); response.close();
} catch (Exception e) { } catch (Exception e) {
reconciliation.setSynchronousStatus(2); reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@@ -715,13 +764,17 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
} }
} else { } else {
reconciliation.setSynchronousStatus(2); reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
} }
} catch (JAXBException e) { } catch (JAXBException e) {
reconciliation.setSynchronousStatus(2); reconciliation.setSkSynchronousStatus(2);
billManageMapper.updateById(reconciliation); billManageMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -94,6 +94,13 @@ public class BillManageDomainService {
return billManageService.insert(billManageDO); return billManageService.insert(billManageDO);
} }
/**
* 直接保存账单管理实体
*/
public boolean saveEntity(BillManage billManage) {
return billManageService.save(billManage);
}
/** /**
* 修改账单管理 * 修改账单管理
*/ */
@@ -119,6 +119,13 @@ public class BillingStatementDomainService {
return billingStatementService.getInfo(billingStatementId); return billingStatementService.getInfo(billingStatementId);
} }
/**
* 批量保存计费流水实体
*/
public boolean saveEntityBatch(List<BillingStatement> list) {
return billingStatementService.saveBatch(list);
}
/** /**
* 批量审核 * 批量审核
*/ */
@@ -668,6 +675,9 @@ public class BillingStatementDomainService {
*/ */
public List<BillingStatementPO> getBillDetailsList(BillingStatementDO billingStatementDO) { public List<BillingStatementPO> getBillDetailsList(BillingStatementDO billingStatementDO) {
//查询当前账单的五大信息组织信息结算对象来源系统收支类型账单周期 //查询当前账单的五大信息组织信息结算对象来源系统收支类型账单周期
if (billingStatementDO.getBillManageId() == null || billingStatementDO.getBillManageId() <= 0) {
return new ArrayList<>();
}
BillManagePO billManagePO = billManageDomainService.getInfo(billingStatementDO.getBillManageId()); BillManagePO billManagePO = billManageDomainService.getInfo(billingStatementDO.getBillManageId());
if(null == billManagePO){ if(null == billManagePO){
throw new ServiceException("账单信息未找到"); throw new ServiceException("账单信息未找到");
@@ -675,8 +685,8 @@ public class BillingStatementDomainService {
billingStatementDO.setSettlementCustomersCode(billManagePO.getSettlementCustomersCode()); billingStatementDO.setSettlementCustomersCode(billManagePO.getSettlementCustomersCode());
billingStatementDO.setBelongModuleCode(billManagePO.getBelongModuleCode()); billingStatementDO.setBelongModuleCode(billManagePO.getBelongModuleCode());
billingStatementDO.setAccountExpenseType(billManagePO.getBillType()); billingStatementDO.setAccountExpenseType(billManagePO.getBillType());
billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime()); // billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime());
billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime()); // billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime());
billingStatementDO.setBillingState(2); billingStatementDO.setBillingState(2);
startPage(); startPage();
return billingStatementService.queryList(billingStatementDO); return billingStatementService.queryList(billingStatementDO);
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.bms.domain.billManage.entity.BillManage; import com.mhd.bms.domain.billManage.entity.BillManage;
import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper; import com.mhd.bms.domain.billManage.repository.mapper.BillManageMapper;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsInvoiceList; import com.mhd.bms.domain.bmsInvoiceList.entity.BmsInvoiceList;
import com.mhd.bms.domain.bmsInvoiceList.entity.BmsSettlementPartyInvoice; import com.mhd.bms.domain.bmsInvoiceList.entity.BmsSettlementPartyInvoice;
import com.mhd.bms.domain.bmsInvoiceList.repository.facade.IBmsInvoiceListService; import com.mhd.bms.domain.bmsInvoiceList.repository.facade.IBmsInvoiceListService;
@@ -56,6 +57,8 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper; private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
@Resource @Resource
private BillManageMapper billManageMapper; private BillManageMapper billManageMapper;
@Resource
private com.mhd.system.api.SystemServiceFeign systemServiceFeign;
/*@Resource /*@Resource
private BmsSettlementPartyInvoiceMapper bmsSettlementPartyInvoiceMapper;*/ private BmsSettlementPartyInvoiceMapper bmsSettlementPartyInvoiceMapper;*/
@@ -327,7 +330,7 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
/** /**
* 发票详情 * 发票详情
* *
* @param id * @param
* @return * @return
*/ */
@Override @Override
@@ -415,6 +418,23 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId()); bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId());
//bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId()); //bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId());
bmsMakeOutInvoiceItem.setCreateTime(date); bmsMakeOutInvoiceItem.setCreateTime(date);
// 如果前端没传 invoiceItemName invoiceItem编码从费用科目反查名称补齐
if (StringUtils.isEmpty(bmsMakeOutInvoiceItem.getInvoiceItemName())
&& StringUtils.isNotEmpty(bmsMakeOutInvoiceItem.getInvoiceItem())) {
try {
AjaxResult ajaxResult = systemServiceFeign.getSubInfoByCode(bmsMakeOutInvoiceItem.getInvoiceItem());
if ("200".equals(String.valueOf(ajaxResult.get("code"))) && ajaxResult.get("data") != null) {
com.alibaba.fastjson.JSONObject dataObj = com.alibaba.fastjson.JSON.parseObject(
com.alibaba.fastjson.JSON.toJSONString(ajaxResult.get("data")));
String subjectName = dataObj.getString("subjectName");
if (StringUtils.isNotEmpty(subjectName)) {
bmsMakeOutInvoiceItem.setInvoiceItemName(subjectName);
}
}
} catch (Exception e) {
log.warn("开票项目名称反查失败 invoiceItem=" + bmsMakeOutInvoiceItem.getInvoiceItem() + " " + e.getMessage());
}
}
bmsMakeOutInvoiceItemMapper.insert(bmsMakeOutInvoiceItem); bmsMakeOutInvoiceItemMapper.insert(bmsMakeOutInvoiceItem);
} }
} }
@@ -218,4 +218,6 @@ public class BusinessDocumentDO extends BaseVOEntity{
private BigDecimal billingUnitPrice; private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码") @ApiModelProperty("nc科目编码")
private String ncSubjectCode; private String ncSubjectCode;
private Long billManageId;
} }
@@ -96,4 +96,12 @@ public class BillLogsConstants
public static final String payment_bill_text = "付款单号:{},付款金额:{}元"; public static final String payment_bill_text = "付款单号:{},付款金额:{}元";
/**
* 复制账单
* 原账单编号{}新账单编号{}
*/
public static final String copy_bill_title = "复制账单";
public static final String copy_bill_text = "原账单编号:{},新账单编号:{}";
} }
@@ -169,4 +169,6 @@ public class ContractManagePO extends BaseVOEntity{
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)") @ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType; private Integer principalType;
private String isMany;
} }
@@ -213,4 +213,6 @@ public class BusinessDocumentDTO extends BaseVOEntity{
private String paymentAccountId; private String paymentAccountId;
@ApiModelProperty("收款帐户名称") @ApiModelProperty("收款帐户名称")
private String paymentAccountName; private String paymentAccountName;
private Long billManageId;
} }
@@ -229,6 +229,51 @@ public class BillManageApi extends BaseController{
} }
@ApiOperation("修改账单明细")
@PostMapping("/updateBillDetail")
public AjaxResult updateBillDetail(@RequestBody BillManageDTO billManageDTO)
{
try {
billManageApplicationService.updateBillDetail(billManageDTO);
return AjaxResult.success("操作成功");
}catch (Exception e){
return AjaxResult.error("修改明细失败:"+e.getMessage());
}
}
@ApiOperation("新增账单")
@PostMapping("/addBill")
public AjaxResult addBill(@RequestBody BillManageDTO billManageDTO)
{
if(billManageDTO.getBillDetailDTOList() == null || billManageDTO.getBillDetailDTOList().size() == 0){
throw new ServiceException("账单明细不能为空");
}
try {
billManageApplicationService.addBill(billManageDTO);
return AjaxResult.success("操作成功");
}catch (Exception e){
return AjaxResult.error("新增账单失败:"+e.getMessage());
}
}
@ApiOperation("复制账单")
@PostMapping("/copyBill")
public AjaxResult copyBill(@RequestBody BillManageDTO billManageDTO)
{
if(billManageDTO.getBillManageId() == null){
throw new ServiceException("原账单id不能为空");
}
try {
Boolean result = billManageApplicationService.copyBill(billManageDTO);
return toAjax(result);
}catch (Exception e){
return AjaxResult.error("复制账单失败:"+e.getMessage());
}
}
@ApiOperation("应收账单-客户确认") @ApiOperation("应收账单-客户确认")
@PostMapping("/customerConfirmation") @PostMapping("/customerConfirmation")
public AjaxResult customerConfirmation(@RequestBody BillManageDTO billManageDTO) public AjaxResult customerConfirmation(@RequestBody BillManageDTO billManageDTO)
@@ -79,6 +79,25 @@ public class BusinessDocumentApi extends BaseController{
} }
/**
* 保存业务单据
*/
@ApiOperation("账单添加费用")
@PostMapping("/manageAddFee")
public AjaxResult manageAddFee(@RequestBody BusinessDocumentDTO businessDocumentDTO)
{
try {
//转换实体
BusinessDocumentDO businessDocumentDO = businessDocumentAssembler.toDO(businessDocumentDTO);
return toAjax(businessDocumentApplicationService.manageAddFee(businessDocumentDO));
} catch (ServiceException e) {
return AjaxResult.error(e.getMessage());
} catch (Exception e){
return AjaxResult.error("保存业务单据失败:" + e.getMessage());
}
}
/** /**
* 保存业务单据 * 保存业务单据
+4 -4
View File
@@ -18,15 +18,15 @@ spring:
discovery: discovery:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
config: config:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -118,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1 SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select> </select>
<select id="getCustomerCodeNcJson" parameterType="java.lang.String" resultType="java.lang.String">
SELECT ORG_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select>
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String"> <select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1 SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
</select> </select>
@@ -92,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="documentTypeDO.organizationId != null"> <if test="documentTypeDO.organizationId != null">
and organization_id = #{documentTypeDO.organizationId} and organization_id = #{documentTypeDO.organizationId}
</if> </if>
<if test="documentTypeDO.belongModuleCode != null and documentTypeDO.belongModuleCode != ''">
and BELONG_MODULE_CODE = #{documentTypeDO.belongModuleCode}
</if>
</sql> </sql>
</mapper> </mapper>
@@ -198,7 +198,13 @@
and a.main_role = #{settlementCustomersDO.mainRole} and a.main_role = #{settlementCustomersDO.mainRole}
</if> </if>
<if test="settlementCustomersDO.organizationId != null"> <if test="settlementCustomersDO.organizationId != null">
and a.organization_id = #{settlementCustomersDO.organizationId} AND (
a.organization_id = #{settlementCustomersDO.organizationId}
OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%')
OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%')
OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%')
OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%')
)
</if> </if>
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''"> <if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
and a.top_organization_id = #{settlementCustomersDO.topOrganizationId} and a.top_organization_id = #{settlementCustomersDO.topOrganizationId}
@@ -209,7 +209,7 @@ public class ReconciliationApplicationService {
reconciliationPO.setSettlementCurrency(tmsOrder.getSettlementCurrency()); reconciliationPO.setSettlementCurrency(tmsOrder.getSettlementCurrency());
} }
if (reconciliationPO.getSettlementCurrency() != null){ if (reconciliationPO.getSettlementCurrency() != null){
String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency())); String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency()),reconciliationPO.getOrganizationId());
reconciliationPO.setSettlementCurrencyName(s); reconciliationPO.setSettlementCurrencyName(s);
} }
} }
@@ -39,9 +39,11 @@ public interface ReconciliationMapper extends BaseMapper<Reconciliation>
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId); String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getCustomerCodeNcJson(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId); String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency); String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency, @Param("organizationId") Long organizationId);
String getServiceItemsCodeNc(@Param("name") String name); String getServiceItemsCodeNc(@Param("name") String name);
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.linke.finance.domain.approvalDocument.entity.ApprovalDocument; import com.linke.finance.domain.approvalDocument.entity.ApprovalDocument;
import com.linke.finance.domain.approvalDocument.repository.mapper.ApprovalDocumentMapper; import com.linke.finance.domain.approvalDocument.repository.mapper.ApprovalDocumentMapper;
@@ -725,6 +727,26 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> list = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (list != null && list.size() > 0) {
Map<String, Object> targetMap = list.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String settlementCurrency=order.getSettlementCurrency(); String settlementCurrency=order.getSettlementCurrency();
String salesmanId = order.getSalesmanId(); String salesmanId = order.getSalesmanId();
String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId); String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId);
@@ -732,7 +754,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String deptName = reconciliationMapper.getDeptName(customerUserDept); String deptName = reconciliationMapper.getDeptName(customerUserDept);
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
makerCodeNc= documentPreparerNcCode; makerCodeNc= documentPreparerNcCode;
String settlementCurrencyNcCode = settlementCurrency; String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
String invoiceNumber=make.getInvoiceNumber(); String invoiceNumber=make.getInvoiceNumber();
R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make); R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make);
if (itemR.getCode()==200) { if (itemR.getCode()==200) {
@@ -952,6 +974,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
reconciliation.setSynchronousStatus(2); reconciliation.setSynchronousStatus(2);
reconciliationMapper.updateById(reconciliation); reconciliationMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -1008,6 +1034,27 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> list = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (list != null && list.size() > 0) {
Map<String, Object> targetMap = list.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String settlementCurrency=order.getSettlementCurrency(); String settlementCurrency=order.getSettlementCurrency();
String salesmanId = order.getSalesmanId(); String salesmanId = order.getSalesmanId();
String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId); String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId);
@@ -1015,7 +1062,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String deptName = reconciliationMapper.getDeptName(customerUserDept); String deptName = reconciliationMapper.getDeptName(customerUserDept);
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
makerCodeNc= documentPreparerNcCode; makerCodeNc= documentPreparerNcCode;
String settlementCurrencyNcCode = settlementCurrency; String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
String invoiceNumber=make.getInvoiceNumber(); String invoiceNumber=make.getInvoiceNumber();
R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make); R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make);
if (itemR.getCode()==200) { if (itemR.getCode()==200) {
@@ -1235,6 +1282,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
reconciliation.setSynchronousStatus(2); reconciliation.setSynchronousStatus(2);
reconciliationMapper.updateById(reconciliation); reconciliationMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -1560,9 +1611,29 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> listNc = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (listNc != null && listNc.size() > 0) {
Map<String, Object> targetMap = listNc.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
String settlementCurrency=order.getSettlementCurrency(); String settlementCurrency=order.getSettlementCurrency();
String settlementCurrencyNcCode = settlementCurrency; String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
makerCodeNc=documentPreparerNcCode; makerCodeNc=documentPreparerNcCode;
SKitem item=new SKitem(); SKitem item=new SKitem();
if (deptValue != null && !deptValue.isEmpty()) { if (deptValue != null && !deptValue.isEmpty()) {
@@ -1759,6 +1830,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
reconciliation.setSynchronousStatus(2); reconciliation.setSynchronousStatus(2);
reconciliationMapper.updateById(reconciliation); reconciliationMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -1844,9 +1919,29 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
String appointShipper=make.getActualInvoiceCustomerName(); String appointShipper=make.getActualInvoiceCustomerName();
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId(); String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId); String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
List<Map<String, Object>> listNc = objectMapper.readValue(
customerCodeNcJson,
new TypeReference<List<Map<String, Object>>>() {}
);
if (listNc != null && listNc.size() > 0) {
Map<String, Object> targetMap = listNc.stream()
.filter(map -> {
Object codeObj = map.get("code");
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
})
.findFirst()
.orElse(null);
if (targetMap != null) {
customerCodeNc = (String) targetMap.get("ncCustomer");
}
}
}
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId); String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
String settlementCurrency=order.getSettlementCurrency(); String settlementCurrency=order.getSettlementCurrency();
String settlementCurrencyNcCode = settlementCurrency; String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
makerCodeNc=documentPreparerNcCode; makerCodeNc=documentPreparerNcCode;
@@ -2046,6 +2141,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
reconciliation.setSynchronousStatus(2); reconciliation.setSynchronousStatus(2);
reconciliationMapper.updateById(reconciliation); reconciliationMapper.updateById(reconciliation);
e.printStackTrace(); e.printStackTrace();
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
} }
return true; return true;
} }
@@ -20,5 +20,5 @@ public interface TmsReceiptMapper extends BaseMapper<TmsReceipt>
*/ */
public List<TmsReceiptPO> queryList(TmsReceiptDO tmsReceiptDO); public List<TmsReceiptPO> queryList(TmsReceiptDO tmsReceiptDO);
String selectCnName(@Param("settlementCount") String settlementCount); String selectCnName(@Param("settlementCount") String settlementCount,@Param("organizationId") Long organizationId);
} }
+4 -4
View File
@@ -20,15 +20,15 @@ spring:
discovery: discovery:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
config: config:
# server-addr: 127.0.0.1:8848 # server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号 # 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010 # server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.31:6848 server-addr: 10.102.192.30:6848
username: nacos username: nacos
password: manhuoda@2023 password: manhuoda@2023
#线上正式环境 #线上正式环境
@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and a.inner_number like concat('%', #{innerNumber}, '%') and a.inner_number like concat('%', #{innerNumber}, '%')
</if> </if>
<if test="partyName != null and partyName != ''"> <if test="partyName != null and partyName != ''">
and a.inner_number like concat('%', #{partyName}, '%') and a.party_name like concat('%', #{partyName}, '%')
</if> </if>
<if test="billRemark != null and billRemark != ''"> <if test="billRemark != null and billRemark != ''">
and a.bill_remark like concat('%', #{billRemark}, '%') and a.bill_remark like concat('%', #{billRemark}, '%')
@@ -373,12 +373,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1 SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select> </select>
<select id="getCustomerCodeNcJson" parameterType="java.lang.String" resultType="java.lang.String">
SELECT ORG_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
</select>
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String"> <select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1 SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
</select> </select>
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String"> <select id="getSettlementCurrencyNcCode" resultType="java.lang.String">
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1 SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE"
where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency}
<if test="organizationId != null">
and ORGANIZATION_ID = #{organizationId}
</if>
limit 1
</select> </select>
<select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String"> <select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
@@ -123,6 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTmsReceiptPo1"/> <include refid="selectTmsReceiptPo1"/>
</select> </select>
<select id="selectCnName" resultType="java.lang.String"> <select id="selectCnName" resultType="java.lang.String">
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} and ORGANIZATION_ID = #{organizationId} limit 1
</select> </select>
</mapper> </mapper>
@@ -25,6 +25,7 @@ import com.mhd.oms.domain.gwLog.entity.GwLog;
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper; import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.domain.documentPushMaterialRecord.entity.DocumentPushMaterialRecord; import com.mhd.oms.domain.documentPushMaterialRecord.entity.DocumentPushMaterialRecord;
import com.mhd.oms.domain.documentPushMaterialRecord.repository.mapper.DocumentPushMaterialRecordMapper; import com.mhd.oms.domain.documentPushMaterialRecord.repository.mapper.DocumentPushMaterialRecordMapper;
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO; import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO; import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO;
import com.mhd.system.api.model.LoginUser; import com.mhd.system.api.model.LoginUser;
@@ -42,6 +43,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@@ -93,6 +95,8 @@ public class BusinessDocumentOrderApplicationService {
@Resource @Resource
private DocumentPushMaterialRecordMapper documentPushMaterialRecordMapper; private DocumentPushMaterialRecordMapper documentPushMaterialRecordMapper;
/** /**
* 分页查询请填写功能名称列表 * 分页查询请填写功能名称列表
*/ */
@@ -257,28 +261,57 @@ public class BusinessDocumentOrderApplicationService {
billMap.put("packNo", cargo.getCargoNum() != null ? cargo.getCargoNum() : ""); billMap.put("packNo", cargo.getCargoNum() != null ? cargo.getCargoNum() : "");
billMap.put("erpQty", cargo.getCargoNum() != null ? cargo.getCargoNum() : ""); billMap.put("erpQty", cargo.getCargoNum() != null ? cargo.getCargoNum() : "");
// 查询物料基础信息计算净重和毛重 // 查询物料基础信息
MaterialBaseInfoPO material = null;
if (cargo.getMaterialBaseInfoId() != null) { if (cargo.getMaterialBaseInfoId() != null) {
MaterialBaseInfoPO material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId()); material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId());
if (material != null && cargo.getCargoNum() != null) { }
if (material.getWeightLimit() != null) { if (material != null) {
billMap.put("netWt", material.getWeightLimit().multiply(cargo.getCargoNum())); // 净重和毛重
} else { if (cargo.getCargoNum() != null) {
billMap.put("netWt", ""); billMap.put("netWt", material.getWeightLimit() != null
} ? material.getWeightLimit().multiply(cargo.getCargoNum()) : "");
if (material.getGrossWeight() != null) { billMap.put("grossWt", material.getGrossWeight() != null
billMap.put("grossWt", material.getGrossWeight().multiply(cargo.getCargoNum())); ? material.getGrossWeight().multiply(cargo.getCargoNum()) : "");
} else {
billMap.put("grossWt", "");
}
} else { } else {
billMap.put("netWt", ""); billMap.put("netWt", "");
billMap.put("grossWt", ""); billMap.put("grossWt", "");
} }
// 货物名称
billMap.put("goodsName", material.getMaterialName() != null ? material.getMaterialName() : "");
// 成交单位申报单位
billMap.put("gUnit", material.getDeclarationUnit() != null ? material.getDeclarationUnit() : "");
// 币制
billMap.put("currency", material.getCurrency() != null ? material.getCurrency() : "");
// 原产国countryCode
billMap.put("countryCode", material.getOriginCountry() != null ? material.getOriginCountry() : "");
// 单价企业单价
BigDecimal unitPrice = material.getUnitPrice();
billMap.put("unitPrice", unitPrice != null ? unitPrice : "");
// 总价entTotal = 成交数量 × 单价
if (unitPrice != null && cargo.getCargoNum() != null) {
billMap.put("entTotal", unitPrice.multiply(cargo.getCargoNum()));
} else {
billMap.put("entTotal", "");
}
} else { } else {
billMap.put("netWt", ""); billMap.put("netWt", "");
billMap.put("grossWt", ""); billMap.put("grossWt", "");
billMap.put("goodsName", "");
billMap.put("gUnit", "");
billMap.put("currency", "");
billMap.put("countryCode", "");
billMap.put("unitPrice", "");
billMap.put("entTotal", "");
} }
// 最终目的国优先取订单填写未填写则取收货地
String destinationCountry = (order.getDestinationCountry() != null && !order.getDestinationCountry().isEmpty())
? order.getDestinationCountry() : order.getUnloadName();
billMap.put("destinationCountry", destinationCountry != null ? destinationCountry : "");
// 境内货源地优先取订单填写未填写则取发货地
String domesticSourcePlace = (order.getDomesticSourcePlace() != null && !order.getDomesticSourcePlace().isEmpty())
? order.getDomesticSourcePlace() : order.getLoadingName();
billMap.put("domesticSourcePlace", domesticSourcePlace != null ? domesticSourcePlace : "");
billList.add(billMap); billList.add(billMap);
} }
} }
@@ -402,6 +435,8 @@ public class BusinessDocumentOrderApplicationService {
} }
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, String pushBy, String pushByName) { private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, String pushBy, String pushByName) {
try { try {
BusinessDocumentOrder update = new BusinessDocumentOrder(); BusinessDocumentOrder update = new BusinessDocumentOrder();
@@ -760,6 +760,12 @@ public class BusinessDocumentOrder extends BaseVOEntity{
@ApiModelProperty("进出口方式:I-进口,E-出口") @ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType; private String ieType;
@ApiModelProperty("境内货源地")
private String domesticSourcePlace;
@ApiModelProperty("最终目的国(地区)")
private String destinationCountry;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败") @ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus; private Integer pushStatus;
@@ -786,6 +786,12 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
@ApiModelProperty("进出口方式:I-进口,E-出口") @ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType; private String ieType;
@ApiModelProperty("境内货源地")
private String domesticSourcePlace;
@ApiModelProperty("最终目的国(地区)")
private String destinationCountry;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败") @ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus; private Integer pushStatus;
@@ -800,6 +800,12 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
@ApiModelProperty("进出口方式:I-进口,E-出口") @ApiModelProperty("进出口方式:I-进口,E-出口")
private String ieType; private String ieType;
@ApiModelProperty("境内货源地")
private String domesticSourcePlace;
@ApiModelProperty("最终目的国(地区)")
private String destinationCountry;
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败") @ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
private Integer pushStatus; private Integer pushStatus;
@@ -5,6 +5,9 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.aliyun.oss.ServiceException; import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -185,6 +188,7 @@ public class BusinessDocumentOrderDomainService {
String appointShipperId = businessDocumentOrderDO.getAppointShipperId(); String appointShipperId = businessDocumentOrderDO.getAppointShipperId();
String isCheckCredit = reservationStockInOrderMapper.getIsCheckCredit(Long.valueOf(appointShipperId)); String isCheckCredit = reservationStockInOrderMapper.getIsCheckCredit(Long.valueOf(appointShipperId));
String customerNcCode = reservationStockInOrderMapper.getCustomerNcCode(Long.valueOf(appointShipperId)); String customerNcCode = reservationStockInOrderMapper.getCustomerNcCode(Long.valueOf(appointShipperId));
String orgCode = reservationStockInOrderMapper.getCustomerOrgCode(Long.valueOf(appointShipperId));
if(isCheckCredit != null&&"1".equals(isCheckCredit)){ if(isCheckCredit != null&&"1".equals(isCheckCredit)){
UserShipperFeignDTO userShipperFeignDTO = new UserShipperFeignDTO(); UserShipperFeignDTO userShipperFeignDTO = new UserShipperFeignDTO();
List<UserShipperEntityFeign> userShipperEntityFeigns = new ArrayList<>(); List<UserShipperEntityFeign> userShipperEntityFeigns = new ArrayList<>();
@@ -209,6 +213,23 @@ public class BusinessDocumentOrderDomainService {
tmsOrder.setSettlementStatus(1L);//未出账 tmsOrder.setSettlementStatus(1L);//未出账
tmsOrder.setAuditStatus(0L);//未审核 tmsOrder.setAuditStatus(0L);//未审核
tmsOrder.setCustomerCodeNc(customerNcCode); tmsOrder.setCustomerCodeNc(customerNcCode);
String orgId = businessDocumentOrderDO.getOrgId();
if (orgCode != null) {
JSONArray orgCodeArray = JSON.parseArray(orgCode);
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
for (int i = 0; i < orgCodeArray.size(); i++) {
JSONObject obj = orgCodeArray.getJSONObject(i);
if (obj != null && String.valueOf(obj.getInteger("code")).equals(orgId)) {
String ncCustomer = obj.getString("ncCustomer");
if (StringUtils.isNotBlank(ncCustomer)) {
customerNcCode = ncCustomer;
tmsOrder.setCustomerCodeNc(customerNcCode);
}
break;
}
}
}
}
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid())); tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) { if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) { if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
@@ -552,6 +573,27 @@ public class BusinessDocumentOrderDomainService {
* 生成货源单信息 * 生成货源单信息
*/ */
BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder); BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder);
// 根据orgId匹配orgCode中的ncCustomer赋值给customerCodeNc
String updateAppointShipperId = businessDocumentOrderDO.getAppointShipperId();
if (StringUtils.isNotBlank(updateAppointShipperId)) {
String updateOrgCode = reservationStockInOrderMapper.getCustomerOrgCode(Long.valueOf(updateAppointShipperId));
String updateOrgId = businessDocumentOrderDO.getOrgId();
if (updateOrgCode != null && updateOrgId != null) {
JSONArray orgCodeArray = JSON.parseArray(updateOrgCode);
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
for (int i = 0; i < orgCodeArray.size(); i++) {
JSONObject obj = orgCodeArray.getJSONObject(i);
if (obj != null && String.valueOf(obj.getInteger("code")).equals(updateOrgId)) {
String ncCustomer = obj.getString("ncCustomer");
if (StringUtils.isNotBlank(ncCustomer)) {
tmsOrder.setCustomerCodeNc(ncCustomer);
}
break;
}
}
}
}
}
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid())); tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) { if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) { if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
@@ -57,6 +57,12 @@ public class DocumentPushMaterialRecord implements Serializable {
@ApiModelProperty("商品类型(0物料,1半成品,2成品)") @ApiModelProperty("商品类型(0物料,1半成品,2成品)")
private Integer goodsType; private Integer goodsType;
@ApiModelProperty("总价")
private BigDecimal entTotal;
@ApiModelProperty("原产国")
private String originCountry;
@ApiModelProperty("推送时间") @ApiModelProperty("推送时间")
private Date pushTime; private Date pushTime;
@@ -0,0 +1,396 @@
package com.mhd.oms.domain.executionInMaterialDetail.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 物料明细对象 material_detail
*
* @author gen
* @date 2024-05-21
*/
@Data
public class ExecutionInMaterialDetail extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("订单物料明细id")
@TableId(type = IdType.AUTO)
private Long materialDetailId;
@ApiModelProperty("业务唯一id")
@JsonSerialize(using = ToStringSerializer.class)
private Long uniqueId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("入库单号")
@Excel(name = "入库单号")
private String inOrderNumber;
@ApiModelProperty("物料基础信息id")
@Excel(name = "物料基础信息id")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
@Excel(name = "物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
@Excel(name = "物料名称")
private String materialName;
@ApiModelProperty("物料条形码")
@Excel(name = "物料条形码")
private String barCode;
@ApiModelProperty("计划数量")
@Excel(name = "计划数量")
private BigDecimal quantity;
@ApiModelProperty("收货数量")
@Excel(name = "收货数量")
private BigDecimal receiptQuantity;
@ApiModelProperty("上架数量")
@Excel(name = "上架数量")
private BigDecimal shelvesQuantity;
@ApiModelProperty("作业数量(例如:收货数量 上架数量)")
@Excel(name = "作业数量(例如:收货数量 上架数量)")
private BigDecimal actualQuantity;
@ApiModelProperty("收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)")
@Excel(name = "收货状态: 1-待收货 2-收货中 3-已收货 4-已收货(少收) 5-已收货(超收)")
private Integer receiptStatus;
@ApiModelProperty("上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)")
@Excel(name = "上架状态: 1-待上架 2-上架中 3-已上架 4-已上架(少上) 5-已上架(超上)")
private Integer shelvesStatus;
@ApiModelProperty("包装规格id")
@Excel(name = "包装规格id")
private Long packId;
@ApiModelProperty("包装规格编码")
@Excel(name = "包装规格编码")
private String packCode;
@ApiModelProperty("包装规格名称")
@Excel(name = "包装规格名称")
private String packName;
@ApiModelProperty("包装详情id")
@Excel(name = "包装详情id")
private Long packDetailId;
@ApiModelProperty("单位代码:EA IP CS PL OT")
@Excel(name = "单位代码:EA IP CS PL OT")
private String unitCode;
@ApiModelProperty("单位名称")
@Excel(name = "单位名称")
private String unitName;
@ApiModelProperty("单位数量")
@Excel(name = "单位数量")
private BigDecimal unitNumber;
@ApiModelProperty("物料仓库控制信息id")
@Excel(name = "物料仓库控制信息id")
private Long materialWarehouseControlId;
@ApiModelProperty("是否序列号管理: 1-是 2-否")
@Excel(name = "是否序列号管理: 1-是 2-否")
private Integer serialNumberManage;
@ApiModelProperty("是否质检管理: 1-是 2-否")
@Excel(name = "是否质检管理: 1-是 2-否")
private Integer qualityInspectionManage;
@ApiModelProperty("质检阶段: 1-收货前 2-收货后上架前")
@Excel(name = "质检阶段: 1-收货前 2-收货后上架前")
private Integer qualityInspectionStage;
@ApiModelProperty("质检规则: 1-全检 2-抽检 ")
@Excel(name = "质检规则: 1-全检 2-抽检 ")
private Integer qualityInspectionRule;
@ApiModelProperty("抽检比例")
@Excel(name = "抽检比例")
private BigDecimal qualityInspectionRatio;
@ApiModelProperty("质检项: 1-包装 2-纯度")
@Excel(name = "质检项: 1-包装 2-纯度")
private Integer qualityInspectionTerm;
@ApiModelProperty("质检结果: 1-正常 2-异常")
@Excel(name = "质检结果: 1-正常 2-异常")
private Integer qualityInspectionResults;
@ApiModelProperty("是否允许超收: 1-是 2-否")
@Excel(name = "是否允许超收: 1-是 2-否")
private Integer allowOvercharge;
@ApiModelProperty("超收比例")
@Excel(name = "超收比例")
private BigDecimal overchargeRatio;
@ApiModelProperty("批次号")
@Excel(name = "批次号")
private String batchNumber;
@ApiModelProperty("物料状态编码")
@Excel(name = "物料状态编码")
private String materialStatusCode;
@ApiModelProperty("物料状态名称")
@Excel(name = "物料状态名称")
private String materialStatusName;
@ApiModelProperty("分配规则id")
@Excel(name = "分配规则id")
private Long distributeRuleId;
@ApiModelProperty("分配规则编码")
@Excel(name = "分配规则编码")
private String distributeRuleCode;
@ApiModelProperty("分配规则名称")
@Excel(name = "分配规则名称")
private String distributeRuleName;
@ApiModelProperty("容器id")
@Excel(name = "容器id")
private Long containerId;
@ApiModelProperty("容器编码")
@Excel(name = "容器编码")
private String containerCode;
@ApiModelProperty("容器类型 数据字典")
@Excel(name = "容器类型 数据字典")
private String containerType;
@ApiModelProperty("容器类型名称 数据字典")
@Excel(name = "容器类型名称 数据字典")
private String containerTypeName;
@ApiModelProperty("上架仓库id")
private Long warehouseId;
@ApiModelProperty("上架仓库编码")
@Excel(name = "上架仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
@Excel(name = "仓库名称")
private String warehouseName;
@ApiModelProperty("上架库区id")
@Excel(name = "上架库区id")
private Long storageSectionId;
@ApiModelProperty("上架库区编码")
@Excel(name = "上架库区编码")
private String storageCode;
@ApiModelProperty("上架库区名称")
@Excel(name = "上架库区名称")
private String storageName;
@ApiModelProperty("上架库位id")
@Excel(name = "上架库位id")
private Long storageLocationId;
@ApiModelProperty("上架库位编码")
@Excel(name = "上架库位编码")
private String storageLocationCode;
@ApiModelProperty("上架库位名称")
@Excel(name = "上架库位名称")
private String storageLocationName;
@ApiModelProperty("层级深度,从一级开始递增")
private Integer level;
@ApiModelProperty("父级唯一Id")
private Long parentUniqueId;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("越库单id")
private Long overStockId;
@ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成")
@Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成")
private Integer overStockStatus;
@ApiModelProperty("越库类型:1-直接越库 2-分拨越库")
@Excel(name = "越库类型:1-直接越库 2-分拨越库")
private Long overStockType;
// ========== 报关相关明细字段 ==========
@ApiModelProperty("规格型号")
@Excel(name = "规格型号/ITEM")
private String specificationModel;
@ApiModelProperty("SKU码")
@Excel(name = "SKU码")
private String skuCode;
@ApiModelProperty("Invoice No.")
@Excel(name = "Invoice No.")
private String invoiceNo;
@ApiModelProperty("")
@Excel(name = "")
private BigDecimal liter;
@ApiModelProperty("尺寸")
@Excel(name = "尺寸")
private String dimensions;
@ApiModelProperty("申报单位")
@Excel(name = "申报单位")
private String declarationUnit;
@ApiModelProperty("Batch Ref NO's")
@Excel(name = "Batch Ref NO's")
private String batchRefNo;
@ApiModelProperty("Sheet Ref NO's")
@Excel(name = "Sheet Ref NO's")
private String sheetRefNo;
@ApiModelProperty("原产国")
@Excel(name = "原产国")
private String originCountry;
@ApiModelProperty("箱号/卡板号")
@Excel(name = "箱号/卡板号")
private String boxPalletNo;
@ApiModelProperty("币制")
@Excel(name = "币制")
private String currency;
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("申报数量")
@Excel(name = "申报数量")
private BigDecimal declaredQuantity;
@ApiModelProperty("箱数")
@Excel(name = "箱数")
private BigDecimal boxCount;
@ApiModelProperty("件数")
@Excel(name = "件数")
private BigDecimal pieceCount;
@ApiModelProperty("入库数量(输入大于等于0的数字,可以为小数)")
@Excel(name = "入库数量")
private BigDecimal inboundQuantity;
@ApiModelProperty("总净重(KG)")
@Excel(name = "总净重(KG)")
private BigDecimal totalNetWeight;
@ApiModelProperty("总毛重(KG)")
@Excel(name = "总毛重(KG)")
private BigDecimal totalGrossWeight;
@ApiModelProperty("总体积(CBM)")
@Excel(name = "总体积(CBM)")
private BigDecimal totalVolume;
@ApiModelProperty("总面积(SQM)")
@Excel(name = "总面积(SQM)")
private BigDecimal totalArea;
@ApiModelProperty("总价")
@Excel(name = "总价")
private BigDecimal totalPrice;
@ApiModelProperty("单价")
@Excel(name = "单价")
private BigDecimal unitPrice;
@ApiModelProperty("合同收费")
@Excel(name = "合同收费")
private BigDecimal contractFee;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseFee;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWhFee;
@ApiModelProperty("折扣(%)")
@Excel(name = "折扣(%)")
private BigDecimal discountRate;
@ApiModelProperty("单体积(CBM)")
@Excel(name = "单体积(CBM)")
private BigDecimal singleVolume;
@ApiModelProperty("单毛重(KG)")
@Excel(name = "单毛重(KG)")
private BigDecimal singleGrossWeight;
@ApiModelProperty("lot编号")
@Excel(name = "lot编号")
private String lotNo;
@ApiModelProperty(value = "饮用时间")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date drinkDate;
@ApiModelProperty("火险保费")
private BigDecimal fireInsureFee;
//订单行号
private String lineNumGw;
//物料规格
private String specGw;
//计量单位
private String unitGw;
//数量
private BigDecimal qtyGw;
//企业币制
private String erpCurrGw;
//企业单价
private BigDecimal erpPriceGw;
//申报总价
private BigDecimal amountGw;
}

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