This commit is contained in:
赵辉
2026-07-03 15:11:41 +08:00
parent 8b66aea296
commit 615e0d34e4
3 changed files with 46 additions and 0 deletions
@@ -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())) {
@@ -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);
}
@@ -646,4 +646,7 @@
and organization_name = #{organizationName}
and interface_type = #{interfaceType} limit 1
</select>
<select id="getCustomerOrgCode" resultType="java.lang.String">
select ORG_CODE from "NGWL_TEST_USER".USER_SHIPPER where 1 = 1 and DEL_FLAG = 1 and USER_ID = #{id}
</select>
</mapper>