Compare commits
149
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 |
@@ -18,7 +18,7 @@ import java.util.Set;
|
||||
/**
|
||||
* bms财务结算系统feign调用接口
|
||||
*/
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.33.0.109:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface BmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.33.0.99:8017", fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface OmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.33.0.129:8014",configuration = FeignAutoConfiguration.class)
|
||||
public interface WlhyServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
||||
* @description: TODO
|
||||
* @date 2024/5/10 8:58
|
||||
**/
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.102.192.32:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE, url = "http://10.33.0.109:8016", fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface WmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.102.192.33:8018", configuration = FeignAutoConfiguration.class)
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,fallbackFactory = RemoteBmsFeignFallbackFactory.class,url = "http://10.33.0.99:8018", configuration = FeignAutoConfiguration.class)
|
||||
public interface YmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,8 +46,8 @@ TmsOrderAddDTO implements Serializable {
|
||||
@ApiModelProperty(value = "装货电话")
|
||||
private String loadingPhone="";
|
||||
@ApiModelProperty(value = "装货时间日期(年月日)",required = true)
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date loadingDate;
|
||||
// @ApiModelProperty(value = "装货时间(上午、下午、24小时)")
|
||||
// private String loadingTime="";
|
||||
|
||||
@@ -116,6 +116,12 @@ public class WarehouseFeignPO extends BaseVOEntity{
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
|
||||
}
|
||||
+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());
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<WmsServiceFeign
|
||||
|
||||
@Override
|
||||
public AjaxResult execution(StockOutOrderDTO stockOutOrderDTO) {
|
||||
return null;
|
||||
return AjaxResult.error(cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -15,19 +15,20 @@ spring:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.31:6848
|
||||
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.102.192.31:6848
|
||||
# server-addr: 10.102.192.5:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -36,3 +37,19 @@ spring:
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
# SSO单点登录配置
|
||||
sso:
|
||||
# RSA公钥(由中台openssl私钥导出)
|
||||
public-key: |
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA62dYkl2Nvy2wW9028dQ7
|
||||
HdxFNhwEriFNzFMFq+m1jTvZWdU6e9a1iCGWTVV2fTo4PWSyhjWyzv2ZBEuanWBq
|
||||
y/bfh/jOTjT/tlWvMeJZ1TV4suCbigHq5TGxDsY6ZC6if9ULhU3NWkgnPNn6HfO9
|
||||
NVvBTfx9MgWtCtT33kq30KgxC6LqVdCe08+gD0KB3df0DK8OJorVFfxYVc7TjGEL
|
||||
xqUuE7PcgZgDb8KvdgO66OxBqFIB0qfc73oALKGoq/8kvjrqE/amaIZPv3jE2Rc7
|
||||
0rIhGHrFcoA3W01nNRGQKY/E/VKOGBn/uDNdi5iMXsFjKxiBbXB07bBxdhUH7698
|
||||
AwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
# SSO登录成功后跳转的前端页面地址
|
||||
redirect-url: "/"
|
||||
|
||||
+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;
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -759,6 +759,10 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
//根据合同编码查询保存合同信息
|
||||
ContractManagePO contractManagePO = contractManageDomainService.getInfoByCode1(contractManageDO.getOriginalContractNumber());
|
||||
//修改时,不管前端是否传明细,都需要先删除该合同原有的明细,避免明细为空时老明细仍在
|
||||
if (!isInsert) {
|
||||
contractManageDetailMapper.delete(new LambdaQueryWrapper<ContractManageDetail>().eq(ContractManageDetail::getContractManageId, contractManageDO.getContractManageId()));
|
||||
}
|
||||
//保存合同详情科目
|
||||
List<ContractManageDetailDTO> contractManageDetailDTOList = contractManageDO.getContractManageDetailDTOList();
|
||||
if(null != contractManageDetailDTOList && contractManageDetailDTOList.size()>0){
|
||||
@@ -830,8 +834,9 @@ public class ContractManageApplicationService {
|
||||
if (isInsert) {
|
||||
// 新增/复制时使用新插入的合同ID
|
||||
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
|
||||
} else if(null != contractManagePO){
|
||||
contractManageDetailDO.setContractManageId(contractManagePO.getContractManageId());
|
||||
} else {
|
||||
// 修改时使用当前正在修改的合同ID,不能用 getInfoByCode1 查到的(避免多条合同 originalContractNumber 相同导致明细错绑)
|
||||
contractManageDetailDO.setContractManageId(contractManageDO.getContractManageId());
|
||||
}
|
||||
contractManageDetailDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
contractManageDetailDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
@@ -977,7 +982,8 @@ public class ContractManageApplicationService {
|
||||
&& Objects.equals(item.getContractType(), contractType))
|
||||
.collect(Collectors.toList());
|
||||
if (contractManagePOs != null && contractManagePOs.size() > 1) {
|
||||
throw new ServiceException("存在多条相同费用科目的合同,请检查");
|
||||
resultContract.setIsMany("1");
|
||||
return resultContract;
|
||||
}
|
||||
if(contractManagePOList != null && contractManagePOList.size()>0){
|
||||
if(StringUtils.isNotEmpty(settlementCustomersCode)){
|
||||
|
||||
+1
-1
@@ -183,5 +183,5 @@ public class ContractManagePO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
|
||||
private Integer transportationCosts;
|
||||
|
||||
private String isMany;
|
||||
}
|
||||
+3
-1
@@ -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;
|
||||
|
||||
}
|
||||
+3
-1
@@ -165,6 +165,8 @@ public class StorageLocationPO extends BaseVOEntity{
|
||||
@Excel(name = "是否作废: 1-否 2-是")
|
||||
private Integer nullify;
|
||||
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
|
||||
}
|
||||
+4
@@ -204,4 +204,8 @@ public class StorageLocationDO extends BaseVOEntity{
|
||||
@ApiModelProperty("坐标-层 终止")
|
||||
@Excel(name = "坐标-层 终止")
|
||||
private String coordinateLayerEnd;
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
}
|
||||
+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;
|
||||
}
|
||||
+8
@@ -131,4 +131,12 @@ public class WarehouseDO extends BaseVOEntity{
|
||||
private String orgIds;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
}
|
||||
+4
@@ -212,6 +212,10 @@ public class StorageLocationDTO extends BaseVOEntity{
|
||||
@Excel(name = "坐标-层 终止")
|
||||
private String coordinateLayerEnd;
|
||||
|
||||
@ApiModelProperty("库位条码")
|
||||
@Excel(name = "库位条码")
|
||||
private String locationBarCode;
|
||||
|
||||
public interface Edit {}
|
||||
|
||||
public interface BatchInsert {}
|
||||
|
||||
+8
@@ -136,4 +136,12 @@ public class WarehouseDTO extends BaseVOEntity{
|
||||
private String orgIds;
|
||||
@ApiModelProperty("组织id 集合")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
@ApiModelProperty("任务模式")
|
||||
@Excel(name = "任务模式")
|
||||
private String taskMode;
|
||||
|
||||
@ApiModelProperty("作业模式")
|
||||
@Excel(name = "作业模式")
|
||||
private String workMode;
|
||||
}
|
||||
@@ -14,18 +14,18 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.102.192.30:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<sql id="selectContractManagePo">
|
||||
SELECT DISTINCT a.*
|
||||
FROM CONTRACT_MANAGE a
|
||||
INNER JOIN CONTRACT_MANAGE_DETAIL b
|
||||
left JOIN CONTRACT_MANAGE_DETAIL b
|
||||
ON a.CONTRACT_MANAGE_ID = b.CONTRACT_MANAGE_ID
|
||||
where
|
||||
a.del_flag = 1
|
||||
|
||||
+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
|
||||
|
||||
+8
-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">
|
||||
|
||||
+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 {
|
||||
|
||||
+27
@@ -2942,6 +2942,33 @@ public class UserApplicationService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅根据用户登录账号获取用户信息(不区分组织,SSO等场景使用)
|
||||
*/
|
||||
public LoginUser getUserByUserAccount(String userAccount) {
|
||||
UserPo userPo = userDomainService.findByUserAccount(userAccount);
|
||||
if (ObjectUtil.isNotNull(userPo)) {
|
||||
LoginUser sysUser = new LoginUser();
|
||||
sysUser.setUserid(userPo.getUserId());
|
||||
sysUser.setUsername(userPo.getUserAccount());
|
||||
UserDriverPo userDriverPo = userDriverDomainService.selectByUserId(userPo.getUserId());
|
||||
UserShipperPo userShipperPo = userShipperDomainService.selectByUserId(userPo.getUserId());
|
||||
sysUser.setUserPo(userPo);
|
||||
com.mhd.common.core.domain.po.UserDriverPo userDriverPo1 = new com.mhd.common.core.domain.po.UserDriverPo();
|
||||
if(userDriverPo != null){
|
||||
BeanUtils.copyProperties(userDriverPo, userDriverPo1);
|
||||
}
|
||||
sysUser.setUserDriverPo(userDriverPo1);
|
||||
com.mhd.common.core.domain.po.UserShipperPo userShipperPo1 = new com.mhd.common.core.domain.po.UserShipperPo();
|
||||
if (userShipperPo != null){
|
||||
BeanUtils.copyProperties(userShipperPo, userShipperPo1);
|
||||
}
|
||||
sysUser.setUserShipperPo(userShipperPo1);
|
||||
return sysUser;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 根据用户账号和组织账号获取组织用户信息
|
||||
* @Author Alex
|
||||
|
||||
+89
-56
@@ -1349,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);
|
||||
}
|
||||
@@ -1374,61 +1450,8 @@ public class UserShipperApplicationService {
|
||||
throw new ServiceException("获取组织配置失败");
|
||||
}
|
||||
|
||||
// 检查是否已存在相同customerNcCode的委托方(可能在不同组织)
|
||||
List<UserShipperEntity> existingShippers = userShipperMapper.selectList(
|
||||
new LambdaQueryWrapper<UserShipperEntity>()
|
||||
.eq(UserShipperEntity::getShipperEnterpriseName, record.getDesc1())
|
||||
.eq(UserShipperEntity::getDelFlag, 1));
|
||||
|
||||
if (CollUtil.isNotEmpty(existingShippers)) {
|
||||
// 找到已存在的委托方,检查是否已经有该组织
|
||||
UserShipperEntity existingShipper = existingShippers.get(0);
|
||||
String existingOrgCode = existingShipper.getOrgCode();
|
||||
|
||||
boolean hasOrg = false;
|
||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||
if (StringUtils.isNotEmpty(existingOrgCode)) {
|
||||
try {
|
||||
orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(existingOrgCode);
|
||||
// 检查是否已包含当前组织
|
||||
for (int i = 0; i < orgCodeArray.size(); i++) {
|
||||
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
|
||||
Long itemCode = orgItem.getLong("code");
|
||||
if (targetOrganizationId.equals(itemCode)) {
|
||||
hasOrg = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析orgCode失败,shipperId={}", existingShipper.getShipperId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasOrg) {
|
||||
// 添加新组织到orgCode数组
|
||||
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||
newOrgItem.put("name", targetOrganizationName);
|
||||
newOrgItem.put("code", targetOrganizationId);
|
||||
newOrgItem.put("ncCustomer", record.getCode());
|
||||
newOrgItem.put("names", targetOrganizationId);
|
||||
orgCodeArray.add(newOrgItem);
|
||||
|
||||
// 更新委托方的orgCode字段
|
||||
existingShipper.setOrgCode(orgCodeArray.toJSONString());
|
||||
existingShipper.setUpdateBy(loginUser.getUserPo().getUserId());
|
||||
existingShipper.setUpdateByName(loginUser.getUserPo().getUserName());
|
||||
existingShipper.setUpdateTime(new Date());
|
||||
userShipperMapper.updateById(existingShipper);
|
||||
|
||||
log.info("委托方已存在,添加新组织到orgCode,customerNcCode={},新增组织code={},name={}",
|
||||
record.getCode(), targetOrganizationId, targetOrganizationName);
|
||||
} else {
|
||||
log.info("委托方已存在且已包含该组织,跳过添加,customerNcCode={},组织code={}",
|
||||
record.getCode(), targetOrganizationId);
|
||||
}
|
||||
return; // 不新增,直接返回
|
||||
}
|
||||
|
||||
// 按公司名跨组织匹配已存在委托方的逻辑已迁移到 doSync 层(先调用 appendOrganizationToExistingShipper),
|
||||
// 走到这里说明按 ncCode+companyName 与公司名均未匹配到,本方法只负责"新增"。
|
||||
// 不存在相同的委托方,执行新增逻辑
|
||||
UserShipperDO userShipperDO = buildShipperDOFromMasterData(record, loginUser,
|
||||
targetOrganizationId, targetOrganizationName, targetTopOrganizationId);
|
||||
@@ -1441,6 +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);
|
||||
@@ -1556,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());
|
||||
|
||||
+38
-4
@@ -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();
|
||||
new Thread(() -> {
|
||||
String lockKey = LOCK_PREFIX + organizationId;
|
||||
try {
|
||||
boolean locked = redisLock.tryLock(lockKey, SYNC_LOCK_MINUTES, TimeUnit.MINUTES);
|
||||
if (!locked) {
|
||||
throw new ServiceException("当前组织正在同步主数据,请稍后再试");
|
||||
log.warn("当前组织正在同步主数据,跳过本次同步");
|
||||
return;
|
||||
}
|
||||
markSyncInProgress(organizationId);
|
||||
asyncUserShipperMasterDataSyncService.syncMasterDataAsync(loginUser, lockKey);
|
||||
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,6 +200,22 @@ public class UserShipperMasterDataSyncService {
|
||||
targetOrganizationId, organizationId, topOrganizationId, loginUser);
|
||||
UserShipperPo existing = existingMap.get(matchKey);
|
||||
if (existing == null) {
|
||||
// 按 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());
|
||||
@@ -193,6 +225,7 @@ public class UserShipperMasterDataSyncService {
|
||||
if (added != null) {
|
||||
existingMap.put(matchKey, added);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
userShipperApplicationService.updateEnterpriseShipperFromMasterData(
|
||||
record, existing, loginUser, saveTarget.getOrganizationId(),
|
||||
@@ -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);
|
||||
|
||||
+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);
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
@@ -500,6 +500,13 @@ public class UserAPI extends BaseController {
|
||||
return R.ok(sysUserVo, "操作成功");
|
||||
}
|
||||
|
||||
@ApiOperation("仅根据用户登录账号获取用户信息(不区分组织,SSO等场景)")
|
||||
@GetMapping("/getUserByUserAccount")
|
||||
public R<LoginUser> getUserByUserAccount(@RequestParam(value = "userAccount") String userAccount) {
|
||||
LoginUser sysUserVo = userApplicationService.getUserByUserAccount(userAccount);
|
||||
return R.ok(sysUserVo, "操作成功");
|
||||
}
|
||||
|
||||
@ApiOperation("根据用户钉钉用户id获取用户信息")
|
||||
@GetMapping("/getUserByDingUserId")
|
||||
public R<LoginUser> getUserByDingUserId(@RequestParam(value = "dingUserId") String dingUserId) {
|
||||
|
||||
+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.31:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
@@ -43,3 +43,12 @@ spring:
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
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">
|
||||
|
||||
@@ -629,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>
|
||||
|
||||
+22
@@ -420,6 +420,28 @@ public class BillManageApplicationService {
|
||||
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) {
|
||||
|
||||
+16
-1
@@ -288,6 +288,9 @@ public class BusinessDocumentApplicationService {
|
||||
billingStatementDTO.setBillingStatementIds(billingStatement.getBillingStatementId().toString());
|
||||
billingStatementDTO.setAuditOperation(1);
|
||||
billingStatementDomainService.reviewBilling(billingStatementDTO);
|
||||
billingStatement.setBillManageId(businessDocumentDO.getBillManageId());
|
||||
billingStatement.setBillingState(3);
|
||||
billingStatementMapper.updateById(billingStatement);
|
||||
}
|
||||
|
||||
BillManage billManage = billManageService.getById(businessDocumentDO.getBillManageId());
|
||||
@@ -320,6 +323,14 @@ public class BusinessDocumentApplicationService {
|
||||
BigDecimal amount = billAmount.add(billDetail.getBillingAmount());
|
||||
billManage.setBillAmount(amount);
|
||||
billManage.setBillTotalAmount(amount);
|
||||
BigDecimal billTotalAmount = billManage.getBillTotalAmount();
|
||||
BigDecimal billAmountSettlement = billManage.getBillAmountSettlement();
|
||||
BigDecimal subtract = billTotalAmount.subtract(billAmountSettlement);
|
||||
billManage.setBillAmountUnsettled(subtract);
|
||||
BigDecimal taxAmount = billManage.getTaxAmount();
|
||||
billManage.setTaxAmount(taxAmount.add(billDetail.getTaxAmount()));
|
||||
BigDecimal taxFreeFee = billManage.getTaxFreeFee();
|
||||
billManage.setTaxFreeFee(taxFreeFee.add(billDetail.getTaxFreeFee()));
|
||||
billManageService.updateById(billManage);
|
||||
return true;
|
||||
}
|
||||
@@ -607,7 +618,7 @@ public class BusinessDocumentApplicationService {
|
||||
if(businessDocumentDO.getBelongModuleCode().equals(BelongModuleCode.WMS.getCode())){
|
||||
contractType = 1;
|
||||
}
|
||||
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndSecondSubjectCode(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getFirstSubjectCode(),businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
|
||||
AjaxResult ajaxResult = systemServiceFeign.getInfoByCustomerAndSecondSubjectCode(businessDocumentDO.getSettlementCustomersCode(),contractType,businessDocumentDO.getFirstSubjectCode() != null ?businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode(),businessDocumentDO.getTopOrganizationId(),businessDocumentDO.getOrganizationId());
|
||||
if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
throw new ServiceException("合同信息未找到");
|
||||
}
|
||||
@@ -615,6 +626,10 @@ public class BusinessDocumentApplicationService {
|
||||
if (null == contractPO) {
|
||||
throw new ServiceException("合同信息未找到");
|
||||
}
|
||||
String isMany = contractPO.getIsMany();
|
||||
if ("1".equals(isMany)) {
|
||||
throw new ServiceException("存在多条相同费用科目的合同,请检查");
|
||||
}
|
||||
businessDocumentDO.setContractName(contractPO.getContractName());
|
||||
businessDocumentDO.setContractNumber(contractPO.getContractNumber());
|
||||
}
|
||||
|
||||
+4
-4
@@ -519,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("未找到该组织的推送地址!");
|
||||
}
|
||||
@@ -751,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 {
|
||||
@@ -764,11 +764,11 @@ 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) {
|
||||
|
||||
@@ -169,4 +169,6 @@ public class ContractManagePO extends BaseVOEntity{
|
||||
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
|
||||
private Integer principalType;
|
||||
|
||||
private String isMany;
|
||||
|
||||
}
|
||||
@@ -18,15 +18,15 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public interface ReconciliationMapper extends BaseMapper<Reconciliation>
|
||||
|
||||
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);
|
||||
|
||||
|
||||
+4
-4
@@ -754,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) {
|
||||
@@ -1062,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) {
|
||||
@@ -1633,7 +1633,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
}
|
||||
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()) {
|
||||
@@ -1941,7 +1941,7 @@ public class ReconciliationImpl extends ServiceImpl<ReconciliationMapper, Reconc
|
||||
}
|
||||
String documentPreparerNcCode = reconciliationMapper.getDocumentPreparerNcCode(salesmanId);
|
||||
String settlementCurrency=order.getSettlementCurrency();
|
||||
String settlementCurrencyNcCode = settlementCurrency;
|
||||
String settlementCurrencyNcCode = reconciliationMapper.getSettlementCurrencyNcCode(settlementCurrency, reconciliation.getOrganizationId());
|
||||
|
||||
|
||||
makerCodeNc=documentPreparerNcCode;
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
@@ -20,15 +20,15 @@ spring:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -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}, '%')
|
||||
@@ -381,8 +381,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
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} limit 1
|
||||
select chinese_name from NGWL_TEST_WLHY.TMS_SETTLEMENT_EXCHANGE_RATE where english_name = #{settlementCount} and ORGANIZATION_ID = #{organizationId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
+11
-35
@@ -25,8 +25,7 @@ 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.domain.erpCountry.entity.ErpCountry;
|
||||
import com.mhd.oms.domain.erpCountry.repository.mapper.ErpCountryMapper;
|
||||
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
@@ -96,8 +95,7 @@ public class BusinessDocumentOrderApplicationService {
|
||||
@Resource
|
||||
private DocumentPushMaterialRecordMapper documentPushMaterialRecordMapper;
|
||||
|
||||
@Resource
|
||||
private ErpCountryMapper erpCountryMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
@@ -252,10 +250,6 @@ public class BusinessDocumentOrderApplicationService {
|
||||
body.put("goodsType", goodsType != null ? goodsType : "");
|
||||
body.put("ieFlag", order.getIeType() != null ? order.getIeType() : "");
|
||||
body.put("corpCode", corpCode != null ? corpCode : "");
|
||||
// 启运/运抵国地区(收货地→ErpCountry表)
|
||||
body.put("stshipTrsarvNatcd", lookupErpCountryCode(order.getUnloadAreaId(), order.getUnloadName()));
|
||||
// 贸易国地区(发货地→ErpCountry表)
|
||||
body.put("tradeAreaCode", lookupErpCountryCode(order.getLoadingAreaId(), order.getLoadingName()));
|
||||
|
||||
List<Map<String, Object>> billList = new ArrayList<>();
|
||||
if (cargoList != null && !cargoList.isEmpty()) {
|
||||
@@ -310,10 +304,14 @@ public class BusinessDocumentOrderApplicationService {
|
||||
billMap.put("unitPrice", "");
|
||||
billMap.put("entTotal", "");
|
||||
}
|
||||
// 最终目的国(收货地)
|
||||
billMap.put("destinationCountry", order.getUnloadName() != null ? order.getUnloadName() : "");
|
||||
// 境内货源地(发货地)
|
||||
billMap.put("domesticSourcePlace", order.getLoadingName() != null ? order.getLoadingName() : "");
|
||||
// 最终目的国(优先取订单填写,未填写则取收货地)
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -436,29 +434,7 @@ public class BusinessDocumentOrderApplicationService {
|
||||
|
||||
}
|
||||
|
||||
/** 根据区域ID或名称查ErpCountry表获取国别编码 */
|
||||
private String lookupErpCountryCode(String areaId, String areaName) {
|
||||
if (areaId == null && areaName == null) return "";
|
||||
try {
|
||||
LambdaQueryWrapper<ErpCountry> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(ErpCountry::getDelFlag, 1);
|
||||
if (areaId != null) {
|
||||
qw.eq(ErpCountry::getErpCountryCode, areaId);
|
||||
}
|
||||
List<ErpCountry> list = erpCountryMapper.selectList(qw);
|
||||
if (!list.isEmpty()) return list.get(0).getErpCountryCode();
|
||||
// 按名称模糊匹配
|
||||
if (areaName != null) {
|
||||
LambdaQueryWrapper<ErpCountry> qw2 = new LambdaQueryWrapper<>();
|
||||
qw2.eq(ErpCountry::getDelFlag, 1).like(ErpCountry::getErpCountryName, areaName);
|
||||
List<ErpCountry> list2 = erpCountryMapper.selectList(qw2);
|
||||
if (!list2.isEmpty()) return list2.get(0).getErpCountryCode();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("查ErpCountry失败 areaId={} areaName={}", areaId, areaName, e);
|
||||
}
|
||||
return areaId != null ? areaId : "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updatePushStatus(Long id, Integer pushStatus, Date pushTime, String pushBy, String pushByName) {
|
||||
|
||||
+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;
|
||||
|
||||
|
||||
+6
@@ -786,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;
|
||||
|
||||
|
||||
+6
@@ -800,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;
|
||||
|
||||
|
||||
+42
@@ -5,6 +5,9 @@ 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;
|
||||
@@ -185,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<>();
|
||||
@@ -209,6 +213,23 @@ public class BusinessDocumentOrderDomainService {
|
||||
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())) {
|
||||
@@ -552,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())) {
|
||||
|
||||
+6
@@ -57,6 +57,12 @@ public class DocumentPushMaterialRecord implements Serializable {
|
||||
@ApiModelProperty("商品类型(0物料,1半成品,2成品)")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal entTotal;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("推送时间")
|
||||
private Date pushTime;
|
||||
|
||||
|
||||
+1
@@ -357,6 +357,7 @@ public class ExecutionStockInOrderImpl extends ServiceImpl<ExecutionStockInOrder
|
||||
reservationStockInOrderDO.setDocumentDate(new Date());
|
||||
reservationStockInOrderDO.setOrderTypeCode("pu_tong_ru_ku");
|
||||
reservationStockInOrderDO.setOrderTypeName("普通入库");
|
||||
reservationStockInOrderDO.setBusinessType("pu_tong_ru_ku");
|
||||
reservationStockInOrderDO.setIssueStatus(0);
|
||||
reservationStockInOrderDO.setSalesmanId(loginUser.getUserPo().getUserId().toString());
|
||||
reservationStockInOrderDO.setSalesmanName(loginUser.getUserPo().getUserName());
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@ public class ExecutionStockInOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库业务单号")
|
||||
@Excel(name = "入库业务单号")
|
||||
private String businessInOrderNumber;
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+3
-1
@@ -58,7 +58,9 @@ public class ExecutionStockInOrderDO extends BaseVOEntity {
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库业务单号")
|
||||
@Excel(name = "入库业务单号")
|
||||
private String businessInOrderNumber;
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@ public class ExecutionStockInOrderDTO extends ExecutionStockInOrderBaseDTO {
|
||||
@ApiModelProperty("入库单号")
|
||||
@Excel(name = "入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("入库业务单号")
|
||||
@Excel(name = "入库业务单号")
|
||||
private String businessInOrderNumber;
|
||||
@ApiModelProperty("入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
@Excel(name = "入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库")
|
||||
private Integer status;
|
||||
|
||||
+7
-7
@@ -132,13 +132,13 @@ public class ExecutionStockInOrderApplicationService {
|
||||
}
|
||||
}
|
||||
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
||||
if (stockInOrderDO.getWarehouseId() == null) {
|
||||
AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
if (associationWarehouseCacheDO != null) {
|
||||
stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
}
|
||||
// if (stockInOrderDO.getWarehouseId() == null) {
|
||||
// AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
// if (associationWarehouseCacheDO != null) {
|
||||
// stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// 库管角色过滤:不展示已创建(status=1)的入库单
|
||||
|
||||
+14
-1
@@ -29,6 +29,7 @@ import com.mhd.oms.domain.executionStockInOrder.repository.po.ExecutionStockInOr
|
||||
import com.mhd.oms.domain.executionStockInOrder.repository.todo.ExecutionStockInOrderDO;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.entity.ExecutionStockOutOrder;
|
||||
import com.mhd.oms.domain.executionStockOutOrder.repository.facade.IExecutionStockOutOrderService;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -39,6 +40,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -85,7 +87,8 @@ public class ExecutionStockInOrderDomainService {
|
||||
// private IReceiptMaterialDetailService receiptMaterialDetailService;
|
||||
// @Autowired
|
||||
// private IShelfMaterialDetailService shelfMaterialDetailService;
|
||||
|
||||
@Resource
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
/**
|
||||
* 分页查询入库单列表
|
||||
*/
|
||||
@@ -497,6 +500,13 @@ public class ExecutionStockInOrderDomainService {
|
||||
StockInOrder stockInOrder = new StockInOrder();
|
||||
BeanUtils.copyProperties(byId, stockInOrder,"inOrderId");
|
||||
stockInOrder.setOmsStockInOrderId(String.valueOf(byId.getInOrderId()));
|
||||
Long warehouseId = stockInOrder.getWarehouseId();
|
||||
Long topOrgId = stockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = stockInOrderMapper.getOrgId(warehouseId);
|
||||
String orgName = stockInOrderMapper.getOrgName(warehouseId);
|
||||
stockInOrder.setOrganizationId(orgId);
|
||||
stockInOrder.setOrganizationName(orgName);
|
||||
stockInOrder.setTopOrganizationId(topOrgId);
|
||||
wmsServiceFeign.omsInOrderAdd(stockInOrder);
|
||||
String inOrderNumber = stockInOrder.getInOrderNumber();
|
||||
List<ExecutionInMaterialDetail> materialDetailList = materialDetailService.list(new QueryWrapper<ExecutionInMaterialDetail>().lambda().eq(ExecutionInMaterialDetail::getInOrderNumber, inOrderNumber));
|
||||
@@ -505,6 +515,9 @@ public class ExecutionStockInOrderDomainService {
|
||||
InMaterialDetail inMaterialDetail = new InMaterialDetail();
|
||||
BeanUtils.copyProperties(reservationInMaterialDetail, inMaterialDetail,"materialDetailId");
|
||||
inMaterialDetail.setOmsInMaterialDetail(String.valueOf(reservationInMaterialDetail.getMaterialDetailId()));
|
||||
inMaterialDetail.setOrganizationId(orgId);
|
||||
inMaterialDetail.setOrganizationName(orgName);
|
||||
inMaterialDetail.setTopOrganizationId(topOrgId);
|
||||
inMaterialDetailList.add(inMaterialDetail);
|
||||
}
|
||||
wmsServiceFeign.omsInOrderAddDetail(inMaterialDetailList);
|
||||
|
||||
+3
-1
@@ -52,7 +52,9 @@ public class ExecutionStockOutOrderPO extends BaseVOEntity {
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String businessOutOrderNumber;
|
||||
@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;
|
||||
|
||||
+3
-1
@@ -51,7 +51,9 @@ public class ExecutionStockOutOrderDO extends BaseVOEntity {
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String businessOutOrderNumber;
|
||||
@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;
|
||||
|
||||
+3
-1
@@ -48,7 +48,9 @@ public class ExecutionStockOutOrderDTO extends ExecutionStockOutOrderBaseDTO {
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String outOrderNumber;
|
||||
|
||||
@ApiModelProperty("出库单号")
|
||||
@Excel(name = "出库单号")
|
||||
private String businessOutOrderNumber;
|
||||
@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;
|
||||
|
||||
+1
@@ -235,6 +235,7 @@ public class ExecutionStockOutOrderApplicationService {
|
||||
//设置客户信息
|
||||
//customerParam(stockOutOrderDO);
|
||||
stockOutOrderDO.setOrderTypeCode("pu_tong_chu_ku");
|
||||
stockOutOrderDO.setBusinessType("pu_tong_chu_ku");
|
||||
stockOutOrderDO.setOrderTypeName("普通出库");
|
||||
//设置数据字典键值
|
||||
//setDataDict(stockOutOrderDO);
|
||||
|
||||
+13
-1
@@ -37,6 +37,7 @@ import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.entity.Reservatio
|
||||
import com.mhd.oms.domain.reservationInventoryAdjustmentRecord.repository.mapper.ReservationInventoryAdjustmentRecordMapper;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.entity.ReservationMaterialInventory;
|
||||
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.WmsServiceFeign;
|
||||
import com.mhd.system.api.domain.*;
|
||||
@@ -93,7 +94,8 @@ public class ExecutionStockOutOrderDomainService {
|
||||
private ReservationInventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
|
||||
@Autowired
|
||||
private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper;
|
||||
|
||||
@Autowired
|
||||
private ReservationStockInOrderMapper stockInOrderMapper;
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
*/
|
||||
@@ -396,6 +398,13 @@ public class ExecutionStockOutOrderDomainService {
|
||||
ExecutionStockOutOrder byId = stockOutOrderService.getById(inOrderId);
|
||||
StockOutOrder stockOutOrder = new StockOutOrder();
|
||||
BeanUtils.copyProperties(byId, stockOutOrder,"outOrderId");
|
||||
Long warehouseId = stockOutOrder.getWarehouseId();
|
||||
Long topOrgId = stockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = stockInOrderMapper.getOrgId(warehouseId);
|
||||
String orgName = stockInOrderMapper.getOrgName(warehouseId);
|
||||
stockOutOrder.setOrganizationId(orgId);
|
||||
stockOutOrder.setOrganizationName(orgName);
|
||||
stockOutOrder.setTopOrganizationId(topOrgId);
|
||||
wmsServiceFeign.omsOutOrderAdd(stockOutOrder);
|
||||
|
||||
List<ReservationDeliveryDetailsLink> list = deliveryDetailsLinkService.list(new QueryWrapper<ReservationDeliveryDetailsLink>().lambda().eq(ReservationDeliveryDetailsLink::getOrderNumber, byId.getOutOrderNumber()));
|
||||
@@ -415,6 +424,9 @@ public class ExecutionStockOutOrderDomainService {
|
||||
for (ExecutionOutMaterialDetail reservationOutMaterialDetail : materialDetailList) {
|
||||
OutMaterialDetail outMaterialDetail = new OutMaterialDetail();
|
||||
BeanUtils.copyProperties(reservationOutMaterialDetail, outMaterialDetail,"materialDetailId");
|
||||
outMaterialDetail.setOrganizationId(orgId);
|
||||
outMaterialDetail.setOrganizationName(orgName);
|
||||
outMaterialDetail.setTopOrganizationId(topOrgId);
|
||||
outMaterialDetailList.add(outMaterialDetail);
|
||||
}
|
||||
wmsServiceFeign.omsOutOrderAddDetail(outMaterialDetailList);
|
||||
|
||||
+6
@@ -57,6 +57,12 @@ public class MaterialPushRecord implements Serializable {
|
||||
@ApiModelProperty("商品类型(0物料,1半成品,2成品)")
|
||||
private Integer goodsType;
|
||||
|
||||
@ApiModelProperty("总价")
|
||||
private BigDecimal entTotal;
|
||||
|
||||
@ApiModelProperty("原产国")
|
||||
private String originCountry;
|
||||
|
||||
@ApiModelProperty("推送时间")
|
||||
private Date pushTime;
|
||||
|
||||
|
||||
+122
@@ -2,6 +2,8 @@ package com.mhd.oms.domain.materialPushRecord.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.repository.mapper.BusinessDocumentCargoMultiMapper;
|
||||
import com.mhd.oms.domain.materialPushRecord.entity.MaterialPushRecord;
|
||||
import com.mhd.oms.domain.materialPushRecord.repository.mapper.MaterialPushRecordMapper;
|
||||
import com.mhd.oms.domain.documentPushMaterialRecord.entity.DocumentPushMaterialRecord;
|
||||
@@ -11,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -27,6 +30,9 @@ public class MaterialPushRecordService {
|
||||
@Resource
|
||||
private DocumentPushMaterialRecordMapper documentPushMaterialRecordMapper;
|
||||
|
||||
@Resource
|
||||
private BusinessDocumentCargoMultiMapper businessDocumentCargoMultiMapper;
|
||||
|
||||
/**
|
||||
* 按物料ID列表查询物料数据
|
||||
* 先按orderId查单证推送快照,没有再查物料推送快照,最后调WMS
|
||||
@@ -40,6 +46,17 @@ public class MaterialPushRecordService {
|
||||
return emptyResult;
|
||||
}
|
||||
|
||||
// 查询订单货物明细数量(总价计算用)
|
||||
Map<Long, BigDecimal> cargoNumMap = queryCargoNumMap(orderId, materialBaseInfoIds);
|
||||
// 查询WMS物料信息(原产国等)
|
||||
Map<Long, Map<String, Object>> materialInfoMap = queryMaterialInfoMap(materialBaseInfoIds);
|
||||
|
||||
TableDataInfo result = queryInternal(materialBaseInfoIds, orderId);
|
||||
fillExtraFields(result.getData(), cargoNumMap, materialInfoMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
private TableDataInfo queryInternal(List<Long> materialBaseInfoIds, Long orderId) {
|
||||
// 1. 先按orderId查单证推送物料记录表
|
||||
List<DocumentPushMaterialRecord> docRecords = documentPushMaterialRecordMapper.selectList(
|
||||
new LambdaQueryWrapper<DocumentPushMaterialRecord>()
|
||||
@@ -106,4 +123,109 @@ public class MaterialPushRecordService {
|
||||
return errorResult;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单ID查询货物明细数量
|
||||
*/
|
||||
private Map<Long, BigDecimal> queryCargoNumMap(Long orderId, List<Long> materialBaseInfoIds) {
|
||||
Map<Long, BigDecimal> map = new HashMap<>();
|
||||
if (orderId == null || materialBaseInfoIds == null || materialBaseInfoIds.isEmpty()) {
|
||||
return map;
|
||||
}
|
||||
try {
|
||||
List<BusinessDocumentCargoMulti> cargoList = businessDocumentCargoMultiMapper.selectList(
|
||||
new LambdaQueryWrapper<BusinessDocumentCargoMulti>()
|
||||
.eq(BusinessDocumentCargoMulti::getOrderId, String.valueOf(orderId))
|
||||
.in(BusinessDocumentCargoMulti::getMaterialBaseInfoId, materialBaseInfoIds)
|
||||
.eq(BusinessDocumentCargoMulti::getDelFlag, 1));
|
||||
for (BusinessDocumentCargoMulti cargo : cargoList) {
|
||||
if (cargo.getMaterialBaseInfoId() != null && cargo.getCargoNum() != null) {
|
||||
map.put(cargo.getMaterialBaseInfoId(), cargo.getCargoNum());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("查询订单货物明细失败 orderId={}", orderId, e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询WMS物料信息
|
||||
*/
|
||||
private Map<Long, Map<String, Object>> queryMaterialInfoMap(List<Long> materialBaseInfoIds) {
|
||||
Map<Long, Map<String, Object>> map = new HashMap<>();
|
||||
if (materialBaseInfoIds == null || materialBaseInfoIds.isEmpty()) {
|
||||
return map;
|
||||
}
|
||||
try {
|
||||
TableDataInfo wmsResult = wmsServiceFeign.getBatchByIds(materialBaseInfoIds);
|
||||
if (wmsResult != null && wmsResult.getData() != null) {
|
||||
for (Object obj : wmsResult.getData()) {
|
||||
if (obj instanceof Map) {
|
||||
Map<String, Object> item = (Map<String, Object>) obj;
|
||||
Object mid = item.get("materialBaseInfoId");
|
||||
if (mid != null) {
|
||||
map.put(Long.valueOf(String.valueOf(mid)), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("调用WMS查询物料信息失败: {}", e.getMessage());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一补充总价和原产国字段
|
||||
*/
|
||||
private void fillExtraFields(List<?> dataList, Map<Long, BigDecimal> cargoNumMap, Map<Long, Map<String, Object>> materialInfoMap) {
|
||||
if (dataList == null) {
|
||||
return;
|
||||
}
|
||||
for (Object obj : dataList) {
|
||||
if (obj instanceof MaterialPushRecord) {
|
||||
MaterialPushRecord r = (MaterialPushRecord) obj;
|
||||
Long mid = r.getMaterialBaseInfoId();
|
||||
BigDecimal cargoNum = cargoNumMap.get(mid);
|
||||
if (cargoNum != null && r.getUnitPrice() != null) {
|
||||
r.setEntTotal(cargoNum.multiply(r.getUnitPrice()));
|
||||
}
|
||||
Map<String, Object> material = materialInfoMap.get(mid);
|
||||
if (material != null && material.get("originCountry") != null) {
|
||||
r.setOriginCountry(String.valueOf(material.get("originCountry")));
|
||||
}
|
||||
} else if (obj instanceof DocumentPushMaterialRecord) {
|
||||
DocumentPushMaterialRecord r = (DocumentPushMaterialRecord) obj;
|
||||
Long mid = r.getMaterialBaseInfoId();
|
||||
BigDecimal cargoNum = cargoNumMap.get(mid);
|
||||
if (cargoNum != null && r.getUnitPrice() != null) {
|
||||
r.setEntTotal(cargoNum.multiply(r.getUnitPrice()));
|
||||
}
|
||||
Map<String, Object> material = materialInfoMap.get(mid);
|
||||
if (material != null && material.get("originCountry") != null) {
|
||||
r.setOriginCountry(String.valueOf(material.get("originCountry")));
|
||||
}
|
||||
} else if (obj instanceof Map) {
|
||||
Map<String, Object> item = (Map<String, Object>) obj;
|
||||
Object mid = item.get("materialBaseInfoId");
|
||||
if (mid != null) {
|
||||
Long materialBaseInfoId = Long.valueOf(String.valueOf(mid));
|
||||
BigDecimal cargoNum = cargoNumMap.get(materialBaseInfoId);
|
||||
Object up = item.get("unitPrice");
|
||||
BigDecimal unitPrice = up != null ? new BigDecimal(String.valueOf(up)) : null;
|
||||
if (cargoNum != null) {
|
||||
item.put("cargoNum", cargoNum);
|
||||
if (unitPrice != null) {
|
||||
item.put("entTotal", cargoNum.multiply(unitPrice));
|
||||
}
|
||||
}
|
||||
Map<String, Object> material = materialInfoMap.get(materialBaseInfoId);
|
||||
if (material != null && material.get("originCountry") != null) {
|
||||
item.put("originCountry", material.get("originCountry"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -60,7 +60,9 @@ public class ReservationOutMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -62,7 +62,9 @@ public class ReservationOutMaterialDetailPO extends ReservationStockOutOrderBase
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -60,7 +60,9 @@ public class ReservationOutMaterialDetailDO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -58,7 +58,9 @@ public class ReservationOutMaterialDetailDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class StockInExcelListener extends AnalysisEventListener<Map<String, Obje
|
||||
*/
|
||||
private void parseHeaderData(Map<String, Object> data) {
|
||||
// 入库日期:查找包含"入库日期"标签的下一个值
|
||||
Object stockInDateObj = getValueAfterLabel(data, "入库日期");
|
||||
Object stockInDateObj = getValueAfterLabel(data, "入庫日期:");
|
||||
if (stockInDateObj != null) {
|
||||
Date stockInDate = convertToDate(stockInDateObj);
|
||||
stockInHeader.setStockInDate(stockInDate);
|
||||
|
||||
+1
@@ -66,4 +66,5 @@ public interface ReservationStockInOrderMapper extends BaseMapper<ReservationSto
|
||||
|
||||
String getNcUrl(@Param("interfaceType") String interfaceType,@Param("organizationName") String organizationName,@Param("organizationId") Long organizationId);
|
||||
|
||||
String getCustomerOrgCode(@Param("id") Long id);
|
||||
}
|
||||
+8
@@ -241,6 +241,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
reservationStockOutOrderDO.setOrderTypeCode("pu_tong_chu_ku");
|
||||
reservationStockOutOrderDO.setBusinessType("pu_tong_chu_ku");
|
||||
reservationStockOutOrderDO.setOrderTypeName("普通出库");
|
||||
reservationStockOutOrderDO.setPriorityLevelCode("yi_ban");
|
||||
reservationStockOutOrderDO.setPriorityLevelName("一般");
|
||||
DeliveryHeader deliveryHeader = deliveryDataDTO.getDeliveryHeader();
|
||||
reservationStockOutOrderDO.setTotalAmount(deliveryHeader.getSubtotalAmount());
|
||||
reservationStockOutOrderDO.setRoute(deliveryHeader.getDeliveryLineNo());
|
||||
@@ -291,6 +293,9 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
reservationDeliveryDetailsLink.setAmount(customerDeliveryDetail.getAmount());
|
||||
reservationDeliveryDetailsLink.setCustomerNumber(customerDeliveryDetail.getCustomerCode());
|
||||
reservationDeliveryDetailsLink.setDeliveryName(customerDeliveryDetail.getCustomerName());
|
||||
String customerCode = customerDeliveryDetail.getCustomerCode();
|
||||
Long userId = stockOutOrderMapper.queryShipperId(customerCode, loginUser.getUserPo().getOrganizationId());
|
||||
reservationDeliveryDetailsLink.setCustomerId(userId);
|
||||
reservationDeliveryDetailsLink.setBox(customerDeliveryDetail.getBoxCount());
|
||||
reservationDeliveryDetailsLink.setBag(customerDeliveryDetail.getPackageCount());
|
||||
reservationDeliveryDetailsLink.setCategory(customerDeliveryDetail.getCategory());
|
||||
@@ -381,6 +386,9 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
|
||||
reservationStockInOrderDO.setDocumentDate(new Date());
|
||||
reservationStockInOrderDO.setOrderTypeCode("pu_tong_ru_ku");
|
||||
reservationStockInOrderDO.setOrderTypeName("普通入库");
|
||||
reservationStockInOrderDO.setBusinessType("pu_tong_ru_ku");
|
||||
reservationStockInOrderDO.setPriorityLevelCode("yi_ban");
|
||||
reservationStockInOrderDO.setPriorityLevelName("一般");
|
||||
reservationStockInOrderDO.setIssueStatus(0);
|
||||
reservationStockInOrderDO.setSalesmanId(loginUser.getUserPo().getUserId().toString());
|
||||
reservationStockInOrderDO.setSalesmanName(loginUser.getUserPo().getUserName());
|
||||
|
||||
-4
@@ -234,10 +234,6 @@ public class ReservationStockInOrderApplicationService {
|
||||
if (stockInOrderPO == null) {
|
||||
throw new ServiceException("入库单不存在,入库单ID:" + inOrderId);
|
||||
}
|
||||
// 只有已创建状态(status = 1)的入库单可以删除
|
||||
if (stockInOrderPO.getStatus() == null || !stockInOrderPO.getStatus().equals(1)) {
|
||||
throw new ServiceException("只有已创建状态的入库单可以删除,入库单号:" + stockInOrderPO.getInOrderNumber() + ",当前状态:" + getStatusName(stockInOrderPO.getStatus()));
|
||||
}
|
||||
}
|
||||
|
||||
return stockInOrderDomainService.delete(inOrderIds);
|
||||
|
||||
+24
-8
@@ -519,8 +519,15 @@ public class ReservationStockInOrderDomainService {
|
||||
reservationStockInOrder.setIssueStatus(0);
|
||||
reservationStockInOrder.setOrderTypeCode("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setOrderTypeName("普通入库");
|
||||
reservationStockInOrder.setBusinessType("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setReservationOrderSource("客户预约");
|
||||
reservationStockInOrder.setWarehouseId(warehouseId);
|
||||
if (warehouseId == null || warehouseId == 0L){
|
||||
reservationStockInOrder.setWarehouseId(byId.getWarehouseId());
|
||||
reservationStockInOrder.setWarehouseCode(byId.getWarehouseCode());
|
||||
reservationStockInOrder.setWarehouseName(byId.getWarehouseName());
|
||||
}
|
||||
|
||||
// reservationStockInOrder.setOrganizationId(orgId);
|
||||
// reservationStockInOrder.setOrganizationName(orgName);
|
||||
// reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
@@ -651,27 +658,36 @@ public class ReservationStockInOrderDomainService {
|
||||
ReservationStockInOrder byId = stockInOrderService.getById(inOrderId);
|
||||
String inOrderNumber = byId.getInOrderNumber();
|
||||
List<ReservationInMaterialDetail> materialDetailList = materialDetailService.list(new QueryWrapper<ReservationInMaterialDetail>().lambda().eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber));
|
||||
|
||||
Long warehouseId1 = byId.getWarehouseId();
|
||||
String warehouseCode1 = byId.getWarehouseCode();
|
||||
String warehouseName1 = byId.getWarehouseName();
|
||||
// 按照 warehouseId 分组
|
||||
Map<Long, List<ReservationInMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationInMaterialDetail::getWarehouseId));
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = reservationStockInOrderMapper.getOrgId(warehouseId);
|
||||
String orgName = reservationStockInOrderMapper.getOrgName(warehouseId);
|
||||
String warehouseCode = reservationStockInOrderMapper.getWarehouseCode(warehouseId);
|
||||
String warehouseName = reservationStockInOrderMapper.getWarehouseName(warehouseId);
|
||||
|
||||
|
||||
if (warehouseCode == null) warehouseCode = warehouseCode1;
|
||||
if (warehouseName == null) warehouseName = warehouseName1;
|
||||
|
||||
ExecutionStockInOrder reservationStockInOrder = new ExecutionStockInOrder();
|
||||
BeanUtils.copyProperties(byId, reservationStockInOrder,"inOrderId","issueStatus","issueTime","issueId","issueName","reservationAuditId","reservationAuditName","reservationAuditTime");
|
||||
reservationStockInOrder.setIssueStatus(0);
|
||||
reservationStockInOrder.setOrderTypeCode("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setOrderTypeName("普通入库");
|
||||
reservationStockInOrder.setBusinessType("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setReservationOrderSource("客户预约");
|
||||
reservationStockInOrder.setWarehouseId(warehouseId);
|
||||
reservationStockInOrder.setOrganizationId(orgId);
|
||||
reservationStockInOrder.setOrganizationName(orgName);
|
||||
reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
// reservationStockInOrder.setOrganizationId(orgId);
|
||||
// reservationStockInOrder.setOrganizationName(orgName);
|
||||
// reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
reservationStockInOrder.setBusinessInOrderNumber(inOrderNumber);
|
||||
@@ -687,9 +703,9 @@ public class ReservationStockInOrderDomainService {
|
||||
ExecutionInMaterialDetail reservationInMaterialDetail = new ExecutionInMaterialDetail();
|
||||
BeanUtils.copyProperties(reserveInMaterialDetail, reservationInMaterialDetail,"materialDetailId");
|
||||
reservationInMaterialDetail.setQuantity(reserveInMaterialDetail.getQuantity());
|
||||
reservationInMaterialDetail.setOrganizationId(orgId);
|
||||
reservationInMaterialDetail.setOrganizationName(orgName);
|
||||
reservationInMaterialDetail.setTopOrganizationId(topOrgId);
|
||||
// reservationInMaterialDetail.setOrganizationId(orgId);
|
||||
// reservationInMaterialDetail.setOrganizationName(orgName);
|
||||
// reservationInMaterialDetail.setTopOrganizationId(topOrgId);
|
||||
reservationInMaterialDetail.setWarehouseCode(warehouseCode);
|
||||
reservationInMaterialDetail.setWarehouseName(warehouseName);
|
||||
reservationInMaterialDetail.setInOrderNumber(reservationStockInOrder.getInOrderNumber());
|
||||
@@ -702,13 +718,13 @@ public class ReservationStockInOrderDomainService {
|
||||
BigDecimal quantity = details.stream().map(ReservationInMaterialDetail::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
reservationStockInOrder.setQuantity(quantity);
|
||||
executionStockInOrderService.save(reservationStockInOrder);
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
ExecutionStockInOrderDO param = new ExecutionStockInOrderDO();
|
||||
Long inOrderId1 = reservationStockInOrder.getInOrderId();
|
||||
List<Long> inOrderIdList1 = new ArrayList<>();
|
||||
inOrderIdList1.add(inOrderId1);
|
||||
param.setInOrderIds(inOrderIdList1);
|
||||
stockInOrderApplicationService.issueOrder(param);
|
||||
executionInMaterialDetailService.saveBatch(inMaterialDetailList);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -6,6 +6,7 @@ import com.mhd.oms.domain.reservationOutMaterialDetail.repository.po.Reservation
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.entity.ReservationStockOutOrder;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.po.ReservationStockOutOrderPO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
//import com.mhd.wms.domain.stockOutOrder.entity.ReservationStockOutOrder;
|
||||
//import com.mhd.wms.domain.stockOutOrder.repository.po.ReservationStockOutOrderPO;
|
||||
//import com.mhd.wms.domain.stockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||
@@ -34,4 +35,6 @@ public interface ReservationStockOutOrderMapper extends BaseMapper<ReservationSt
|
||||
* 出库单提货单打印-明细
|
||||
*/
|
||||
List<ReservationOutMaterialDetailPO> queryOutStockNoticePrintDetail(ReservationStockOutOrderDO stockOutOrderDO);
|
||||
|
||||
Long queryShipperId(@Param("userMemberCode") String userMemberCode,@Param("organizationId") Long organizationId);
|
||||
}
|
||||
+7
@@ -251,8 +251,15 @@ public class ReservationStockOutOrderApplicationService {
|
||||
shipperParam(stockOutOrderDO);
|
||||
//设置客户信息
|
||||
//customerParam(stockOutOrderDO);
|
||||
if (stockOutOrderDO.getOrderTypeCode() == null) {
|
||||
stockOutOrderDO.setOrderTypeCode("pu_tong_chu_ku");
|
||||
}
|
||||
if (stockOutOrderDO.getBusinessType() == null) {
|
||||
stockOutOrderDO.setBusinessType("pu_tong_chu_ku");
|
||||
}
|
||||
if (stockOutOrderDO.getOrderTypeName() == null) {
|
||||
stockOutOrderDO.setOrderTypeName("普通出库");
|
||||
}
|
||||
//设置数据字典键值
|
||||
//setDataDict(stockOutOrderDO);
|
||||
return stockOutOrderDomainService.insert(stockOutOrderDO);
|
||||
|
||||
+17
-2
@@ -370,13 +370,20 @@ public class ReservationStockOutOrderDomainService {
|
||||
reservationStockInOrder.setIssueStatus(0);
|
||||
reservationStockInOrder.setOrderTypeCode("pu_tong_chu_ku");
|
||||
reservationStockInOrder.setOrderTypeName("普通出库");
|
||||
reservationStockInOrder.setBusinessType("pu_tong_chu_ku");
|
||||
reservationStockInOrder.setReservationOrderSource("客户预约");
|
||||
reservationStockInOrder.setWarehouseId(warehouseId);
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
if (warehouseId == null || warehouseId == 0L){
|
||||
reservationStockInOrder.setWarehouseId(byId.getWarehouseId());
|
||||
reservationStockInOrder.setWarehouseCode(byId.getWarehouseCode());
|
||||
reservationStockInOrder.setWarehouseName(byId.getWarehouseName());
|
||||
}
|
||||
// reservationStockInOrder.setOrganizationId(orgId);
|
||||
// reservationStockInOrder.setOrganizationName(orgName);
|
||||
// reservationStockInOrder.setTopOrganizationId(topOrgId);
|
||||
reservationStockInOrder.setWarehouseCode(warehouseCode);
|
||||
reservationStockInOrder.setWarehouseName(warehouseName);
|
||||
|
||||
reservationStockInOrder.setBusinessOutOrderNumber(inOrderNumber);
|
||||
if (materialDetailGroupByWarehouse!=null&&materialDetailGroupByWarehouse.size()>1) {
|
||||
reservationStockInOrder.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
|
||||
@@ -472,6 +479,9 @@ public class ReservationStockOutOrderDomainService {
|
||||
|
||||
for (Long inOrderId : inOrderIds) {
|
||||
ReservationStockOutOrder byId = stockOutOrderService.getById(inOrderId);
|
||||
Long warehouseId1 = byId.getWarehouseId();
|
||||
String warehouseCode1 = byId.getWarehouseCode();
|
||||
String warehouseName1 = byId.getWarehouseName();
|
||||
String inOrderNumber = byId.getOutOrderNumber();
|
||||
List<ReservationOutMaterialDetail> materialDetailList = outMaterialDetailService.list(new QueryWrapper<ReservationOutMaterialDetail>().lambda().eq(ReservationOutMaterialDetail::getOutOrderNumber, inOrderNumber));
|
||||
|
||||
@@ -479,17 +489,22 @@ public class ReservationStockOutOrderDomainService {
|
||||
Map<Long, List<ReservationOutMaterialDetail>> materialDetailGroupByWarehouse = materialDetailList.stream()
|
||||
.collect(Collectors.groupingBy(ReservationOutMaterialDetail::getWarehouseId));
|
||||
materialDetailGroupByWarehouse.forEach((warehouseId, details) -> {
|
||||
if (warehouseId == null) warehouseId = warehouseId1;
|
||||
Long topOrgId = reservationStockInOrderMapper.getTopOrgId(warehouseId);
|
||||
Long orgId = reservationStockInOrderMapper.getOrgId(warehouseId);
|
||||
String orgName = reservationStockInOrderMapper.getOrgName(warehouseId);
|
||||
String warehouseCode = reservationStockInOrderMapper.getWarehouseCode(warehouseId);
|
||||
String warehouseName = reservationStockInOrderMapper.getWarehouseName(warehouseId);
|
||||
|
||||
if (warehouseCode == null) warehouseCode = warehouseCode1;
|
||||
if (warehouseName == null) warehouseName = warehouseName1;
|
||||
|
||||
ExecutionStockOutOrder reservationStockInOrder = new ExecutionStockOutOrder();
|
||||
BeanUtils.copyProperties(byId, reservationStockInOrder,"outOrderId","issueStatus","issueTime","issueId","issueName","reservationAuditId","reservationAuditName","reservationAuditTime");
|
||||
reservationStockInOrder.setIssueStatus(0);
|
||||
reservationStockInOrder.setOrderTypeCode("pu_tong_chu_ku");
|
||||
reservationStockInOrder.setOrderTypeName("普通出库");
|
||||
reservationStockInOrder.setBusinessType("pu_tong_chu_ku");
|
||||
reservationStockInOrder.setReservationOrderSource("客户预约");
|
||||
reservationStockInOrder.setWarehouseId(warehouseId);
|
||||
reservationStockInOrder.setOrganizationId(orgId);
|
||||
|
||||
+3
-1
@@ -60,7 +60,9 @@ public class ReserveOutMaterialDetail extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -64,7 +64,9 @@ public class ReserveOutMaterialDetailPO extends ReserveStockOutOrderBaseDO {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -57,7 +57,9 @@ public class ReserveOutMaterialDetailDO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+3
-1
@@ -56,7 +56,9 @@ public class ReserveOutMaterialDetailDTO extends BaseVOEntity {
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String reserveMaterialName;
|
||||
@ApiModelProperty("物料条形码")
|
||||
@Excel(name = "物料条形码")
|
||||
private String barCode;
|
||||
|
||||
+5
-8
@@ -79,6 +79,10 @@ public class ReserveStockInOrderApplicationService {
|
||||
*/
|
||||
|
||||
public List<ReserveStockInOrderPO> queryList(ReserveStockInOrderDO stockInOrderDO) {
|
||||
Long shipperId = stockInOrderDO.getShipperId();
|
||||
if (shipperId != null && shipperId != 0L ) {
|
||||
return stockInOrderDomainService.queryList(stockInOrderDO);
|
||||
}
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null){
|
||||
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
|
||||
@@ -127,14 +131,7 @@ public class ReserveStockInOrderApplicationService {
|
||||
stockInOrderDO.setTopOrganizationId(2827L);
|
||||
}
|
||||
}
|
||||
// 前端有传warehouseId则优先使用传参;未传时才使用"用户关联仓库"作为默认值
|
||||
if (stockInOrderDO.getWarehouseId() == null) {
|
||||
// AssociationWarehouseCacheDO associationWarehouseCacheDO =
|
||||
// SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
|
||||
// if (associationWarehouseCacheDO != null) {
|
||||
// stockInOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return stockInOrderDomainService.queryList(stockInOrderDO);
|
||||
|
||||
+13
@@ -120,6 +120,10 @@ public class ReserveStockInOrderDomainService {
|
||||
//统计总体积
|
||||
BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReserveInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
stockInOrderDO.setVolumeLimit(volumeLimit);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
// stockInOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
// stockInOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
stockInOrderService.insert(stockInOrderDO);
|
||||
return materialDetailService.batchInsert(stockInOrderDO.getInOrderNumber(), stockInOrderDO.getMaterialDetailList());
|
||||
}
|
||||
@@ -145,6 +149,10 @@ public class ReserveStockInOrderDomainService {
|
||||
// //统计总体积
|
||||
// BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReserveInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// stockInOrderDO.setVolumeLimit(volumeLimit);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
// stockInOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
// stockInOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
stockInOrderService.insert(stockInOrderDO);
|
||||
materialDetailService.batchInsert(stockInOrderDO.getInOrderNumber(), stockInOrderDO.getMaterialDetailList());
|
||||
}
|
||||
@@ -174,6 +182,10 @@ public class ReserveStockInOrderDomainService {
|
||||
//统计总体积
|
||||
BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(ReserveInMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
stockInOrderDO.setVolumeLimit(volumeLimit);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
// stockInOrderDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
// stockInOrderDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
stockInOrderService.update(stockInOrderDO);
|
||||
ReserveInMaterialDetailBaseDO inMaterialDetailBaseDO = new ReserveInMaterialDetailBaseDO();
|
||||
BeanUtils.copyProperties(stockInOrderPO, inMaterialDetailBaseDO);
|
||||
@@ -450,6 +462,7 @@ public class ReserveStockInOrderDomainService {
|
||||
reservationStockInOrder.setIssueStatus(0);
|
||||
reservationStockInOrder.setOrderTypeCode("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setOrderTypeName("普通入库");
|
||||
reservationStockInOrder.setBusinessType("pu_tong_ru_ku");
|
||||
reservationStockInOrder.setReservationOrderSource("客户预约");
|
||||
Long shipperId = reservationStockInOrder.getShipperId();
|
||||
String jsbz = reservationStockInOrderMapper.getJsbz(shipperId);
|
||||
|
||||
+1
@@ -260,6 +260,7 @@ public class ReserveStockOutOrderApplicationService {
|
||||
//设置客户信息
|
||||
//customerParam(stockOutOrderDO);
|
||||
stockOutOrderDO.setOrderTypeCode("pu_tong_chu_ku");
|
||||
stockOutOrderDO.setBusinessType("pu_tong_chu_ku");
|
||||
stockOutOrderDO.setOrderTypeName("普通出库");
|
||||
//设置数据字典键值
|
||||
//setDataDict(stockOutOrderDO);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user