Author SHA1 Message Date
王奎兴 14a5aedf15 Merge branch 'dev' into feature/dev-0729 2026-08-10 18:14:55 +08:00
秦鸿展 d4f660bc7e BI月台动态真实数据 2026-08-10 17:59:59 +08:00
秦鸿展 64bb96c97c BI月台动态真实数据 2026-08-10 17:36:04 +08:00
王奎兴 9df65779ad 保存电子签名id重复; 2026-08-10 17:26:48 +08:00
王奎兴 176a0aa879 已审核入库单电子签名也显示; 2026-08-10 10:03:35 +08:00
王奎兴 1241256787 电子签名签名方式修改; 2026-08-10 09:57:51 +08:00
王奎兴 5e65d63a4f 出入库单按规则生成; 2026-08-08 18:36:36 +08:00
王奎兴 296176c85e 出入库单按规则生成; 2026-08-08 18:02:30 +08:00
王奎兴 993746ee41 出库单按规则生成; 2026-08-08 17:47:59 +08:00
王奎兴 6a0818350a 出库单按规则生成;执行单回显通知单备注; 2026-08-08 16:41:22 +08:00
王奎兴 1b8a75aea5 入库单按规则生成; 2026-08-08 16:04:46 +08:00
zhaoqing 76a290dc58 Merge branch 'dev-ty1.2' into dev 2026-08-08 15:12:27 +08:00
rcx 969d90fff5 fix(wms 库存模块): 修复库存查询各页签分组维度不符合需求的问题
1. queryListByWl(物料查询):原按单物料分组会把同一物料跨仓库库存合并成一行,丢失仓库维度。子查询 partition by 增加 warehouse_id、join 增加 warehouse_id 关联、外层 GROUP BY 增加 warehouse_id,改为按"物料+仓库"汇总。
2. queryListByWlKw(物料/库位查询):GROUP BY 增加 shipper_id,改为按"货主+库位+物料"汇总,避免不同货主在同库位同物料的库存被错误合并。
3. queryListByHz(按货主查询):GROUP BY 增加 warehouse_id,改为按"货主+仓库"汇总;hzwl 分支改走 queryListByHz,符合"按货主查询:货主+仓库"需求。
2026-08-08 15:08:01 +08:00
王奎兴 23b5f96a0c Merge branch 'dev-ty1.2' into dev 2026-08-08 14:26:11 +08:00
zhaoqing 02de8706e2 fix(wms): 复核状态逻辑修改 2026-08-08 11:46:55 +08:00
王奎兴 e6aa8d59e2 发测试 2026-08-08 11:41:13 +08:00
王奎兴 4b29406701 Merge branch 'dev' into feature/dev-0729
# Conflicts:
#	mhd_bms/src/main/resources/bootstrap.yml
2026-08-08 11:39:21 +08:00
王奎兴 1c29c7e5e4 入库调整备注; 2026-08-08 11:36:58 +08:00
王奎兴 add7ef60db 签名方式修改; 2026-08-08 10:27:35 +08:00
王奎兴 d14cea759a 签名方式修改; 2026-08-08 10:25:59 +08:00
rcx 4fde6e1a9c Merge remote-tracking branch 'origin/dev-ty1.2' into dev-ty1.2 2026-08-08 10:08:22 +08:00
rcx 0f88ad75b9 fix(wms 库存模块): 修复库存汇总分组拆分bug并补充库存调整仓库空值校验
1. queryListByHzWlUnit、queryListByWlExpiry 的 GROUP BY 移除
   shipper_code/material_code 等描述列,只保留ID列;对应SELECT
   描述列改用MAX()聚合,避免同ID明细因描述列NULL/值不一致被错误拆分。
2. 库存调整接口新增 ObjectUtil.isNotNull(warehousePO) 空值校验。
2026-08-08 10:07:39 +08:00
王奎兴 067fe1c2c9 签名方式修改; 2026-08-08 10:04:06 +08:00
zhaoqing 6b2adce82f fix(system): 复核状态逻辑修改 2026-08-08 10:01:54 +08:00
王奎兴 bee31cf944 签名方式修改; 2026-08-08 09:59:00 +08:00
王奎兴 552a685bb1 pda签名; 2026-08-08 09:41:29 +08:00
高正杨 1c46de4fb7 pda签名; 2026-08-07 20:46:54 +08:00
王奎兴 a66177e21b pda签名; 2026-08-07 20:25:05 +08:00
王奎兴 fedeece533 扫二维码签名;入库单号规则; 2026-08-07 20:01:01 +08:00
zhaoqing ae138915ae fix(system): 库位库区排序修改 2026-08-07 18:51:04 +08:00
王奎兴 57b8dcfb02 feign查询仓库信息添加字段; 2026-08-07 18:13:24 +08:00
王奎兴 b45af55cdd 生成入库单同步生成电子签名; 2026-08-07 17:54:32 +08:00
zhaoqing 3991496617 发测试bms wms system 2026-08-07 17:32:11 +08:00
王奎兴 261bb07fb0 Merge branch 'dev-ty1.2' into dev 2026-08-07 17:23:38 +08:00
王奎兴 b18fa5938a 样品出库不修改库存; 2026-08-07 17:13:05 +08:00
zhaoqing ba3a90471a feat(bms):计费规格 查询条件 添加费用科目 2026-08-07 15:56:47 +08:00
rcx c5a39d23f2 feat: wms - 库存管理 - 库存查询 -库存调整推送逻辑优化
- 推送 OMS 逻辑增加仓库启用状态判定,未启用 OMS 则不推送
2026-08-07 15:13:19 +08:00
rcx cb136a19b4 feat: 「库存管理」-「库存查询」增加按货主/物料查询
- 实现按(货主 + 物料 + 仓库 + 包装单位)组合聚合逻辑,更新日期取组内最新时间
2026-08-07 15:08:05 +08:00
zhaoqing 0f26cd3d0d feat(bms):新增账单费用支持修改(包含税费相关修改) 2026-08-07 09:40:32 +08:00
rcx 57649dbdfa fix(库存模块): 修复库存调整无法生效 bug
库存调整:修复所有商品调整点击确认之后未生效 bug
2026-08-06 18:07:38 +08:00
王奎兴 b55c890f7e 仓库管理添加单号生成规则字段; 2026-08-06 17:12:40 +08:00
rcx 315d96063a fix(库存模块): 修复库存调整逻辑并优化即时库存接口
库存调整:修复部分商品在点击“完成库存调整”后数据未更新的问题。

即时库存:移除 JSON 返回列表中每个对象冗余的库存数量合计字段,改为在最外层统一返回,优化并缩短接口整体响应时间。
2026-08-06 17:08:54 +08:00
秦鸿展 897e5f195f 测试 2026-08-06 16:57:20 +08:00
秦鸿展 b5b7143d7c 30 2026-08-06 16:41:13 +08:00
王奎兴 f06c210ae9 仓库管理添加单号生成规则字段; 2026-08-06 16:40:56 +08:00
秦鸿展 4f38ac7cd6 ID重复问题 2026-08-06 16:39:36 +08:00
王奎兴 488fdfc50e 业务单添加执行单号; 2026-08-06 15:42:22 +08:00
秦鸿展 1cdc1878a0 31 2026-08-06 15:40:20 +08:00
秦鸿展 2c91368278 ID错误问题 2026-08-06 15:37:42 +08:00
秦鸿展 c0f70715c7 测试 2026-08-06 15:30:04 +08:00
王奎兴 c93445ca4c 业务单添加执行单号回显; 2026-08-06 15:18:15 +08:00
秦鸿展 cb9d09c899 30 2026-08-06 14:22:16 +08:00
王奎兴 f3aec5d42f 系统超时; 2026-08-06 14:14:22 +08:00
王奎兴 bcd7991725 推送nc结算币种; 2026-08-06 13:43:50 +08:00
王奎兴 db5e0e1a66 推送nc结算币种; 2026-08-06 13:39:12 +08:00
王奎兴 ba8dbdd859 推送nc结算币种; 2026-08-06 13:35:24 +08:00
王奎兴 f1967dd40f 发31 2026-08-06 09:15:16 +08:00
王奎兴 505f0aff5e 发31 2026-08-05 20:44:46 +08:00
王奎兴 b9dd2999f1 发30 2026-08-05 20:40:57 +08:00
王奎兴 091c971f30 发30 2026-08-05 20:40:12 +08:00
王奎兴 2de4efbe65 发测试 2026-08-05 20:18:40 +08:00
zhaoqing e5ef8740de 发测试system 2026-08-05 20:02:19 +08:00
王奎兴 661e57ce62 发30 2026-08-05 19:23:05 +08:00
王奎兴 49233cf19b 发31 2026-08-05 19:20:52 +08:00
王奎兴 b96db591f2 发31 2026-08-05 19:19:00 +08:00
王奎兴 236b047f5e 发30 2026-08-05 19:05:43 +08:00
王奎兴 feba6ff672 发31 2026-08-05 19:01:46 +08:00
王奎兴 8caf83b823 回显应收应付; 2026-08-05 18:38:30 +08:00
rcx 789c9ac29c Merge remote-tracking branch 'origin/dev' into dev 2026-08-05 18:33:44 +08:00
rcx 925eeba899 Merge branch 'dev-ty1.2' into dev 2026-08-05 18:32:42 +08:00
王奎兴 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
rcx 56b39702b5 feat:WMS 模块 「库存查询」-「即时库存」
1. 完成即时库存列表接口改造:JSON 返回每个对象中补充规格型号与库存数量合计字段。
     2. 支持前端基于规格型号进行即时库存的组合条件查询
