99 Commits
Author SHA1 Message Date
rcx e60f22979c fix(wms): 补提交收货/上架单已反审归档详情接口(此前遗漏未入库)
getInfo 增加 archive 重载(归档主单已软删用getById放行+校验已反审标记,明细放行软删行)+ getReverseAuditInfo 接口,补齐对接文档承诺的4个归档详情接口中缺失的收货/上架两个;随附上架默认库位注释微调
2026-09-12 11:21:33 +08:00
rcx 84ff45b43d fix(oms): 批量审核运输业务单号重复(goods_number取号三层防线)
根因: 取号为「COUNT当日单量+1+查重后移」, 非原子、无锁、无唯一索引。
批量审核并发创建运输业务单时, 多请求在同一查重窗口取到同一序号并全部
插入成功, 且将同一单号回填到出库单business_number, 页面所见单号重复。

- GoodsNumberGenerator: 取号改为当日MAX+1+存在性校验后移; 按yyMMdd分段的
  JVM锁串行化"取号+插单"; 插单后自检同号自动改号自愈; 兼容唯一索引撞号重试
- BusinessDocumentOrderDomainService: 主创建入口改走原子"取号+插单",
  出库/入库单号回填移至插单成功之后
- BusinessDocumentOrderImpl: 审核拆单子单路径同改
- Mapper: countByGoodsNumberPrefix改为selectGoodsNumbersByPrefix
2026-09-12 10:09:11 +08:00
rcx 892cc30999 fix(oms): 出入库业务单下发执行单时订单来源继承业务单(数据导入/手动创建/系统生成)不再写死"客户预约"; 手动创建业务单来源为空兜底"手动创建"; 出库下发明细过滤del_flag, 修复编辑后软删旧明细参与仓库分组导致多生成执行单且数量叠加 2026-09-12 10:00:45 +08:00
rcx da76816533 fix(oms): 反审运输链路按拆单子单全量软删——执行单挂子单下(businessDocumentId=子单id), 主单+子单+执行单+TMS链全删; 执行单列表默认过滤归档行 2026-09-12 09:53:13 +08:00
rcx b86ab75dcf fix(oms,wms): WMS出库明细uniqueId撞键修复+推单返回值校验
- WMS反审/取消下发软删出库明细时置空uniqueId(表唯一约束不含del_flag)
- omsOrderAddDetail推单前自愈: 按本次推送uniqueId值跨执行单清归档行, 反审重发不再撞键
- OMS推单三处(单头/明细/配送明细)校验返回值, 失败报WMS真实原因, 不再静默吞掉后伪装成可用库存为0
- WmsServiceFeign三方法void改AjaxResult, 控制器与降级工厂同步
2026-09-11 16:07:21 +08:00
rcx 796bb99a8b fix(wms): 出库异常列表不再默认过滤已软删出库单, 反审生成的异常记录可见 2026-09-11 14:28:55 +08:00
rcx f9a50ae353 fix(oms): 出库反审核心改动(下发自愈/运输链路软删/issueStatus已驳回/uniqueId置空/仓库兜底切换) 2026-09-11 14:17:17 +08:00
rcx 2094ea31cd fix(oms): 仓库信息本地兜底查询去掉STOCK_LOCK_MODE列, 兜底不依赖冻结功能列, 修复无该列环境的下发报错 2026-09-11 13:52:28 +08:00
rcx 788bae9a16 fix(oms,wms): 出库反审补全——重新下发自愈/仓库信息本地兜底/运输链路反审联动/归档查询修复
- 反审后 issueStatus 置 3-已驳回(与入库侧同口径), 清空执行单号/货源单号
- 反审/取消下发软删执行明细时置空 uniqueId, 修复重新下发撞唯一约束
- 新增 WarehouseInfoApplicationService(Feign优先+本地跨库兜底), 出库侧8处调用点接入
- 反审联动软删运输链路: 运输业务单/执行单本地软删 + TMS deleteChainByExecuteOrderNumber
- WMS归档查询修复: 交接归档详情丢行/拣货归档数量恒0/复核列表归档汇总/OMS执行单已反审tab
2026-09-11 11:42:42 +08:00
rcx a65cca1cfa fix(oms,wms): 入库反审三项修复:反审记录不可见、反审后重新下发无法收货、异常列表JOIN过滤
1. 入库异常三个生成器(收货异常/上架异常/反审记录)插入时未显式设置delFlag,MyBatis-Plus insert不含该列,列无默认值落库为NULL,被列表del_flag=1过滤导致反审记录永远不可见;现显式setDelFlag(1)

2. 反审重置业务单status=1:首轮完成上架经WMS回传把业务单status写成5(已入库),不重置则重新下发时copy给执行单→W入库单→收货单,收货单带已完成状态导致前端不给收货按钮

3. 入库异常列表LEFT JOIN stock_in_order固定b.DEL_FLAG=1,反审记录关联的入库单已软删导致匹配不上,仓库等基于b表的过滤把行全部过滤掉、列表恒为空;改为按a.TYPE切换关联状态(type=3关联已软删入库单);收货/上架已反审tab同号多张入库单JOIN出重复行,限定只关联同状态最新一张(IN_ORDER_ID取max)
2026-09-11 09:41:21 +08:00
rcx cae62e83a5 fix(oms,wms): 入库反审修复:已反审tab列表查不到数据、未下发单反审补写反审记录
1. W收货单/W上架单【已反审】tab查不到数据:queryList 的 LEFT JOIN stock_in_order 固定带 a/b.DEL_FLAG=1,归档数据(反审后双方均已软删del_flag=2)关联不上b表,仓库/货主等基于b表的过滤条件把行全部过滤掉;改为按是否查反审归档动态切换关联条件(归档按del_flag=2关联,正常列表行为不变)

2. 未下发WMS的执行单反审不产生反审记录:reverseExecutionOrder 幂等跳过分支直接return导致入库异常无留痕;现补写1条反审记录(abnormalType=6,回退库存0,备注未下发WMS),同单号已有有效记录时防重,重试/重复反审幂等

3. OMS反审Feign参数透传组织三字段(organizationId/organizationName/topOrganizationId),供WMS跳过分支写反审记录使用(该场景无W入库单可取组织信息)
2026-09-10 17:25:07 +08:00
rcx e2da7177f0 fix(oms/wms): 出库明细出库时间过滤严格按出仓日期outbound_date(去除建档时间兜底),所见即所筛 2026-09-10 16:38:34 +08:00
rcx 0b45ad181f feat(oms/wms): 出库明细单据类型回显/查询条件/导出列补齐
- 出库明细查询新增orderTypeCode(精确)/orderTypeName(模糊)查询条件
- OMS出库明细SQL补查b.order_type_code/name,响应回显orderTypeCode/orderTypeName(原恒为null)
- WMS出库明细导出新增"业务单据类型"列(第31列)
2026-09-10 16:18:11 +08:00
rcx 260ec1f369 fix(oms): 出入库业务单反审补充清空执行单号/下发执行时间,修复反审后前端是否执行仍显示已执行 2026-09-10 14:24:43 +08:00
rcx b28575c34d fix(wms): 入库明细导出客户编号/客户名称改取货主编码与货主名称(与页面显示一致) 2026-09-10 14:04:06 +08:00
rcx 8af8197901 feat(oms/wms): 出入库明细货物种类改显物料分类名称、单据类型回显与查询条件
一、货物种类
- O/W出入库明细查询新增返回materialClassifyName(物料分类名称,多个逗号分隔)
- WMS入库导出"货物种类"列、出库导出"种类"列改为物料分类名称(原为goodsType编码转文字)
- OMS出入库导出新增"货物种类"列,货物类型列加字典转换不再显示0/1/2编码

二、单据类型
- O/W入库明细查询新增orderTypeCode/orderTypeName回显与查询条件(编码精确/名称模糊)
- WMS入库明细导出新增"业务单据类型"列(第31列)

三、时间字段
- OMS出库明细查询返回增加completeTime完成时间
- OMS orderOutboundDate出仓日期格式恢复为yyyy-MM-dd HH:mm:ss
- OMS出库时间过滤改为三级兜底:出库时间OUTBOUND_TIME→出仓日期→建档时间

四、修复
- WMS出库导出SQL修复TOTAL_PRICE列不存在(总价改用TOTAL_AMOUNT),总价值暂无来源占位空列
2026-09-10 11:35:30 +08:00
rcx 12f1d99e02 fix(wms): 出入库明细查询status字段改用独立SQL别名映射,避免同列双映射在增量构建下不可靠 2026-09-09 21:53:02 +08:00
rcx 244fbf9759 feat(wms): 出入库明细查询返回增加status字段(与outOrderStatus/inOrderStatus同值,便于前端绑定) 2026-09-09 18:20:44 +08:00
rcx e3826d6333 fix(oms): 出入库明细查询状态过滤口径修正-改为issue_status=4
问题:OMS执行出库单status不随WMS出库完成流转(回写代码被注释),推送创建的单据status也是默认值,
原过滤条件 status in(9,12,13)/status=5 会导致明细页查不到数据。

修复:
- 出库明细SQL:status in(9,12,13) 改为 issue_status=4(issueStatus: 0-已创建 2-已审核 3-已驳回 4-已出库)
- 入库明细SQL:status=5 改为 issue_status=4(WMS回写status=5时同步issueStatus=4,推送创建直接置4)
- 两个明细SQL新增返回 b.issue_status,前端状态列绑定issueStatus
- WithOrderPO新增issueStatus字段(导出"单据状态"列自动转文字),outOrderStatus/inOrderStatus保留返回但不再导出
2026-09-09 17:23:54 +08:00
rcx f217d6ec5c 发测试 2026-09-09 15:51:57 +08:00
rcx e58b6cb9ce feat(oms/wms): 出入库明细查询-已入库/已出库状态过滤、WMS新增出入库明细查询页面及专用导出
一、OMS 入库/出库明细查询(修复+导出)
- 出库明细SQL状态过滤由=9改为in(9,12,13):已出库/已复核/已交接均算已出库,与出库排名统计口径一致
- 入库明细SQL固定只统计已入库(status=5)单据
- 入/出库明细SQL新增实际入仓/出仓日期区间过滤(IFNULL(实际日期,建档时间)兜底),支持统计当天
- 新增Excel导出接口 /executionInMaterialDetailApi/exportWithOrder、/executionOutMaterialDetailApi/exportWithOrder(全量不分页)
- 退货回仓统计:通过入库单类型 inOrderTypeCode=tui_huo_ru_ku(退货入库)过滤

二、WMS 新增入库/出库明细查询页面
- 入库明细查询:GET /materialDetailApi/listWithOrder(明细关联入库单,固定已入库(5),level=1防父子行重复计数)
- 出库明细查询:GET /outMaterialDetailApi/listWithOrder(新建OutMaterialDetailApi,关联出库单,固定in(9,12,13))
- 返回单头字段:单据状态/审核状态/货主/供应商/客户/单据类型/实际入仓出仓日期/保额/货物类型等
- 入库客户编号/名称/客户预约名称经通知单号关联notice_order取得(入库单表无客户字段)

三、WMS 明细导出专用列集
- 出库导出/exportWithOrder:按客户要求30列导出,含出库单号/出库日期/客户信息/LOT号/费用组(单价、总价、折扣、仓租、合同收费)等
- 入库导出/exportWithOrder:按客户要求30列导出,含客户信息/入库日期/每件保额/收费标准/有效期等
- 单据状态、货物种类导出时自动转文字;导出列顺序与客户清单一致
- 火险保费、入库单件净重(KG)暂无数据来源,导出空列占位,待确认数据来源后补充

四、其他
- 查询条件不传日期时默认查全部日期,统计当天由前端传当天日期区间实现
- 数据权限:非平台超管按登录人一级组织过滤
2026-09-09 15:49:09 +08:00
rcx b7cacaeb8d feat(oms,wms): 入库业务单反审——业务单改已驳回+已反审tab,执行单/W入库/收货/上架软删打标归档,库存还原扣减,W入库异常反审记录
【需求】已入库/已出库的单子客户通知需要回退的场景,单子回退到最原始状态。反审入口在 OMS-入库业务单页面【反審單據】按钮,一次操作全链路回退。

【反审规则】
1. 按页面状态 issueStatus 判断:进行中(1)/已审核(2)/已入库(4)/部分完成(5) 可反审;已创建(0)无需反审、已驳回(3)可直接编辑;已取消/已关闭(status 6/7)兜底拦截
2. 已推送关务/NC(pushStatus=3)直接拦截,避免关务与仓内数据不一致
3. W入库单有出库记录就不能反审:按入库单号+动作(分配库存/出库)查询库存调整记录>0 即拦截,另校验库存冻结量>0
4. WMS无该单数据时幂等成功(未下发单反审),反审失败可安全重试

【反审动作】
1. 入库业务单:状态改为已驳回(issueStatus=3,与审核不通过同语义,可编辑→重新审核→重新下发),打已反审标记落入【已反审】tab;清空入库数量/入库时间/执行单号,明细 INBOUND_ITEMS/TOTAL_NET_WEIGHT 归零
2. 入库执行单+物料明细:软删(del_flag=2)+打已反审标记,【已反审】tab 按「已软删+已反审」查询归档数据,避免归档单被误审核/下发
3. WMS侧(逐执行单Feign omsReverseInOrder):库存还原扣减(校验库存行合计=已完成上架量后整行对称扣回,GREATEST(x-n,0)兜底)→ W入库单/W收货单/W上架单及明细、收货/上架作业单/任务/质检单整链软删+打已反审标记 → 写1条入库异常【反审记录】(type=3/abnormalType=6,FSYC单号)用于记录跟踪

【接口】
- POST /reservationStockInOrderApi/reverseAudit 反审(inOrderIds + reverseAuditRemark,支持批量)
- 已反审tab:/reservationStockInOrderApi/list?reverseAuditStatus=1(执行单/W入库单/W收货单/W上架单同参数,后端固定限定 del_flag=2+标记=1 归档数据)
- 归档详情:/executionStockInOrderApi、/stockInOrderApi、/stockReceiptOrderApi、/stockShelfOrderApi 各增 getReverseAuditInfo/{id}(原 getInfo 行为不变)
- 反审记录筛选:/inOrderAbnormalApi/list?abnormalType=6

【DDL】sql/20260908_oms_inbound_reverse_audit.sql:RESERVATION_STOCK_IN_ORDER / EXECUTION_STOCK_IN_ORDER / STOCK_IN_ORDER / STOCK_RECEIPT_ORDER / STOCK_SHELF_ORDER 各新增 REVERSE_AUDIT_STATUS/REMARK/BY/BY_NAME/TIME 五列,发服务前先执行

【其他】
- 库存扣减走 batchSubtractInventoryQuantity 并显式传更新人,规避 Feign 链路无登录态时 SecurityUtils 抛异常
- omsReverseInOrder 的 Feign 方法与降级已随出库反审提交(715883f1)入库,本次不再重复提交
- 归档行只读,详情走 getReverseAuditInfo;正常数据与归档数据互不干扰
2026-09-09 15:38:21 +08:00
rcx 715883f1d4 feat(oms,wms): 出库业务单反审——已出库/已审核单据回退已创建
- 新增 POST /reservationStockOutOrderApi/reverseAudit,按issueStatus(2-已审核/4-已出库)判断可反审
- 主单回退已创建并打reverseStatus标记,进【已反审】tab(list status=-2),重新审核通过自动复位
- 执行单/明细软删+reverseFlag=1,预约库存调整记录软删
- WMS新增/stockOutOrderApi/omsReverseExecutionOrder:已出库还原实物库存+推OMS,未出库仅还原分配占用,WMS无数据幂等成功
- W出库/拣货/复核/交接单软删+reverseFlag=1,列表支持delFlag=2&reverseFlag=1【已反审】tab
- 四页面新增归档详情接口getReverseInfo*
- 生成出库异常记录【反审记录】(abnormalType=3,前缀FSYC)
- 需先执行SQL: 20260908两个反审脚本(OMS库+WMS库)
2026-09-09 15:20:13 +08:00
rcx 139a3a82da feat(wms): 盘点单详情investigetionManageDetailList按物料编码排序,相同编码相邻展示(仅排序不聚合) 2026-09-09 14:18:48 +08:00
rcx fcc8102d9e feat(wms): 库存调整记录列表新增按入库单号(inOrderNumber)查询 2026-09-09 14:16:32 +08:00
rcx 7649585715 发测试 2026-09-09 09:27:57 +08:00
rcx 7511d211c6 fix(wms): 修复盘点详情批次属性attributeValue为空的问题
1. 标签映射表改LinkedHashMap固定优先级,补全批次号/入库日期/生产日期/过期日期及英文标签映射
2. fieldName反射取不到值时回退按batchLabels映射再取,修复fieldName配置失效导致值永远为空
3. batchDetailId为空的批次属性配置行不再丢弃,改为batchDetailId+标签双重去重
2026-09-09 09:14:01 +08:00
rcx fd3a9afddf 发31 2026-09-08 17:52:42 +08:00
rcx 0358c694ea 发30 2026-09-08 17:46:49 +08:00
rcx 009dc5b3a6 feat(wms): 盘点单详情investigetionManageDetailList返回批次号、入库日期、生产日期、过期日期 2026-09-08 17:35:29 +08:00
rcx 178b7697af fix(oms): 出库单列表totalOutboundQuantity恒为null,queryList改为SQL汇总一级明细出库数量
原Java循环逐单调getInfoChildren汇总(N+1)被注释后无赋值导致恒为null;改为关联子查询coalesce(sum(outbound_quantity),0),仅统计level=1且del_flag=1,口径与详情页一致;/list与/list1共用同一语句同时生效,无需DDL
2026-09-08 15:08:00 +08:00
rcx 32364baba8 发测试 2026-09-08 13:38:54 +08:00
rcx 6c6a491ff8 feat(oms/wms): WMS上架状态回传OMS入库业务单,修复入库状态不同步
- WMS上架推进入库状态后回传OMS(OmsServiceFeign新增returnInResult)
- OMS回传接收加固:无登录上下文判空、已入库同步issueStatus=4
- 已入库联动同步预约入库单(入库业务单)状态
2026-09-08 13:37:43 +08:00
rcx a496fc235b fix(oms): 新增/编辑入库单以业务类型为准同步单据类型,修复退货入库被写成普通入库及编辑类型不生效 2026-09-08 10:53:23 +08:00
rcx 06202b652a 发测试 2026-09-08 09:32:47 +08:00
rcx 5d748a9ac6 fix(oms): 入库业务单新增时用businessType回填单据类型,修复退货单被写成普通入库 2026-09-08 09:28:27 +08:00
王奎兴 361a91d701 发31 2026-09-07 19:02:39 +08:00
王奎兴 3471874139 退货入库; 2026-09-07 18:58:33 +08:00
王奎兴 a38e28bb97 退货入库; 2026-09-07 18:57:51 +08:00
rcx ab7a4e265f Merge branch 'dev-ty1.2' into dev
# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java
#	mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java
#	mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java
#	mhd_wms/src/main/resources/bootstrap.yml
2026-09-07 18:03:18 +08:00
rcx 976ab715af 发30 2026-09-07 18:02:10 +08:00
王奎兴 6856899afc Merge remote-tracking branch 'origin/dev' into dev 2026-09-07 17:23:10 +08:00
王奎兴 6d7be15d97 发31 2026-09-07 17:23:01 +08:00
rcx 0babc7dbf8 Merge remote-tracking branch 'origin/dev' into dev 2026-09-07 17:19:31 +08:00
王奎兴 1a80f715dd 恢复xxl 2026-09-07 17:16:11 +08:00
rcx 7742d11d1c 发31 2026-09-07 17:15:05 +08:00
rcx c4df9b3403 Merge remote-tracking branch 'origin/dev' into dev 2026-09-07 17:08:20 +08:00
rcx 7ed34df81e 发30 2026-09-07 17:07:16 +08:00
王奎兴 0ace96ea9f 恢复xxl 2026-09-07 17:06:27 +08:00
王奎兴 34014f40a5 Merge branch 'dev-ty1.2' into dev 2026-09-07 16:57:14 +08:00
rcx acbf7c9fdf fix: 退货入库单下发时执行入库单类型被固定写成普通入库 2026-09-07 16:56:17 +08:00
rcx 9e1c5d8570 fix(oms): 预约单下发不再推送WMS,修复执行单下发后WMS出现预约单+执行单两张单;三个下发入口补充软删单拦截 2026-09-07 15:44:44 +08:00
秦鸿展 98b5ce81cc 委托方导出功能 2026-09-07 14:28:29 +08:00
rcx b6a69411f1 发 测试 2026-09-07 14:25:29 +08:00
rcx 34b27eabd2 fix(oms): 出入库导入行级必填校验+页签解析失败完整堆栈日志
一、行级必填校验(ReservationStockInOrderImpl)
- 入库导入:新增校验空【產品編號】/空【支/件数】的明细行,给出明确提示
- 出库导入:新增校验空【支/件数】的明细行
- 修复原因:明细行件数为空时 new BigDecimal(null) 抛无信息的 NullPointerException,页面只显示 页签[x]:java.lang.NullPointerException 无法定位

二、页签解析失败完整堆栈日志
- 出/入库多页签解析第一阶段捕获异常时,将完整堆栈打入服务端日志(LOGGER.error),便于远程定位页签内具体报错行号
2026-09-07 14:18:34 +08:00
rcx 1c4b520f5a Merge remote-tracking branch 'origin/dev-bms-260826' into dev-ty1.2 2026-09-07 13:50:28 +08:00
王奎兴 32459fd443 xxl-job配置; 2026-09-07 11:33:14 +08:00
王奎兴 625b195183 发测试 2026-09-07 10:21:36 +08:00
王奎兴 0c95470300 Merge branch 'dev-ty1.2' into dev-bms-260826 2026-09-07 10:19:22 +08:00
王奎兴 ba3a540a94 Merge branch 'dev' into dev-bms-260826
# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java
#	mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java
#	mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java
#	mhd_wms/src/main/resources/bootstrap.yml
2026-09-07 10:00:28 +08:00
王奎兴 a484e81b32 发测试 2026-09-07 09:23:22 +08:00
rcx 627f63cbd3 fix(oms,wms): 入库执行单取消下发完整回退WMS数据,修复重复下发数据致取消阻断
一、取消下发回退不完整/阻断:原OMS跨库仅软删4张表,收货任务/收货作业单/质检单/电子签名残留;且getWShOrder在重复下发产生多张同号收货单时抛TooManyResultsException,取消下发整体回滚失败。WMS新增/stockInOrderApi/omsCancelInOrder:单事务软删下发链路全部8张表(入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单),幂等可重试,已开始收货报错拦截;OMS执行单取消下发改调该接口并清理待签名电子签名;预约单取消下发补齐WMS清理

二、下发失败被静默吞掉:omsInOrderAdd/omsInOrderAddDetail原返回void、Feign降级静默,OMS已下发但WMS无数据。改返回AjaxResult、fallback报错,执行单/预约单下发逐一校验返回值,失败回滚下发标记(WMS侧幂等,重下发安全)

