Compare commits
276
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a852c0844e | ||
|
|
50b10ad19f | ||
|
|
aff19e1536 | ||
|
|
4c58838842 | ||
|
|
d27cca0217 | ||
|
|
6f5fa138d9 | ||
|
|
cf0a42ec8a | ||
|
|
5c591d3b57 | ||
|
|
165927bc3d | ||
|
|
2d03084f0c | ||
|
|
1f0703bc64 | ||
|
|
9bb5a7c2cf | ||
|
|
a7eed8590f | ||
|
|
4fad415cb7 | ||
|
|
a23a4acef3 | ||
|
|
0cd0a9535d | ||
|
|
71765b339f | ||
|
|
521e4ca5bd | ||
|
|
47688bfe34 | ||
|
|
b0999402cd | ||
|
|
dde4698fc6 | ||
|
|
5513b0af08 | ||
|
|
357fb0bd65 | ||
|
|
16627950e2 | ||
|
|
81dc017b68 | ||
|
|
80b96b0f17 | ||
|
|
d683774b88 | ||
|
|
20f60d490f | ||
|
|
73f7bbd803 | ||
|
|
5029ae8d42 | ||
|
|
87eea6a8cd | ||
|
|
72b2a153a0 | ||
|
|
7326407d13 | ||
|
|
4091f20e7a | ||
|
|
7bcf11baaf | ||
|
|
11ad2ea20f | ||
|
|
b303c78b39 | ||
|
|
2fb7d117c0 | ||
|
|
cdb21fe961 | ||
|
|
2151555f31 | ||
|
|
ce4f56962f | ||
|
|
c3b4923ce9 | ||
|
|
c536d2c5c6 | ||
|
|
fad5eb66fa | ||
|
|
52172dc3d7 | ||
|
|
34a146514f | ||
|
|
8377d9f2a5 | ||
|
|
0f2e2e769b | ||
|
|
73b1a76cb6 | ||
|
|
81c30d752d | ||
|
|
38b2de852b | ||
|
|
35122c0fca | ||
|
|
f1c7dd453b | ||
|
|
f1aa799809 | ||
|
|
d5dfa96859 | ||
|
|
23fe5eca9c | ||
|
|
69d5276bd9 | ||
|
|
876430874c | ||
|
|
24c234bcb7 | ||
|
|
c52b9f092e | ||
|
|
61b68804f0 | ||
|
|
23bffb32b3 | ||
|
|
9f9b0867ac | ||
|
|
1a309cb042 | ||
|
|
226360ef3a | ||
|
|
444b6add0a | ||
|
|
46757ed2f1 | ||
|
|
1548a28c9e | ||
|
|
2755ed1a33 | ||
|
|
5030ca2a8a | ||
|
|
4852b4496a | ||
|
|
e2bfb032a7 | ||
|
|
762c9d4bf4 | ||
|
|
f4f2573af7 | ||
|
|
1381bcee72 | ||
|
|
bbe8ce3523 | ||
|
|
7ae6ed2aac | ||
|
|
d45206a644 | ||
|
|
f7faed5e44 | ||
|
|
fa5f8d68cc | ||
|
|
b0a28a101e | ||
|
|
b24d02f4a6 | ||
|
|
a9aba71e0c | ||
|
|
687404b47f | ||
|
|
d4e3b36974 | ||
|
|
162f35b752 | ||
|
|
9cb99c915d | ||
|
|
9a58a7b41c | ||
|
|
3c594d4a91 | ||
|
|
dc9d491d61 | ||
|
|
d0cde81dcd | ||
|
|
81cd4b3317 | ||
|
|
442ca4977c | ||
|
|
2abdb6e8d1 | ||
|
|
53e9f977a1 | ||
|
|
1dcd38aaa2 | ||
|
|
50b7be1e4f | ||
|
|
4ce7b3afec | ||
|
|
aeff793901 | ||
|
|
187bddc820 | ||
|
|
360cb8d95c | ||
|
|
a589cfd3af | ||
|
|
f80b0bbddb | ||
|
|
76596ac927 | ||
|
|
2a33823ef2 | ||
|
|
930894b37e | ||
|
|
02acda9e23 | ||
|
|
41fa3991d9 | ||
|
|
a221c05ec9 | ||
|
|
57fb245715 | ||
|
|
79cda62fb4 | ||
|
|
0fba417b77 | ||
|
|
ed8d3fafd9 | ||
|
|
fea9ac6277 | ||
|
|
8e1cd9b185 | ||
|
|
bc2fc833a2 | ||
|
|
196410331b | ||
|
|
9351bd8816 | ||
|
|
429c279b78 | ||
|
|
4a6421c9cf | ||
|
|
9e71401716 | ||
|
|
fceaf38db9 | ||
|
|
4a90bbd9ad | ||
|
|
4ced5f9b65 | ||
|
|
07d43b393d | ||
|
|
ab0c0fdc17 | ||
|
|
0425b41cf4 | ||
|
|
9e3cedb596 | ||
|
|
5678399a34 | ||
|
|
dc0416510b | ||
|
|
cf85ffa37f | ||
|
|
7d26d7915c | ||
|
|
185b68bde9 | ||
|
|
553e0eebee | ||
|
|
fb4c508873 | ||
|
|
ebfd3c3f2e | ||
|
|
62ecfddb95 | ||
|
|
19696cbb6a | ||
|
|
40c16f17cc | ||
|
|
bd2170e0be | ||
|
|
e4a3835ee0 | ||
|
|
98e94682eb | ||
|
|
eb07b799f6 | ||
|
|
615e0d34e4 | ||
|
|
8b66aea296 | ||
|
|
eec6752b9a | ||
|
|
2907a55c96 | ||
|
|
08762490dd | ||
|
|
9e2d84fc5c | ||
|
|
1c2bb30c44 | ||
|
|
268c00074f | ||
|
|
7f38da20e1 | ||
|
|
176bdbc633 | ||
|
|
c2a4b981e6 | ||
|
|
ecd5e89172 | ||
|
|
22ff97e045 | ||
|
|
afc26a798f | ||
|
|
b5914940df | ||
|
|
01ec70e3c2 | ||
|
|
b178e79c8f | ||
|
|
0d70cc8b4c | ||
|
|
55f089a7d6 | ||
|
|
b432ab0ac3 | ||
|
|
08b930e6d4 | ||
|
|
1ed10bf71b | ||
|
|
4772395daf | ||
|
|
11fa915e0e | ||
|
|
8c9ef2f083 | ||
|
|
193db96e63 | ||
|
|
ec43b3be8a | ||
|
|
9511a38946 | ||
|
|
bc962c3131 | ||
|
|
4f24096a0c | ||
|
|
20a7978729 | ||
|
|
7c18ccf3bb | ||
|
|
78c9ab191a | ||
|
|
8bec065f69 | ||
|
|
d82abe15bf | ||
|
|
4017c0a60d | ||
|
|
da0dae5f40 | ||
|
|
12999e6ffd | ||
|
|
8b186907e1 | ||
|
|
183c84cb5b | ||
|
|
9ca77a7d57 | ||
|
|
40ff9808b8 | ||
|
|
4afe929020 | ||
|
|
d982cc41c3 | ||
|
|
0497d8e96e | ||
|
|
b51bc17838 | ||
|
|
2516d86226 | ||
|
|
287575c622 | ||
|
|
374b26d023 | ||
|
|
a5489ceb5a | ||
|
|
de1ef5dec7 | ||
|
|
eed47e1f34 | ||
|
|
3cd16ddfac | ||
|
|
bf3e5c3e29 | ||
|
|
8f779f5e29 | ||
|
|
8ff0561a1f | ||
|
|
8be0813e21 | ||
|
|
f995d9e7c6 | ||
|
|
5c8c6251d6 | ||
|
|
dc589fdf3f | ||
|
|
1cf6d4492d | ||
|
|
8f0e71fe2a | ||
|
|
c6366ef728 | ||
|
|
b26d79bab0 | ||
|
|
2d424847c3 | ||
|
|
392e54d636 | ||
|
|
11c7fdc7de | ||
|
|
8893eda62d | ||
|
|
293fedda12 | ||
|
|
ed4d6111a5 | ||
|
|
92acdb4f20 | ||
|
|
f933aa9234 | ||
|
|
f704038362 | ||
|
|
3e90a8c5c4 | ||
|
|
db198dd2a2 | ||
|
|
a6e727e04a | ||
|
|
badb1b62da | ||
|
|
141686d743 | ||
|
|
ce8e340116 | ||
|
|
42e9f79b10 | ||
|
|
1520cd7aba | ||
|
|
c103884826 | ||
|
|
66d77910f3 | ||
|
|
e966726a0c | ||
|
|
89c3f398b8 | ||
|
|
84174a6639 | ||
|
|
92a5544891 | ||
|
|
81c7c9e9f7 | ||
|
|
bc9adf3f19 | ||
|
|
81157cc451 | ||
|
|
da4da4e61e | ||
|
|
3248aef4a9 | ||
|
|
242f56ae1a | ||
|
|
cf22323cfe | ||
|
|
fe2dcc027b | ||
|
|
6072ac272f | ||
|
|
6c71bff1ad | ||
|
|
2c16152c0b | ||
|
|
0b3df4bf32 | ||
|
|
1b5914a7d1 | ||
|
|
feb614e3e4 | ||
|
|
7650bd2eb9 | ||
|
|
7d13b42144 | ||
|
|
432fa3398d | ||
|
|
e84adc2d6f | ||
|
|
0ad41cd768 | ||
|
|
caac89e3db | ||
|
|
95c128b506 | ||
|
|
186d76f9fc | ||
|
|
bc3bdd669e | ||
|
|
6aeabc7be7 | ||
|
|
80b604a637 | ||
|
|
55c780caa1 | ||
|
|
af0f3e81b9 | ||
|
|
0ae37ac795 | ||
|
|
129cd393aa | ||
|
|
b4f685a25d | ||
|
|
a14c7776e8 | ||
|
|
3360e500dc | ||
|
|
41fc2d1805 | ||
|
|
7ccb06ad79 | ||
|
|
7a7038e794 | ||
|
|
d04df87e19 | ||
|
|
21aab4f17e | ||
|
|
ab10adb0d2 | ||
|
|
f32f5b48bc | ||
|
|
3224e87814 | ||
|
|
afa6ed0685 | ||
|
|
32efb1dfe5 | ||
|
|
0cf697a03b | ||
|
|
7babb53e90 | ||
|
|
31247d7faa | ||
|
|
4a07d1a0c4 |
@@ -357,6 +357,10 @@ public interface SystemServiceFeign {
|
||||
@GetMapping("/contractManageApi/getInfoByCustomer")
|
||||
public AjaxResult getInfoByCustomer(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType);
|
||||
|
||||
@ApiOperation("根据结算主体和费用科目获取合同信息")
|
||||
@GetMapping(value = "/contractManageApi/getInfoByCustomerAndSecondSubjectCode")
|
||||
public AjaxResult getInfoByCustomerAndSecondSubjectCode(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("firstSubjectCode") String firstSubjectCode,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 根据结算主体获取合同信息
|
||||
*/
|
||||
|
||||
@@ -223,4 +223,7 @@ public interface UserServiceFeign {
|
||||
@ApiOperation("查询赊销额度")
|
||||
@PostMapping("/userShipperApi/querySaleCreditLimitFeign")
|
||||
public AjaxResult querySaleCreditLimitFeign(@RequestBody UserShipperFeignDTO userShipperDTO);
|
||||
|
||||
@GetMapping("/userApi/getUserByUserAccount")
|
||||
R<LoginUser> getUserByUserAccount(@RequestParam("userAccount") String account);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mhd.system.api;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mhd.common.core.constant.ServiceNameConstants;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
@@ -97,6 +98,18 @@ public interface WmsServiceFeign {
|
||||
@PostMapping(value = "/stockInOrderApi/omsInOrderAdd")
|
||||
public void omsInOrderAdd(@RequestBody StockInOrder stockInOrder);
|
||||
|
||||
@ApiOperation("oms取消下发单保存")
|
||||
@PostMapping(value = "/stockOutOrderApi/cancelExecutionOrder")
|
||||
public void omsCancelExecutionOrder(@RequestBody StockOutOrder stockOutOrder);
|
||||
|
||||
@ApiOperation("oms取消下发单自动分配")
|
||||
@PostMapping(value = "/stockOutOrderApi/omsAutoAssign")
|
||||
public void omsAutoAssign(@RequestBody StockOutOrderDTO stockOutOrderDTO);
|
||||
|
||||
@ApiOperation("oms出库执行")
|
||||
@PostMapping(value = "/stockOutOrderApi/execution")
|
||||
public AjaxResult execution(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
|
||||
|
||||
/**
|
||||
* oms下发单明细保存
|
||||
*/
|
||||
@@ -115,4 +128,17 @@ public interface WmsServiceFeign {
|
||||
@RequestParam(value = "pushTime",required = false) String pushTime,
|
||||
@RequestParam(value = "pushBy",required = false) Long pushBy,
|
||||
@RequestParam(value = "pushByName",required = false) String pushByName);
|
||||
|
||||
/**
|
||||
* 根据物料ID列表批量查询物料信息
|
||||
*/
|
||||
@GetMapping("/materialBaseInfoApi/getBatchByIds")
|
||||
public TableDataInfo getBatchByIds(@RequestParam("materialBaseInfoIds") List<Long> materialBaseInfoIds);
|
||||
|
||||
/**
|
||||
* 生成拣货单
|
||||
*/
|
||||
@ApiOperation("生成拣货单")
|
||||
@PostMapping("/stockOutOrderApi/genPickingOrderByOms")
|
||||
public AjaxResult genPickingOrderByOms(@RequestBody com.mhd.system.api.domain.StockOutOrderDTO stockOutOrderDTO);
|
||||
}
|
||||
+2
@@ -84,4 +84,6 @@ public class MaterialInventoryOmsParamDO extends BaseVOEntity {
|
||||
//过期日期
|
||||
private Date expiryDate;
|
||||
|
||||
private String executioOrderNumber;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
package com.mhd.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库单对象 stock_out_order
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-28
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class StockOutOrderDTO extends BaseVOEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("出库单id")
|
||||
private Long outOrderId;
|
||||
|
||||
@ApiModelProperty("组织表ID")
|
||||
@Excel(name = "组织表ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
@Excel(name = "组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("一级组织表ID")
|
||||
@Excel(name = "一级组织表ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("通知单号")
|
||||
@Excel(name = "通知单号")
|
||||
private String noticeNumber;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
@Excel(name = "出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
|
||||
private Integer auditStatus;
|
||||
|
||||
@ApiModelProperty("出库单审核备注")
|
||||
@Excel(name = "出库单审核备注")
|
||||
private String auditRemark;
|
||||
|
||||
@ApiModelProperty("出库单审核人")
|
||||
@Excel(name = "出库单审核人")
|
||||
private Long auditBy;
|
||||
|
||||
@ApiModelProperty("出库单审核人姓名")
|
||||
@Excel(name = "出库单审核人姓名")
|
||||
private String auditByName;
|
||||
|
||||
@ApiModelProperty("出库单审核时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@Excel(name = "出库单审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date auditTime;
|
||||
|
||||
@ApiModelProperty("仓库id")
|
||||
@Excel(name = "仓库id")
|
||||
private Long warehouseId;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
@Excel(name = "仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("仓库名称")
|
||||
@Excel(name = "仓库名称")
|
||||
private String warehouseName;
|
||||
|
||||
@ApiModelProperty("货主id")
|
||||
@Excel(name = "货主id")
|
||||
private Long shipperId;
|
||||
|
||||
@ApiModelProperty("货主编码")
|
||||
@Excel(name = "货主编码")
|
||||
private String shipperCode;
|
||||
|
||||
@ApiModelProperty("货主名称")
|
||||
@Excel(name = "货主名称")
|
||||
private String shipperName;
|
||||
|
||||
@ApiModelProperty("出库单类型编码")
|
||||
@Excel(name = "出库单类型编码")
|
||||
private String orderTypeCode;
|
||||
|
||||
@ApiModelProperty("出库单类型名称")
|
||||
@Excel(name = "出库单类型名称")
|
||||
private String orderTypeName;
|
||||
|
||||
@ApiModelProperty("客户id")
|
||||
@Excel(name = "客户id")
|
||||
private Long customerId;
|
||||
|
||||
@ApiModelProperty("客户编码")
|
||||
@Excel(name = "客户编码")
|
||||
private String customerCode;
|
||||
|
||||
@ApiModelProperty("客户名称")
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty("预计出货时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Excel(name = "预计出货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date expectTime;
|
||||
|
||||
@ApiModelProperty("供应链订单号")
|
||||
@Excel(name = "供应链订单号")
|
||||
private String supplyChainNumber;
|
||||
|
||||
@ApiModelProperty("优先级别编码")
|
||||
@Excel(name = "优先级别编码")
|
||||
private String priorityLevelCode;
|
||||
|
||||
@ApiModelProperty("优先级别名称")
|
||||
@Excel(name = "优先级别名称")
|
||||
private String priorityLevelName;
|
||||
|
||||
@ApiModelProperty("是否直接出库: 1-是 2-否")
|
||||
@Excel(name = "是否直接出库: 1-是 2-否")
|
||||
private Integer directWarehouse;
|
||||
|
||||
@ApiModelProperty("是否复核: 1-是 2-否")
|
||||
@Excel(name = "是否复核: 1-是 2-否")
|
||||
private Integer review;
|
||||
|
||||
@ApiModelProperty("附件url")
|
||||
@Excel(name = "附件url")
|
||||
private String annexUrl;
|
||||
|
||||
@ApiModelProperty("物料种数")
|
||||
@Excel(name = "物料种数")
|
||||
private Integer materialQuantity;
|
||||
|
||||
@ApiModelProperty("计划数量")
|
||||
@Excel(name = "计划数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ApiModelProperty("净重 单位:千克")
|
||||
@Excel(name = "净重 单位:千克")
|
||||
private BigDecimal weightLimit;
|
||||
|
||||
@ApiModelProperty("体积 单位:立方米")
|
||||
@Excel(name = "体积 单位:立方米")
|
||||
private BigDecimal volumeLimit;
|
||||
|
||||
@ApiModelProperty("分配数量")
|
||||
@Excel(name = "分配数量")
|
||||
private BigDecimal allocationQuantity;
|
||||
|
||||
|
||||
@ApiModelProperty("已生成拣货单数量")
|
||||
@Excel(name = "已生成拣货单分配数量")
|
||||
private BigDecimal alreadyAllocationQuantity;
|
||||
|
||||
@ApiModelProperty("拣货数量")
|
||||
@Excel(name = "拣货数量")
|
||||
private BigDecimal pickingQuantity;
|
||||
|
||||
@ApiModelProperty("复核数量")
|
||||
@Excel(name = "复核数量")
|
||||
private BigDecimal checkQuantity;
|
||||
|
||||
@ApiModelProperty("是否取消订单: 1-是 2-否")
|
||||
@Excel(name = "是否取消订单: 1-是 2-否")
|
||||
private Integer cancelOrder;
|
||||
|
||||
@ApiModelProperty("取消订单备注")
|
||||
@Excel(name = "取消订单备注")
|
||||
private String cancelRemark;
|
||||
|
||||
@ApiModelProperty("取消订单人")
|
||||
@Excel(name = "取消订单人")
|
||||
private Long cancelBy;
|
||||
|
||||
@ApiModelProperty("取消订单人姓名")
|
||||
@Excel(name = "取消订单人姓名")
|
||||
private String cancelByName;
|
||||
|
||||
@ApiModelProperty("取消订单时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@Excel(name = "取消订单时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date cancelTime;
|
||||
|
||||
@ApiModelProperty("是否关闭订单: 1-是 2-否")
|
||||
@Excel(name = "是否关闭订单: 1-是 2-否")
|
||||
private Integer closeOrder;
|
||||
|
||||
@ApiModelProperty("关闭订单备注")
|
||||
@Excel(name = "关闭订单备注")
|
||||
private String closeRemark;
|
||||
|
||||
@ApiModelProperty("关闭订单人")
|
||||
@Excel(name = "关闭订单人")
|
||||
private Long closeBy;
|
||||
|
||||
@ApiModelProperty("关闭订单人姓名")
|
||||
@Excel(name = "关闭订单人姓名")
|
||||
private String closeByName;
|
||||
|
||||
@ApiModelProperty("关闭订单时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@Excel(name = "关闭订单时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date closeTime;
|
||||
|
||||
@ApiModelProperty("复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
@Excel(name = "复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
private Integer checkStatus;
|
||||
|
||||
@ApiModelProperty("复核任务是否下发: 1-是 2-否")
|
||||
@Excel(name = "复核任务是否下发: 1-是 2-否")
|
||||
private Integer checkTaskDistribution;
|
||||
|
||||
@ApiModelProperty("复核任务下发时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "复核任务下发时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date checkTaskDistributionTime;
|
||||
|
||||
@ApiModelProperty("复核作业人用户ID")
|
||||
@Excel(name = "复核作业人用户ID")
|
||||
@JsonAlias({"checkOperatorId", "operatorId"})
|
||||
private Long checkOperatorsBy;
|
||||
|
||||
@ApiModelProperty("复核作业人姓名")
|
||||
@Excel(name = "复核作业人姓名")
|
||||
private String checkOperatorsName;
|
||||
|
||||
@ApiModelProperty("调度单号")
|
||||
@Excel(name = "调度单号")
|
||||
private String mobilizeCode;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "组织ID集合")
|
||||
private List<Long> organizationIdList;
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("出库单id集合")
|
||||
private List<Long> outOrderIds;
|
||||
|
||||
// @ApiModelProperty("物料明细")
|
||||
// private List<OutMaterialDetailDTO> materialDetailList;
|
||||
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
@ApiModelProperty("物料审核数量")
|
||||
@Excel(name = "物料审核数量")
|
||||
private BigDecimal actualQuantity;
|
||||
|
||||
@ApiModelProperty("波次类型编码")
|
||||
private String waveOrderTypeCode;
|
||||
|
||||
@ApiModelProperty("大于复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
private Integer gtCheckStatus;
|
||||
|
||||
@ApiModelProperty("小于复核状态: 1-未复核 2-复核中 3-已复核")
|
||||
private Integer ltCheckStatus;
|
||||
|
||||
@ApiModelProperty("PDA复核查询tab: 1-列表(待复核) 2-历史记录(已复核)")
|
||||
private Integer tabType;
|
||||
|
||||
@ApiModelProperty("to")
|
||||
@Excel(name = "to")
|
||||
private String to;
|
||||
|
||||
@ApiModelProperty("联系人")
|
||||
@Excel(name = "联系人")
|
||||
private String contactPerson;
|
||||
|
||||
@ApiModelProperty("车型及车牌")
|
||||
@Excel(name = "车型及车牌")
|
||||
private String vehicleModelPlate;
|
||||
|
||||
@ApiModelProperty("委托编号")
|
||||
@Excel(name = "委托编号")
|
||||
private String entrustNo;
|
||||
|
||||
@ApiModelProperty("Tel")
|
||||
@Excel(name = "Tel")
|
||||
private String tel;
|
||||
|
||||
@ApiModelProperty("司机签名")
|
||||
@Excel(name = "司机签名")
|
||||
private String driverSign;
|
||||
|
||||
@ApiModelProperty("Fax")
|
||||
@Excel(name = "Fax")
|
||||
private String fax;
|
||||
|
||||
@ApiModelProperty("申报地关区")
|
||||
@Excel(name = "申报地关区")
|
||||
private String declareCustoms;
|
||||
|
||||
@ApiModelProperty("生产商")
|
||||
@Excel(name = "生产商")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("报关员姓名及联系方式")
|
||||
@Excel(name = "报关员姓名及联系方式")
|
||||
private String customsDeclarerInfo;
|
||||
|
||||
@ApiModelProperty("送货地址")
|
||||
@Excel(name = "送货地址")
|
||||
private String deliveryAddr;
|
||||
|
||||
@ApiModelProperty("进出境关别")
|
||||
@Excel(name = "进出境关别")
|
||||
private String entryExitCustoms;
|
||||
|
||||
@ApiModelProperty("起运/运抵国(地区)")
|
||||
@Excel(name = "起运/运抵国(地区)")
|
||||
private String departureArrivalCountry;
|
||||
|
||||
@ApiModelProperty("承运商")
|
||||
@Excel(name = "承运商")
|
||||
private String carrier;
|
||||
|
||||
@ApiModelProperty("柜号")
|
||||
@Excel(name = "柜号")
|
||||
private String containerNo;
|
||||
|
||||
@ApiModelProperty("柜")
|
||||
@Excel(name = "柜")
|
||||
private String containerNoName;
|
||||
|
||||
@ApiModelProperty("出仓日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date outboundDate;
|
||||
@ApiModelProperty("完成时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date completeTime;
|
||||
@ApiModelProperty("orderDate")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "orderDate", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date orderDate;
|
||||
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeCode;
|
||||
@ApiModelProperty("运输方式")
|
||||
@Excel(name = "运输方式")
|
||||
private String transportModeName;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeCode;
|
||||
@ApiModelProperty("监管方式")
|
||||
@Excel(name = "监管方式")
|
||||
private String supervisionModeName;
|
||||
@ApiModelProperty("海关是否查验货物")
|
||||
@Excel(name = "海关是否查验货物")
|
||||
private String customsInspectionFlag;
|
||||
@ApiModelProperty("是否需要报关")
|
||||
@Excel(name = "是否需要报关")
|
||||
private String needDeclareFlag;
|
||||
@ApiModelProperty("是否需要运输")
|
||||
@Excel(name = "是否需要运输")
|
||||
private String needTransportFlag;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件开始日期")
|
||||
private String createTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "创建时间查询条件结束日期")
|
||||
private String createTimeEnd;
|
||||
|
||||
@ApiModelProperty(name = "审核时间查询条件开始日期")
|
||||
private String auditTimeStart;
|
||||
|
||||
@ApiModelProperty(name = "审核时间查询条件结束日期")
|
||||
private String auditTimeEnd;
|
||||
|
||||
@ApiModelProperty("出库明细-物料名称(商品名称),模糊匹配,与前端参数 materialName 一致")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("出库明细-物料编码,模糊匹配,与前端参数 materialCode 一致")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("出库交接图片,PDA出库交接时上传的照片,多张图片以逗号隔开")
|
||||
private String pictureApp;
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
@Excel(name = "业务单号")
|
||||
private String businessOrderNo;
|
||||
|
||||
@ApiModelProperty("业务类型")
|
||||
@Excel(name = "业务类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty("制单人")
|
||||
@Excel(name = "制单人")
|
||||
private String documentCreator;
|
||||
|
||||
@ApiModelProperty("制单人名称")
|
||||
@Excel(name = "制单人名称")
|
||||
private String documentCreatorName;
|
||||
|
||||
@ApiModelProperty("制单日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "制单日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date documentDate;
|
||||
@ApiModelProperty("承运商名称")
|
||||
@Excel(name = "承运商名称")
|
||||
private String carrierName;
|
||||
@ApiModelProperty("计费信息")
|
||||
private String billingJson;
|
||||
@ApiModelProperty("结算币种")
|
||||
private String settlementCurrency;
|
||||
@ApiModelProperty("业务员ID")
|
||||
private String salesmanId;
|
||||
@ApiModelProperty("业务员名称")
|
||||
private String salesmanName;
|
||||
// @ApiModelProperty("费用")
|
||||
// List<ReceiptOrderAccount> receiptOrderAccountList;
|
||||
@ApiModelProperty("退货数量")
|
||||
@Excel(name = "退货数量")
|
||||
private BigDecimal returnQuantity;
|
||||
/**
|
||||
* 提货单打印所选模版(与图5单选项文案一致即可)。可传副标题如「谷丰--营销部」,或整段「提货单--谷丰--营销部」;不传则标题为「提货单」
|
||||
*/
|
||||
@ApiModelProperty("提货单打印模版名/弹窗选项全文;后端生成 printTitle(-- 会规范为 ——)")
|
||||
private String noticePrintTemplateName;
|
||||
@ApiModelProperty("车次")
|
||||
@Excel(name = "车次")
|
||||
private Integer trainNo;
|
||||
@ApiModelProperty("推送状态:1-未推送,2-推送中,3-推送成功,4-推送失败")
|
||||
private Integer pushStatus;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("推送时间")
|
||||
private Date pushTime;
|
||||
|
||||
@ApiModelProperty("推送人")
|
||||
private Long pushBy;
|
||||
|
||||
@ApiModelProperty("推送人姓名")
|
||||
private String pushByName;
|
||||
@ApiModelProperty(value = "推送时间起")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date pushTimeFrom;
|
||||
|
||||
@ApiModelProperty(value = "推送时间止")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date pushTimeTo;
|
||||
|
||||
@ApiModelProperty(value = "推送时间起")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTimeFrom;
|
||||
|
||||
@ApiModelProperty(value = "推送时间止")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTimeTo;
|
||||
}
|
||||
@@ -46,8 +46,8 @@ TmsOrderAddDTO implements Serializable {
|
||||
@ApiModelProperty(value = "装货电话")
|
||||
private String loadingPhone="";
|
||||
@ApiModelProperty(value = "装货时间日期(年月日)",required = true)
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date loadingDate;
|
||||
// @ApiModelProperty(value = "装货时间(上午、下午、24小时)")
|
||||
// private String loadingTime="";
|
||||
|
||||
+7
-1
@@ -116,6 +116,12 @@ public class WarehouseFeignPO extends BaseVOEntity{
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -284,6 +284,10 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
||||
return AjaxResult.error("查询失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getInfoByCustomerAndSecondSubjectCode(String settlementCustomersCode, Integer contractType, String firstSubjectCode, Long topOrganizationId, Long organizationId) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public AjaxResult getInfoByCustomer2(String settlementCustomersCode, Integer contractType, Long topOrganizationId) {
|
||||
return AjaxResult.error("查询失败");
|
||||
@@ -310,4 +314,4 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -170,6 +170,11 @@ public class RemoteUserFeignFallbackFactory implements FallbackFactory<UserServi
|
||||
return R.fail("获取组织用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<LoginUser> getUserByUserAccount(String userAccount) {
|
||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<LoginUser> getUserByTopOrganizationUserPhone(@RequestBody UserDTO userDTO, String source) {
|
||||
return R.fail("获取组织用户失败:" + throwable.getMessage());
|
||||
|
||||
+29
@@ -73,6 +73,21 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
||||
public void omsInOrderAdd(StockInOrder stockInOrder) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void omsCancelExecutionOrder(StockOutOrder stockOutOrder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void omsAutoAssign(StockOutOrderDTO stockOutOrderDTO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult execution(StockOutOrderDTO stockOutOrderDTO) {
|
||||
return AjaxResult.error(cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void omsInOrderAddDetail(List<InMaterialDetail> inMaterialDetails) {
|
||||
}
|
||||
@@ -90,6 +105,20 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
||||
public AjaxResult<?> updateMaterialPushStatus(Long materialBaseInfoId, Integer pushStatus, String pushTime, Long pushBy, String pushByName) {
|
||||
return AjaxResult.error(cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo getBatchByIds(List<Long> materialBaseInfoIds) {
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setData(new ArrayList<>());
|
||||
tableDataInfo.setTotal(0);
|
||||
tableDataInfo.setCode(500);
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult genPickingOrderByOms(StockOutOrderDTO stockOutOrderDTO) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+36
-2
@@ -40,6 +40,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -107,11 +108,14 @@ public class TokenLoginApplicationService {
|
||||
//租户一级组织ID
|
||||
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(topOrganizationIdR.get("data")), SysTenantsPo.class);
|
||||
Long topOrganizationId = sysTenantsPo.getOrganizationId();
|
||||
// 获取用户选择的组织ID,未选则使用一级组织ID
|
||||
Long selectedOrgId = loginDTO.getOrganizationId();
|
||||
Long organizationId = (selectedOrgId != null) ? selectedOrgId : topOrganizationId;
|
||||
//获取用户信息,组装dto
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setUserPhone(userPhone);
|
||||
userDTO.setTopOrganizationId(topOrganizationId);
|
||||
userDTO.setOrganizationId(topOrganizationId);
|
||||
userDTO.setOrganizationId(organizationId);
|
||||
// 查询用户信息,查询组织下用户是否存在
|
||||
R<LoginUser> userResult = userServiceFeign.getUserByTopOrganizationUserPhone(userDTO, SecurityConstants.INNER);
|
||||
if (R.FAIL == userResult.getCode()) {
|
||||
@@ -153,7 +157,8 @@ public class TokenLoginApplicationService {
|
||||
}else {
|
||||
userDTO.setBusinessType(4);
|
||||
}
|
||||
userDTO.setOrganizationName(sysTenantsPo.getOrganizationName());
|
||||
userDTO.setOrganizationName(StringUtils.isNotBlank(loginDTO.getOrganizationName())
|
||||
? loginDTO.getOrganizationName() : sysTenantsPo.getOrganizationName());
|
||||
userResult = userServiceFeign.registerAddUser(userDTO, SecurityConstants.INNER);
|
||||
userInfo = userResult.getData();
|
||||
} else {
|
||||
@@ -379,6 +384,10 @@ public class TokenLoginApplicationService {
|
||||
throw new ServiceException("用户不存在/密码错误");
|
||||
}
|
||||
}
|
||||
// 验证码登录时 userInfo.getUserPo() 可能为null,加保护
|
||||
if (userInfo == null || userInfo.getUserPo() == null || userInfo.getUserPo().getOrganizationId() == null) {
|
||||
throw new ServiceException("登录用户组织信息不完整,请联系管理员");
|
||||
}
|
||||
R<OrganizationPo> organizationInfo = organizationServiceFeign.getInfoForIdList(userInfo.getUserPo().getOrganizationId());
|
||||
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
|
||||
throw new ServiceException("登录用户组织不存在");
|
||||
@@ -569,4 +578,29 @@ public class TokenLoginApplicationService {
|
||||
sysPasswordService.validateByWms(userPo, verificationCode, 1);
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据域名获取组织信息(免Token,供司机APP注册时选择组织用)
|
||||
*/
|
||||
public AjaxResult getOrganizationByPath(String path) {
|
||||
if (StringUtils.isBlank(path)) {
|
||||
return AjaxResult.error("域名不能为空");
|
||||
}
|
||||
try {
|
||||
AjaxResult result = organizationServiceFeign.getOrganizationByPath(path);
|
||||
if (ObjectUtil.isNull(result) || ObjectUtil.isNull(result.get("data"))) {
|
||||
return AjaxResult.error("未找到对应组织");
|
||||
}
|
||||
SysTenantsPo sysTenantsPo = JSON.parseObject(JSON.toJSONString(result.get("data")), SysTenantsPo.class);
|
||||
Long topOrganizationId = sysTenantsPo.getOrganizationId();
|
||||
// 返回一级组织ID和名称,前端可据此展示组织选择
|
||||
Map<String, Object> data = new java.util.HashMap<>();
|
||||
data.put("organizationId", topOrganizationId);
|
||||
data.put("organizationName", sysTenantsPo.getOrganizationName());
|
||||
return AjaxResult.success(data);
|
||||
} catch (Exception e) {
|
||||
log.error("获取组织信息失败, path={}", path, e);
|
||||
return AjaxResult.error("获取组织信息失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,10 @@ public class LoginDTO {
|
||||
@ApiModelProperty(name = "APP包名")
|
||||
private String appMark;
|
||||
|
||||
@ApiModelProperty(name = "组织ID(司机选择组织,不传默认一级组织)")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty(name = "组织名称(司机选择组织时传入)")
|
||||
private String organizationName;
|
||||
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.utils.JwtUtils;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.security.annotation.RepeatSubmit;
|
||||
import com.mhd.common.security.auth.AuthUtil;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -75,6 +77,15 @@ public class AppTokenController extends BaseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据域名获取组织信息(免Token,供司机APP注册时选择组织用)
|
||||
*/
|
||||
@ApiOperation("根据域名获取组织信息")
|
||||
@GetMapping("/getOrganizationByPath/{path}")
|
||||
public AjaxResult getOrganizationByPath(@PathVariable("path") String path) {
|
||||
return tokenLoginApplicationService.getOrganizationByPath(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Description wms 新登录接口
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.mhd.auth.system.controller;
|
||||
|
||||
import com.mhd.auth.system.service.SsoAuthorizeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SSO单点登录控制器
|
||||
* 子系统端实现:接收中台传递的签名参数,验签后自动登录并重定向
|
||||
*
|
||||
* @author mhd
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
@CrossOrigin
|
||||
public class SsoAuthorizeController {
|
||||
|
||||
@Autowired
|
||||
private SsoAuthorizeService ssoAuthorizeService;
|
||||
|
||||
/**
|
||||
* SSO单点登录授权接口
|
||||
* 中台点击子系统链接后,将签名参数传递给此接口
|
||||
* 验签通过后自动登录并重定向到前端页面,携带token
|
||||
*
|
||||
* @param signature 签名信息(Base64编码后再URL编码),签名源数据格式:appkey=xxx&account=xxx×tamp=xxxxxx
|
||||
* @param appkey 对方的应用key,值固定为nanguang
|
||||
* @param account 账号
|
||||
* @param timestamp 当前时间戳(毫秒),用于防止签名被盗用,超过24小时视为失效
|
||||
*/
|
||||
@GetMapping("/sso-authorize")
|
||||
public void ssoAuthorize(@RequestParam("signature") String signature,
|
||||
@RequestParam("appkey") String appkey,
|
||||
@RequestParam("account") String account,
|
||||
@RequestParam("timestamp") Long timestamp,
|
||||
HttpServletResponse response) throws IOException {
|
||||
log.info("SSO单点登录请求, appkey={}, account={}, timestamp={}", appkey, account, timestamp);
|
||||
|
||||
String redirectUrl = ssoAuthorizeService.getRedirectUrl();
|
||||
|
||||
try {
|
||||
// 1. 校验时间戳是否超过24小时,防止签名被盗用
|
||||
long ONE_DAY_MILLIS = 24L * 60 * 60 * 1000;
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if ((currentTime - timestamp) > ONE_DAY_MILLIS) {
|
||||
log.warn("SSO签名已过期, appkey={}, account={}, timestamp={}, 距今{}小时",
|
||||
appkey, account, timestamp, (currentTime - timestamp) / (60 * 60 * 1000));
|
||||
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:签名已超过24小时,请重新发起", StandardCharsets.UTF_8.name()));
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 构造签名源数据(包含timestamp)
|
||||
String sourceData = "appkey=" + appkey + "&account=" + account + "×tamp=" + timestamp;
|
||||
|
||||
// 3. 验证签名
|
||||
boolean verifyResult = ssoAuthorizeService.verifySignature(sourceData, signature);
|
||||
if (!verifyResult) {
|
||||
log.warn("SSO验签失败, appkey={}, account={}, timestamp={}", appkey, account, timestamp);
|
||||
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:签名验证不通过", StandardCharsets.UTF_8.name()));
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. 验签通过,使用account进行登录,获取token
|
||||
Map<String, Object> loginResult = ssoAuthorizeService.ssoLogin(account);
|
||||
String accessToken = (String) loginResult.get("access_token");
|
||||
|
||||
// 5. 重定向到前端页面,token通过URL参数传递
|
||||
// 前端页面需读取URL中的token参数并存入localStorage
|
||||
log.info("SSO单点登录成功, account={}", account);
|
||||
response.sendRedirect(redirectUrl + "?token=" + URLEncoder.encode(accessToken, StandardCharsets.UTF_8.name()));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("SSO单点登录异常, appkey={}, account={}, timestamp={}", appkey, account, timestamp, e);
|
||||
response.sendRedirect(redirectUrl + "?msg=" + URLEncoder.encode("登录失败:" + e.getMessage(), StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.mhd.auth.system.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mhd.common.core.constant.CacheConstants;
|
||||
import com.mhd.common.core.constant.Constants;
|
||||
import com.mhd.common.core.constant.SecurityConstants;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
import com.mhd.common.core.domain.po.RolePO;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.enums.UserStatus;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.utils.ServletUtils;
|
||||
import com.mhd.common.core.utils.ip.IpUtil;
|
||||
import com.mhd.common.core.utils.ip.IpUtils;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.log.service.AsyncLogService;
|
||||
import com.mhd.common.security.service.TokenService;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.UserServiceFeign;
|
||||
import com.mhd.system.api.domain.UserDTO;
|
||||
import com.mhd.system.api.domain.UserUpdateDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* SSO单点登录服务
|
||||
*
|
||||
* @author mhd
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SsoAuthorizeService {
|
||||
|
||||
@Value("${sso.public-key}")
|
||||
private String publicKeyStr;
|
||||
|
||||
@Value("https://diglog.namkwong.com.mo/main_app/sso")
|
||||
private String redirectUrl;
|
||||
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
@Resource
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private AsyncLogService asyncLogService;
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
@Resource
|
||||
private com.mhd.auth.app.infrastructure.feign.OrganizationServiceFeign organizationServiceFeign;
|
||||
|
||||
/**
|
||||
* 验证RSA签名
|
||||
*
|
||||
* @param sourceData 签名源数据,格式:appkey=xxx&account=xxx×tamp=xxxxxx
|
||||
* @param signatureStr Base64编码的签名(可能经过URL编码)
|
||||
* @return 验签结果
|
||||
*/
|
||||
public boolean verifySignature(String sourceData, String signatureStr) {
|
||||
try {
|
||||
// Spring @RequestParam 已自动完成 URL 解码,此处直接 Base64 解码即可
|
||||
byte[] signatureBytes = Base64.getDecoder().decode(signatureStr);
|
||||
|
||||
PublicKey publicKey = generatePublicKey(publicKeyStr);
|
||||
Signature signature = Signature.getInstance("SHA256withRSA");
|
||||
signature.initVerify(publicKey);
|
||||
signature.update(sourceData.getBytes("UTF-8"));
|
||||
return signature.verify(signatureBytes);
|
||||
} catch (Exception e) {
|
||||
log.error("SSO验签失败, sourceData={}, signature={}", sourceData, signatureStr, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公钥字符串生成PublicKey对象
|
||||
*/
|
||||
private PublicKey generatePublicKey(String keyStr) throws Exception {
|
||||
// 去除头尾标记和空白字符
|
||||
String publicKeyContent = keyStr
|
||||
.replace("-----BEGIN PUBLIC KEY-----", "")
|
||||
.replace("-----END PUBLIC KEY-----", "")
|
||||
.replaceAll("\\s+", "");
|
||||
byte[] keyBytes = Base64.getDecoder().decode(publicKeyContent);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
java.security.spec.X509EncodedKeySpec keySpec = new java.security.spec.X509EncodedKeySpec(keyBytes);
|
||||
return keyFactory.generatePublic(keySpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* SSO登录:根据account查找用户并创建token
|
||||
*
|
||||
* @param account 账号
|
||||
* @return 包含token等信息的Map
|
||||
*/
|
||||
public Map<String, Object> ssoLogin(String account) {
|
||||
// 根据账号查找用户(SSO登录不区分组织,仅通过userAccount查询)
|
||||
R<LoginUser> userResult = userServiceFeign.getUserByUserAccount(account);
|
||||
if (R.FAIL == userResult.getCode()) {
|
||||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
if (userResult.getData() == null) {
|
||||
throw new ServiceException("SSO登录用户不存在:" + account);
|
||||
}
|
||||
|
||||
LoginUser userInfo = userResult.getData();
|
||||
UserPo userPo = userInfo.getUserPo();
|
||||
|
||||
// 校验用户状态
|
||||
if (userPo == null) {
|
||||
throw new ServiceException("SSO登录用户信息异常:" + account);
|
||||
}
|
||||
// 删除标记
|
||||
if (UserStatus.DELETED.getCode().equals(String.valueOf(userPo.getDelFlag()))) {
|
||||
throw new ServiceException("对不起,您的账号:" + account + " 已被删除");
|
||||
}
|
||||
// 用户状态
|
||||
if (UserStatus.DELETED.getCode().equals(String.valueOf(userPo.getUserStatus()))) {
|
||||
throw new ServiceException("对不起,您的账号:" + account + " 已停用");
|
||||
}
|
||||
|
||||
// 获取组织信息
|
||||
com.mhd.common.core.domain.entity.R<OrganizationPo> organizationInfo = organizationServiceFeign.getInfoForIdList(userPo.getOrganizationId());
|
||||
if (ObjectUtil.isNull(organizationInfo) || ObjectUtil.isNull(organizationInfo.getData())) {
|
||||
throw new ServiceException("登录用户组织不存在");
|
||||
}
|
||||
userInfo.setOrganizationPo(organizationInfo.getData());
|
||||
|
||||
// 查询用户角色
|
||||
AjaxResult roleListAjaxResult = userServiceFeign.getRoleListByUserId(userPo.getUserId());
|
||||
if ("200".equals(String.valueOf(roleListAjaxResult.get("code"))) && ObjectUtil.isNotNull(roleListAjaxResult.get("data"))) {
|
||||
List<RolePO> rolePOS = JSONUtil.toList(JSONUtil.toJsonStr(roleListAjaxResult.get("data")), RolePO.class);
|
||||
if (rolePOS != null && !rolePOS.isEmpty()) {
|
||||
userInfo.setRoleList(rolePOS.stream().map(RolePO::getRoleName).collect(Collectors.toList()));
|
||||
userInfo.setRoleIdList(rolePOS.stream().map(RolePO::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
// 更新登录信息
|
||||
UserUpdateDTO userUpdateDTO = new UserUpdateDTO();
|
||||
userUpdateDTO.setLastLoginTime(new Date());
|
||||
userUpdateDTO.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||
userUpdateDTO.setUserName(account);
|
||||
userServiceFeign.updateWhenLogin(userUpdateDTO, SecurityConstants.INNER);
|
||||
|
||||
// 创建token
|
||||
Map<String, Object> result = tokenService.createTokenApi(userInfo);
|
||||
|
||||
// 记录登录日志
|
||||
recordLogininfor(userPo, Constants.LOGIN_SUCCESS, "SSO单点登录成功", 1);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*/
|
||||
private void recordLogininfor(UserPo userPo, String status, String message, Integer behaviorType) {
|
||||
com.mhd.system.api.domain.SysLogininforPo logininfor = new com.mhd.system.api.domain.SysLogininforPo();
|
||||
logininfor.setUserAccount(userPo.getUserAccount());
|
||||
logininfor.setUserName(userPo.getUserName());
|
||||
logininfor.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||
logininfor.setLocation(StrUtil.isNotEmpty(logininfor.getIpaddr()) ? IpUtil.getLocationSplicing(logininfor.getIpaddr()) : "");
|
||||
logininfor.setBehaviorType(behaviorType);
|
||||
logininfor.setMsg(message);
|
||||
logininfor.setOrganizationId(userPo.getOrganizationId());
|
||||
logininfor.setOrganizationName(userPo.getOrganizationName());
|
||||
logininfor.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
logininfor.setAccessTime(cn.hutool.core.date.DateUtil.date());
|
||||
if (org.apache.commons.lang3.StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) {
|
||||
logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS);
|
||||
} else if (Constants.LOGIN_FAIL.equals(status)) {
|
||||
logininfor.setStatus(Constants.LOGIN_FAIL_STATUS);
|
||||
}
|
||||
asyncLogService.saveLogininfor(logininfor);
|
||||
}
|
||||
|
||||
public String getRedirectUrl() {
|
||||
return redirectUrl;
|
||||
}
|
||||
}
|
||||
@@ -14,24 +14,42 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.102.192.30:6848
|
||||
# 测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.102.192.5:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
file-extension: yml #默认properties
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
# SSO单点登录配置
|
||||
sso:
|
||||
# RSA公钥(由中台openssl私钥导出)
|
||||
public-key: |
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62dYkl2Nvy2wW9028dQ7
|
||||
HdxFNhwEriFNzFMFq+m1jTvZWdU6e9a1iCGWTVV2fTo4PWSyhjWyzv2ZBEuanWBq
|
||||
y/bfh/jOTjT/tlWvMeJZ1TV4suCbigHq5TGxDsY6ZC6if9ULhU3NWkgnPNn6HfO9
|
||||
NVvBTfx9MgWtCtT33kq30KgxC6LqVdCe08+gD0KB3df0DK8OJorVFfxYVc7TjGEL
|
||||
xqUuE7PcgZgDb8KvdgO66OxBqFIB0qfc73oALKGoq/8kvjrqE/amaIZPv3jE2Rc7
|
||||
0rIhGHrFcoA3W01nNRGQKY/E/VKOGBn/uDNdi5iMXsFjKxiBbXB07bBxdhUH7698
|
||||
AwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
# SSO登录成功后跳转的前端页面地址
|
||||
redirect-url: "/"
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -17,6 +18,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@ApiModel("BI-港澳服务专区")
|
||||
public class HkMacaoServiceZoneVO {
|
||||
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -11,6 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@ApiModel("BI-港澳服务专区-地图点位")
|
||||
public class HkMapPointVO {
|
||||
|
||||
|
||||
+21
@@ -1,5 +1,6 @@
|
||||
package com.mhd.bi.interfaces.facadeApi.biReport.vo.hkMacaoZone;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -38,4 +39,24 @@ public class HkVehicleDetailsVO {
|
||||
@JsonProperty("update_time")
|
||||
@ApiModelProperty("更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty("状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("运输方向")
|
||||
private String direction;
|
||||
|
||||
@ApiModelProperty("货物类型")
|
||||
private String cargo;
|
||||
|
||||
@ApiModelProperty("预计到达时间")
|
||||
private String eta;
|
||||
|
||||
@JsonProperty("transportion_number")
|
||||
@ApiModelProperty("运单号")
|
||||
private String transportionNumber;
|
||||
|
||||
@JsonProperty("cargo_source")
|
||||
@ApiModelProperty("货源")
|
||||
private String cargoSource;
|
||||
}
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@ public class TmsAddressMultiDTO {
|
||||
@ApiModelProperty(value = "装卸货联系人电话")
|
||||
private String contactPhone;
|
||||
@ApiModelProperty(value = "装卸货日期(年月日)")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date layDate;
|
||||
@ApiModelProperty(value = "装卸货时间(上午、下午、24小时)")
|
||||
private String layTime;
|
||||
|
||||
+4
@@ -271,4 +271,8 @@ public class UserShipperPo {
|
||||
|
||||
@ApiModelProperty("货主code")
|
||||
private String roleCodeShipper;
|
||||
@ApiModelProperty(name = "是否校验信用")
|
||||
private String isCheckCredit;
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
}
|
||||
+3
@@ -46,6 +46,9 @@ public class MdmMerchantRecordDTO implements Serializable {
|
||||
@ApiModelProperty("电子邮件")
|
||||
private String desc16;
|
||||
|
||||
@ApiModelProperty("nc编码")
|
||||
private String desc17;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String desc23;
|
||||
|
||||
|
||||
+1
-10
@@ -95,21 +95,12 @@ public final class MdmMerchantSyncFilter {
|
||||
|
||||
public static SkipReason resolveSkipReason(MdmMerchantRecordDTO record, String orgNcCode,
|
||||
Long syncOrganizationId, Long topOrganizationId) {
|
||||
if (record == null || StringUtils.isEmpty(record.getCode())) {
|
||||
if (StringUtils.isEmpty(trim(record.getDesc17()))) {
|
||||
return SkipReason.EMPTY_CODE;
|
||||
}
|
||||
if (!isCustomer(record)) {
|
||||
return SkipReason.NOT_CUSTOMER;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(orgNcCode) && !orgNcCode.equals(trim(record.getCode()))) {
|
||||
return SkipReason.ORG_MISMATCH;
|
||||
}
|
||||
if (StringUtils.isEmpty(trim(record.getDesc1()))) {
|
||||
return SkipReason.MISSING_NAME;
|
||||
}
|
||||
if (isDisabled(record)) {
|
||||
return SkipReason.DISABLED;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +191,7 @@ public class AuthFilter implements GlobalFilter, Ordered
|
||||
|
||||
/**
|
||||
* 获取请求token
|
||||
* 优先从 Authorization 请求头获取,其次从 URL 参数 token 获取(SSO场景)
|
||||
*/
|
||||
private String getToken(ServerHttpRequest request)
|
||||
{
|
||||
@@ -200,6 +201,11 @@ public class AuthFilter implements GlobalFilter, Ordered
|
||||
{
|
||||
token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY);
|
||||
}
|
||||
// 兜底:从URL参数中获取token(SSO单点登录场景,前端尚未存入localStorage时)
|
||||
if (StringUtils.isEmpty(token))
|
||||
{
|
||||
token = request.getQueryParams().getFirst("token");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,19 @@ spring:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
#线上正式环境
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.33.0.129:6010
|
||||
#线上正式环境
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
+108
-14
@@ -268,12 +268,25 @@ public class ContractManageApplicationService {
|
||||
Long organizationId = contractManageDTO.getOrganizationId();
|
||||
String sunjectCode = contractManageDTO.getSubjectCode();
|
||||
Long topOrganizationId = contractManageDTO.getTopOrganizationId();
|
||||
List<ContractManage> UserContractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
||||
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(ContractManage::getDelFlag, 1)
|
||||
.eq(ContractManage::getOrganizationId, organizationId)
|
||||
.eq(ContractManage::getTopOrganizationId, topOrganizationId)
|
||||
.eq(ContractManage::getCommonContractFlag, 2));
|
||||
ContractManageDO contractManageDO = new ContractManageDO();
|
||||
contractManageDO.setOrganizationId(organizationId);
|
||||
contractManageDO.setSettlementCustomersId(settlementCustomersId);
|
||||
contractManageDO.setTopOrganizationId(topOrganizationId);
|
||||
contractManageDO.setCommonContractFlag(2);
|
||||
contractManageDO.setDelFlag(1);
|
||||
contractManageDO.setFirstSubjectCode(sunjectCode);
|
||||
List<ContractManagePO> contractManagePOS = contractManageMapper.queryList(contractManageDO);
|
||||
if (contractManagePOS != null && contractManagePOS.size() > 1) {
|
||||
throw new RuntimeException("同一费用科目存在多条合同,请检查");
|
||||
}
|
||||
List<ContractManage> UserContractManages = new ArrayList<>();
|
||||
if (contractManagePOS != null) {
|
||||
for (ContractManagePO po : contractManagePOS) {
|
||||
ContractManage contractManage = new ContractManage();
|
||||
BeanUtils.copyProperties(po, contractManage);
|
||||
UserContractManages.add(contractManage);
|
||||
}
|
||||
}
|
||||
if (UserContractManages != null && UserContractManages.size() > 0) {
|
||||
//用户合同计费策略
|
||||
calucateSubjectAndPriceStrategy(UserContractManages, organizationId, topOrganizationId, sunjectCode, result);
|
||||
@@ -595,7 +608,8 @@ public class ContractManageApplicationService {
|
||||
通用合同:同一时间段、同一合同类型,只能存在一个
|
||||
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
|
||||
*/
|
||||
checkContract(contractManageDO);
|
||||
//20260702取消同一时间段不能有相同合同校验
|
||||
//checkContract(contractManageDO);
|
||||
handleData(contractManageDO);
|
||||
handleDict(contractManageDO);
|
||||
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
|
||||
@@ -603,7 +617,7 @@ public class ContractManageApplicationService {
|
||||
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
boolean flag = contractManageDomainService.insert(contractManageDO);
|
||||
handleDetils(contractManageDO);
|
||||
handleDetils(contractManageDO, true);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -737,7 +751,7 @@ public class ContractManageApplicationService {
|
||||
/**
|
||||
* 处理合同详情
|
||||
*/
|
||||
private void handleDetils(ContractManageDO contractManageDO) {
|
||||
private void handleDetils(ContractManageDO contractManageDO, boolean isInsert) {
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
@@ -745,6 +759,10 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
//根据合同编码查询保存合同信息
|
||||
ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode1(contractManageDO.getOriginalContractNumber());
|
||||
//修改时,不管前端是否传明细,都需要先删除该合同原有的明细,避免明细为空时老明细仍在
|
||||
if (!isInsert) {
|
||||
contractManageDetailMapper.delete(new LambdaQueryWrapper<ContractManageDetail>().eq(ContractManageDetail::getContractManageId, contractManageDO.getContractManageId()));
|
||||
}
|
||||
//保存合同详情科目
|
||||
List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList();
|
||||
if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){
|
||||
@@ -813,10 +831,13 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
if(null != contractManagePO){
|
||||
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId());
|
||||
if (isInsert) {
|
||||
// 新增/复制时使用新插入的合同ID
|
||||
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
|
||||
} else {
|
||||
// 修改时使用当前正在修改的合同ID,不能用 getInfoByCode1 查到的(避免多条合同 originalContractNumber 相同导致明细错绑)
|
||||
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
|
||||
}
|
||||
//contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
|
||||
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
contractManageDetailDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
@@ -831,9 +852,9 @@ public class ContractManageApplicationService {
|
||||
@Transactional
|
||||
public Boolean update(ContractManageDO contractManageDO) {
|
||||
validateContractType(contractManageDO.getContractType());
|
||||
checkContract(contractManageDO);
|
||||
//checkContract(contractManageDO);
|
||||
handleData(contractManageDO);
|
||||
handleDetils(contractManageDO);
|
||||
handleDetils(contractManageDO, false);
|
||||
handleDict(contractManageDO);
|
||||
return contractManageDomainService.update(contractManageDO);
|
||||
}
|
||||
@@ -935,6 +956,79 @@ public class ContractManageApplicationService {
|
||||
return resultContract;
|
||||
}
|
||||
|
||||
public ContractManagePO getInfoByCustomerAndSecondSubjectCode(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId,String firstSubjectCode) {
|
||||
/*
|
||||
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
|
||||
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
|
||||
*/
|
||||
//获取当前登录人信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser) && topOrganizationId == null) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if(contractType==null){
|
||||
throw new ServiceException("合同类型不能为空");
|
||||
}
|
||||
ContractManagePO resultContract = new ContractManagePO();
|
||||
//查询当前日期在有效期内的合同
|
||||
ContractManageDO queryParam = new ContractManageDO();
|
||||
queryParam.setNowDateString(DateUtil.format(new Date(),"yyyy-MM-dd"));
|
||||
queryParam.setFirstSubjectCode(firstSubjectCode);
|
||||
queryParam.setOrganizationId(organizationId);
|
||||
queryParam.setTopOrganizationId(topOrganizationId);
|
||||
List<ContractManagePO> contractManagePOList = contractManageDomainService.queryList(queryParam);
|
||||
List<ContractManagePO> contractManagePOs = contractManagePOList.stream()
|
||||
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode)
|
||||
&& Objects.equals(item.getContractType(), contractType))
|
||||
.collect(Collectors.toList());
|
||||
if (contractManagePOs != null && contractManagePOs.size() > 1) {
|
||||
resultContract.setIsMany("1");
|
||||
return resultContract;
|
||||
}
|
||||
if(contractManagePOList != null && contractManagePOList.size()>0){
|
||||
if(StringUtils.isNotEmpty(settlementCustomersCode)){
|
||||
//根据结算对象,及合同的类型 查询对应合同信息
|
||||
ContractManagePO contractManagePO = contractManagePOList.stream()
|
||||
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
|
||||
if(null == contractManagePO){
|
||||
resultContract = findGeneralContract(contractManagePOList, contractType);
|
||||
}else {
|
||||
resultContract = contractManagePO;
|
||||
}
|
||||
}else {
|
||||
resultContract = findGeneralContract(contractManagePOList, contractType);
|
||||
}
|
||||
if(null == resultContract){
|
||||
throw new ServiceException("找不到匹配的合同,请重试");
|
||||
}
|
||||
//得到合同后,查询合同明细
|
||||
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(resultContract.getContractManageId());
|
||||
List<ContractManageDetailPO> contractManageDetailSaveList = new ArrayList<>();
|
||||
if(contractManageDetailPOList != null && contractManageDetailPOList.size()>0){
|
||||
//将临时合同中没有,但是通用合同中有的数据过滤出(使用 ObjectUtil.equal 避免 firstSubjectCode/secondSubjectCode 为 null 时 NPE)
|
||||
contractManageDetailSaveList = contractManageDetailPOList.stream().filter(item -> contractManageDetailPOList.stream().noneMatch(item1 -> ObjectUtil.equal(item1.getFirstSubjectCode(), item.getFirstSubjectCode()) && ObjectUtil.equal(item1.getSecondSubjectCode(), item.getSecondSubjectCode()) && item1.getSubjectType()==1)).collect(Collectors.toList());
|
||||
//首先根据结算科目类型将临时合同过滤出
|
||||
List<ContractManageDetailPO> tempContractManageDetailPOList = contractManageDetailPOList.stream().filter(item -> item.getSubjectType()==2).collect(Collectors.toList());
|
||||
//遍历两个集合,将相同费用科目code的数据,进行比较,如果结算科目类型是临时且合同有效期有效,则使用该条数据,将另一条移除
|
||||
for (ContractManageDetailPO manageDetailPO : tempContractManageDetailPOList) {
|
||||
for (ContractManageDetailPO contractManageDetailPO : contractManageDetailPOList) {
|
||||
if(ObjectUtil.equal(contractManageDetailPO.getFirstSubjectCode(), manageDetailPO.getFirstSubjectCode()) && ObjectUtil.equal(contractManageDetailPO.getSecondSubjectCode(), manageDetailPO.getSecondSubjectCode())){
|
||||
//判断如果是临时合同在有效期内,则将该条数据保存到集合contractManageDetailSaveList
|
||||
DateTime start = DateUtil.parseDate(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime end = DateUtil.parseDateTime(DateUtil.format(manageDetailPO.getSubjectEffectiveDate(),"yyyy-MM-dd"));
|
||||
DateTime now = DateUtil.beginOfDay(DateUtil.date());
|
||||
if (now.isAfterOrEquals(start) && now.isBefore(end)) {
|
||||
contractManageDetailSaveList.add(manageDetailPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultContract.setContractManageDetailPOList(contractManageDetailSaveList);
|
||||
}
|
||||
return resultContract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据结算主体获取合同信息
|
||||
* @param settlementCustomersCode 结算主体code
|
||||
|
||||
+9
-1
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -98,6 +99,13 @@ public class WarehouseApplicationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
String orgIds = warehouseDO.getOrgIds();
|
||||
if (StringUtils.isNotEmpty(orgIds)) {
|
||||
String[] orgIdArray = orgIds.split(",");
|
||||
List<Long> orgIdList = Arrays.stream(orgIdArray).map(Long::valueOf).collect(Collectors.toList());
|
||||
warehouseDO.setOrgIdList(orgIdList);
|
||||
warehouseDO.setOrganizationId(null);
|
||||
}
|
||||
return warehouseDomainService.queryList(warehouseDO);
|
||||
}
|
||||
|
||||
@@ -314,4 +322,4 @@ public class WarehouseApplicationService {
|
||||
return warehouseDomainService.getWarehouseChildren(warehouseId, storageLocationType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@ public interface IContractManageService extends IService<ContractManage>
|
||||
/**
|
||||
* 新增合同管理
|
||||
*/
|
||||
public Boolean insert(ContractManageDO contractManageDO);
|
||||
public Long insert(ContractManageDO contractManageDO);
|
||||
|
||||
/**
|
||||
* 修改合同管理
|
||||
|
||||
+3
-2
@@ -37,10 +37,11 @@ public class ContractManageImpl extends ServiceImpl<ContractManageMapper, Contra
|
||||
* 新增合同管理
|
||||
*/
|
||||
@Override
|
||||
public Boolean insert(ContractManageDO contractManageDO) {
|
||||
public Long insert(ContractManageDO contractManageDO) {
|
||||
ContractManage contractManage = new ContractManage();
|
||||
BeanUtils.copyProperties(contractManageDO,contractManage);
|
||||
return this.save(contractManage);
|
||||
this.save(contractManage);
|
||||
return contractManage.getContractManageId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -183,5 +183,5 @@ public class ContractManagePO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
|
||||
private Integer transportationCosts;
|
||||
|
||||
private String isMany;
|
||||
}
|
||||
+2
@@ -214,4 +214,6 @@ public class ContractManageDO extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
|
||||
private Integer transportationCosts;
|
||||
|
||||
@ApiModelProperty("一级费用科目code")
|
||||
private String firstSubjectCode;
|
||||
}
|
||||
+4
-2
@@ -60,8 +60,9 @@ public class ContractManageDomainService {
|
||||
* 新增合同管理
|
||||
*/
|
||||
public Boolean insert(ContractManageDO contractManageDO) {
|
||||
|
||||
return contractManageService.insert(contractManageDO);
|
||||
Long contractManageId = contractManageService.insert(contractManageDO);
|
||||
contractManageDO.setContractManageId(contractManageId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,6 +149,7 @@ public class ContractManageDomainService {
|
||||
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ContractManage::getOriginalContractNumber,contractNumber);
|
||||
queryWrapper.eq(ContractManage::getDelFlag,1);
|
||||
queryWrapper.last("LIMIT 1");
|
||||
ContractManage contractManage = contractManageService.getOne(queryWrapper);
|
||||
if(null != contractManage){
|
||||
BeanUtils.copyProperties(contractManage,contractManagePO);
|
||||
|
||||
+4
-2
@@ -165,6 +165,8 @@ public class StorageLocation extends BaseVOEntity{
|
||||
@ApiModelProperty("是否作废: 1-否 2-是")
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -165,6 +165,8 @@ public class StorageLocationPO extends BaseVOEntity{
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -204,4 +204,8 @@ public class StorageLocationDO extends BaseVOEntity{
|
||||
@ApiModelProperty("坐标-层 终止")
|
||||
@Excel(name = "坐标-层 终止")
|
||||
private String coordinateLayerEnd;
|
||||
}
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
}
|
||||
+31
-1
@@ -68,6 +68,20 @@ public class StorageSectionDomainService {
|
||||
storageSectionDO.getStorageCode(), storageSectionDO.getStorageName(), null);
|
||||
//设置仓库
|
||||
setWarehouseInfo(storageSectionDO);
|
||||
String storageCode = storageSectionDO.getStorageCode();
|
||||
String storageName = storageSectionDO.getStorageName();
|
||||
Long warehouseId = storageSectionDO.getWarehouseId();
|
||||
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getStorageCode, storageCode)
|
||||
.eq(StorageSection::getWarehouseId, warehouseId)
|
||||
.eq(StorageSection::getDelFlag, 1));
|
||||
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getStorageName, storageName)
|
||||
.eq(StorageSection::getWarehouseId, warehouseId)
|
||||
.eq(StorageSection::getDelFlag, 1));
|
||||
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
|
||||
throw new ServiceException("库区编码或名称已存在");
|
||||
}
|
||||
return storageSectionService.insert(storageSectionDO);
|
||||
}
|
||||
|
||||
@@ -86,6 +100,22 @@ public class StorageSectionDomainService {
|
||||
storageSectionDO.getStorageSectionId());
|
||||
//设置仓库
|
||||
setWarehouseInfo(storageSectionDO);
|
||||
String storageCode = storageSectionDO.getStorageCode();
|
||||
String storageName = storageSectionDO.getStorageName();
|
||||
Long warehouseId = storageSectionDO.getWarehouseId();
|
||||
List<StorageSection> codelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getStorageCode, storageCode)
|
||||
.eq(StorageSection::getWarehouseId, warehouseId)
|
||||
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
|
||||
.eq(StorageSection::getDelFlag, 1));
|
||||
List<StorageSection> namelist = storageSectionService.list(new QueryWrapper<StorageSection>().lambda()
|
||||
.eq(StorageSection::getStorageName, storageName)
|
||||
.eq(StorageSection::getWarehouseId, warehouseId)
|
||||
.ne(StorageSection::getStorageSectionId, storageSectionDO.getStorageSectionId())
|
||||
.eq(StorageSection::getDelFlag, 1));
|
||||
if ((codelist != null && codelist.size() > 0) || (namelist != null && namelist.size() > 0)) {
|
||||
throw new ServiceException("库区编码或名称已存在");
|
||||
}
|
||||
return storageSectionService.update(storageSectionDO);
|
||||
}
|
||||
|
||||
@@ -168,4 +198,4 @@ public class StorageSectionDomainService {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+7
@@ -122,5 +122,12 @@ public class Warehouse extends BaseVOEntity{
|
||||
@Excel(name = "是否启用: 1-否 2-是")
|
||||
private Integer isEnable;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
}
|
||||
+6
@@ -124,5 +124,11 @@ public class WarehousePO extends BaseVOEntity{
|
||||
private Integer isEnable;
|
||||
@ApiModelProperty("库区集合")
|
||||
private List<StorageSectionPO> storageSectionList;
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
}
|
||||
+12
@@ -127,4 +127,16 @@ public class WarehouseDO extends BaseVOEntity{
|
||||
private Integer isEnable;
|
||||
@ApiModelProperty("仓库id 集合")
|
||||
private List<Long> warehouseIds;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private String orgIds;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
}
|
||||
+5
-1
@@ -212,7 +212,11 @@ public class StorageLocationDTO extends BaseVOEntity{
|
||||
@Excel(name = "坐标-层 终止")
|
||||
private String coordinateLayerEnd;
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
|
||||
public interface Edit {}
|
||||
|
||||
public interface BatchInsert {}
|
||||
}
|
||||
}
|
||||
+12
@@ -132,4 +132,16 @@ public class WarehouseDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("是否启用: 1-否 2-是")
|
||||
@Excel(name = "是否启用: 1-否 2-是")
|
||||
private Integer isEnable;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private String orgIds;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
}
|
||||
+7
@@ -160,6 +160,13 @@ public class ContractManageApi extends BaseController{
|
||||
return AjaxResult.success(contractManageApplicationService.getInfoByCustomer(settlementCustomersCode,contractType,null));
|
||||
}
|
||||
|
||||
@ApiOperation("根据结算主体和费用科目获取合同信息")
|
||||
@GetMapping(value = "/getInfoByCustomerAndSecondSubjectCode")
|
||||
public AjaxResult getInfoByCustomerAndSecondSubjectCode(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("firstSubjectCode") String firstSubjectCode,@RequestParam("topOrganizationId") Long topOrganizationId,@RequestParam("organizationId") Long organizationId)
|
||||
{
|
||||
return AjaxResult.success(contractManageApplicationService.getInfoByCustomerAndSecondSubjectCode(settlementCustomersCode,contractType,topOrganizationId,organizationId,firstSubjectCode));
|
||||
}
|
||||
|
||||
@ApiOperation("根据结算主体获取合同信息")
|
||||
@GetMapping(value = "/getInfoByCustomer2")
|
||||
public AjaxResult getInfoByCustomer2(@RequestParam("settlementCustomersCode") String settlementCustomersCode,@RequestParam("contractType") Integer contractType,@RequestParam("topOrganizationId") Long topOrganizationId)
|
||||
|
||||
@@ -6,11 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<sql id="selectContractManagePo">
|
||||
select
|
||||
*
|
||||
from contract_manage
|
||||
SELECT DISTINCT a.*
|
||||
FROM CONTRACT_MANAGE a
|
||||
left JOIN CONTRACT_MANAGE_DETAIL b
|
||||
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
|
||||
where
|
||||
del_flag = 1
|
||||
a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<sql id="selectContractManagePo1">
|
||||
@@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and contract_state = #{contractState}
|
||||
</if>
|
||||
<if test="signingUnit != null and signingUnit != ''">
|
||||
and signing_unit = #{signingUnit}
|
||||
and asigning_unit = #{signingUnit}
|
||||
</if>
|
||||
<if test="settlementCustomers != null and settlementCustomers != ''">
|
||||
and settlement_customers = #{settlementCustomers}
|
||||
@@ -108,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="theyOperatorPhone != null and theyOperatorPhone != ''">
|
||||
and they_operator_phone = #{theyOperatorPhone}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
@@ -132,73 +134,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="contractManageDO.contractNumber != null and contractManageDO.contractNumber != ''">
|
||||
and contract_number like concat('%', #{contractManageDO.contractNumber}, '%')
|
||||
and a.contract_number like concat('%', #{contractManageDO.contractNumber}, '%')
|
||||
</if>
|
||||
<if test="contractManageDO.originalContractNumber != null and contractManageDO.originalContractNumber != ''">
|
||||
and original_contract_number like concat('%', #{contractManageDO.originalContractNumber}, '%')
|
||||
and a.original_contract_number like concat('%', #{contractManageDO.originalContractNumber}, '%')
|
||||
</if>
|
||||
<if test="contractManageDO.commonContractFlag != null">
|
||||
and common_contract_flag = #{contractManageDO.commonContractFlag}
|
||||
and a.common_contract_flag = #{contractManageDO.commonContractFlag}
|
||||
</if>
|
||||
<if test="contractManageDO.contractType != null">
|
||||
and contract_type = #{contractManageDO.contractType}
|
||||
and a.contract_type = #{contractManageDO.contractType}
|
||||
</if>
|
||||
<if test="contractManageDO.settlementCustomers != null and contractManageDO.settlementCustomers != '' " >
|
||||
and settlement_customers like concat('%', #{contractManageDO.settlementCustomers}, '%')
|
||||
and a.settlement_customers like concat('%', #{contractManageDO.settlementCustomers}, '%')
|
||||
</if>
|
||||
<if test="contractManageDO.settlementCustomersCode != null">
|
||||
and settlement_customers_code = #{contractManageDO.settlementCustomersCode}
|
||||
and a.settlement_customers_code = #{contractManageDO.settlementCustomersCode}
|
||||
</if>
|
||||
<if test="contractManageDO.signingUnit != null and contractManageDO.signingUnit != ''">
|
||||
and signing_unit like concat('%', #{contractManageDO.signingUnit}, '%')
|
||||
and a.signing_unit like concat('%', #{contractManageDO.signingUnit}, '%')
|
||||
</if>
|
||||
<if test="contractManageDO.contractName != null and contractManageDO.contractName != ''">
|
||||
and contract_name like concat('%', #{contractManageDO.contractName}, '%')
|
||||
and a.contract_name like concat('%', #{contractManageDO.contractName}, '%')
|
||||
</if>
|
||||
<if test="contractManageDO.contractState != null">
|
||||
and contract_state = #{contractManageDO.contractState}
|
||||
and a.contract_state = #{contractManageDO.contractState}
|
||||
</if>
|
||||
<if test="contractManageDO.signingDateStart != null and contractManageDO.signingDateStart != ''">
|
||||
AND date_format(signing_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.signingDateStart}
|
||||
AND date_format(a.signing_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.signingDateStart}
|
||||
</if>
|
||||
<if test="contractManageDO.signingDateEnd != null and contractManageDO.signingDateEnd != ''">
|
||||
AND date_format(signing_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.signingDateEnd}
|
||||
AND date_format(a.signing_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.signingDateEnd}
|
||||
</if>
|
||||
|
||||
<if test="contractManageDO.effectiveDateStart != null and contractManageDO.effectiveDateStart != ''">
|
||||
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateStart}
|
||||
AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateStart}
|
||||
</if>
|
||||
<if test="contractManageDO.effectiveDateEnd != null and contractManageDO.effectiveDateEnd != ''">
|
||||
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.effectiveDateEnd}
|
||||
AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.effectiveDateEnd}
|
||||
</if>
|
||||
|
||||
<if test="contractManageDO.expirationDateStart != null and contractManageDO.expirationDateStart != ''">
|
||||
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.expirationDateStart}
|
||||
AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.expirationDateStart}
|
||||
</if>
|
||||
<if test="contractManageDO.expirationDateEnd != null and contractManageDO.expirationDateEnd != ''">
|
||||
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateEnd}
|
||||
AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateEnd}
|
||||
</if>
|
||||
<!-- 时间段重叠判断:只有当已有合同与传入的有效期真正有交集时才算冲突
|
||||
条件:已有合同开始日期 <= 新合同结束日期 且 已有合同结束日期 >= 新合同开始日期 -->
|
||||
<if test="contractManageDO.effectiveDateString != null and contractManageDO.effectiveDateString != ''
|
||||
and contractManageDO.expirationDateString != null and contractManageDO.expirationDateString != ''">
|
||||
AND (
|
||||
date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString}
|
||||
AND date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString}
|
||||
date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.expirationDateString}
|
||||
AND date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.effectiveDateString}
|
||||
)
|
||||
</if>
|
||||
<if test="contractManageDO.nowDateString != null and contractManageDO.nowDateString != ''">
|
||||
AND (
|
||||
date_format(expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString}
|
||||
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
|
||||
date_format(a.expiration_date,'%Y-%m-%d') <![CDATA[>=]]> #{contractManageDO.nowDateString}
|
||||
AND date_format(a.effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
|
||||
)
|
||||
</if>
|
||||
<if test="contractManageDO.organizationId != null">
|
||||
and organization_id = #{contractManageDO.organizationId}
|
||||
and a.organization_id = #{contractManageDO.organizationId}
|
||||
</if>
|
||||
<if test="contractManageDO.topOrganizationId != null">
|
||||
and top_organization_id = #{contractManageDO.topOrganizationId}
|
||||
and a.top_organization_id = #{contractManageDO.topOrganizationId}
|
||||
</if>
|
||||
<if test="contractManageDO.firstSubjectCode != null and contractManageDO.firstSubjectCode != ''">
|
||||
and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
+2
-1
@@ -47,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="locationBarCode" column="LOCATION_BAR_CODE" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -58,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.storage_location_classify, a.storage_location_classify_name, a.storage_location_type, a.storage_location_type_name,
|
||||
a.mixing_strategy, a.mixing_strategy_name, a.storage_location_group_id, a.storage_location_group_code, a.storage_location_group_name,
|
||||
a.weight_limit, a.volume_limit, a.location_size, a.location_length, a.location_width, a.location_height,
|
||||
a.coordinate, a.coordinate_area, a.coordinate_column, a.coordinate_row, a.coordinate_layer, a.remark,
|
||||
a.coordinate, a.coordinate_area, a.coordinate_column, a.coordinate_row, a.coordinate_layer, a.remark, a.LOCATION_BAR_CODE,
|
||||
a.opening_up, a.nullify, a.status, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
|
||||
from storage_location a
|
||||
LEFT JOIN warehouse w ON a.warehouse_id = w.warehouse_id AND w.del_flag = 1
|
||||
|
||||
+14
-1
@@ -37,11 +37,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="isEnable" column="IS_ENABLE" />
|
||||
<result property="workMode" column="WORK_MODE" />
|
||||
<result property="taskMode" column="TASK_MODE" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectWarehousePo">
|
||||
select warehouse_id, organization_id, organization_name, top_organization_id, warehouse_code, warehouse_name, warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name, director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region, usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag, IS_ENABLE from warehouse
|
||||
select warehouse_id, organization_id, organization_name, top_organization_id, warehouse_code, warehouse_name,
|
||||
warehouse_type, warehouse_type_name, warehouse_structure, warehouse_nature, warm_layer_code, warm_layer_name,
|
||||
director_name, director_phone, region_code, region_name, detail_address, longitude, latitude, building_region,
|
||||
usage_region, remark, opening_up, nullify, create_time, create_by, create_by_name, update_time, update_by,
|
||||
update_by_name, del_flag, IS_ENABLE ,WORK_MODE,TASK_MODE
|
||||
from warehouse
|
||||
</sql>
|
||||
|
||||
<sql id="selectWarehousePo1">
|
||||
@@ -130,6 +137,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="orgIdList != null and orgIdList.size > 0 ">
|
||||
and organization_id in
|
||||
<foreach collection="orgIdList" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<choose>
|
||||
<when test="delFlag != null"> and del_flag = #{delFlag} </when>
|
||||
<otherwise> and del_flag = 1 </otherwise>
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class AsyncUserShipperMasterDataSyncService {
|
||||
@Resource
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Async
|
||||
@Async("taskScheduler")
|
||||
public void syncMasterDataAsync(LoginUser loginUser, String lockKey) {
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
try {
|
||||
|
||||
+102
-19
@@ -1860,25 +1860,64 @@ public class UserApplicationService {
|
||||
userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4));
|
||||
}
|
||||
UserEntity userEntity = userDomainService.addUser(userDO);
|
||||
//同步网货平台员工信息
|
||||
wlhyDomainService.addOrEditPlatformUser1(userEntity);
|
||||
//同步商城用户
|
||||
userMallDomainService.syncDriverUserInfo(userEntity);
|
||||
//给用户分配默认普通角色权限
|
||||
RoleDo roleDo = new RoleDo();
|
||||
roleDo.setRoleCode(RoleEnum.DRIVER.getCode());
|
||||
roleDo.setOrganizationId(userEntity.getOrganizationId());
|
||||
RoleEntity roleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(roleDo);
|
||||
if (null != roleEntity) {
|
||||
UserRoleDo userRoleDo = new UserRoleDo();
|
||||
userRoleDo.setUserId(userEntity.getUserId());
|
||||
userRoleDo.setRoleId(roleEntity.getRoleId());
|
||||
//判断是否存在当前登录人
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
userRoleDomainService.addUserRole(userRoleDo,userEntity);
|
||||
}else {
|
||||
userRoleDomainService.addUserRole(userRoleDo);
|
||||
//给小程序注册用户分配默认普通用户角色(must),本组织没有则找上级
|
||||
userEntity.setUserPassword("Aa123456"); // 三方同步需要密码
|
||||
try {
|
||||
RoleDo mustRoleDo = new RoleDo();
|
||||
mustRoleDo.setRoleCode(RoleEnum.MUST.getCode());
|
||||
mustRoleDo.setOrganizationId(userEntity.getOrganizationId());
|
||||
RoleEntity mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
|
||||
// 本组织没有,找上级组织
|
||||
if (null == mustRoleEntity && userEntity.getTopOrganizationId() != null
|
||||
&& !userEntity.getTopOrganizationId().equals(userEntity.getOrganizationId())) {
|
||||
mustRoleDo.setOrganizationId(userEntity.getTopOrganizationId());
|
||||
mustRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(mustRoleDo);
|
||||
}
|
||||
if (null != mustRoleEntity) {
|
||||
UserRoleDo mustUserRoleDo = new UserRoleDo();
|
||||
mustUserRoleDo.setUserId(userEntity.getUserId());
|
||||
mustUserRoleDo.setRoleId(mustRoleEntity.getRoleId());
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
userRoleDomainService.addUserRole(mustUserRoleDo, userEntity);
|
||||
} else {
|
||||
userRoleDomainService.addUserRole(mustUserRoleDo);
|
||||
}
|
||||
userDO.setRoleCode(RoleEnum.MUST.getCode());
|
||||
userDO.setRoleName(mustRoleEntity.getRoleName());
|
||||
userEntity.setRoleCode(RoleEnum.MUST.getCode());
|
||||
userEntity.setRoleName(mustRoleEntity.getRoleName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("分配默认角色失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
//更新user表role_code和role_name(用mapper直接更新,避免需要loginUser)
|
||||
userMapper.update(null, new LambdaUpdateWrapper<UserEntity>()
|
||||
.set(UserEntity::getRoleCode, userDO.getRoleCode())
|
||||
.set(UserEntity::getRoleName, userDO.getRoleName())
|
||||
.eq(UserEntity::getUserId, userEntity.getUserId()));
|
||||
//同步三方平台(放在角色分配之后,确保roleCode已设置)
|
||||
try {
|
||||
wlhyDomainService.addOrEditPlatformUser1(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步网货平台员工信息失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
try {
|
||||
userMallDomainService.syncDriverUserInfo(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步商城用户失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
// 只有组织开启园区(排队)才同步YMS
|
||||
Integer isQueue = userMapper.getOrdIsQueue(userEntity.getOrganizationId());
|
||||
if (isQueue != null && isQueue == 1) {
|
||||
try {
|
||||
// 截断avatar URL(YMS的avatar列长度有限,去掉OSS签名参数)
|
||||
if (userEntity.getAvatar() != null && userEntity.getAvatar().contains("?")) {
|
||||
userEntity.setAvatar(userEntity.getAvatar().substring(0, userEntity.getAvatar().indexOf("?")));
|
||||
}
|
||||
ymsDomainService.addOrEditYmsUser(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步YMS平台员工信息失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
//2024年3月27日16:40:15 处理用户验证码注册,首次登录redis用户数据不更新问题
|
||||
@@ -1934,6 +1973,23 @@ public class UserApplicationService {
|
||||
userDO.setDriverEnterpriseCode(driverEnterpriseCode);
|
||||
UserPo userPo = registerAddUser(userDO);
|
||||
|
||||
// 承运企业添加司机,补分配driver角色
|
||||
RoleDo driverRoleDo = new RoleDo();
|
||||
driverRoleDo.setRoleCode(RoleEnum.DRIVER.getCode());
|
||||
driverRoleDo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
RoleEntity driverRoleEntity = roleDomainService.selectByOrganizationIdAndRoleCode(driverRoleDo);
|
||||
if (null != driverRoleEntity) {
|
||||
UserRoleDo driverUserRoleDo = new UserRoleDo();
|
||||
driverUserRoleDo.setUserId(userPo.getUserId());
|
||||
driverUserRoleDo.setRoleId(driverRoleEntity.getRoleId());
|
||||
userRoleDomainService.addUserRole(driverUserRoleDo);
|
||||
// 更新user表role_code和role_name为driver(承运企业司机不需要must)
|
||||
userMapper.update(null, new LambdaUpdateWrapper<UserEntity>()
|
||||
.set(UserEntity::getRoleCode, RoleEnum.DRIVER.getCode())
|
||||
.set(UserEntity::getRoleName, RoleEnum.DRIVER.getName())
|
||||
.eq(UserEntity::getUserId, userPo.getUserId()));
|
||||
}
|
||||
|
||||
//20240314 运输企业添加司机,默认生成一条空的司机信息方便列表查询
|
||||
UserDriverDO userDriverDO = new UserDriverDO();
|
||||
userDriverDO.setUserId(userPo.getUserId());
|
||||
@@ -2886,6 +2942,33 @@ public class UserApplicationService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅根据用户登录账号获取用户信息(不区分组织,SSO等场景使用)
|
||||
*/
|
||||
public LoginUser getUserByUserAccount(String userAccount) {
|
||||
UserPo userPo = userDomainService.findByUserAccount(userAccount);
|
||||
if (ObjectUtil.isNotNull(userPo)) {
|
||||
LoginUser sysUser = new LoginUser();
|
||||
sysUser.setUserid(userPo.getUserId());
|
||||
sysUser.setUsername(userPo.getUserAccount());
|
||||
UserDriverPo userDriverPo = userDriverDomainService.selectByUserId(userPo.getUserId());
|
||||
UserShipperPo userShipperPo = userShipperDomainService.selectByUserId(userPo.getUserId());
|
||||
sysUser.setUserPo(userPo);
|
||||
com.mhd.common.core.domain.po.UserDriverPo userDriverPo1 = new com.mhd.common.core.domain.po.UserDriverPo();
|
||||
if(userDriverPo != null){
|
||||
BeanUtils.copyProperties(userDriverPo, userDriverPo1);
|
||||
}
|
||||
sysUser.setUserDriverPo(userDriverPo1);
|
||||
com.mhd.common.core.domain.po.UserShipperPo userShipperPo1 = new com.mhd.common.core.domain.po.UserShipperPo();
|
||||
if (userShipperPo != null){
|
||||
BeanUtils.copyProperties(userShipperPo, userShipperPo1);
|
||||
}
|
||||
sysUser.setUserShipperPo(userShipperPo1);
|
||||
return sysUser;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 根据用户账号和组织账号获取组织用户信息
|
||||
* @Author Alex
|
||||
|
||||
+547
-150
@@ -521,6 +521,7 @@ public class UserShipperApplicationService {
|
||||
userShipperDO.setUpdateBy(loginUserPo.getUserId());
|
||||
userShipperDO.setUpdateByName(loginUserPo.getUserName());
|
||||
userShipperDO.setUpdateTime(new Date());
|
||||
userShipperDO.setRoleCode("ownerCargo");
|
||||
updateUserInformation(userShipperDO);
|
||||
//保存托运人信息
|
||||
userShipperDomainService.saveUserShipper(userShipperDO);
|
||||
@@ -583,6 +584,7 @@ public class UserShipperApplicationService {
|
||||
refreshShipperDictData(userShipperDO);
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(userShipperDO, userDO, IgnoreNullUtil.getNullPropertyNames(userShipperDO));
|
||||
|
||||
//修改用户表信息
|
||||
UserPo userPo = userApplicationService.updateUser(userDO);
|
||||
|
||||
@@ -1347,6 +1349,82 @@ public class UserShipperApplicationService {
|
||||
organizationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按公司名跨组织查询第一个未删除的委托方(包含 orgCode)。
|
||||
* 用于 MDM 同步时:同公司名可能在不同组织下 nc 编码不同,但本地是同一条委托方记录。
|
||||
*/
|
||||
public UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(String shipperEnterpriseName) {
|
||||
if (StringUtils.isEmpty(shipperEnterpriseName)) {
|
||||
return null;
|
||||
}
|
||||
return userShipperMapper.findFirstByShipperEnterpriseNameAcrossOrgs(shipperEnterpriseName.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* 在已存在的同公司名委托方(可能属于其他组织)的 orgCode JSON 数组中追加当前组织信息。
|
||||
* 若目标组织已存在于数组中则跳过(不重复追加)。
|
||||
*
|
||||
* @param existingShipper 本地已存在的同公司名委托方
|
||||
* @param targetOrganizationId 当前同步组织 ID
|
||||
* @param targetOrganizationName 当前同步组织名称
|
||||
* @param ncCustomerCode MDM 客商 code(作为该组织下的 ncCustomer 记录)
|
||||
* @param loginUser 登录用户(用于写入 updateBy)
|
||||
* @return true 表示实际写入(新增组织或已存在都返回 true,方便调用方统计),false 表示参数无效
|
||||
*/
|
||||
public boolean appendOrganizationToExistingShipper(UserShipperEntity existingShipper,
|
||||
Long targetOrganizationId, String targetOrganizationName,
|
||||
String ncCustomerCode, LoginUser loginUser) {
|
||||
if (existingShipper == null) {
|
||||
return false;
|
||||
}
|
||||
String existingOrgCode = existingShipper.getOrgCode();
|
||||
|
||||
boolean hasOrg = false;
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||
if (StringUtils.isNotEmpty(existingOrgCode)) {
|
||||
try {
|
||||
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
|
||||
// 检查是否已包含当前组织
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long itemCode = orgItem.getLong("code");
|
||||
if (targetOrganizationId != null && targetOrganizationId.equals(itemCode)) {
|
||||
hasOrg = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasOrg) {
|
||||
// 添加新组织到orgCode数组
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("name", targetOrganizationName);
|
||||
newOrgItem.put("code", targetOrganizationId);
|
||||
newOrgItem.put("ncCustomer", ncCustomerCode);
|
||||
newOrgItem.put("names", targetOrganizationId);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
|
||||
// 更新委托方的orgCode字段
|
||||
existingShipper.setOrgCode(orgCodeArray.toJSONString());
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
|
||||
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
}
|
||||
existingShipper.setUpdateTime(new Date());
|
||||
userShipperMapper.updateById(existingShipper);
|
||||
|
||||
log.info("委托方已存在,添加新组织到orgCode,customerNcCode={},新增组织code={},name={}",
|
||||
ncCustomerCode, targetOrganizationId, targetOrganizationName);
|
||||
} else {
|
||||
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
|
||||
ncCustomerCode, targetOrganizationId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String buildMasterDataMatchKey(String ncCode, String companyName) {
|
||||
return normalizeMasterDataKey(ncCode) + "|" + normalizeMasterDataKey(companyName);
|
||||
}
|
||||
@@ -1372,6 +1450,9 @@ public class UserShipperApplicationService {
|
||||
throw new ServiceException("获取组织配置失败");
|
||||
}
|
||||
|
||||
// 按公司名跨组织匹配已存在委托方的逻辑已迁移到 doSync 层(先调用 appendOrganizationToExistingShipper),
|
||||
// 走到这里说明按 ncCode+companyName 与公司名均未匹配到,本方法只负责"新增"。
|
||||
// 不存在相同的委托方,执行新增逻辑
|
||||
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
|
||||
targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
|
||||
userShipperDO.setDataSource(1);
|
||||
@@ -1383,6 +1464,16 @@ public class UserShipperApplicationService {
|
||||
userShipperDO.setAuthType(2);
|
||||
userShipperDO.setShipperAuthStatus(3);
|
||||
|
||||
// 初始化 orgCode:新加的客商属于当前组织,将当前组织信息写入 orgCode JSON 数组
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||
com.alibaba.fastjson.JSONObject orgItem = new com.alibaba.fastjson.JSONObject();
|
||||
orgItem.put("name", targetOrganizationName);
|
||||
orgItem.put("code", targetOrganizationId);
|
||||
orgItem.put("ncCustomer", record.getCode());
|
||||
orgItem.put("names", targetOrganizationId);
|
||||
orgCodeArray.add(orgItem);
|
||||
userShipperDO.setOrgCode(orgCodeArray.toJSONString());
|
||||
|
||||
String userAccount = buildMasterDataUserAccount(record.getCode());
|
||||
checkUserAccountUnique(userAccount, null, configSwitch.getTopOrganizationId());
|
||||
userShipperDO.setUserAccount(userAccount);
|
||||
@@ -1498,7 +1589,7 @@ public class UserShipperApplicationService {
|
||||
Long targetOrganizationId, String targetOrganizationName,
|
||||
Long targetTopOrganizationId) {
|
||||
UserShipperDO userShipperDO = new UserShipperDO();
|
||||
userShipperDO.setCustomerNcCode(record.getCode());
|
||||
userShipperDO.setCustomerNcCode(record.getDesc17()); // NC编码用desc17,与匹配Key一致
|
||||
userShipperDO.setUserMemberCode(record.getCode());
|
||||
userShipperDO.setShipperEnterpriseName(record.getDesc1());
|
||||
userShipperDO.setUserNameShipper(record.getDesc1());
|
||||
@@ -1581,95 +1672,247 @@ public class UserShipperApplicationService {
|
||||
com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject();
|
||||
|
||||
for (UserShipperEntity userShipperEntity : customerNcCodeList) {
|
||||
if (StringUtils.isEmpty(userShipperEntity.getCustomerNcCode())) {
|
||||
|
||||
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
|
||||
|
||||
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
|
||||
|
||||
if (userShipperEntity1 == null) {
|
||||
log.warn("未找到对应货主,custcode={}", userShipperEntity.getCustomerNcCode());
|
||||
continue;
|
||||
}
|
||||
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
|
||||
.eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
|
||||
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
|
||||
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity1.getOrganizationId());
|
||||
if (StringUtils.isEmpty(orgcode)) {
|
||||
return AjaxResult.error("组织NC编码不能为空");
|
||||
}
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
|
||||
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
|
||||
queryParam.put("orgcode", orgcode);
|
||||
log.info("调用赊销额度查询接口,custcode={},orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
|
||||
|
||||
String queryResult = HttpRequest.post(queryUrl)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("uap_token", uapToken)
|
||||
.header("uap_usercode", uapUsercode)
|
||||
.header("uap_dataSource", uapDataSource)
|
||||
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
|
||||
.body(queryParam.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("赊销额度查询接口返回,custcode={},result={}", userShipperEntity.getCustomerNcCode(), queryResult);
|
||||
|
||||
if (StringUtils.isNotEmpty(queryResult)) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
|
||||
allResults.put(userShipperEntity.getCustomerNcCode(), resultJson);
|
||||
|
||||
// 第三步:查询成功,更新货主的额度同步时间(limitTime)
|
||||
|
||||
if (userShipperEntity1 != null) {
|
||||
// 根据查询结果同步数据
|
||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||
if (dataJson != null) {
|
||||
// 同步额度数据(limitdatas)
|
||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||
com.alibaba.fastjson.JSONObject limitData = limitdatas.getJSONObject(0);
|
||||
userShipperEntity1.setLimitTime(new Date());
|
||||
userShipperEntity1.setAuthorizedQuota(limitData.getBigDecimal("nlimitmny"));
|
||||
userShipperEntity1.setAuthorizedUsedAmount(limitData.getBigDecimal("nengrossmny"));
|
||||
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
|
||||
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("更新货主额度同步成功,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
||||
} else {
|
||||
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
|
||||
// 解析org_code,支持多组织
|
||||
List<Long> orgCodeList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
// 解析JSON数组:[{"name":"通宇","code":2830,"ncOrganizationId":"145222101124","names":2830},...]
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long code = orgItem.getLong("code");
|
||||
if (code != null) {
|
||||
orgCodeList.add(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("解析org_code成功,custcode={},orgCodeList={}", userShipperEntity.getCustomerNcCode(), orgCodeList);
|
||||
} catch (Exception e) {
|
||||
log.error("解析org_code失败,custcode={},orgCode={}", userShipperEntity.getCustomerNcCode(), userShipperEntity1.getOrgCode(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果org_code为空或解析失败,使用原来的organizationId方式
|
||||
if (orgCodeList.isEmpty()) {
|
||||
Long organizationId = userShipperEntity1.getOrganizationId();
|
||||
if (organizationId != null) {
|
||||
orgCodeList.add(organizationId);
|
||||
log.info("org_code为空,使用organizationId,custcode={},organizationId={}", organizationId);
|
||||
}
|
||||
}
|
||||
|
||||
if (orgCodeList.isEmpty()) {
|
||||
log.warn("货主无组织信息,跳过查询,custcode={}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历每个组织code,分别调用接口
|
||||
int orgIndex = 0; // 组织循环计数器
|
||||
for (Long orgCode : orgCodeList) {
|
||||
String orgcode = userShipperMapper.getOrgNcCode(orgCode);
|
||||
if (StringUtils.isEmpty(orgcode)) {
|
||||
log.warn("组织NC编码为空,跳过查询,custcode={},orgCode={}", orgCode);
|
||||
orgIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 从orgCode数组中获取当前组织的ncCustomer字段
|
||||
String ncCustomer = null;
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long itemCode = orgItem.getLong("code");
|
||||
if (orgCode.equals(itemCode)) {
|
||||
ncCustomer = orgItem.getString("ncCustomer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(ncCustomer)) {
|
||||
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode);
|
||||
orgIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
|
||||
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
|
||||
queryParam.put("orgcode", orgcode);
|
||||
log.info("调用赊销额度查询接口,custcode={},ncCustomer={},orgcode={}", ncCustomer, orgcode);
|
||||
|
||||
// 同步协议明细(agreedaydatas),与limitdatas独立
|
||||
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
|
||||
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
|
||||
// 先删除该货主已有的协议明细,避免重复
|
||||
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
|
||||
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
|
||||
int i;
|
||||
for (i = 0; i < agreedaydatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||
AgreementDetails agreementDetails = new AgreementDetails();
|
||||
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
|
||||
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
|
||||
agreementDetails.setCode(agreeItem.getString("code"));
|
||||
agreementDetails.setPday(agreeItem.getString("pday"));
|
||||
agreementDetails.setPname(agreeItem.getString("pname"));
|
||||
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
|
||||
agreementDetails.setPcode(agreeItem.getString("pcode"));
|
||||
agreementDetails.setPtype(agreeItem.getString("ptype"));
|
||||
agreementDetailsMapper.insert(agreementDetails);
|
||||
String queryResult = HttpRequest.post(queryUrl)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("uap_token", uapToken)
|
||||
.header("uap_usercode", uapUsercode)
|
||||
.header("uap_dataSource", uapDataSource)
|
||||
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
|
||||
.body(queryParam.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("赊销额度查询接口返回,custcode={},ncCustomer={},orgcode={},result={}", ncCustomer, orgcode, queryResult);
|
||||
|
||||
if (StringUtils.isNotEmpty(queryResult)) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
|
||||
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
|
||||
|
||||
// 第三步:查询成功,更新货主的额度同步时间(limitTime)
|
||||
|
||||
if (userShipperEntity1 != null) {
|
||||
// 根据查询结果同步数据
|
||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||
if (dataJson != null) {
|
||||
// 解析现有的orgCode数组
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
} catch (Exception e) {
|
||||
log.warn("解析现有orgCode失败,将创建新的数组,shipperId={}", userShipperEntity1.getShipperId());
|
||||
}
|
||||
}
|
||||
userShipperEntity1.setAgreementCount(i);
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("同步协议明细成功,custcode={},shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId(), agreedaydatas.size());
|
||||
|
||||
// 同步额度数据(limitdatas)
|
||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||
// 将limitdatas按orgcode值合并到orgCode数组中
|
||||
for (int i = 0; i < limitdatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
||||
String limitOrgcode = limitItem.getString("orgcode"); // 例如 "NA01"
|
||||
|
||||
if (StringUtils.isNotEmpty(limitOrgcode)) {
|
||||
// 在orgCode数组中查找code匹配的组织(注意:这里的code是2830, 2839等)
|
||||
boolean found = false;
|
||||
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||
String orgItemCode = orgItem.getString("code"); // orgCode数组中的code
|
||||
|
||||
// 如果orgCode数组中的code与当前orgCode(如2830)匹配,将limitdatas的字段添加到该组织对象中
|
||||
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||
orgItem.putAll(limitItem);
|
||||
found = true;
|
||||
log.info("匹配到code={}的组织,将额度数据(orgcode={})添加到orgCode中,custcode={}", orgItemCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有找到匹配的组织,创建新的组织对象
|
||||
if (!found) {
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("code", orgCode); // 使用当前orgCode
|
||||
newOrgItem.putAll(limitItem);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
log.info("未找到code={}的组织,创建新组织并添加额度数据(orgcode={}),custcode={}", orgCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 使用limitdatas中的数据更新额度字段
|
||||
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
||||
userShipperEntity1.setLimitTime(new Date());
|
||||
userShipperEntity1.setAuthorizedQuota(firstLimitData.getBigDecimal("nlimitmny"));
|
||||
userShipperEntity1.setAuthorizedUsedAmount(firstLimitData.getBigDecimal("nengrossmny"));
|
||||
userShipperEntity1.setSettlementCurrency(firstLimitData.getString("currencycode"));
|
||||
userShipperEntity1.setCreditAmount(firstLimitData.getBigDecimal("nbalancemny"));
|
||||
|
||||
log.info("更新货主额度同步成功,custcode={},orgcode={},shipperId={},orgCode组织数={}", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), orgCodeArray.size());
|
||||
} else {
|
||||
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
|
||||
// 同步协议明细(agreedaydatas),与limitdatas独立
|
||||
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
|
||||
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
|
||||
// 只在第一次循环时删除该货主的所有协议明细,避免重复
|
||||
if (orgIndex == 0) {
|
||||
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
|
||||
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
|
||||
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
||||
}
|
||||
|
||||
// 将agreedaydatas保存到orgCode数组中,与code同一级别
|
||||
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||
boolean foundOrg = false;
|
||||
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||
String orgItemCode = orgItem.getString("code");
|
||||
|
||||
// 找到当前组织,将agreedaydatas添加到该组织对象中
|
||||
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||
orgItem.put("agreedaydatas", agreedaydatas);
|
||||
foundOrg = true;
|
||||
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没找到,创建新组织对象
|
||||
if (!foundOrg) {
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("code", orgCode);
|
||||
newOrgItem.put("agreedaydatas", agreedaydatas);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
log.info("创建新组织并添加agreedaydatas,code={},共{}条", orgCode, agreedaydatas.size());
|
||||
}
|
||||
|
||||
// 同时插入到agreement_details表
|
||||
for (int i = 0; i < agreedaydatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||
AgreementDetails agreementDetails = new AgreementDetails();
|
||||
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
|
||||
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
|
||||
agreementDetails.setCode(agreeItem.getString("code"));
|
||||
agreementDetails.setPday(agreeItem.getString("pday"));
|
||||
agreementDetails.setPname(agreeItem.getString("pname"));
|
||||
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
|
||||
agreementDetails.setPcode(agreeItem.getString("pcode"));
|
||||
agreementDetails.setPtype(agreeItem.getString("ptype"));
|
||||
agreementDetailsMapper.insert(agreementDetails);
|
||||
}
|
||||
log.info("同步协议明细成功,custcode={},orgcode={},shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), agreedaydatas.size());
|
||||
} else {
|
||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
|
||||
// 保存更新后的orgCode数组(统一在最后保存)
|
||||
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
||||
} else {
|
||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
} else {
|
||||
log.info("赊销额度查询无data返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
log.warn("未找到对应货主,custcode={},orgCode={}", orgCode);
|
||||
}
|
||||
} else {
|
||||
log.warn("未找到对应货主,custcode={},organizationId={}", userShipperEntity1.getCustomerNcCode(), userShipperDTO.getOrganizationId());
|
||||
log.warn("赊销额度查询返回为空,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
} else {
|
||||
log.warn("赊销额度查询返回为空,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
} catch (Exception e) {
|
||||
log.error("查询赊销额度异常,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode, e);
|
||||
} finally {
|
||||
orgIndex++; // 计数器递增
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("查询赊销额度异常,custcode={}", userShipperEntity1.getCustomerNcCode(), e);
|
||||
}
|
||||
|
||||
// 所有组织循环完成后,统一更新数据库(只更新一次)
|
||||
if (userShipperEntity1 != null) {
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("批量更新货主额度完成,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(allResults);
|
||||
@@ -1723,89 +1966,243 @@ public class UserShipperApplicationService {
|
||||
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
|
||||
.eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
|
||||
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
|
||||
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity1.getOrganizationId());
|
||||
if (StringUtils.isEmpty(orgcode)) {
|
||||
return AjaxResult.error("组织NC编码不能为空");
|
||||
|
||||
if (userShipperEntity1 == null) {
|
||||
log.warn("未找到对应货主,custcode={}", userShipperEntity.getCustomerNcCode());
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
|
||||
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
|
||||
queryParam.put("orgcode", orgcode);
|
||||
log.info("调用赊销额度查询接口,custcode={},orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
|
||||
|
||||
String queryResult = HttpRequest.post(queryUrl)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("uap_token", uapToken)
|
||||
.header("uap_usercode", uapUsercode)
|
||||
.header("uap_dataSource", uapDataSource)
|
||||
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
|
||||
.body(queryParam.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("赊销额度查询接口返回,custcode={},result={}", userShipperEntity.getCustomerNcCode(), queryResult);
|
||||
|
||||
if (StringUtils.isNotEmpty(queryResult)) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
|
||||
allResults.put(userShipperEntity.getCustomerNcCode(), resultJson);
|
||||
|
||||
// 第三步:查询成功,更新货主的额度同步时间(limitTime)
|
||||
|
||||
if (userShipperEntity1 != null) {
|
||||
// 根据查询结果同步数据
|
||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||
if (dataJson != null) {
|
||||
// 同步额度数据(limitdatas)
|
||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||
com.alibaba.fastjson.JSONObject limitData = limitdatas.getJSONObject(0);
|
||||
userShipperEntity1.setLimitTime(new Date());
|
||||
userShipperEntity1.setAuthorizedQuota(limitData.getBigDecimal("nlimitmny"));
|
||||
userShipperEntity1.setAuthorizedUsedAmount(limitData.getBigDecimal("nengrossmny"));
|
||||
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
|
||||
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("更新货主额度同步成功,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
||||
} else {
|
||||
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
|
||||
// 解析org_code,支持多组织
|
||||
List<Long> orgCodeList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
// 解析JSON数组:[{"name":"通宇","code":2830,"ncOrganizationId":"145222101124","names":2830},...]
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long code = orgItem.getLong("code");
|
||||
if (code != null) {
|
||||
orgCodeList.add(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("解析org_code成功,custcode={},orgCodeList={}", userShipperEntity.getCustomerNcCode(), orgCodeList);
|
||||
} catch (Exception e) {
|
||||
log.error("解析org_code失败,custcode={},orgCode={}", userShipperEntity.getCustomerNcCode(), userShipperEntity1.getOrgCode(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果org_code为空或解析失败,使用原来的organizationId方式
|
||||
if (orgCodeList.isEmpty()) {
|
||||
Long organizationId = userShipperEntity1.getOrganizationId();
|
||||
if (organizationId != null) {
|
||||
orgCodeList.add(organizationId);
|
||||
log.info("org_code为空,使用organizationId,custcode={},organizationId={}", userShipperEntity.getCustomerNcCode(), organizationId);
|
||||
}
|
||||
}
|
||||
|
||||
if (orgCodeList.isEmpty()) {
|
||||
log.warn("货主无组织信息,跳过查询,custcode={}", userShipperEntity.getCustomerNcCode());
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历每个组织code,分别调用接口
|
||||
int orgIndex = 0; // 组织循环计数器
|
||||
for (Long orgCode : orgCodeList) {
|
||||
String orgcode = userShipperMapper.getOrgNcCode(orgCode);
|
||||
if (StringUtils.isEmpty(orgcode)) {
|
||||
log.warn("组织NC编码为空,跳过查询,custcode={},orgCode={}", userShipperEntity.getCustomerNcCode(), orgCode);
|
||||
orgIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 从orgCode数组中获取当前组织的ncCustomer字段
|
||||
String ncCustomer = null;
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long itemCode = orgItem.getLong("code");
|
||||
if (orgCode.equals(itemCode)) {
|
||||
ncCustomer = orgItem.getString("ncCustomer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(ncCustomer)) {
|
||||
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode, userShipperEntity.getCustomerNcCode());
|
||||
orgIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
|
||||
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
|
||||
queryParam.put("orgcode", orgcode);
|
||||
log.info("调用赊销额度查询接口,custcode={},ncCustomer={},orgcode={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode);
|
||||
|
||||
// 同步协议明细(agreedaydatas),与limitdatas独立
|
||||
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
|
||||
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
|
||||
// 先删除该货主已有的协议明细,避免重复
|
||||
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
|
||||
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
|
||||
int i;
|
||||
for (i = 0; i < agreedaydatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||
AgreementDetails agreementDetails = new AgreementDetails();
|
||||
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
|
||||
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
|
||||
agreementDetails.setCode(agreeItem.getString("code"));
|
||||
agreementDetails.setPday(agreeItem.getString("pday"));
|
||||
agreementDetails.setPname(agreeItem.getString("pname"));
|
||||
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
|
||||
agreementDetails.setPcode(agreeItem.getString("pcode"));
|
||||
agreementDetails.setPtype(agreeItem.getString("ptype"));
|
||||
agreementDetailsMapper.insert(agreementDetails);
|
||||
String queryResult = HttpRequest.post(queryUrl)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("uap_token", uapToken)
|
||||
.header("uap_usercode", uapUsercode)
|
||||
.header("uap_dataSource", uapDataSource)
|
||||
.header("token", "94B3992EAD9747D3598CC6F7775F6239B5DC3B526DF7DE0091CB8B2D")
|
||||
.body(queryParam.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
log.info("赊销额度查询接口返回,custcode={},ncCustomer={},orgcode={},result={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode, queryResult);
|
||||
|
||||
if (StringUtils.isNotEmpty(queryResult)) {
|
||||
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
|
||||
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
|
||||
|
||||
// 第三步:查询成功,更新货主的额度同步时间(limitTime)
|
||||
|
||||
if (userShipperEntity1 != null) {
|
||||
// 根据查询结果同步数据
|
||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||
if (dataJson != null) {
|
||||
// 解析现有的orgCode数组(提到外面,limitdatas和agreedaydatas共用)
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||
try {
|
||||
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
|
||||
} catch (Exception e) {
|
||||
log.warn("解析现有orgCode失败,将创建新的数组,shipperId={}", userShipperEntity1.getShipperId());
|
||||
}
|
||||
}
|
||||
userShipperEntity1.setAgreementCount(i);
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("同步协议明细成功,custcode={},shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId(), agreedaydatas.size());
|
||||
|
||||
// 同步额度数据(limitdatas)
|
||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||
// 将limitdatas按orgcode值合并到orgCode数组中
|
||||
for (int i = 0; i < limitdatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
||||
String limitOrgcode = limitItem.getString("orgcode"); // 例如 "NA01"
|
||||
|
||||
if (StringUtils.isNotEmpty(limitOrgcode)) {
|
||||
// 在orgCode数组中查找code匹配的组织(注意:这里的code是2830, 2839等)
|
||||
boolean found = false;
|
||||
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||
String orgItemCode = orgItem.getString("code"); // orgCode数组中的code
|
||||
|
||||
// 如果orgCode数组中的code与当前orgCode(如2830)匹配,将limitdatas的字段添加到该组织对象中
|
||||
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||
orgItem.putAll(limitItem);
|
||||
found = true;
|
||||
log.info("匹配到code={}的组织,将额度数据(orgcode={})添加到orgCode中,custcode={}", orgItemCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有找到匹配的组织,创建新的组织对象
|
||||
if (!found) {
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("code", orgCode); // 使用当前orgCode
|
||||
newOrgItem.putAll(limitItem);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
log.info("未找到code={}的组织,创建新组织并添加额度数据(orgcode={}),custcode={}", orgCode, limitOrgcode, userShipperEntity1.getCustomerNcCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 使用limitdatas中的数据更新额度字段
|
||||
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
||||
userShipperEntity1.setLimitTime(new Date());
|
||||
userShipperEntity1.setAuthorizedQuota(firstLimitData.getBigDecimal("nlimitmny"));
|
||||
userShipperEntity1.setAuthorizedUsedAmount(firstLimitData.getBigDecimal("nengrossmny"));
|
||||
userShipperEntity1.setSettlementCurrency(firstLimitData.getString("currencycode"));
|
||||
userShipperEntity1.setCreditAmount(firstLimitData.getBigDecimal("nbalancemny"));
|
||||
|
||||
log.info("更新货主额度同步成功,custcode={},orgcode={},shipperId={},orgCode组织数={}", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), orgCodeArray.size());
|
||||
} else {
|
||||
log.info("赊销额度查询无limitdatas返回,跳过额度更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
|
||||
// 同步协议明细(agreedaydatas),与limitdatas独立
|
||||
com.alibaba.fastjson.JSONArray agreedaydatas = dataJson.getJSONArray("agreedaydatas");
|
||||
if (agreedaydatas != null && !agreedaydatas.isEmpty()) {
|
||||
// 只在第一次循环时删除该货主的所有协议明细,避免重复
|
||||
if (orgIndex == 0) {
|
||||
agreementDetailsMapper.delete(new LambdaQueryWrapper<AgreementDetails>()
|
||||
.eq(AgreementDetails::getShipperId, userShipperEntity1.getShipperId()));
|
||||
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
||||
}
|
||||
|
||||
// 将agreedaydatas保存到orgCode数组中,与code同一级别
|
||||
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||
boolean foundOrg = false;
|
||||
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||
String orgItemCode = orgItem.getString("code");
|
||||
|
||||
// 找到当前组织,将agreedaydatas添加到该组织对象中
|
||||
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||
orgItem.put("agreedaydatas", agreedaydatas);
|
||||
foundOrg = true;
|
||||
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没找到,创建新组织对象
|
||||
if (!foundOrg) {
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("code", orgCode);
|
||||
newOrgItem.put("agreedaydatas", agreedaydatas);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
log.info("创建新组织并添加agreedaydatas,code={},共{}条", orgCode, agreedaydatas.size());
|
||||
}
|
||||
|
||||
// 同时插入到agreement_details表
|
||||
for (int i = 0; i < agreedaydatas.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||
AgreementDetails agreementDetails = new AgreementDetails();
|
||||
agreementDetails.setShipperId(userShipperEntity1.getShipperId());
|
||||
agreementDetails.setOrgcode(agreeItem.getString("orgcode"));
|
||||
agreementDetails.setCode(agreeItem.getString("code"));
|
||||
agreementDetails.setPday(agreeItem.getString("pday"));
|
||||
agreementDetails.setPname(agreeItem.getString("pname"));
|
||||
agreementDetails.setPtypename(agreeItem.getString("ptypename"));
|
||||
agreementDetails.setPcode(agreeItem.getString("pcode"));
|
||||
agreementDetails.setPtype(agreeItem.getString("ptype"));
|
||||
agreementDetailsMapper.insert(agreementDetails);
|
||||
}
|
||||
log.info("同步协议明细成功,custcode={},orgcode={},shipperId={},共{}条", userShipperEntity1.getCustomerNcCode(), orgcode, userShipperEntity1.getShipperId(), agreedaydatas.size());
|
||||
} else {
|
||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
|
||||
// 保存更新后的orgCode数组(统一在最后保存)
|
||||
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
||||
} else {
|
||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
} else {
|
||||
log.info("赊销额度查询无data返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
log.warn("未找到对应货主,custcode={},orgCode={}", userShipperEntity.getCustomerNcCode(), orgCode);
|
||||
}
|
||||
} else {
|
||||
log.warn("未找到对应货主,custcode={},organizationId={}", userShipperEntity1.getCustomerNcCode(), userShipperDTO.getOrganizationId());
|
||||
log.warn("赊销额度查询返回为空,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||
}
|
||||
} else {
|
||||
log.warn("赊销额度查询返回为空,custcode={}", userShipperEntity1.getCustomerNcCode());
|
||||
} catch (Exception e) {
|
||||
log.error("查询赊销额度异常,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode, e);
|
||||
} finally {
|
||||
orgIndex++; // 计数器递增
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("查询赊销额度异常,custcode={}", userShipperEntity1.getCustomerNcCode(), e);
|
||||
}
|
||||
|
||||
// 所有组织循环完成后,统一更新数据库(只更新一次)
|
||||
if (userShipperEntity1 != null) {
|
||||
userShipperMapper.updateById(userShipperEntity1);
|
||||
log.info("批量更新货主额度完成,custcode={},shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(allResults);
|
||||
|
||||
+51
-17
@@ -13,6 +13,7 @@ import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.common.redis.service.RedisLock;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
|
||||
import com.mhd.user.domain.userShipperMdmSync.entity.UserShipperMdmSyncEntity;
|
||||
import com.mhd.user.domain.userShipperMdmSync.mapper.UserShipperMdmSyncMapper;
|
||||
@@ -69,13 +70,28 @@ public class UserShipperMasterDataSyncService {
|
||||
public void syncMasterData() {
|
||||
LoginUser loginUser = requireLoginUser();
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
String lockKey = LOCK_PREFIX + organizationId;
|
||||
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
|
||||
if (!locked) {
|
||||
throw new ServiceException("当前组织正在同步主数据,请稍后再试");
|
||||
}
|
||||
markSyncInProgress(organizationId);
|
||||
asyncUserShipperMasterDataSyncService.syncMasterDataAsync(loginUser, lockKey);
|
||||
new Thread(() -> {
|
||||
String lockKey = LOCK_PREFIX + organizationId;
|
||||
try {
|
||||
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
|
||||
if (!locked) {
|
||||
log.warn("当前组织正在同步主数据,跳过本次同步");
|
||||
return;
|
||||
}
|
||||
markSyncInProgress(organizationId);
|
||||
try {
|
||||
ShipperMasterDataSyncResultVo resultVo = doSync(loginUser);
|
||||
log.info("MDM同步完成: {}", resultVo);
|
||||
} catch (Exception e) {
|
||||
log.error("同步主数据失败, organizationId={}", organizationId, e);
|
||||
markSyncFailed(organizationId, e.getMessage());
|
||||
} finally {
|
||||
redisLock.unlock(lockKey);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取同步锁失败", e);
|
||||
}
|
||||
}, "mdm-sync-thread").start();
|
||||
}
|
||||
|
||||
public ShipperMasterDataSyncResultVo executeSync(LoginUser loginUser) {
|
||||
@@ -184,14 +200,31 @@ public class UserShipperMasterDataSyncService {
|
||||
targetOrganizationId, organizationId, topOrganizationId, loginUser);
|
||||
UserShipperPo existing = existingMap.get(matchKey);
|
||||
if (existing == null) {
|
||||
userShipperApplicationService.addEnterpriseShipperFromMasterData(
|
||||
record, loginUser, saveTarget.getOrganizationId(),
|
||||
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId());
|
||||
resultVo.setAddCount(resultVo.getAddCount() + 1);
|
||||
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName(
|
||||
ncCode, companyName, saveTarget.getOrganizationId());
|
||||
if (added != null) {
|
||||
existingMap.put(matchKey, added);
|
||||
// 按 ncCode+companyName 未匹配到时,再按公司名跨组织查询已存在的同公司名委托方。
|
||||
// 同一个客商在 MDM 中可能属于不同组织(nc 编码不同),但本地是同一条委托方记录。
|
||||
// 如果匹配到的委托方属于“另外的组织”(非当前同步组织),则不新增,
|
||||
// 而是在其 orgCode 上追加当前同步组织的信息(连同本组织下的 ncCustomer)。
|
||||
UserShipperEntity existingByName = userShipperApplicationService
|
||||
.findFirstByShipperEnterpriseNameAcrossOrgs(companyName);
|
||||
if (existingByName != null
|
||||
&& saveTarget.getOrganizationId() != null
|
||||
&& !saveTarget.getOrganizationId().equals(existingByName.getOrganizationId())) {
|
||||
userShipperApplicationService.appendOrganizationToExistingShipper(
|
||||
existingByName, saveTarget.getOrganizationId(),
|
||||
saveTarget.getOrganizationName(), ncCode, loginUser);
|
||||
resultVo.setLinkCount(resultVo.getLinkCount() + 1);
|
||||
log.info("MDM同步按公司名跨组织合并:customerNcCode={},companyName={},本组织code={},已存在委托方shipperId={}(其他组织)",
|
||||
ncCode, companyName, saveTarget.getOrganizationId(), existingByName.getShipperId());
|
||||
} else {
|
||||
userShipperApplicationService.addEnterpriseShipperFromMasterData(
|
||||
record, loginUser, saveTarget.getOrganizationId(),
|
||||
saveTarget.getOrganizationName(), saveTarget.getTopOrganizationId());
|
||||
resultVo.setAddCount(resultVo.getAddCount() + 1);
|
||||
UserShipperPo added = userShipperApplicationService.findByCustomerNcCodeAndCompanyName(
|
||||
ncCode, companyName, saveTarget.getOrganizationId());
|
||||
if (added != null) {
|
||||
existingMap.put(matchKey, added);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
userShipperApplicationService.updateEnterpriseShipperFromMasterData(
|
||||
@@ -261,8 +294,9 @@ public class UserShipperMasterDataSyncService {
|
||||
entity.setLastSyncTime(syncTime);
|
||||
entity.setSyncStatus(resultVo.getFailCount() > 0 ? 2 : 1);
|
||||
String syncMessage = String.format(
|
||||
"新增%d,更新%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
|
||||
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getSkipCount(), resultVo.getFailCount(),
|
||||
"新增%d,更新%d,关联%d,跳过%d,失败%d;组织NC=%s;跳过明细[组织不匹配:%d,非客户:%d,内部单位:%d,停用:%d,其他:%d]",
|
||||
resultVo.getAddCount(), resultVo.getUpdateCount(), resultVo.getLinkCount(),
|
||||
resultVo.getSkipCount(), resultVo.getFailCount(),
|
||||
orgNcCode, skipOrgMismatch, skipNotCustomer, skipInternalOrg, skipDisabled, skipOther);
|
||||
if (resultVo.getFailCount() > 0 && !resultVo.getErrorMessages().isEmpty()) {
|
||||
syncMessage += ";" + resultVo.getErrorMessages().get(0);
|
||||
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package com.mhd.user.application.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.user.interfaces.dto.wechat.WxPhoneNumberDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 微信小程序手机号快速验证
|
||||
* appId/appSecret 在 bootstrap.yml / Nacos 中配置,不同环境配置不同值即可
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WechatMiniAppService {
|
||||
|
||||
private static final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
||||
private static final String GET_PHONE_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";
|
||||
|
||||
@Value("${wechat.miniapp.appId:}")
|
||||
private String appId;
|
||||
|
||||
@Value("${wechat.miniapp.appSecret:}")
|
||||
private String appSecret;
|
||||
|
||||
/** access_token 缓存:{token, expireTime} */
|
||||
private volatile String cachedToken;
|
||||
private volatile long tokenExpireTime;
|
||||
|
||||
public AjaxResult wxGetPhoneNumber(WxPhoneNumberDTO dto, Long organizationId) {
|
||||
if (dto == null || dto.getCode() == null || dto.getCode().isEmpty()) {
|
||||
return AjaxResult.error("code 不能为空");
|
||||
}
|
||||
if (appId.isEmpty() || appSecret.isEmpty()) {
|
||||
return AjaxResult.error("未配置 wechat.miniapp.appId / wechat.miniapp.appSecret");
|
||||
}
|
||||
|
||||
try {
|
||||
String accessToken = getAccessToken();
|
||||
String body = "{\"code\":\"" + dto.getCode() + "\"}";
|
||||
String phoneJson = doPost(String.format(GET_PHONE_URL, accessToken), body);
|
||||
JSONObject result = JSONObject.parseObject(phoneJson);
|
||||
|
||||
int errcode = result.getIntValue("errcode");
|
||||
if (errcode != 0) {
|
||||
String errmsg = result.getString("errmsg");
|
||||
log.error("微信手机号解密失败, errcode={}, errmsg={}", errcode, errmsg);
|
||||
return AjaxResult.error("获取手机号失败:" + errmsg);
|
||||
}
|
||||
|
||||
JSONObject phoneInfo = result.getJSONObject("phone_info");
|
||||
if (phoneInfo == null) {
|
||||
return AjaxResult.error("未获取到手机号信息");
|
||||
}
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("phoneNumber", phoneInfo.getString("phoneNumber"));
|
||||
data.put("purePhoneNumber", phoneInfo.getString("purePhoneNumber"));
|
||||
data.put("countryCode", phoneInfo.getString("countryCode"));
|
||||
return AjaxResult.success(data);
|
||||
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("微信手机号验证异常", e);
|
||||
return AjaxResult.error("微信手机号验证失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String getAccessToken() {
|
||||
if (cachedToken != null && System.currentTimeMillis() < tokenExpireTime) {
|
||||
return cachedToken;
|
||||
}
|
||||
synchronized (this) {
|
||||
if (cachedToken != null && System.currentTimeMillis() < tokenExpireTime) {
|
||||
return cachedToken;
|
||||
}
|
||||
String url = String.format(ACCESS_TOKEN_URL, appId, appSecret);
|
||||
String response = doGet(url);
|
||||
JSONObject result = JSONObject.parseObject(response);
|
||||
if (result.containsKey("errcode") && result.getIntValue("errcode") != 0) {
|
||||
throw new ServiceException("获取微信 access_token 失败:" + result.getString("errmsg"));
|
||||
}
|
||||
cachedToken = result.getString("access_token");
|
||||
int expiresIn = result.getIntValue("expires_in");
|
||||
tokenExpireTime = System.currentTimeMillis() + (expiresIn - 300) * 1000L;
|
||||
return cachedToken;
|
||||
}
|
||||
}
|
||||
|
||||
private String doGet(String urlStr) {
|
||||
try {
|
||||
URL url = new URL(urlStr);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(10000);
|
||||
conn.setReadTimeout(10000);
|
||||
return readResponse(conn);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("微信接口请求失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String doPost(String urlStr, String body) {
|
||||
try {
|
||||
URL url = new URL(urlStr);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-Type", "application/json;charset=utf-8");
|
||||
conn.setConnectTimeout(10000);
|
||||
conn.setReadTimeout(10000);
|
||||
try (OutputStream os = conn.getOutputStream()) {
|
||||
os.write(body.getBytes(StandardCharsets.UTF_8));
|
||||
os.flush();
|
||||
}
|
||||
return readResponse(conn);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("微信接口请求失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String readResponse(HttpURLConnection conn) throws Exception {
|
||||
int code = conn.getResponseCode();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
code >= 400 ? conn.getErrorStream() : conn.getInputStream(), StandardCharsets.UTF_8));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
reader.close();
|
||||
if (code >= 400) {
|
||||
throw new ServiceException("微信接口 HTTP " + code + ":" + sb);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
+3
@@ -291,4 +291,7 @@ public class UserShipperEntity extends BaseVOEntity {
|
||||
@ApiModelProperty(name = "是否校验信用")
|
||||
private String isCheckCredit;
|
||||
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
|
||||
}
|
||||
+6
@@ -31,6 +31,12 @@ public interface UserRepositoryInterface extends IService<UserEntity> {
|
||||
|
||||
|
||||
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
|
||||
|
||||
/**
|
||||
* 仅根据用户登录账号查询用户(不区分组织,SSO等场景使用)
|
||||
*/
|
||||
UserPo findByUserAccount(String userAccount);
|
||||
|
||||
UserPo getUserByDingUserId(String dingUserId);
|
||||
|
||||
UserPo selectUserShipperList(UserPo userPo);
|
||||
|
||||
+5
@@ -33,6 +33,11 @@ public interface UserMapper extends BaseMapper<UserEntity> {
|
||||
|
||||
UserPo findByTopOrganizationIdAndUserAccount(UserDO userDO);
|
||||
|
||||
/**
|
||||
* 仅根据用户登录账号查询用户(不区分组织,SSO等场景使用)
|
||||
*/
|
||||
UserPo findByUserAccount(@Param("userAccount") String userAccount);
|
||||
|
||||
UserPo getUserByDingUserId(@Param("dingUserId") String dingUserId);
|
||||
|
||||
UserPo findByTopOrganizationIdAndUserPhone(UserDO userDO);
|
||||
|
||||
+6
@@ -52,5 +52,11 @@ public interface UserShipperMapper extends BaseMapper<UserShipperEntity> {
|
||||
@Param("companyName") String companyName,
|
||||
@Param("organizationId") Long organizationId);
|
||||
|
||||
/**
|
||||
* 按公司名跨组织查询第一个未删除的委托方(包含 orgCode 字段)。
|
||||
* 用于 MDM 同步时按"公司名"匹配已存在的委托方(可能是其他组织的),以便在其 orgCode 上追加新组织。
|
||||
*/
|
||||
UserShipperEntity findFirstByShipperEnterpriseNameAcrossOrgs(@Param("shipperEnterpriseName") String shipperEnterpriseName);
|
||||
|
||||
String getOrgNcCode(Long organizationId);
|
||||
}
|
||||
+5
@@ -79,6 +79,11 @@ public class UserRepositoryImpl extends ServiceImpl<UserMapper,UserEntity> imple
|
||||
return userMapper.findByTopOrganizationIdAndUserAccount(userDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPo findByUserAccount(String userAccount) {
|
||||
return userMapper.findByUserAccount(userAccount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPo getUserByDingUserId(String dingUserId) {
|
||||
return userMapper.getUserByDingUserId(dingUserId);
|
||||
|
||||
+2
@@ -354,4 +354,6 @@ public class UserShipperPo implements Serializable {
|
||||
private BigDecimal agreementCount;
|
||||
@ApiModelProperty(name = "是否校验信用")
|
||||
private String isCheckCredit;
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
}
|
||||
+3
@@ -322,4 +322,7 @@ public class UserShipperDO extends UserDO {
|
||||
private String userPassword;
|
||||
@ApiModelProperty(name = "是否校验信用")
|
||||
private String isCheckCredit;
|
||||
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
}
|
||||
+7
@@ -82,6 +82,13 @@ public class UserDomainService {
|
||||
return userRepositoryInterface.findByTopOrganizationIdAndUserAccount(userDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅根据用户登录账号查询用户(不区分组织,SSO等场景使用)
|
||||
*/
|
||||
public UserPo findByUserAccount(String userAccount) {
|
||||
return userRepositoryInterface.findByUserAccount(userAccount);
|
||||
}
|
||||
|
||||
public UserPo getUserByDingUserId(String dingUserId) {
|
||||
return userRepositoryInterface.getUserByDingUserId(dingUserId);
|
||||
}
|
||||
|
||||
@@ -268,4 +268,7 @@ public class UserShipperDTO extends UserDTO {
|
||||
private String userPassword;
|
||||
@ApiModelProperty(name = "是否校验信用")
|
||||
private String isCheckCredit;
|
||||
|
||||
@ApiModelProperty(name = "组织代码")
|
||||
private String orgCode;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.mhd.user.interfaces.dto.wechat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信小程序手机号快速验证——请求参数
|
||||
*/
|
||||
@Data
|
||||
public class WxPhoneNumberDTO {
|
||||
|
||||
@ApiModelProperty("wx.getPhoneNumber 返回的 code(注意:非 wx.login 的 code)")
|
||||
private String code;
|
||||
}
|
||||
@@ -12,9 +12,11 @@ import com.mhd.common.log.enums.BusinessType;
|
||||
import com.mhd.user.application.service.UserApplicationService;
|
||||
import com.mhd.user.application.service.UserDriverApplicationService;
|
||||
import com.mhd.user.application.service.UserShipperApplicationService;
|
||||
import com.mhd.user.domain.roleAggregate.repository.todo.RoleDo;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserDocumentWarningQueryPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.*;
|
||||
import com.mhd.user.domain.userAggregate.service.UserRoleDomainService;
|
||||
|
||||
import com.mhd.user.interfaces.assember.*;
|
||||
import com.mhd.user.interfaces.dto.addDTO.*;
|
||||
import com.mhd.user.interfaces.dto.queryDTO.UserDataPermissionQueryDTO;
|
||||
@@ -498,6 +500,13 @@ public class UserAPI extends BaseController {
|
||||
return R.ok(sysUserVo, "操作成功");
|
||||
}
|
||||
|
||||
@ApiOperation("仅根据用户登录账号获取用户信息(不区分组织,SSO等场景)")
|
||||
@GetMapping("/getUserByUserAccount")
|
||||
public R<LoginUser> getUserByUserAccount(@RequestParam(value = "userAccount") String userAccount) {
|
||||
LoginUser sysUserVo = userApplicationService.getUserByUserAccount(userAccount);
|
||||
return R.ok(sysUserVo, "操作成功");
|
||||
}
|
||||
|
||||
@ApiOperation("根据用户钉钉用户id获取用户信息")
|
||||
@GetMapping("/getUserByDingUserId")
|
||||
public R<LoginUser> getUserByDingUserId(@RequestParam(value = "dingUserId") String dingUserId) {
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.log.annotation.Log;
|
||||
import com.mhd.common.log.enums.BusinessType;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.system.api.domain.UserShipperFeignDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.application.service.UserApplicationService;
|
||||
import com.mhd.user.application.service.UserShipperApplicationService;
|
||||
import com.mhd.user.domain.userAggregate.repository.todo.*;
|
||||
@@ -18,6 +20,7 @@ import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.common.security.annotation.RepeatSubmit;
|
||||
import com.mhd.common.security.service.TokenService;
|
||||
import com.mhd.user.application.service.UserShipperMasterDataSyncService;
|
||||
import com.mhd.user.application.service.WechatMiniAppService;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO;
|
||||
import com.mhd.user.interfaces.vo.SettlementInfoQueryVo;
|
||||
import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo;
|
||||
@@ -42,6 +45,8 @@ public class UserShipperAPI extends BaseController {
|
||||
@Resource
|
||||
private UserShipperMasterDataSyncService userShipperMasterDataSyncService;
|
||||
@Resource
|
||||
private WechatMiniAppService wechatMiniAppService;
|
||||
@Resource
|
||||
private UserApplicationService userApplicationService;
|
||||
@Resource
|
||||
private UserShipperAssember userShipperAssember;
|
||||
@@ -342,4 +347,13 @@ public class UserShipperAPI extends BaseController {
|
||||
}
|
||||
return AjaxResult.success(resultMap);
|
||||
}
|
||||
|
||||
@ApiOperation("微信小程序手机号快速验证")
|
||||
@PostMapping("/wxGetPhoneNumber")
|
||||
public AjaxResult wxGetPhoneNumber(@RequestBody com.mhd.user.interfaces.dto.wechat.WxPhoneNumberDTO dto) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long organizationId = (loginUser != null && loginUser.getUserPo() != null)
|
||||
? loginUser.getUserPo().getOrganizationId() : null;
|
||||
return wechatMiniAppService.wxGetPhoneNumber(dto, organizationId);
|
||||
}
|
||||
}
|
||||
+3
@@ -18,6 +18,9 @@ public class ShipperMasterDataSyncResultVo {
|
||||
@ApiModelProperty("更新条数")
|
||||
private int updateCount;
|
||||
|
||||
@ApiModelProperty("关联到已存在委托方条数(按公司名跨组织匹配到同公司名委托方,仅在 orgCode 上追加新组织,不新增委托方)")
|
||||
private int linkCount;
|
||||
|
||||
@ApiModelProperty("跳过条数")
|
||||
private int skipCount;
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
@@ -42,4 +42,13 @@ spring:
|
||||
max-request-size: 50MB
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
feign:
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connectTimeout: 10000
|
||||
readTimeout: 120000
|
||||
mhd-third-party-service:
|
||||
connectTimeout: 10000
|
||||
readTimeout: 120000
|
||||
@@ -153,6 +153,13 @@
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<!-- 仅根据用户登录账号查询用户(不区分组织,SSO等场景使用) -->
|
||||
<select id="findByUserAccount" parameterType="java.lang.String"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
<include refid="selectUserVo"/>
|
||||
and a.user_account = #{userAccount}
|
||||
limit 1
|
||||
</select>
|
||||
<!-- 根据用户钉钉userID查询用户 -->
|
||||
<select id="getUserByDingUserId" parameterType="java.lang.String"
|
||||
resultType="com.mhd.common.core.domain.po.UserPo">
|
||||
@@ -264,8 +271,8 @@
|
||||
<!-- 数据权限:南光组织(organizationId=2827)查全部,其他组织查自己 -->
|
||||
<if test="organizationId != null">
|
||||
<!-- 如果设置了 organizationId,添加 organization_id 条件 -->
|
||||
and a.organization_id = #{organizationId}
|
||||
and a.organization_name IS NOT NULL
|
||||
and (a.organization_id = #{organizationId}
|
||||
or b.ORG_CODE like concat('%', to_char(#{organizationId}), '%'))
|
||||
</if>
|
||||
<if test="topOrganizationId != null">
|
||||
<!-- 如果设置了 topOrganizationId,添加 top_organization_id 条件 -->
|
||||
@@ -773,7 +780,13 @@
|
||||
</if>
|
||||
/*组织ID - 数据隔离:南光组织(organizationId=2827)查询全部,其他组织查询自己组织的数据*/
|
||||
<if test="organizationId !=null">
|
||||
AND u.organization_id = #{organizationId}
|
||||
AND (
|
||||
u.organization_id = #{organizationId}
|
||||
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
|
||||
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
|
||||
)
|
||||
AND u.organization_name IS NOT NULL
|
||||
</if>
|
||||
GROUP BY u.user_id, u.user_name, u.user_area_address, u.user_area_county_id, u.user_area_name, u.user_phone, u.has_default_address, b.shipper_id, b.shipper_enterprise_name, u.DOCUMENT_PREPARER_NC_CODE, b.CUSTOMER_NC_CODE, u.organization_id, u.top_organization_id, b.settlement_currency
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
a.esign_auth_status,
|
||||
a.esign_enterprise_status,
|
||||
a.CUSTOMER_NC_CODE,
|
||||
a.org_code,
|
||||
a.esign_seal_auth_id
|
||||
FROM user_shipper a
|
||||
LEFT JOIN "USER" b ON a.user_id = b.user_id
|
||||
@@ -171,7 +172,8 @@
|
||||
b.LIMIT_TIME,
|
||||
b.CREDIT_AMOUNT,
|
||||
b.IS_CHECK_CREDIT,
|
||||
b.AGREEMENT_COUNT
|
||||
b.AGREEMENT_COUNT,
|
||||
b.org_code
|
||||
FROM "USER" a
|
||||
LEFT JOIN user_shipper b ON a.user_id = b.user_id
|
||||
left join (select user_id, LISTAGG(DISTINCT r.role_name, '&') WITHIN GROUP(ORDER BY r.role_name) AS roleName
|
||||
@@ -375,7 +377,13 @@
|
||||
</if>
|
||||
/*用户组织ID*/
|
||||
<if test="organizationId !=null">
|
||||
and a.organization_id = #{organizationId}
|
||||
AND (
|
||||
a.organization_id = #{organizationId}
|
||||
OR b.org_code LIKE concat('%"code":"', #{organizationId}, '"%')
|
||||
OR b.org_code LIKE concat('%code:', #{organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%code: ', #{organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%"code":', #{organizationId}, '%')
|
||||
)
|
||||
</if>
|
||||
/*组织名称*/
|
||||
<if test="organizationName != null and organizationName != ''">
|
||||
@@ -511,6 +519,7 @@
|
||||
</foreach>
|
||||
OR a.create_by = #{createBy})
|
||||
</if>
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="getShipperCountByMatter" parameterType="com.mhd.common.core.domain.todo.StatisticalMattersDo"
|
||||
@@ -620,6 +629,22 @@
|
||||
AND a.organization_id = #{organizationId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 按公司名跨组织查询第一个未删除的委托方(包含 orgCode),用于 MDM 同步时按"公司名"匹配已存在委托方 -->
|
||||
<select id="findFirstByShipperEnterpriseNameAcrossOrgs" resultType="com.mhd.user.domain.userAggregate.entity.UserShipperEntity">
|
||||
SELECT b.shipper_id,
|
||||
b.user_id,
|
||||
b.customer_nc_code,
|
||||
b.data_source,
|
||||
b.shipper_enterprise_name,
|
||||
b.user_name_shipper,
|
||||
b.org_code
|
||||
FROM user_shipper b
|
||||
WHERE b.del_flag = 1
|
||||
AND b.shipper_enterprise_name = #{shipperEnterpriseName}
|
||||
ORDER BY b.shipper_id ASC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getOrgNcCode" resultType="java.lang.String">
|
||||
select NC_CODE from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID = #{organizationId}
|
||||
</select>
|
||||
|
||||
+103
@@ -17,6 +17,7 @@ import com.mhd.bms.domain.billManage.service.BillManageDomainService;
|
||||
import com.mhd.bms.domain.billOperationLog.repository.todo.BillOperationLogDO;
|
||||
import com.mhd.bms.domain.billOperationLog.service.BillOperationLogDomainService;
|
||||
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
|
||||
import com.mhd.bms.domain.billingStatement.repository.po.BillingStatementPO;
|
||||
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
|
||||
import com.mhd.bms.domain.ncLog.entity.NcLog;
|
||||
import com.mhd.bms.domain.ncLog.repository.mapper.NcLogMapper;
|
||||
@@ -384,6 +385,108 @@ public class BillManageApplicationService {
|
||||
return flag && flagTwo && three;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制账单
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean copyBill(BillManageDTO billManageDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
if (billManageDTO.getBillManageId() == null) {
|
||||
throw new ServiceException("原账单id不能为空");
|
||||
}
|
||||
// 1. 获取原账单信息
|
||||
BillManagePO originalBill = billManageDomainService.getInfo(billManageDTO.getBillManageId());
|
||||
if (null == originalBill) {
|
||||
throw new ServiceException("原账单信息未找到");
|
||||
}
|
||||
// 2. 获取原账单明细
|
||||
List<BillDetailPO> originalDetails = billDetailDomainService.getDetailsByBillManageId(billManageDTO.getBillManageId());
|
||||
if (originalDetails == null || originalDetails.isEmpty()) {
|
||||
throw new ServiceException("原账单明细为空,无法复制");
|
||||
}
|
||||
// 3. 创建新账单,除账单编号外完全复制原账单
|
||||
String newBillNumber = OrderSequence.getOrderCode("ZD");
|
||||
BillManage newBill = new BillManage();
|
||||
BeanUtils.copyProperties(originalBill, newBill);
|
||||
newBill.setBillManageId(null);
|
||||
newBill.setBillNumber(newBillNumber);
|
||||
newBill.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
newBill.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
newBill.setCreateTime(new Date());
|
||||
newBill.setUpdateBy(loginUser.getUserPo().getUserId());
|
||||
newBill.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
newBill.setUpdateTime(new Date());
|
||||
newBill.setDelFlag(1);
|
||||
// 复制后重置状态字段为初始值
|
||||
// 账单状态、对账状态、发票状态重置
|
||||
newBill.setBillState(1); // 1-未确认
|
||||
newBill.setBillStep(1); // 1-发起对账
|
||||
newBill.setReconciliationStatus(0); // 1-暂未确认
|
||||
newBill.setIsInvoice(0); // 0-未索取
|
||||
// 实收=0,未收=账单金额
|
||||
newBill.setActualReceivedAmount(BigDecimal.ZERO);
|
||||
newBill.setBillAmountUnsettled(newBill.getBillAmount());
|
||||
newBill.setBillAmountSettlement(BigDecimal.ZERO);
|
||||
// NC同步状态重置
|
||||
newBill.setSynchronousStatus(0); // 0-未同步
|
||||
newBill.setSkSynchronousStatus(0); // 0-未同步
|
||||
// 清空发票、收款、推送相关字段
|
||||
newBill.setApplyNumber(null); // 发票申请单号
|
||||
newBill.setSettlementTime(null); // 收款时间
|
||||
newBill.setSynchronousTime(null); // 应收单推送时间
|
||||
newBill.setSkSynchronousTime(null); // 收款单推送时间
|
||||
newBill.setInvoiceId(null); // 发票表ID
|
||||
newBill.setInvoiceMakeTime(null); // 开票时间
|
||||
newBill.setNcId(null); // nc唯一标识(应收)
|
||||
newBill.setSkNcId(null); // nc唯一标识(收款)
|
||||
// 保存新账单
|
||||
boolean flag = billManageDomainService.saveEntity(newBill);
|
||||
if (!flag) {
|
||||
throw new ServiceException("复制账单失败,请重试");
|
||||
}
|
||||
// 4. 复制账单明细
|
||||
List<BillDetail> newDetailList = new ArrayList<>();
|
||||
for (BillDetailPO originalDetail : originalDetails) {
|
||||
BillDetail newDetail = new BillDetail();
|
||||
BeanUtils.copyProperties(originalDetail, newDetail);
|
||||
newDetail.setBillDetailId(null);
|
||||
newDetail.setBillManageId(newBill.getBillManageId());
|
||||
newDetail.setBillNumber(newBillNumber);
|
||||
newDetail.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
newDetail.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
newDetail.setCreateTime(new Date());
|
||||
newDetailList.add(newDetail);
|
||||
}
|
||||
Boolean flagTwo = billDetailDomainService.insertBatch(newDetailList);
|
||||
// 5. 复制计费流水(billing_statement)
|
||||
List<BillingStatementPO> originalStatements = billingStatementDomainService.getDetailsByManageId(billManageDTO.getBillManageId());
|
||||
boolean flagThree = true;
|
||||
if (originalStatements != null && !originalStatements.isEmpty()) {
|
||||
List<BillingStatement> newStatementList = new ArrayList<>();
|
||||
for (BillingStatementPO originalStatement : originalStatements) {
|
||||
BillingStatement newStatement = new BillingStatement();
|
||||
BeanUtils.copyProperties(originalStatement, newStatement);
|
||||
newStatement.setBillingStatementId(null);
|
||||
newStatement.setBillManageId(newBill.getBillManageId());
|
||||
newStatement.setCreateBy(loginUser.getUserPo().getUserId());
|
||||
newStatement.setCreateByName(loginUser.getUserPo().getUserName());
|
||||
newStatement.setCreateTime(new Date());
|
||||
newStatementList.add(newStatement);
|
||||
}
|
||||
flagThree = billingStatementDomainService.saveEntityBatch(newStatementList);
|
||||
}
|
||||
// 6. 保存操作日志
|
||||
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
|
||||
billOperationLogDO.setBillManageId(newBill.getBillManageId());
|
||||
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.copy_bill_text, originalBill.getBillNumber(), newBillNumber));
|
||||
billOperationLogDO.setOperationType(1);
|
||||
boolean three = billOperationLogDomainService.saveBillOperationLog(billOperationLogDO);
|
||||
return flag && flagTwo && flagThree && three;
|
||||
}
|
||||
|
||||
/**
|
||||
* 应收账单-客户确认
|
||||
*/
|
||||
|
||||
+139
-1
@@ -7,10 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.mhd.bms.application.server.billingRules.CostCalculationApplicationService;
|
||||
import com.mhd.bms.application.server.settlementCustomers.SettlementCustomersApplicationService;
|
||||
import com.mhd.bms.domain.billManage.entity.BillDetail;
|
||||
import com.mhd.bms.domain.billManage.entity.BillManage;
|
||||
import com.mhd.bms.domain.billManage.repository.facade.IBillDetailService;
|
||||
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
|
||||
import com.mhd.bms.domain.billingRules.repository.po.BillingParamsPO;
|
||||
import com.mhd.bms.domain.billingRules.repository.po.BillingRulesPO;
|
||||
import com.mhd.bms.domain.billingStatement.entity.BillingStatement;
|
||||
import com.mhd.bms.domain.billingStatement.repository.mapper.BillingStatementMapper;
|
||||
import com.mhd.bms.domain.billingStatement.repository.todo.BillingStatementDO;
|
||||
import com.mhd.bms.domain.billingStatement.service.BillingStatementDomainService;
|
||||
import com.mhd.bms.domain.businessDocument.entity.BusinessDocument;
|
||||
import com.mhd.bms.domain.businessDocument.repository.mapper.BusinessDocumentMapper;
|
||||
import com.mhd.bms.domain.businessDocument.repository.po.BusinessDocumentPO;
|
||||
import com.mhd.bms.domain.businessDocument.repository.todo.BusinessDocumentDO;
|
||||
import com.mhd.bms.domain.businessDocument.service.BusinessDocumentDomainService;
|
||||
@@ -30,6 +38,7 @@ import com.mhd.bms.infrastructure.feign.vo.ContractManagePO;
|
||||
import com.mhd.bms.infrastructure.feign.vo.ExpenseAccountPO;
|
||||
import com.mhd.bms.interfaces.assembler.businessDocument.BusinessDocumentAssembler;
|
||||
import com.mhd.bms.interfaces.dto.billingRules.CostCalculationDTO;
|
||||
import com.mhd.bms.interfaces.dto.billingStatement.BillingStatementDTO;
|
||||
import com.mhd.bms.interfaces.dto.businessDocument.BusinessDocumentDTO;
|
||||
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
|
||||
import com.mhd.common.core.domain.po.OrganizationPo;
|
||||
@@ -86,6 +95,14 @@ public class BusinessDocumentApplicationService {
|
||||
private CostCalculationApplicationService costCalculationApplicationService;
|
||||
@Autowired
|
||||
private ISettlementCustomersService settlementCustomersService;
|
||||
@Autowired
|
||||
private BusinessDocumentMapper businessDocumentMapper;
|
||||
@Autowired
|
||||
private BillingStatementMapper billingStatementMapper;
|
||||
@Autowired
|
||||
private IBillManageService billManageService;
|
||||
@Autowired
|
||||
private IBillDetailService billDetailService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -202,6 +219,123 @@ public class BusinessDocumentApplicationService {
|
||||
return businessDocumentDomainService.insert(businessDocumentDO);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean manageAddFee(BusinessDocumentDO businessDocumentDO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
//先设置组织信息,因为handleDate方法中需要使用topOrganizationId
|
||||
businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
businessDocumentDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
businessDocumentDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
businessDocumentDO.setCreateBy(userPo.getUserId());
|
||||
businessDocumentDO.setCreateByName(userPo.getUserName());
|
||||
//校验使用的表单是否必填校验
|
||||
checkDoucumentType(businessDocumentDO);
|
||||
//处理数据
|
||||
handleDate(businessDocumentDO);
|
||||
businessDocumentDO.setDataSources(2);
|
||||
businessDocumentDO.setBusinessFlow(OrderSequence.getOrderCode("LS"));
|
||||
//调用费用计算,计算费用金额进行保存
|
||||
CostCalculationDTO costCalculationDTO = new CostCalculationDTO();
|
||||
costCalculationDTO.setOriginalBusinessNum(businessDocumentDO.getOriginalBusinessNum());
|
||||
costCalculationDTO.setContractNumber(businessDocumentDO.getContractNumber());
|
||||
costCalculationDTO.setFormJson(businessDocumentDO.getDocumentFormJson());
|
||||
costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
|
||||
costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
|
||||
costCalculationDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
costCalculationDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
costCalculationDTO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
|
||||
businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
|
||||
BillingRulesPO billingRulesPO = billingCostPo.getBillingRulesPO();
|
||||
List<BillingParamsPO> billingParamsPOList = billingRulesPO.getBillingParamsPOList();
|
||||
if (ObjectUtil.isNotNull(billingParamsPOList)&&billingParamsPOList.size()>0) {
|
||||
BillingParamsPO billingParamsPO = billingParamsPOList.get(0);
|
||||
String billingParamsJson = billingParamsPO.getBillingParamsJson();
|
||||
String preSetRules = billingParamsPO.getPreSetRules();
|
||||
String documentFormJson = businessDocumentDO.getDocumentFormJson();
|
||||
JSONObject paramObj = JSONObject.parseObject(documentFormJson);
|
||||
List<BillingParamsEntity> billingParamsEntityList = JSON.parseArray(billingParamsJson, BillingParamsEntity.class);
|
||||
for (BillingParamsEntity billingParamsEntity : billingParamsEntityList) {
|
||||
String isFee = billingParamsEntity.getIsFee();
|
||||
String fields = billingParamsEntity.getFields();
|
||||
// 安全获取值并转 BigDecimal(不会报错)
|
||||
BigDecimal value = getSafeBigDecimal(paramObj, fields);
|
||||
|
||||
if ("1".equals(isFee)) {
|
||||
businessDocumentDO.setBillingUnitPrice(value.setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
} else {
|
||||
businessDocumentDO.setBillingNum(value.setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
}
|
||||
BusinessDocument businessDocument = businessDocumentDomainService.insertRetrun(businessDocumentDO);
|
||||
BusinessDocumentDTO businessDocumentDTO = new BusinessDocumentDTO();
|
||||
businessDocumentDTO.setBusinessDocumentIds(businessDocument.getBusinessDocumentId().toString());
|
||||
businessDocumentDTO.setAuditOperation(1);
|
||||
takeEffectByIds(businessDocumentDTO);
|
||||
auditByIds(businessDocumentDTO);
|
||||
List<BillingStatement> billingStatements = billingStatementMapper.selectList(new LambdaQueryWrapper<BillingStatement>()
|
||||
.eq(BillingStatement::getBusinessDocumentId, businessDocument.getBusinessDocumentId())
|
||||
.eq(BillingStatement::getDelFlag, 1));
|
||||
BillingStatement billingStatement = null;
|
||||
if (ObjectUtil.isNotNull(billingStatements)&&billingStatements.size()>0) {
|
||||
billingStatement = billingStatements.get(0);
|
||||
BillingStatementDTO billingStatementDTO = new BillingStatementDTO();
|
||||
billingStatementDTO.setBillingStatementIds(billingStatement.getBillingStatementId().toString());
|
||||
billingStatementDTO.setAuditOperation(1);
|
||||
billingStatementDomainService.reviewBilling(billingStatementDTO);
|
||||
billingStatement.setBillManageId(businessDocumentDO.getBillManageId());
|
||||
billingStatement.setBillingState(3);
|
||||
billingStatementMapper.updateById(billingStatement);
|
||||
}
|
||||
|
||||
BillManage billManage = billManageService.getById(businessDocumentDO.getBillManageId());
|
||||
BillDetail billDetail = new BillDetail();
|
||||
billDetail.setBillManageId(businessDocumentDO.getBillManageId());
|
||||
billDetail.setBillNumber(billManage.getBillNumber());
|
||||
billDetail.setBillingStatementId(billingStatement.getBillingStatementId());
|
||||
billDetail.setBillingFlow(billingStatement.getBillingFlow());
|
||||
billDetail.setOrganizationId(billManage.getOrganizationId());
|
||||
billDetail.setOrganizationName(billManage.getOrganizationName());
|
||||
billDetail.setTopOrganizationId(billManage.getTopOrganizationId());
|
||||
billDetail.setCreateBy(userPo.getUserId());
|
||||
billDetail.setCreateByName(userPo.getUserName());
|
||||
billDetail.setCreateTime(new Date());
|
||||
billDetail.setDelFlag(1);
|
||||
billDetail.setBillingTotalAmount(billingStatement.getBillingAmount());
|
||||
billDetail.setBillingDiscountAmount(BigDecimal.ZERO);
|
||||
billDetail.setBillingAmount(billingStatement.getBillingAmount());
|
||||
billDetail.setBillType(1);
|
||||
billDetail.setBillingExpectedAmount(BigDecimal.ZERO);
|
||||
billDetail.setFeeType(billingStatement.getServiceItemsName());
|
||||
billDetail.setInvoiceItem(billingStatement.getFirstSubjectCode());
|
||||
billDetail.setInvoiceItemName(billingStatement.getFirstSubjectName());
|
||||
billDetail.setSettlementCurrency(billingStatement.getSettlementCurrency());
|
||||
billDetail.setTaxAmount(billingStatement.getTaxAmount());
|
||||
billDetail.setTaxFreeFee(billingStatement.getTaxFreeFee());
|
||||
billDetail.setTaxRate(billingStatement.getTaxRate());
|
||||
billDetailService.save(billDetail);
|
||||
BigDecimal billAmount = billManage.getBillAmount();
|
||||
BigDecimal amount = billAmount.add(billDetail.getBillingAmount());
|
||||
billManage.setBillAmount(amount);
|
||||
billManage.setBillTotalAmount(amount);
|
||||
BigDecimal billTotalAmount = billManage.getBillTotalAmount();
|
||||
BigDecimal billAmountSettlement = billManage.getBillAmountSettlement();
|
||||
BigDecimal subtract = billTotalAmount.subtract(billAmountSettlement);
|
||||
billManage.setBillAmountUnsettled(subtract);
|
||||
BigDecimal taxAmount = billManage.getTaxAmount();
|
||||
billManage.setTaxAmount(taxAmount.add(billDetail.getTaxAmount()));
|
||||
BigDecimal taxFreeFee = billManage.getTaxFreeFee();
|
||||
billManage.setTaxFreeFee(taxFreeFee.add(billDetail.getTaxFreeFee()));
|
||||
billManageService.updateById(billManage);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从 JSONObject 安全获取 BigDecimal,支持:
|
||||
* 数字、整数字符串、小数字符串、null、空字符串
|
||||
@@ -484,7 +618,7 @@ public class BusinessDocumentApplicationService {
|
||||
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
|
||||
contractType = 1;
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndOrganizationId(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
|
||||
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndSecondSubjectCode(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getFirstSubjectCode() != null ?businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode(),businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("合同信息未找到");
|
||||
}
|
||||
@@ -492,6 +626,10 @@ public class BusinessDocumentApplicationService {
|
||||
if (null == contractPO) {
|
||||
throw new ServiceException("合同信息未找到");
|
||||
}
|
||||
String isMany = contractPO.getIsMany();
|
||||
if ("1".equals(isMany)) {
|
||||
throw new ServiceException("存在多条相同费用科目的合同,请检查");
|
||||
}
|
||||
businessDocumentDO.setContractName(contractPO.getContractName());
|
||||
businessDocumentDO.setContractNumber(contractPO.getContractNumber());
|
||||
}
|
||||
|
||||
+2
@@ -25,6 +25,8 @@ public interface BillManageMapper extends BaseMapper<BillManage>
|
||||
|
||||
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
|
||||
|
||||
String getCustomerCodeNcJson(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
|
||||
|
||||
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
|
||||
|
||||
String getsalespersonNcCode(@Param("salesmanId") String salesmanId);
|
||||
|
||||
+57
-4
@@ -1,9 +1,13 @@
|
||||
package com.mhd.bms.domain.billManage.repository.persistence;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mhd.bms.domain.billManage.entity.BillManage;
|
||||
import com.mhd.bms.domain.billManage.repository.facade.IBillManageService;
|
||||
@@ -66,6 +70,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 账单管理Service业务层处理
|
||||
@@ -211,6 +216,26 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
Map<String, Object> targetMap = listNc.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||
String orgCodeNc = billManageMapper.getOrgCodeNc(organizationId);
|
||||
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
@@ -436,6 +461,10 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
billManageMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -490,7 +519,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
if (ncUrl!=null&&ncUrl!="") {
|
||||
url = ncUrl;
|
||||
} else {
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliation.setSkSynchronousStatus(2);
|
||||
billManageMapper.updateById(reconciliation);
|
||||
throw new ServiceException("未找到该组织的推送地址!");
|
||||
}
|
||||
@@ -528,6 +557,26 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = billManageMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = billManageMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
Map<String, Object> targetMap = listNc.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
String documentPreparerNcCode = billManageMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
String settlementCurrency=reconciliation.getSettlementCurrency();
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
@@ -702,7 +751,7 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
billManageMapper.updateById(reconciliation);
|
||||
response.close();
|
||||
} catch (Exception e) {
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliation.setSkSynchronousStatus(2);
|
||||
billManageMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -715,13 +764,17 @@ public class BillManageImpl extends ServiceImpl<BillManageMapper, BillManage> im
|
||||
|
||||
}
|
||||
} else {
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliation.setSkSynchronousStatus(2);
|
||||
billManageMapper.updateById(reconciliation);
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliation.setSkSynchronousStatus(2);
|
||||
billManageMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+7
@@ -94,6 +94,13 @@ public class BillManageDomainService {
|
||||
return billManageService.insert(billManageDO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接保存账单管理实体
|
||||
*/
|
||||
public boolean saveEntity(BillManage billManage) {
|
||||
return billManageService.save(billManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改账单管理
|
||||
*/
|
||||
|
||||
+9
-2
@@ -119,6 +119,13 @@ public class BillingStatementDomainService {
|
||||
return billingStatementService.getInfo(billingStatementId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存计费流水实体
|
||||
*/
|
||||
public boolean saveEntityBatch(List<BillingStatement> list) {
|
||||
return billingStatementService.saveBatch(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量审核
|
||||
*/
|
||||
@@ -675,8 +682,8 @@ public class BillingStatementDomainService {
|
||||
billingStatementDO.setSettlementCustomersCode(billManagePO.getSettlementCustomersCode());
|
||||
billingStatementDO.setBelongModuleCode(billManagePO.getBelongModuleCode());
|
||||
billingStatementDO.setAccountExpenseType(billManagePO.getBillType());
|
||||
billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime());
|
||||
billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime());
|
||||
// billingStatementDO.setCycleBeginTime(billManagePO.getCycleBeginTime());
|
||||
// billingStatementDO.setCycleEndTime(billManagePO.getCycleEndTime());
|
||||
billingStatementDO.setBillingState(2);
|
||||
startPage();
|
||||
return billingStatementService.queryList(billingStatementDO);
|
||||
|
||||
+2
@@ -218,4 +218,6 @@ public class BusinessDocumentDO extends BaseVOEntity{
|
||||
private BigDecimal billingUnitPrice;
|
||||
@ApiModelProperty("nc科目编码")
|
||||
private String ncSubjectCode;
|
||||
|
||||
private Long billManageId;
|
||||
}
|
||||
@@ -96,4 +96,12 @@ public class BillLogsConstants
|
||||
public static final String payment_bill_text = "付款单号:{},付款金额:{}元";
|
||||
|
||||
|
||||
/**
|
||||
* 复制账单
|
||||
* 原账单编号:{},新账单编号:{}
|
||||
*/
|
||||
public static final String copy_bill_title = "复制账单";
|
||||
public static final String copy_bill_text = "原账单编号:{},新账单编号:{}";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -169,4 +169,6 @@ public class ContractManagePO extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
|
||||
private Integer principalType;
|
||||
|
||||
private String isMany;
|
||||
|
||||
}
|
||||
+2
@@ -213,4 +213,6 @@ public class BusinessDocumentDTO extends BaseVOEntity{
|
||||
private String paymentAccountId;
|
||||
@ApiModelProperty("收款帐户名称")
|
||||
private String paymentAccountName;
|
||||
|
||||
private Long billManageId;
|
||||
}
|
||||
@@ -229,6 +229,22 @@ public class BillManageApi extends BaseController{
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("复制账单")
|
||||
@PostMapping("/copyBill")
|
||||
public AjaxResult copyBill(@RequestBody BillManageDTO billManageDTO)
|
||||
{
|
||||
if(billManageDTO.getBillManageId() == null){
|
||||
throw new ServiceException("原账单id不能为空");
|
||||
}
|
||||
try {
|
||||
Boolean result = billManageApplicationService.copyBill(billManageDTO);
|
||||
return toAjax(result);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error("复制账单失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("应收账单-客户确认")
|
||||
@PostMapping("/customerConfirmation")
|
||||
public AjaxResult customerConfirmation(@RequestBody BillManageDTO billManageDTO)
|
||||
|
||||
@@ -79,6 +79,25 @@ public class BusinessDocumentApi extends BaseController{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存业务单据
|
||||
*/
|
||||
@ApiOperation("账单添加费用")
|
||||
@PostMapping("/manageAddFee")
|
||||
public AjaxResult manageAddFee(@RequestBody BusinessDocumentDTO businessDocumentDTO)
|
||||
{
|
||||
try {
|
||||
//转换实体
|
||||
BusinessDocumentDO businessDocumentDO = businessDocumentAssembler.toDO(businessDocumentDTO);
|
||||
return toAjax(businessDocumentApplicationService.manageAddFee(businessDocumentDO));
|
||||
} catch (ServiceException e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e){
|
||||
return AjaxResult.error("保存业务单据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存业务单据
|
||||
|
||||
@@ -18,17 +18,17 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
file-extension: yml #默认properties
|
||||
# 开启nacos自动刷新,如果这个配置没有或者为false会导致配置不能自动刷新
|
||||
|
||||
@@ -118,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getCustomerCodeNcJson" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT ORG_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
|
||||
</select>
|
||||
|
||||
@@ -92,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="documentTypeDO.organizationId != null">
|
||||
and organization_id = #{documentTypeDO.organizationId}
|
||||
</if>
|
||||
<if test="documentTypeDO.belongModuleCode != null and documentTypeDO.belongModuleCode != ''">
|
||||
and BELONG_MODULE_CODE = #{documentTypeDO.belongModuleCode}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
@@ -198,7 +198,13 @@
|
||||
and a.main_role = #{settlementCustomersDO.mainRole}
|
||||
</if>
|
||||
<if test="settlementCustomersDO.organizationId != null">
|
||||
and a.organization_id = #{settlementCustomersDO.organizationId}
|
||||
AND (
|
||||
a.organization_id = #{settlementCustomersDO.organizationId}
|
||||
OR b.org_code LIKE concat('%"code":"', #{settlementCustomersDO.organizationId}, '"%')
|
||||
OR b.org_code LIKE concat('%code:', #{settlementCustomersDO.organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%code: ', #{settlementCustomersDO.organizationId}, '%')
|
||||
OR b.org_code LIKE concat('%"code":', #{settlementCustomersDO.organizationId}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
|
||||
and a.top_organization_id = #{settlementCustomersDO.topOrganizationId}
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ public class ReconciliationApplicationService {
|
||||
reconciliationPO.setSettlementCurrency(tmsOrder.getSettlementCurrency());
|
||||
}
|
||||
if (reconciliationPO.getSettlementCurrency() != null){
|
||||
String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency()));
|
||||
String s = tmsReceiptMapper.selectCnName(String.valueOf(reconciliationPO.getSettlementCurrency()),reconciliationPO.getOrganizationId());
|
||||
reconciliationPO.setSettlementCurrencyName(s);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -39,9 +39,11 @@ public interface ReconciliationMapper extends BaseMapper<Reconciliation>
|
||||
|
||||
String getCustomerCodeNc(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
|
||||
|
||||
String getCustomerCodeNcJson(@Param("actualInvoiceCustomerId") String actualInvoiceCustomerId);
|
||||
|
||||
String getDocumentPreparerNcCode(@Param("salesmanId") String salesmanId);
|
||||
|
||||
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency);
|
||||
String getSettlementCurrencyNcCode(@Param("settlementCurrency") String settlementCurrency, @Param("organizationId") Long organizationId);
|
||||
|
||||
String getServiceItemsCodeNc(@Param("name") String name);
|
||||
|
||||
|
||||
+103
-4
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.linke.finance.domain.approvalDocument.entity.ApprovalDocument;
|
||||
import com.linke.finance.domain.approvalDocument.repository.mapper.ApprovalDocumentMapper;
|
||||
@@ -725,6 +727,26 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> list = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (list != null && list.size() > 0) {
|
||||
Map<String, Object> targetMap = list.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
String settlementCurrency=order.getSettlementCurrency();
|
||||
String salesmanId = order.getSalesmanId();
|
||||
String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId);
|
||||
@@ -732,7 +754,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String deptName = reconciliationMapper.getDeptName(customerUserDept);
|
||||
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
makerCodeNc= documentPreparerNcCode;
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
|
||||
String invoiceNumber=make.getInvoiceNumber();
|
||||
R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make);
|
||||
if (itemR.getCode()==200) {
|
||||
@@ -952,6 +974,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliationMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1008,6 +1034,27 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> list = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (list != null && list.size() > 0) {
|
||||
Map<String, Object> targetMap = list.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String settlementCurrency=order.getSettlementCurrency();
|
||||
String salesmanId = order.getSalesmanId();
|
||||
String customerUserDept = reconciliationMapper.getCustomerUserDept(salesmanId);
|
||||
@@ -1015,7 +1062,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String deptName = reconciliationMapper.getDeptName(customerUserDept);
|
||||
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
makerCodeNc= documentPreparerNcCode;
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
|
||||
String invoiceNumber=make.getInvoiceNumber();
|
||||
R<List<TmsMakeOutInvoiceItem>> itemR = wlhyServiceFeign.selectMakeOutInvoiceItemList(make);
|
||||
if (itemR.getCode()==200) {
|
||||
@@ -1235,6 +1282,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliationMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1560,9 +1611,29 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
Map<String, Object> targetMap = listNc.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
String settlementCurrency=order.getSettlementCurrency();
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
|
||||
makerCodeNc=documentPreparerNcCode;
|
||||
SKitem item=new SKitem();
|
||||
if (deptValue != null && !deptValue.isEmpty()) {
|
||||
@@ -1759,6 +1830,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliationMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1844,9 +1919,29 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
String appointShipper=make.getActualInvoiceCustomerName();
|
||||
String actualInvoiceCustomerId = make.getActualInvoiceCustomerId();
|
||||
String customerCodeNc = reconciliationMapper.getCustomerCodeNc(actualInvoiceCustomerId);
|
||||
String customerCodeNcJson = reconciliationMapper.getCustomerCodeNcJson(actualInvoiceCustomerId);
|
||||
if (customerCodeNcJson != null && !customerCodeNcJson.isEmpty()) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> listNc = objectMapper.readValue(
|
||||
customerCodeNcJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
if (listNc != null && listNc.size() > 0) {
|
||||
Map<String, Object> targetMap = listNc.stream()
|
||||
.filter(map -> {
|
||||
Object codeObj = map.get("code");
|
||||
return codeObj != null && codeObj.toString().equals(reconciliation.getOrganizationId().toString());
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (targetMap != null) {
|
||||
customerCodeNc = (String) targetMap.get("ncCustomer");
|
||||
}
|
||||
}
|
||||
}
|
||||
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
String settlementCurrency=order.getSettlementCurrency();
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
|
||||
|
||||
|
||||
makerCodeNc=documentPreparerNcCode;
|
||||
@@ -2046,6 +2141,10 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
reconciliation.setSynchronousStatus(2);
|
||||
reconciliationMapper.updateById(reconciliation);
|
||||
e.printStackTrace();
|
||||
} catch (JsonMappingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,5 +20,5 @@ public interface TmsReceiptMapper extends BaseMapper<TmsReceipt>
|
||||
*/
|
||||
public List<TmsReceiptPO> queryList(TmsReceiptDO tmsReceiptDO);
|
||||
|
||||
String selectCnName(@Param("settlementCount") String settlementCount);
|
||||
}
|
||||
String selectCnName(@Param("settlementCount") String settlementCount,@Param("organizationId") Long organizationId);
|
||||
}
|
||||
@@ -21,14 +21,14 @@ spring:
|
||||
# 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
|
||||
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
|
||||
#线上正式环境
|
||||
|
||||
@@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and a.inner_number like concat('%', #{innerNumber}, '%')
|
||||
</if>
|
||||
<if test="partyName != null and partyName != ''">
|
||||
and a.inner_number like concat('%', #{partyName}, '%')
|
||||
and a.party_name like concat('%', #{partyName}, '%')
|
||||
</if>
|
||||
<if test="billRemark != null and billRemark != ''">
|
||||
and a.bill_remark like concat('%', #{billRemark}, '%')
|
||||
@@ -373,12 +373,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT CUSTOMER_NC_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getCustomerCodeNcJson" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT ORG_CODE FROM NGWL_TEST_USER."USER_SHIPPER" where del_flag = 1 and SHIPPER_ID = #{actualInvoiceCustomerId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getDocumentPreparerNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT DOCUMENT_PREPARER_NC_CODE FROM NGWL_TEST_USER."USER" where del_flag = 1 and user_id = #{salesmanId} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getSettlementCurrencyNcCode" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE" where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency} limit 1
|
||||
<select id="getSettlementCurrencyNcCode" resultType="java.lang.String">
|
||||
SELECT NC_SYSTEM_CODE FROM NGWL_TEST_WLHY."TMS_SETTLEMENT_EXCHANGE_RATE"
|
||||
where IS_DELETE = '0' and ENGLISH_NAME = #{settlementCurrency}
|
||||
<if test="organizationId != null">
|
||||
and ORGANIZATION_ID = #{organizationId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getServiceItemsCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
|
||||
@@ -123,6 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectTmsReceiptPo1"/>
|
||||
</select>
|
||||
<select id="selectCnName" resultType="java.lang.String">
|
||||
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount}
|
||||
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} and ORGANIZATION_ID = #{organizationId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
+88
-14
@@ -23,6 +23,9 @@ import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder;
|
||||
import com.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
|
||||
import com.mhd.oms.domain.documentPushMaterialRecord.entity.DocumentPushMaterialRecord;
|
||||
import com.mhd.oms.domain.documentPushMaterialRecord.repository.mapper.DocumentPushMaterialRecordMapper;
|
||||
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
@@ -40,6 +43,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@@ -88,6 +92,11 @@ public class BusinessDocumentOrderApplicationService {
|
||||
@Resource
|
||||
private ExecuteOrderMapper executeOrderMapper;
|
||||
|
||||
@Resource
|
||||
private DocumentPushMaterialRecordMapper documentPushMaterialRecordMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*/
|
||||
@@ -252,28 +261,57 @@ public class BusinessDocumentOrderApplicationService {
|
||||
billMap.put("packNo", cargo.getCargoNum() != null ? cargo.getCargoNum() : "");
|
||||
billMap.put("erpQty", cargo.getCargoNum() != null ? cargo.getCargoNum() : "");
|
||||
|
||||
// 查询物料基础信息,计算净重和毛重
|
||||
// 查询物料基础信息
|
||||
MaterialBaseInfoPO material = null;
|
||||
if (cargo.getMaterialBaseInfoId() != null) {
|
||||
MaterialBaseInfoPO material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId());
|
||||
if (material != null && cargo.getCargoNum() != null) {
|
||||
if (material.getWeightLimit() != null) {
|
||||
billMap.put("netWt", material.getWeightLimit().multiply(cargo.getCargoNum()));
|
||||
} else {
|
||||
billMap.put("netWt", "");
|
||||
}
|
||||
if (material.getGrossWeight() != null) {
|
||||
billMap.put("grossWt", material.getGrossWeight().multiply(cargo.getCargoNum()));
|
||||
} else {
|
||||
billMap.put("grossWt", "");
|
||||
}
|
||||
material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId());
|
||||
}
|
||||
if (material != null) {
|
||||
// 净重和毛重
|
||||
if (cargo.getCargoNum() != null) {
|
||||
billMap.put("netWt", material.getWeightLimit() != null
|
||||
? material.getWeightLimit().multiply(cargo.getCargoNum()) : "");
|
||||
billMap.put("grossWt", material.getGrossWeight() != null
|
||||
? material.getGrossWeight().multiply(cargo.getCargoNum()) : "");
|
||||
} else {
|
||||
billMap.put("netWt", "");
|
||||
billMap.put("grossWt", "");
|
||||
}
|
||||
// 货物名称
|
||||
billMap.put("goodsName", material.getMaterialName() != null ? material.getMaterialName() : "");
|
||||
// 成交单位(申报单位)
|
||||
billMap.put("gUnit", material.getDeclarationUnit() != null ? material.getDeclarationUnit() : "");
|
||||
// 币制
|
||||
billMap.put("currency", material.getCurrency() != null ? material.getCurrency() : "");
|
||||
// 原产国(countryCode)
|
||||
billMap.put("countryCode", material.getOriginCountry() != null ? material.getOriginCountry() : "");
|
||||
// 单价(企业单价)
|
||||
BigDecimal unitPrice = material.getUnitPrice();
|
||||
billMap.put("unitPrice", unitPrice != null ? unitPrice : "");
|
||||
// 总价(entTotal = 成交数量 × 单价)
|
||||
if (unitPrice != null && cargo.getCargoNum() != null) {
|
||||
billMap.put("entTotal", unitPrice.multiply(cargo.getCargoNum()));
|
||||
} else {
|
||||
billMap.put("entTotal", "");
|
||||
}
|
||||
} else {
|
||||
billMap.put("netWt", "");
|
||||
billMap.put("grossWt", "");
|
||||
billMap.put("goodsName", "");
|
||||
billMap.put("gUnit", "");
|
||||
billMap.put("currency", "");
|
||||
billMap.put("countryCode", "");
|
||||
billMap.put("unitPrice", "");
|
||||
billMap.put("entTotal", "");
|
||||
}
|
||||
// 最终目的国(优先取订单填写,未填写则取收货地)
|
||||
String destinationCountry = (order.getDestinationCountry() != null && !order.getDestinationCountry().isEmpty())
|
||||
? order.getDestinationCountry() : order.getUnloadName();
|
||||
billMap.put("destinationCountry", destinationCountry != null ? destinationCountry : "");
|
||||
// 境内货源地(优先取订单填写,未填写则取发货地)
|
||||
String domesticSourcePlace = (order.getDomesticSourcePlace() != null && !order.getDomesticSourcePlace().isEmpty())
|
||||
? order.getDomesticSourcePlace() : order.getLoadingName();
|
||||
billMap.put("domesticSourcePlace", domesticSourcePlace != null ? domesticSourcePlace : "");
|
||||
billList.add(billMap);
|
||||
}
|
||||
}
|
||||
@@ -328,6 +366,37 @@ public class BusinessDocumentOrderApplicationService {
|
||||
if (dataCode != null && dataCode == 200) {
|
||||
gwLog.setStatus(2);
|
||||
updatePushStatus(order.getId(), 3, new Date(), String.valueOf(pushBy), pushByName);
|
||||
// 推送成功,保存单证推送物料快照
|
||||
try {
|
||||
Date now = new Date();
|
||||
for (BusinessDocumentCargoMulti cargo : cargoList) {
|
||||
DocumentPushMaterialRecord docRecord = new DocumentPushMaterialRecord();
|
||||
docRecord.setOrderId(order.getId());
|
||||
docRecord.setMaterialBaseInfoId(cargo.getMaterialBaseInfoId());
|
||||
if (cargo.getMaterialBaseInfoId() != null) {
|
||||
MaterialBaseInfoPO material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId());
|
||||
if (material != null) {
|
||||
docRecord.setMaterialCode(material.getMaterialCode());
|
||||
docRecord.setMaterialName(material.getMaterialName());
|
||||
docRecord.setGoodsType(material.getGoodsType());
|
||||
docRecord.setPackName(material.getPackName());
|
||||
docRecord.setDeclarationUnit(material.getDeclarationUnit());
|
||||
docRecord.setCurrency(material.getCurrency());
|
||||
docRecord.setUnitPrice(material.getUnitPrice());
|
||||
docRecord.setWeightLimit(material.getWeightLimit());
|
||||
docRecord.setGrossWeight(material.getGrossWeight());
|
||||
}
|
||||
}
|
||||
docRecord.setPushTime(now);
|
||||
docRecord.setDelFlag(1);
|
||||
docRecord.setCreateBy(String.valueOf(pushBy));
|
||||
docRecord.setCreateTime(now);
|
||||
docRecord.setUpdateTime(now);
|
||||
documentPushMaterialRecordMapper.insert(docRecord);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存单证推送物料快照失败: orderId={}", order.getId(), e);
|
||||
}
|
||||
successCount++;
|
||||
} else {
|
||||
gwLog.setStatus(3);
|
||||
@@ -366,6 +435,8 @@ public class BusinessDocumentOrderApplicationService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, String pushBy, String pushByName) {
|
||||
try {
|
||||
BusinessDocumentOrder update = new BusinessDocumentOrder();
|
||||
@@ -399,9 +470,12 @@ public class BusinessDocumentOrderApplicationService {
|
||||
int failCount = 0;
|
||||
StringBuilder failMsg = new StringBuilder();
|
||||
|
||||
// 从数据库查询单证信息,获取运输业务单号
|
||||
BusinessDocumentOrder order = businessDocumentOrderMapper.selectById(businessDocumentOrderDTO.getId());
|
||||
|
||||
// 构建单个对象
|
||||
Map<String, String> item = new HashMap<>();
|
||||
item.put("erpBillNo", String.valueOf(businessDocumentOrderDTO.getId()));
|
||||
item.put("erpBillNo", order != null ? order.getGoodsNumber() : businessDocumentOrderDTO.getGoodsNumber());
|
||||
item.put("operateType", String.valueOf(businessDocumentOrderDTO.getReviseApplyType()));
|
||||
item.put("appMan", businessDocumentOrderDTO.getReviseApplyBy());
|
||||
item.put("appMess", businessDocumentOrderDTO.getReviseApplyReason());
|
||||
|
||||
+42
@@ -2,6 +2,7 @@ package com.mhd.oms.application.service.materialInfo;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
@@ -9,6 +10,9 @@ import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
|
||||
import com.mhd.oms.domain.materialPushRecord.entity.MaterialPushRecord;
|
||||
import com.mhd.oms.domain.materialPushRecord.repository.mapper.MaterialPushRecordMapper;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.MaterialInfoDTO;
|
||||
@@ -45,6 +49,9 @@ public class MaterialInfoApplicationService {
|
||||
@Resource
|
||||
private BusinessDocumentOrderMapper businessDocumentOrderMapper;
|
||||
|
||||
@Resource
|
||||
private MaterialPushRecordMapper materialPushRecordMapper;
|
||||
|
||||
private final WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
public MaterialInfoApplicationService(WmsServiceFeign wmsServiceFeign) {
|
||||
@@ -88,6 +95,7 @@ public class MaterialInfoApplicationService {
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
StringBuilder failMsg = new StringBuilder();
|
||||
List<Long> successIds = new ArrayList<>();
|
||||
|
||||
for (MaterialInfoDTO dto : dtoList) {
|
||||
Map<String, String> item = new HashMap<>();
|
||||
@@ -147,6 +155,7 @@ public class MaterialInfoApplicationService {
|
||||
gwLog.setStatus(2);
|
||||
updatePushStatus(dto.getMaterialBaseInfoId(), 3, new Date(), pushBy, pushByName);
|
||||
successCount++;
|
||||
successIds.add(dto.getMaterialBaseInfoId());
|
||||
} else {
|
||||
gwLog.setStatus(3);
|
||||
gwLog.setErrorMsg(responseString);
|
||||
@@ -181,6 +190,39 @@ public class MaterialInfoApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
// 推送成功后,保存物料快照到物料推送记录表
|
||||
if (!successIds.isEmpty()) {
|
||||
try {
|
||||
Date now = new Date();
|
||||
TableDataInfo wmsResult = wmsServiceFeign.getBatchByIds(successIds);
|
||||
if (wmsResult != null && wmsResult.getData() != null) {
|
||||
List<MaterialBaseInfoPO> materialList = JSONArray.parseArray(
|
||||
JSONObject.toJSONString(wmsResult.getData()), MaterialBaseInfoPO.class);
|
||||
for (MaterialBaseInfoPO material : materialList) {
|
||||
MaterialPushRecord record = new MaterialPushRecord();
|
||||
record.setMaterialBaseInfoId(material.getMaterialBaseInfoId());
|
||||
record.setMaterialCode(material.getMaterialCode());
|
||||
record.setMaterialName(material.getMaterialName());
|
||||
record.setGoodsType(material.getGoodsType());
|
||||
record.setPackName(material.getPackName());
|
||||
record.setDeclarationUnit(material.getDeclarationUnit());
|
||||
record.setCurrency(material.getCurrency());
|
||||
record.setUnitPrice(material.getUnitPrice());
|
||||
record.setWeightLimit(material.getWeightLimit());
|
||||
record.setGrossWeight(material.getGrossWeight());
|
||||
record.setPushTime(now);
|
||||
record.setDelFlag(1);
|
||||
record.setCreateBy(String.valueOf(pushBy));
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
materialPushRecordMapper.insert(record);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("保存物料推送快照失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
String resultMsg = "推送完成: 成功" + successCount + "条, 失败" + failCount + "条";
|
||||
if (failCount > 0) {
|
||||
resultMsg += "[" + failMsg.toString() + "]";
|
||||
|
||||
+6
@@ -760,6 +760,12 @@ public class BusinessDocumentOrder extends BaseVOEntity{
|
||||
@ApiModelProperty("进出口方式:I-进口,E-出口")
|
||||
private String ieType;
|
||||
|
||||
@ApiModelProperty("境内货源地")
|
||||
private String domesticSourcePlace;
|
||||
|
||||
@ApiModelProperty("最终目的国(地区)")
|
||||
private String destinationCountry;
|
||||
|
||||
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
|
||||
private Integer pushStatus;
|
||||
|
||||
|
||||
+52
-1
@@ -1,6 +1,8 @@
|
||||
package com.mhd.oms.domain.businessDocumentOrder.repository.persistence;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -43,6 +45,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.rmi.ServerException;
|
||||
import java.util.ArrayList;
|
||||
@@ -169,6 +172,29 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
return businessDocumentOrderPO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getOrderCodeByDate(Date date){
|
||||
return new StringBuffer()
|
||||
.append(getSecondPartByDate(date))
|
||||
.append(getThreePart())
|
||||
.toString();
|
||||
}
|
||||
private static String getSecondPartByDate(Date date) {
|
||||
if (date == null) {
|
||||
date = new Date();
|
||||
}
|
||||
String temp_current_time = DateUtil.format(date, datePattern());
|
||||
return temp_current_time.substring(2, temp_current_time.length());
|
||||
}
|
||||
private static String datePattern() {
|
||||
return "yyyyMMddHHmmss";
|
||||
}
|
||||
private static String getThreePart() {
|
||||
return RandomUtil.randomNumbers(4);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean audit(List<Long> ids, Long reviewStatus, String SalesManager,String reviewOpinion ) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();//获取登录人
|
||||
@@ -229,6 +255,31 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
subOrder.setRecipientName(user.getUserName());
|
||||
|
||||
|
||||
String orderCode = null;
|
||||
int maxRetryCount = 100;
|
||||
int retryCount = 0;
|
||||
|
||||
while (retryCount < maxRetryCount) {
|
||||
orderCode = getOrderCodeByDate(subOrder.getDocumentDate());
|
||||
retryCount++;
|
||||
|
||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
||||
);
|
||||
|
||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (retryCount >= maxRetryCount) {
|
||||
throw new com.aliyun.oss.ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
||||
}
|
||||
}
|
||||
|
||||
//生成货源单号
|
||||
subOrder.setGoodsNumber(orderCode);
|
||||
|
||||
|
||||
businessDocumentOrderMapper.insert(subOrder);
|
||||
subOrderCount++; // 增加子单计数
|
||||
|
||||
@@ -706,4 +757,4 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
{
|
||||
return businessDocumentOrderMapper.queryListAndMaterial(businessDocumentOrderDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -91,6 +91,8 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date loadingDate;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@@ -123,6 +125,8 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date unloadingData;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@@ -674,6 +678,8 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date documentDate;
|
||||
|
||||
|
||||
@@ -764,6 +770,8 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
|
||||
private String entryNumber;
|
||||
|
||||
@ApiModelProperty("预计出发日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date layDate;
|
||||
|
||||
@ApiModelProperty("出入库单号")
|
||||
@@ -778,6 +786,12 @@ public class BusinessDocumentOrderPO extends BaseVOEntity{
|
||||
@ApiModelProperty("进出口方式:I-进口,E-出口")
|
||||
private String ieType;
|
||||
|
||||
@ApiModelProperty("境内货源地")
|
||||
private String domesticSourcePlace;
|
||||
|
||||
@ApiModelProperty("最终目的国(地区)")
|
||||
private String destinationCountry;
|
||||
|
||||
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
|
||||
private Integer pushStatus;
|
||||
|
||||
|
||||
+12
@@ -106,6 +106,8 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date loadingDate;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@@ -138,6 +140,8 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date unloadingData;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@@ -741,6 +745,8 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
private String paymentAccountId;
|
||||
|
||||
@ApiModelProperty("预计出发日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date layDate;
|
||||
|
||||
@ApiModelProperty("收款账户信息")
|
||||
@@ -794,6 +800,12 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
@ApiModelProperty("进出口方式:I-进口,E-出口")
|
||||
private String ieType;
|
||||
|
||||
@ApiModelProperty("境内货源地")
|
||||
private String domesticSourcePlace;
|
||||
|
||||
@ApiModelProperty("最终目的国(地区)")
|
||||
private String destinationCountry;
|
||||
|
||||
@ApiModelProperty("推送状态:1-未推送 2-推送中 3-推送成功 4-推送失败")
|
||||
private Integer pushStatus;
|
||||
|
||||
|
||||
+138
-5
@@ -1,10 +1,17 @@
|
||||
package com.mhd.oms.domain.businessDocumentOrder.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.common.core.domain.entity.TmsOrder;
|
||||
import com.mhd.common.core.domain.po.UserShipperPo;
|
||||
import com.mhd.common.core.utils.DateUtils;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
@@ -47,6 +54,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -101,6 +109,25 @@ public class BusinessDocumentOrderDomainService {
|
||||
return businessDocumentOrderService.queryList(businessDocumentOrderDO);
|
||||
}
|
||||
|
||||
public static String getOrderCodeByDate(Date date){
|
||||
return new StringBuffer()
|
||||
.append(getSecondPartByDate(date))
|
||||
.append(getThreePart())
|
||||
.toString();
|
||||
}
|
||||
private static String getSecondPartByDate(Date date) {
|
||||
if (date == null) {
|
||||
date = new Date();
|
||||
}
|
||||
String temp_current_time = DateUtil.format(date, datePattern());
|
||||
return temp_current_time.substring(2, temp_current_time.length());
|
||||
}
|
||||
private static String datePattern() {
|
||||
return "yyyyMMddHHmmss";
|
||||
}
|
||||
private static String getThreePart() {
|
||||
return RandomUtil.randomNumbers(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
@@ -161,6 +188,7 @@ public class BusinessDocumentOrderDomainService {
|
||||
String appointShipperId = businessDocumentOrderDO.getAppointShipperId();
|
||||
String isCheckCredit = reservationStockInOrderMapper.getIsCheckCredit(Long.valueOf(appointShipperId));
|
||||
String customerNcCode = reservationStockInOrderMapper.getCustomerNcCode(Long.valueOf(appointShipperId));
|
||||
String orgCode = reservationStockInOrderMapper.getCustomerOrgCode(Long.valueOf(appointShipperId));
|
||||
if(isCheckCredit != null&&"1".equals(isCheckCredit)){
|
||||
UserShipperFeignDTO userShipperFeignDTO = new UserShipperFeignDTO();
|
||||
List<UserShipperEntityFeign> userShipperEntityFeigns = new ArrayList<>();
|
||||
@@ -184,6 +212,24 @@ public class BusinessDocumentOrderDomainService {
|
||||
BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder, "id");
|
||||
tmsOrder.setSettlementStatus(1L);//未出账
|
||||
tmsOrder.setAuditStatus(0L);//未审核
|
||||
tmsOrder.setCustomerCodeNc(customerNcCode);
|
||||
String orgId = businessDocumentOrderDO.getOrgId();
|
||||
if (orgCode != null) {
|
||||
JSONArray orgCodeArray = JSON.parseArray(orgCode);
|
||||
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
JSONObject obj = orgCodeArray.getJSONObject(i);
|
||||
if (obj != null && String.valueOf(obj.getInteger("code")).equals(orgId)) {
|
||||
String ncCustomer = obj.getString("ncCustomer");
|
||||
if (StringUtils.isNotBlank(ncCustomer)) {
|
||||
customerNcCode = ncCustomer;
|
||||
tmsOrder.setCustomerCodeNc(customerNcCode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
|
||||
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
|
||||
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
|
||||
@@ -257,16 +303,41 @@ public class BusinessDocumentOrderDomainService {
|
||||
}
|
||||
|
||||
//生成货源单号
|
||||
if (businessDocumentOrderDO.getGoodsNumber() == null) {
|
||||
|
||||
tmsOrder.setGoodsNumber(OrderSequence.getOrderCode());
|
||||
String orderCode = null;
|
||||
int maxRetryCount = 100;
|
||||
int retryCount = 0;
|
||||
|
||||
while (retryCount < maxRetryCount) {
|
||||
orderCode = getOrderCodeByDate(tmsOrder.getDocumentDate());
|
||||
retryCount++;
|
||||
|
||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
||||
);
|
||||
|
||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (retryCount >= maxRetryCount) {
|
||||
throw new ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
||||
}
|
||||
}
|
||||
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>().eq(ReservationStockOutOrder::getOutOrderNumber, tmsOrder.getInOrderNumber()));
|
||||
|
||||
//生成货源单号
|
||||
tmsOrder.setGoodsNumber(orderCode);
|
||||
|
||||
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||
.eq(ReservationStockOutOrder::getOutOrderNumber, tmsOrder.getInOrderNumber())
|
||||
.eq(ReservationStockOutOrder::getDelFlag, 1));
|
||||
if (reservationStockOutOrder != null){
|
||||
reservationStockOutOrder.setBusinessNumber(tmsOrder.getGoodsNumber());
|
||||
reservationStockOutOrderMapper.updateById(reservationStockOutOrder);
|
||||
}
|
||||
ReservationStockInOrder reservationStockInOrder = reservationStockInOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockInOrder>().eq(ReservationStockInOrder::getInOrderNumber, tmsOrder.getInOrderNumber()));
|
||||
ReservationStockInOrder reservationStockInOrder = reservationStockInOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockInOrder>()
|
||||
.eq(ReservationStockInOrder::getInOrderNumber, tmsOrder.getInOrderNumber())
|
||||
.eq(ReservationStockInOrder::getDelFlag, 1));
|
||||
if (reservationStockInOrder != null){
|
||||
reservationStockInOrder.setBusinessNumber(tmsOrder.getGoodsNumber());
|
||||
reservationStockInOrderMapper.updateById(reservationStockInOrder);
|
||||
@@ -392,7 +463,7 @@ public class BusinessDocumentOrderDomainService {
|
||||
tmsOrder.setSplicingOrderType(0L); // 普通单
|
||||
}
|
||||
//一天后
|
||||
tmsOrder.setDocumentDate(DateUtils.addHours(new Date(), 24));
|
||||
tmsOrder.setDocumentDate(businessDocumentOrderDO.getDocumentDate());
|
||||
|
||||
boolean istrue = businessDocumentOrderMapper.insert(tmsOrder) > 0;
|
||||
|
||||
@@ -474,6 +545,7 @@ public class BusinessDocumentOrderDomainService {
|
||||
throw new ServiceException("您非货主角色或账号已被删除!");
|
||||
}
|
||||
BusinessDocumentOrder tmsOrder = businessDocumentOrderService.getById(businessDocumentOrderDO.getId());
|
||||
String inOrderNumber = tmsOrder.getInOrderNumber();
|
||||
if (tmsOrder.getOrderStatus() == 1){
|
||||
tmsOrder.setOrderStatus(0L);
|
||||
}
|
||||
@@ -484,6 +556,7 @@ public class BusinessDocumentOrderDomainService {
|
||||
throw new ServiceException("运单已被关闭,请确认!");
|
||||
}
|
||||
//处理费用默认值
|
||||
tmsOrder.setDocumentDate(businessDocumentOrderDO.getDocumentDate());
|
||||
handFee(businessDocumentOrderDO);
|
||||
//组织赋值
|
||||
Long organizationId = businessDocumentOrderDO.getOrganizationId();
|
||||
@@ -500,6 +573,27 @@ public class BusinessDocumentOrderDomainService {
|
||||
* 生成货源单信息
|
||||
*/
|
||||
BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder);
|
||||
// 根据orgId匹配orgCode中的ncCustomer赋值给customerCodeNc
|
||||
String updateAppointShipperId = businessDocumentOrderDO.getAppointShipperId();
|
||||
if (StringUtils.isNotBlank(updateAppointShipperId)) {
|
||||
String updateOrgCode = reservationStockInOrderMapper.getCustomerOrgCode(Long.valueOf(updateAppointShipperId));
|
||||
String updateOrgId = businessDocumentOrderDO.getOrgId();
|
||||
if (updateOrgCode != null && updateOrgId != null) {
|
||||
JSONArray orgCodeArray = JSON.parseArray(updateOrgCode);
|
||||
if (orgCodeArray != null && !orgCodeArray.isEmpty()) {
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
JSONObject obj = orgCodeArray.getJSONObject(i);
|
||||
if (obj != null && String.valueOf(obj.getInteger("code")).equals(updateOrgId)) {
|
||||
String ncCustomer = obj.getString("ncCustomer");
|
||||
if (StringUtils.isNotBlank(ncCustomer)) {
|
||||
tmsOrder.setCustomerCodeNc(ncCustomer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
|
||||
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
|
||||
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
|
||||
@@ -679,6 +773,45 @@ public class BusinessDocumentOrderDomainService {
|
||||
}
|
||||
// boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
|
||||
|
||||
|
||||
String orderCode = null;
|
||||
int maxRetryCount = 100;
|
||||
int retryCount = 0;
|
||||
|
||||
while (retryCount < maxRetryCount) {
|
||||
orderCode = getOrderCodeByDate(tmsOrder.getDocumentDate());
|
||||
retryCount++;
|
||||
|
||||
List<BusinessDocumentOrder> checkOrderCodes = businessDocumentOrderMapper.selectList(
|
||||
new QueryWrapper<BusinessDocumentOrder>().eq("goods_number", orderCode)
|
||||
);
|
||||
|
||||
if (CollectionUtils.isEmpty(checkOrderCodes)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (retryCount >= maxRetryCount) {
|
||||
throw new ServiceException("生成唯一订单编号失败,已达到最大重试次数:" + maxRetryCount);
|
||||
}
|
||||
}
|
||||
|
||||
//生成货源单号
|
||||
tmsOrder.setGoodsNumber(orderCode);
|
||||
|
||||
ReservationStockOutOrder reservationStockOutOrder = reservationStockOutOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||
.eq(ReservationStockOutOrder::getOutOrderNumber, inOrderNumber)
|
||||
.eq(ReservationStockOutOrder::getDelFlag, 1));
|
||||
if (reservationStockOutOrder != null){
|
||||
reservationStockOutOrder.setBusinessNumber(tmsOrder.getGoodsNumber());
|
||||
reservationStockOutOrderMapper.updateById(reservationStockOutOrder);
|
||||
}
|
||||
ReservationStockInOrder reservationStockInOrder = reservationStockInOrderMapper.selectOne(new LambdaQueryWrapper<ReservationStockInOrder>()
|
||||
.eq(ReservationStockInOrder::getInOrderNumber, inOrderNumber)
|
||||
.eq(ReservationStockInOrder::getDelFlag, 1));
|
||||
if (reservationStockInOrder != null){
|
||||
reservationStockInOrder.setBusinessNumber(tmsOrder.getGoodsNumber());
|
||||
reservationStockInOrderMapper.updateById(reservationStockInOrder);
|
||||
}
|
||||
int i = businessDocumentOrderMapper.updateById(tmsOrder);
|
||||
if (deliveryFreight != null && deliveryFreight.compareTo(BigDecimal.ZERO) > 0){
|
||||
List<ReservationOrder> reservationOrderList = reservationOrderMapper.selectList(new LambdaQueryWrapper<ReservationOrder>().eq(ReservationOrder::getGoodsNumber, businessDocumentOrderDO.getGoodsNumber()));
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.mhd.oms.domain.documentPushMaterialRecord.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "单证推送物料记录对象")
|
||||
@TableName("document_push_material_record")
|
||||
public class DocumentPushMaterialRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("单证ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty("物料ID")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("规格型号")
|
||||
private String packName;
|
||||
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declarationUnit;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private BigDecimal cargoNum;
|
||||
|
||||
@ApiModelProperty("币制")
|
||||
private String currency;
|
||||
|
||||
@ApiModelProperty("单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ApiModelProperty("净重(kg)")
|
||||
private BigDecimal weightLimit;
|
||||
|
||||
@ApiModelProperty("毛重(kg)")
|
||||
private BigDecimal grossWeight;
|
||||
|
||||
@ApiModelProperty("商品类型(0物料,1半成品,2成品)")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal entTotal;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("推送时间")
|
||||
private Date pushTime;
|
||||
|
||||
@ApiModelProperty("删除标志(1-正常,2-删除)")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.mhd.oms.domain.documentPushMaterialRecord.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.documentPushMaterialRecord.entity.DocumentPushMaterialRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DocumentPushMaterialRecordMapper extends BaseMapper<DocumentPushMaterialRecord> {
|
||||
}
|
||||
+7
@@ -31,6 +31,7 @@ public class ExecuteOrderPO extends BaseVOEntity{
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long id;
|
||||
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String realCreateBy;
|
||||
@@ -123,6 +124,8 @@ public class ExecuteOrderPO extends BaseVOEntity{
|
||||
private String jobStatus;
|
||||
|
||||
@ApiModelProperty("预计运输时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date documentDate;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
@@ -150,6 +153,8 @@ public class ExecuteOrderPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date loadingDate;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@@ -188,6 +193,8 @@ public class ExecuteOrderPO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date layDate;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
|
||||
+10
@@ -172,4 +172,14 @@ public class ExecuteOrderDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("车次")
|
||||
private Integer trainNo;
|
||||
|
||||
@ApiModelProperty("预计开始日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date documentStartTime;
|
||||
|
||||
@ApiModelProperty("预计结束日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date documentEndTime;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user