2026-08-05 18:18:08 +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
王奎兴 8414fa1509 业务单详情添加执行单信息; 2026-08-05 14:00:11 +08:00
hjx 4b382e4d8f Merge remote-tracking branch 'origin/dev-ty1.2' into dev-ty1.2 2026-08-05 09:55:47 +08:00
hjx b80668145a feat:参照 WMS 入库单规则,通宇「入仓委托单」需新增「入库仓库」字段,并设置为必填项,设置「入库仓库」校验具体
fix:修复【入库管理-收货管理】中批量设置货物参数(数量/面积/体积/尺寸)时,部分字段留空导致已有数据被重置丢失的问题。
2026-08-05 09:49:19 +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
王奎兴 81841b7ad0 发测试 2026-08-04 14:00:34 +08:00
王奎兴 e366f78081 发测试 2026-08-04 13:58:31 +08:00
王奎兴 a12ac94dd3 bms结算对象同步; 2026-08-04 11:46:59 +08:00
zhaoqing d1ce20abae feat(sys):合同导出 2026-08-04 10:29:48 +08:00
王奎兴 df6b11a8bb 本地 测试文件上传下载; 2026-08-04 09:30:13 +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
秦鸿展 ef53355b87 发测试 2026-08-03 11:47:29 +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
王奎兴 04545a8219 Merge branch 'dev' into feature/dev-0729 2026-07-31 18:05:59 +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
王奎兴 95d232623b Merge branch 'dev' into feature/dev-0729 2026-07-29 18:09: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
秦鸿展 498574763b OMS批量签名 2026-07-29 14:34:54 +08:00
王奎兴 c200645a15 发30 2026-07-29 14:32:11 +08:00
秦鸿展 c852ef1b8b OMS批量签名 2026-07-29 14:29:56 +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
秦鸿展 f660c66027 修复启动报错 2026-07-28 15:50:17 +08:00
秦鸿展 c1e062082a OMS的签名表以及详情,WMS的批量签名 2026-07-28 15:43:38 +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
秦鸿展 e77937fb89 批量电子签名 2026-07-25 17:15:04 +08:00
秦鸿展 6b78248531 出库签名列表查询以及详情 2026-07-25 13:32:26 +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
秦鸿展 21db85ef2b 入库查询签名列表以及详情 2026-07-24 16:46:42 +08:00
zhaoqing f32f43ab18 feat(oms):出入库明细查询 2026-07-24 15:46:30 +08:00
zhaoqing eb3ada8335 feat(oms):出入库明细查询 2026-07-24 14:19:04 +08:00
zhaoqing 49f6832d3f feat(oms):出库明细查询 2026-07-24 11:24:10 +08:00
zhaoqing 60bc140195 feat(oms):入库明细查询 2026-07-24 10:10:57 +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
303 changed files with 13322 additions and 1531 deletions
BIN
View File
Binary file not shown.
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* bms财务结算系统feign调用接口
*/
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface BmsServiceFeign {
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface OmsServiceFeign {
@@ -66,4 +66,8 @@ public interface OmsServiceFeign {
@ApiOperation("批量推送")
@PostMapping("/reservationStockOutOrderApi/batchPushByNumber")
public AjaxResult batchPushByNumber(@RequestBody List<String> numberList);
@ApiOperation("保存电子签名记录")
@PostMapping("/electronicSignatureApi/saveSignature")
public AjaxResult saveSignature(@RequestBody ElectronicSignatureSyncDTO saveDTO);
}
@@ -165,6 +165,10 @@ public interface UserServiceFeign {
@GetMapping("/userShipperApi/userShipperListAll")
public AjaxResult<?> userShipperListAll();
@ApiOperation("查询租户下全部托运人")
@GetMapping("/userShipperApi/userShipperListAllByOrg")
public AjaxResult<?> userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode);
@ApiOperation("查询租户下全部承运人")
@GetMapping("/userDriverApi/userDriverListAll")
public AjaxResult<?> userDriverListAll();
@@ -223,4 +227,7 @@ public interface UserServiceFeign {
@ApiOperation("查询赊销额度")
@PostMapping("/userShipperApi/querySaleCreditLimitFeign")
public AjaxResult querySaleCreditLimitFeign(@RequestBody UserShipperFeignDTO userShipperDTO);
@GetMapping("/userApi/getUserByUserAccount")
R<LoginUser> getUserByUserAccount(@RequestParam("userAccount") String account);
}
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class)
public interface WlhyServiceFeign {
/**
@@ -21,7 +21,7 @@ import java.util.Map;
* @description: TODO
* @date 2024/5/10 8:58
**/
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface WmsServiceFeign {
/**
@@ -141,4 +141,14 @@ public interface WmsServiceFeign {
@ApiOperation("生成拣货单")
@PostMapping("/stockOutOrderApi/genPickingOrderByOms")
public AjaxResult genPickingOrderByOms(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
/**
* OMS批量签名:更新WMS入/出库单签名字段
*
* <p>OMS端勾选记录批量签名后,通过此Feign调用WMS的 /stockSignatureApi/batchSign 接口,
* 同步更新WMS stock_in_order / stock_out_order 表的签名状态、签名时间、签名图片、签名备注。</p>
*/
@ApiOperation("OMS批量签名-同步WMS入/出库单签名字段")
@PostMapping("/stockSignatureApi/batchSign")
public AjaxResult batchSignWms(@RequestBody SignatureBatchFeignDTO dto);
}
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class)
public interface YmsServiceFeign {
/**
@@ -0,0 +1,108 @@
package com.mhd.system.api.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 电子签名同步DTOWMS端通过Feign调用OMS
*/
@Data
public class ElectronicSignatureSyncDTO {
@ApiModelProperty("订单ID")
private Long orderId;
@ApiModelProperty("订单号")
private String orderNumber;
@ApiModelProperty("订单类型:IN-入库 OUT-出库")
private String orderType;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("组织名称")
private String organizationName;
@ApiModelProperty("一级组织ID")
private Long topOrganizationId;
@ApiModelProperty("仓库ID")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("创建人")
private Long createBy;
@ApiModelProperty("创建人姓名")
private String createByName;
@ApiModelProperty("物料明细列表")
private List<MaterialDetailItem> materialDetailList;
@Data
public static class MaterialDetailItem {
@ApiModelProperty("物料基础信息ID")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("数量")
private BigDecimal quantity;
@ApiModelProperty("单位代码")
private String unitCode;
@ApiModelProperty("单位名称")
private String unitName;
@ApiModelProperty("批次号")
private String batchNumber;
@ApiModelProperty("LOT编号")
private String lotNumber;
@ApiModelProperty("仓库ID")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("库区ID")
private Long storageSectionId;
@ApiModelProperty("库区编码")
private String storageSectionCode;
@ApiModelProperty("库区名称")
private String storageSectionName;
@ApiModelProperty("库位ID")
private Long storageLocationId;
@ApiModelProperty("库位编码")
private String storageLocationCode;
@ApiModelProperty("库位名称")
private String storageLocationName;
@ApiModelProperty("业务唯一ID")
private Long uniqueId;
}
}
@@ -240,9 +240,7 @@ public class InMaterialDetail extends BaseVOEntity {
@ApiModelProperty("父级唯一Id")
private Long parentUniqueId;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("越库单id")
private Long overStockId;
@@ -376,4 +374,24 @@ public class InMaterialDetail extends BaseVOEntity {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date drinkDate;
@ApiModelProperty("来货验收是否合格;1 合格,0 不合格")
@Excel(name = "来货验收是否合格;1 合格,0 不合格")
private String arrivalAcceptQualified;
@ApiModelProperty("包装是否破损;1 破损,0 完好")
@Excel(name = "包装是否破损;1 破损,0 完好")
private String packageDamaged;
@ApiModelProperty("是否解冻 / 水渍;1 是,0 否")
@Excel(name = "是否解冻 / 水渍;1 是,0 否")
private String isThawWaterstain;
@ApiModelProperty("问题货是否已通知客户;1 已通知,0 未通知")
@Excel(name = "问题货是否已通知客户;1 已通知,0 未通知")
private String notifyCustomerAbnormal;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}
@@ -0,0 +1,42 @@
package com.mhd.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* OMS→WMS 批量签名 Feign DTO
*
* <p>OMS端批量签名时,通过此DTO调用WMS的批量签名接口,
* 更新WMS stock_in_order / stock_out_order 表的签名字段。</p>
*/
@Data
public class SignatureBatchFeignDTO {
@ApiModelProperty("入库单ID列表")
private List<Long> inOrderIds;
@ApiModelProperty("出库单ID列表")
private List<Long> outOrderIds;
@ApiModelProperty("签名状态:2-已签名")
private Integer signatureStatus;
@ApiModelProperty("签名时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date signatureTime;
@ApiModelProperty("手写签名图片(base64或URL,单张)")
private String signaturePic;
@ApiModelProperty("拍照取证图片(逗号分隔多张URL")
private String evidencePics;
@ApiModelProperty("签名备注")
private String signatureRemark;
}
@@ -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,28 @@ public class WarehouseFeignPO extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是")
private Integer nullify;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
}
@ApiModelProperty("订单号生成规则(0-日期累加 1-历史累加)")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -90,6 +90,11 @@ public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsService
public AjaxResult batchPushByNumber(List<String> numberList) {
return null;
}
@Override
public AjaxResult saveSignature(ElectronicSignatureSyncDTO saveDTO) {
return null;
}
};
}
}
@@ -140,6 +140,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
return AjaxResult.error("获取租户托运人失败");
}
@Override
public AjaxResult<?> userShipperListAllByOrg(Long orgCode) {
return null;
}
@Override
public AjaxResult<?> userDriverListAll() {
return AjaxResult.error("获取租户承运人失败");
@@ -170,6 +175,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());
@@ -85,7 +85,7 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
@Override
public AjaxResult execution(StockOutOrderDTO stockOutOrderDTO) {
return null;
return AjaxResult.error(cause.getMessage());
}
@Override
@@ -119,6 +119,12 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
return null;
}
@Override
public AjaxResult batchSignWms(SignatureBatchFeignDTO dto) {
log.error("WMS批量签名调用失败");
return AjaxResult.error("WMS批量签名调用失败:" + cause.getMessage());
}
};
}
}
@@ -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);
+22 -5
View File
@@ -15,19 +15,20 @@ spring:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
# username: nacos
# password: manhuoda@2023
#线上正式环境
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.102.192.31:6848
# server-addr: 10.102.192.5:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -36,3 +37,19 @@ spring:
# 共享配置
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"
@@ -0,0 +1,34 @@
package com.mhd.bi.domain.biPlatformRealData.repository.mapper;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import java.util.List;
/**
* 月台监测-真实数据 Mapper
* 数据来源:TEST_NGWL_YMS 库(达梦,跨库访问)
* 注:列名按达梦默认大写规则;若实际库中小写请反馈调整
*/
public interface BiPlatformRealDataMapper {
/** 作业车辆状态列表 */
List<RealPlatformVehiclePO> queryVehicles();
/** 月台实时概览(总数 / 当前作业中) */
RealPlatformOverviewPO queryPlatformOverview();
/** 今日作业任务数 */
Long countTodayTasks();
/** 车辆状态统计(今日) */
RealVehicleStatusPO queryVehicleStatusToday();
/** 本月任务量 */
Long countMonthTasks();
/** 任务负荷(今日 24 小时) */
List<RealTaskLoadPO> queryTaskLoadToday();
}
@@ -0,0 +1,18 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台实时概览(真实数据,来自 TEST_NGWL_YMS.QMS_WINDOW_INFO
*/
@Data
public class RealPlatformOverviewPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 月台总数 */
private Long totalPlatforms;
/** 当前作业中(月台作业状态=占用) */
private Long operatingPlatforms;
}
@@ -0,0 +1,30 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 月台监测-作业车辆(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS 等)
*/
@Data
public class RealPlatformVehiclePO implements Serializable {
private static final long serialVersionUID = 1L;
/** 车牌号(qms_main_business.CARNO */
private String plateNumber;
/** 流程状态(qms_main_business.FLOWSTATUS */
private String status;
/** 叫号月台(qms_queue_list.WINDOWNAME */
private String platformId;
/** 月台作业时长,分钟(EXITTIME - ENTRYTIME */
private Long platformDuration;
/** 预约申请时间(qms_main_business.CREATE_TIME */
private String appointmentTime;
/** 作业楼层(qms_window_info.PLATFORMFLOOR */
private String workFloor;
}
@@ -0,0 +1,18 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 任务负荷统计(按小时,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
*/
@Data
public class RealTaskLoadPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 0-23 小时 */
private Integer hourOfDay;
/** 该小时段任务数 */
private Long taskCount;
}
@@ -0,0 +1,24 @@
package com.mhd.bi.domain.biPlatformRealData.repository.po;
import lombok.Data;
import java.io.Serializable;
/**
* 作业车辆状态统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS
*/
@Data
public class RealVehicleStatusPO implements Serializable {
private static final long serialVersionUID = 1L;
/** 今日预约车辆 */
private Long todayReservedVehicles;
/** 当前未签到 */
private Long notCheckedIn;
/** 当前作业中 */
private Long operatingVehicles;
/** 作业完成 */
private Long completedVehicles;
}
@@ -0,0 +1,184 @@
package com.mhd.bi.domain.biPlatformRealData.service;
import com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilder;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* 月台监测-真实数据业务层(封装 YMS 跨库查询)
* 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照
*/
@Service
public class BiPlatformRealDataService {
@Resource
private BiPlatformRealDataMapper biPlatformRealDataMapper;
public List<RealPlatformVehiclePO> queryVehicles() {
try {
return biPlatformRealDataMapper.queryVehicles();
} catch (Exception e) {
return java.util.Collections.emptyList();
}
}
public RealPlatformOverviewPO queryPlatformOverview() {
try {
RealPlatformOverviewPO po = biPlatformRealDataMapper.queryPlatformOverview();
if (po == null) {
po = new RealPlatformOverviewPO();
}
if (po.getTotalPlatforms() == null) po.setTotalPlatforms(0L);
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
return po;
} catch (Exception e) {
RealPlatformOverviewPO po = new RealPlatformOverviewPO();
po.setTotalPlatforms(0L);
po.setOperatingPlatforms(0L);
return po;
}
}
public long countTodayTasks() {
try {
Long n = biPlatformRealDataMapper.countTodayTasks();
return n == null ? 0L : n;
} catch (Exception e) {
return 0L;
}
}
public RealVehicleStatusPO queryVehicleStatusToday() {
try {
RealVehicleStatusPO po = biPlatformRealDataMapper.queryVehicleStatusToday();
if (po == null) po = new RealVehicleStatusPO();
if (po.getTodayReservedVehicles() == null) po.setTodayReservedVehicles(0L);
if (po.getNotCheckedIn() == null) po.setNotCheckedIn(0L);
if (po.getOperatingVehicles() == null) po.setOperatingVehicles(0L);
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
return po;
} catch (Exception e) {
RealVehicleStatusPO po = new RealVehicleStatusPO();
po.setTodayReservedVehicles(0L);
po.setNotCheckedIn(0L);
po.setOperatingVehicles(0L);
po.setCompletedVehicles(0L);
return po;
}
}
public long countMonthTasks() {
try {
Long n = biPlatformRealDataMapper.countMonthTasks();
return n == null ? 0L : n;
} catch (Exception e) {
return 0L;
}
}
public List<RealTaskLoadPO> queryTaskLoadToday() {
try {
return biPlatformRealDataMapper.queryTaskLoadToday();
} catch (Exception e) {
return java.util.Collections.emptyList();
}
}
/**
* 实时组装月台监测数据:真实字段查 YMS 库,写死字段保留静态值。
* 每次调用实时查库,不经过快照表。
*/
public PlatformSurveillanceVO buildRealTimePlatformSurveillance() {
Random r = new Random();
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
// 作业车辆列表
List<RealPlatformVehiclePO> realVehicles = queryVehicles();
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
for (RealPlatformVehiclePO rv : realVehicles) {
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
v.setAppointmentTime(rv.getAppointmentTime());
v.setWorkFloor(rv.getWorkFloor());
v.setPlateNumber(rv.getPlateNumber());
v.setStatus(rv.getStatus());
v.setPlatformId(rv.getPlatformId());
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
vehicleVos.add(v);
}
if (!vehicleVos.isEmpty()) {
template.setVehicles(vehicleVos);
}
// 月台实时概览
RealPlatformOverviewPO ov = queryPlatformOverview();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue());
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
int total = ov.getTotalPlatforms().intValue();
int occ = ov.getOperatingPlatforms().intValue();
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
template.getPlatformOverview().setCurrentOccupancyRate(rate);
}
long todayTasks = countTodayTasks();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTodayTasks((int) todayTasks);
}
// 作业车辆状态统计
RealVehicleStatusPO vs = queryVehicleStatusToday();
if (template.getVehicleStatus() != null) {
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
}
// 本月任务统计 taskTotal
long monthTasks = countMonthTasks();
if (template.getMonthlyTaskStatistics() != null) {
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
}
// 任务负荷(今日 24 小时)
List<RealTaskLoadPO> loads = queryTaskLoadToday();
if (!loads.isEmpty() && template.getTaskLoadStatistics() != null) {
Map<Integer, Long> hourMap = new HashMap<>();
for (RealTaskLoadPO l : loads) {
hourMap.put(l.getHourOfDay(), l.getTaskCount());
}
for (TaskLoadItemVO item : template.getTaskLoadStatistics()) {
Integer hour = parseHourFromLabel(item.getTime());
if (hour != null) {
Long n = hourMap.get(hour);
if (n != null) item.setTaskCount(n.intValue());
}
}
}
return template;
}
private static Integer parseHourFromLabel(String label) {
if (label == null) return null;
try {
String s = label.replace("", "").trim();
return Integer.parseInt(s);
} catch (Exception e) {
return null;
}
}
}
@@ -13,10 +13,20 @@ import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillance
import com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone.HkMacaoServiceZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.transportZone.TransportOperationZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.warehouseZone.WarehouseOperationZoneVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO;
import com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Random;
/**
@@ -34,6 +44,7 @@ public class BiReportSnapshotSyncService {
private final BiSnapshotWriteMapper biSnapshotWriteMapper;
private final ObjectMapper objectMapper;
private final BiPlatformRealDataService biPlatformRealDataService;
/**
* 依次同步各快照表;单表失败不影响其它表,只记日志。
@@ -137,9 +148,87 @@ public class BiReportSnapshotSyncService {
return BiSnapshotWeeklyRandomDataBuilder.warehouseTransport(new Random());
}
/** TODO 业务落地:改为查询真实数据。临时实现见 {@link BiSnapshotWeeklyRandomDataBuilder#platformSurveillance(Random)}。 */
/** TODO 业务落地:部分字段改为真实数据,其余仍写死。 */
protected PlatformSurveillanceVO buildPlatformSurveillanceSnapshot() {
return BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(new Random());
Random r = new Random();
// 写死数据复用原 builder
PlatformSurveillanceVO template = BiSnapshotWeeklyRandomDataBuilder.platformSurveillance(r);
// ====== 真实数据:作业车辆列表 ======
List<RealPlatformVehiclePO> realVehicles = biPlatformRealDataService.queryVehicles();
List<PlatformVehicleItemVO> vehicleVos = new ArrayList<>();
for (RealPlatformVehiclePO rv : realVehicles) {
PlatformVehicleItemVO v = new PlatformVehicleItemVO();
v.setAppointmentTime(rv.getAppointmentTime());
v.setWorkFloor(rv.getWorkFloor());
v.setPlateNumber(rv.getPlateNumber());
v.setStatus(rv.getStatus());
v.setPlatformId(rv.getPlatformId());
v.setPlatformDuration(rv.getPlatformDuration() == null ? 0 : rv.getPlatformDuration().intValue());
vehicleVos.add(v);
}
if (!vehicleVos.isEmpty()) {
template.setVehicles(vehicleVos);
}
// ====== 真实数据:月台实时概览 ======
RealPlatformOverviewPO ov = biPlatformRealDataService.queryPlatformOverview();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTotalPlatforms(ov.getTotalPlatforms().intValue());
template.getPlatformOverview().setOperatingPlatforms(ov.getOperatingPlatforms().intValue());
int total = ov.getTotalPlatforms().intValue();
int occ = ov.getOperatingPlatforms().intValue();
int rate = total > 0 ? (int) Math.round(((double) occ / total) * 100.0) : 0;
template.getPlatformOverview().setCurrentOccupancyRate(rate);
}
long todayTasks = biPlatformRealDataService.countTodayTasks();
if (template.getPlatformOverview() != null) {
template.getPlatformOverview().setTodayTasks((int) todayTasks);
}
// ====== 真实数据:作业车辆状态统计 ======
RealVehicleStatusPO vs = biPlatformRealDataService.queryVehicleStatusToday();
if (template.getVehicleStatus() != null) {
template.getVehicleStatus().setTodayReservedVehicles(vs.getTodayReservedVehicles().intValue());
template.getVehicleStatus().setNotCheckedIn(vs.getNotCheckedIn().intValue());
template.getVehicleStatus().setOperatingVehicles(vs.getOperatingVehicles().intValue());
template.getVehicleStatus().setCompletedVehicles(vs.getCompletedVehicles().intValue());
}
// ====== 真实数据:本月任务统计 taskTotal ======
long monthTasks = biPlatformRealDataService.countMonthTasks();
if (template.getMonthlyTaskStatistics() != null) {
template.getMonthlyTaskStatistics().setTaskTotal((int) monthTasks);
}
// ====== 真实数据:任务负荷(今日 24 小时) ======
List<RealTaskLoadPO> loads = biPlatformRealDataService.queryTaskLoadToday();
if (!loads.isEmpty() && template.getTaskLoadStatistics() != null) {
Map<Integer, Long> hourMap = new HashMap<>();
for (RealTaskLoadPO l : loads) {
hourMap.put(l.getHourOfDay(), l.getTaskCount());
}
for (com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO item : template.getTaskLoadStatistics()) {
Integer hour = parseHourFromLabel(item.getTime());
if (hour != null) {
Long n = hourMap.get(hour);
if (n != null) item.setTaskCount(n.intValue());
}
}
}
return template;
}
private static Integer parseHourFromLabel(String label) {
if (label == null) return null;
// "15时" -> 15
try {
String s = label.replace("", "").trim();
return Integer.parseInt(s);
} catch (Exception e) {
return null;
}
}
/**
@@ -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"},
@@ -3,6 +3,7 @@ package com.mhd.bi.interfaces.facadeApi.biReport;
import com.mhd.bi.domain.biSnapshotSync.service.BiReportSnapshotSyncService;
import com.mhd.bi.domain.biComprehensive.service.BiComprehensiveReportService;
import com.mhd.bi.domain.biPlatformSurveillance.service.BiPlatformSurveillanceReportService;
import com.mhd.bi.domain.biPlatformRealData.service.BiPlatformRealDataService;
import com.mhd.bi.domain.biOverallOperation.service.BiOverallOperationReportService;
import com.mhd.bi.domain.biHkMacaoServiceZone.service.BiHkMacaoServiceZoneReportService;
import com.mhd.bi.domain.biTransportOperationZone.service.BiTransportOperationZoneReportService;
@@ -48,6 +49,9 @@ public class BiReportApi extends BaseController {
@Autowired
private BiPlatformSurveillanceReportService biPlatformSurveillanceReportService;
@Autowired
private BiPlatformRealDataService biPlatformRealDataService;
@Autowired
private BiOverallOperationReportService biOverallOperationReportService;
@@ -92,12 +96,12 @@ public class BiReportApi extends BaseController {
}
/**
* 月台监测指标查询(按照 del_flag=1,按 create_time 最新一条
* 月台监测指标查询(实时查 YMS 库,真实字段 + 写死字段
*/
@ApiOperation(value = "月台监测指标查询", notes = "返回 DEL_FLAG=1 且 CREATE_TIME 最新的一条快照")
@ApiOperation(value = "月台监测指标查询", notes = "每次调用实时查询 YMS 库组装;部分字段为真实业务数据,部分为写死数据")
@GetMapping("/platformSurveillance")
public BiApiResult<PlatformSurveillanceVO> platformSurveillance() {
PlatformSurveillanceVO data = biPlatformSurveillanceReportService.loadLatestPlatformSurveillance();
PlatformSurveillanceVO data = biPlatformRealDataService.buildRealTimePlatformSurveillance();
return BiApiResult.ok(data);
}
//园区物流大屏接口----------------------------------------------------------------------
@@ -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
# 线上测试环境配置 容器名+端口号
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
<!-- 作业车辆状态列表(vehicles):
plateNumber <- qms_main_business.CARNO
status <- qms_main_business.FLOWSTATUS
platformId <- qms_queue_list.WINDOWNAME(按主业务的某个窗口关联键关联;此处用 businessNo = windowNo 关联,根据实际表调整)
platformDuration <- qms_main_business.EXITTIME - ENTRYTIME(分钟)
appointmentTime <- qms_main_business.CREATE_TIME(创建时间)
workFloor <- qms_window_info.PLATFORMFLOOR(按 platformId 关联窗口号)
注:列名按达梦默认大写规则;若实际为小写,请反馈调整 -->
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
SELECT
mb.CARNO AS plateNumber,
mb.FLOWSTATUS AS status,
ql.WINDOWNAME AS platformId,
CASE
WHEN mb.EXITTIME IS NOT NULL AND mb.ENTRYTIME IS NOT NULL
THEN CAST((mb.EXITTIME - mb.ENTRYTIME) AS BIGINT)
ELSE 0
END AS platformDuration,
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
wi.PLATFORMFLOOR AS workFloor
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
LEFT JOIN NGWL_TEST_YMS.QMS_QUEUE_LIST ql ON ql.MAIN_BUSINESS_ID = mb.ID
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi ON wi.WINDOW_NO = ql.WINDOWNAME
WHERE 1=1
AND mb.DEL_FLAG = 1
ORDER BY mb.CREATE_TIME DESC
LIMIT 50
</select>
<!-- 月台概览:totalPlatforms(总条数)、operatingPlatforms(作业状态=占用/作业中) -->
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
SELECT
COUNT(1) AS totalPlatforms,
SUM(CASE WHEN STATUS = 2 THEN 1 ELSE 0 END) AS operatingPlatforms
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
WHERE DEL_FLAG = 1
</select>
<!-- 今日作业任务:实际进入时间是今日的 -->
<select id="countTodayTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
</select>
<!-- 车辆状态统计:今日的统计(按预约申请时间 / 流程状态) -->
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
SELECT
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
SUM(CASE WHEN FLOWSTATUS = '已预约' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
SUM(CASE WHEN FLOWSTATUS IN ('已进场','已称重','已装车','二次称重','已结算','已还卡') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
SUM(CASE WHEN FLOWSTATUS = '已出场' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
</select>
<!-- 本月任务量:实际进入时间是本月的 -->
<select id="countMonthTasks" resultType="java.lang.Long">
SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND ENTRYTIME IS NOT NULL
AND TO_CHAR(ENTRYTIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
</select>
<!-- 任务负荷(今日 24 小时时段):按 HOUR(ENTRYTIME) 统计 -->
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
SELECT
HOUR(ENTRYTIME) AS hourOfDay,
COUNT(1) AS taskCount
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
AND ENTRYTIME IS NOT NULL
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE)
GROUP BY HOUR(ENTRYTIME)
ORDER BY HOUR(ENTRYTIME)
</select>
</mapper>
@@ -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;
@@ -33,4 +33,6 @@ public class WarehousePO implements Serializable {
@Excel(name = "仓库名称")
private String warehouseName;
@Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable;
}
@@ -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: 10.33.0.129:6010
#线上正式环境
# server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
# 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: 10.33.0.129:6010
#线上正式环境
# server-addr: 127.0.0.1:8848
# server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
# 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());
@@ -759,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){
@@ -830,8 +834,9 @@ public class ContractManageApplicationService {
if (isInsert) {
// 新增/复制时使用新插入的合同ID
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
} else if(null != contractManagePO){
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId());
} else {
// 修改时使用当前正在修改的合同ID不能用 getInfoByCode1 查到的避免多条合同 originalContractNumber 相同导致明细错绑
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
}
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
@@ -977,7 +982,8 @@ public class ContractManageApplicationService {
&& Objects.equals(item.getContractType(), contractType))
.collect(Collectors.toList());
if (contractManagePOs != null && contractManagePOs.size() > 1) {
throw new ServiceException("存在多条相同费用科目的合同,请检查");
resultContract.setIsMany("1");
return resultContract;
}
if(contractManagePOList != null && contractManagePOList.size()>0){
if(StringUtils.isNotEmpty(settlementCustomersCode)){
@@ -1118,4 +1124,51 @@ public class ContractManageApplicationService {
public ContractManagePO getGeneralContract() {
return contractManageDomainService.getGeneralContract();
}
/**
* 合同导出合同头字段 + 明细拍平成一行一条明细
*/
public List<ContractManageExportVO> buildExportList(ContractManageDO contractManageDO) {
List<ContractManagePO> contractList = this.queryList(contractManageDO);
List<ContractManageExportVO> exportList = new ArrayList<>();
if (contractList == null || contractList.isEmpty()) {
return exportList;
}
List<Long> contractManageIds = contractList.stream()
.map(ContractManagePO::getContractManageId)
.collect(Collectors.toList());
Map<Long, List<ContractManageDetailPO>> detailMap = contractManageDetailDomainService
.queryListByManageIds(contractManageIds).stream()
.collect(Collectors.groupingBy(ContractManageDetailPO::getContractManageId));
for (ContractManagePO contract : contractList) {
List<ContractManageDetailPO> details = detailMap.get(contract.getContractManageId());
if (details != null && !details.isEmpty()) {
for (ContractManageDetailPO detail : details) {
ContractManageExportVO vo = new ContractManageExportVO();
// 合同头字段整体复制
BeanUtils.copyProperties(contract, vo);
// 明细字段显式赋值合同头/明细存在同名字段避免互相覆盖
vo.setSubjectType(detail.getSubjectType());
vo.setFirstSubjectCode(detail.getFirstSubjectCode());
vo.setFirstSubjectName(detail.getFirstSubjectName());
vo.setSecondSubjectCode(detail.getSecondSubjectCode());
vo.setSecondSubjectName(detail.getSecondSubjectName());
vo.setAccountingStrategy(detail.getAccountingStrategy());
vo.setBillingAttributes(detail.getBillingAttributes());
vo.setSubjectEffectiveDate(detail.getSubjectEffectiveDate());
vo.setSubjectExpirationDate(detail.getSubjectExpirationDate());
vo.setDocumentType(detail.getDocumentType());
vo.setServiceItemsName(detail.getServiceItemsName());
exportList.add(vo);
}
} else {
// 无明细的合同也保留一行头字段
ContractManageExportVO vo = new ContractManageExportVO();
BeanUtils.copyProperties(contract, vo);
exportList.add(vo);
}
}
return exportList;
}
}
@@ -183,5 +183,5 @@ public class ContractManagePO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
private String isMany;
}
@@ -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;
}
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 合同管理详情
@@ -95,5 +96,29 @@ public class ContractManageDetailDomainService {
return resultList;
}
/**
* 根据多个合同管理id批量查询合同科目详情一次SQL查询避免逐合同N+1
* @param contractManageIds 合同管理id集合
* @return 合同科目详情列表
*/
public List<ContractManageDetailPO> queryListByManageIds(Collection<Long> contractManageIds) {
List<ContractManageDetailPO> resultList = new ArrayList<>();
if (contractManageIds == null || contractManageIds.isEmpty()) {
return resultList;
}
LambdaQueryWrapper<ContractManageDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ContractManageDetail::getContractManageId, contractManageIds);
queryWrapper.eq(ContractManageDetail::getDelFlag, 1);
List<ContractManageDetail> contractManageDetails = contractManageDetailService.list(queryWrapper);
if (contractManageDetails != null && contractManageDetails.size() > 0) {
for (ContractManageDetail contractManageDetail : contractManageDetails) {
ContractManageDetailPO contractManageDetailPO = new ContractManageDetailPO();
BeanUtils.copyProperties(contractManageDetail, contractManageDetailPO);
resultList.add(contractManageDetailPO);
}
}
return resultList;
}
}
@@ -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;
}
@@ -91,31 +91,15 @@ 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());
//设置仓库
setWarehouseInfo(storageSectionDO);
String storageCode = storageSectionDO.getStorageCode();
String storageName = storageSectionDO.getStorageName();
Long warehouseId = storageSectionDO.getWarehouseId();
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageCode, storageCode)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
.eq(StorageSection::getStorageName, storageName)
.eq(StorageSection::getWarehouseId, warehouseId)
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
.eq(StorageSection::getDelFlag, 1));
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
throw new ServiceException("库区编码或名称已存在");
}
return storageSectionService.update(storageSectionDO);
}
@@ -122,5 +122,28 @@ public class Warehouse extends BaseVOEntity{
@Excel(name = "是否启用: 1-否 2-是")
private Integer isEnable;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则0日期累加1历史累加")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -124,5 +124,28 @@ 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;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -131,4 +131,29 @@ public class WarehouseDO extends BaseVOEntity{
private String orgIds;
@ApiModelProperty("组织id 集合")
private List<Long> orgIdList;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -0,0 +1,102 @@
package com.mhd.basic.interfaces.dto.contractManage;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 合同管理导出对象合同头字段 + 科目明细字段拍平为一行一条明细
*
* @author gen
* @date 2024-06-07
*/
@Data
@ApiModel(value = "合同管理导出对象", description = "合同管理导出对象(含明细)")
public class ContractManageExportVO {
/** ====== 合同头字段(与 ContractManagePO 的 @Excel 一致) ====== */
@Excel(name = "合同编号")
private String contractNumber;
@Excel(name = "合同名称")
private String contractName;
@Excel(name = "是否通用合同", readConverterExp = "1=是,2=否")
private Integer commonContractFlag;
@Excel(name = "合同类型", readConverterExp = "1=仓储,2=运输,3=其他")
private Integer contractType;
@Excel(name = "合同状态", readConverterExp = "1=未生效,2=使用中,3=已过期,4=已作废")
private Integer contractState;
@Excel(name = "签订单位")
private String signingUnit;
@Excel(name = "结算主体")
private String settlementCustomers;
@Excel(name = "我司身份", readConverterExp = "1=甲方,2=乙方")
private Integer ourIdentity;
@Excel(name = "账期", readConverterExp = "1=每月,2=双月,3=季度")
private Integer accountingPeriod;
@Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date signingDate;
@Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date effectiveDate;
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
@Excel(name = "组织名称")
private String organizationName;
@Excel(name = "客户类型")
private String customerType;
@Excel(name = "是否自动出账", readConverterExp = "1=是,2=否")
private Integer automaticFlag;
@Excel(name = "备注")
private String remark;
/** ====== 明细字段(来源于 contract_manage_detail ====== */
@Excel(name = "结算科目类型", readConverterExp = "1=通用,2=临时")
private Integer subjectType;
@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 String accountingStrategy;
@Excel(name = "计费周期")
private String billingAttributes;
@Excel(name = "科目生效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectEffectiveDate;
@Excel(name = "科目到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectExpirationDate;
@Excel(name = "单据类型")
private String documentType;
@Excel(name = "费用类别")
private String serviceItemsName;
}
@@ -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 {}
}
}
@@ -136,4 +136,29 @@ public class WarehouseDTO extends BaseVOEntity{
private String orgIds;
@ApiModelProperty("组织id 集合")
private List<Long> orgIdList;
@ApiModelProperty("任务模式")
@Excel(name = "任务模式")
private String taskMode;
@ApiModelProperty("作业模式")
@Excel(name = "作业模式")
private String workMode;
@ApiModelProperty("订单号生成规则")
@Excel(name = "单号生成规则")
private String orderNoGenerateRule;
@ApiModelProperty("入库单号首字母前缀")
@Excel(name = "入库单号首字母前缀")
private String inOrderNoPrefix;
@ApiModelProperty("出库单号首字母前缀")
@Excel(name = "出库单号首字母前缀")
private String outOrderNoPrefix;
@ApiModelProperty("样品出库单号首字母前缀")
@Excel(name = "样品出库单号首字母前缀")
private String sampleOutOrderNoPrefix;
}
@@ -1,8 +1,11 @@
package com.mhd.basic.interfaces.facade.contractManage;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import com.mhd.basic.interfaces.assember.contractManage.ContractManageAssembler;
import com.mhd.basic.interfaces.dto.contractManage.ContractManageExportVO;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceDTO;
import com.mhd.basic.interfaces.dto.contractManage.SubjectAndPriceReturn;
import io.swagger.annotations.ApiOperation;
@@ -14,9 +17,11 @@ import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
import com.mhd.basic.application.service.contractManage.ContractManageApplicationService;
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;
import com.mhd.common.core.utils.poi.ExcelUtil;
/**
* 合同管理Api
@@ -205,7 +210,24 @@ public class ContractManageApi extends BaseController{
return AjaxResult.success(list);
}
@ApiOperation("导出合同(含明细)")
@GetMapping(value = "/export", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void export(ContractManageDTO contractManageDTO, HttpServletResponse response) throws IOException
{
//转换实体
ContractManageDO contractManageDO = new ContractManageDO();
BeanUtils.copyProperties(contractManageDTO, contractManageDO);
//查询全量不分页并拍平明细
List<ContractManageExportVO> list = contractManageApplicationService.buildExportList(contractManageDO);
//设置下载头防止浏览器乱码
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<ContractManageExportVO> util = new ExcelUtil<>(ContractManageExportVO.class);
util.exportExcel(response, list, "合同导出");
}
}
@@ -16,7 +16,7 @@ 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
#线上正式环境
@@ -25,7 +25,7 @@ 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
#线上正式环境
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectContractManagePo">
SELECT DISTINCT a.*
FROM CONTRACT_MANAGE a
INNER JOIN CONTRACT_MANAGE_DETAIL b
left JOIN CONTRACT_MANAGE_DETAIL b
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
where
a.del_flag = 1
@@ -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
@@ -184,8 +185,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultMap="StorageLocationResult">
<include refid="selectStorageLocationPo"/>
<include refid="selectStorageLocationPo1"/>
-- 按照创建时间倒序排序
order by a.create_time desc
-- 按照库位名称正序排序,名称相同时按创建时间倒序
order by a.storage_location_name asc, a.create_time desc
</select>
<select id="getStorageLocationCount" parameterType="com.mhd.basic.domain.storageLocation.repository.todo.StorageLocationDO" resultType="java.lang.Long">
@@ -100,6 +100,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.basic.domain.storageSection.repository.todo.StorageSectionDO" resultMap="StorageSectionResult">
<include refid="selectStorageSectionPo"/>
<include refid="selectStorageSectionPo1"/>
order by a.create_time desc
order by a.storage_name asc, a.create_time desc
</select>
</mapper>
@@ -37,11 +37,23 @@ 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" />
<result property="sampleOutOrderNoPrefix" column="SAMPLE_OUT_ORDER_NO_PREFIX" />
<result property="orderNoGenerateRule" column="ORDER_NO_GENERATE_RULE" />
<result property="inOrderNoPrefix" column="IN_ORDER_NO_PREFIX" />
<result property="outOrderNoPrefix" column="OUT_ORDER_NO_PREFIX" />
</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,SAMPLE_OUT_ORDER_NO_PREFIX,ORDER_NO_GENERATE_RULE,IN_ORDER_NO_PREFIX,
OUT_ORDER_NO_PREFIX
from warehouse
</sql>
<sql id="selectWarehousePo1">
@@ -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 {
@@ -2942,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
@@ -23,7 +23,10 @@ import com.mhd.common.core.enums.MessageTypeEnum;
import com.mhd.common.core.enums.WebsocketTypeEnum;
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
import com.mhd.common.core.service.jPush.AsyncJPushApplicationService;
import com.mhd.common.core.utils.AESUtil;
import com.mhd.common.core.utils.OConvertUtils;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.security.utils.password.PasswordUtil;
import com.mhd.system.api.FinanceServiceFeign;
import com.mhd.system.api.WlhyServiceFeign;
import com.mhd.system.api.domain.UserShipperEntityFeign;
@@ -359,6 +362,254 @@ public class UserShipperApplicationService {
return result;
}
/**
* Excel 导入委托方
* 模版列登录账号公司名称联系人联系电话地址详细地址备注结算币种NC客户编码
*/
public com.mhd.common.core.web.domain.AjaxResult importShipperFromExcel(org.springframework.web.multipart.MultipartFile file) {
if (file == null || file.isEmpty()) {
return com.mhd.common.core.web.domain.AjaxResult.error("文件不能为空");
}
try {
org.apache.poi.ss.usermodel.Workbook workbook = org.apache.poi.ss.usermodel.WorkbookFactory.create(file.getInputStream());
org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0);
int total = 0, success = 0, failed = 0;
java.util.List<String> errors = new java.util.ArrayList<>();
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null) {
return com.mhd.common.core.web.domain.AjaxResult.error("登录信息失效");
}
Long currentOrgId = loginUser.getUserPo().getOrganizationId();
String currentOrgName = loginUser.getUserPo().getOrganizationName();
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
org.apache.poi.ss.usermodel.Row row = sheet.getRow(i);
if (row == null) continue;
String userAccount = getCellStr(row.getCell(0));
String companyName = getCellStr(row.getCell(1));
if (org.springframework.util.StringUtils.isEmpty(companyName)) continue;
total++;
try {
String contactName = getCellStr(row.getCell(2));
String contactPhone = getCellStr(row.getCell(3));
String address = getCellStr(row.getCell(4));
String detailedAddress = getCellStr(row.getCell(5));
String remark = getCellStr(row.getCell(6));
String settlementCurrency = getCellStr(row.getCell(7));
String ncCustomerCode = getCellStr(row.getCell(8));
// 先按公司名称查是否已存在委托方
UserShipperEntity existingShipper = findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
if (existingShipper != null && existingShipper.getShipperId() != null) {
// 已存在按模板更新指定字段
updateShipperFromExcel(existingShipper, userAccount, companyName,
contactName, contactPhone, address, detailedAddress,
remark, settlementCurrency, ncCustomerCode, loginUser, currentOrgId);
success++;
} else {
UserShipperDO shipperDO = new UserShipperDO();
shipperDO.setShipperType(2);
shipperDO.setDataSource(2);
shipperDO.setUserAccount(userAccount);
shipperDO.setShipperEnterpriseName(companyName);
// NC客户编码使用模板中的独立字段不再复用登录账号
shipperDO.setCustomerNcCode(ncCustomerCode);
// 联系人 -> user表 user_name + user_shipper表 user_name_shipper
shipperDO.setUserName(contactName);
shipperDO.setUserNameShipper(contactName);
// 联系电话 -> user表 user_phone
shipperDO.setUserPhone(contactPhone);
// 地址 -> user表 user_area_name详细地址 -> user表 user_area_address
shipperDO.setUserAreaName(address);
shipperDO.setUserAreaAddress(detailedAddress);
shipperDO.setRemark(remark);
shipperDO.setSettlementCurrency(settlementCurrency);
// 新导入账号默认密码 Aa123456按前端加密约定先 AES 加密
shipperDO.setUserPassword(AESUtil.encrypt("Aa123456"));
// 初始化 orgCode记录当前组织信息和NC客户编码
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
orgItem.put("name", currentOrgName);
orgItem.put("code", currentOrgId);
orgItem.put("ncCustomer", ncCustomerCode);
orgItem.put("names", currentOrgId);
orgCodeArray.add(orgItem);
shipperDO.setOrgCode(orgCodeArray.toJSONString());
Map<String, Object> addResult = addShipper(shipperDO);
Object newUserIdObj = addResult.get("userId");
if (newUserIdObj instanceof Long) {
assignCompanyRoleIfMissing((Long) newUserIdObj, currentOrgId);
}
success++;
}
} catch (Exception e) {
failed++;
errors.add("" + (i + 1) + "行[" + companyName + "]导入失败:" + e.getMessage());
log.error("导入委托方第{}行失败", i + 1, e);
}
}
workbook.close();
java.util.Map<String, Object> result = new java.util.HashMap<>();
result.put("total", total);
result.put("success", success);
result.put("failed", failed);
result.put("errorMessages", errors);
return com.mhd.common.core.web.domain.AjaxResult.success("导入完成", result);
} catch (Exception e) {
log.error("解析Excel失败", e);
return com.mhd.common.core.web.domain.AjaxResult.error("解析Excel失败:" + e.getMessage());
}
}
/**
* 导入时若账号没有任何角色则补分配企业货主角色
*/
private void assignCompanyRoleIfMissing(Long userId, Long organizationId) {
if (userId == null || organizationId == null) {
return;
}
List<UserRoleMenuPO> existingRoles = userRoleDomainService.selectRolesByUserId(userId);
if (CollUtil.isNotEmpty(existingRoles)) {
return;
}
// role_code + organization_id 精确匹配角色selectByOrganizationIdAndRoleCode common_where 不含 roleCode 过滤不适用
RolePO rolePO = roleDomainService.selectByRoleCodeAndOrganizationId(RoleEnum.COMPANY.getCode(), organizationId);
if (rolePO == null) {
log.warn("组织{}下未找到{}角色,无法为导入用户{}分配角色", organizationId, RoleEnum.COMPANY.getCode(), userId);
return;
}
// 1. 写入 user_role
UserRoleDo userRoleDo = new UserRoleDo();
userRoleDo.setUserId(userId);
userRoleDo.setRoleId(rolePO.getRoleId());
userRoleDomainService.addUserRole(userRoleDo);
// 2. 同步更新 user 表的 role_code / role_name
UserDO userDO = new UserDO();
userDO.setUserId(userId);
userDO.setRoleCode(RoleEnum.COMPANY.getCode());
userDO.setRoleName(RoleEnum.COMPANY.getName());
userDomainService.updateUser(userDO);
}
/**
* 按Excel模板更新已存在的委托方只更新模板中的字段
*/
private void updateShipperFromExcel(UserShipperEntity existingShipper, String userAccount,
String companyName, String contactName, String contactPhone,
String address, String detailedAddress, String remark,
String settlementCurrency, String ncCustomerCode,
LoginUser loginUser, Long currentOrgId) {
Long userId = existingShipper.getUserId();
// user 主表读取当前登录账号user_shipper 表无 user_account 字段
UserPo existingUser = null;
String existingUserAccount = null;
if (userId != null) {
existingUser = userDomainService.selectByUserId(userId);
if (existingUser != null) {
existingUserAccount = existingUser.getUserAccount();
}
}
if (StringUtils.isBlank(existingUserAccount) && StringUtils.isBlank(userAccount)) {
throw new ServiceException("登录账号不能为空");
}
// 登录账号变更时校验唯一性
if (StringUtils.isNotBlank(userAccount) && !userAccount.equals(existingUserAccount)) {
UserDO checkDO = new UserDO();
checkDO.setUserAccount(userAccount);
checkDO.setTopOrganizationId(existingShipper.getTopOrganizationId());
UserPo existedUser = userDomainService.findByTopOrganizationIdAndUserAccount(checkDO);
if (existedUser != null && !existedUser.getUserId().equals(userId)) {
throw new ServiceException("登录账号已存在:" + userAccount);
}
}
Date now = new Date();
Long updateBy = loginUser.getUserPo().getUserId();
String updateByName = loginUser.getUserPo().getUserName();
// 1. 更新 user_shipper 表指定字段
// 注意user_shipper 表没有 user_account 字段登录账号在 user 主表维护
UserShipperEntity shipperUpdate = new UserShipperEntity();
shipperUpdate.setShipperId(existingShipper.getShipperId());
shipperUpdate.setShipperEnterpriseName(companyName);
shipperUpdate.setUserNameShipper(contactName);
shipperUpdate.setUserAreaName(address);
shipperUpdate.setUserAreaAddress(detailedAddress);
shipperUpdate.setRemark(remark);
shipperUpdate.setSettlementCurrency(settlementCurrency);
shipperUpdate.setCustomerNcCode(ncCustomerCode);
shipperUpdate.setUpdateBy(updateBy);
shipperUpdate.setUpdateByName(updateByName);
shipperUpdate.setUpdateTime(now);
userShipperMapper.updateById(shipperUpdate);
// 2. 同步更新 user 表指定字段
if (userId != null) {
UserDO userDO = new UserDO();
userDO.setUserId(userId);
if (StringUtils.isNotBlank(userAccount)) {
userDO.setUserAccount(userAccount);
}
userDO.setUserName(contactName);
userDO.setUserPhone(contactPhone);
userDO.setUserAreaName(address);
userDO.setUserAreaAddress(detailedAddress);
userDO.setUpdateBy(updateBy);
userDO.setUpdateByName(updateByName);
userDO.setUpdateTime(now);
// 如果现有账号没有密码设置默认密码 Aa123456 addUserInfoShipper 一致的加密流程
if (existingUser != null && StringUtils.isBlank(existingUser.getUserPassword())) {
String finalAccount = StringUtils.isNotBlank(userAccount) ? userAccount : existingUser.getUserAccount();
String salt = OConvertUtils.randomGen(8);
String passwordEncode = PasswordUtil.encrypt(finalAccount, "Aa123456", salt);
userDO.setUserPassword(passwordEncode);
userDO.setUserSalt(salt);
}
userDomainService.updateUser(userDO);
// 如果该账号没有任何角色补分配企业货主角色避免登录报账号未授权角色信息
assignCompanyRoleIfMissing(userId, existingShipper.getOrganizationId());
}
// 3. 更新 orgCode 中当前组织的 ncCustomer
String existingOrgCode = existingShipper.getOrgCode();
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
boolean hasOrg = false;
if (StringUtils.isNotEmpty(existingOrgCode)) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
if (currentOrgId != null && currentOrgId.equals(orgItem.getLong("code"))) {
orgItem.put("ncCustomer", ncCustomerCode);
hasOrg = true;
}
}
} catch (Exception e) {
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
}
}
if (!hasOrg) {
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("name", loginUser.getUserPo().getOrganizationName());
newOrgItem.put("code", currentOrgId);
newOrgItem.put("ncCustomer", ncCustomerCode);
newOrgItem.put("names", currentOrgId);
orgCodeArray.add(newOrgItem);
}
UserShipperEntity orgCodeUpdate = new UserShipperEntity();
orgCodeUpdate.setShipperId(existingShipper.getShipperId());
orgCodeUpdate.setOrgCode(orgCodeArray.toJSONString());
orgCodeUpdate.setUpdateBy(updateBy);
orgCodeUpdate.setUpdateByName(updateByName);
orgCodeUpdate.setUpdateTime(now);
userShipperMapper.updateById(orgCodeUpdate);
}
private String getCellStr(org.apache.poi.ss.usermodel.Cell cell) {
if (cell == null) return null;
cell.setCellType(org.apache.poi.ss.usermodel.CellType.STRING);
String v = cell.getStringCellValue();
return v == null ? null : v.trim();
}
/**
* 个人货主认证
*
@@ -1055,6 +1306,12 @@ public class UserShipperApplicationService {
return userShipperDomainService.userShipperList(userShipperDO);
}
public List<UserShipperPo> userShipperListAllByOrg(Long orgCode) {
UserShipperDO userShipperDO = new UserShipperDO();
userShipperDO.setOrganizationId(orgCode);
return userShipperDomainService.userShipperList(userShipperDO);
}
/**
* E签宝回调接口-认证授权完成
* @param jsonObject 回调参数
@@ -1349,6 +1606,82 @@ public class UserShipperApplicationService {
organizationId);
}
/**
* 按公司名跨组织查询第一个未删除的委托方包含 orgCode
* 用于 MDM 同步时同公司名可能在不同组织下 nc 编码不同但本地是同一条委托方记录
*/
public UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(String shipperEnterpriseName) {
if (StringUtils.isEmpty(shipperEnterpriseName)) {
return null;
}
return userShipperMapper.findFirstByShipperEnterpriseNameAcrossOrgs(shipperEnterpriseName.trim());
}
/**
* 在已存在的同公司名委托方可能属于其他组织 orgCode JSON 数组中追加当前组织信息
* 若目标组织已存在于数组中则跳过不重复追加
*
* @param existingShipper 本地已存在的同公司名委托方
* @param targetOrganizationId 当前同步组织 ID
* @param targetOrganizationName 当前同步组织名称
* @param ncCustomerCode MDM 客商 code作为该组织下的 ncCustomer 记录
* @param loginUser 登录用户用于写入 updateBy
* @return true 表示实际写入新增组织或已存在都返回 true方便调用方统计false 表示参数无效
*/
public boolean appendOrganizationToExistingShipper(UserShipperEntity existingShipper,
Long targetOrganizationId, String targetOrganizationName,
String ncCustomerCode, LoginUser loginUser) {
if (existingShipper == null) {
return false;
}
String existingOrgCode = existingShipper.getOrgCode();
boolean hasOrg = false;
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
if (StringUtils.isNotEmpty(existingOrgCode)) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
// 检查是否已包含当前组织
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (targetOrganizationId != null && targetOrganizationId.equals(itemCode)) {
hasOrg = true;
break;
}
}
} catch (Exception e) {
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
}
}
if (!hasOrg) {
// 添加新组织到orgCode数组
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("name", targetOrganizationName);
newOrgItem.put("code", targetOrganizationId);
newOrgItem.put("ncCustomer", ncCustomerCode);
newOrgItem.put("names", targetOrganizationId);
orgCodeArray.add(newOrgItem);
// 更新委托方的orgCode字段
existingShipper.setOrgCode(orgCodeArray.toJSONString());
if (loginUser != null && loginUser.getUserPo() != null) {
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
}
existingShipper.setUpdateTime(new Date());
userShipperMapper.updateById(existingShipper);
log.info("委托方已存在,添加新组织到orgCodecustomerNcCode={},新增组织code={}name={}",
ncCustomerCode, targetOrganizationId, targetOrganizationName);
} else {
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
ncCustomerCode, targetOrganizationId);
}
return true;
}
public static String buildMasterDataMatchKey(String ncCode, String companyName) {
return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName);
}
@@ -1374,61 +1707,8 @@ public class UserShipperApplicationService {
throw new ServiceException("获取组织配置失败");
}
// 检查是否已存在相同customerNcCode的委托方可能在不同组织
List<UserShipperEntity> existingShippers = userShipperMapper.selectList(
new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getShipperEnterpriseName, record.getDesc1())
.eq(UserShipperEntity::getDelFlag, 1));
if (CollUtil.isNotEmpty(existingShippers)) {
// 找到已存在的委托方检查是否已经有该组织
UserShipperEntity existingShipper = existingShippers.get(0);
String existingOrgCode = existingShipper.getOrgCode();
boolean hasOrg = false;
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
if (StringUtils.isNotEmpty(existingOrgCode)) {
try {
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
// 检查是否已包含当前组织
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (targetOrganizationId.equals(itemCode)) {
hasOrg = true;
break;
}
}
} catch (Exception e) {
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
}
}
if (!hasOrg) {
// 添加新组织到orgCode数组
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
newOrgItem.put("name", targetOrganizationName);
newOrgItem.put("code", targetOrganizationId);
newOrgItem.put("ncCustomer", record.getCode());
newOrgItem.put("names", targetOrganizationId);
orgCodeArray.add(newOrgItem);
// 更新委托方的orgCode字段
existingShipper.setOrgCode(orgCodeArray.toJSONString());
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
existingShipper.setUpdateTime(new Date());
userShipperMapper.updateById(existingShipper);
log.info("委托方已存在,添加新组织到orgCodecustomerNcCode={},新增组织code={}name={}",
record.getCode(), targetOrganizationId, targetOrganizationName);
} else {
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
record.getCode(), targetOrganizationId);
}
return; // 不新增直接返回
}
// 按公司名跨组织匹配已存在委托方的逻辑已迁移到 doSync 先调用 appendOrganizationToExistingShipper
// 走到这里说明按 ncCode+companyName 与公司名均未匹配到本方法只负责"新增"
// 不存在相同的委托方执行新增逻辑
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
@@ -1441,6 +1721,16 @@ public class UserShipperApplicationService {
userShipperDO.setAuthType(2);
userShipperDO.setShipperAuthStatus(3);
// 初始化 orgCode新加的客商属于当前组织将当前组织信息写入 orgCode JSON 数组
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
orgItem.put("name", targetOrganizationName);
orgItem.put("code", targetOrganizationId);
orgItem.put("ncCustomer", record.getCode());
orgItem.put("names", targetOrganizationId);
orgCodeArray.add(orgItem);
userShipperDO.setOrgCode(orgCodeArray.toJSONString());
String userAccount = buildMasterDataUserAccount(record.getCode());
checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId());
userShipperDO.setUserAccount(userAccount);
@@ -1556,7 +1846,7 @@ public class UserShipperApplicationService {
Long targetOrganizationId, String targetOrganizationName,
Long targetTopOrganizationId) {
UserShipperDO userShipperDO = new UserShipperDO();
userShipperDO.setCustomerNcCode(record.getCode());
userShipperDO.setCustomerNcCode(record.getDesc17()); // NC编码用desc17与匹配Key一致
userShipperDO.setUserMemberCode(record.getCode());
userShipperDO.setShipperEnterpriseName(record.getDesc1());
userShipperDO.setUserNameShipper(record.getDesc1());
@@ -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);
@@ -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;
}
@@ -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;
@@ -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);
}
@@ -500,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) {
@@ -212,6 +212,15 @@ public class UserShipperAPI extends BaseController {
return AjaxResult.success("操作成功",list);
}
@Log(title = "托运人管理-查询租户下所有托运人", description ="查询租户下所有托运人",businessType = BusinessType.INQUIRE)
@ApiOperation("查询租户下所有托运人")
@GetMapping("/userShipperListAllByOrg")
public AjaxResult userShipperListAllByOrg(@RequestParam("orgCode") Long orgCode) {
//转换实体
List<UserShipperPo> list = userShipperApplicationService.userShipperListAllByOrg(orgCode);
return AjaxResult.success("操作成功",list);
}
@Log(title = "托运人管理-修改授权额度 结算天数 使用额度", description ="修改授权额度 结算天数 使用额度",businessType = BusinessType.INQUIRE)
@ApiOperation("修改授权额度和结算天数")
@PutMapping("/settlementInfo")
@@ -352,8 +361,20 @@ public class UserShipperAPI extends BaseController {
@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)
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;
@@ -20,15 +20,15 @@ spring:
discovery:
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
# server-addr: 10.33.0.129:6010
server-addr: 10.102.192.31:6848
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.30: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.31:6848
server-addr: 10.33.0.129:6010
# server-addr: 10.102.192.30: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">
@@ -775,10 +782,6 @@
<if test="organizationId !=null">
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>
@@ -75,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,
@@ -379,10 +381,6 @@
<if test="organizationId !=null">
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>
/*组织名称*/
@@ -629,6 +627,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;
@@ -18,6 +19,7 @@ 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;
@@ -77,6 +79,8 @@ public class BillManageApplicationService {
private BillDetailMapper billDetailMapper;
@Autowired
private NcLogMapper ncLogMapper;
@Autowired
private IBillManageService billManageService;
/**
@@ -132,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;
}
@@ -333,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());
@@ -356,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);
//更新账单金额
@@ -369,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());
@@ -386,83 +413,185 @@ public class BillManageApplicationService {
}
/**
* 复制账单
* 新增账单
*/
@Transactional
public Boolean copyBill(BillManageDTO billManageDTO) {
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);
item.setBillManageId(billManageDO.getBillManageId());
item.setBillNumber(billManageDO.getBillNumber());
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不能为空");
}
// 1. 获取原账单信息
// 获取原账单信息
BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId());
if (null == originalBill) {
throw new ServiceException("原账单信息未找到");
}
// 2. 获取原账单明细
// 获取原账单明细
List<BillDetailPO> originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
if (originalDetails == null || originalDetails.isEmpty()) {
throw new ServiceException("原账单明细为空,无法复制");
}
// 3. 创建新账单除账单编号外完全复制原账单
String newBillNumber = OrderSequence.getOrderCode("ZD");
BillManage newBill = new BillManage();
BeanUtils.copyProperties(originalBill, newBill);
newBill.setBillManageId(null);
newBill.setBillNumber(newBillNumber);
newBill.setCreateBy(loginUser.getUserPo().getUserId());
newBill.setCreateByName(loginUser.getUserPo().getUserName());
newBill.setCreateTime(new Date());
newBill.setUpdateBy(loginUser.getUserPo().getUserId());
newBill.setUpdateByName(loginUser.getUserPo().getUserName());
newBill.setUpdateTime(new Date());
newBill.setDelFlag(1);
// 保存新账单
boolean flag = billManageDomainService.saveEntity(newBill);
if (!flag) {
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);
}
// 4. 复制账单明细
List<BillDetail> newDetailList = new ArrayList<>();
for (BillDetailPO originalDetail : originalDetails) {
BillDetail newDetail = new BillDetail();
BeanUtils.copyProperties(originalDetail, newDetail);
newDetail.setBillDetailId(null);
newDetail.setBillManageId(newBill.getBillManageId());
newDetail.setBillNumber(newBillNumber);
newDetail.setCreateBy(loginUser.getUserPo().getUserId());
newDetail.setCreateByName(loginUser.getUserPo().getUserName());
newDetail.setCreateTime(new Date());
newDetailList.add(newDetail);
}
Boolean flagTwo = billDetailDomainService.insertBatch(newDetailList);
// 5. 复制计费流水billing_statement
List<BillingStatementPO> originalStatements = billingStatementDomainService.getDetailsByManageId(billManageDTO.getBillManageId());
boolean flagThree = true;
if (originalStatements != null && !originalStatements.isEmpty()) {
List<BillingStatement> newStatementList = new ArrayList<>();
for (BillingStatementPO originalStatement : originalStatements) {
BillingStatement newStatement = new BillingStatement();
BeanUtils.copyProperties(originalStatement, newStatement);
newStatement.setBillingStatementId(null);
newStatement.setBillManageId(newBill.getBillManageId());
newStatement.setCreateBy(loginUser.getUserPo().getUserId());
newStatement.setCreateByName(loginUser.getUserPo().getUserName());
newStatement.setCreateTime(new Date());
newStatementList.add(newStatement);
}
flagThree = billingStatementDomainService.saveEntityBatch(newStatementList);
}
// 6. 保存操作日志
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
billOperationLogDO.setBillManageId(newBill.getBillManageId());
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.copy_bill_text, originalBill.getBillNumber(), newBillNumber));
billOperationLogDO.setOperationType(1);
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
return flag && flagTwo && flagThree && three;
originalBill.setBillDetailPOList(originalDetails);
return originalBill;
}
/**
@@ -644,6 +773,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);
}
@@ -594,10 +596,16 @@ public class BillingStatementApplicationService {
BeanUtils.copyProperties(billingStatementDO,billingStatementPO);
billingStatementPO.setBillingTotalAmount(billingStatementDO.getBillingAmount());
billingStatementPO.setDataSources(2);
billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
// 若传入了计费流水号则直接使用否则自动生成
if (StringUtils.isEmpty(billingStatementPO.getBillingFlow())) {
billingStatementPO.setBillingFlow(OrderSequence.getOrderCode("JFLS"));
}
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;
}
@@ -288,6 +288,9 @@ public class BusinessDocumentApplicationService {
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());
@@ -320,6 +323,14 @@ public class BusinessDocumentApplicationService {
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;
}
@@ -607,7 +618,7 @@ public class BusinessDocumentApplicationService {
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
contractType = 1;
}
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndSecondSubjectCode(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getFirstSubjectCode(),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("合同信息未找到");
}
@@ -615,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());
}
@@ -274,7 +274,7 @@ public class SettlementCustomersApplicationService {
SyncDictCache dictCache,
List<SettlementCustomers> toInsert,
List<SettlementCustomers> toUpdate) {
AjaxResult ajaxResult = userServiceFeign.userShipperListAll();
AjaxResult ajaxResult = userServiceFeign.userShipperListAllByOrg(loginUser.getUserPo().getOrganizationId());
List<UserShipperPo> userShipperPoList = parseFeignList(ajaxResult, UserShipperPo.class);
if (userShipperPoList.isEmpty()) {
return;
@@ -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);
}
@@ -44,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;
}
@@ -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;
@@ -675,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("账单信息未找到");
@@ -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);
}
}
@@ -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;

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