三、下发防重原子化:issueOrder下发标记改条件更新(issue_time IS NULL)+影响行数校验,关闭并发/双击重复推送WMS的窗口
2026-09-07 09:20:37 +08:00
王奎兴 f6c454765e jobid查询接口; 2026-09-05 19:21:17 +08:00
王奎兴 25102b5207 jobid查询接口; 2026-09-05 19:14:34 +08:00
王奎兴 6708353379 jobid查询接口; 2026-09-05 19:08:42 +08:00
王奎兴 20d11dc9b2 jobid查询接口; 2026-09-05 19:00:02 +08:00
王奎兴 fa7db5df0c jobid查询接口; 2026-09-05 18:52:30 +08:00
王奎兴 cb1a1ec9a6 jobid查询接口; 2026-09-05 18:48:19 +08:00
王奎兴 3abac7b3d6 jobid查询接口; 2026-09-05 18:44:25 +08:00
秦鸿展 3c81e37e32 30 2026-09-05 18:39:15 +08:00
王奎兴 cecfe3e777 jobid查询接口; 2026-09-05 18:28:34 +08:00
王奎兴 104fc8bbef code 2026-09-05 18:19:25 +08:00
王奎兴 d9e5cede10 code 2026-09-05 17:59:18 +08:00
王奎兴 1689da1911 token 2026-09-05 17:51:37 +08:00
王奎兴 c043da88e4 groupid 2026-09-05 17:41:01 +08:00
王奎兴 d10a81fc42 自动添加xxl任务; 2026-09-05 17:37:33 +08:00
王奎兴 10bba6fd9e 物料仓租修改; 2026-09-05 16:59:46 +08:00
王奎兴 bc09b77695 添加计费字段; 2026-09-05 16:55:10 +08:00
秦鸿展 a7a387f215 南岐GPS接口对接增加字段 2026-09-05 16:29:38 +08:00
王奎兴 4d0ea8522e 发31 2026-09-05 15:52:37 +08:00
王奎兴 700eb3ee95 发30 2026-09-05 15:45:09 +08:00
王奎兴 fd62a7aff5 发31 2026-09-05 15:41:11 +08:00
王奎兴 b05c87e291 Merge branch 'dev' into dev-bms-260826
# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java
#	mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/facade/IReservationStockInOrderService.java
#	mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/mapper/ReservationStockInOrderMapper.java
#	mhd_oms/src/main/resources/mapper/reservationStockInOrder/ReservationStockInOrderMapper.xml
#	mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/po/MaterialInventoryPO.java
#	mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java
#	mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java
#	mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml
2026-09-05 15:14:35 +08:00
王奎兴 7790850da3 自动生成job 2026-09-05 14:51:25 +08:00
秦鸿展 8ddf20f3e7 南岐GPS接口 2026-09-05 14:39:04 +08:00
秦鸿展 9e186bc034 南岐GPS接口 2026-09-05 14:38:49 +08:00
rcx c0065074d3 Merge branch 'dev-ty1.2' into dev 2026-09-05 13:53:01 +08:00
rcx be8ba45067 fix(oms,wms): 出库单下发WMS失败被静默吞掉,修复WMS出库拣货不显示OMS单据
- 建单/下发前统一校验(数量>0、已关联库存、WMS可用库存),错误汇总一次性提示
- 新增WMS库存校验接口,库存不足在OMS侧拦截不再推送WMS;拦截重复下发
- 检查WMS自动分配/生成拣货单返回值,失败报错并补偿清理WMS残留单据
- 下发状态逐单提交,避免批量部分失败造成两边状态撕裂
- 预约单多仓下发增加逐仓预校验
- 修复取消下发不删拣货单、无库存脏单无法取消两个历史问题
2026-09-05 13:42:02 +08:00
rcx c0bcedbdc3 fix(wms,oms): JSON日期反序列化兼容yyyy-MM-dd纯日期格式
- 库存查询日期只保留年月日后,前端回传纯日期(如 createTime=2026-07-06)触发
  @JsonFormat("yyyy-MM-dd HH:mm:ss") 严格格式反序列化 InvalidFormatException
- 新增 FlexibleDateDeserializer:字段 @JsonFormat 模式优先严格解析,失败后兼容
  yyyy-MM-dd HH:mm:ss / yyyy-MM-dd HH:mm / yyyy-MM-dd / 时间戳 / ISO-8601
