Author SHA1 Message Date
王奎兴 568ce3f96d Merge branch 'dev' into dev-bms-0723
# Conflicts:
#	mhd_bms/src/main/resources/bootstrap.yml
#	mhd_bms/src/main/resources/mapper/SettlementCustomersMapper.xml
2026-08-05 18:19:19 +08:00
王奎兴 0ee27d796f 回显应收应付; 2026-08-05 18:16:25 +08:00
王奎兴 7842ceaf71 回显应收应付; 2026-08-05 18:13:30 +08:00
王奎兴 987a7c564d 发31 2026-08-05 17:54:11 +08:00
王奎兴 18c8c4d18d 发31 2026-08-05 17:32:17 +08:00
王奎兴 0f4da97358 新增应收账单推送nc 2026-08-05 17:30:17 +08:00
秦鸿展 2787f7651e 30 2026-08-05 17:14:03 +08:00
王奎兴 b9fe4bc4d2 新增应收账单推送nc 2026-08-05 17:01:52 +08:00
王奎兴 7a6c570a88 查货主卡死; 2026-08-05 15:17:00 +08:00
王奎兴 f1567eb81e 查货主卡死; 2026-08-05 14:48:09 +08:00
王奎兴 885d38565c 业务单详情添加执行单信息; 2026-08-05 14:45:32 +08:00
王奎兴 476d7c8b0e 发测试 2026-08-04 17:18:22 +08:00
秦鸿展 93dd653ca9 31 2026-08-04 16:35:35 +08:00
秦鸿展 f84c7b0843 BI月台字段修改 2026-08-04 16:34:41 +08:00
秦鸿展 3feb3851e4 30 2026-08-04 14:27:17 +08:00
秦鸿展 38a04d6d30 BI月台新增字段 2026-08-04 14:12:00 +08:00
秦鸿展 c58112a719 正式31 2026-08-03 20:43:22 +08:00
秦鸿展 a4a29c7c8e 正式30 2026-08-03 20:33:23 +08:00
秦鸿展 9283cc9df8 BI报表增加字段 2026-08-03 18:23:21 +08:00
王奎兴 076c915a4c 发31 2026-08-03 16:23:38 +08:00
王奎兴 55c958bde5 发30 2026-08-03 16:13:10 +08:00
zhaoqing c5babe103e feat(sys):合同新增报错 2026-07-31 23:57:48 +08:00
王奎兴 287ae8f22b Merge branch 'dev' into dev-ty1.2 2026-07-31 22:39:30 +08:00
王奎兴 1779bc2b23 发30 2026-07-31 18:02:30 +08:00
王奎兴 2a56ce433f 发31 2026-07-31 17:57:50 +08:00
王奎兴 2dd8e7f0a2 发30 2026-07-31 17:51:26 +08:00
王奎兴 b8605c6b43 预约单老系统数据导入; 2026-07-31 17:12:24 +08:00
秦鸿展 5fec54ac63 发测试 2026-07-31 16:41:19 +08:00
秦鸿展 564b8ff8aa 发测试 2026-07-31 16:07:17 +08:00
王奎兴 76a5c987b2 预约单老系统数据导入; 2026-07-31 15:53:35 +08:00
王奎兴 f6ee1a3eee 预约单老系统数据导入; 2026-07-31 15:47:20 +08:00
zhaoqing 1297f920be fix(bms):单据计费查询条件添加 2026-07-31 14:59:20 +08:00
王奎兴 d4ba4f0c0b Merge remote-tracking branch 'origin/dev' into dev 2026-07-30 17:22:11 +08:00
王奎兴 0ed45fee69 仓库出租率计算定时任务重复执行问题;发30; 2026-07-30 17:21:59 +08:00
秦鸿展 69412f7293 发测试 2026-07-30 11:43:06 +08:00
秦鸿展 2bd4d5bb63 发测试 2026-07-30 10:08:24 +08:00
秦鸿展 8b9b29dbf1 发测试 2026-07-30 10:04:03 +08:00
zhaoqing 5890660fe4 feat(bms):导出应收账单 2026-07-29 18:39:05 +08:00
zhaoqing fa6ccad965 feat(bms):导出应收账单 2026-07-29 18:29:54 +08:00
秦鸿展 e12beb1e0c 发30 2026-07-29 17:23:52 +08:00
秦鸿展 8c722deac6 发测试 2026-07-29 16:34:59 +08:00
秦鸿展 a1494846db 编辑库区 2026-07-29 16:33:40 +08:00
秦鸿展 0d70450997 费用修改 2026-07-29 15:51:11 +08:00
zhaoqing 6c6649368c sql(bms) 2026-07-29 15:24:41 +08:00
zhaoqing 92d53ad90d fix(bms):新增合同(费用类别) 2026-07-29 15:21:36 +08:00
秦鸿展 8b9cd8c749 复制订单 2026-07-29 14:57:31 +08:00
王奎兴 c200645a15 发30 2026-07-29 14:32:11 +08:00
王奎兴 674f56b2c2 库存数量和单位名称 2026-07-29 14:25:12 +08:00
王奎兴 44e7581b2c 发31 2026-07-29 11:02:00 +08:00
王奎兴 01b2723e1f 维他奶导入添加库存信息; 2026-07-29 10:54:22 +08:00
秦鸿展 489515f865 30 2026-07-28 21:18:04 +08:00
秦鸿展 d8aa1e9490 31 2026-07-28 21:10:15 +08:00
秦鸿展 07d9dacded 31 2026-07-28 16:10:37 +08:00
秦鸿展 538a3b42bd 登录校验手机号格式注释 2026-07-28 16:07:00 +08:00
赵辉 55dfb6f4a1 30 2026-07-28 14:47:06 +08:00
赵辉 1f84ad71d8 单点登录修改 2026-07-28 14:43:31 +08:00
赵辉 4d0eb901c9 单点登录修改 2026-07-28 14:43:24 +08:00
秦鸿展 23984e69d6 上架库存货主显示异常,出库复核数量显示BUG 2026-07-28 11:06:07 +08:00
秦鸿展 a1f4953fb5 30 2026-07-25 22:08:20 +08:00
秦鸿展 25ed516000 31 2026-07-25 21:55:16 +08:00
秦鸿展 9f2e8f1855 测试 2026-07-25 21:02:13 +08:00
秦鸿展 1488405397 31 2026-07-25 19:51:53 +08:00
秦鸿展 ad55d49d6b 测试 2026-07-25 19:49:47 +08:00
秦鸿展 7aa7576799 测试 2026-07-25 19:37:11 +08:00
秦鸿展 96c95dabc6 测试 2026-07-25 19:31:11 +08:00
秦鸿展 f3fc2b3093 31 2026-07-25 17:54:17 +08:00
秦鸿展 a112aa1163 30 2026-07-25 17:21:22 +08:00
秦鸿展 57cce338b1 导入物料BUG修改 2026-07-25 13:13:32 +08:00
秦鸿展 33a6e875ce 导入物料BUG修改 2026-07-25 10:16:17 +08:00
秦鸿展 cdc098fdd3 导入物料BUG修改 2026-07-25 10:09:26 +08:00
秦鸿展 e544b76db6 导入物料BUG修改 2026-07-25 10:05:12 +08:00
秦鸿展 4f727fadc1 导入物料BUG修改 2026-07-24 20:01:18 +08:00
秦鸿展 5b98ae9435 导入物料BUG修改 2026-07-24 19:42:40 +08:00
秦鸿展 82909efe6b 导入物料BUG修改 2026-07-24 18:49:14 +08:00
zhaoqing d268718f9b fix(oms):入库/出库 预约/业务单号生成 2026-07-23 17:53:32 +08:00
王奎兴 895c8d6a4b 发测试; 2026-07-23 17:48:19 +08:00
王奎兴 914a751d96 bms2.0应收单和收款单推送nc修改; 2026-07-23 17:46:32 +08:00
王奎兴 fc16c1edf2 发30 2026-07-23 14:54:15 +08:00
王奎兴 4bd655e4da nc推送改造(进行中); 2026-07-23 14:51:14 +08:00
王奎兴 a96b03a060 nc推送改造(进行中); 2026-07-23 14:49:19 +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
王奎兴 12999e6ffd 发测试 2026-06-30 09:42:18 +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
赵辉 eed47e1f34 正式 2026-06-27 20:24:38 +08:00
王奎兴 3cd16ddfac 31 2026-06-27 20:20:35 +08:00
王奎兴 bf3e5c3e29 预约单改造; 2026-06-27 19:53:15 +08:00
王奎兴 8f779f5e29 预约单改造; 2026-06-27 19:44:52 +08:00
王奎兴 8ff0561a1f 预约单改造; 2026-06-27 19:07:54 +08:00
秦鸿展 8be0813e21 新增角色BUG修改 2026-06-27 19:00:43 +08:00
王奎兴 f995d9e7c6 Merge remote-tracking branch 'origin/dev' into dev 2026-06-27 18:26:40 +08:00
王奎兴 5c8c6251d6 预约单改造; 2026-06-27 18:26:30 +08:00
秦鸿展 dc589fdf3f 新增角色 2026-06-27 18:17:43 +08:00
赵辉 1cf6d4492d 測試 2026-06-27 18:16:35 +08:00
王奎兴 8f0e71fe2a 预约单改造; 2026-06-27 18:06:31 +08:00
秦鸿展 c6366ef728 司机APP注册是默认用户角色 2026-06-27 17:22:27 +08:00
赵辉 b26d79bab0 測試 2026-06-27 14:51:12 +08:00
秦鸿展 2d424847c3 对接微信小程序接口 2026-06-27 14:06:34 +08:00
赵辉 392e54d636 測試 2026-06-27 14:04:17 +08:00
赵辉 11c7fdc7de 单据修改 2026-06-27 14:00:37 +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
赵辉 badb1b62da 正式 2026-06-24 17:04:20 +08:00
赵辉 141686d743 oms业务单发单添加客户nc编码 2026-06-24 16:46:13 +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
王奎兴 1520cd7aba 发30 2026-06-24 10:59:38 +08:00
王奎兴 c103884826 发30 2026-06-24 10:42:42 +08:00
王奎兴 66d77910f3 发31 2026-06-24 10:37:07 +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
王奎兴 92a5544891 发30 2026-06-23 21:24:50 +08:00
王奎兴 81c7c9e9f7 发31 2026-06-23 21:15:54 +08:00
zhaoqing bc9adf3f19 修改字段净重和规格 2026-06-23 21:10:43 +08:00
王奎兴 81157cc451 发30 2026-06-23 21:07:41 +08:00
王奎兴 da4da4e61e 发31 2026-06-23 20:55:29 +08:00
王奎兴 3248aef4a9 发31 2026-06-23 20:54:09 +08:00
王奎兴 242f56ae1a 查询报错 2026-06-23 20:47:11 +08:00
王奎兴 cf22323cfe 查询报错 2026-06-23 20:39:58 +08:00
zhaoqing fe2dcc027b 修改删改单推送数据 2026-06-23 20:09:22 +08:00
王奎兴 6072ac272f 查询报错 2026-06-23 20:05:54 +08:00
王奎兴 6c71bff1ad Merge remote-tracking branch 'origin/dev' into dev 2026-06-23 19:57:54 +08:00
王奎兴 2c16152c0b 修改上架明细报错 2026-06-23 19:57:40 +08:00
zhaoqing 0b3df4bf32 查询添加判断条件删改单申请状态 2026-06-23 19:54:59 +08:00
王奎兴 1b5914a7d1 修改上架明细报错 2026-06-23 19:10:14 +08:00
zhaoqing feb614e3e4 单证时间修改 2026-06-23 19:04:04 +08:00
zhaoqing 7650bd2eb9 单证时间修改 2026-06-23 18:50:06 +08:00
王奎兴 7d13b42144 关务推送动态url地址; 2026-06-23 18:48:20 +08:00
王奎兴 432fa3398d Merge remote-tracking branch 'origin/dev' into dev 2026-06-23 18:11:27 +08:00
王奎兴 e84adc2d6f 关务推送动态url地址; 2026-06-23 18:11:16 +08:00
zhaoqing 0ad41cd768 修改删改单申请推送 2026-06-23 18:08:18 +08:00
王奎兴 caac89e3db 更新上架明细报错; 2026-06-23 17:51:44 +08:00
zhaoqing 95c128b506 sql 2026-06-23 17:32:14 +08:00
zhaoqing 186d76f9fc 修改一般贸易的详情数据查询 2026-06-23 17:12:19 +08:00
zhaoqing bc3bdd669e 一般贸易推送,保存详情数据 2026-06-23 16:52:40 +08:00
王奎兴 6aeabc7be7 拣货单查询; 2026-06-23 16:45:16 +08:00
王奎兴 80b604a637 保存关务推送内容; 2026-06-23 16:05:00 +08:00
zhaoqing 55c780caa1 sql 2026-06-23 15:32:20 +08:00
zhaoqing af0f3e81b9 修改一般贸易的详情查询数据来源 2026-06-23 15:23:54 +08:00
赵辉 0ae37ac795 信用修改 2026-06-23 14:39:05 +08:00
zhaoqing 129cd393aa 修改一般贸易的详情查询数据来源 2026-06-23 14:34:03 +08:00
zhaoqing b4f685a25d 修改一般贸易的详情查询数据来源 2026-06-23 14:01:41 +08:00
赵辉 a14c7776e8 信用修改 2026-06-23 14:00:32 +08:00
王奎兴 3360e500dc 发测试 2026-06-23 11:48:47 +08:00
赵辉 41fc2d1805 修改字段 2026-06-23 11:30:30 +08:00
赵辉 7ccb06ad79 测试环境 2026-06-23 11:11:11 +08:00
王奎兴 7a7038e794 发测试 2026-06-23 10:52:02 +08:00
王奎兴 d04df87e19 报关回写; 2026-06-23 10:50:23 +08:00
赵辉 21aab4f17e 三方信用修改 2026-06-23 10:27:57 +08:00
王奎兴 ab10adb0d2 Merge remote-tracking branch 'origin/dev' into dev 2026-06-23 10:15:59 +08:00
王奎兴 f32f5b48bc 回显成品物料; 2026-06-23 10:15:52 +08:00
赵辉 3224e87814 三方信用修改 2026-06-23 10:14:06 +08:00
zhaoqing afa6ed0685 修改查询时间失效的问题 2026-06-23 10:03:32 +08:00
王奎兴 32efb1dfe5 推送人回显po username 2026-06-23 09:58:48 +08:00
王奎兴 0cf697a03b 关务保税仓页面查询; 2026-06-23 09:46:07 +08:00
王奎兴 7babb53e90 关务推送bug; 2026-06-23 09:29:31 +08:00
赵辉 31247d7faa 委托方增加组织代码,与查询修改 2026-06-23 08:57:06 +08:00
王奎兴 4a07d1a0c4 发测试 2026-06-22 18:35:40 +08:00
386 changed files with 34809 additions and 1871 deletions
@@ -357,6 +357,10 @@ public interface SystemServiceFeign {
@GetMapping("/contractManageApi/getInfoByCustomer")
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("查询赊销额度")
@PostMapping("/userShipperApi/querySaleCreditLimitFeign")
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;
import cn.hutool.json.JSONUtil;
import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
@@ -97,6 +98,18 @@ public interface WmsServiceFeign {
@PostMapping(value = "/stockInOrderApi/omsInOrderAdd")
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下发单明细保存
*/
@@ -115,4 +128,17 @@ public interface WmsServiceFeign {
@RequestParam(value = "pushTime",required = false) String pushTime,
@RequestParam(value = "pushBy",required = false) Long pushBy,
@RequestParam(value = "pushByName",required = false) String pushByName);
/**
* 根据物料ID列表批量查询物料信息
*/
@GetMapping("/materialBaseInfoApi/getBatchByIds")
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 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 = "装货电话")
private String loadingPhone="";
@ApiModelProperty(value = "装货时间日期(年月日)",required = true)
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private java.util.Date loadingDate;
// @ApiModelProperty(value = "装货时间(上午、下午、24小时)")
// private String loadingTime="";
@@ -116,6 +116,12 @@ public class WarehouseFeignPO extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是")
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("查询失败");
}
@Override
public AjaxResult getInfoByCustomerAndSecondSubjectCode(String settlementCustomersCode, Integer contractType, String firstSubjectCode, Long topOrganizationId, Long organizationId) {
return null;
}
@Override
public AjaxResult getInfoByCustomer2(String settlementCustomersCode, Integer contractType, Long topOrganizationId) {
return AjaxResult.error("查询失败");
@@ -310,4 +314,4 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
}
};
}
}
}
@@ -170,6 +170,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
return R.fail("获取组织用户失败:" + throwable.getMessage());
}
@Override
public R<LoginUser> getUserByUserAccount(String userAccount) {
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public R<LoginUser> getUserByTopOrganizationUserPhone(@RequestBody UserDTO userDTO, String source) {
return R.fail("获取组织用户失败:" + throwable.getMessage());
@@ -73,6 +73,21 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
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
public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
}
@@ -90,6 +105,20 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
public AjaxResult<?> updateMaterialPushStatus(Long materialBaseInfoId, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
return AjaxResult.error(cause.getMessage());
}
@Override
public TableDataInfo getBatchByIds(List<Long> materialBaseInfoIds) {
TableDataInfo tableDataInfo = new TableDataInfo();
tableDataInfo.setData(new ArrayList<>());
tableDataInfo.setTotal(0);
tableDataInfo.setCode(500);
return tableDataInfo;
}
@Override
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
return null;
}
};
}
}
@@ -40,6 +40,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -107,11 +108,14 @@ public class TokenLoginApplicationService {
//租户一级组织ID
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
Long topOrganizationId = sysTenantsPo.getOrganizationId();
// 获取用户选择的组织ID未选则使用一级组织ID
Long selectedOrgId = loginDTO.getOrganizationId();
Long organizationId = (selectedOrgId != null) ? selectedOrgId : topOrganizationId;
//获取用户信息组装dto
UserDTO userDTO = new UserDTO();
userDTO.setUserPhone(userPhone);
userDTO.setTopOrganizationId(topOrganizationId);
userDTO.setOrganizationId(topOrganizationId);
userDTO.setOrganizationId(organizationId);
// 查询用户信息查询组织下用户是否存在
R<LoginUser> userResult = userServiceFeign.getUserByTopOrganizationUserPhone(userDTO, SecurityConstants.INNER);
if (R.FAIL == userResult.getCode()) {
@@ -153,7 +157,8 @@ public class TokenLoginApplicationService {
}else {
userDTO.setBusinessType(4);
}
userDTO.setOrganizationName(sysTenantsPo.getOrganizationName());
userDTO.setOrganizationName(StringUtils.isNotBlank(loginDTO.getOrganizationName())
? loginDTO.getOrganizationName() : sysTenantsPo.getOrganizationName());
userResult = userServiceFeign.registerAddUser(userDTO, SecurityConstants.INNER);
userInfo = userResult.getData();
} else {
@@ -379,6 +384,10 @@ public class TokenLoginApplicationService {
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());
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
throw new ServiceException("登录用户组织不存在");
@@ -569,4 +578,29 @@ public class TokenLoginApplicationService {
sysPasswordService.validateByWms(userPo, verificationCode, 1);
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包名")
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.StringUtils;
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.auth.AuthUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -75,6 +77,15 @@ public class AppTokenController extends BaseController {
return R.ok();
}
/**
* 根据域名获取组织信息免Token供司机APP注册时选择组织用
*/
@ApiOperation("根据域名获取组织信息")
@GetMapping("/getOrganizationByPath/{path}")
public AjaxResult getOrganizationByPath(@PathVariable("path") String path) {
return tokenLoginApplicationService.getOrganizationByPath(path);
}
/**
* @Description wms 新登录接口
@@ -0,0 +1,90 @@
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);
log.info("SSO单点登录成功, account={}, token={} , redirectUrl={}", account, accessToken, redirectUrl);
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("${sso.redirect-url}")
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;
}
}
@@ -550,11 +550,11 @@ public class SysLoginService {
throw new ServiceException("请输入手机号和短信验证码");
}
//调用工具类校验校验手机号格式错误
if (!RegexUtil.isPhoneLegal(userPhone)) {
recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1);
throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR);
}
// //调用工具类校验校验手机号格式错误
// if (!RegexUtil.isPhoneLegal(userPhone)) {
// recordLogininfor(userPhone, Constants.LOGIN_FAIL, UserError.USER_PHONE_REG_ERROR.errmsg(), 1);
// throw new DigitalLogisticsException(UserError.USER_PHONE_REG_ERROR);
// }
//根据域名获取一级组织ID
AjaxResult topOrganizationIdR = organizationServiceFeign.getOrganizationByPath(path, SecurityConstants.INNER);
+24 -6
View File
@@ -14,24 +14,42 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010
# username: nacos
# password: manhuoda@2023
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 10.102.192.5:6848
# username: nacos
# password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
server-addr: 10.102.192.31:6848
# 测试环境配置 容器名+端口号
server-addr: 10.33.0.129:6010
# server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
# server-addr: 10.102.192.5:6848
# username: nacos
# password: manhuoda@2023
username: nacos
password: manhuoda@2023
#线上正式环境
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties
# 共享配置
shared-configs:
- 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: "https://diglog.namkwong.com.mo/main_app/sso"
@@ -127,6 +127,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
for (String[] row : Baseline.P_PLATES) {
int dur = jitterInt(Integer.parseInt(row[3]), r);
vehicles.add(PlatformVehicleItemVO.builder()
.appointmentTime(Baseline.P_APPOINTMENT_TIME)
.workFloor(Baseline.P_WORK_FLOOR)
.plateNumber(row[0])
.status(row[1])
.platformId(row[2])
@@ -394,6 +396,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
static final String[] W_CUST_NAMES = {"华东冷链", "华南汽配", "西南快消", "华北家电", "跨境达"};
static final int[] W_CUST_AMT = {198, 172, 205, 189, 221};
static final String P_APPOINTMENT_TIME = "2026-08-03 09:30:00";
static final String P_WORK_FLOOR = "一楼";
static final String[][] P_PLATES = {
{"粤A12345", "待入场", "#12", "88"},
{"闽D99887", "作业中", "#07", "142"},
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -17,6 +18,7 @@ import java.util.List;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel("BI-港澳服务专区")
public class HkMacaoServiceZoneVO {
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
@@ -11,6 +12,7 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel("BI-港澳服务专区-地图点位")
public class HkMapPointVO {
@@ -1,5 +1,6 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -38,4 +39,24 @@ public class HkVehicleDetailsVO {
@JsonProperty("update_time")
@ApiModelProperty("更新时间")
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;
}
@@ -14,6 +14,12 @@ import lombok.NoArgsConstructor;
@ApiModel("月台监测-作业车辆")
public class PlatformVehicleItemVO {
@ApiModelProperty("预约申请时间")
private String appointmentTime;
@ApiModelProperty("作业楼层")
private String workFloor;
@ApiModelProperty("车牌号码")
private String plateNumber;
+4 -4
View File
@@ -16,12 +16,12 @@ spring:
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.5:6848
# username: nacos
# password: manhuoda@2023
#线上正式环境
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
@@ -32,8 +32,8 @@ public class TmsAddressMultiDTO {
@ApiModelProperty(value = "装卸货联系人电话")
private String contactPhone;
@ApiModelProperty(value = "装卸货日期(年月日)")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date layDate;
@ApiModelProperty(value = "装卸货时间(上午、下午、24小时)")
private String layTime;
@@ -271,4 +271,8 @@ public class UserShipperPo {
@ApiModelProperty("货主code")
private String roleCodeShipper;
@ApiModelProperty(name = "是否校验信用")
private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
}
@@ -46,6 +46,9 @@ public class MdmMerchantRecordDTO implements Serializable {
@ApiModelProperty("电子邮件")
private String desc16;
@ApiModelProperty("nc编码")
private String desc17;
@ApiModelProperty("身份证号")
private String desc23;
@@ -95,21 +95,12 @@ public final class MdmMerchantSyncFilter {
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode,
Long syncOrganizationId, Long topOrganizationId) {
if (record == null || StringUtils.isEmpty(record.getCode())) {
if (StringUtils.isEmpty(trim(record.getDesc17()))) {
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()))) {
return SkipReason.MISSING_NAME;
}
if (isDisabled(record)) {
return SkipReason.DISABLED;
}
return null;
}
@@ -191,6 +191,7 @@ public class AuthFilter implements GlobalFilter, Ordered
/**
* 获取请求token
* 优先从 Authorization 请求头获取其次从 URL 参数 token 获取SSO场景
*/
private String getToken(ServerHttpRequest request)
{
@@ -200,6 +201,11 @@ public class AuthFilter implements GlobalFilter, Ordered
{
token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY);
}
// 兜底从URL参数中获取tokenSSO单点登录场景前端尚未存入localStorage时
if (StringUtils.isEmpty(token))
{
token = request.getQueryParams().getFirst("token");
}
return token;
}
+8 -8
View File
@@ -13,24 +13,24 @@ spring:
cloud:
nacos:
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.33.0.129:6010
#线上正式环境
# server-addr: 127.0.0.1:8848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
# server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
#线上正式环境
# server-addr: 127.0.0.1:8848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
# server-addr: 10.102.192.31:6848
# username: nacos
# password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties
# 共享配置
@@ -270,7 +270,7 @@ public class LeaseApplicationService {
* 货主租赁明细
* 定时任务每天凌晨1点执行计算前一天的货主租赁明细
*/
@Scheduled(cron = "0 0 1 * * ?")
// @Scheduled(cron = "0 0 1 * * ?")
public void shipperLeaseDetails() {
log.info("开始执行货主租赁明细定时任务");
// 计算前一天的日期将时间设置为当天的0点0分0秒只保留日期部分
@@ -537,7 +537,7 @@ public class LeaseApplicationService {
/**
* 定时任务散租推送到bms
*/
@Scheduled(cron = "0 0 0 * * ?")
// @Scheduled(cron = "0 0 0 * * ?")
public void ScatteredRentalSynchronization() {
LeaseDO leaseDO = new LeaseDO();
leaseDO.setTime(new Date());
@@ -268,12 +268,25 @@ public class ContractManageApplicationService {
Long organizationId = contractManageDTO.getOrganizationId();
String sunjectCode = contractManageDTO.getSubjectCode();
Long topOrganizationId = contractManageDTO.getTopOrganizationId();
List<ContractManage> UserContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
.eq(ContractManage::getDelFlag, 1)
.eq(ContractManage::getOrganizationId, organizationId)
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
.eq(ContractManage::getCommonContractFlag, 2));
ContractManageDO contractManageDO = new ContractManageDO();
contractManageDO.setOrganizationId(organizationId);
contractManageDO.setSettlementCustomersId(settlementCustomersId);
contractManageDO.setTopOrganizationId(topOrganizationId);
contractManageDO.setCommonContractFlag(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) {
//用户合同计费策略
calucateSubjectAndPriceStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result);
@@ -595,7 +608,8 @@ public class ContractManageApplicationService {
通用合同同一时间段同一合同类型只能存在一个
特殊合同同一结算主体同一时间段同一合同类型只能存在一个
*/
checkContract(contractManageDO);
//20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
@@ -603,7 +617,7 @@ public class ContractManageApplicationService {
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO);
handleDetils(contractManageDO);
handleDetils(contractManageDO, true);
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();
if (ObjectUtil.isNull(loginUser)) {
@@ -745,6 +759,10 @@ public class ContractManageApplicationService {
}
//根据合同编码查询保存合同信息
ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode1(contractManageDO.getOriginalContractNumber());
//修改时不管前端是否传明细都需要先删除该合同原有的明细避免明细为空时老明细仍在
if (!isInsert) {
contractManageDetailMapper.delete(new LambdaQueryWrapper<ContractManageDetail>().eq(ContractManageDetail::getContractManageId, contractManageDO.getContractManageId()));
}
//保存合同详情科目
List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList();
if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){
@@ -813,10 +831,13 @@ public class ContractManageApplicationService {
}
}
if(null != contractManagePO){
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId());
if (isInsert) {
// 新增/复制时使用新插入的合同ID
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
} else {
// 修改时使用当前正在修改的合同ID不能用 getInfoByCode1 查到的避免多条合同 originalContractNumber 相同导致明细错绑
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
}
//contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
@@ -831,9 +852,9 @@ public class ContractManageApplicationService {
@Transactional
public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType());
checkContract(contractManageDO);
//checkContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO);
handleDetils(contractManageDO, false);
handleDict(contractManageDO);
return contractManageDomainService.update(contractManageDO);
}
@@ -935,6 +956,79 @@ public class ContractManageApplicationService {
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
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.mhd.common.core.utils.StringUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
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);
}
@@ -314,4 +322,4 @@ public class WarehouseApplicationService {
return warehouseDomainService.getWarehouseChildren(warehouseId, storageLocationType);
}
}
}
@@ -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
public Boolean insert(ContractManageDO contractManageDO) {
public Long insert(ContractManageDO contractManageDO) {
ContractManage contractManage = new 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-包含)")
private Integer transportationCosts;
private String isMany;
}
@@ -214,4 +214,6 @@ public class ContractManageDO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("一级费用科目code")
private String firstSubjectCode;
}
@@ -60,8 +60,9 @@ public class ContractManageDomainService {
* 新增合同管理
*/
public Boolean insert(ContractManageDO contractManageDO) {
return contractManageService.insert(contractManageDO);
Long contractManageId = contractManageService.insert(contractManageDO);
contractManageDO.setContractManageId(contractManageId);
return true;
}
/**
@@ -148,6 +149,7 @@ public class ContractManageDomainService {
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ContractManage::getOriginalContractNumber,contractNumber);
queryWrapper.eq(ContractManage::getDelFlag,1);
queryWrapper.last("LIMIT 1");
ContractManage contractManage = contractManageService.getOne(queryWrapper);
if(null != contractManage){
BeanUtils.copyProperties(contractManage,contractManagePO);
@@ -98,4 +98,10 @@ public class ContractManageDetail extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -97,4 +97,10 @@ public class ContractManageDetailPO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -102,4 +102,10 @@ public class ContractManageDetailDO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -165,6 +165,8 @@ public class StorageLocation extends BaseVOEntity{
@ApiModelProperty("是否作废: 1-否 2-是")
@Excel(name = "是否作废: 1-否 2-是")
private Integer nullify;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
}
}
@@ -165,6 +165,8 @@ public class StorageLocationPO extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是")
private Integer nullify;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
}
}
@@ -204,4 +204,8 @@ public class StorageLocationDO extends BaseVOEntity{
@ApiModelProperty("坐标-层 终止")
@Excel(name = "坐标-层 终止")
private String coordinateLayerEnd;
}
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
}
@@ -68,6 +68,20 @@ public class StorageSectionDomainService {
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null);
//设置仓库
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);
}
@@ -77,11 +91,11 @@ public class StorageSectionDomainService {
public Boolean update(StorageSectionDO storageSectionDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (topOrganizationId == null || topOrganizationId == 0 || associationWarehouseCacheDO == null) {
throw new ServiceException("获取当前登陆人组织与登陆仓库失败!");
if (topOrganizationId == null || topOrganizationId == 0) {
throw new ServiceException("获取当前登陆人组织失败!");
}
checkStorageSectionDuplicate(topOrganizationId, associationWarehouseCacheDO.getWarehouseId(),
// 直接用记录自身的 warehouseId 做唯一校验不再依赖缓存仓库
checkStorageSectionDuplicate(topOrganizationId, storageSectionDO.getWarehouseId(),
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(),
storageSectionDO.getStorageSectionId());
//设置仓库
@@ -168,4 +182,4 @@ public class StorageSectionDomainService {
}
}
}
@@ -122,5 +122,12 @@ public class Warehouse extends BaseVOEntity{
@Excel(name = "是否启用: 1-否 2-是")
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;
@ApiModelProperty("库区集合")
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;
@ApiModelProperty("仓库id 集合")
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;
}
@@ -102,4 +102,10 @@ public class ContractManageDetailDTO extends BaseVOEntity{
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -212,7 +212,11 @@ public class StorageLocationDTO extends BaseVOEntity{
@Excel(name = "坐标-层 终止")
private String coordinateLayerEnd;
@ApiModelProperty("库位条码")
@Excel(name = "库位条码")
private String locationBarCode;
public interface Edit {}
public interface BatchInsert {}
}
}
@@ -132,4 +132,16 @@ public class WarehouseDTO extends BaseVOEntity{
@ApiModelProperty("是否启用: 1-否 2-是")
@Excel(name = "是否启用: 1-否 2-是")
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));
}
@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("根据结算主体获取合同信息")
@GetMapping(value = "/getInfoByCustomer2")
public AjaxResult getInfoByCustomer2(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId)
@@ -6,11 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectContractManagePo">
select
*
from contract_manage
SELECT DISTINCT a.*
FROM CONTRACT_MANAGE a
left JOIN CONTRACT_MANAGE_DETAIL b
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
where
del_flag = 1
a.del_flag = 1
</sql>
<sql id="selectContractManagePo1">
@@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and contract_state = #{contractState}
</if>
<if test="signingUnit != null and signingUnit != ''">
and signing_unit = #{signingUnit}
and asigning_unit = #{signingUnit}
</if>
<if test="settlementCustomers != null and settlementCustomers != ''">
and settlement_customers = #{settlementCustomers}
@@ -108,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="theyOperatorPhone != null and theyOperatorPhone != ''">
and they_operator_phone = #{theyOperatorPhone}
</if>
</where>
</sql>
@@ -132,73 +134,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="common_where">
<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 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 test="contractManageDO.commonContractFlag != null">
and common_contract_flag = #{contractManageDO.commonContractFlag}
and a.common_contract_flag = #{contractManageDO.commonContractFlag}
</if>
<if test="contractManageDO.contractType != null">
and contract_type = #{contractManageDO.contractType}
and a.contract_type = #{contractManageDO.contractType}
</if>
<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 test="contractManageDO.settlementCustomersCode != null">
and settlement_customers_code = #{contractManageDO.settlementCustomersCode}
and a.settlement_customers_code = #{contractManageDO.settlementCustomersCode}
</if>
<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 test="contractManageDO.contractName != null and contractManageDO.contractName != ''">
and contract_name like concat('%', #{contractManageDO.contractName}, '%')
and a.contract_name like concat('%', #{contractManageDO.contractName}, '%')
</if>
<if test="contractManageDO.contractState != null">
and contract_state = #{contractManageDO.contractState}
and a.contract_state = #{contractManageDO.contractState}
</if>
<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 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 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 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 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 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 test="contractManageDO.effectiveDateString != null and contractManageDO.effectiveDateString != ''
and contractManageDO.expirationDateString != null and contractManageDO.expirationDateString != ''">
AND (
date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString}
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString}
date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString}
AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString}
)
</if>
<if test="contractManageDO.nowDateString != null and contractManageDO.nowDateString != ''">
AND (
date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString}
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString}
AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
)
</if>
<if test="contractManageDO.organizationId != null">
and organization_id = #{contractManageDO.organizationId}
and a.organization_id = #{contractManageDO.organizationId}
</if>
<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>
</sql>
</mapper>
</mapper>
@@ -107,7 +107,10 @@
<select id="selectCostSubject" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO"
resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO">
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
where
a.del_flag = 1
@@ -118,13 +121,17 @@
<select id="selectAllCostSubject"
resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO">
select
*
from expense_account
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
where
del_flag = 1
and status = 1
and first_subject_flag = 2
and upper_subject_code = #{subjectCode}
a.del_flag = 1
and a.status = 1
and a.first_subject_flag = 2
and a.upper_subject_code = #{subjectCode}
</select>
<select id="getInfoByCode" resultType="com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO" parameterType="com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO">
@@ -141,6 +148,7 @@
AND a.top_organization_id = #{expenseAccountDO.topOrganizationId}
AND a.subject_code = #{expenseAccountDO.subjectCode}
AND a.status = 1
LIMIT 1
</select>
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="locationBarCode" column="LOCATION_BAR_CODE" />
</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.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.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
from storage_location a
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="delFlag" column="del_flag" />
<result property="isEnable" column="IS_ENABLE" />
<result property="workMode" column="WORK_MODE" />
<result property="taskMode" column="TASK_MODE" />
</resultMap>
<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 id="selectWarehousePo1">
@@ -130,6 +137,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</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>
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
<otherwise> and del_flag = 1 </otherwise>
@@ -1,12 +1,22 @@
package com.mhd.user.application.service;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.user.domain.userAggregate.entity.AgreementDetails;
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import com.mhd.user.domain.userAggregate.repository.mapper.AgreementDetailsMapper;
import com.mhd.user.domain.userAggregate.repository.mapper.UserShipperMapper;
import com.mhd.user.domain.userAggregate.repository.po.AgreementDetailsPo;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -19,18 +29,87 @@ public class AgreementDetailsApplicationService {
@Resource
private AgreementDetailsMapper agreementDetailsMapper;
@Resource
private UserShipperMapper userShipperMapper;
/**
* 根据货主ID查询所有协议明细
* 根据货主ID查询当前登录用户组织下的协议明细
* 从user_shipper表的orgCode字段解析JSON匹配当前登录用户组织code
* 返回该组织下的agreedaydatas列表
*
* @param shipperId 货主ID
* @return 协议明细列表
*/
public List<AgreementDetails> listByShipperId(Long shipperId) {
return agreementDetailsMapper.selectList(
new LambdaQueryWrapper<AgreementDetails>()
.eq(AgreementDetails::getShipperId, shipperId)
.orderByDesc(AgreementDetails::getCreateTime)
);
public List<AgreementDetailsPo> listByShipperId(Long shipperId) {
// 1. 获取当前登录用户组织ID
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser) || ObjectUtil.isNull(loginUser.getUserPo())) {
log.warn("未获取到登录用户信息");
return Collections.emptyList();
}
Long organizationId = loginUser.getUserPo().getOrganizationId();
if (ObjectUtil.isNull(organizationId)) {
log.warn("当前登录用户无组织信息");
return Collections.emptyList();
}
// 2. 根据shipperId查询货主信息获取orgCode字段
UserShipperEntity shipperEntity = userShipperMapper.selectById(shipperId);
if (ObjectUtil.isNull(shipperEntity)) {
log.warn("未找到货主信息,shipperId={}", shipperId);
return Collections.emptyList();
}
String orgCodeJson = shipperEntity.getOrgCode();
if (ObjectUtil.isNull(orgCodeJson) || orgCodeJson.isEmpty()) {
log.warn("货主orgCode为空,shipperId={}", shipperId);
return Collections.emptyList();
}
// 3. 解析orgCode JSON数组匹配当前登录用户组织code
JSONArray orgCodeArray = JSONArray.parseArray(orgCodeJson);
if (orgCodeArray == null || orgCodeArray.isEmpty()) {
return Collections.emptyList();
}
JSONObject matchedOrg = null;
for (int i = 0; i < orgCodeArray.size(); i++) {
JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long code = orgItem.getLong("code");
if (organizationId.equals(code)) {
matchedOrg = orgItem;
break;
}
}
if (matchedOrg == null) {
log.info("未匹配到当前组织的协议信息,shipperId={}organizationId={}", shipperId, organizationId);
return Collections.emptyList();
}
// 4. 获取匹配组织的agreedaydatas
JSONArray agreedaydatas = matchedOrg.getJSONArray("agreedaydatas");
if (agreedaydatas == null || agreedaydatas.isEmpty()) {
log.info("当前组织下无协议天数数据,shipperId={}organizationId={}", shipperId, organizationId);
return Collections.emptyList();
}
// 5. 转换为AgreementDetailsPo列表
List<AgreementDetailsPo> result = new ArrayList<>();
for (int i = 0; i < agreedaydatas.size(); i++) {
JSONObject item = agreedaydatas.getJSONObject(i);
AgreementDetailsPo po = new AgreementDetailsPo();
po.setCode(item.getString("code"));
po.setOrgcode(item.getString("orgcode"));
po.setPtypename(item.getString("ptypename"));
po.setPtype(item.getString("ptype"));
po.setPcode(item.getString("pcode"));
po.setPname(item.getString("pname"));
po.setPday(item.getString("pday"));
result.add(po);
}
log.info("查询协议明细成功,shipperId={}organizationId={},共{}条", shipperId, organizationId, result.size());
return result;
}
/**
@@ -21,7 +21,7 @@ public class AsyncUserShipperMasterDataSyncService {
@Resource
private RedisLock redisLock;
@Async
@Async("taskScheduler")
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
Long organizationId = loginUser.getUserPo().getOrganizationId();
try {
@@ -1860,25 +1860,64 @@ public class UserApplicationService {
userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4));
}
UserEntity userEntity = userDomainService.addUser(userDO);
//同步网货平台员工信息
wlhyDomainService.addOrEditPlatformUser1(userEntity);
//同步商城用户
userMallDomainService.syncDriverUserInfo(userEntity);
//给用户分配默认普通角色权限
RoleDo roleDo = new RoleDo();
roleDo.setRoleCode(RoleEnum.DRIVER.getCode());
roleDo.setOrganizationId(userEntity.getOrganizationId());
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo);
if (null != roleEntity) {
UserRoleDo userRoleDo = new UserRoleDo();
userRoleDo.setUserId(userEntity.getUserId());
userRoleDo.setRoleId(roleEntity.getRoleId());
//判断是否存在当前登录人
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
userRoleDomainService.addUserRole(userRoleDo,userEntity);
}else {
userRoleDomainService.addUserRole(userRoleDo);
//给小程序注册用户分配默认普通用户角色must本组织没有则找上级
userEntity.setUserPassword("Aa123456"); // 三方同步需要密码
try {
RoleDo mustRoleDo = new RoleDo();
mustRoleDo.setRoleCode(RoleEnum.MUST.getCode());
mustRoleDo.setOrganizationId(userEntity.getOrganizationId());
RoleEntity mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
// 本组织没有找上级组织
if (null == mustRoleEntity && userEntity.getTopOrganizationId() != null
&& !userEntity.getTopOrganizationId().equals(userEntity.getOrganizationId())) {
mustRoleDo.setOrganizationId(userEntity.getTopOrganizationId());
mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
}
if (null != mustRoleEntity) {
UserRoleDo mustUserRoleDo = new UserRoleDo();
mustUserRoleDo.setUserId(userEntity.getUserId());
mustUserRoleDo.setRoleId(mustRoleEntity.getRoleId());
LoginUser loginUser = SecurityUtils.getLoginUser();
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用户数据不更新问题
@@ -1934,6 +1973,23 @@ public class UserApplicationService {
userDO.setDriverEnterpriseCode(driverEnterpriseCode);
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 运输企业添加司机默认生成一条空的司机信息方便列表查询
UserDriverDO userDriverDO = new UserDriverDO();
userDriverDO.setUserId(userPo.getUserId());
@@ -2886,6 +2942,33 @@ public class UserApplicationService {
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 根据用户账号和组织账号获取组织用户信息
* @Author Alex
@@ -13,6 +13,7 @@ import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.redis.service.RedisLock;
import com.mhd.common.security.utils.SecurityUtils;
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.userShipperMdmSync.entity.UserShipperMdmSyncEntity;
import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper;
@@ -69,13 +70,28 @@ public class UserShipperMasterDataSyncService {
public void syncMasterData() {
LoginUser loginUser = requireLoginUser();
Long organizationId = loginUser.getUserPo().getOrganizationId();
String lockKey = LOCK_PREFIX + organizationId;
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
if (!locked) {
throw new ServiceException("当前组织正在同步主数据,请稍后再试");
}
markSyncInProgress(organizationId);
asyncUserShipperMasterDataSyncService.syncMasterDataAsync(loginUser, lockKey);
new Thread(() -> {
String lockKey = LOCK_PREFIX + organizationId;
try {
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
if (!locked) {
log.warn("当前组织正在同步主数据,跳过本次同步");
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) {
@@ -184,14 +200,31 @@ public class UserShipperMasterDataSyncService {
targetOrganizationId, organizationId, topOrganizationId, loginUser);
UserShipperPo existing = existingMap.get(matchKey);
if (existing == null) {
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);
// ncCode+companyName 未匹配到时再按公司名跨组织查询已存在的同公司名委托方
// 同一个客商在 MDM 中可能属于不同组织nc 编码不同但本地是同一条委托方记录
// 如果匹配到的委托方属于另外的组织非当前同步组织则不新增
// 而是在其 orgCode 上追加当前同步组织的信息连同本组织下的 ncCustomer
UserShipperEntity existingByName = userShipperApplicationService
.findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
if (existingByName != null
&& 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 {
userShipperApplicationService.updateEnterpriseShipperFromMasterData(
@@ -261,8 +294,9 @@ public class UserShipperMasterDataSyncService {
entity.setLastSyncTime(syncTime);
entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1);
String syncMessage = String.format(
"新增%d,更新%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getSkipCount(), resultVo.getFailCount(),
"新增%d,更新%d关联%d跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getLinkCount(),
resultVo.getSkipCount(), resultVo.getFailCount(),
orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther);
if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) {
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 = "是否校验信用")
private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
}
@@ -31,6 +31,12 @@ public interface UserRepositoryInterface extends IService<UserEntity> {
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
UserPo findByUserAccount(String userAccount);
UserPo getUserByDingUserId(String dingUserId);
UserPo selectUserShipperList(UserPo userPo);
@@ -33,6 +33,11 @@ public interface UserMapper extends BaseMapper<UserEntity> {
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
UserPo findByUserAccount(@Param("userAccount") String userAccount);
UserPo getUserByDingUserId(@Param("dingUserId") String dingUserId);
UserPo findByTopOrganizationIdAndUserPhone(UserDO userDO);
@@ -52,5 +52,11 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
@Param("companyName") String companyName,
@Param("organizationId") Long organizationId);
/**
* 按公司名跨组织查询第一个未删除的委托方包含 orgCode 字段
* 用于 MDM 同步时按"公司名"匹配已存在的委托方可能是其他组织的以便在其 orgCode 上追加新组织
*/
UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(@Param("shipperEnterpriseName") String shipperEnterpriseName);
String getOrgNcCode(Long organizationId);
}
@@ -79,6 +79,11 @@ public class UserRepositoryImpl extends ServiceImpl<UserMapper,UserEntity> imple
return userMapper.findByTopOrganizationIdAndUserAccount(userDO);
}
@Override
public UserPo findByUserAccount(String userAccount) {
return userMapper.findByUserAccount(userAccount);
}
@Override
public UserPo getUserByDingUserId(String dingUserId) {
return userMapper.getUserByDingUserId(dingUserId);
@@ -0,0 +1,32 @@
package com.mhd.user.domain.userAggregate.repository.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 协议天数PO
*/
@Data
public class AgreementDetailsPo {
@ApiModelProperty("客户编码")
private String code;
@ApiModelProperty("协议组织编码")
private String orgcode;
@ApiModelProperty("协议类型名称")
private String ptypename;
@ApiModelProperty("协议类型:1-付款协议天数,2-收款协议天数")
private String ptype;
@ApiModelProperty("财务系统协议编码")
private String pcode;
@ApiModelProperty("协议天数名称")
private String pname;
@ApiModelProperty("协议天数")
private String pday;
}
@@ -354,4 +354,6 @@ public class UserShipperPo implements Serializable {
private BigDecimal agreementCount;
@ApiModelProperty(name = "是否校验信用")
private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
}
@@ -244,6 +244,12 @@ public class UserShipperDO extends UserDO {
@ApiModelProperty("货主/供应商/客户名称")
private String userNameShipper;
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("用户电话")
private String userPhone;
@ApiModelProperty("联系人")
private String emergencyContactName;
@@ -322,4 +328,7 @@ public class UserShipperDO extends UserDO {
private String userPassword;
@ApiModelProperty(name = "是否校验信用")
private String isCheckCredit;
@ApiModelProperty(name = "组织代码")
private String orgCode;
}
@@ -82,6 +82,13 @@ public class UserDomainService {
return userRepositoryInterface.findByTopOrganizationIdAndUserAccount(userDO);
}
/**
* 仅根据用户登录账号查询用户不区分组织SSO等场景使用
*/
public UserPo findByUserAccount(String userAccount) {
return userRepositoryInterface.findByUserAccount(userAccount);
}
public UserPo getUserByDingUserId(String dingUserId) {
return userRepositoryInterface.getUserByDingUserId(dingUserId);
}
@@ -268,4 +268,7 @@ public class UserShipperDTO extends UserDTO {
private String userPassword;
@ApiModelProperty(name = "是否校验信用")
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.UserDriverApplicationService;
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.todo.*;
import com.mhd.user.domain.userAggregate.service.UserRoleDomainService;
import com.mhd.user.interfaces.assember.*;
import com.mhd.user.interfaces.dto.addDTO.*;
import com.mhd.user.interfaces.dto.queryDTO.UserDataPermissionQueryDTO;
@@ -498,6 +500,13 @@ public class UserAPI extends BaseController {
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获取用户信息")
@GetMapping("/getUserByDingUserId")
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.log.annotation.Log;
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.model.LoginUser;
import com.mhd.user.application.service.UserApplicationService;
import com.mhd.user.application.service.UserShipperApplicationService;
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.service.TokenService;
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.vo.SettlementInfoQueryVo;
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo;
@@ -42,6 +45,8 @@ public class UserShipperAPI extends BaseController {
@Resource
private UserShipperMasterDataSyncService userShipperMasterDataSyncService;
@Resource
private WechatMiniAppService wechatMiniAppService;
@Resource
private UserApplicationService userApplicationService;
@Resource
private UserShipperAssember userShipperAssember;
@@ -342,4 +347,25 @@ public class UserShipperAPI extends BaseController {
}
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("更新条数")
private int updateCount;
@ApiModelProperty("关联到已存在委托方条数(按公司名跨组织匹配到同公司名委托方,仅在 orgCode 上追加新组织,不新增委托方)")
private int linkCount;
@ApiModelProperty("跳过条数")
private int skipCount;
@@ -21,14 +21,14 @@ spring:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30:6848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
config:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.30:6848
server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
@@ -42,4 +42,13 @@ spring:
max-request-size: 50MB
mybatis-plus:
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>
limit 1
</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查询用户 -->
<select id="getUserByDingUserId" parameterType="java.lang.String"
resultType="com.mhd.common.core.domain.po.UserPo">
@@ -264,8 +271,8 @@
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
<if test="organizationId != null">
<!-- 如果设置了 organizationId,添加 organization_id 条件 -->
and a.organization_id = #{organizationId}
and a.organization_name IS NOT NULL
and (a.organization_id = #{organizationId}
or b.ORG_CODE like concat('%', to_char(#{organizationId}), '%'))
</if>
<if test="topOrganizationId != null">
<!-- 如果设置了 topOrganizationId,添加 top_organization_id 条件 -->
@@ -773,7 +780,13 @@
</if>
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
<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
</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
@@ -67,6 +67,7 @@
a.esign_auth_status,
a.esign_enterprise_status,
a.CUSTOMER_NC_CODE,
a.org_code,
a.esign_seal_auth_id
FROM user_shipper a
LEFT JOIN "USER" b ON a.user_id = b.user_id
@@ -74,7 +75,9 @@
AND b.del_flag = 1
</sql>
<sql id="selectShipperVo1">
SELECT b.shipper_id,
SELECT b.area,
b.detail_address,
b.shipper_id,
a.user_id,
b.parent_shipper_id,
b.shipper_type,
@@ -171,7 +174,8 @@
b.LIMIT_TIME,
b.CREDIT_AMOUNT,
b.IS_CHECK_CREDIT,
b.AGREEMENT_COUNT
b.AGREEMENT_COUNT,
b.org_code
FROM "USER" a
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
@@ -375,7 +379,13 @@
</if>
/*用户组织ID*/
<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 test="organizationName != null and organizationName != ''">
@@ -511,6 +521,7 @@
</foreach>
OR a.create_by = #{createBy})
</if>
</sql>
<select id="getShipperCountByMatter" parameterType="com.mhd.common.core.domain.todo.StatisticalMattersDo"
@@ -620,6 +631,22 @@
AND a.organization_id = #{organizationId}
LIMIT 1
</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 NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
</select>
@@ -7,6 +7,7 @@ import com.mhd.bms.application.server.receiptManage.ReceiptManageApplicationServ
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.billManage.repository.mapper.BillDetailMapper;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
@@ -17,6 +18,8 @@ import com.mhd.bms.domain.billManage.service.BillManageDomainService;
import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
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.ncLog.entity.NcLog;
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
@@ -76,6 +79,8 @@ public class BillManageApplicationService {
private BillDetailMapper billDetailMapper;
@Autowired
private NcLogMapper ncLogMapper;
@Autowired
private IBillManageService billManageService;
/**
@@ -131,8 +136,12 @@ public class BillManageApplicationService {
List<BillManagePO> billManagePOS = billManageDomainService.queryList(billManageDO);
for (BillManagePO billManagePO : billManagePOS) {
String billNumber = billManagePO.getBillNumber(); // 获取账单编号
// 原有 - 前端列表用不变
List<BillDetail> billDetails = billDetailMapper.selectList(new LambdaQueryWrapper<BillDetail>().eq(BillDetail::getBillNumber, billNumber));
billManagePO.setBillDetailList(billDetails);
// 新增 - 导出用LEFT JOIN billing_statement 拿到费用科目
List<BillDetailPO> billDetailPOs = billDetailMapper.getDetailsByBillManageId(billManagePO.getBillManageId());
billManagePO.setBillDetailPOList(billDetailPOs);
}
return billManagePOS;
}
@@ -332,7 +341,10 @@ public class BillManageApplicationService {
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){
throw new ServiceException("账单金额不一致,调整失败,请重试");
// 金额不一致时用明细累加值覆盖前端传值不再抛异常
billManageDTO.setBillTotalAmount(billingTotalAmount);
billManageDTO.setBillAmount(billingAmount);
billManageDTO.setBillDiscountAmount(billingDiscountAmount);
}
//将集合中没有计费流水id的过滤到另一个集合将添加费用的集合保存到计费流水并返回计费流水id
List<BillDetailDTO> billDetailDTOListNoBillingStatementId = billDetailDTOList.stream().filter(billDetailDTO -> billDetailDTO.getBillingStatementId()==null).collect(Collectors.toList());
@@ -355,6 +367,19 @@ public class BillManageApplicationService {
billDetailDTO1.setFeeType(billDetailDTO1.getServiceItemsName());
});
}
//同步更新已有计费流水调整账单时可修改已有费用
List<BillDetailDTO> billDetailDTOListHasBillingStatementId = billDetailDTOList.stream()
.filter(billDetailDTO -> billDetailDTO.getBillingStatementId() != null)
.collect(Collectors.toList());
for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) {
BillingStatementDO billingStatementDO = new BillingStatementDO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDO);
billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId());
billingStatementDO.setBillManageId(billManagePO.getBillManageId());
billingStatementDO.setBillingState(3);
billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementApplicationService.update(billingStatementDO);
}
//保存账单明细
Boolean flag = billDetailDomainService.saveBatch(billDetailDTOList);
//更新账单金额
@@ -368,7 +393,10 @@ public class BillManageApplicationService {
billManageDO.setTailCalculationCode(billManageDTO.getTailCalculationCode());
billManageDO.setAmountAccuracyCode(billManageDTO.getAmountAccuracyCode());
billManageDO.setBillDiscount(billManageDTO.getBillDiscount());
billManageDO.setBillRemark(billManageDTO.getBillRemark());
billManageDO.setBillDiscountLimit(billManageDTO.getBillDiscountLimit());
billManageDO.setCycleBeginTime(billManageDTO.getCycleBeginTime());
billManageDO.setCycleEndTime(billManageDTO.getCycleEndTime());
billManageDO.setCreateTime(billManageDTO.getCreateTime());
billManageDO.setUpdateTime(new Date());
billManageDO.setUpdateBy(loginUser.getUserid());
@@ -384,6 +412,186 @@ public class BillManageApplicationService {
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.setSalesmanId(String.valueOf(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);
String firstSubjectCode = billDetailDTO.getFirstSubjectCode();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = billingStatementDTO.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
billingStatementDTO.setTaxAmount(taxAmount);
billingStatementDTO.setTaxFreeFee(taxFreeFee);
billingStatementDTO.setTaxRate(taxRate);
billingStatementDTO.setBillingAmount(amount);
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());
});
}
//同步更新已有计费流水新增账单时可修改已有费用
List<BillDetailDTO> billDetailDTOListHasBillingStatementId = billDetailDTOList.stream()
.filter(item -> item.getBillingStatementId() != null)
.collect(Collectors.toList());
for (BillDetailDTO billDetailDTO : billDetailDTOListHasBillingStatementId) {
BillingStatementDO billingStatementDO = new BillingStatementDO();
BeanUtils.copyProperties(billDetailDTO, billingStatementDO);
billingStatementDO.setBillingStatementId(billDetailDTO.getBillingStatementId());
billingStatementDO.setBillManageId(billManageDO.getBillManageId());
billingStatementDO.setBillingState(3);
billingStatementDO.setAccountExpenseType(billDetailDTO.getBillType());
billingStatementApplicationService.update(billingStatementDO);
}
//保存账单明细
double allTaxRate = 0.0d;
BigDecimal allTaxAmount = BigDecimal.ZERO;
BigDecimal allTaxFreeFee = BigDecimal.ZERO;
for (BillDetailDTO item : billDetailDTOList) {
String firstSubjectCode = item.getFirstSubjectCode();
Double taxRate = billDetailMapper.getTaxRate(firstSubjectCode);
BigDecimal amount = item.getBillingAmount();
BigDecimal taxAmount = amount.divide(BigDecimal.ONE.add(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))),10, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(taxRate).divide(BigDecimal.valueOf(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal taxFreeFee = amount.subtract(taxAmount);
item.setTaxAmount(taxAmount);
item.setTaxFreeFee(taxFreeFee);
item.setTaxRate(taxRate);
allTaxRate += taxRate;
allTaxAmount = allTaxAmount.add(taxAmount);
allTaxFreeFee = allTaxFreeFee.add(taxFreeFee);
}
BillManage billManage = billManageService.getById(billManageDO.getBillManageId());
if (billManage != null) {
billManage.setTaxRate(allTaxRate);
billManage.setTaxAmount(allTaxAmount);
billManage.setTaxFreeFee(allTaxFreeFee);
billManage.setSalesmanId(String.valueOf(loginUser.getUserid()));
billManageService.updateById(billManage);
}
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;
}
/**
* 复制账单-获取原账单数据供前端回显
* 前端拿到数据后跳转到类似修改/新增账单的页面用户修改后通过addBill接口提交新增
*/
public BillManagePO copyBill(BillManageDTO billManageDTO) {
if (billManageDTO.getBillManageId() == null) {
throw new ServiceException("原账单id不能为空");
}
// 获取原账单信息
BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId());
if (null == originalBill) {
throw new ServiceException("原账单信息未找到");
}
// 获取原账单明细
List<BillDetailPO> originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
if (originalDetails == null || originalDetails.isEmpty()) {
throw new ServiceException("原账单明细为空,无法复制");
}
// 重置关键字段为初始值清空id等方便前端回显后直接提交新增
originalBill.setBillManageId(null);
originalBill.setBillNumber(null);
originalBill.setBillState(1);
originalBill.setBillStep(1);
originalBill.setReconciliationStatus(0);
originalBill.setIsInvoice(0);
originalBill.setActualReceivedAmount(BigDecimal.ZERO);
originalBill.setBillAmountUnsettled(originalBill.getBillAmount());
originalBill.setBillAmountSettlement(BigDecimal.ZERO);
originalBill.setSynchronousStatus(0);
originalBill.setSkSynchronousStatus(0);
originalBill.setApplyNumber(null);
originalBill.setSettlementTime(null);
originalBill.setSynchronousTime(null);
originalBill.setSkSynchronousTime(null);
originalBill.setInvoiceId(null);
originalBill.setInvoiceMakeTime(null);
originalBill.setNcId(null);
originalBill.setSkNcId(null);
// 明细也清空id
for (BillDetailPO detail : originalDetails) {
detail.setBillDetailId(null);
detail.setBillManageId(null);
detail.setBillNumber(null);
}
originalBill.setBillDetailPOList(originalDetails);
return originalBill;
}
/**
* 应收账单-客户确认
*/
@@ -563,6 +771,76 @@ public class BillManageApplicationService {
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;
}
}
@@ -585,6 +585,8 @@ public class BillingStatementApplicationService {
此方法只进行实体返回并不进行数据保存
*/
LoginUser loginUser = SecurityUtils.getLoginUser();
billingStatementDO.setAccountExpenseType(billingStatementDO.getAccountExpenseType());
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
@@ -598,6 +600,9 @@ public class BillingStatementApplicationService {
billingStatementPO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billingStatementPO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billingStatementPO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
// 默认填充当前登录人为业务员
billingStatementPO.setSalesmanId(String.valueOf(loginUser.getUserid()));
billingStatementPO.setSalesmanName(loginUser.getUserPo().getUserName());
return billingStatementPO;
}
@@ -7,10 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService;
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.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.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.todo.BusinessDocumentDO;
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.interfaces.assembler.businessDocument.BusinessDocumentAssembler;
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.common.core.domain.dto.BusinessDataPushDTO;
import com.mhd.common.core.domain.po.OrganizationPo;
@@ -86,6 +95,14 @@ public class BusinessDocumentApplicationService {
private CostCalculationApplicationService costCalculationApplicationService;
@Autowired
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);
}
@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支持
* 数字整数字符串小数字符串null空字符串
@@ -484,7 +618,7 @@ public class BusinessDocumentApplicationService {
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
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")))) {
throw new ServiceException("合同信息未找到");
}
@@ -492,6 +626,10 @@ public class BusinessDocumentApplicationService {
if (null == contractPO) {
throw new ServiceException("合同信息未找到");
}
String isMany = contractPO.getIsMany();
if ("1".equals(isMany)) {
throw new ServiceException("存在多条相同费用科目的合同,请检查");
}
businessDocumentDO.setContractName(contractPO.getContractName());
businessDocumentDO.setContractNumber(contractPO.getContractNumber());
}
@@ -38,4 +38,6 @@ public interface IBillDetailService extends IService<BillDetail>
public BillDetailPO getInfo(Long billDetailId);
List<BillDetailPO> getDetailsByBillManageId(Long billManageId);
}
List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId);
}
@@ -5,6 +5,7 @@ import com.mhd.bms.domain.billManage.entity.BillDetail;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -17,4 +18,8 @@ public interface BillDetailMapper extends BaseMapper<BillDetail>
{
List<BillDetailPO> getDetailsByBillManageId(@Param("billManageId") Long billManageId);
}
List<BillDetail> getDetailsByBillManageIdAndGroup(@Param("billManageId") Long billManageId);
Double getTaxRate(@Param("code") String code);
}
@@ -25,6 +25,8 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getCustomerCodeNcJson(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
String getsalespersonNcCode(@Param("salesmanId") String salesmanId);
@@ -42,4 +44,6 @@ public interface BillManageMapper extends BaseMapper<BillManage>
String getDeptName(@Param("dictCode") String dictCode);
String getOrgCodeNc(@Param("organizationId") Long organizationId);
Long getShipperId(@Param("userId") Long userId, @Param("organizationId") Long organizationId);
}
@@ -75,4 +75,9 @@ public class BillDetailImpl extends ServiceImpl<BillDetailMapper, BillDetail> im
public List<BillDetailPO> getDetailsByBillManageId(Long billManageId) {
return billDetailMapper.getDetailsByBillManageId(billManageId);
}
}
@Override
public List<BillDetail> getDetailsByBillManageIdAndGroup(Long billManageId) {
return billDetailMapper.getDetailsByBillManageIdAndGroup(billManageId);
}
}
@@ -264,4 +264,6 @@ public class BillManageDO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("业务员ID")
private String salesmanId;
}
@@ -94,6 +94,13 @@ public class BillManageDomainService {
return billManageService.insert(billManageDO);
}
/**
* 直接保存账单管理实体
*/
public boolean saveEntity(BillManage billManage) {
return billManageService.save(billManage);
}
/**
* 修改账单管理
*/
@@ -100,6 +100,10 @@ public class BillingStatementPO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -101,6 +101,10 @@ public class BillingStatementDO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -119,6 +119,13 @@ public class BillingStatementDomainService {
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) {
//查询当前账单的五大信息组织信息结算对象来源系统收支类型账单周期
if (billingStatementDO.getBillManageId() == null || billingStatementDO.getBillManageId() <= 0) {
return new ArrayList<>();
}
BillManagePO billManagePO = billManageDomainService.getInfo(billingStatementDO.getBillManageId());
if(null == billManagePO){
throw new ServiceException("账单信息未找到");
@@ -675,8 +685,8 @@ public class BillingStatementDomainService {
billingStatementDO.setSettlementCustomersCode(billManagePO.getSettlementCustomersCode());
billingStatementDO.setBelongModuleCode(billManagePO.getBelongModuleCode());
billingStatementDO.setAccountExpenseType(billManagePO.getBillType());
billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime());
billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime());
// billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime());
// billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime());
billingStatementDO.setBillingState(2);
startPage();
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.mhd.bms.domain.billManage.entity.BillManage;
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.BmsSettlementPartyInvoice;
import com.mhd.bms.domain.bmsInvoiceList.repository.facade.IBmsInvoiceListService;
@@ -56,6 +57,8 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
private BmsMakeOutInvoiceItemMapper bmsMakeOutInvoiceItemMapper;
@Resource
private BillManageMapper billManageMapper;
@Resource
private com.mhd.system.api.SystemServiceFeign systemServiceFeign;
/*@Resource
private BmsSettlementPartyInvoiceMapper bmsSettlementPartyInvoiceMapper;*/
@@ -327,7 +330,7 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
/**
* 发票详情
*
* @param id
* @param
* @return
*/
@Override
@@ -415,6 +418,23 @@ public class BmsInvoiceListServiceImpl extends ServiceImpl<BmsInvoiceListMapper,
bmsMakeOutInvoiceItem.setMakeId(bmsMakeOutInvoice.getId());
//bmsMakeOutInvoiceItem.setCreateBy(sysUser.getId());
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);
}
}
@@ -218,4 +218,6 @@ public class BusinessDocumentDO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
private Long billManageId;
}
@@ -96,4 +96,12 @@ public class BillLogsConstants
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-承运商)")
private Integer principalType;
private String isMany;
}
@@ -0,0 +1,145 @@
package com.mhd.bms.interfaces.dto.billManage;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "应收账单导出对象")
public class BillManageExportVO {
/** ====== 原有账单头字段(与 BillManagePO 的 @Excel 一致) ====== */
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@Excel(name = "组织表ID")
private Long organizationId;
@Excel(name = "组织名称")
private String organizationName;
@Excel(name = "账单编号")
private String billNumber;
@Excel(name = "账单类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@Excel(name = "账单状态", readConverterExp = "1=-未确认,2-对账中,3-未收款/付款,4-部分收款/付款,5-已收款/付款,6-已作废,7-已退款")
private Integer billState;
@Excel(name = "账单流程节点", readConverterExp = "1=-发起对账,2-客户确认,3-财务审核,4-收款/付款")
private Integer billStep;
@Excel(name = "系统来源")
private String belongModule;
@Excel(name = "系统来源code")
private String belongModuleCode;
@Excel(name = "结算对象id")
private Long settlementCustomersId;
@Excel(name = "结算对象code")
private String settlementCustomersCode;
@Excel(name = "结算对象")
private String settlementEntity;
@Excel(name = "账单总金额")
private BigDecimal billTotalAmount;
@Excel(name = "优惠金额")
private BigDecimal billDiscountAmount;
@Excel(name = "账单金额")
private BigDecimal billAmount;
@Excel(name = "已收/付金额")
private BigDecimal billAmountSettlement;
@Excel(name = "未收/付金额")
private BigDecimal billAmountUnsettled;
@Excel(name = "期望金额")
private BigDecimal billExpectedAmount;
@Excel(name = "对账状态", readConverterExp = "1=-暂未确认,2-申请调账,3-财务调账,4-核对无误")
private Integer reconciliationStatus;
@Excel(name = "对账意见描述")
private String reconciliationOpinion;
@Excel(name = "客户凭证地址")
private String voucherAddress;
@Excel(name = "财务审核结果(1-同意,2-拒绝)")
private Integer financialReviewFlag;
@Excel(name = "审核意见描述")
private String financialReviewOpinion;
@Excel(name = "周期开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cycleBeginTime;
@Excel(name = "周期结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cycleEndTime;
@Excel(name = "收款/付款时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date settlementTime;
@Excel(name = "备注")
private String billRemark;
@Excel(name = "折扣百分比")
private BigDecimal billDiscount;
@Excel(name = "折扣上限金额")
private BigDecimal billDiscountLimit;
@Excel(name = "费用计算精度code")
private String costAccuracyCode;
@Excel(name = "费用计算精度name")
private String costAccuracyName;
@Excel(name = "尾数计算code")
private String tailCalculationCode;
@Excel(name = "尾数计算name")
private String tailCalculationName;
@Excel(name = "账单金额精度code")
private String amountAccuracyCode;
@Excel(name = "账单金额精度name")
private String amountAccuracyName;
/** ====== 新增明细字段(来源于 bill_detail + billing_statement ====== */
@Excel(name = "费用类别")
private String feeType;
@Excel(name = "费用类型code")
private String serviceItemsCode;
@Excel(name = "费用类型")
private String serviceItemsName;
@Excel(name = "一级费用科目code")
private String firstSubjectCode;
@Excel(name = "一级费用科目")
private String firstSubjectName;
@Excel(name = "二级费用科目code")
private String secondSubjectCode;
@Excel(name = "二级费用科目")
private String secondSubjectName;
@Excel(name = "明细金额")
private BigDecimal billingAmount;
}
@@ -102,6 +102,10 @@ public class BillingStatementDTO extends BaseVOEntity{
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer accountExpenseType;
@ApiModelProperty("收支类型(1-应收,2-应付)")
@Excel(name = "收支类型", readConverterExp = "1=-应收,2-应付")
private Integer billType;
@ApiModelProperty("流水备注")
@Excel(name = "流水备注")
private String billingRemark;
@@ -213,4 +213,6 @@ public class BusinessDocumentDTO extends BaseVOEntity{
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
private Long billManageId;
}
@@ -6,6 +6,8 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.io.IOException;
import java.net.URLEncoder;
import com.mhd.bms.application.server.billManage.BillManageApplicationService;
import com.mhd.bms.domain.billManage.repository.po.BillDetailPO;
@@ -13,7 +15,9 @@ import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
import com.mhd.bms.domain.ncLog.entity.NcLog;
import com.mhd.bms.infrastructure.utils.UniqueKeyUtil;
import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
import com.mhd.bms.interfaces.dto.billManage.BillManageExportVO;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.redis.enums.RedisLockTypeEnum;
@@ -31,6 +35,7 @@ import com.mhd.bms.domain.billManage.repository.todo.BillManageDO;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
import com.mhd.bms.interfaces.assembler.billManage.BillManageAssembler;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
@@ -79,6 +84,55 @@ public class BillManageApi extends BaseController{
return AjaxResult.success(billManageApplicationService.listCount(billManageDO));
}
@ApiOperation("导出应收账单")
@GetMapping(value = "/exportReceivableList", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void exportReceivableList(BillManageDTO billManageDTO, HttpServletResponse response) throws IOException
{
//转换实体
BillManageDO billManageDO = new BillManageDO();
BeanUtils.copyProperties(billManageDTO,billManageDO);
billManageDO.setBillType(1);
//查全部不分页
List<BillManagePO> list = billManageApplicationService.queryList(billManageDO);
//扁平化处理一条明细生成一行
List<BillManageExportVO> exportList = new ArrayList<>();
for (BillManagePO bill : list) {
List<BillDetailPO> details = bill.getBillDetailPOList();
if (details != null && !details.isEmpty()) {
for (BillDetailPO detail : details) {
BillManageExportVO vo = new BillManageExportVO();
//复制全部账单头字段
BeanUtils.copyProperties(bill, vo);
//覆盖明细字段
vo.setFeeType(detail.getFeeType());
vo.setServiceItemsCode(detail.getServiceItemsCode());
vo.setServiceItemsName(detail.getServiceItemsName());
vo.setFirstSubjectCode(detail.getFirstSubjectCode());
vo.setFirstSubjectName(detail.getFirstSubjectName());
vo.setSecondSubjectCode(detail.getSecondSubjectCode());
vo.setSecondSubjectName(detail.getSecondSubjectName());
vo.setBillingAmount(detail.getBillingAmount());
exportList.add(vo);
}
} else {
//没有明细也要有一行
BillManageExportVO vo = new BillManageExportVO();
BeanUtils.copyProperties(bill, vo);
exportList.add(vo);
}
}
//设置下载头防止浏览器乱码
String fileName = URLEncoder.encode("应收账单", "UTF-8").replaceAll("\\+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelUtil<BillManageExportVO> util = new ExcelUtil<>(BillManageExportVO.class);
util.exportExcel(response, exportList, "应收账单");
}
@ApiOperation("获取nc推送日志")
@GetMapping(value = "/getNcLog")
public AjaxResult getNcLog(@RequestParam(name = "billManageId") Long billManageId, @RequestParam(name = "type") Long type)
@@ -229,6 +283,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 {
BillManagePO result = billManageApplicationService.copyBill(billManageDTO);
return AjaxResult.success(result);
}catch (Exception e){
return AjaxResult.error("复制账单失败:"+e.getMessage());
}
}
@ApiOperation("应收账单-客户确认")
@PostMapping("/customerConfirmation")
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());
}
}
/**
* 保存业务单据

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