- 仅在 OMS/WMS 通过 Module Bean 注册生效,不改动 BaseVOEntity 全局行为
2026-09-05 13:38:06 +08:00
王奎兴 84558fe2f6 xxl配置类; 2026-09-05 10:46:24 +08:00
秦鸿展 b46483263b 31 2026-09-05 10:36:12 +08:00
秦鸿展 4755d4e62b 30 2026-09-05 10:30:36 +08:00
王奎兴 6c6afe4342 联查合同接口开发; 2026-09-05 10:22:24 +08:00
王奎兴 befdb82b53 联查合同接口开发; 2026-09-04 19:16:57 +08:00
王奎兴 5a329904c3 正式合同定时任务; 2026-09-04 15:40:19 +08:00
王奎兴 c25a9a5f68 发30 2026-09-04 14:06:48 +08:00
王奎兴 6108606daa bms改造; 2026-09-04 11:11:39 +08:00
王奎兴 2c60dc8f84 bms改造; 2026-09-01 16:58:39 +08:00
王奎兴 3349552e10 结算对象改造; 2026-08-28 17:32:02 +08:00
311 changed files with 12586 additions and 463 deletions
@@ -3,6 +3,7 @@ package com.mhd.system.api;
import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
@@ -18,7 +19,7 @@ import java.util.Set;
/**
* bms财务结算系统feign调用接口
*/
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface BmsServiceFeign {
@@ -68,4 +69,17 @@ public interface BmsServiceFeign {
*/
@PostMapping("/businessDocumentApi/wholeRentSynchronizationZXF")
public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDataPushDTO businessDataPushDTO);
@PostMapping("/businessDocumentApi/feignSave")
public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign);
/**
* 根据结算对象id查询结算对象参数列表
*/
@GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId")
AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId);
@PostMapping("/settlementCustomersApi/updatePushContractManageJobId")
AjaxResult updatePushContractManageJobId(@RequestParam("settlementCustomersId") Long settlementCustomersId,
@RequestParam("jobId") Integer jobId);
}
@@ -12,11 +12,12 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4: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 {
@@ -28,6 +29,10 @@ public interface OmsServiceFeign {
@PostMapping(value = "/reservationStockInOrderApi/pushInOrderDetail")
public AjaxResult pushInOrderDetail(@RequestBody InMaterialDetailTZPD inMaterialDetail);
@ApiOperation("wms回传入库结果:按入库单号同步入库状态(3-收货中 4-上架中 5-已入库)到OMS入库业务单,type非1为入库")
@GetMapping(value = "/executionStockInOrderApi/returnResult")
public AjaxResult returnInResult(@RequestParam("orderNumber") String orderNumber, @RequestParam("status") Long status, @RequestParam("type") String type);
@ApiOperation("wms推送入库单")
@PostMapping(value = "/reservationStockOutOrderApi/pushOutOrder")
@@ -12,6 +12,8 @@ import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.domain.po.SysMultistageDictPo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.domain.ContainerFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.factory.RemoteSystemFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
@@ -390,4 +392,13 @@ public interface SystemServiceFeign {
public AjaxResult matchForMaterialImport(@RequestParam("keyword") String keyword,
@RequestParam("organizationId") Long organizationId);
@ApiOperation("保存临时合同管理")
@PostMapping("/contractManageApi/feignSave")
public AjaxResult feignSave(@RequestBody ContractManageFeignDTO contractManageFeignDTO);
@ApiOperation("Feign保存合约信息规则维护")
@PostMapping("/contractManageParametersApi/feignSave")
public AjaxResult feignSaveContractParameters(@RequestBody ContractManageParametersFeign contractManageParametersFeign);
}
@@ -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.30:8014",configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class)
public interface WlhyServiceFeign {
/**
@@ -539,6 +539,13 @@ public interface WlhyServiceFeign {
@GetMapping("/feign/order/cancelIssueDocuments")
public AjaxResult cancelIssueDocuments(@RequestParam(name="executeOrderId") String executeOrderId);
/**
* OMS出库业务单反审联动: 按执行单货源编号软删TMS整条链路(货源单->运单->运输作业单, is_delete=1), 幂等,
* 与 cancelIssueDocuments(仅关闭货源单且有有效运单即拒绝)不同, 反审口径不留TMS数据
*/
@PostMapping("/feign/order/deleteChainByExecuteOrderNumber")
public AjaxResult deleteChainByExecuteOrderNumber(@RequestParam(name="executeOrderNumber") String executeOrderNumber);
@GetMapping(value = "/ntocc/tmsSettlementExchangeRate/queryList")
public AjaxResult<?> queryList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@@ -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.3: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 {
/**
@@ -74,33 +74,33 @@ public interface WmsServiceFeign {
*/
@ApiOperation("oms下发单保存")
@PostMapping(value = "/stockOutOrderApi/omsOutOrderAdd")
public void omsOutOrderAdd(@RequestBody StockOutOrder stockOutOrder);
public AjaxResult omsOutOrderAdd(@RequestBody StockOutOrder stockOutOrder);
/**
* oms下发单明细保存
*/
@ApiOperation("oms下发单明细保存")
@PostMapping(value = "/stockOutOrderApi/omsOutOrderAddDetail")
public void omsOutOrderAddDetail(@RequestBody List<OutMaterialDetail> outMaterialDetails);
public AjaxResult omsOutOrderAddDetail(@RequestBody List<OutMaterialDetail> outMaterialDetails);
/**
* oms下发单明细保存
*/
@ApiOperation("oms下发单明细保存")
@PostMapping(value = "/stockOutOrderApi/omsOutOrderAddDeliveryDetailsLink")
public void omsOutOrderAddDeliveryDetailsLink(@RequestBody List<DeliveryDetailsLink> deliveryDetailsLinks);
public AjaxResult omsOutOrderAddDeliveryDetailsLink(@RequestBody List<DeliveryDetailsLink> deliveryDetailsLinks);
/**
* oms下发单保存
* oms下发单保存(返回执行结果,失败时OMS据此回滚下发标记,避免"OMS已下发/WMS无数据"的阻断)
*/
@ApiOperation("oms下发单保存")
@PostMapping(value = "/stockInOrderApi/omsInOrderAdd")
public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder);
public AjaxResult omsInOrderAdd(@RequestBody StockInOrder stockInOrder);
@ApiOperation("oms取消下发单保存")
@PostMapping(value = "/stockOutOrderApi/cancelExecutionOrder")
public void omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder);
public AjaxResult omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder);
@ApiOperation("oms取消下发单自动分配")
@PostMapping(value = "/stockOutOrderApi/omsAutoAssign")
@@ -111,11 +111,48 @@ public interface WmsServiceFeign {
public AjaxResult execution(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
/**
* oms下发单明细保存
* oms下发前库存校验:可用库存不足时返回错误,OMS据此在推送前拦截下发,
* 避免单据先落库、分配才失败而在WMS残留"已审核"状态的垃圾单
*/
@ApiOperation("oms下发前库存校验")
@PostMapping(value = "/stockOutOrderApi/checkOmsAssignInventory")
public AjaxResult checkOmsAssignInventory(@RequestBody List<OutMaterialDetail> outMaterialDetails);
/**
* oms下发单明细保存(返回执行结果,明细保存含自动审核链路,失败时OMS据此回滚)
*/
@ApiOperation("oms下发单明细保存")
@PostMapping(value = "/stockInOrderApi/omsInOrderAddDetail")
public void omsInOrderAddDetail(@RequestBody List<InMaterialDetail> inMaterialDetails);
public AjaxResult omsInOrderAddDetail(@RequestBody List<InMaterialDetail> inMaterialDetails);
/**
* oms取消下发入库执行单:WMS侧一个事务内逻辑删除下发链路产生的全部数据
* (入库单/明细、收货单/明细、收货任务、收货作业单/明细、质检单),已开始收货则报错拦截
*/
@ApiOperation("oms取消下发入库单清理")
@PostMapping(value = "/stockInOrderApi/omsCancelInOrder")
public AjaxResult omsCancelInOrder(@RequestBody StockInOrder stockInOrder);
/**
* oms出库执行单反审(已出库/已复核单据客户通知回退场景):WMS侧还原实物库存并推送OMS库存、
* 逻辑删除出库链路单据、生成1条出库异常【反审记录】;反审原因经 remark 透传。
* 已产生下游不可逆数据时返回错误,OMS据此整体回滚。
*/
@ApiOperation("oms出库执行单反审WMS回退")
@PostMapping(value = "/stockOutOrderApi/omsReverseExecutionOrder")
public AjaxResult omsReverseExecutionOrder(@RequestBody StockOutOrder stockOutOrder);
/**
* oms入库业务单反审:WMS侧一个事务内回退已入库/收货中/上架中单据——
* 校验未产生出库(按入库单号+动作"分配库存/出库"查库存调整记录>0即有出库) ->
* 按库存行整行回退库存扣减 -> 软删W入库单/W收货单/W上架单全链并打已反审标记
* (各页面【已反审】tab按"已软删+已反审"查询归档数据)-> 写1条入库异常【反审记录】(type=3)。
* 入参: inOrderNumber=执行入库单号, remark=业务单号+反审原因, updateBy/updateByName=反审人;
* WMS无该单数据时幂等返回成功(未下发单反审不产生WMS数据)。
*/
@ApiOperation("oms入库单反审WMS回退")
@PostMapping(value = "/stockInOrderApi/omsReverseInOrder")
public AjaxResult omsReverseInOrder(@RequestBody StockInOrder stockInOrder);
@ApiOperation("oms查询物料列表")
@GetMapping("/materialBaseInfoApi/queryList")
@@ -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,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.33.0.99:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
public interface YmsServiceFeign {
/**
@@ -0,0 +1,203 @@
package com.mhd.system.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 业务单据对象 business_document
*
* @author gen
* @date 2024-06-21
*/
@Data
public class BusinessDocumentFeign extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("业务单据记录id")
@TableId(type = IdType.AUTO)
private Long businessDocumentId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("业务流水")
@Excel(name = "业务流水")
private String businessFlow;
@ApiModelProperty("状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废")
@Excel(name = "状态", readConverterExp = "状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废")
private Integer businessState;
@ApiModelProperty("来源模块")
@Excel(name = "来源模块")
private String belongModule;
@ApiModelProperty("来源模块code")
@Excel(name = "来源模块code")
private String belongModuleCode;
@ApiModelProperty("数据来源(1-系统生成,2-手工录入)")
@Excel(name = "数据来源", readConverterExp = "1=-系统生成,2-手工录入")
private Integer dataSources;
@ApiModelProperty("单据类型id")
@Excel(name = "单据类型id")
private Long documentTypeId;
@ApiModelProperty("单据类型code")
@Excel(name = "单据类型code")
private String documentTypeCode;
@ApiModelProperty("单据类型")
@Excel(name = "单据类型")
private String documentType;
@ApiModelProperty("原始业务单号")
@Excel(name = "原始业务单号")
private String originalBusinessNum;
@ApiModelProperty("项目编码")
@Excel(name = "项目编码")
private String projectCode;
@ApiModelProperty("项目名称")
@Excel(name = "项目名称")
private String projectName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("账单金额")
@Excel(name = "账单金额")
private BigDecimal billAmount;
@ApiModelProperty("预计费金额")
@Excel(name = "预计费金额")
private BigDecimal estimatedCost;
@ApiModelProperty("一级费用科目code")
@Excel(name = "一级费用科目code")
private String firstSubjectCode;
@ApiModelProperty("一级费用科目(结算项)")
@Excel(name = "一级费用科目")
private String firstSubjectName;
@ApiModelProperty("二级费用科目code")
@Excel(name = "二级费用科目code")
private String secondSubjectCode;
@ApiModelProperty("二级费用科目(结算项)")
@Excel(name = "二级费用科目")
private String secondSubjectName;
@ApiModelProperty("结算对象id")
@Excel(name = "结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("结算对象code")
@Excel(name = "结算对象code")
private String settlementCustomersCode;
@ApiModelProperty("结算对象")
@Excel(name = "结算对象")
private String settlementEntity;
@ApiModelProperty("计费时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "计费时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date billingTime;
@ApiModelProperty("单据表单json数据")
@Excel(name = "单据表单json数据")
private String documentFormJson;
@ApiModelProperty("合同管理id")
@Excel(name = "合同管理id", readConverterExp = "合同管理id")
private Long contractManageId;
@ApiModelProperty("项目管理id")
@Excel(name = "项目管理id", readConverterExp = "项目管理id")
private Long projectManageId;
@ApiModelProperty("原始流水号")
@Excel(name = "原始流水号")
private String originalSerialNumber;
@ApiModelProperty("费用类型code(服务项)")
@Excel(name = "费用类型code(服务项)")
private String serviceItemsCode;
@ApiModelProperty("费用类型")
@Excel(name = "费用类型")
private String serviceItemsName;
@ApiModelProperty("费用类型id(服务项)")
@Excel(name = "费用类型id(服务项)")
private Long serviceItemsManageId;
@ApiModelProperty("单据备注")
@Excel(name = "单据备注")
private String remark;
@ApiModelProperty("审核备注")
@Excel(name = "审核备注")
private String reviewRemarks;
@ApiModelProperty("结算方式(1-现金,2-油卡)")
private Integer settlementWay;
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
@ApiModelProperty("税率")
private Double taxRate;
@ApiModelProperty("收款帐户")
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费数量")
private BigDecimal billingNum;
@ApiModelProperty("计费单价")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("是否推送")
private Integer isPush;
@ApiModelProperty("仓库类型")
private String warehouseType;
}
@@ -0,0 +1,110 @@
package com.mhd.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 合同管理详情对象 contract_manage_detail
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageDetailFeignDTO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理详情id")
private Long contractManageDetailId;
@ApiModelProperty("合同管理id")
@Excel(name = "合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算科目类型(1-通用,2-临时)")
@Excel(name = "结算科目类型", readConverterExp = "1=-通用,2-临时")
private Integer subjectType;
@ApiModelProperty("一级费用科目code")
@Excel(name = "一级费用科目code")
private String firstSubjectCode;
@ApiModelProperty("一级费用科目")
@Excel(name = "一级费用科目")
private String firstSubjectName;
@ApiModelProperty("二级费用科目code")
@Excel(name = "二级费用科目code")
private String secondSubjectCode;
@ApiModelProperty("二级费用科目")
@Excel(name = "二级费用科目")
private String secondSubjectName;
@ApiModelProperty("计费策略id")
@Excel(name = "计费策略id")
private Long accountingStrategyId;
@ApiModelProperty("计费策略")
@Excel(name = "计费策略")
private String accountingStrategy;
@ApiModelProperty("计费策略编码")
@Excel(name = "计费策略编码")
private String accountingStrategyCode;
@ApiModelProperty("计费周期")
@Excel(name = "计费周期")
private String billingAttributes;
@ApiModelProperty("计费周期编码")
@Excel(name = "计费周期编码")
private String billingAttributesCode;
@ApiModelProperty("合同有效日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同有效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectEffectiveDate;
@ApiModelProperty("合同到期日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date subjectExpirationDate;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
@ApiModelProperty("单据类型code")
private String documentTypeCode;
@ApiModelProperty("单据类型")
private String documentType;
@ApiModelProperty("费用类别编码")
private String serviceItemsCode;
@ApiModelProperty("费用类别名称")
private String serviceItemsName;
}
@@ -0,0 +1,228 @@
package com.mhd.system.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 合同管理对象 contract_manage
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageFeignDTO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("原始合同编号")
@Excel(name = "原始合同编号")
private String originalContractNumber;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("是否通用合同(1-是,2-否)")
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输,3-其他)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输,3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@Excel(name = "合同状态", readConverterExp = "1=-未生效,2-使用中,3-已过期,4-已作废")
private Integer contractState;
@ApiModelProperty("签订单位")
@Excel(name = "签订单位")
private String signingUnit;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private String settlementCustomers;
@ApiModelProperty("结算主体id")
@Excel(name = "结算主体id")
private Long settlementCustomersId;
@ApiModelProperty("结算主体code")
@Excel(name = "结算主体code")
private String settlementCustomersCode;
@ApiModelProperty("我司身份(1-甲方,2-乙方)")
@Excel(name = "我司身份", readConverterExp = "1=-甲方,2-乙方")
private Integer ourIdentity;
@ApiModelProperty("账期(1-每月,2-双月,3-季度)")
@Excel(name = "账期", readConverterExp = "1=-每月,2-双月,3-季度")
private Integer accountingPeriod;
@ApiModelProperty("合同签订日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date signingDate;
@ApiModelProperty("合同生效日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date effectiveDate;
@ApiModelProperty("合同到期日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date expirationDate;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("合同正本附件地址")
@Excel(name = "合同正本附件地址")
private String contractOriginalUrl;
@ApiModelProperty("廉政协议附件地址")
@Excel(name = "廉政协议附件地址")
private String integrityAgreementUrl;
@ApiModelProperty("安全协议附件地址")
@Excel(name = "安全协议附件地址")
private String securityProtocolUrl;
@ApiModelProperty("其他附件地址")
@Excel(name = "其他附件地址")
private String otherAttachmentsUrl;
@ApiModelProperty("合同正本附件原始文件名")
private String contractOriginalName;
@ApiModelProperty("廉政协议附件原始文件名")
private String integrityAgreementName;
@ApiModelProperty("安全协议附件原始文件名")
private String securityProtocolName;
@ApiModelProperty("其他附件原始文件名(多文件时与 otherAttachmentsUrl 同分隔符、同顺序)")
private String otherAttachmentsName;
@ApiModelProperty("我司签订人")
@Excel(name = "我司签订人")
private String ourSinged;
@ApiModelProperty("我司签订人联系方式")
@Excel(name = "我司签订人联系方式")
private String ourSingedPhone;
@ApiModelProperty("我司经办人")
@Excel(name = "我司经办人")
private String ourOperator;
@ApiModelProperty("我司经办人联系方式")
@Excel(name = "我司经办人联系方式")
private String ourOperatorPhone;
@ApiModelProperty("对方签订人")
@Excel(name = "对方签订人")
private String theySinged;
@ApiModelProperty("对方签订人联系方式")
@Excel(name = "对方签订人联系方式")
private String theySingedPhone;
@ApiModelProperty("对方经办人")
@Excel(name = "对方经办人")
private String theyOperator;
@ApiModelProperty("对方经办人联系方式")
@Excel(name = "对方经办人联系方式")
private String theyOperatorPhone;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
@ApiModelProperty(name = "合同科目详情列表")
private List<ContractManageDetailFeignDTO> contractManageDetailDTOList;
@ApiModelProperty("合同管理ids")
private String contractManageIds;
@ApiModelProperty(name = "合同签订查询条件开始日期")
private String signingDateStart;
@ApiModelProperty(name = "合同签订查询条件结束日期")
private String signingDateEnd;
@ApiModelProperty(name = "合同生效查询条件开始日期")
private String effectiveDateStart;
@ApiModelProperty(name = "合同生效查询条件结束日期")
private String effectiveDateEnd;
@ApiModelProperty(name = "合同到期查询条件开始日期")
private String expirationDateStart;
@ApiModelProperty(name = "合同到期查询条件结束日期")
private String expirationDateEnd;
@ApiModelProperty(name = "结算主体基础数据id(可以是用户id也可以是企业id)")
private String settlementId;
@ApiModelProperty(name = "是否自动出账(1-是,2-否)")
private Integer automaticFlag;
@ApiModelProperty("出账日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date paymentDate;
@ApiModelProperty(name = "出账天数")
private Integer billDays;
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType;
@ApiModelProperty("客户类型")
private String customerType;
@ApiModelProperty("客户类型编码")
private String customerTypeCode;
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("客户类型")
private String contractRentType;
@ApiModelProperty("客户类型编码")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型编码")
private String warehouseTempLayerTypeName;
}
@@ -0,0 +1,52 @@
package com.mhd.system.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersFeign extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -250,4 +250,20 @@ public class MaterialBaseInfoFeign extends BaseVOEntity{
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -6,6 +6,7 @@ import com.mhd.common.core.domain.po.OrganizationPo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.ProductServiceFeign;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@@ -66,6 +67,21 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory<BmsService
public AjaxResult wholeRentSynchronizationZXF(BusinessDataPushDTO businessDataPushDTO) {
return null;
}
@Override
public AjaxResult feignSaveBusinessDocument(BusinessDocumentFeign businessDocumentFeign) {
return AjaxResult.error("保存业务单据失败");
}
@Override
public AjaxResult getListBySettlementCustomersId(Long settlementCustomersId) {
return AjaxResult.error(throwable.getMessage());
}
@Override
public AjaxResult updatePushContractManageJobId(Long settlementCustomersId, Integer jobId) {
return AjaxResult.error(throwable.getMessage());
}
};
}
}
}
@@ -41,6 +41,11 @@ public class RemoteOmsFeignFallbackFactory implements FallbackFactory<OmsService
return null;
}
@Override
public AjaxResult returnInResult(String orderNumber, Long status, String type) {
return null;
}
@Override
public AjaxResult pushOutOrder(StockOutOrderTZPD stockOutOrder) {
return null;
@@ -13,6 +13,8 @@ import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.AssociationWarehouseFeign;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.ContainerFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.SysDictData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -318,6 +320,16 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
public AjaxResult matchForMaterialImport(String keyword, Long organizationId) {
return AjaxResult.error("物料分类匹配失败");
}
@Override
public AjaxResult feignSave(ContractManageFeignDTO contractManageFeignDTO) {
return AjaxResult.error("新增合同失败");
}
@Override
public AjaxResult feignSaveContractParameters(ContractManageParametersFeign contractManageParametersFeign) {
return AjaxResult.error("保存合同参数失败");
}
};
}
}
@@ -551,6 +551,12 @@ public class RemoteWlhyFallbackFactory implements FallbackFactory<WlhyServiceFei
return AjaxResult.error(cause.getMessage());
}
@Override
public AjaxResult deleteChainByExecuteOrderNumber(String executeOrderNumber) {
//返回错误而非静默成功, 让OMS反审事务能感知失败并整体回滚
return AjaxResult.error("TMS反审联动软删链路失败(服务降级):" + cause.getMessage());
}
@Override
public AjaxResult<?> queryList(Integer pageNo, Integer pageSize, String pushStatus, String organizationId) {
return AjaxResult.error(cause.getMessage());
@@ -57,25 +57,38 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
}
@Override
public void omsOutOrderAdd(StockOutOrder stockOutOrder) {
public AjaxResult omsOutOrderAdd(StockOutOrder stockOutOrder) {
//返回错误而非静默成功: 降级吞掉会让OMS继续走分配, 残留"有单无明细"的垃圾单
return AjaxResult.error("WMS下发单保存失败(服务降级):" + cause.getMessage());
}
@Override
public void omsOutOrderAddDetail(List<OutMaterialDetail> outMaterialDetails) {
public AjaxResult omsOutOrderAddDetail(List<OutMaterialDetail> outMaterialDetails) {
return AjaxResult.error("WMS下发单明细保存失败(服务降级):" + cause.getMessage());
}
@Override
public void omsOutOrderAddDeliveryDetailsLink(List<DeliveryDetailsLink> deliveryDetailsLinks) {
public AjaxResult omsOutOrderAddDeliveryDetailsLink(List<DeliveryDetailsLink> deliveryDetailsLinks) {
return AjaxResult.error("WMS下发单配送明细保存失败(服务降级):" + cause.getMessage());
}
@Override
public void omsInOrderAdd(StockInOrder stockInOrder) {
public AjaxResult omsInOrderAdd(StockInOrder stockInOrder) {
//返回错误而非静默成功:下发主单保存失败必须让OMS感知并回滚下发标记,
//否则OMS显示已下发、WMS无数据,下游收货流程无从进行(流程阻断)
return AjaxResult.error("WMS入库单保存失败(服务降级):" + cause.getMessage());
}
@Override
public void omsCancelExecutionOrder(StockOutOrder stockOutOrder) {
public AjaxResult omsCancelExecutionOrder(StockOutOrder stockOutOrder) {
//返回错误而非静默成功,让OMS侧补偿清理能感知失败并记录告警
return AjaxResult.error("WMS取消下发清理失败:" + cause.getMessage());
}
@Override
public AjaxResult omsReverseExecutionOrder(StockOutOrder stockOutOrder) {
//返回错误而非静默成功,让OMS反审事务能感知失败并整体回滚
return AjaxResult.error("WMS出库执行单反审失败(服务降级):" + cause.getMessage());
}
@Override
@@ -89,7 +102,27 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
}
@Override
public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
public AjaxResult checkOmsAssignInventory(List<OutMaterialDetail> outMaterialDetails) {
//校验接口本身不可用时返回错误,OMS会阻止下发(不能在WMS状态未知时盲目推送)
return AjaxResult.error("WMS库存校验服务不可用:" + cause.getMessage());
}
@Override
public AjaxResult omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
//返回错误而非静默成功:明细保存(含自动审核)失败必须让OMS感知并回滚下发标记
return AjaxResult.error("WMS入库单明细保存失败(服务降级):" + cause.getMessage());
}
@Override
public AjaxResult omsCancelInOrder(StockInOrder stockInOrder) {
//返回错误而非静默成功,让OMS侧取消下发能感知清理失败并整体回滚(取消下发可重试,WMS清理幂等)
return AjaxResult.error("WMS取消下发清理失败:" + cause.getMessage());
}
@Override
public AjaxResult omsReverseInOrder(StockInOrder stockInOrder) {
//返回错误而非静默成功,让OMS侧反审能感知回退失败并整体回滚(反审可重试,WMS回退幂等)
return AjaxResult.error("WMS入库单反审回退失败(服务降级):" + cause.getMessage());
}
@Override
@@ -15,12 +15,17 @@ import com.mhd.bi.domain.biWarehouseTransport.service.BiWarehouseTransportReport
import com.mhd.bi.interfaces.facadeApi.biReport.dto.BiApiResult;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.ComprehensiveSituationVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.WarehouseTransportSituationVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.gps.NanqiGpsLocationVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.overall.OverallOperationSituationVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
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.common.core.exception.ServiceException;
import com.mhd.common.core.feign.ThirdPartyServiceFeign;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -72,6 +77,12 @@ public class BiReportApi extends BaseController {
@Autowired
private BiReportSnapshotSyncService biReportSnapshotSyncService;
@Autowired
private ThirdPartyServiceFeign thirdPartyServiceFeign;
@Autowired
private ObjectMapper objectMapper;
@ApiOperation(value = "手动触发快照同步", notes = "立即写入各 BI 快照表(综合、仓储运输、月台监测、总体运营、仓储运营专区、运输运营专区、港澳服务专区);须带 X-BI-Access-Token")
@PostMapping("/snapshotSync/run")
@@ -139,6 +150,29 @@ public class BiReportApi extends BaseController {
List<RealPlatformInfoPO> data = biPlatformRealDataService.queryPlatformInfoList();
return BiApiResult.ok(data);
}
/**
* 南岐GPS:根据车牌号查询车辆实时定位
* (内部经 ThirdPartyServiceFeign 转发到 mhd_thrid_party 的 /nanqiGps/queryByPlate,逻辑仍在 mhd_thrid_party
*/
@ApiOperation(value = "根据车牌号查询车辆实时定位(南岐GPS)", notes = "按车牌号查询南岐GPS车辆实时定位,实时转发到三方服务")
@GetMapping("/nanqiGps/queryByPlate")
public BiApiResult<NanqiGpsLocationVO> nanqiQueryByPlate(
@ApiParam(value = "车牌号")
@RequestParam(value = "carPlate") String carPlate) {
if (carPlate == null || carPlate.trim().isEmpty()) {
throw new ServiceException("车牌号不能为空");
}
AjaxResult result = thirdPartyServiceFeign.nanqiQueryByPlate(carPlate);
Object codeObj = result == null ? null : result.get("code");
if (codeObj == null || !"200".equals(String.valueOf(codeObj))) {
String msg = result == null ? "南岐GPS查询失败" : String.valueOf(result.get("msg"));
throw new ServiceException(msg);
}
Object data = result.get("data");
NanqiGpsLocationVO vo = objectMapper.convertValue(data, NanqiGpsLocationVO.class);
return BiApiResult.ok(vo);
}
//园区物流大屏接口----------------------------------------------------------------------
/**
* 总体运营态势
@@ -0,0 +1,248 @@
package com.mhd.bi.interfaces.facadeApi.biReport.vo.gps;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 南岐GPS 车辆定位信息 VO(与 mhd_thrid_party.NanqiGpsLocationVO 同构,供 BI 开放接口返回)
*
* @author mhd
*/
@Data
@ApiModel("南岐GPS 车辆定位信息")
public class NanqiGpsLocationVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("应答结果:1成功 0失败")
private Integer rspCode;
@ApiModelProperty("应答描述")
private String rspDesc;
@ApiModelProperty("车辆id")
private String carId;
@ApiModelProperty("车牌号")
private String carPlate;
@ApiModelProperty("车辆名")
private String carName;
@ApiModelProperty("车队id")
private String teamId;
@ApiModelProperty("车队名称")
private String teamName;
@ApiModelProperty("终端号")
private String tmnNo;
@ApiModelProperty("消息序列号")
private String tmnKey;
@ApiModelProperty("卡号")
private String simCard;
@ApiModelProperty("定位时间")
private String time;
@ApiModelProperty("经度(WGS84")
private BigDecimal lng;
@ApiModelProperty("纬度(WGS84")
private BigDecimal lat;
@ApiModelProperty("百度经度")
private BigDecimal blng;
@ApiModelProperty("百度纬度")
private BigDecimal blat;
@ApiModelProperty("谷歌/高德经度")
private BigDecimal glng;
@ApiModelProperty("谷歌/高德纬度")
private BigDecimal glat;
@ApiModelProperty("海拔(米)")
private BigDecimal height;
@ApiModelProperty("速度(千米/小时)")
private BigDecimal speed;
@ApiModelProperty("方向 0~360")
private String drct;
@ApiModelProperty("昨日平台总里程(千米)")
private String prevDayTotalMile;
@ApiModelProperty("平台总里程(千米)")
private String mile;
@ApiModelProperty("今日里程(千米)")
private String preMile;
@ApiModelProperty("终端里程(千米)")
private String tmnMile;
@ApiModelProperty("定位信号:0无 弱<=3 中<=6 强>6")
private String satl;
@ApiModelProperty("通讯信号:0无 弱<=10 中<=20 强>20")
private String sgn;
@ApiModelProperty("地理描述")
private String addr;
@ApiModelProperty("车辆定位状态")
private String state;
@ApiModelProperty("车辆状态文字")
private String stateCn;
@ApiModelProperty("驾驶员")
private String drvName;
@ApiModelProperty("驾驶员电话")
private String drvPhone;
@ApiModelProperty("车牌颜色")
private String plateColor;
@ApiModelProperty("车辆类型")
private String carType;
@ApiModelProperty("地图图标")
private String icon;
@ApiModelProperty("地图图标完整链接")
private String iconLink;
@ApiModelProperty("是否上传自定义图片:true取上传图片 false取大图")
private String uploadFlag;
@ApiModelProperty("大图片")
private String bigIcon;
@ApiModelProperty("大图片完整链接")
private String bigIconLink;
@ApiModelProperty("实时照片")
private String photoIcon;
@ApiModelProperty("中文方向")
private String drctCn;
@ApiModelProperty("今日行驶时长(秒)")
private String todayRun;
@ApiModelProperty("行停时长")
private String runStopTime;
@ApiModelProperty("行停时长(秒),排序时使用")
private String runStopTimeSecond;
@ApiModelProperty("ACC时长")
private String accTime;
@ApiModelProperty("ACC总时长")
private String totalAccTime;
@ApiModelProperty("离线时长")
private String offLineTime;
@ApiModelProperty("信号线(返回集合,每记录含name/value)")
private String sgnStts;
@ApiModelProperty("提醒信息(返回集合,每记录含name/value)")
private String reminds;
@ApiModelProperty("油量(返回集合,每记录含name/value)")
private String st1;
@ApiModelProperty("载重(返回集合,每记录含name/value)")
private String st2;
@ApiModelProperty("温度(返回集合,每记录含name/value)")
private String st3;
@ApiModelProperty("湿度(返回集合,每记录含name/value)")
private String st4;
@ApiModelProperty("水位(返回集合,每记录含name/value)")
private String st5;
@ApiModelProperty("服务到期状态:1已到期 0未到期")
private String expState;
@ApiModelProperty("服务期限")
private String expTime;
@ApiModelProperty("油量")
private String oil;
@ApiModelProperty("定位附加项(JSON")
private String protocols;
@ApiModelProperty("扩展字段(JSON")
private String exts;
@ApiModelProperty("模拟量1")
private String moni1;
@ApiModelProperty("模拟量2")
private String moni2;
@ApiModelProperty("模拟量3")
private String moni3;
@ApiModelProperty("模拟量4")
private String moni4;
@ApiModelProperty("视频通道(JSON")
private String videos;
@ApiModelProperty("未处理报警类型名称(逗号分隔)")
private String alarms;
@ApiModelProperty("未处理报警类型ID(逗号分隔)")
private String alarmTypeIds;
@ApiModelProperty("终端型号")
private String tmnType;
@ApiModelProperty("终端到期时间")
private String tmnExpirTime;
@ApiModelProperty("视频设备报警id集合")
private String videoAlarmTypes;
@ApiModelProperty("驾驶员登签姓名(卡号)")
private String driverSign;
@ApiModelProperty("驾驶员登签电话号码")
private String driverSignPhone;
@ApiModelProperty("驾驶员登签时间")
private String driverSignTime;
@ApiModelProperty("驾驶员登签时长")
private String drvSignTimeLong;
@ApiModelProperty("车辆基本状态(16进制位掩码)")
private String carStts;
@ApiModelProperty("报警状态(16进制位掩码)")
private String alarmStts;
@ApiModelProperty("协议版本")
private String prtcVer;
@ApiModelProperty("接入端口")
private String tmnPort;
}
+2 -2
View File
@@ -19,14 +19,14 @@ spring:
# username: nacos
# password: manhuoda@2023
#线上正式环境
server-addr: 10.102.192.31:6848
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.102.192.30:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -88,5 +88,10 @@ public class SettlementCustomersPO extends BaseVOEntity{
private String settlementObject;
}
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
private Integer pushBillingRecordJobId;
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
private Integer pushContractManageToBmsJobId;
@ApiModelProperty(name = "生成应收账单任务id")
private Integer pushBillManageJobId;
}
@@ -0,0 +1,58 @@
package com.mhd.common.core.domain.po;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "结算对象参数对象", description = "结算对象参数响应对象")
public class SettlementCustomersParametersPO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算对象编码")
@Excel(name = "结算对象编码")
private String settlementCustomersCode;
@ApiModelProperty("结算主体id")
@Excel(name = "结算主体id")
private Long settlementEntityId;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private String settlementEntity;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("参数内容")
@Excel(name = "参数内容")
private String content;
@ApiModelProperty("参数名称")
@Excel(name = "参数名称")
private String parametersName;
}
@@ -26,7 +26,7 @@ import java.io.InputStream;
import java.util.List;
import java.util.Map;
@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012",configuration = FeignAutoConfiguration.class)
@FeignClient(value = "mhd-third-party-service",url = "http://10.33.0.129:8012", configuration = FeignAutoConfiguration.class)
public interface ThirdPartyServiceFeign {
//查询当前组织所有三方接口信息
@@ -334,4 +334,12 @@ public interface ThirdPartyServiceFeign {
@PostMapping("/mdmMasterData/queryMerchant")
R<com.mhd.common.core.domain.thirdparty.MdmMerchantQueryResultDTO> queryMdmMerchant(
@RequestBody com.mhd.common.core.domain.thirdparty.MdmMerchantQueryDTO queryDTO);
/**
* 南岐GPS:根据车牌号查询车辆实时定位
* @param carPlate 车牌号
* @return AjaxResultdata 为车辆定位信息(code=200 成功)
*/
@GetMapping("/nanqiGps/queryByPlate")
AjaxResult nanqiQueryByPlate(@RequestParam("carPlate") String carPlate);
}
@@ -0,0 +1,112 @@
package com.mhd.common.core.jackson;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.ContextualDeserializer;
import java.io.IOException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 宽松日期反序列化:兼容 yyyy-MM-dd(纯日期)等常见格式。
*
* 背景:库存查询等接口日期只保留年月日后,前端可能把 "2026-07-06" 这类纯日期回传,
* 而实体/DTO 上 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 是严格格式,反序列化直接报
* InvalidFormatException。本反序列化器解析顺序:
* 1) 字段 @JsonFormat 指定的模式(严格全匹配,保持原行为);
* 2) 兜底常见格式:yyyy-MM-dd HH:mm:ss → yyyy-MM-dd HH:mm → yyyy-MM-dd
* 3) 纯数字按毫秒时间戳;
* 4) 交给 Jackson 默认解析(ISO-8601 等)。
* 仅放宽接受范围,不影响任何既有格式的解析结果;由各服务 DateCompatibilityConfig 显式注册生效。
*
* @author rcx
* @date 2026-09-05
*/
public class FlexibleDateDeserializer extends JsonDeserializer<Date> implements ContextualDeserializer {
/** 兜底格式按长度降序排列,避免长文本被短格式部分解析 */
private static final String[] FALLBACK_PATTERNS = {
"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"
};
/** 字段 @JsonFormat 指定的模式,可为空 */
private final String pattern;
public FlexibleDateDeserializer() {
this(null);
}
public FlexibleDateDeserializer(String pattern) {
this.pattern = pattern;
}
@Override
public Date deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException {
String value = parser.getText();
if (value == null || value.trim().isEmpty()) {
return null;
}
value = value.trim();
// 纯数字按毫秒时间戳(10位秒级时间戳也兼容)
if (value.matches("\\d{10,}")) {
return new Date(Long.parseLong(value));
}
// 1) 字段 @JsonFormat 指定的模式优先
Date parsed = tryParse(value, pattern);
// 2) 兜底常见格式
if (parsed == null) {
for (String fallback : FALLBACK_PATTERNS) {
parsed = tryParse(value, fallback);
if (parsed != null) {
break;
}
}
}
// 3) 交给 Jackson 默认解析(ISO-8601 等)
if (parsed == null) {
try {
parsed = ctxt.parseDate(value);
} catch (IllegalArgumentException ignore) {
// 走不到默认解析时统一在下方抛出友好异常
}
}
if (parsed == null) {
throw ctxt.weirdStringException(value, Date.class,
"支持格式:yyyy-MM-dd HH:mm:ss / yyyy-MM-dd HH:mm / yyyy-MM-dd");
}
return parsed;
}
/**
* 严格全匹配解析:解析失败或文本未完整消费(如按 yyyy-MM-dd 解析 "2026-07-06 10:00:00"
* 都视为不匹配返回 null,交由下一个格式尝试
*/
private Date tryParse(String value, String pattern) {
if (pattern == null || pattern.isEmpty()) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setLenient(false);
ParsePosition pos = new ParsePosition(0);
Date date = sdf.parse(value, pos);
return (date != null && pos.getIndex() == value.length()) ? date : null;
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) {
if (property != null) {
JsonFormat jsonFormat = property.getAnnotation(JsonFormat.class);
if (jsonFormat != null && jsonFormat.pattern() != null && !jsonFormat.pattern().isEmpty()) {
return new FlexibleDateDeserializer(jsonFormat.pattern());
}
}
return this;
}
}
+10
View File
@@ -111,6 +111,16 @@
<version>2.24</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<!-- JPush推送 -->
<!-- jpush极光推送导入start -->
<!-- <dependency>-->
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -11,16 +12,26 @@ import com.mhd.basic.domain.contractManage.entity.ContractManage;
import com.mhd.basic.domain.contractManage.repository.mapper.ContractManageMapper;
import com.mhd.basic.domain.contractManage.repository.po.ContractManagePO;
import com.mhd.basic.domain.contractManage.repository.todo.ContractManageDO;
import com.mhd.basic.domain.contractManage.repository.util.HttpWebServiceUtil;
import com.mhd.basic.domain.contractManage.repository.util.XxlJobOpenApiUtil;
import com.mhd.basic.domain.contractManage.service.ContractManageDomainService;
import com.mhd.basic.domain.contractManageDetail.entity.ContractManageDetail;
import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManageDetailMapper;
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService;
import com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService;
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
import com.mhd.basic.interfaces.dto.contractManage.*;
import com.mhd.basic.interfaces.assember.contractManageParameters.ContractManageParametersAssembler;
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.common.core.domain.po.*;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
@@ -32,18 +43,23 @@ import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import com.mhd.system.api.domain.MaterialInventoryPO;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.model.LoginUser;
import com.mhd.system.service.ISysDictTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -75,6 +91,20 @@ public class ContractManageApplicationService {
@Autowired
private SystemServiceFeign systemServiceFeign;
@Autowired
private ContractManageParametersDomainService contractManageParametersDomainService;
@Autowired
private ContractManageParametersAssembler contractManageParametersAssembler;
@Autowired
private ContractManageParametersMapper contractManageParametersMapper;
@Autowired
private IContractManageParametersService contractManageParametersService;
@Resource
private XxlJobOpenApiUtil apiUtil;
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q";
/**
* 分页查询合同管理列表
@@ -126,7 +156,21 @@ public class ContractManageApplicationService {
contractManageDO.setTopOrganizationId(2827L);
}
}
return contractManageDomainService.queryList(contractManageDO);
List<ContractManagePO> list = contractManageDomainService.queryList(contractManageDO);
if (!list.isEmpty()) {
List<Long> contractManageIds = list.stream()
.map(ContractManagePO::getContractManageId)
.collect(Collectors.toList());
List<ContractManageParametersPO> allParams = contractManageParametersDomainService.queryListByManageIds(contractManageIds);
Map<Long, List<ContractManageParametersPO>> paramsMap = allParams.stream()
.collect(Collectors.groupingBy(ContractManageParametersPO::getContractManageId));
for (ContractManagePO po : list) {
po.setContractManageParametersList(paramsMap.getOrDefault(po.getContractManageId(), new ArrayList<>()));
}
}
return list;
}
// public BigDecimal getAmount(List<SubjectAndPriceReturn> subjectAndPriceReturnList) {
@@ -610,6 +654,7 @@ public class ContractManageApplicationService {
*/
//20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
@@ -618,9 +663,42 @@ public class ContractManageApplicationService {
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO);
handleDetils(contractManageDO, true);
handleParameters(contractManageDO);
return flag;
}
/**
* 新增合同管理
*/
@Transactional
public ContractManageDO insertFeign(ContractManageDO contractManageDO) {
//获取当前登录人信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
validateContractType(contractManageDO.getContractType());
/*
通用合同:同一时间段、同一合同类型,只能存在一个
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
*/
//20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
contractManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO);
if (!flag) {
throw new ServiceException("新增合同管理失败,请检查数据");
}
handleDetils(contractManageDO, true);
return contractManageDO;
}
/**
* 处理数据字典
*/
@@ -748,6 +826,26 @@ public class ContractManageApplicationService {
}
}
private void checkUniqueActiveContract(ContractManageDO contractManageDO) {
if (contractManageDO.getContractState() != null && contractManageDO.getContractState() != 2) {
return;
}
if (contractManageDO.getSettlementCustomersId() == null
|| StringUtils.isEmpty(contractManageDO.getWarehouseTempLayerType())
|| StringUtils.isEmpty(contractManageDO.getContractRentType())) {
return;
}
long count = contractManageDomainService.countByUniqueKey(
contractManageDO.getSettlementCustomersId(),
contractManageDO.getWarehouseTempLayerType(),
contractManageDO.getContractRentType(),
contractManageDO.getContractManageId()
);
if (count > 0) {
throw new ServiceException("同一结算客户、同一温层、同一租赁类型只能存在一个使用中的合同");
}
}
/**
* 处理合同详情
*/
@@ -846,6 +944,111 @@ public class ContractManageApplicationService {
}
}
private void handleParameters(ContractManageDO contractManageDO) {
List<ContractManageParametersPO> existingList = contractManageParametersDomainService.queryListByManageId(contractManageDO.getContractManageId());
if (!existingList.isEmpty()) {
Long[] ids = existingList.stream().map(ContractManageParametersPO::getId).toArray(Long[]::new);
contractManageParametersDomainService.delete(ids);
}
if (StringUtils.isNotEmpty(contractManageDO.getParametersJson())) {
ContractManageParametersDTO dto = new ContractManageParametersDTO();
dto.setContractManageId(contractManageDO.getContractManageId());
dto.setContractNumber(contractManageDO.getContractNumber());
dto.setContractName(contractManageDO.getContractName());
dto.setParametersJson(contractManageDO.getParametersJson());
dto.setOrganizationId(contractManageDO.getOrganizationId());
dto.setOrganizationName(contractManageDO.getOrganizationName());
dto.setTopOrganizationId(contractManageDO.getTopOrganizationId());
ContractManageParametersDO parametersDO = contractManageParametersAssembler.toDO(dto);
contractManageParametersDomainService.insert(parametersDO);
if(StringUtils.isNotEmpty(contractManageDO.getSettlementCustomersCode())){
AjaxResult ajaxResult = bmsServiceFeign.getCustomersInfoByCode(contractManageDO.getSettlementCustomersCode());
if (!"200".equals(String.valueOf(ajaxResult.get("code")))){
throw new ServiceException("获取结算客户信息失败");
}
SettlementCustomersPO settlementCustomersPO = JSON.parseObject(JSONObject.toJSONString(ajaxResult.get("data")), SettlementCustomersPO.class);
if(null == settlementCustomersPO){
throw new ServiceException("结算客户信息未找到");
}
Long settlementEntityId = settlementCustomersPO.getSettlementEntityId();
if(null != settlementEntityId){
Integer pushContractManageToBmsJobId = settlementCustomersPO.getPushContractManageToBmsJobId();
if (null != pushContractManageToBmsJobId) {
stopXxlJob(pushContractManageToBmsJobId);
}
Integer jobId = addXxlJob(settlementEntityId.toString());
settlementCustomersPO.setPushContractManageToBmsJobId(jobId);
AjaxResult updateResult = bmsServiceFeign.updatePushContractManageJobId(settlementCustomersPO.getSettlementCustomersId(), jobId);
if (!"200".equals(String.valueOf(updateResult.get("code")))) {
throw new ServiceException("更新结算对象定时任务ID失败");
}
}
}
}
}
/**
* 创建夜间23点定时任务
* @param shipperId 结算对象id,作为任务参数
* @return xxlJobId 保存到业务表,后续用于删除/暂停
*/
public Integer addXxlJob(String shipperId) {
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
req.setJobGroup(5);
//生成唯一业务流水号拼接至JobDesc,保证本次新建任务的JobDesc唯一,据此查询jobId不会命中历史任务
String xxlJobBizNo = generateXxlJobBizNo();
req.setJobDesc("整租推送计费单据/流水任务,结算对象id:" + shipperId + ",业务流水号:" + xxlJobBizNo);
req.setAuthor("system");
req.setAlarmEmail("");
req.setScheduleType("CRON");
// 每天晚上23点执行
req.setScheduleConf("0 0 1 * * ?");
req.setGlueType("BEAN");
req.setExecutorHandler("pushContractManageToBms");
req.setExecutorParam(shipperId);
req.setGlueRemark("");
req.setGlueSource("");
req.setExecutorRouteStrategy("FIRST");
req.setChildJobId(null);
req.setMisfireStrategy("DO_NOTHING");
req.setExecutorBlockStrategy("SERIAL_EXECUTION");
req.setExecutorTimeout(0);
req.setExecutorFailRetryCount(0);
boolean addOk = apiUtil.addJob(req);
if (!addOk) {
throw new RuntimeException("创建夜间定时任务失败");
}
Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"5");
if (xxlJobId == null) {
throw new RuntimeException("定时任务创建成功,但查询jobId失败");
}
return xxlJobId;
}
public void stopXxlJob(Integer shipperId) {
//1.实例化工具类,建议交给Spring管理
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
//3.调用创建任务接口 ,返回任务ID
apiUtil.pauseJob(shipperId);
}
private static final DateTimeFormatter JOB_BIZ_NO_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
private static final Random RANDOM = new Random();
/**
* 生成xxl-job任务业务流水号:JOB + 当天yyMMddHHmmssSSS + 6位随机数字,保证每次创建的JobDesc唯一
* 示例:JOB260905102030123123456
* @return 业务流水号字符串
*/
private static String generateXxlJobBizNo() {
String dateTimeStr = LocalDateTime.now().format(JOB_BIZ_NO_FORMATTER);
int randomNum = RANDOM.nextInt(1_000_000);
String randomStr = String.format("%06d", randomNum);
return "JOB" + dateTimeStr + randomStr;
}
/**
* 修改合同管理
*/
@@ -853,8 +1056,10 @@ public class ContractManageApplicationService {
public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType());
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO, false);
handleParameters(contractManageDO);
handleDict(contractManageDO);
return contractManageDomainService.update(contractManageDO);
}
@@ -880,6 +1085,8 @@ public class ContractManageApplicationService {
ContractManagePO result = contractManageDomainService.getInfo(contractManageId);
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(result.getContractManageId());
result.setContractManageDetailPOList(contractManageDetailPOList);
List<ContractManageParametersPO> paramsList = contractManageParametersDomainService.queryListByManageId(result.getContractManageId());
result.setContractManageParametersList(paramsList);
return result;
}
@@ -1171,4 +1378,296 @@ public class ContractManageApplicationService {
}
return exportList;
}
/*
* 获取结算对象
* */
public SettlementCustomersPO getSettlementCustomers(Long shipperId) {
try {
Long topOrganizationId = null;
AjaxResult ajaxResult = bmsServiceFeign.getCustomersInfoBySettlementEntityId(shipperId, topOrganizationId);
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code"))) || ajaxResult.get("data") == null) {
log.warn("按 settlementEntityId 查询结算对象未成功:shipperId={}, code={}", shipperId, ajaxResult != null ? ajaxResult.get("code") : null);
return null;
}
return JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")), SettlementCustomersPO.class);
} catch (Exception e) {
log.warn("按 settlementEntityId 查询结算对象异常,shipperId={}", shipperId, e);
return null;
}
}
/*
* 根据结算对象id获取结算对象参数列表
* */
public List<SettlementCustomersParametersPO> getSettlementCustomersParameters(Long settlementCustomersId) {
try {
AjaxResult ajaxResult = bmsServiceFeign.getListBySettlementCustomersId(settlementCustomersId);
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code"))) || ajaxResult.get("data") == null) {
log.warn("按 settlementCustomersId 查询结算对象参数未成功:settlementCustomersId={}, code={}", settlementCustomersId, ajaxResult != null ? ajaxResult.get("code") : null);
return null;
}
return JSON.parseArray(JSON.toJSONString(ajaxResult.get("data")), SettlementCustomersParametersPO.class);
} catch (Exception e) {
log.warn("按 settlementCustomersId 查询结算对象参数异常,settlementCustomersId={}", settlementCustomersId, e);
return null;
}
}
public void pushContractManageToBms(String shipperId) {
SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId));
if (settlementCustomers == null) {
log.warn("pushContractManageToBms 未找到结算对象,shipperId={}", shipperId);
return;
}
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
List<SettlementCustomersParametersPO> parametersList = getSettlementCustomersParameters(settlementCustomersId);
if (parametersList == null || parametersList.isEmpty()) {
log.warn("pushContractManageToBms 未找到结算对象参数,settlementCustomersId={}", settlementCustomersId);
return;
}
for (SettlementCustomersParametersPO param : parametersList) {
String parametersName = param.getParametersName();
String content = param.getContent();
if (StringUtils.isEmpty(content)) {
log.warn("结算对象参数 content 为空,parametersName={}, settlementCustomersId={}", parametersName, settlementCustomersId);
continue;
}
Map<String, Object> contentMap = JSON.parseObject(content, new TypeReference<Map<String, Object>>() {});
Integer sfzdcz = Integer.valueOf(contentMap.get("sfzdcz").toString());
if (sfzdcz != 1) {
log.info("结算对象参数 sfzdcz 不为1,跳过推送,parametersName={}, sfzdcz={}", parametersName, sfzdcz);
continue;
}
String warehouseTempLayerType;
String serviceItemsName;
Boolean isGc = false;
if ("冻仓计费配置".equals(parametersName)) {
warehouseTempLayerType = "DC";
serviceItemsName = "冻仓仓租费用";
} else if ("干仓计费配置".equals(parametersName)) {
warehouseTempLayerType = "GC";
serviceItemsName = "干仓仓租费用";
isGc=true;
} else {
log.warn("未知的结算对象参数类型,parametersName={}", parametersName);
continue;
}
List<ContractManage> contractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
.eq(ContractManage::getContractRentType, "NORMAL")
.eq(ContractManage::getContractState, 2)
.eq(ContractManage::getDelFlag, 1)
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
.eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType));
if (contractManages == null || contractManages.isEmpty()) {
log.warn("未找到正式合同,warehouseTempLayerType={}, settlementCustomersId={}", warehouseTempLayerType, settlementCustomersId);
continue;
}
for (ContractManage contractManage : contractManages) {
Long contractManageId = contractManage.getContractManageId();
ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper<ContractManageParameters>()
.eq(ContractManageParameters::getContractManageId, contractManageId), false);
if (contractManageParameters == null) {
continue;
}
String parametersJson = contractManageParameters.getParametersJson();
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
BigDecimal hyj = (BigDecimal) parametersMap.get("hyj");
buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D01", "租金(固定租)", warehouseTempLayerType, serviceItemsName);
}
}
}
private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers, ContractManage contractManage, String code, String name, String warehouseType, String serviceItemsName) {
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
String settlementEntity = settlementCustomers.getSettlementEntity();
String settlementCustomersCode = settlementCustomers.getSettlementCustomersCode();
BusinessDocumentFeign businessDocumentFeign = new BusinessDocumentFeign();
businessDocumentFeign.setBillAmount(fee);
businessDocumentFeign.setOrganizationId(contractManage.getOrganizationId());
businessDocumentFeign.setOrganizationName(contractManage.getOrganizationName());
businessDocumentFeign.setTopOrganizationId(contractManage.getTopOrganizationId());
businessDocumentFeign.setBelongModuleCode("wms");
businessDocumentFeign.setBelongModule("WMS");
businessDocumentFeign.setDataSources(1);
businessDocumentFeign.setSettlementEntity(settlementEntity);
businessDocumentFeign.setSettlementCustomersId(settlementCustomersId);
businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode);
businessDocumentFeign.setDocumentTypeId(4l);
businessDocumentFeign.setDocumentTypeCode("CM_ZL");
businessDocumentFeign.setDocumentType("仓库租赁单");
businessDocumentFeign.setFirstSubjectCode(code);
businessDocumentFeign.setFirstSubjectName(name);
businessDocumentFeign.setBillingTime(new Date());
businessDocumentFeign.setServiceItemsCode("GC_CZ");
businessDocumentFeign.setServiceItemsName(serviceItemsName);
businessDocumentFeign.setSettlementWay(1);
businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber());
businessDocumentFeign.setWarehouseType(warehouseType);
String contractName = contractManage.getContractName();
String contractNumber = contractManage.getContractNumber();
Long contractManageId = contractManage.getContractManageId();
businessDocumentFeign.setContractName(contractName);
businessDocumentFeign.setContractNumber(contractNumber);
businessDocumentFeign.setContractManageId(contractManageId);
businessDocumentFeign.setBusinessFlow(OrderSequence.getOrderCode("LS"));
businessDocumentFeign.setIsPush(1);
AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign);
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) {
log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常");
}
}
private static final String WEBSERVICE_URL = "http://10.33.0.116:8080/sys/webservice/ngLegalByFindWebserviceService";
public List<com.alibaba.fastjson.JSONObject> getContractNosByCompanyName(String companyName, int pageNum, int pageSize) {
List<com.alibaba.fastjson.JSONObject> contractList = new ArrayList<>();
try {
log.info("=== 开始查询合同列表 ===");
log.info("查询公司: {}, 页码: {}, 每页数量: {}", companyName, pageNum, pageSize);
String httpRequest = buildXmlRequest(companyName, pageNum, pageSize);
log.info("XML请求: {}", httpRequest);
log.info("XML请求生成完成,长度: {} 字符", httpRequest.length());
log.info("正在调用WebService...");
String httpResponse = HttpWebServiceUtil.callWebService(httpRequest, WEBSERVICE_URL);
String jsonData = extractJsonFromResponse(httpResponse);
log.info("正在解析JSON..."+jsonData);
if (jsonData == null || jsonData.trim().isEmpty()) {
log.warn("未提取到JSON数据,返回空列表");
return contractList;
}
log.info("提取到JSON数据,长度: {} 字符", jsonData.length());
List<com.alibaba.fastjson.JSONObject> result = parseContractListFromJson(jsonData);
contractList.addAll(result);
log.info("=== 查询完成 ===");
log.info("找到 {} 个合同", contractList.size());
} catch (Exception e) {
log.error("查询合同列表失败", e);
throw new RuntimeException("查询合同列表失败: " + e.getMessage(), e);
}
return contractList;
}
/**
* 构建XML请求 - 动态分页
*/
private String buildXmlRequest(String companyName, int pageNum, int pageSize) {
String jsonParam = "{\"fdName\":\"" + companyName + "\"}";
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
" xmlns:web=\"http://webservice.legal.ng.kmss.landray.com/\">" +
"<soapenv:Body>" +
"<web:findNgLegal>" +
"<arg0 xmlns=\"\">" +
"<fdPageNo>" + pageNum + "</fdPageNo>" +
"<fdRowSize>" + pageSize + "</fdRowSize>" +
"<fdRelativePerson><![CDATA[" + jsonParam + "]]></fdRelativePerson>" +
"<fdContractNo></fdContractNo>" +
"<fdPersonNo>NA0301</fdPersonNo>" +
"<fdSponsor></fdSponsor>" +
"<docCreateTimeStar></docCreateTimeStar>" +
"<docCreateTimeEnd></docCreateTimeEnd>" +
"</arg0>" +
"</web:findNgLegal>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
}
/**
* 从SOAP响应中提取JSON
*/
private String extractJsonFromResponse(String soapResponse) {
if (soapResponse == null || soapResponse.isEmpty()) {
return null;
}
// 直接查找JSON部分
int jsonStart = soapResponse.indexOf("{\"returnState\":");
int jsonEnd = soapResponse.indexOf("}</return>");
if (jsonStart != -1 && jsonEnd != -1) {
// 找到JSON结束位置
jsonEnd = jsonEnd + 1; // 包含右大括号
String json = soapResponse.substring(jsonStart, jsonEnd);
log.info("直接提取JSON成功");
return json;
}
// 备用方法:查找<return>标签
int start = soapResponse.indexOf("<return>");
int end = soapResponse.indexOf("</return>");
if (start != -1 && end != -1) {
start += "<return>".length();
String json = soapResponse.substring(start, end);
// 解码XML实体
json = json.replace("&lt;", "<")
.replace("&gt;", ">")
.replace("&amp;", "&")
.replace("&quot;", "\"")
.replace("&apos;", "'");
log.info("从<return>标签提取JSON成功");
return json.trim();
}
log.warn("无法从响应中提取JSON");
return null;
}
/**
* 解析JSON获取完整合同列表
*/
private List<com.alibaba.fastjson.JSONObject> parseContractListFromJson(String jsonData) {
List<com.alibaba.fastjson.JSONObject> contractList = new ArrayList<>();
try {
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(jsonData);
String returnState = jsonObject.getString("returnState");
if (!"2".equals(returnState)) {
log.warn("返回状态异常: {}", returnState);
return contractList;
}
JSONArray dataArray = jsonObject.getJSONArray("data");
if (dataArray == null || dataArray.isEmpty()) {
log.info("查询成功,但未找到合同数据");
return contractList;
}
log.info("找到 {} 个合同", dataArray.size());
for (int i = 0; i < dataArray.size(); i++) {
com.alibaba.fastjson.JSONObject contract = dataArray.getJSONObject(i);
contractList.add(contract);
}
} catch (Exception e) {
log.error("JSON解析失败", e);
log.error("原始JSON: {}", jsonData);
}
return contractList;
}
}
@@ -0,0 +1,72 @@
package com.mhd.basic.application.service.contractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 合约信息规则维护表ApplicationService
*
* @author gen
* @date 2024-06-07
*/
@Service
@Slf4j
public class ContractManageParametersApplicationService {
@Autowired
private ContractManageParametersDomainService contractManageParametersDomainService;
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
contractManageParametersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
}
return contractManageParametersDomainService.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersDomainService.insert(contractManageParametersDO);
}
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersDomainService.update(contractManageParametersDO);
}
/**
* 批量删除合约信息规则维护表
*/
public boolean delete(Long[] ids) {
return contractManageParametersDomainService.delete(ids);
}
/**
* 获取合约信息规则维护表详细信息
*/
public ContractManageParametersPO getInfo(Long id)
{
return contractManageParametersDomainService.getInfo(id);
}
}
@@ -192,4 +192,30 @@ public class ContractManage extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("合同租赁类型")
private String contractRentType;
@ApiModelProperty("合同租赁类型")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerTypeName;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -1,6 +1,7 @@
package com.mhd.basic.domain.contractManage.repository.po;
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
@@ -195,5 +196,35 @@ public class ContractManagePO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("客户类型")
private String contractRentType;
@ApiModelProperty("客户类型编码")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型编码")
private String warehouseTempLayerTypeName;
private String isMany;
@ApiModelProperty("合约信息规则维护列表")
private List<ContractManageParametersPO> contractManageParametersList;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -226,6 +226,34 @@ public class ContractManageDO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("客户类型")
private String contractRentType;
@ApiModelProperty("客户类型编码")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型编码")
private String warehouseTempLayerTypeName;
@ApiModelProperty("一级费用科目code")
private String firstSubjectCode;
@ApiModelProperty("合约信息规则维护JSON")
private String parametersJson;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date initialStartDate;
}
@@ -0,0 +1,96 @@
package com.mhd.basic.domain.contractManage.repository.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.zip.GZIPInputStream;
@Slf4j
@Component
public class HttpWebServiceUtil {
/**
* 调用HTTP WebService
*/
public static String callWebService(String requestBody, String endpointUrl) {
try {
// 创建RestTemplate
RestTemplate restTemplate = new RestTemplate();
// 设置请求头
HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.TEXT_XML);
// headers.setAccept(Collections.singletonList(MediaType.TEXT_XML));
headers.setContentType(MediaType.parseMediaType("text/xml; charset=UTF-8")); // 核心修复
headers.setAccept(Collections.singletonList(MediaType.ALL));
headers.set("SOAPAction", "");
headers.set("User-Agent", "PostmanRuntime/7.26.10");
headers.set("Cache-Control", "no-cache");
headers.set("Accept-Encoding", "gzip, deflate");
headers.set("Connection", "keep-alive");
// 创建请求实体
HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
log.info("发送请求到: {}", endpointUrl);
// 发送请求
ResponseEntity<byte[]> response = restTemplate.exchange(
endpointUrl,
HttpMethod.POST,
entity,
byte[].class
);
log.info("响应状态: {}", response.getStatusCode());
// 处理响应
byte[] rawResponse = response.getBody();
if (rawResponse == null) {
return "";
}
// 检查是否gzip压缩
String contentEncoding = response.getHeaders().getFirst("Content-Encoding");
String responseBody;
if ("gzip".equalsIgnoreCase(contentEncoding)) {
responseBody = decompressGzip(rawResponse);
log.info("已解压gzip响应,长度: {} 字符", responseBody.length());
} else {
responseBody = new String(rawResponse, StandardCharsets.UTF_8);
log.info("响应长度: {} 字符", responseBody.length());
}
return responseBody;
} catch (Exception e) {
log.error("WebService调用失败", e);
throw new RuntimeException("WebService调用失败: " + e.getMessage(), e);
}
}
/**
* 解压缩GZIP内容
*/
private static String decompressGzip(byte[] compressedData) throws IOException {
try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressedData));
InputStreamReader reader = new InputStreamReader(gis, StandardCharsets.UTF_8)) {
StringBuilder sb = new StringBuilder();
char[] buffer = new char[1024];
int len;
while ((len = reader.read(buffer)) != -1) {
sb.append(buffer, 0, len);
}
return sb.toString();
}
}
}
@@ -0,0 +1,20 @@
package com.mhd.basic.domain.contractManage.repository.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class XxlJobBusinessConfig {
@Value("${xxl.job.admin.address}")
private String adminAddress;
@Value("${xxl.job.admin.cookie}")
private String adminCookie;
@Bean
public XxlJobOpenApiUtil xxlJobOpenApiUtil() {
return new XxlJobOpenApiUtil(adminAddress, adminCookie);
}
}
@@ -0,0 +1,218 @@
package com.mhd.basic.domain.contractManage.repository.util;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
/**
* 调用XXLJOB后台页面接口
* 列表接口返回JSON不再返回HTML
*/
@Slf4j
public class XxlJobOpenApiUtil {
private final String adminUrl;
private final String cookie;
public XxlJobOpenApiUtil(String adminUrl, String cookie) {
this.adminUrl = StrUtil.removeSuffix(adminUrl, "/");
this.cookie = cookie;
}
/**
* 新增定时任务 POST /jobinfo/add
* @param addReq 请求实体与浏览器payload字段完全对齐
* @return true=新增成功false=失败
*/
public boolean addJob(JobInfoAddReq addReq) {
String url = adminUrl + "/jobinfo/add";
try {
Map<String, Object> formMap = BeanUtil.beanToMap(addReq);
HttpResponse response = HttpRequest.post(url)
.header("Cookie", cookie)
.form(formMap)
.execute();
int status = response.getStatus();
log.info("[XxlJob] addJob status:{}", status);
// 新增成功200重定向到列表页
return status == 200;
} catch (Exception e) {
log.error("[XxlJob] addJob异常", e);
return false;
}
}
/**
* 根据任务描述+执行器参数查询jobId
* 适配返回JSON格式的pageList接口
* @param jobDesc 任务描述
* @param executorParam 任务参数(业务shipperId)
* @return jobId查不到返回null
*/
public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam,String jobGroup) {
StringBuilder querySb = new StringBuilder();
// start length必须
querySb.append("start=0&length=10");
// jobGroup为空就不拼接这个参数不要 jobGroup=""
// 你们业务固定jobGroup=3直接写死3不用传空
if(StrUtil.isNotBlank(jobGroup)){
querySb.append("&jobGroup=").append(jobGroup);
}
// jobDesc
if(StrUtil.isNotBlank(jobDesc)){
querySb.append("&jobDesc=").append(cn.hutool.core.net.URLEncodeUtil.encode(jobDesc));
}
// executorParam
if(StrUtil.isNotBlank(executorParam)){
querySb.append("&executorParam=").append(cn.hutool.core.net.URLEncodeUtil.encode(executorParam));
}
// executorHandler为空直接不携带
// triggerStatus=-1
querySb.append("&triggerStatus=-1");
String url = adminUrl + "/jobinfo/pageList?" + querySb;
log.info("[XxlJob] pageList请求url:{}",url);
try {
HttpResponse response = HttpRequest.get(url)
.header("Authorization", cookie)
.execute();
String jsonStr = response.body();
log.info("[XxlJob] pageList响应:{}",jsonStr);
if (StrUtil.isBlank(jsonStr)) {
log.warn("[XxlJob] pageList返回空响应");
return null;
}
JSONObject jsonObj = JSON.parseObject(jsonStr);
JSONArray jsonArray = jsonObj.getJSONArray("data");
if(jsonArray == null){
return null;
}
List<JobPageItem> dataList = jsonArray.toList(JobPageItem.class);
if (dataList == null || dataList.isEmpty()) {
return null;
}
for (JobPageItem item : dataList) {
if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) {
return item.id;
}
}
return null;
} catch (Exception e) {
log.error("[XxlJob] queryJobId异常", e);
return null;
}
}
/**
* 暂停任务 POST /jobinfo/pause
* @param jobId xxl任务id
* @return true成功
*/
public boolean pauseJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/pause";
try {
HttpResponse response = HttpRequest.post(url)
.header("Cookie", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* 开启任务 POST /jobinfo/start
* @param jobId xxl任务id
* @return true成功
*/
public boolean startJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/start";
try {
HttpResponse response = HttpRequest.post(url)
.header("Cookie", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] startJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* 删除任务 POST /jobinfo/remove
* @param jobId xxl任务id
* @return true成功
*/
public boolean removeJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/remove";
try {
HttpResponse response = HttpRequest.post(url)
.header("Cookie", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] removeJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* pageList 返回data数组中每一项实体
*/
@Data
public static class JobPageItem {
private Integer id;
private String jobDesc;
private String executorParam;
}
/**
* add接口请求实体与浏览器F12抓包payload字段一一对应
*/
@Data
public static class JobInfoAddReq {
private Integer jobGroup;
private String jobDesc;
private String author;
private String alarmEmail;
private String scheduleType;
private String scheduleConf;
private String glueType;
private String executorHandler;
private String executorParam;
private String glueRemark;
private String glueSource;
private String executorRouteStrategy;
private Integer childJobId;
private String misfireStrategy;
private String executorBlockStrategy;
private Integer executorTimeout;
private Integer executorFailRetryCount;
}
}
@@ -23,10 +23,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -193,6 +190,22 @@ public class ContractManageDomainService {
}
/**
* 同结算客户+同温层+同租赁类型+使用中 的合同数量用于唯一性校验
*/
public long countByUniqueKey(Long settlementCustomersId, String warehouseTempLayerType, String contractRentType, Long excludeId) {
LambdaQueryWrapper<ContractManage> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ContractManage::getSettlementCustomersId, settlementCustomersId);
wrapper.eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType);
wrapper.eq(ContractManage::getContractRentType, contractRentType);
wrapper.eq(ContractManage::getContractState, 2);
wrapper.eq(ContractManage::getDelFlag, 1);
if (excludeId != null) {
wrapper.ne(ContractManage::getContractManageId, excludeId);
}
return contractManageService.count(wrapper);
}
public ContractManagePO getGeneralContract() {
ContractManagePO contractManagePO = new ContractManagePO();
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
@@ -228,4 +241,6 @@ public class ContractManageDomainService {
}
return contractManagePO;
}
}
@@ -0,0 +1,52 @@
package com.mhd.basic.domain.contractManageParameters.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
import lombok.Data;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParameters extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,47 @@
package com.mhd.basic.domain.contractManageParameters.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import java.util.List;
/**
* 合约信息规则维护表Service接口
*
* @author gen
* @date 2024-06-07
*/
public interface IContractManageParametersService extends IService<ContractManageParameters>
{
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO);
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO);
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO);
/**
* 批量删除合约信息规则维护表
*/
public Boolean delete(Long[] ids);
/**
* 查询合约信息规则维护表
*/
public ContractManageParametersPO getInfo(Long id);
/**
* 根据合同管理id查询合约信息规则维护列表
*/
List<ContractManageParametersPO> getListByContractManageId(Long contractManageId);
}
@@ -0,0 +1,26 @@
package com.mhd.basic.domain.contractManageParameters.repository.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import org.apache.ibatis.annotations.Param;
/**
* 合约信息规则维护表Mapper接口
*
* @author gen
* @date 2024-06-07
*/
public interface ContractManageParametersMapper extends BaseMapper<ContractManageParameters>
{
/**
* 查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(@Param("contractManageParametersDO") ContractManageParametersDO contractManageParametersDO);
/**
* 根据合同管理id查询合约信息规则维护列表
*/
List<ContractManageParametersPO> getListByContractManageId(@Param("contractManageId") Long contractManageId);
}
@@ -0,0 +1,86 @@
package com.mhd.basic.domain.contractManageParameters.repository.persistence;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService;
import com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 合约信息规则维护表Service业务层处理
*
* @author gen
* @date 2024-06-07
*/
@Service
public class ContractManageParametersImpl extends ServiceImpl<ContractManageParametersMapper, ContractManageParameters> implements IContractManageParametersService{
@Autowired
private ContractManageParametersMapper contractManageParametersMapper;
/**
* 查询合约信息规则维护表列表
*/
@Override
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO)
{
return contractManageParametersMapper.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
@Override
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters);
return this.save(contractManageParameters);
}
/**
* 修改合约信息规则维护表
*/
@Override
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters);
return this.updateById(contractManageParameters);
}
/**
* 批量删除合约信息规则维护表
*/
@Override
public Boolean delete(Long[] ids ) {
List<ContractManageParameters> list = new ArrayList<>();
for (Long id : ids) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
contractManageParameters.setId(id);
contractManageParameters.setDelFlag(2);
list.add(contractManageParameters);
}
return this.updateBatchById(list);
}
/**
* 查询合约信息规则维护表
*/
@Override
public ContractManageParametersPO getInfo(Long id) {
ContractManageParameters contractManageParameters = this.getById(id);
ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO();
BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO);
return contractManageParametersPO;
}
@Override
public List<ContractManageParametersPO> getListByContractManageId(Long contractManageId) {
return contractManageParametersMapper.getListByContractManageId(contractManageId);
}
}
@@ -0,0 +1,51 @@
package com.mhd.basic.domain.contractManageParameters.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
@ApiModel(value = "合约信息规则维护表对象", description = "合约信息规则维护表响应对象")
public class ContractManageParametersPO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,49 @@
package com.mhd.basic.domain.contractManageParameters.repository.todo;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersDO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,105 @@
package com.mhd.basic.domain.contractManageParameters.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Service
@Slf4j
public class ContractManageParametersDomainService {
@Autowired
private IContractManageParametersService contractManageParametersService;
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.insert(contractManageParametersDO);
}
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.update(contractManageParametersDO);
}
/**
* 批量删除合约信息规则维护表
*/
public Boolean delete(Long[] ids) {
return contractManageParametersService.delete(ids);
}
/**
* 获取合约信息规则维护表详细信息
*/
public ContractManageParametersPO getInfo(Long id)
{
return contractManageParametersService.getInfo(id);
}
/**
* 根据合同管理id查询合约信息规则维护列表
* @param contractManageId
* @return
*/
public List<ContractManageParametersPO> queryListByManageId(Long contractManageId) {
List<ContractManageParametersPO> resultList = new ArrayList<>();
LambdaQueryWrapper<ContractManageParameters> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ContractManageParameters::getContractManageId,contractManageId);
queryWrapper.eq(ContractManageParameters::getDelFlag,1);
List<ContractManageParameters> contractManageParametersList = contractManageParametersService.list(queryWrapper);
if(contractManageParametersList.size()>0){
for (ContractManageParameters contractManageParameters : contractManageParametersList) {
ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO();
BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO);
resultList.add(contractManageParametersPO);
}
}
return resultList;
}
public List<ContractManageParametersPO> queryListByManageIds(Collection<Long> contractManageIds) {
List<ContractManageParametersPO> resultList = new ArrayList<>();
if (contractManageIds == null || contractManageIds.isEmpty()) {
return resultList;
}
LambdaQueryWrapper<ContractManageParameters> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ContractManageParameters::getContractManageId, contractManageIds);
queryWrapper.eq(ContractManageParameters::getDelFlag, 1);
List<ContractManageParameters> entityList = contractManageParametersService.list(queryWrapper);
for (ContractManageParameters entity : entityList) {
ContractManageParametersPO po = new ContractManageParametersPO();
BeanUtils.copyProperties(entity, po);
resultList.add(po);
}
return resultList;
}
}
@@ -413,4 +413,20 @@ public class MaterialBaseInfo extends BaseVOEntity{
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -399,4 +399,20 @@ public class MaterialBaseInfoPO extends BaseVOEntity{
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -405,4 +405,20 @@ public class MaterialBaseInfoDO extends BaseVOEntity{
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -82,4 +82,20 @@ public class MaterialClassify extends BaseVOEntity{
@Excel(name = "单位")
private String unit;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -89,4 +89,20 @@ public class MaterialClassifyPO extends BaseVOEntity{
@Excel(name = "单位")
private String unit;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -89,4 +89,20 @@ public class MaterialClassifyDO extends BaseVOEntity{
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -0,0 +1,65 @@
package com.mhd.basic.interfaces.assember.contractManageParameters;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 合约信息规则维护表Assembler
*
* @author gen
* @date 2024-06-07
*/
@Component
public class ContractManageParametersAssembler {
/**
* 转换实体
*/
public ContractManageParametersDO toDO(ContractManageParametersDTO contractManageParametersDTO) {
ContractManageParametersDO contractManageParametersDO = new ContractManageParametersDO();
// 拷贝
BeanUtils.copyProperties(contractManageParametersDTO, contractManageParametersDO, IgnoreNullUtil.getNullPropertyNames(contractManageParametersDTO));
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
String userName = loginUser.getUsername();
// 获取登录人id
Long userId = loginUser.getUserid();
if(contractManageParametersDTO.getId() != null){
if(userId != null){
contractManageParametersDO.setUpdateBy(userId);
}else {
contractManageParametersDO.setUpdateBy(new Long("0"));
}
contractManageParametersDO.setUpdateByName(userName);
contractManageParametersDO.setUpdateTime(new Date());
}else {
if(userId != null){
contractManageParametersDO.setCreateBy(userId);
contractManageParametersDO.setUpdateBy(userId);
}else {
contractManageParametersDO.setCreateBy(new Long("0"));
contractManageParametersDO.setUpdateBy(new Long("0"));
}
contractManageParametersDO.setCreateByName(userName);
contractManageParametersDO.setUpdateByName(userName);
contractManageParametersDO.setCreateTime(new Date());
contractManageParametersDO.setUpdateTime(new Date());
contractManageParametersDO.setDelFlag(1);
}
return contractManageParametersDO;
}
}
@@ -216,4 +216,33 @@ public class ContractManageDTO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("合同租赁类型code")
private String contractRentType;
@ApiModelProperty("合同租赁类型名称")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型code")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型编码名称")
private String warehouseTempLayerTypeName;
@ApiModelProperty("合约信息规则维护JSON")
private String parametersJson;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -0,0 +1,48 @@
package com.mhd.basic.interfaces.dto.contractManageParameters;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersDTO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -385,4 +385,19 @@ public class MaterialBaseInfoDTO extends BaseVOEntity{
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -89,4 +89,20 @@ public class MaterialClassifyDTO extends BaseVOEntity{
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -1,5 +1,7 @@
package com.mhd.basic.interfaces.facade.contractManage;
import com.alibaba.fastjson.JSONObject;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
@@ -8,6 +10,10 @@ 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 com.mhd.common.core.utils.sms.Result;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -119,6 +125,25 @@ public class ContractManageApi extends BaseController{
}
}
/**
* 保存合同管理
*/
@ApiOperation("保存临时合同管理")
@PostMapping("/feignSave")
public AjaxResult feignSave(@RequestBody ContractManageFeignDTO contractManageFeignDTO)
{
try {
//转换实体
ContractManageDTO contractManageDTO = new ContractManageDTO();
BeanUtils.copyProperties(contractManageFeignDTO, contractManageDTO);
ContractManageDO contractManageDO = contractManageAssembler.toDO(contractManageDTO);
ContractManageDO insert = contractManageApplicationService.insertFeign(contractManageDO);
return AjaxResult.success(insert);
}catch (Exception e){
return AjaxResult.error(e.getMessage());
}
}
/**
* 批量删除合同管理
*/
@@ -230,4 +255,45 @@ public class ContractManageApi extends BaseController{
util.exportExcel(response, list, "合同导出");
}
/**
* 1. 简单任务示例Bean模式
* 这里的 demoJobHandler 必须和调度中心配置一致
*/
@XxlJob("pushContractManageToBms")
public void pushContractManageToBms() {
// 获取任务参数(货主id)
String shipperId = XxlJobHelper.getJobParam();
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId);
try {
contractManageApplicationService.pushContractManageToBms(shipperId);
// 设置任务执行结果
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
} catch (Exception e) {
logger.error("XXL-JOB 执行失败", e);
XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage());
}
}
/**
* 根据公司名称获取合同列表(完整合同内容,支持分页)
* @param companyName 公司名称
* @param pageNum 页码
* @param pageSize 每页数量
* @return 合同列表
*/
@GetMapping("/contractNos")
public TableDataInfo getContractNosByCompanyName(
@RequestParam String companyName,
@RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize) {
List<JSONObject> list = contractManageApplicationService.getContractNosByCompanyName(companyName, pageNum, pageSize);
TableDataInfo tableDataInfo = new TableDataInfo(list, list.size());
tableDataInfo.setCode(200);
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
}
@@ -0,0 +1,105 @@
package com.mhd.basic.interfaces.facade.contractManageParameters;
import java.util.List;
import com.mhd.basic.interfaces.assember.contractManageParameters.ContractManageParametersAssembler;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.application.service.contractManageParameters.ContractManageParametersApplicationService;
import javax.annotation.Resource;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
/**
* 合约信息规则维护表Api
*
* @author gen
* @date 2024-06-07
*/
@RestController
@RequestMapping("/contractManageParametersApi")
public class ContractManageParametersApi extends BaseController{
@Autowired
private ContractManageParametersApplicationService contractManageParametersApplicationService;
@Resource
private ContractManageParametersAssembler contractManageParametersAssembler;
/**
* 分页查询合约信息规则维护表列表
*/
@ApiOperation("查询合约信息规则维护表列表")
@GetMapping("/list")
public TableDataInfo list(ContractManageParametersDTO contractManageParametersDTO)
{
//转换实体
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
startPage();
List<ContractManageParametersPO> list = contractManageParametersApplicationService.queryList(contractManageParametersDO);
return getDataTable(list);
}
/**
* 编辑合约信息规则维护表
*/
@ApiOperation("编辑合约信息规则维护表")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody ContractManageParametersDTO contractManageParametersDTO)
{
//转换实体
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
if(contractManageParametersDTO.getId() != null){
return toAjax(contractManageParametersApplicationService.update(contractManageParametersDO));
}else {
return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO));
}
}
/**
* 批量删除合约信息规则维护表
*/
@ApiOperation("批量删除合约信息规则维护表")
@DeleteMapping("/deleteByIds/{ids}")
public AjaxResult delete(@PathVariable Long[] ids)
{
return toAjax(contractManageParametersApplicationService.delete(ids));
}
/**
* 获取合约信息规则维护表详细信息
*/
@ApiOperation("获取合约信息规则维护表")
@GetMapping(value = "/getInfo/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(contractManageParametersApplicationService.getInfo(id));
}
@ApiOperation("Feign保存合约信息规则维护")
@PostMapping("/feignSave")
public AjaxResult feignSave(@RequestBody ContractManageParametersFeign contractManageParametersFeign)
{
try {
ContractManageParametersDTO contractManageParametersDTO = new ContractManageParametersDTO();
BeanUtils.copyProperties(contractManageParametersFeign, contractManageParametersDTO);
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO));
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
}
@@ -0,0 +1,54 @@
package com.mhd.basic.util;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* XXL-JOB 配置类
*/
@Configuration
public class XxlJobConfig {
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.appname}")
private String appname;
@Value("${xxl.job.executor.address}")
private String address;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setAddress(address);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
}
@@ -14,16 +14,16 @@ spring:
nacos:
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.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 10.102.192.105:6848
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.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -201,9 +201,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contractManageDO.topOrganizationId != null">
and a.top_organization_id = #{contractManageDO.topOrganizationId}
</if>
<if test="contractManageDO.contractRentType != null and contractManageDO.contractRentType != ''">
and a.contract_rent_type = #{contractManageDO.contractRentType}
</if>
<if test="contractManageDO.warehouseTempLayerType != null and contractManageDO.warehouseTempLayerType != ''">
and a.warehouse_temp_layer_type = #{contractManageDO.warehouseTempLayerType}
</if>
<if test="contractManageDO.firstSubjectCode != null and contractManageDO.firstSubjectCode != ''">
and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode}
</if>
<if test="contractManageDO.renewalAdvanceDays != null">
and a.renewal_advance_days = #{contractManageDO.renewalAdvanceDays}
</if>
<if test="contractManageDO.subjectMatter != null and contractManageDO.subjectMatter != ''">
and a.subject_matter like concat('%', #{contractManageDO.subjectMatter}, '%')
</if>
<if test="contractManageDO.nature != null and contractManageDO.nature != ''">
and a.nature = #{contractManageDO.nature}
</if>
<if test="contractManageDO.initialStartDate != null">
and a.initial_start_date = #{contractManageDO.initialStartDate}
</if>
</sql>
</mapper>
@@ -0,0 +1,53 @@
<?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.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper">
<sql id="selectContractManageParametersPo">
select
*
from contract_manage_parameters
</sql>
<sql id="selectContractManageParametersPo1">
<where>
<if test="contractManageId != null ">
and contract_manage_id = #{contractManageId}
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="contractNumber != null and contractNumber != ''">
and contract_number like concat('%', #{contractNumber}, '%')
</if>
<if test="contractName != null and contractName != ''">
and contract_name like concat('%', #{contractName}, '%')
</if>
</where>
</sql>
<select id="queryList" parameterType="com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO"
resultType="com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO">
<include refid="selectContractManageParametersPo"/>
<include refid="selectContractManageParametersPo1"/>
</select>
<select id="getListByContractManageId"
resultType="com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO" parameterType="java.lang.Long">
SELECT
*
FROM
contract_manage_parameters
WHERE
contract_manage_id = #{contractManageId}
</select>
</mapper>
@@ -27,13 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="chargeStandard" column="charge_standard" />
<result property="unit" column="unit" />
<result property="monthlyWarehouseRent" column="monthly_warehouse_rent" />
<result property="halfMonthWarehouseRent" column="half_month_warehouse_rent" />
<result property="monthlyWarehouseRentUnit" column="monthly_warehouse_rent_unit" />
<result property="halfMonthWarehouseRentUnit" column="half_month_warehouse_rent_unit" />
</resultMap>
<sql id="selectMaterialClassifyPo">
select material_classify_id, organization_id, organization_name, top_organization_id, code, name, level, parent_code,
parent_name, code_path, name_path, remark, nullify, create_time, create_by, create_by_name, update_time, update_by,
update_by_name, del_flag,CHARGE_STANDARD,unit
update_by_name, del_flag,CHARGE_STANDARD,unit,
monthly_warehouse_rent, half_month_warehouse_rent, monthly_warehouse_rent_unit, half_month_warehouse_rent_unit
from material_classify
</sql>
@@ -3,6 +3,7 @@ package com.mhd.user.interfaces.facade;
import com.github.pagehelper.PageHelper;
import com.mhd.common.core.domain.entity.R;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.security.utils.SecurityUtils;
@@ -24,6 +25,7 @@ import com.mhd.user.application.service.WechatMiniAppService;
import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO;
import com.mhd.user.interfaces.vo.SettlementInfoQueryVo;
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo;
import com.mhd.user.interfaces.vo.UserShipperExportVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -31,6 +33,9 @@ import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
@Api(tags = "用户中台管理-托运人管理")
@@ -128,6 +133,33 @@ public class UserShipperAPI extends BaseController {
return getDataTable(list);
}
@Log(title = "托运人管理-导出", description ="导出托运人列表",businessType = BusinessType.EXPORT)
@ApiOperation("导出托运人列表")
@GetMapping(value = "/exportUserShipper", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
public void exportUserShipper(UserShipperDTO userShipperDTO, HttpServletResponse response) throws IOException {
//转换实体
UserShipperDO userShipperDO = userShipperAssember.toUserShipperDO(userShipperDTO);
//查询全量不分页复用列表查询逻辑含数据权限过滤
List<UserShipperPo> list = userShipperApplicationService.userShipperList(userShipperDO);
List<UserShipperExportVO> exportList = new ArrayList<>();
if (list != null) {
for (UserShipperPo po : list) {
UserShipperExportVO vo = new UserShipperExportVO();
BeanUtils.copyProperties(po, vo);
exportList.add(vo);
}
}
//设置下载头防止浏览器乱码
String fileName = URLEncoder.encode("托运人列表", "UTF-8").replaceAll("\\+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelUtil<UserShipperExportVO> util = new ExcelUtil<>(UserShipperExportVO.class);
util.exportExcel(response, exportList, "托运人列表");
}
@ApiOperation("查询托运人列表统计表单")
@GetMapping("/userShipperCount")
@@ -0,0 +1,73 @@
package com.mhd.user.interfaces.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 托运人委托方列表导出对象
*
* @author gen
*/
@Data
@ApiModel(value = "托运人列表导出对象", description = "托运人列表导出对象")
public class UserShipperExportVO {
@Excel(name = "登录账号", sort = 1, width = 20)
@ApiModelProperty(value = "登录账号")
private String userAccount;
@Excel(name = "公司名称", sort = 2, width = 30)
@ApiModelProperty(value = "公司名称")
private String shipperEnterpriseName;
@Excel(name = "联系人", sort = 3, width = 15)
@ApiModelProperty(value = "联系人")
private String emergencyContactName;
@Excel(name = "联系电话", sort = 4, width = 18)
@ApiModelProperty(value = "联系电话")
private String emergencyContactPhone;
@Excel(name = "地址", sort = 5, width = 30)
@ApiModelProperty(value = "企业注册地址")
private String shipperEnterpriseAddress;
@Excel(name = "详细地址", sort = 6, width = 30)
@ApiModelProperty(value = "详细地址")
private String userAreaAddressShipper;
@Excel(name = "备注", sort = 7, width = 25)
@ApiModelProperty(value = "备注")
private String remark;
@Excel(name = "结算币种", sort = 8, width = 12)
@ApiModelProperty(value = "结算币种")
private String settlementCurrency;
@Excel(name = "信用额度", sort = 9, width = 15)
@ApiModelProperty(value = "信用额度(授权额度)")
private BigDecimal authorizedQuota;
@Excel(name = "信用占用", sort = 10, width = 15)
@ApiModelProperty(value = "信用占用")
private BigDecimal authorizedUsedAmount;
@Excel(name = "信用余额", sort = 11, width = 15)
@ApiModelProperty(value = "信用余额")
private BigDecimal creditAmount;
@Excel(name = "客户协议", sort = 12, width = 12)
@ApiModelProperty(value = "客户协议数量")
private BigDecimal agreementCount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "最近同步信用时间", sort = 13, width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "最近同步信用时间")
private Date limitTime;
}
+11
View File
@@ -94,6 +94,17 @@
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<!--添加druid连接池 依赖 -->
<dependency>
<groupId>com.alibaba</groupId>
@@ -3,17 +3,27 @@ package com.mhd.bms.application.server.billingStatement;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.bms.application.server.billManage.BillManageApplicationService;
import com.mhd.bms.domain.billManage.repository.po.BillManagePO;
import com.mhd.bms.domain.billManage.service.BillManageDomainService;
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
import com.mhd.bms.domain.billingStatement.repository.facade.IBillingStatementService;
import com.mhd.bms.domain.billingStatement.repository.mapper.BillingStatementMapper;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementADDVO;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementCollectPO;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementCollectDO;
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
import com.mhd.bms.domain.businessDocument.entity.BusinessDocument;
import com.mhd.bms.domain.businessDocument.repository.facade.IBusinessDocumentService;
import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustomersMapper;
import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper;
import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
import com.mhd.bms.interfaces.assembler.billingStatement.BillingStatementAssembler;
@@ -39,6 +49,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -64,6 +75,16 @@ public class BillingStatementApplicationService {
private BillManageApplicationService billManageApplicationService;
@Autowired
private BillManageDomainService billManageDomainService;
@Autowired
private IBusinessDocumentService businessDocumentService;
@Autowired
private IBillingStatementService billingStatementService;
@Autowired
private BillingStatementMapper billingStatementMapper;
@Autowired
private SettlementCustomersMapper settlementCustomersMapper;
@Autowired
private SettlementCustomersParametersMapper settlementCustomersParametersMapper;
/**
@@ -631,4 +652,460 @@ public class BillingStatementApplicationService {
}
return billingStatementDomainService.getBillDetailsList(billingStatementDO);
}
public void pushBillManage(String shipperId) {
SettlementCustomers settlementCustomers = settlementCustomersMapper.selectOne(new LambdaQueryWrapper<SettlementCustomers>()
.eq(SettlementCustomers::getSettlementEntityId, shipperId)
.eq(SettlementCustomers::getDelFlag, 1));
if (ObjectUtil.isNull(settlementCustomers)) {
//未找到结算对象
return;
}
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
SettlementCustomersParameters settlementCustomersParameters = settlementCustomersParametersMapper.selectOne(new LambdaQueryWrapper<SettlementCustomersParameters>()
.eq(SettlementCustomersParameters::getSettlementEntityId, settlementCustomersId)
.eq(SettlementCustomersParameters::getParametersName, "干仓计费配置"));
if (ObjectUtil.isNull(settlementCustomersParameters)) {
//结算对象未配置参数
return;
}
String content = settlementCustomersParameters.getContent();
Map<String, Object> contentMap = JSON.parseObject(content, Map.class);
//主费用开票策略
String zfycl = (String) contentMap.get("zfycl");
//附加费用开票策略
String fjfykpcl = (String) contentMap.get("fjfykpcl");
//合并开票
Integer hbcp = (Integer) contentMap.get("hbcp");
Boolean isMerge = false;
if (hbcp == 1) {
//判断是否合并开票
isMerge = true;
}
if (!isMerge) {
//按入仓单和收费事项分开计费
if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
calcReceiptAndItemSeparately(settlementCustomersId);
}
//按合同和收费事项分开计费
else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
calcContractAndItemSeparately(settlementCustomersId);
}
} else {
//按入仓单和收费事项合并计费
if ("warehouse_receipt".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
mergeCalcByReceiptAndItem(settlementCustomersId);
}
//按合同和收费事项合并计费
else if ("project_monthly".equals(zfycl) && "fee_item".equals(fjfykpcl)) {
mergeCalcByContractAndItem(settlementCustomersId);
}
}
}
/*
* 按入仓单和收费事项分开计费
* */
public void calcReceiptAndItemSeparately(Long settlementCustomersId) {
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
.eq(BusinessDocument::getBelongModuleCode, "干仓")
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
.eq(BusinessDocument::getBusinessState, 3)
.eq(BusinessDocument::getDelFlag, 1));
Map<String, List<BusinessDocument>> groupedMap = list.stream()
.collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode));
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
List<BusinessDocument> groupList = entry.getValue();
String firstSubject = entry.getKey();
if ("0D01".equals(firstSubject)) {
//主费用
for (BusinessDocument businessDocument : groupList) {
String businessFlow = businessDocument.getBusinessFlow();
List<BillingStatement> billingStatements = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.eq(BillingStatement::getBusinessFlow, businessFlow)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatements != null && billingStatements.size() > 0) {
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingStatements) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
} else {
//附加费用
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.in(BillingStatement::getBusinessFlow, businessFlowList)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatementList != null && billingStatementList.size() > 0) {
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingStatementList) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
}
}
/*
* 按入仓单和收费事项合并计费
* */
public void mergeCalcByReceiptAndItem(Long settlementCustomersId) {
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
.eq(BusinessDocument::getBelongModuleCode, "干仓")
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
.eq(BusinessDocument::getBusinessState, 3)
.eq(BusinessDocument::getDelFlag, 1));
Map<String, List<BusinessDocument>> groupedMap = list.stream()
.collect(Collectors.groupingBy(BusinessDocument::getOriginalBusinessNum));
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
List<BusinessDocument> groupList = entry.getValue();
String originalBusinessNum = entry.getKey();
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.in(BillingStatement::getBusinessFlow, businessFlowList)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatementList != null && billingStatementList.size() > 0) {
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingStatementList) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
}
/*
* 按合同和收费事项分开计费
* */
public void calcContractAndItemSeparately(Long settlementCustomersId) {
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
.eq(BusinessDocument::getBelongModuleCode, "干仓")
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
.eq(BusinessDocument::getBusinessState, 3)
.eq(BusinessDocument::getDelFlag, 1));
Map<String, List<BusinessDocument>> groupedMap = list.stream()
.collect(Collectors.groupingBy(BusinessDocument::getFirstSubjectCode));
for (Map.Entry<String, List<BusinessDocument>> entry : groupedMap.entrySet()) {
List<BusinessDocument> groupList = entry.getValue();
String firstSubject = entry.getKey();
if ("0D01".equals(firstSubject)) {
//主费用
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.in(BillingStatement::getBusinessFlow, businessFlowList)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatementList != null && billingStatementList.size() > 0) {
Map<Long, List<BillingStatement>> contractManageIdMap = billingStatementList.stream()
.collect(Collectors.groupingBy(BillingStatement::getContractManageId));
for (Map.Entry<Long, List<BillingStatement>> contractManageIdEntry : contractManageIdMap.entrySet()) {
Long contractManageId = contractManageIdEntry.getKey();
List<BillingStatement> billingContractStatementList = contractManageIdEntry.getValue();
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingContractStatementList) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
} else {
//附加费用
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.in(BillingStatement::getBusinessFlow, businessFlowList)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatementList != null && billingStatementList.size() > 0) {
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingStatementList) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
}
}
/*
* 按合同和收费事项合并计费
* */
public void mergeCalcByContractAndItem(Long settlementCustomersId) {
List<BusinessDocument> list = businessDocumentService.list(new LambdaQueryWrapper<BusinessDocument>()
.eq(BusinessDocument::getBelongModuleCode, "干仓")
.eq(BusinessDocument::getSettlementCustomersId, settlementCustomersId)
.eq(BusinessDocument::getBusinessState, 3)
.eq(BusinessDocument::getDelFlag, 1));
Map<Long, List<BusinessDocument>> groupedMap = list.stream()
.collect(Collectors.groupingBy(BusinessDocument::getContractManageId));
for (Map.Entry<Long, List<BusinessDocument>> entry : groupedMap.entrySet()) {
List<BusinessDocument> groupList = entry.getValue();
Long contractManageId = entry.getKey();
List<String> businessFlowList = groupList.stream().map(BusinessDocument::getBusinessFlow).collect(Collectors.toList());
List<BillingStatement> billingStatementList = billingStatementService.list(new LambdaQueryWrapper<BillingStatement>()
.in(BillingStatement::getBusinessFlow, businessFlowList)
.eq(BillingStatement::getBillingState, 1)
.eq(BillingStatement::getDelFlag, 1));
if (billingStatementList != null && billingStatementList.size() > 0) {
List<BillingStatementADDVO> billingStatementADDVOS = new ArrayList<>();
List<String> billingStatementIdList = new ArrayList<>();
BigDecimal allAmount = BigDecimal.ZERO;
BigDecimal allFreeFee = BigDecimal.ZERO;
String settlementCurrency = "CNY";
for (BillingStatement billingStatement : billingStatementList) {
settlementCurrency = billingStatement.getSettlementCurrency();
String firstSubjectCode = billingStatement.getFirstSubjectCode();
String firstSubjectName = billingStatement.getFirstSubjectName();
Long organizationId = billingStatement.getOrganizationId();
Map<String, Object> taxRateMap = billingStatementMapper.getTaxRate(organizationId, firstSubjectCode, firstSubjectName);
if (taxRateMap == null) continue;
Double taxRate = (Double) taxRateMap.get("taxRate");
Long billingStatementId = billingStatement.getBillingStatementId();
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
billingStatementDTO.setBillingStatementIds(String.valueOf(billingStatementId));
billingStatementDTO.setAuditOperation(1);
reviewBilling(billingStatementDTO);
BillingStatementADDVO billingStatementADDVO = new BillingStatementADDVO();
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);
allAmount.add(amount);
allFreeFee.add(taxFreeFee);
billingStatementADDVO.setBillingStatementId(String.valueOf(billingStatementId));
billingStatementADDVO.setTaxRate(taxRate);
billingStatementADDVO.setTaxAmount(taxAmount);
billingStatementADDVO.setTaxFreeFee(taxFreeFee);
billingStatementADDVO.setFeeType(billingStatement.getServiceItemsName());
billingStatementADDVO.setInvoiceItem(billingStatement.getFirstSubjectCode());
billingStatementADDVO.setInvoiceItemName(billingStatement.getFirstSubjectName());
billingStatementADDVOS.add(billingStatementADDVO);
billingStatementIdList.add(String.valueOf(billingStatementId));
}
String ids = String.join(",", billingStatementIdList);
BillingStatementDTO billingStatementDTO1 = new BillingStatementDTO();
billingStatementDTO1.setBillingStatementIds(ids);
billingStatementDTO1.setBelongModuleCode("wms");
billingStatementDTO1.setTaxAmount(allAmount);
billingStatementDTO1.setBillingAmount(allAmount);
billingStatementDTO1.setTaxFreeFee(allFreeFee);
billingStatementDTO1.setSettlementCurrency(settlementCurrency);
billingStatementDTO1.setBillingStatementList(billingStatementADDVOS);
generateBills(billingStatementDTO1);
}
}
}
}
@@ -1,5 +1,6 @@
package com.mhd.bms.application.server.settlementCustomers;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
@@ -9,12 +10,16 @@ import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustom
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
import com.mhd.bms.domain.settlementCustomers.repository.persistence.SettlementCustomersImpl;
import com.mhd.bms.domain.settlementCustomers.repository.util.XxlJobOpenApiUtil;
import com.mhd.bms.domain.settlementCustomers.service.SettlementCustomersDomainService;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
import com.mhd.bms.interfaces.dto.settlementCustomers.SettlementCustomersDTO;
import com.mhd.common.core.domain.po.SysDictDataVo;
import com.mhd.common.core.domain.po.UserDriverPo;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.domain.po.UserShipperPo;
import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO;
import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO;
import com.mhd.common.core.domain.po.*;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
@@ -25,19 +30,25 @@ import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.domain.BatchDetailFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.WarehouseFeignPO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -60,9 +71,17 @@ public class SettlementCustomersApplicationService {
private SettlementCustomersMapper settlementCustomersMapper;
@Autowired
private SettlementCustomersImpl settlementCustomersImpl;
@Autowired
private ISettlementCustomersParametersService settlementCustomersParametersService;
@Autowired
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
private static final int SYNC_BATCH_SIZE = 500;
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
private static final String token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozNTYzLCJ0b3BPcmdhbml6YXRpb25JZCI6MjgyNywidXNlcl9rZXkiOiI0N2MzY2U4My0wMmFjLTQ0NTQtOTdiYS1lYmQwMDc2MzNiNDMiLCJ1c2VybmFtZSI6ImNhbmdtYSJ9.tnZyywwburfBo3Kizdhfk5eYdXbrrZ9976Z0W7GrS6UqSpKwfI2RwdRwfYx7DbD7Ri1Fdj_eOVxBkjvdFF226Q";
@Resource
private XxlJobOpenApiUtil apiUtil;
/**
* 分页查询结算对象列表
*/
@@ -138,7 +157,38 @@ public class SettlementCustomersApplicationService {
settlementCustomersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
settlementCustomersDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
settlementCustomersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
return settlementCustomersDomainService.insert(settlementCustomersDO);
Boolean insert = settlementCustomersDomainService.insert(settlementCustomersDO);
if (insert) {
List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigs();
if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) {
for (SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO : settlementCustomersNcConfigDTOList) {
SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig();
settlementCustomersNcConfigDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId());
settlementCustomersNcConfigDTO.setOrganizationId(settlementCustomersDO.getOrganizationId());
settlementCustomersNcConfigDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
settlementCustomersNcConfigDTO.setOrganizationName(settlementCustomersDO.getOrganizationName());
BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfig);
settlementCustomersNcConfigService.save(settlementCustomersNcConfig);
}
}
List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParameters();
if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) {
for (SettlementCustomersParametersDTO settlementCustomersParametersDTO : settlementCustomersParametersDTOList) {
SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters();
settlementCustomersParametersDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId());
settlementCustomersParametersDTO.setOrganizationId(settlementCustomersDO.getOrganizationId());
settlementCustomersParametersDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
settlementCustomersParametersDTO.setOrganizationName(settlementCustomersDO.getOrganizationName());
settlementCustomersParametersDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode());
settlementCustomersParametersDTO.setSettlementEntity(settlementCustomersDO.getSettlementEntity());
settlementCustomersParametersDTO.setSettlementEntityId(settlementCustomersDO.getSettlementEntityId());
BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParameters);
settlementCustomersParametersService.save(settlementCustomersParameters);
}
}
}
return insert;
}
/**
@@ -203,6 +253,7 @@ public class SettlementCustomersApplicationService {
/**
* 修改结算对象
*/
@Transactional
public Boolean update(SettlementCustomersDO settlementCustomersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
@@ -216,9 +267,211 @@ public class SettlementCustomersApplicationService {
}
//处理数据字典
handleDict(settlementCustomersDO);
List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigDTOList = settlementCustomersDO.getSettlementCustomersNcConfigs();
if (CollectionUtil.isNotEmpty(settlementCustomersNcConfigDTOList)) {
settlementCustomersNcConfigService.remove(new LambdaQueryWrapper<SettlementCustomersNcConfig>()
.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId()));
for (SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO : settlementCustomersNcConfigDTOList) {
SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig();
settlementCustomersNcConfigDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId());
settlementCustomersNcConfigDTO.setOrganizationId(settlementCustomersDO.getOrganizationId());
settlementCustomersNcConfigDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
settlementCustomersNcConfigDTO.setOrganizationName(settlementCustomersDO.getOrganizationName());
BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfig);
settlementCustomersNcConfigService.save(settlementCustomersNcConfig);
}
}
List<SettlementCustomersParametersDTO> settlementCustomersParametersDTOList = settlementCustomersDO.getSettlementCustomersParameters();
if (CollectionUtil.isNotEmpty(settlementCustomersParametersDTOList)) {
settlementCustomersParametersService.remove(new LambdaQueryWrapper<SettlementCustomersParameters>()
.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersDO.getSettlementCustomersId()));
for (SettlementCustomersParametersDTO settlementCustomersParametersDTO : settlementCustomersParametersDTOList) {
SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters();
settlementCustomersParametersDTO.setSettlementCustomersId(settlementCustomersDO.getSettlementCustomersId());
settlementCustomersParametersDTO.setOrganizationId(settlementCustomersDO.getOrganizationId());
settlementCustomersParametersDTO.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
settlementCustomersParametersDTO.setOrganizationName(settlementCustomersDO.getOrganizationName());
settlementCustomersParametersDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode());
settlementCustomersParametersDTO.setSettlementEntity(settlementCustomersDO.getSettlementEntity());
settlementCustomersParametersDTO.setSettlementEntityId(settlementCustomersDO.getSettlementEntityId());
BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParameters);
Long contractManageId1 = settlementCustomersParameters.getContractManageId();
if (contractManageId1==null) {
ContractManageFeignDTO contractManageDTO = new ContractManageFeignDTO();
contractManageDTO.setSettlementCustomersCode(settlementCustomersDO.getSettlementCustomersCode());
contractManageDTO.setContractRentType("TEMP");
contractManageDTO.setContractRentTypeName("临时合同");
contractManageDTO.setOriginalContractNumber(generateHtCode());
contractManageDTO.setContractName("临时合同");
contractManageDTO.setSigningUnit(settlementCustomersDO.getOrganizationName());
contractManageDTO.setCustomerTypeCode("1");
contractManageDTO.setCommonContractFlag(2);
contractManageDTO.setSigningDate(new Date());
contractManageDTO.setEffectiveDate(new Date());
Calendar calendar = Calendar.getInstance();
calendar.set(9999, Calendar.DECEMBER, 31, 0, 0, 0);
Date date = calendar.getTime();
contractManageDTO.setExpirationDate(date);
contractManageDTO.setContractState(2);
contractManageDTO.setPaymentDate(new Date());
contractManageDTO.setBillDays(10);
contractManageDTO.setContractType(1);
AjaxResult ajaxResult = systemServiceFeign.feignSave(contractManageDTO);
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
ContractManageFeignDTO contractManageFeignDTO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ContractManageFeignDTO.class);
Long contractManageId = contractManageFeignDTO.getContractManageId();
String originalContractNumber = contractManageFeignDTO.getOriginalContractNumber();
settlementCustomersParameters.setContractManageId(contractManageId);
settlementCustomersParameters.setContractNumber(originalContractNumber);
ContractManageParametersFeign contractManageParametersFeign = new ContractManageParametersFeign();
contractManageParametersFeign.setContractManageId(contractManageId);
contractManageParametersFeign.setContractName(contractManageFeignDTO.getContractName());
contractManageParametersFeign.setContractNumber(contractManageFeignDTO.getContractNumber());
contractManageParametersFeign.setParametersJson(settlementCustomersParametersDTO.getContent());
contractManageParametersFeign.setOrganizationId(settlementCustomersDO.getOrganizationId());
contractManageParametersFeign.setOrganizationName(settlementCustomersDO.getOrganizationName());
contractManageParametersFeign.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
AjaxResult paramResult = systemServiceFeign.feignSaveContractParameters(contractManageParametersFeign);
if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) {
throw new ServiceException("保存合同参数失败");
}
Long settlementEntityId = settlementCustomersDO.getSettlementEntityId();
if (settlementEntityId != null) {
stopXxlJob(settlementCustomersDO.getPushBillingRecordJobId());
stopXxlJob(settlementCustomersDO.getPushBillManageJobId());
//生成唯一业务流水号拼接至JobDesc保证本次新建任务的JobDesc唯一据此查询jobId不会命中历史任务
String xxlJobBizNo = generateXxlJobBizNo();
Integer jobId = addXxlJob(String.valueOf(settlementEntityId), xxlJobBizNo);
Integer jobId1 = addXxlJob1(String.valueOf(settlementEntityId), xxlJobBizNo);
settlementCustomersDO.setPushBillingRecordJobId(jobId);
settlementCustomersDO.setPushBillManageJobId(jobId1);
}
} else {
throw new ServiceException("创建临时合同失败");
}
}
settlementCustomersParametersService.save(settlementCustomersParameters);
}
}
return settlementCustomersDomainService.update(settlementCustomersDO);
}
/**
* 创建夜间23点定时任务
* @param shipperId 结算对象id作为任务参数
* @param bizNo 业务流水号拼接进JobDesc保证每个任务描述唯一据此精确查询本次新建的xxlJobId
* @return xxlJobId 保存到业务表后续用于删除/暂停
*/
public Integer addXxlJob(String shipperId, String bizNo) {
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
req.setJobGroup(3);
req.setJobDesc("散租推送计费单据/流水任务,结算对象id:" + shipperId + ",业务流水号:" + bizNo);
req.setAuthor("system");
req.setAlarmEmail("");
req.setScheduleType("CRON");
// 每天晚上23点执行
req.setScheduleConf("0 0 1 * * ?");
req.setGlueType("BEAN");
req.setExecutorHandler("pushBillingRecord");
req.setExecutorParam(shipperId);
req.setGlueRemark("");
req.setGlueSource("");
req.setExecutorRouteStrategy("FIRST");
req.setChildJobId(null);
req.setMisfireStrategy("DO_NOTHING");
req.setExecutorBlockStrategy("SERIAL_EXECUTION");
req.setExecutorTimeout(0);
req.setExecutorFailRetryCount(0);
boolean addOk = apiUtil.addJob(req);
if (!addOk) {
throw new RuntimeException("创建夜间定时任务失败");
}
Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"3");
if (xxlJobId == null) {
throw new RuntimeException("定时任务创建成功,但查询jobId失败");
}
return xxlJobId;
}
/**
* 创建夜间23点定时任务
* @param shipperId 结算对象id作为任务参数
* @param bizNo 业务流水号拼接进JobDesc保证每个任务描述唯一据此精确查询本次新建的xxlJobId
* @return xxlJobId 保存到业务表后续用于删除/暂停
*/
public Integer addXxlJob1(String shipperId, String bizNo) {
XxlJobOpenApiUtil.JobInfoAddReq req = new XxlJobOpenApiUtil.JobInfoAddReq();
req.setJobGroup(6);
req.setJobDesc("计费单据/流水生成发票任务,结算对象id:" + shipperId + ",业务流水号:" + bizNo);
req.setAuthor("system");
req.setAlarmEmail("");
req.setScheduleType("CRON");
// 每天晚上23点执行
req.setScheduleConf("0 0 1 * * ?");
req.setGlueType("BEAN");
req.setExecutorHandler("pushBillManage");
req.setExecutorParam(shipperId);
req.setGlueRemark("");
req.setGlueSource("");
req.setExecutorRouteStrategy("FIRST");
req.setChildJobId(null);
req.setMisfireStrategy("DO_NOTHING");
req.setExecutorBlockStrategy("SERIAL_EXECUTION");
req.setExecutorTimeout(0);
req.setExecutorFailRetryCount(0);
boolean addOk = apiUtil.addJob(req);
if (!addOk) {
throw new RuntimeException("创建夜间定时任务失败");
}
Integer xxlJobId = apiUtil.queryJobIdByDescAndParam(req.getJobDesc(), shipperId,"6");
if (xxlJobId == null) {
throw new RuntimeException("定时任务创建成功,但查询jobId失败");
}
return xxlJobId;
}
public void stopXxlJob(Integer shipperId) {
//1.实例化工具类建议交给Spring管理
XxlJobOpenApiUtil apiUtil = new XxlJobOpenApiUtil(adminAddresses,token);
//3.调用创建任务接口 返回任务ID
apiUtil.pauseJob(shipperId);
}
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
private static final DateTimeFormatter JOB_BIZ_NO_FORMATTER = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
private static final Random RANDOM = new Random();
/**
* 生成编码HT + 当天yyMMdd + 6位随机数字
* 示例HT260828123456
* @return 编码字符串
*/
public static String generateHtCode() {
// 当天yyMMdd
String dateStr = LocalDate.now().format(FORMATTER);
// 6位随机数 000000999999
int randomNum = RANDOM.nextInt(1_000_000);
String randomStr = String.format("%06d", randomNum);
return "HT" + dateStr + randomStr;
}
/**
* 生成xxl-job任务业务流水号JOB + 当天yyMMddHHmmssSSS + 6位随机数字保证每次创建的JobDesc唯一
* 示例JOB260905102030123123456
* @return 业务流水号字符串
*/
public static String generateXxlJobBizNo() {
String dateTimeStr = LocalDateTime.now().format(JOB_BIZ_NO_FORMATTER);
int randomNum = RANDOM.nextInt(1_000_000);
String randomStr = String.format("%06d", randomNum);
return "JOB" + dateTimeStr + randomStr;
}
/**
* 批量删除结算对象
*/
@@ -433,9 +686,17 @@ public class SettlementCustomersApplicationService {
? userShipperPo.getTopOrganizationId()
: loginUser.getUserPo().getTopOrganizationId());
saveEntity.setCreateTime(new Date());
saveEntity.setOrgCode(userShipperPo.getOrgCode());
return saveEntity;
}
public Boolean updatePushContractManageToBmsJobId(Long settlementCustomersId, Integer jobId) {
return settlementCustomersImpl.lambdaUpdate()
.eq(SettlementCustomers::getSettlementCustomersId, settlementCustomersId)
.set(SettlementCustomers::getPushContractManageToBmsJobId, jobId)
.update();
}
private SettlementCustomersDO buildDriverSettlementCustomerDO(UserDriverPo userDriverPo, LoginUser loginUser, Long organizationId) {
SettlementCustomersDO saveEntity = new SettlementCustomersDO();
saveEntity.setSettlementEntityId(userDriverPo.getUserId());
@@ -0,0 +1,87 @@
package com.mhd.bms.application.server.settlementCustomersNcConfig;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import com.mhd.bms.domain.settlementCustomersNcConfig.service.SettlementCustomersNcConfigDomainService;
import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 结算对象NC配置ApplicationService
*
* @author gen
* @date 2024-06-17
*/
@Service
@Slf4j
public class SettlementCustomersNcConfigApplicationService {
@Autowired
private SettlementCustomersNcConfigDomainService settlementCustomersNcConfigDomainService;
/**
* 分页查询结算对象NC配置列表
*/
public List<SettlementCustomersNcConfigPO> queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
return settlementCustomersNcConfigDomainService.queryList(settlementCustomersNcConfigDO);
}
/**
* 新增结算对象NC配置
*/
public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
settlementCustomersNcConfigDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
settlementCustomersNcConfigDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
settlementCustomersNcConfigDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
return settlementCustomersNcConfigDomainService.insert(settlementCustomersNcConfigDO);
}
/**
* 修改结算对象NC配置
*/
public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
return settlementCustomersNcConfigDomainService.update(settlementCustomersNcConfigDO);
}
/**
* 获取结算对象NC配置详细信息
*/
public SettlementCustomersNcConfigPO getInfo(Long id) {
return settlementCustomersNcConfigDomainService.getInfo(id);
}
/**
* 批量删除结算对象NC配置
*/
public Boolean deleteByIds(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) {
if (!StringUtils.isNotEmpty(settlementCustomersNcConfigDTO.getIds())) {
throw new ServiceException("id不能为空");
}
Set<String> idSet = Stream.of(settlementCustomersNcConfigDTO.getIds().split(",")).collect(Collectors.toSet());
Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
return settlementCustomersNcConfigDomainService.delete(ids);
}
}
@@ -0,0 +1,94 @@
package com.mhd.bms.application.server.settlementCustomersParameters;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import com.mhd.bms.domain.settlementCustomersParameters.service.SettlementCustomersParametersDomainService;
import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 结算对象参数ApplicationService
*
* @author gen
* @date 2024-06-17
*/
@Service
@Slf4j
public class SettlementCustomersParametersApplicationService {
@Autowired
private SettlementCustomersParametersDomainService settlementCustomersParametersDomainService;
/**
* 分页查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) {
return settlementCustomersParametersDomainService.queryList(settlementCustomersParametersDO);
}
/**
* 新增结算对象参数
*/
public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
settlementCustomersParametersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
settlementCustomersParametersDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
settlementCustomersParametersDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
return settlementCustomersParametersDomainService.insert(settlementCustomersParametersDO);
}
/**
* 修改结算对象参数
*/
public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
return settlementCustomersParametersDomainService.update(settlementCustomersParametersDO);
}
/**
* 获取结算对象参数详细信息
*/
public SettlementCustomersParametersPO getInfo(Long id) {
return settlementCustomersParametersDomainService.getInfo(id);
}
/**
* 批量删除结算对象参数
*/
public Boolean deleteByIds(SettlementCustomersParametersDTO settlementCustomersParametersDTO) {
if (!StringUtils.isNotEmpty(settlementCustomersParametersDTO.getIds())) {
throw new ServiceException("id不能为空");
}
Set<String> idSet = Stream.of(settlementCustomersParametersDTO.getIds().split(",")).collect(Collectors.toSet());
Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
return settlementCustomersParametersDomainService.delete(ids);
}
/**
* 根据结算对象id查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
return settlementCustomersParametersDomainService.getListBySettlementCustomersId(settlementCustomersId);
}
}
@@ -222,4 +222,7 @@ public class BillingStatement extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("仓储单号")
private String wmsNumber;
}
@@ -1,6 +1,8 @@
package com.mhd.bms.domain.billingStatement.repository.mapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementCollectPO;
@@ -42,4 +44,9 @@ public interface BillingStatementMapper extends BaseMapper<BillingStatement>
* 根据账单id查询流水明细列表
*/
List<BillingStatementPO> getDetailsByManageId(@Param("billManageId") Long billManageId);
}
/**
* 查询税率
*/
Map<String,Object> getTaxRate(@Param("organizationId") Long organizationId, @Param("subjectCode") String subjectCode, @Param("subjectName") String subjectName);
}
@@ -236,4 +236,6 @@ public class BillingStatementPO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("仓储单号")
private String wmsNumber;
}
@@ -254,4 +254,6 @@ public class BillingStatementDO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("仓储单号")
private String wmsNumber;
}
@@ -396,7 +396,7 @@ public class BillingStatementDomainService {
public Boolean generateFlow(BusinessDocumentPO businessDocumentPO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
// throw new DigitalLogisticsException(UserError.TIMEOUT);
}
BillingStatementDO billingStatementDO = new BillingStatementDO();
String[] ignroreFields = new String[]{"billingStatementId","dataSources","createBy","createByName","createTime","updateBy","updateByName","updateTime"};
@@ -414,13 +414,24 @@ public class BillingStatementDomainService {
billingStatementDO.setBillingAmount(businessDocumentPO.getBillAmount());
billingStatementDO.setBillingState(1);
billingStatementDO.setDataSources(1);
billingStatementDO.setCreateBy(loginUser.getUserPo().getUserId());
billingStatementDO.setCreateByName(loginUser.getUserPo().getUserName());
billingStatementDO.setCreateTime(new Date());
billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow());
billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
if (loginUser==null) {
billingStatementDO.setCreateBy(businessDocumentPO.getCreateBy());
billingStatementDO.setCreateByName(businessDocumentPO.getCreateByName());
billingStatementDO.setCreateTime(new Date());
billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow());
billingStatementDO.setTopOrganizationId(businessDocumentPO.getTopOrganizationId());
billingStatementDO.setOrganizationId(businessDocumentPO.getOrganizationId());
billingStatementDO.setOrganizationName(businessDocumentPO.getOrganizationName());
} else {
billingStatementDO.setCreateBy(loginUser.getUserPo().getUserId());
billingStatementDO.setCreateByName(loginUser.getUserPo().getUserName());
billingStatementDO.setCreateTime(new Date());
billingStatementDO.setBillingFlow(businessDocumentPO.getBusinessFlow());
billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
billingStatementDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
billingStatementDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
}
//收款帐户信息
billingStatementDO.setPaymentAccountId(businessDocumentPO.getPaymentAccountId()); //收款帐户ID
billingStatementDO.setPaymentAccountName(businessDocumentPO.getPaymentAccountName()); //收款帐户名称
@@ -194,4 +194,9 @@ public class BusinessDocument extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("是否推送")
private Integer isPush;
@ApiModelProperty("仓库类型")
private String warehouseType;
}
@@ -198,4 +198,9 @@ public class BusinessDocumentPO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("是否推送")
private Integer isPush;
@ApiModelProperty("仓库类型")
private String warehouseType;
}
@@ -218,6 +218,9 @@ public class BusinessDocumentDO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
private Long billManageId;
@ApiModelProperty("是否推送")
private Integer isPush;
@ApiModelProperty("仓库类型")
private String warehouseType;
}
@@ -121,7 +121,13 @@ public class BusinessDocumentDomainService {
public Boolean takeEffectByIds(List<Long> businessDocumentIdLongList) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
LambdaUpdateWrapper<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(BusinessDocument::getBusinessState,2);
// updateWrapper.set(BusinessDocument::getUpdateBy,loginUser.getUserPo().getUserId());
// updateWrapper.set(BusinessDocument::getUpdateTime,new Date());
// updateWrapper.set(BusinessDocument::getUpdateByName,loginUser.getUserPo().getUserName());
updateWrapper.in(BusinessDocument::getBusinessDocumentId,businessDocumentIdLongList);
return businessDocumentService.update(updateWrapper);
}
if(businessDocumentIdLongList != null && businessDocumentIdLongList.size() > 0){
LambdaUpdateWrapper<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
@@ -160,7 +166,20 @@ public class BusinessDocumentDomainService {
public Boolean auditByIds(List<Long> businessDocumentIdLongList, BusinessDocumentDTO businessDocumentDTO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
LambdaUpdateWrapper<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
if(businessDocumentDTO.getAuditOperation() == 1){
//同意
updateWrapper.set(BusinessDocument::getBusinessState,3);
}else {
//驳回
updateWrapper.set(BusinessDocument::getBusinessState,4);
}
updateWrapper.set(BusinessDocument::getReviewRemarks,businessDocumentDTO.getReviewRemarks());
// updateWrapper.set(BusinessDocument::getUpdateBy,loginUser.getUserPo().getUserId());
// updateWrapper.set(BusinessDocument::getUpdateTime,new Date());
// updateWrapper.set(BusinessDocument::getUpdateByName,loginUser.getUserPo().getUserName());
updateWrapper.in(BusinessDocument::getBusinessDocumentId,businessDocumentIdLongList);
return businessDocumentService.update(updateWrapper);
}
if(businessDocumentIdLongList != null && businessDocumentIdLongList.size() > 0){
LambdaUpdateWrapper<BusinessDocument> updateWrapper = new LambdaUpdateWrapper<>();
@@ -94,6 +94,13 @@ public class SettlementCustomers extends BaseVOEntity{
@ApiModelProperty("默认结算币种")
private String settlementCurrency;
@ApiModelProperty(name = "组织代码")
private String orgCode;
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
private Integer pushBillingRecordJobId;
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
private Integer pushContractManageToBmsJobId;
@ApiModelProperty(name = "生成应收账单任务id")
private Integer pushBillManageJobId;
}
@@ -1,11 +1,16 @@
package com.mhd.bms.domain.settlementCustomers.repository.persistence;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService;
import com.mhd.bms.domain.settlementCustomers.repository.mapper.SettlementCustomersMapper;
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper.SettlementCustomersNcConfigMapper;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -23,6 +28,10 @@ import java.util.List;
public class SettlementCustomersImpl extends ServiceImpl<SettlementCustomersMapper, SettlementCustomers> implements ISettlementCustomersService{
@Autowired
private SettlementCustomersMapper settlementCustomersMapper;
@Autowired
private SettlementCustomersParametersMapper settlementCustomersParametersMapper;
@Autowired
private SettlementCustomersNcConfigMapper settlementCustomersNcConfigMapper;
/**
* 查询结算对象列表
@@ -30,7 +39,19 @@ public class SettlementCustomersImpl extends ServiceImpl<SettlementCustomersMapp
@Override
public List<SettlementCustomersPO> queryList(SettlementCustomersDO settlementCustomersDO)
{
return settlementCustomersMapper.queryList(settlementCustomersDO);
List<SettlementCustomersPO> settlementCustomersPOS = settlementCustomersMapper.queryList(settlementCustomersDO);
if (settlementCustomersPOS != null && settlementCustomersPOS.size() > 0) {
for (SettlementCustomersPO settlementCustomersPO : settlementCustomersPOS) {
Long settlementCustomersId = settlementCustomersPO.getSettlementCustomersId();
List<SettlementCustomersParameters> settlementCustomersParameters = settlementCustomersParametersMapper.selectList(new LambdaQueryWrapper<SettlementCustomersParameters>()
.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId));
List<SettlementCustomersNcConfig> settlementCustomersNcConfigs = settlementCustomersNcConfigMapper.selectList(new LambdaQueryWrapper<SettlementCustomersNcConfig>()
.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersId));
settlementCustomersPO.setSettlementCustomersParameters(settlementCustomersParameters);
settlementCustomersPO.setSettlementCustomersNcConfigs(settlementCustomersNcConfigs);
}
}
return settlementCustomersPOS;
}
@Override
@@ -88,4 +109,4 @@ public class SettlementCustomersImpl extends ServiceImpl<SettlementCustomersMapp
BeanUtils.copyProperties(settlementCustomers,settlementCustomersPO);
return settlementCustomersPO;
}
}
}
@@ -1,5 +1,7 @@
package com.mhd.bms.domain.settlementCustomers.repository.po;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@@ -7,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.List;
import com.mhd.common.core.web.domain.BaseVOEntity;
@@ -126,5 +130,15 @@ public class SettlementCustomersPO extends BaseVOEntity{
@ApiModelProperty("业务单据创建时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date businessCreateTime;
@ApiModelProperty(name = "组织代码")
private String orgCode;
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
private Integer pushBillingRecordJobId;
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
private Integer pushContractManageToBmsJobId;
@ApiModelProperty(name = "生成应收账单任务id")
private Integer pushBillManageJobId;
List<SettlementCustomersNcConfig> settlementCustomersNcConfigs;
List<SettlementCustomersParameters> settlementCustomersParameters;
}
@@ -1,5 +1,7 @@
package com.mhd.bms.domain.settlementCustomers.repository.todo;
import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO;
import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@@ -131,5 +133,18 @@ public class SettlementCustomersDO extends BaseVOEntity{
@ApiModelProperty("单据类型编码")
private String documentTypeCode;
@ApiModelProperty(name = "组织代码")
private String orgCode;
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
private Integer pushBillingRecordJobId;
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
private Integer pushContractManageToBmsJobId;
@ApiModelProperty(name = "生成应收账单任务id")
private Integer pushBillManageJobId;
@ApiModelProperty("结算对象参数")
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
@ApiModelProperty("结算对象nc配置")
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigs;
}
@@ -0,0 +1,20 @@
package com.mhd.bms.domain.settlementCustomers.repository.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class XxlJobBusinessConfig {
@Value("${xxl.job.admin.address}")
private String adminAddress;
@Value("${xxl.job.admin.cookie}")
private String adminCookie;
@Bean
public XxlJobOpenApiUtil xxlJobOpenApiUtil() {
return new XxlJobOpenApiUtil(adminAddress, adminCookie);
}
}
@@ -0,0 +1,222 @@
package com.mhd.bms.domain.settlementCustomers.repository.util;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Map;
/**
* 调用XXLJOB后台页面接口
* 列表接口返回JSON不再返回HTML
*/
@Slf4j
public class XxlJobOpenApiUtil {
private final String adminUrl;
private final String cookie;
public XxlJobOpenApiUtil(String adminUrl, String cookie) {
this.adminUrl = StrUtil.removeSuffix(adminUrl, "/");
this.cookie = cookie;
}
/**
* 新增定时任务 POST /jobinfo/add
* @param addReq 请求实体与浏览器payload字段完全对齐
* @return true=新增成功false=失败
*/
public boolean addJob(JobInfoAddReq addReq) {
String url = adminUrl + "/jobinfo/add";
try {
Map<String, Object> formMap = BeanUtil.beanToMap(addReq);
HttpResponse response = HttpRequest.post(url)
.header("Authorization", cookie)
.form(formMap)
.execute();
int status = response.getStatus();
log.info("[XxlJob] addJob status:{}", status);
// 新增成功200重定向到列表页
return status == 200;
} catch (Exception e) {
log.error("[XxlJob] addJob异常", e);
return false;
}
}
/**
* 根据执行器组+任务描述+执行器参数查询jobId
* 适配返回JSON格式的pageList接口
* @param jobDesc 任务描述
* @param executorParam 任务参数(业务shipperId)
* @return jobId查不到返回null
*/
public Integer queryJobIdByDescAndParam(String jobDesc, String executorParam,String jobGroup) {
StringBuilder querySb = new StringBuilder();
// start length必须
querySb.append("start=0&length=10");
// jobGroup为空就不拼接这个参数不要 jobGroup=""
// 你们业务固定jobGroup=3直接写死3不用传空
if(StrUtil.isNotBlank(jobGroup)){
querySb.append("&jobGroup=").append(jobGroup);
}
// jobDesc
if(StrUtil.isNotBlank(jobDesc)){
querySb.append("&jobDesc=").append(cn.hutool.core.net.URLEncodeUtil.encode(jobDesc));
}
// executorParam
if(StrUtil.isNotBlank(executorParam)){
querySb.append("&executorParam=").append(cn.hutool.core.net.URLEncodeUtil.encode(executorParam));
}
// executorHandler为空直接不携带
// triggerStatus=-1
querySb.append("&triggerStatus=-1");
String url = adminUrl + "/jobinfo/pageList?" + querySb;
log.info("[XxlJob] pageList请求url:{}",url);
try {
HttpResponse response = HttpRequest.get(url)
.header("Authorization", cookie)
.execute();
String jsonStr = response.body();
log.info("[XxlJob] pageList响应:{}",jsonStr);
if (StrUtil.isBlank(jsonStr)) {
log.warn("[XxlJob] pageList返回空响应");
return null;
}
JSONObject jsonObj = JSON.parseObject(jsonStr);
JSONArray jsonArray = jsonObj.getJSONArray("data");
if(jsonArray == null){
return null;
}
List<JobPageItem> dataList = jsonArray.toList(JobPageItem.class);
if (dataList == null || dataList.isEmpty()) {
return null;
}
for (JobPageItem item : dataList) {
if (StrUtil.equals(item.jobDesc, jobDesc) && StrUtil.equals(item.executorParam, executorParam)) {
return item.id;
}
}
return null;
} catch (Exception e) {
log.error("[XxlJob] queryJobId异常", e);
return null;
}
}
/**
* 暂停任务 POST /jobinfo/pause
* @param jobId xxl任务id
* @return true成功
*/
public boolean pauseJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/pause";
try {
HttpResponse response = HttpRequest.post(url)
.header("Authorization", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] pauseJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* 开启任务 POST /jobinfo/start
* @param jobId xxl任务id
* @return true成功
*/
public boolean startJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/start";
try {
HttpResponse response = HttpRequest.post(url)
.header("Authorization", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] startJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* 删除任务 POST /jobinfo/remove
* @param jobId xxl任务id
* @return true成功
*/
public boolean removeJob(Integer jobId) {
if (jobId == null) {
return false;
}
String url = adminUrl + "/jobinfo/remove";
try {
HttpResponse response = HttpRequest.post(url)
.header("Authorization", cookie)
.form("id", jobId)
.execute();
return response.getStatus() == 200;
} catch (Exception e) {
log.error("[XxlJob] removeJob jobId:{}异常", jobId, e);
return false;
}
}
/**
* pageList 返回data数组中每一项实体
*/
@Data
public static class JobPageItem {
private Integer id;
private String jobDesc;
private String executorParam;
}
/**
* add接口请求实体与浏览器F12抓包payload字段一一对应
*/
@Data
public static class JobInfoAddReq {
private Integer jobGroup;
private String jobDesc;
private String author;
private String alarmEmail;
private String scheduleType;
private String scheduleConf;
private String glueType;
private String executorHandler;
private String executorParam;
private String glueRemark;
private String glueSource;
private String executorRouteStrategy;
private Integer childJobId;
private String misfireStrategy;
private String executorBlockStrategy;
private Integer executorTimeout;
private Integer executorFailRetryCount;
}
}
@@ -5,6 +5,10 @@ import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService;
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
import com.mhd.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +28,11 @@ public class SettlementCustomersDomainService {
@Autowired
private ISettlementCustomersService settlementCustomersService;
@Autowired
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
@Autowired
private ISettlementCustomersParametersService settlementCustomersParametersService;
/**
* 分页查询结算对象列表
@@ -64,7 +73,17 @@ public class SettlementCustomersDomainService {
*/
public SettlementCustomersPO getInfo(Long settlementCustomersId)
{
return settlementCustomersService.getInfo(settlementCustomersId);
SettlementCustomersPO info = settlementCustomersService.getInfo(settlementCustomersId);
LambdaQueryWrapper<SettlementCustomersNcConfig> ncConfigWrapper = new LambdaQueryWrapper<>();
ncConfigWrapper.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersId);
info.setSettlementCustomersNcConfigs(settlementCustomersNcConfigService.list(ncConfigWrapper));
LambdaQueryWrapper<SettlementCustomersParameters> parametersWrapper = new LambdaQueryWrapper<>();
parametersWrapper.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId);
info.setSettlementCustomersParameters(settlementCustomersParametersService.list(parametersWrapper));
return info;
}
@@ -0,0 +1,80 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 结算对象对象 settlement_customers
*
* @author gen
* @date 2024-06-17
*/
@Data
public class SettlementCustomersNcConfig extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("nc编码")
@Excel(name = "nc编码")
private String ncCode;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethod;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfig;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethodName;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerTypeName;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfigName;
@ApiModelProperty("欠租期上限 (月)")
@Excel(name = "欠租期上限 (月)")
private Integer oweRentMaxMonth;
@ApiModelProperty("账期 (天)")
@Excel(name = "账期 (天)")
private Integer accountPeriodDay;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}
@@ -0,0 +1,42 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import java.util.List;
/**
* 结算对象NC配置Service接口
*
* @author gen
* @date 2024-06-17
*/
public interface ISettlementCustomersNcConfigService extends IService<SettlementCustomersNcConfig> {
/**
* 分页查询结算对象NC配置列表
*/
public List<SettlementCustomersNcConfigPO> queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO);
/**
* 新增结算对象NC配置
*/
public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO);
/**
* 修改结算对象NC配置
*/
public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO);
/**
* 批量删除结算对象NC配置
*/
public Boolean delete(Long[] ids);
/**
* 查询结算对象NC配置
*/
public SettlementCustomersNcConfigPO getInfo(Long id);
}
@@ -0,0 +1,23 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import org.apache.ibatis.annotations.Param;
/**
* 结算对象NC配置Mapper接口
*
* @author gen
* @date 2024-06-17
*/
public interface SettlementCustomersNcConfigMapper extends BaseMapper<SettlementCustomersNcConfig> {
/**
* 查询结算对象NC配置列表
*/
public List<SettlementCustomersNcConfigPO> queryList(@Param("settlementCustomersNcConfigDO") SettlementCustomersNcConfigDO settlementCustomersNcConfigDO);
}
@@ -0,0 +1,81 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.repository.persistence;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.mapper.SettlementCustomersNcConfigMapper;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 结算对象NC配置Service业务层处理
*
* @author gen
* @date 2024-06-17
*/
@Service
public class SettlementCustomersNcConfigImpl extends ServiceImpl<SettlementCustomersNcConfigMapper, SettlementCustomersNcConfig> implements ISettlementCustomersNcConfigService {
@Autowired
private SettlementCustomersNcConfigMapper settlementCustomersNcConfigMapper;
/**
* 查询结算对象NC配置列表
*/
@Override
public List<SettlementCustomersNcConfigPO> queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
return settlementCustomersNcConfigMapper.queryList(settlementCustomersNcConfigDO);
}
/**
* 新增结算对象NC配置
*/
@Override
public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig();
BeanUtils.copyProperties(settlementCustomersNcConfigDO, settlementCustomersNcConfig);
return this.save(settlementCustomersNcConfig);
}
/**
* 修改结算对象NC配置
*/
@Override
public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig();
BeanUtils.copyProperties(settlementCustomersNcConfigDO, settlementCustomersNcConfig);
return this.updateById(settlementCustomersNcConfig);
}
/**
* 批量删除结算对象NC配置
*/
@Override
public Boolean delete(Long[] ids) {
List<SettlementCustomersNcConfig> list = new ArrayList<>();
for (Long id : ids) {
SettlementCustomersNcConfig settlementCustomersNcConfig = new SettlementCustomersNcConfig();
settlementCustomersNcConfig.setId(id);
settlementCustomersNcConfig.setDelFlag(2);
list.add(settlementCustomersNcConfig);
}
return this.updateBatchById(list);
}
/**
* 查询结算对象NC配置
*/
@Override
public SettlementCustomersNcConfigPO getInfo(Long id) {
SettlementCustomersNcConfig settlementCustomersNcConfig = this.getById(id);
SettlementCustomersNcConfigPO settlementCustomersNcConfigPO = new SettlementCustomersNcConfigPO();
BeanUtils.copyProperties(settlementCustomersNcConfig, settlementCustomersNcConfigPO);
return settlementCustomersNcConfigPO;
}
}
@@ -0,0 +1,77 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 结算对象NC配置对象 settlement_customers_nc_config
*
* @author gen
* @date 2024-06-17
*/
@Data
@ApiModel(value = "结算对象NC配置对象", description = "结算对象NC配置响应对象")
public class SettlementCustomersNcConfigPO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("nc编码")
@Excel(name = "nc编码")
private String ncCode;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethod;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfig;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethodName;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerTypeName;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfigName;
@ApiModelProperty("欠租期上限 (月)")
@Excel(name = "欠租期上限 (月)")
private Integer oweRentMaxMonth;
@ApiModelProperty("账期 (天)")
@Excel(name = "账期 (天)")
private Integer accountPeriodDay;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
}
@@ -0,0 +1,81 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 结算对象NC配置对象 settlement_customers_nc_config
*
* @author gen
* @date 2024-06-17
*/
@Data
public class SettlementCustomersNcConfigDO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("nc编码")
@Excel(name = "nc编码")
private String ncCode;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethod;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfig;
@ApiModelProperty("结算方式")
@Excel(name = "结算方式")
private String ncSettleMethodName;
@ApiModelProperty("仓库温层类型")
@Excel(name = "仓库温层类型")
private String warehouseTempLayerTypeName;
@ApiModelProperty("散租计费配置")
@Excel(name = "散租计费配置")
private String scatterRentBillingConfigName;
@ApiModelProperty("欠租期上限 (月)")
@Excel(name = "欠租期上限 (月)")
private Integer oweRentMaxMonth;
@ApiModelProperty("账期 (天)")
@Excel(name = "账期 (天)")
private Integer accountPeriodDay;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty(name = "创建时间查询条件开始日期")
private String createTimeStart;
@ApiModelProperty(name = "创建时间查询条件结束日期")
private String createTimeEnd;
}
@@ -0,0 +1,59 @@
package com.mhd.bms.domain.settlementCustomersNcConfig.service;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.po.SettlementCustomersNcConfigPO;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 结算对象NC配置领域服务
*
* @author gen
* @date 2024-06-17
*/
@Service
@Slf4j
public class SettlementCustomersNcConfigDomainService {
@Autowired
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
/**
* 分页查询结算对象NC配置列表
*/
public List<SettlementCustomersNcConfigPO> queryList(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
return settlementCustomersNcConfigService.queryList(settlementCustomersNcConfigDO);
}
/**
* 新增结算对象NC配置
*/
public Boolean insert(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
return settlementCustomersNcConfigService.insert(settlementCustomersNcConfigDO);
}
/**
* 修改结算对象NC配置
*/
public Boolean update(SettlementCustomersNcConfigDO settlementCustomersNcConfigDO) {
return settlementCustomersNcConfigService.update(settlementCustomersNcConfigDO);
}
/**
* 批量删除结算对象NC配置
*/
public Boolean delete(Long[] ids) {
return settlementCustomersNcConfigService.delete(ids);
}
/**
* 获取结算对象NC配置详细信息
*/
public SettlementCustomersNcConfigPO getInfo(Long id) {
return settlementCustomersNcConfigService.getInfo(id);
}
}
@@ -0,0 +1,69 @@
package com.mhd.bms.domain.settlementCustomersParameters.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 结算对象对象 settlement_customers
*
* @author gen
* @date 2024-06-17
*/
@Data
public class SettlementCustomersParameters extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算对象编码")
@Excel(name = "结算对象编码")
private String settlementCustomersCode;
@ApiModelProperty("结算主体id")
@Excel(name = "结算主体id")
private Long settlementEntityId;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private String settlementEntity;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("参数内容")
@Excel(name = "参数内容")
private String content;
@ApiModelProperty("参数名称")
@Excel(name = "参数名称")
private String parametersName;
}
@@ -0,0 +1,47 @@
package com.mhd.bms.domain.settlementCustomersParameters.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import java.util.List;
/**
* 结算对象参数Service接口
*
* @author gen
* @date 2024-06-17
*/
public interface ISettlementCustomersParametersService extends IService<SettlementCustomersParameters> {
/**
* 分页查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> queryList(SettlementCustomersParametersDO settlementCustomersParametersDO);
/**
* 新增结算对象参数
*/
public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO);
/**
* 修改结算对象参数
*/
public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO);
/**
* 批量删除结算对象参数
*/
public Boolean delete(Long[] ids);
/**
* 查询结算对象参数
*/
public SettlementCustomersParametersPO getInfo(Long id);
/**
* 根据结算对象id查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId);
}
@@ -0,0 +1,23 @@
package com.mhd.bms.domain.settlementCustomersParameters.repository.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import org.apache.ibatis.annotations.Param;
/**
* 结算对象参数Mapper接口
*
* @author gen
* @date 2024-06-17
*/
public interface SettlementCustomersParametersMapper extends BaseMapper<SettlementCustomersParameters> {
/**
* 查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> queryList(@Param("settlementCustomersParametersDO") SettlementCustomersParametersDO settlementCustomersParametersDO);
}
@@ -0,0 +1,95 @@
package com.mhd.bms.domain.settlementCustomersParameters.repository.persistence;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
import com.mhd.bms.domain.settlementCustomersParameters.repository.mapper.SettlementCustomersParametersMapper;
import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 结算对象参数Service业务层处理
*
* @author gen
* @date 2024-06-17
*/
@Service
public class SettlementCustomersParametersImpl extends ServiceImpl<SettlementCustomersParametersMapper, SettlementCustomersParameters> implements ISettlementCustomersParametersService {
@Autowired
private SettlementCustomersParametersMapper settlementCustomersParametersMapper;
/**
* 查询结算对象参数列表
*/
@Override
public List<SettlementCustomersParametersPO> queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) {
return settlementCustomersParametersMapper.queryList(settlementCustomersParametersDO);
}
/**
* 新增结算对象参数
*/
@Override
public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) {
SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters();
BeanUtils.copyProperties(settlementCustomersParametersDO, settlementCustomersParameters);
return this.save(settlementCustomersParameters);
}
/**
* 修改结算对象参数
*/
@Override
public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) {
SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters();
BeanUtils.copyProperties(settlementCustomersParametersDO, settlementCustomersParameters);
return this.updateById(settlementCustomersParameters);
}
/**
* 批量删除结算对象参数
*/
@Override
public Boolean delete(Long[] ids) {
List<SettlementCustomersParameters> list = new ArrayList<>();
for (Long id : ids) {
SettlementCustomersParameters settlementCustomersParameters = new SettlementCustomersParameters();
settlementCustomersParameters.setId(id);
settlementCustomersParameters.setDelFlag(2);
list.add(settlementCustomersParameters);
}
return this.updateBatchById(list);
}
/**
* 查询结算对象参数
*/
@Override
public SettlementCustomersParametersPO getInfo(Long id) {
SettlementCustomersParameters settlementCustomersParameters = this.getById(id);
SettlementCustomersParametersPO settlementCustomersParametersPO = new SettlementCustomersParametersPO();
BeanUtils.copyProperties(settlementCustomersParameters, settlementCustomersParametersPO);
return settlementCustomersParametersPO;
}
@Override
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
List<SettlementCustomersParameters> list = this.list(new LambdaQueryWrapper<SettlementCustomersParameters>()
.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId)
.eq(SettlementCustomersParameters::getDelFlag, 1));
return list.stream().map(item -> {
SettlementCustomersParametersPO po = new SettlementCustomersParametersPO();
BeanUtils.copyProperties(item, po);
return po;
}).collect(Collectors.toList());
}
}
@@ -0,0 +1,64 @@
package com.mhd.bms.domain.settlementCustomersParameters.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 结算对象参数对象 settlement_customers_parameters
*
* @author gen
* @date 2024-06-17
*/
@Data
@ApiModel(value = "结算对象参数对象", description = "结算对象参数响应对象")
public class SettlementCustomersParametersPO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算对象编码")
@Excel(name = "结算对象编码")
private String settlementCustomersCode;
@ApiModelProperty("结算主体id")
@Excel(name = "结算主体id")
private Long settlementEntityId;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private String settlementEntity;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("参数内容")
@Excel(name = "参数内容")
private String content;
@ApiModelProperty("参数名称")
@Excel(name = "参数名称")
private String parametersName;
}
@@ -0,0 +1,68 @@
package com.mhd.bms.domain.settlementCustomersParameters.repository.todo;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 结算对象参数对象 settlement_customers_parameters
*
* @author gen
* @date 2024-06-17
*/
@Data
public class SettlementCustomersParametersDO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("一级组织表ID")
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
@Excel(name = "组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("结算对象编码")
@Excel(name = "结算对象编码")
private String settlementCustomersCode;
@ApiModelProperty("结算主体id")
@Excel(name = "结算主体id")
private Long settlementEntityId;
@ApiModelProperty("结算主体")
@Excel(name = "结算主体")
private String settlementEntity;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@ApiModelProperty("参数内容")
@Excel(name = "参数内容")
private String content;
@ApiModelProperty("参数名称")
@Excel(name = "参数名称")
private String parametersName;
@ApiModelProperty(name = "创建时间查询条件开始日期")
private String createTimeStart;
@ApiModelProperty(name = "创建时间查询条件结束日期")
private String createTimeEnd;
}
@@ -0,0 +1,66 @@
package com.mhd.bms.domain.settlementCustomersParameters.service;
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
import com.mhd.bms.domain.settlementCustomersParameters.repository.po.SettlementCustomersParametersPO;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 结算对象参数领域服务
*
* @author gen
* @date 2024-06-17
*/
@Service
@Slf4j
public class SettlementCustomersParametersDomainService {
@Autowired
private ISettlementCustomersParametersService settlementCustomersParametersService;
/**
* 分页查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> queryList(SettlementCustomersParametersDO settlementCustomersParametersDO) {
return settlementCustomersParametersService.queryList(settlementCustomersParametersDO);
}
/**
* 新增结算对象参数
*/
public Boolean insert(SettlementCustomersParametersDO settlementCustomersParametersDO) {
return settlementCustomersParametersService.insert(settlementCustomersParametersDO);
}
/**
* 修改结算对象参数
*/
public Boolean update(SettlementCustomersParametersDO settlementCustomersParametersDO) {
return settlementCustomersParametersService.update(settlementCustomersParametersDO);
}
/**
* 批量删除结算对象参数
*/
public Boolean delete(Long[] ids) {
return settlementCustomersParametersService.delete(ids);
}
/**
* 获取结算对象参数详细信息
*/
public SettlementCustomersParametersPO getInfo(Long id) {
return settlementCustomersParametersService.getInfo(id);
}
/**
* 根据结算对象id查询结算对象参数列表
*/
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
return settlementCustomersParametersService.getListBySettlementCustomersId(settlementCustomersId);
}
}
@@ -0,0 +1,71 @@
package com.mhd.bms.interfaces.assembler.settlementCustomersNcConfig;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.todo.SettlementCustomersNcConfigDO;
import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 结算对象NC配置Assembler
*
* @author gen
* @date 2024-06-17
*/
@Component
public class SettlementCustomersNcConfigAssembler {
/**
* 转换实体
*/
public SettlementCustomersNcConfigDO toDO(SettlementCustomersNcConfigDTO settlementCustomersNcConfigDTO) {
SettlementCustomersNcConfigDO settlementCustomersNcConfigDO = new SettlementCustomersNcConfigDO();
// 拷贝
BeanUtils.copyProperties(settlementCustomersNcConfigDTO, settlementCustomersNcConfigDO, IgnoreNullUtil.getNullPropertyNames(settlementCustomersNcConfigDTO));
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
// 获取用户姓名优先使用userPo中的userName如果为空则使用realname最后使用username
String userName = null;
if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null) {
userName = loginUser.getUserPo().getUserName();
} else if (loginUser.getRealname() != null) {
userName = loginUser.getRealname();
} else {
userName = loginUser.getUsername();
}
// 获取登录人id
Long userId = loginUser.getUserid();
if (settlementCustomersNcConfigDTO.getId() != null) {
if (userId != null) {
settlementCustomersNcConfigDO.setUpdateBy(userId);
} else {
settlementCustomersNcConfigDO.setUpdateBy(0L);
}
settlementCustomersNcConfigDO.setUpdateByName(userName);
settlementCustomersNcConfigDO.setUpdateTime(new Date());
} else {
if (userId != null) {
settlementCustomersNcConfigDO.setCreateBy(userId);
settlementCustomersNcConfigDO.setUpdateBy(userId);
} else {
settlementCustomersNcConfigDO.setCreateBy(0L);
settlementCustomersNcConfigDO.setUpdateBy(0L);
}
settlementCustomersNcConfigDO.setCreateByName(userName);
settlementCustomersNcConfigDO.setUpdateByName(userName);
settlementCustomersNcConfigDO.setCreateTime(new Date());
settlementCustomersNcConfigDO.setUpdateTime(new Date());
settlementCustomersNcConfigDO.setDelFlag(1);
}
return settlementCustomersNcConfigDO;
}
}
@@ -0,0 +1,71 @@
package com.mhd.bms.interfaces.assembler.settlementCustomersParameters;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.bms.domain.settlementCustomersParameters.repository.todo.SettlementCustomersParametersDO;
import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 结算对象参数Assembler
*
* @author gen
* @date 2024-06-17
*/
@Component
public class SettlementCustomersParametersAssembler {
/**
* 转换实体
*/
public SettlementCustomersParametersDO toDO(SettlementCustomersParametersDTO settlementCustomersParametersDTO) {
SettlementCustomersParametersDO settlementCustomersParametersDO = new SettlementCustomersParametersDO();
// 拷贝
BeanUtils.copyProperties(settlementCustomersParametersDTO, settlementCustomersParametersDO, IgnoreNullUtil.getNullPropertyNames(settlementCustomersParametersDTO));
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
// 获取用户姓名优先使用userPo中的userName如果为空则使用realname最后使用username
String userName = null;
if (loginUser.getUserPo() != null && loginUser.getUserPo().getUserName() != null) {
userName = loginUser.getUserPo().getUserName();
} else if (loginUser.getRealname() != null) {
userName = loginUser.getRealname();
} else {
userName = loginUser.getUsername();
}
// 获取登录人id
Long userId = loginUser.getUserid();
if (settlementCustomersParametersDTO.getId() != null) {
if (userId != null) {
settlementCustomersParametersDO.setUpdateBy(userId);
} else {
settlementCustomersParametersDO.setUpdateBy(0L);
}
settlementCustomersParametersDO.setUpdateByName(userName);
settlementCustomersParametersDO.setUpdateTime(new Date());
} else {
if (userId != null) {
settlementCustomersParametersDO.setCreateBy(userId);
settlementCustomersParametersDO.setUpdateBy(userId);
} else {
settlementCustomersParametersDO.setCreateBy(0L);
settlementCustomersParametersDO.setUpdateBy(0L);
}
settlementCustomersParametersDO.setCreateByName(userName);
settlementCustomersParametersDO.setUpdateByName(userName);
settlementCustomersParametersDO.setCreateTime(new Date());
settlementCustomersParametersDO.setUpdateTime(new Date());
settlementCustomersParametersDO.setDelFlag(1);
}
return settlementCustomersParametersDO;
}
}
@@ -264,5 +264,6 @@ public class BillingStatementDTO extends BaseVOEntity{
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
@ApiModelProperty("仓储单号")
private String wmsNumber;
}
@@ -215,4 +215,8 @@ public class BusinessDocumentDTO extends BaseVOEntity{
private String paymentAccountName;
private Long billManageId;
@ApiModelProperty("仓库类型")
private String warehouseType;
@ApiModelProperty("是否推送")
private Integer isPush;
}
@@ -1,5 +1,8 @@
package com.mhd.bms.interfaces.dto.settlementCustomers;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.interfaces.dto.settlementCustomersNcConfig.SettlementCustomersNcConfigDTO;
import com.mhd.bms.interfaces.dto.settlementCustomersParameters.SettlementCustomersParametersDTO;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@@ -130,4 +133,17 @@ public class SettlementCustomersDTO extends BaseVOEntity{
@ApiModelProperty("单据类型编码")
private String documentTypeCode;
@ApiModelProperty(name = "组织代码")
private String orgCode;
@ApiModelProperty(name = "散租推送计费单据/流水任务id")
private Integer pushBillingRecordJobId;
@ApiModelProperty(name = "整租推送计费单据/流水任务id")
private Integer pushContractManageToBmsJobId;
@ApiModelProperty(name = "生成应收账单任务id")
private Integer pushBillManageJobId;
@ApiModelProperty("结算对象参数")
private List<SettlementCustomersParametersDTO> settlementCustomersParameters;
@ApiModelProperty("结算对象nc配置")
private List<SettlementCustomersNcConfigDTO> settlementCustomersNcConfigs;
}

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