Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5892efccaf | ||
|
|
ae4e0e129b | ||
|
|
5c4e460cac | ||
|
|
0d9ea32f85 | ||
|
|
6cb70805f1 | ||
|
|
81630339e4 | ||
|
|
ed809e82d4 | ||
|
|
c2e3de244b | ||
|
|
9453aea60f | ||
|
|
c877696eca | ||
|
|
7f6006ca48 | ||
|
|
defc8c3709 | ||
|
|
3c21c2c848 | ||
|
|
71936b50a7 | ||
|
|
9cfffe1224 | ||
|
|
d7574d188a | ||
|
|
1c1b06c1bf | ||
|
|
117019c55c | ||
|
|
171909b68d | ||
|
|
31c27c16c6 | ||
|
|
8dfe9545aa | ||
|
|
028afb57d7 | ||
|
|
37dd374bda | ||
|
|
d69af9ef20 | ||
|
|
9704dbfb07 | ||
|
|
3276792bb5 | ||
|
|
b57db4b8cc | ||
|
|
8a31ed9974 |
@@ -19,7 +19,8 @@ import java.util.Set;
|
||||
/**
|
||||
* bms财务结算系统feign调用接口
|
||||
*/
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.3:8012",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-bms-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "BmsService", value = ServiceNameConstants.BMS_SERVICE, url = "http://10.102.192.32:8019",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface BmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.4:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-oms-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "OmsService", value = ServiceNameConstants.OMS_SERVICE,url = "http://10.102.192.33:8017",fallbackFactory = RemoteOmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface OmsServiceFeign {
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.30:8014",configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-wlhy-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "commonWlhyServiceFeign",value = ServiceNameConstants.WLHY_SERVICE,url = "http://10.102.192.31:8014",configuration = FeignAutoConfiguration.class)
|
||||
public interface WlhyServiceFeign {
|
||||
|
||||
/**
|
||||
@@ -535,14 +536,12 @@ public interface WlhyServiceFeign {
|
||||
*/
|
||||
@PostMapping("/feign/order/add")
|
||||
public AjaxResult add(@RequestBody TmsOrderAddDTO tmsOrderAddDTO);
|
||||
|
||||
/**
|
||||
* 修改运单(OMS调整业务单后同步修改TMS订单)
|
||||
* @param tmsOrderAddDTO 需携带 TMS 订单 id 定位
|
||||
*/
|
||||
@PostMapping("/feign/order/update")
|
||||
public AjaxResult update(@RequestBody TmsOrderAddDTO tmsOrderAddDTO);
|
||||
|
||||
@GetMapping("/feign/order/cancelIssueDocuments")
|
||||
public AjaxResult cancelIssueDocuments(@RequestParam(name="executeOrderId") String executeOrderId);
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ import java.util.Map;
|
||||
* @description: TODO
|
||||
* @date 2024/5/10 8:58
|
||||
**/
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.3:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-wms-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "remoteWmsServiceFeign",value = ServiceNameConstants.WMS_SERVICE,url = "http://10.102.192.32:8016",fallbackFactory = RemoteWmsFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface WmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
// 目标地址由 nacos 配置项 feign.url.xxl-job-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "XxlJobService", value = ServiceNameConstants.XXL_JOB_SERVICE,url = "http://127.0.0.1:8020",fallbackFactory = RemoteXxlJobFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface XxlJobServiceFeign {
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ import com.mhd.system.api.feign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.4:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-yms-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "YmsService", value = ServiceNameConstants.YMS_SERVICE,url = "http://10.102.192.33:8018",fallbackFactory = RemoteBmsFeignFallbackFactory.class, configuration = FeignAutoConfiguration.class)
|
||||
public interface YmsServiceFeign {
|
||||
|
||||
/**
|
||||
|
||||
+12
-4
@@ -130,9 +130,11 @@ public class TokenLoginApplicationService {
|
||||
//验证码登录校验验证码
|
||||
String key = CacheConstants.SMS_LOGIN + userPhone;
|
||||
Object object = redisService.getCacheObject(key) == null ? "":redisService.getCacheObject(key);
|
||||
if(!ObjectUtil.equal(String.valueOf(object),verificationCode) && !ObjectUtil.equal(verificationCode, SmsConstants.universalCode)){
|
||||
recordLogininfor(userPhone, Constants.LOGIN_FAIL, "验证码错误", 1);
|
||||
throw new ServiceException("验证码错误");
|
||||
if (loginDTO.getWechatFlag() != 1) {
|
||||
// if (!ObjectUtil.equal(String.valueOf(object), verificationCode) && !ObjectUtil.equal(verificationCode, SmsConstants.universalCode)) {
|
||||
// recordLogininfor(userPhone, Constants.LOGIN_FAIL, "验证码错误", 1);
|
||||
throw new ServiceException("验证码错误");
|
||||
// }
|
||||
}
|
||||
|
||||
//获取包名对应的业务(存在需要查询业务,不存在保存为无业务模式)
|
||||
@@ -168,7 +170,13 @@ public class TokenLoginApplicationService {
|
||||
throw new ServiceException("对不起,您的账号:" + userPhone + " 已停用");
|
||||
}
|
||||
//校验验证码是否正确
|
||||
sysPasswordService.validate(userPo, verificationCode, 1, null);
|
||||
if (loginDTO.getWechatFlag() != 1) {
|
||||
// if (!ObjectUtil.equal(String.valueOf(object), verificationCode) && !ObjectUtil.equal(verificationCode, SmsConstants.universalCode)) {
|
||||
// recordLogininfor(userPhone, Constants.LOGIN_FAIL, "验证码错误", 1);
|
||||
throw new ServiceException("验证码错误");
|
||||
// }
|
||||
}
|
||||
// sysPasswordService.validate(userPo, verificationCode, 1, null);
|
||||
}
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
@@ -40,4 +40,7 @@ public class LoginDTO {
|
||||
@ApiModelProperty(name = "组织名称(司机选择组织时传入)")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty(name = "微信标识")
|
||||
private Integer wechatFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -23,8 +23,8 @@ spring:
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.102.192.31:6848
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.102.192.31:6848
|
||||
# 测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public interface BiPlatformRealDataMapper {
|
||||
/** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */
|
||||
RealOnTimeStatPO queryTodayOnTimeStats();
|
||||
|
||||
/** 任务类型统计(当月 OMS 运输订单按业务类型分组:1-跨境 2-国内) */
|
||||
/** 任务类型统计(本月 YMS QMS_MAIN_BUSINESS 预约按业务类型 BUSINESS_NAME 分组) */
|
||||
List<RealTaskTypeStatPO> queryMonthTransportOrderByType();
|
||||
|
||||
/** 月台监控-按楼层统计月台车辆(楼层、月台数量、今日预约车辆、当前作业车辆) */
|
||||
|
||||
+5
-5
@@ -5,16 +5,16 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 任务类型统计(真实数据,来自 NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER 运输订单)
|
||||
* 按业务类型 businessCategory 分组统计当月数量:1-跨境运输 2-国内运输
|
||||
* 任务类型统计(真实数据,来自 NGWL_TEST_YMS.QMS_MAIN_BUSINESS 预约登记表)
|
||||
* 按本月预约车辆数(TARGET_DATE 在当前月)以 BUSINESS_NAME 业务类型分组
|
||||
*/
|
||||
@Data
|
||||
public class RealTaskTypeStatPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 业务类型:1-跨境 2-国内 */
|
||||
private Integer businessCategory;
|
||||
/** 业务类型名称(qms_main_business.BUSINESS_NAME) */
|
||||
private String businessName;
|
||||
|
||||
/** 该类型当月单量 */
|
||||
/** 该业务类型本月预约车辆数 */
|
||||
private Long count;
|
||||
}
|
||||
+21
-22
@@ -153,6 +153,12 @@ public class BiPlatformRealDataService {
|
||||
}
|
||||
fp.put("taskTypeStatistics", m);
|
||||
}
|
||||
// 月台告警统计:按业务要求恒为 0,纳入指纹以确保旧快照(可能含非0写死值)能被覆盖更新为 0
|
||||
if (vo.getPlatformAlarmStatistics() != null) {
|
||||
fp.put("todayAlarmTotal", vo.getPlatformAlarmStatistics().getTodayAlarmTotal());
|
||||
fp.put("handled", vo.getPlatformAlarmStatistics().getHandled());
|
||||
fp.put("unhandled", vo.getPlatformAlarmStatistics().getUnhandled());
|
||||
}
|
||||
return objectMapper.writeValueAsString(fp);
|
||||
}
|
||||
|
||||
@@ -270,39 +276,32 @@ public class BiPlatformRealDataService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务类型统计:当月 OMS 运输订单按业务类型分组(1-跨境运输,2-国内运输)。
|
||||
* 返回 {totalTasks: 当月跨境+国内运输总单量, taskTypes: [{type, count}]}
|
||||
* 查询失败时返回空结构,不影响写死字段。
|
||||
*/
|
||||
/**
|
||||
* 任务类型统计:固定输出「跨境运输」「国内运输」两类,count 取当月 OMS 业务单真实单量;
|
||||
* 当月无数据或查询失败时仍返回两类、count=0(不使用写死模板兜底)。
|
||||
* 任务类型统计:本月(YMS QMS_MAIN_BUSINESS)预约车辆按业务类型 BUSINESS_NAME 分组;
|
||||
* 返回 {totalTasks: 当月总预约车辆数, taskTypes: [{type: 业务类型名称, count: 该类型预约数}]}
|
||||
* 按真实 BUSINESS_NAME 分组输出,不固定兜底类别;当月无数据或查询失败时返回空列表。
|
||||
*/
|
||||
public TaskTypeStatisticsVO queryMonthTransportOrderByType() {
|
||||
int crossBorder = 0; // 跨境运输 BUSINESS_CATEGORY=1
|
||||
int domestic = 0; // 国内运输 BUSINESS_CATEGORY=2
|
||||
List<TaskTypeCountItemVO> items = new ArrayList<>();
|
||||
int total = 0;
|
||||
try {
|
||||
List<RealTaskTypeStatPO> rows = biPlatformRealDataMapper.queryMonthTransportOrderByType();
|
||||
if (rows != null) {
|
||||
for (RealTaskTypeStatPO r : rows) {
|
||||
if (r == null || r.getBusinessCategory() == null || r.getCount() == null) {
|
||||
if (r == null || r.getBusinessName() == null || r.getCount() == null) {
|
||||
continue;
|
||||
}
|
||||
if (r.getBusinessCategory() == 1) {
|
||||
crossBorder = r.getCount().intValue();
|
||||
} else if (r.getBusinessCategory() == 2) {
|
||||
domestic = r.getCount().intValue();
|
||||
}
|
||||
int c = r.getCount().intValue();
|
||||
items.add(TaskTypeCountItemVO.builder().type(r.getBusinessName()).count(c).build());
|
||||
total += c;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("【OMS】统计当月运输订单业务类型失败: {}", e.getMessage(), e);
|
||||
// 失败时不回退写死模板,保持两类 count=0
|
||||
log.error("【YMS】统计当月预约业务类型失败: {}", e.getMessage(), e);
|
||||
// 查询失败返回空列表(前端会显示空)
|
||||
items = new ArrayList<>();
|
||||
total = 0;
|
||||
}
|
||||
List<TaskTypeCountItemVO> items = new ArrayList<>();
|
||||
items.add(TaskTypeCountItemVO.builder().type("跨境运输").count(crossBorder).build());
|
||||
items.add(TaskTypeCountItemVO.builder().type("国内运输").count(domestic).build());
|
||||
return TaskTypeStatisticsVO.builder().totalTasks(crossBorder + domestic).taskTypes(items).build();
|
||||
return TaskTypeStatisticsVO.builder().totalTasks(total).taskTypes(items).build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,7 +446,7 @@ public class BiPlatformRealDataService {
|
||||
}
|
||||
}
|
||||
|
||||
// 任务类型统计:当月 OMS 业务单真实数据(固定跨境运输/国内运输两类,不使用写死模板兜底)
|
||||
// 任务类型统计:本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组(真实业务数据)
|
||||
template.setTaskTypeStatistics(queryMonthTransportOrderByType());
|
||||
|
||||
return template;
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ public class BiReportSnapshotSyncService {
|
||||
}
|
||||
}
|
||||
|
||||
// ====== 真实数据:任务类型统计(当月 OMS 业务单,固定跨境运输/国内运输两类,不使用写死模板兜底) ======
|
||||
// ====== 真实数据:任务类型统计(本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组) ======
|
||||
template.setTaskTypeStatistics(biPlatformRealDataService.queryMonthTransportOrderByType());
|
||||
|
||||
return template;
|
||||
|
||||
+4
-16
@@ -185,13 +185,8 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
||||
.build());
|
||||
}
|
||||
|
||||
// 月台告警:按业务要求,全部置 0(趋势/统计/分布均不生成写死数据)
|
||||
List<PlatformAlarmTrendItemVO> alarmTrend = new ArrayList<>();
|
||||
for (int i = 0; i < Baseline.P_AL_D.length; i++) {
|
||||
alarmTrend.add(PlatformAlarmTrendItemVO.builder()
|
||||
.date(Baseline.P_AL_D[i])
|
||||
.alarmCount(Math.max(0, jitterInt(Baseline.P_AL_C[i], r)))
|
||||
.build());
|
||||
}
|
||||
|
||||
List<TaskTypeCountItemVO> typeCounts = new ArrayList<>();
|
||||
for (int i = 0; i < Baseline.P_TT_TYPES.length; i++) {
|
||||
@@ -201,18 +196,11 @@ public final class BiSnapshotWeeklyRandomDataBuilder {
|
||||
.build());
|
||||
}
|
||||
|
||||
int todayAl = Math.max(0, jitterInt(Baseline.P_AL_TOT, r));
|
||||
int handled = Math.max(0, jitterInt(Baseline.P_AL_H, r));
|
||||
handled = Math.min(handled, todayAl);
|
||||
int unhandled = Math.max(0, todayAl - handled);
|
||||
int todayAl = 0;
|
||||
int handled = 0;
|
||||
int unhandled = 0;
|
||||
|
||||
List<PlatformAlarmDistItemVO> dist = new ArrayList<>();
|
||||
for (int i = 0; i < Baseline.P_DIST_T.length; i++) {
|
||||
dist.add(PlatformAlarmDistItemVO.builder()
|
||||
.type(Baseline.P_DIST_T[i])
|
||||
.count(Math.max(0, jitterInt(Baseline.P_DIST_C[i], r)))
|
||||
.build());
|
||||
}
|
||||
|
||||
return PlatformSurveillanceVO.builder()
|
||||
.vehicles(vehicles)
|
||||
|
||||
@@ -19,14 +19,14 @@ spring:
|
||||
# username: nacos
|
||||
# password: manhuoda@2023
|
||||
#线上正式环境
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -148,19 +148,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY 1 DESC
|
||||
</select>
|
||||
|
||||
<!-- 任务类型统计(运输订单,来自 NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER):
|
||||
当月(CREATE_TIME 在当前月)按业务类型 BUSINESS_CATEGORY 分组统计
|
||||
BUSINESS_CATEGORY: 1-跨境运输 2-国内运输 -->
|
||||
<!-- 任务类型统计(来自 NGWL_TEST_YMS.QMS_MAIN_BUSINESS 预约登记表):
|
||||
按本月预约车辆数(TARGET_DATE 在当前月)按 BUSINESS_NAME 业务类型分组统计 -->
|
||||
<select id="queryMonthTransportOrderByType" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskTypeStatPO">
|
||||
SELECT
|
||||
BUSINESS_CATEGORY AS businessCategory,
|
||||
COUNT(1) AS count
|
||||
FROM NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER
|
||||
WHERE BUSINESS_CATEGORY IN (1, 2)
|
||||
AND CREATE_TIME IS NOT NULL
|
||||
AND TO_CHAR(CREATE_TIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
||||
GROUP BY BUSINESS_CATEGORY
|
||||
ORDER BY BUSINESS_CATEGORY
|
||||
BUSINESS_NAME AS businessName,
|
||||
COUNT(1) AS count
|
||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||
WHERE BUSINESS_NAME IS NOT NULL
|
||||
AND TARGET_DATE IS NOT NULL
|
||||
AND TO_CHAR(TARGET_DATE, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
|
||||
GROUP BY BUSINESS_NAME
|
||||
ORDER BY COUNT(1) DESC
|
||||
</select>
|
||||
|
||||
<!-- 任务负荷(今日 24 小时时段):按 EXTRACT(HOUR FROM ENTRY_TIME) 统计 -->
|
||||
|
||||
+2
-1
@@ -26,7 +26,8 @@ import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.30:8012", configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-third-party-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(value = "mhd-third-party-service",url = "http://10.102.192.32:8012", configuration = FeignAutoConfiguration.class)
|
||||
public interface ThirdPartyServiceFeign {
|
||||
|
||||
//查询当前组织所有三方接口信息
|
||||
|
||||
@@ -13,16 +13,16 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.33.0.129:6010
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
# server-addr: 10.102.192.105:6848
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 10.33.0.129:6010
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
|
||||
+61
@@ -97,6 +97,7 @@ import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.interfaces.dto.addDTO.UserDriverDTO;
|
||||
import com.mhd.user.interfaces.dto.queryDTO.UserDocumentWarningQueryDTO;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.UpdateHasDefaultAddressDTO;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.PasswordChangeDTO;
|
||||
import com.mhd.user.interfaces.facadeApi.Po.UserDriverCountPo;
|
||||
import com.mhd.user.interfaces.vo.QueryAllShipperInfoVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -214,6 +215,61 @@ public class UserApplicationService {
|
||||
@Autowired
|
||||
private UserShipperMapper userShipperMapper;
|
||||
|
||||
/**
|
||||
* 修改密码 - 同步 wlhy 与 yms
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changePassword(PasswordChangeDTO passwordChangeDTO) {
|
||||
// 1. 获取当前登录用户
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
|
||||
Long userId = loginUser.getUserPo().getUserId();
|
||||
if (userId == null) {
|
||||
throw new ServiceException("用户未登录");
|
||||
}
|
||||
|
||||
// 2. 查询用户信息
|
||||
UserPo userPO = userDomainService.selectByUserId(userId);
|
||||
UserEntity userEntity = new UserEntity();
|
||||
BeanUtils.copyProperties(userPO,userEntity);
|
||||
if (ObjectUtil.isNull(userEntity)) {
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
|
||||
// 3. 解密并加密新密码
|
||||
String salt = userEntity.getUserSalt();
|
||||
String newPassword = decrypt(passwordChangeDTO.getNewPassword());
|
||||
String encodedPassword = PasswordUtil.encrypt(userEntity.getUserAccount(), newPassword, salt);
|
||||
|
||||
// 4. 更新本地密码
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setUserId(userId);
|
||||
userDO.setUserPassword(encodedPassword);
|
||||
userDomainService.updateUser(userDO);
|
||||
|
||||
// 5. 同步到网货平台(wlhy)
|
||||
try {
|
||||
userEntity.setUserPassword(encodedPassword);
|
||||
wlhyDomainService.addOrEditPlatformUser(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步密码到网货平台失败,但不影响主流程:{}", e.getMessage());
|
||||
}
|
||||
|
||||
// 6. 同步到 YMS 平台
|
||||
try {
|
||||
Integer isQueue = userMapper.getOrdIsQueue(userEntity.getOrganizationId());
|
||||
if (isQueue != null && isQueue == 1) {
|
||||
userEntity.setUserPassword(newPassword);
|
||||
ymsDomainService.addOrEditYmsUser(userEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("同步密码到 YMS 平台失败,但不影响主流程:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 查询用户列表
|
||||
* @Author Alex
|
||||
@@ -1971,6 +2027,11 @@ public class UserApplicationService {
|
||||
if (StrUtil.isEmpty(userDO.getUserName())) {
|
||||
userDO.setUserName("用户" + userDO.getUserPhone().substring(userDO.getUserPhone().length() - 4));
|
||||
}
|
||||
//密码为空则给默认密码
|
||||
if (StrUtil.isEmpty(userDO.getUserPassword())) {
|
||||
String defaultPassword = "Aa123456";
|
||||
userDO.setUserPassword(PasswordUtil.encrypt(userDO.getUserAccount(), defaultPassword, userDO.getUserSalt()));
|
||||
}
|
||||
UserEntity userEntity = userDomainService.addUser(userDO);
|
||||
//给小程序注册用户分配默认普通用户角色(must),本组织没有则找上级
|
||||
userEntity.setUserPassword("Aa123456"); // 三方同步需要密码
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ public class UserYmsDomainService {
|
||||
ymsSysUserDTO.setPhonenumber(userEntity.getUserPhone());
|
||||
ymsSysUserDTO.setAvatar(userEntity.getAvatar());
|
||||
ymsSysUserDTO.setUserAccountType(userEntity.getUserAccountType());
|
||||
ymsSysUserDTO.setPassword(userEntity.getUserPassword());
|
||||
|
||||
if (StringUtils.isNotBlank(userEntity.getRoleCode())){
|
||||
ymsSysUserDTO.setRoleCodes(Arrays.asList(userEntity.getRoleCode().split(",")));
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.mhd.user.interfaces.dto.updateDTO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 修改密码 DTO
|
||||
* @author AI
|
||||
* @date 2026/09/10
|
||||
*/
|
||||
@Data
|
||||
public class PasswordChangeDTO {
|
||||
|
||||
/**
|
||||
* 新密码
|
||||
*/
|
||||
@NotBlank(message = "新密码不能为空")
|
||||
private String newPassword;
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.mhd.common.security.annotation.InnerAuth;
|
||||
import com.mhd.common.security.service.TokenService;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.user.interfaces.dto.queryDTO.UserDocumentWarningQueryDTO;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.PasswordChangeDTO;
|
||||
import com.mhd.user.interfaces.dto.updateDTO.UpdateHasDefaultAddressDTO;
|
||||
import com.mhd.user.interfaces.vo.QueryAllShipperInfoVo;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -1037,4 +1038,16 @@ public class UserAPI extends BaseController {
|
||||
public R<String> finShipperEnterpriseNamedByUserId(@PathVariable("userId") Long userId) {
|
||||
return R.ok(userApplicationService.finShipperEnterpriseNamedByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码 - 同步 wlhy 与 yms
|
||||
* 根据当前登录用户判断是谁修改,只传新密码,不需要校验旧密码
|
||||
*/
|
||||
@Log(title = "用户中台管理 - 修改密码", description ="修改当前登录用户密码",businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("修改密码")
|
||||
@PostMapping("/changePassword")
|
||||
public AjaxResult changePassword(@RequestBody PasswordChangeDTO passwordChangeDTO) {
|
||||
userApplicationService.changePassword(passwordChangeDTO);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@@ -18,15 +18,15 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
config:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
server-addr: 10.102.192.31:6848
|
||||
# server-addr: 10.102.192.31:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
|
||||
@@ -49,4 +49,8 @@ feign:
|
||||
readTimeout: 120000
|
||||
mhd-third-party-service:
|
||||
connectTimeout: 10000
|
||||
readTimeout: 120000
|
||||
readTimeout: 120000
|
||||
#wechat:
|
||||
# miniapp:
|
||||
# appId: wxc9dd2810a77e4e30
|
||||
# appSecret: 9354ff1215a82785ef14f2355fbf2185
|
||||
+102
@@ -2,12 +2,14 @@ package com.mhd.bms.application.server.receiptManage;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.bms.domain.billManage.entity.BillManage;
|
||||
import com.mhd.bms.domain.billManage.service.BillManageDomainService;
|
||||
import com.mhd.bms.domain.receiptManage.entity.ReceiptManage;
|
||||
import com.mhd.bms.domain.receiptManage.repository.po.ReceiptManagePO;
|
||||
import com.mhd.bms.domain.receiptManage.repository.todo.ReceiptManageDO;
|
||||
import com.mhd.bms.domain.receiptManage.service.ReceiptManageDomainService;
|
||||
import com.mhd.bms.infrastructure.utils.CheckPasswordUtil;
|
||||
import com.mhd.bms.interfaces.dto.receiptManage.ReceiptDetailDTO;
|
||||
import com.mhd.bms.interfaces.dto.receiptManage.ReceiptManageDTO;
|
||||
import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
@@ -18,10 +20,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -147,6 +152,103 @@ public class ReceiptManageApplicationService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 排队批量收款
|
||||
* 接收集合按顺序逐笔处理,任意一笔收款失败则整体回滚
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean queueBatchCollection(List<ReceiptManageDO> receiptManageDOList) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
int index = 1;
|
||||
for (ReceiptManageDO receiptManageDO : receiptManageDOList) {
|
||||
try {
|
||||
//根据账单id查询账单当前金额数据,替换前端传的账单金额、已收金额、未收金额等(仅保留前端传的收款金额和优惠金额)
|
||||
fillBillAmountFromBillManage(receiptManageDO);
|
||||
Boolean flag = batchCollection(receiptManageDO);
|
||||
if (!Boolean.TRUE.equals(flag)) {
|
||||
throw new ServiceException("收款数据处理失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//自己try捕获的异常也要标记事务回滚,确保收款失败时全部回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
throw new ServiceException("第" + index + "笔收款失败:" + e.getMessage() + ",本次收款已全部回滚");
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 排队批量收款-根据账单id查询账单当前金额,替换前端传的账单金额、已收金额、未收金额、剩余未收(仅保留前端传的收款金额和优惠金额)
|
||||
*/
|
||||
private void fillBillAmountFromBillManage(ReceiptManageDO receiptManageDO) {
|
||||
List<ReceiptDetailDTO> receiptDetailDTOList = receiptManageDO.getReceiptDetailDTOList();
|
||||
if (null == receiptDetailDTOList || receiptDetailDTOList.size() == 0) {
|
||||
throw new ServiceException("费用结算明细不能为空");
|
||||
}
|
||||
//汇总收款明细的账单id并查询账单当前数据
|
||||
Set<Long> billManageIdSet = receiptDetailDTOList.stream().map(ReceiptDetailDTO::getBillManageId).filter(ObjectUtil::isNotNull).collect(Collectors.toSet());
|
||||
if (billManageIdSet.size() == 0) {
|
||||
throw new ServiceException("收款账单不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<BillManage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(BillManage::getBillManageId, billManageIdSet);
|
||||
queryWrapper.eq(BillManage::getDelFlag, 1);
|
||||
List<BillManage> billManageList = billManageDomainService.queryListLambda(queryWrapper);
|
||||
if (null == billManageList || billManageList.size() == 0) {
|
||||
throw new ServiceException("账单信息未找到");
|
||||
}
|
||||
Map<Long, BillManage> billManageMap = billManageList.stream().collect(Collectors.toMap(BillManage::getBillManageId, billManage -> billManage, (oldValue, newValue) -> oldValue));
|
||||
//汇总账单金额、已收金额、未收金额、收款金额、优惠金额
|
||||
BigDecimal billAmount = BigDecimal.ZERO;
|
||||
BigDecimal billAmountSettlement = BigDecimal.ZERO;
|
||||
BigDecimal billAmountUnsettled = BigDecimal.ZERO;
|
||||
BigDecimal collectedAmount = BigDecimal.ZERO;
|
||||
BigDecimal collectedDiscount = BigDecimal.ZERO;
|
||||
for (ReceiptDetailDTO receiptDetailDTO : receiptDetailDTOList) {
|
||||
BillManage billManage = billManageMap.get(receiptDetailDTO.getBillManageId());
|
||||
if (null == billManage) {
|
||||
throw new ServiceException("账单" + receiptDetailDTO.getBillNumber() + "信息未找到,请刷新后重试");
|
||||
}
|
||||
//只取前端传的收款金额、优惠金额,为空按0处理
|
||||
BigDecimal detailCollectedAmount = null == receiptDetailDTO.getCollectedAmount() ? BigDecimal.ZERO : receiptDetailDTO.getCollectedAmount();
|
||||
BigDecimal detailCollectedDiscount = null == receiptDetailDTO.getCollectedDiscount() ? BigDecimal.ZERO : receiptDetailDTO.getCollectedDiscount();
|
||||
//账单当前金额以数据库为准
|
||||
BigDecimal detailBillAmount = billManage.getBillAmount();
|
||||
BigDecimal detailBillAmountSettlement = billManage.getBillAmountSettlement();
|
||||
BigDecimal detailBillAmountUnsettled = billManage.getBillAmountUnsettled();
|
||||
//剩余未收金额 = 未收金额 - 收款金额 - 优惠金额
|
||||
BigDecimal detailBillAmountUnsettledResidue = detailBillAmountUnsettled.subtract(detailCollectedAmount).subtract(detailCollectedDiscount);
|
||||
if (detailBillAmountUnsettledResidue.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("账单" + billManage.getBillNumber() + "未收金额小于本次收款金额与优惠金额之和,无法完成收款,请刷新后重试");
|
||||
}
|
||||
//用数据库当前值替换前端传的账单金额、已收金额、未收金额、剩余未收
|
||||
receiptDetailDTO.setBillAmount(detailBillAmount);
|
||||
receiptDetailDTO.setBillAmountSettlement(detailBillAmountSettlement);
|
||||
receiptDetailDTO.setBillAmountUnsettled(detailBillAmountUnsettled);
|
||||
receiptDetailDTO.setBillAmountUnsettledResidue(detailBillAmountUnsettledResidue);
|
||||
//累计收款单金额
|
||||
billAmount = billAmount.add(detailBillAmount);
|
||||
billAmountSettlement = billAmountSettlement.add(detailBillAmountSettlement);
|
||||
billAmountUnsettled = billAmountUnsettled.add(detailBillAmountUnsettled);
|
||||
collectedAmount = collectedAmount.add(detailCollectedAmount);
|
||||
collectedDiscount = collectedDiscount.add(detailCollectedDiscount);
|
||||
}
|
||||
//收款单金额:账单金额、已收金额、未收金额取查询值汇总,收款金额、优惠金额取前端传值汇总
|
||||
receiptManageDO.setBillAmount(billAmount);
|
||||
receiptManageDO.setBillAmountSettlement(billAmountSettlement);
|
||||
receiptManageDO.setBillAmountUnsettled(billAmountUnsettled);
|
||||
receiptManageDO.setCollectedAmount(collectedAmount);
|
||||
receiptManageDO.setCollectedDiscount(collectedDiscount);
|
||||
//剩余未收 = 未收金额 - 收款金额 - 优惠金额
|
||||
receiptManageDO.setUncollectedAmount(billAmountUnsettled.subtract(collectedAmount).subtract(collectedDiscount));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 撤销收款
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -56,6 +57,11 @@ public class ReceiptManageApi extends BaseController{
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
/**
|
||||
* 排队批量收款-获取账单锁的最大等待时间(秒),等待期内排队获取锁,避免并发收款直接失败
|
||||
*/
|
||||
private static final long QUEUE_COLLECTION_LOCK_WAIT_SECONDS = 30L;
|
||||
|
||||
/**
|
||||
* 分页查询收款单管理列表
|
||||
*/
|
||||
@@ -115,6 +121,65 @@ public class ReceiptManageApi extends BaseController{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排队批量收款
|
||||
* 接收多个批量收款请求参数集合,整体加锁后按顺序排队依次处理;
|
||||
* 同一账单分多次收款时前一笔处理完成后才处理下一笔,避免redis锁冲突导致收款失败;
|
||||
* 整个集合在同一事务内处理,任意一笔收款失败则全部回滚
|
||||
*/
|
||||
@ApiOperation("排队批量收款")
|
||||
@RepeatSubmit
|
||||
@PostMapping("/queueBatchCollection")
|
||||
public AjaxResult queueBatchCollection(@RequestBody List<ReceiptManageDTO> receiptManageDTOList)
|
||||
{
|
||||
if(StringUtils.isEmpty(receiptManageDTOList)){
|
||||
throw new ServiceException("收款账单不能为空");
|
||||
}
|
||||
//汇总所有收款请求涉及的账单id并排序,整体加锁,保证事务期间锁不释放且加锁顺序一致避免死锁
|
||||
Set<String> lockKeySet = new TreeSet<>();
|
||||
for (ReceiptManageDTO receiptManageDTO : receiptManageDTOList) {
|
||||
if(!StringUtils.isNotEmpty(receiptManageDTO.getBillManageIds())){
|
||||
throw new ServiceException("收款账单不能为空");
|
||||
}
|
||||
lockKeySet.addAll(Stream.of(receiptManageDTO.getBillManageIds().split(",")).filter(StringUtils::isNotEmpty).map(String::trim).collect(Collectors.toSet()));
|
||||
}
|
||||
RedisLockTypeEnum redisLockTypeEnum = RedisLockTypeEnum.BMS;
|
||||
List<RLock> locks = new ArrayList<>();
|
||||
lockKeySet.forEach(x -> {
|
||||
//获取唯一key值
|
||||
String key = redisLockTypeEnum.getUniqueKey(UniqueKeyUtil.getBillingKey(x));
|
||||
locks.add(redisLock.getRLock(key));
|
||||
});
|
||||
RedissonMultiLock redissonMultiLock = new RedissonMultiLock(locks.toArray(new RLock[lockKeySet.size()]));
|
||||
boolean payInfoDetailLock = false;
|
||||
try {
|
||||
//尝试获取锁 等待指定时间内排队获取 持有锁10分钟
|
||||
payInfoDetailLock = redissonMultiLock.tryLock(QUEUE_COLLECTION_LOCK_WAIT_SECONDS, 10, TimeUnit.MINUTES);
|
||||
if (!payInfoDetailLock) {
|
||||
redissonMultiLock = null;
|
||||
return AjaxResult.error("账单正在处理,请稍后再试");
|
||||
}
|
||||
log.info("排队批量收款-生成账单加锁成功");
|
||||
//转换实体
|
||||
List<ReceiptManageDO> receiptManageDOList = new ArrayList<>();
|
||||
for (ReceiptManageDTO receiptManageDTO : receiptManageDTOList) {
|
||||
ReceiptManageDO receiptManageDO = new ReceiptManageDO();
|
||||
BeanUtils.copyProperties(receiptManageDTO,receiptManageDO);
|
||||
receiptManageDOList.add(receiptManageDO);
|
||||
}
|
||||
//事务内排队逐笔收款,任意一笔失败全部回滚
|
||||
return toAjax(receiptManageApplicationService.queueBatchCollection(receiptManageDOList));
|
||||
}catch (Exception e){
|
||||
//异常已在应用服务层事务内标记回滚(收款失败必回滚),此处仅返回失败结果
|
||||
return AjaxResult.error("收款失败:" + e.getMessage());
|
||||
}finally {
|
||||
if (redissonMultiLock != null && payInfoDetailLock) {
|
||||
redissonMultiLock.unlock();
|
||||
log.info("排队批量收款-生成账单释放了锁");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销收款
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,8 @@ import java.util.Map;
|
||||
/**
|
||||
* 三方服务 Feign
|
||||
*/
|
||||
@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.30:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class)
|
||||
// 目标地址由 nacos 配置项 feign.url.mhd-third-party-service 指定,未配置时按服务名走服务发现
|
||||
@FeignClient(contextId = "thirdPartyServiceFeign",url = "http://10.102.192.31:8012", value = ServiceNameConstants.THIRDPARTY_CENTER, configuration = FeignAutoConfiguration.class)
|
||||
public interface ThirdPartyServiceFeign {
|
||||
|
||||
//查询当前组织所有三方接口信息
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
-- ----------------------------
|
||||
-- 入库业务单推送bms计费流水定时任务(XXL-Job: pushBillingRecord)执行日志表 -- 达梦(DM)数据库版
|
||||
-- 适用:mhd-wms-service 连接的达梦库(生产/测试按环境选择,在WMS服务连接的用户/模式下执行)
|
||||
-- 用途:记录任务执行过程中的例外情况(执行异常报错、业务continue跳过、生成业务单据失败),
|
||||
-- 本次执行全程无任何例外时保留一条成功记录(LOG_TYPE=SUCCESS)
|
||||
-- @date 2026-09-15
|
||||
-- ----------------------------
|
||||
|
||||
CREATE TABLE WMS_PUSH_BILLING_RECORD_LOG (
|
||||
ID BIGINT IDENTITY(1,1) NOT NULL,
|
||||
JOB_NAME VARCHAR(100) DEFAULT NULL,
|
||||
SHIPPER_ID VARCHAR(50) DEFAULT NULL,
|
||||
MATERIAL_INVENTORY_ID BIGINT DEFAULT NULL,
|
||||
IN_ORDER_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
MATERIAL_BASE_INFO_ID BIGINT DEFAULT NULL,
|
||||
LOT_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
WAREHOUSE_CODE VARCHAR(50) DEFAULT NULL,
|
||||
LOG_TYPE VARCHAR(20) DEFAULT NULL,
|
||||
LOG_MESSAGE VARCHAR(2000) DEFAULT NULL,
|
||||
EXECUTION_TIME DATETIME DEFAULT NULL,
|
||||
DEL_FLAG INT DEFAULT 1,
|
||||
CONSTRAINT PK_WMS_PUSH_BILLING_RECORD_LOG PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE WMS_PUSH_BILLING_RECORD_LOG IS '入库业务单推送bms计费流水任务执行日志表';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.ID IS '主键ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.JOB_NAME IS '任务名称(XXL-Job任务标识,如pushBillingRecord)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.SHIPPER_ID IS '货主ID(任务参数)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_INVENTORY_ID IS '物料库存ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.IN_ORDER_NUMBER IS '入库单号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_BASE_INFO_ID IS '物料基础信息ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOT_NUMBER IS 'LOT编号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.WAREHOUSE_CODE IS '仓库编码';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_TYPE IS '日志类型:SUCCESS-全部执行成功 SKIP-业务跳过(continue) ERROR-执行异常';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_MESSAGE IS '日志信息(成功说明/跳过原因/异常信息)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.EXECUTION_TIME IS '执行时间';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.DEL_FLAG IS '删除标记:0-无状态,1-正常,2-已删除';
|
||||
|
||||
CREATE INDEX IDX_WPBR_JOB_NAME ON WMS_PUSH_BILLING_RECORD_LOG (JOB_NAME);
|
||||
CREATE INDEX IDX_WPBR_SHIPPER_ID ON WMS_PUSH_BILLING_RECORD_LOG (SHIPPER_ID);
|
||||
CREATE INDEX IDX_WPBR_EXECUTION_TIME ON WMS_PUSH_BILLING_RECORD_LOG (EXECUTION_TIME);
|
||||
|
||||
-- ----------------------------
|
||||
-- 回滚脚本
|
||||
-- DROP TABLE WMS_PUSH_BILLING_RECORD_LOG;
|
||||
-- ----------------------------
|
||||
@@ -0,0 +1,2 @@
|
||||
-- test write permission
|
||||
SELECT 1;
|
||||
+3
-2
@@ -573,10 +573,11 @@ public class MaterialBaseInfoApplicationService {
|
||||
normalizeImportBarCodeWhenDuplicateOfHs(row);
|
||||
fillIdsFromExistingMasterData(row);
|
||||
fillOrganizationFromShipperIfNeeded(row);
|
||||
if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) {
|
||||
// 登录组织优先:以登录账号的组织为准,覆盖货主解析带来的组织,避免用货主组织导致包装规格等主数据查不到
|
||||
if (isValidOrgId(loginOrgId)) {
|
||||
row.setOrganizationId(loginOrgId);
|
||||
}
|
||||
if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) {
|
||||
if (isValidOrgId(loginTopOrgId)) {
|
||||
row.setTopOrganizationId(loginTopOrgId);
|
||||
}
|
||||
fillOrganizationName(row, loginUser);
|
||||
|
||||
+3
-2
@@ -128,10 +128,11 @@ public class MaterialBaseInfoAsyncService {
|
||||
materialBaseInfoApplicationService.normalizeImportBarCodeWhenDuplicateOfHs(row);
|
||||
materialBaseInfoApplicationService.fillIdsFromExistingMasterData(row);
|
||||
materialBaseInfoApplicationService.fillOrganizationFromShipperIfNeeded(row);
|
||||
if (!isValidOrgId(row.getOrganizationId()) && isValidOrgId(loginOrgId)) {
|
||||
// 登录组织优先:以登录账号的组织为准,覆盖货主解析带来的组织,避免用货主组织(如2841)导致包装规格等主数据查不到
|
||||
if (isValidOrgId(loginOrgId)) {
|
||||
row.setOrganizationId(loginOrgId);
|
||||
}
|
||||
if (row.getTopOrganizationId() == null && isValidOrgId(loginTopOrgId)) {
|
||||
if (isValidOrgId(loginTopOrgId)) {
|
||||
row.setTopOrganizationId(loginTopOrgId);
|
||||
}
|
||||
materialBaseInfoApplicationService.fillOrganizationName(row, loginUser);
|
||||
|
||||
+278
-123
@@ -20,7 +20,9 @@ import com.mhd.system.api.model.LoginUser;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.entity.PushBillingRecordLog;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.PushBillingRecordLogMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
@@ -75,6 +77,11 @@ public class MaterialInventoryApplicationService {
|
||||
private OutMaterialDetailMapper outMaterialDetailMapper;
|
||||
@Autowired
|
||||
private MaterialBaseInfoMapper materialBaseInfoMapper;
|
||||
@Autowired
|
||||
private PushBillingRecordLogMapper pushBillingRecordLogMapper;
|
||||
|
||||
/** XXL-Job任务标识:入库业务单推送bms计费流水 */
|
||||
private static final String JOB_NAME_PUSH_BILLING_RECORD = "pushBillingRecord";
|
||||
|
||||
|
||||
/**
|
||||
@@ -904,7 +911,9 @@ public class MaterialInventoryApplicationService {
|
||||
String inOrderNumber = materialInventoryPO.getInOrderNumber();
|
||||
Long warehouseId = materialInventoryPO.getWarehouseId();
|
||||
Date lastBillingTime = materialInventoryPO.getLastBillingTime();
|
||||
if (warehouseId==19) {//干仓计费
|
||||
String warehouseCode = materialInventoryMapper.queryWarehouseCode(warehouseId);
|
||||
if (warehouseCode == null) return;
|
||||
if ("CMD".equals(warehouseCode)) {//干仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(shipperId,"干仓计费配置");
|
||||
//客户未配置干仓计费配置
|
||||
if (shipperParameters == null || shipperParameters.size()==0) return;
|
||||
@@ -962,7 +971,7 @@ public class MaterialInventoryApplicationService {
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"冻仓");
|
||||
}
|
||||
} else if (warehouseId==20) {//冻仓计费
|
||||
} else if ("CMC".equals(warehouseCode)) {//冻仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
|
||||
if (shipperParameters == null || shipperParameters.size()==0) return;
|
||||
Long contractManageId = (Long) shipperParameters.get("contractManageId");
|
||||
@@ -1017,134 +1026,270 @@ public class MaterialInventoryApplicationService {
|
||||
|
||||
public void pushBillingRecord(String shipperId) {
|
||||
|
||||
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId);
|
||||
//未查询到库存记录
|
||||
if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return;
|
||||
for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) {
|
||||
Date createTime = materialInventoryPO.getCreateTime();
|
||||
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
|
||||
String lotNumber = materialInventoryPO.getLotNumber();
|
||||
String inOrderNumber = materialInventoryPO.getInOrderNumber();
|
||||
Long warehouseId = materialInventoryPO.getWarehouseId();
|
||||
Date lastBillingTime = materialInventoryPO.getLastBillingTime();
|
||||
if (warehouseId==19) {//干仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"干仓计费配置");
|
||||
//客户未配置干仓计费配置
|
||||
if (shipperParameters == null || shipperParameters.size()==0) continue;
|
||||
Long contractManageId = (Long) shipperParameters.get("contractManageId");
|
||||
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
|
||||
String contractNumber = (String) shipperParameters.get("contractNumber");
|
||||
String content = (String) shipperParameters.get("content");
|
||||
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
|
||||
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
|
||||
//客户未配置或是否自动推送设置为否
|
||||
if (sfzdcz==null) continue;
|
||||
if (sfzdcz!=1) continue;
|
||||
//计算费用
|
||||
List<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
|
||||
//入库业务单未设置每月仓租
|
||||
if (monthFee == null || monthFee.size()==0) continue;
|
||||
Map<String, Object> feeMap = monthFee.get(0);
|
||||
//半月仓租
|
||||
BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee");
|
||||
//整月仓租
|
||||
BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee");
|
||||
// 判断是否为昨天
|
||||
boolean isYesterday = false;
|
||||
if (createTime != null) {
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
isYesterday = yesterday.isEqual(createDate);
|
||||
}
|
||||
if (isYesterday) {
|
||||
//首次计费 需要夫力费
|
||||
//库存数量
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
//仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
|
||||
//夫力费
|
||||
BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2"));
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓");
|
||||
buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓");
|
||||
|
||||
} else {
|
||||
//期间付费 不需要夫力费
|
||||
//库存数量
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
//仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓");
|
||||
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓");
|
||||
}
|
||||
} else if (warehouseId==20) {//冻仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
|
||||
if (shipperParameters == null || shipperParameters.size()==0) continue;
|
||||
Long contractManageId = (Long) shipperParameters.get("contractManageId");
|
||||
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
|
||||
String contractNumber = (String) shipperParameters.get("contractNumber");
|
||||
String content = (String) shipperParameters.get("content");
|
||||
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
|
||||
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
|
||||
//客户未配置或是否自动推送设置为否
|
||||
if (sfzdcz==null) continue;
|
||||
if (sfzdcz!=1) continue;
|
||||
//计算费用
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
String materialClassifyId = materialBaseInfo.getMaterialClassifyId();
|
||||
BigDecimal weightLimit = materialBaseInfo.getWeightLimit();
|
||||
Map<String,Object> materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId));
|
||||
//物料分类不存在
|
||||
if (materialClassify == null || materialClassify.size()==0) continue;
|
||||
BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent");
|
||||
BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent");
|
||||
String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit");
|
||||
String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit");
|
||||
//半月仓租
|
||||
BigDecimal halfMonthWhFee = halfMonthWarehouseRent;
|
||||
//整月仓租
|
||||
BigDecimal monthlyWarehouseFee = monthlyWarehouseRent;
|
||||
long daysDiff = 0;
|
||||
if (lastBillingTime != null) {
|
||||
LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now());
|
||||
} else {
|
||||
daysDiff = -1;
|
||||
}
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
if (daysDiff < 15) {
|
||||
// 不足半月: 收半月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
} else {
|
||||
// 大于等于半月: 收整月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
|
||||
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓");
|
||||
}
|
||||
//更新最后计费时间
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
|
||||
materialInventory.setLastBillingTime(new Date());
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
// 例外情况计数(业务跳过continue、执行异常、生成业务单据失败),为0时说明本次执行全程无例外,保留成功记录
|
||||
int exceptionCount = 0;
|
||||
try {
|
||||
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId);
|
||||
//未查询到库存记录
|
||||
if (materialInventoryPOS==null || materialInventoryPOS.size()==0) {
|
||||
savePushBillingRecordLog(shipperId, null, null, PushBillingRecordLog.LOG_TYPE_SUCCESS,
|
||||
"未查询到待推送的库存记录,任务正常结束");
|
||||
return;
|
||||
}
|
||||
for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) {
|
||||
try {
|
||||
String businessChargeType = materialInventoryPO.getBusinessChargeType();
|
||||
//非散租
|
||||
if (!"散租".equals(businessChargeType)) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, null, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"业务计价类型[" + businessChargeType + "]非散租,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
Date createTime = materialInventoryPO.getCreateTime();
|
||||
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
|
||||
String lotNumber = materialInventoryPO.getLotNumber();
|
||||
String inOrderNumber = materialInventoryPO.getInOrderNumber();
|
||||
Long warehouseId = materialInventoryPO.getWarehouseId();
|
||||
Date lastBillingTime = materialInventoryPO.getLastBillingTime();
|
||||
String warehouseCode = materialInventoryDomainService.queryWarehouseCode(warehouseId);
|
||||
//仓库代码为空
|
||||
if (warehouseCode==null) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, null, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"仓库ID[" + warehouseId + "]未查询到仓库编码,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
if ("CMD".equals(warehouseCode)) {//干仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"干仓计费配置");
|
||||
//客户未配置干仓计费配置
|
||||
if (shipperParameters == null || shipperParameters.size()==0) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"货主未配置[干仓计费配置],跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
Long contractManageId = (Long) shipperParameters.get("contractManageId");
|
||||
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
|
||||
String contractNumber = (String) shipperParameters.get("contractNumber");
|
||||
String content = (String) shipperParameters.get("content");
|
||||
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
|
||||
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
|
||||
//客户未配置或是否自动推送设置为否
|
||||
if (sfzdcz==null) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"干仓计费配置未设置[是否自动推送],跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
if (sfzdcz!=1) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"干仓计费配置[是否自动推送]为否,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
//计算费用
|
||||
List<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
|
||||
//入库业务单未设置每月仓租
|
||||
if (monthFee == null || monthFee.size()==0) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"入库业务单未设置每月仓租,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> feeMap = monthFee.get(0);
|
||||
//半月仓租
|
||||
BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee");
|
||||
//整月仓租
|
||||
BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee");
|
||||
// 判断是否为昨天
|
||||
boolean isYesterday = false;
|
||||
if (createTime != null) {
|
||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||
LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
isYesterday = yesterday.isEqual(createDate);
|
||||
}
|
||||
if (isYesterday) {
|
||||
//首次计费 需要夫力费
|
||||
//库存数量
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
//仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
|
||||
//夫力费
|
||||
BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2"));
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
if (!buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
if (!buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
if (!buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
|
||||
} else {
|
||||
//期间付费 不需要夫力费
|
||||
//库存数量
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
//仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
//火险保费
|
||||
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
|
||||
if (!buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"干仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
if (!buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D08","火险保费",contractManageId,"干仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
}
|
||||
} else if ("CMC".equals(warehouseCode)) {//冻仓计费
|
||||
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
|
||||
if (shipperParameters == null || shipperParameters.size()==0) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"货主未配置[冻仓计费配置],跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
Long contractManageId = (Long) shipperParameters.get("contractManageId");
|
||||
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
|
||||
String contractNumber = (String) shipperParameters.get("contractNumber");
|
||||
String content = (String) shipperParameters.get("content");
|
||||
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
|
||||
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
|
||||
//客户未配置或是否自动推送设置为否
|
||||
if (sfzdcz==null) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"冻仓计费配置未设置[是否自动推送],跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
if (sfzdcz!=1) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"冻仓计费配置[是否自动推送]为否,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
//计算费用
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
|
||||
String materialClassifyId = materialBaseInfo.getMaterialClassifyId();
|
||||
BigDecimal weightLimit = materialBaseInfo.getWeightLimit();
|
||||
Map<String,Object> materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId));
|
||||
//物料分类不存在
|
||||
if (materialClassify == null || materialClassify.size()==0) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, warehouseCode, PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"物料分类[" + materialClassifyId + "]不存在,跳过推送");
|
||||
exceptionCount++;
|
||||
continue;
|
||||
}
|
||||
BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent");
|
||||
BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent");
|
||||
String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit");
|
||||
String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit");
|
||||
//半月仓租
|
||||
BigDecimal halfMonthWhFee = halfMonthWarehouseRent;
|
||||
//整月仓租
|
||||
BigDecimal monthlyWarehouseFee = monthlyWarehouseRent;
|
||||
long daysDiff = 0;
|
||||
if (lastBillingTime != null) {
|
||||
LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now());
|
||||
} else {
|
||||
daysDiff = -1;
|
||||
}
|
||||
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
if (daysDiff < 15) {
|
||||
// 不足半月: 收半月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
|
||||
if (!buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
} else {
|
||||
// 大于等于半月: 收整月仓租
|
||||
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
|
||||
if (!buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D01","租金(固定租)",contractManageId,"冻仓")) {
|
||||
exceptionCount++;
|
||||
}
|
||||
}
|
||||
//更新最后计费时间
|
||||
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
|
||||
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
|
||||
materialInventory.setLastBillingTime(new Date());
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
savePushBillingRecordLog(shipperId, materialInventoryPO, null, PushBillingRecordLog.LOG_TYPE_ERROR,
|
||||
"处理物料库存时发生异常:" + e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
savePushBillingRecordLog(shipperId, null, null, PushBillingRecordLog.LOG_TYPE_ERROR,
|
||||
"任务执行异常中断:" + e);
|
||||
throw e;
|
||||
}
|
||||
// 本次执行无任何例外(无跳过、无异常),保留成功记录
|
||||
if (exceptionCount == 0) {
|
||||
savePushBillingRecordLog(shipperId, null, null, PushBillingRecordLog.LOG_TYPE_SUCCESS,
|
||||
"入库业务单推送bms计费流水全部执行成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存入库业务单推送bms计费流水执行日志(日志写入失败仅打印错误,不影响任务主流程)
|
||||
*
|
||||
* @param shipperId 货主ID(任务参数),为空时从物料库存取
|
||||
* @param materialInventoryPO 物料库存(为空表示任务级日志)
|
||||
* @param warehouseCode 仓库编码
|
||||
* @param logType 日志类型:SUCCESS-全部执行成功 SKIP-业务跳过 ERROR-执行异常
|
||||
* @param logMessage 日志信息(成功说明/跳过原因/异常信息)
|
||||
*/
|
||||
private void savePushBillingRecordLog(String shipperId, MaterialInventoryPO materialInventoryPO, String warehouseCode,
|
||||
String logType, String logMessage) {
|
||||
try {
|
||||
PushBillingRecordLog logRecord = new PushBillingRecordLog();
|
||||
logRecord.setJobName(JOB_NAME_PUSH_BILLING_RECORD);
|
||||
if (StringUtils.isNotBlank(shipperId)) {
|
||||
logRecord.setShipperId(shipperId);
|
||||
} else if (materialInventoryPO != null && materialInventoryPO.getShipperId() != null) {
|
||||
logRecord.setShipperId(String.valueOf(materialInventoryPO.getShipperId()));
|
||||
}
|
||||
if (materialInventoryPO != null) {
|
||||
logRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
logRecord.setInOrderNumber(materialInventoryPO.getInOrderNumber());
|
||||
logRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
logRecord.setLotNumber(materialInventoryPO.getLotNumber());
|
||||
}
|
||||
logRecord.setWarehouseCode(warehouseCode);
|
||||
logRecord.setLogType(logType);
|
||||
// 日志信息截断,防止超长导致入库失败
|
||||
if (logMessage != null && logMessage.length() > 2000) {
|
||||
logMessage = logMessage.substring(0, 2000);
|
||||
}
|
||||
logRecord.setLogMessage(logMessage);
|
||||
logRecord.setExecutionTime(new Date());
|
||||
logRecord.setDelFlag(1);
|
||||
pushBillingRecordLogMapper.insert(logRecord);
|
||||
} catch (Exception e) {
|
||||
log.error("保存入库业务单推送bms计费流水执行日志失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO,String code,String name,Long contractManageId,String warehouseType) {
|
||||
private boolean buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO,String code,String name,Long contractManageId,String warehouseType) {
|
||||
Long shipperId = materialInventoryPO.getShipperId();
|
||||
Map<String, Object> shipper = materialInventoryMapper.querySetlleByShipperId(shipperId);
|
||||
if (shipper == null) {
|
||||
return;
|
||||
savePushBillingRecordLog(null, materialInventoryPO, materialInventoryPO.getWarehouseCode(),
|
||||
PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"货主[" + shipperId + "]未查询到结算客户信息,未生成业务单据");
|
||||
return false;
|
||||
}
|
||||
Long settlementCustomersId = (Long) shipper.get("settlementCustomersId");
|
||||
Long settlementEntityId = (Long) shipper.get("settlementEntityId");
|
||||
@@ -1174,7 +1319,12 @@ public class MaterialInventoryApplicationService {
|
||||
businessDocumentFeign.setWarehouseType(warehouseType);
|
||||
businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber());
|
||||
Map<String, Object> contract = materialInventoryDomainService.queryContract(contractManageId);
|
||||
if (contract == null) {return;}
|
||||
if (contract == null) {
|
||||
savePushBillingRecordLog(null, materialInventoryPO, materialInventoryPO.getWarehouseCode(),
|
||||
PushBillingRecordLog.LOG_TYPE_SKIP,
|
||||
"合同[" + contractManageId + "]未查询到合同信息,未生成业务单据");
|
||||
return false;
|
||||
}
|
||||
String contractName = (String) contract.get("contractName");
|
||||
String contractNumber = (String) contract.get("contractNumber");
|
||||
businessDocumentFeign.setContractName(contractName);
|
||||
@@ -1185,6 +1335,11 @@ public class MaterialInventoryApplicationService {
|
||||
AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign);
|
||||
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常");
|
||||
savePushBillingRecordLog(null, materialInventoryPO, materialInventoryPO.getWarehouseCode(),
|
||||
PushBillingRecordLog.LOG_TYPE_ERROR,
|
||||
"保存业务单据失败:" + (ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+98
-8
@@ -2040,21 +2040,71 @@ public class StockInOrderApplicationService {
|
||||
r.getMaterialCode(), topOrganizationId, shipperId);
|
||||
List<MaterialBaseInfoPO> materialList = materialBaseInfoService.queryList(queryDO);
|
||||
log.info("料号查询结果,查询到 {} 条记录", materialList != null ? materialList.size() : 0);
|
||||
MaterialBaseInfoPO materialBaseInfoPO = null;
|
||||
if (materialList != null && !materialList.isEmpty()) {
|
||||
materialBaseInfoPO = materialList.get(0);
|
||||
MaterialBaseInfoPO materialBaseInfoPO = pickMaterialByCode(materialList, r.getMaterialCode(), shipperId, order.getShipperName());
|
||||
// 兜底:按名称解析出的shipperId可能与物料档案shipper_id不一致(系统中存在同名货主账号,
|
||||
// 按user_name精确匹配解析到了另一个同名列货主),此时去掉货主ID条件再查一次,
|
||||
// 用物料档案冗余的shipper_name与Excel客户名称等值匹配
|
||||
if (materialBaseInfoPO == null && StringUtils.isNotBlank(order.getShipperName())) {
|
||||
MaterialBaseInfoDO fallbackDO = new MaterialBaseInfoDO();
|
||||
fallbackDO.setMaterialCode(r.getMaterialCode());
|
||||
if (topOrganizationId != null) {
|
||||
fallbackDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
List<MaterialBaseInfoPO> fallbackList = materialBaseInfoService.queryList(fallbackDO);
|
||||
materialBaseInfoPO = pickMaterialByCode(fallbackList, r.getMaterialCode(), null, order.getShipperName());
|
||||
if (materialBaseInfoPO != null) {
|
||||
log.warn("导入料号校验:按解析shipperId未匹配到物料,已按档案货主名称兜底匹配。料号: [{}], 解析shipperId: {}, 档案shipperId: {}, 档案shipperName: {}",
|
||||
r.getMaterialCode(), shipperId, materialBaseInfoPO.getShipperId(), materialBaseInfoPO.getShipperName());
|
||||
// 以档案货主为准纠正单据货主信息,避免后续shipperParam按错误的shipperId反查覆盖货主名称
|
||||
if (materialBaseInfoPO.getShipperId() != null) {
|
||||
shipperId = materialBaseInfoPO.getShipperId();
|
||||
order.setShipperId(shipperId);
|
||||
}
|
||||
if (StringUtils.isNotBlank(materialBaseInfoPO.getShipperCode())) {
|
||||
order.setShipperCode(materialBaseInfoPO.getShipperCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(materialBaseInfoPO.getShipperName())) {
|
||||
order.setShipperName(materialBaseInfoPO.getShipperName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (materialBaseInfoPO != null) {
|
||||
materialBaseInfoId = materialBaseInfoPO.getMaterialBaseInfoId();
|
||||
log.info("通过料号查询到物料基础信息,料号: {}, 物料ID: {}, 货主ID: {}",
|
||||
log.info("通过料号查询到物料基础信息,料号: {}, 物料ID: {}, 货主ID: {}",
|
||||
r.getMaterialCode(), materialBaseInfoId, shipperId);
|
||||
} else {
|
||||
// 如果提供了料号但查询不到(或不属于该货主),直接报错,不允许导入
|
||||
String errorMsg = String.format("导入失败:该货主下不存在该料号(货主名称=%s,料号=%s)。请确保该料号已在物料管理中创建,且属于该货主",
|
||||
order.getShipperName(), r.getMaterialCode());
|
||||
// 诊断对照查询(仅用于日志定位,不影响流程):去掉货主ID条件再查一次,
|
||||
// 用于区分两类原因:A-按名称解析出的shipperId与物料档案shipper_id不一致(货主错配);
|
||||
// B-登录人topOrganizationId与物料档案top_organization_id不一致(组织口径不一致)
|
||||
try {
|
||||
MaterialBaseInfoDO diagDO = new MaterialBaseInfoDO();
|
||||
diagDO.setMaterialCode(r.getMaterialCode());
|
||||
if (topOrganizationId != null) {
|
||||
diagDO.setTopOrganizationId(topOrganizationId);
|
||||
}
|
||||
List<MaterialBaseInfoPO> diagList = materialBaseInfoService.queryList(diagDO);
|
||||
if (diagList != null && !diagList.isEmpty()) {
|
||||
MaterialBaseInfoPO diagPo = diagList.get(0);
|
||||
log.error("导入料号校验诊断:去掉货主条件后可查到物料,判定为货主解析错配(原因A)。料号: [{}], 解析shipperId: {}, 登录topOrganizationId: {}, 物料ID: {}, 档案shipperId: {}, 档案shipperName: {}, 档案topOrganizationId: {}",
|
||||
r.getMaterialCode(), shipperId, topOrganizationId,
|
||||
diagPo.getMaterialBaseInfoId(), diagPo.getShipperId(), diagPo.getShipperName(), diagPo.getTopOrganizationId());
|
||||
} else {
|
||||
log.error("导入料号校验诊断:去掉货主条件后仍查不到物料,判定为组织口径不一致(原因B)。料号: [{}], 解析shipperId: {}, 登录topOrganizationId: {}",
|
||||
r.getMaterialCode(), shipperId, topOrganizationId);
|
||||
}
|
||||
} catch (Exception diagEx) {
|
||||
log.warn("导入料号校验诊断查询异常,料号: [{}], 错误: {}", r.getMaterialCode(), diagEx.getMessage());
|
||||
}
|
||||
String errorMsg = String.format("导入失败:该货主下不存在该料号(货主名称=%s,料号=%s,解析shipperId=%s,登录topOrganizationId=%s)。请确保该料号已在物料管理中创建,且属于该货主",
|
||||
order.getShipperName(), r.getMaterialCode(),
|
||||
shipperId == null ? "空" : shipperId, topOrganizationId == null ? "空" : topOrganizationId);
|
||||
log.error(errorMsg);
|
||||
throw new ServiceException(errorMsg);
|
||||
}
|
||||
// 校验料号与规格型号/SKU码一致性:按料号查到档案后逐项比对,任何一项不符直接报对应错误
|
||||
// 双方(trim后)必须完全一致:Excel留空而档案有值、或Excel填了值而档案为空,均视为不一致报错
|
||||
// 规格型号(trim后)双方必须完全一致:Excel留空而档案有值、或Excel填了值而档案为空,均视为不一致报错
|
||||
// SKU码:档案条码(barCode)为空时跳过比对(存量档案普遍未维护条码);档案有值时仍严格比对
|
||||
String excelSpec = StringUtils.trimToEmpty(r.getSpecificationModel());
|
||||
String dbSpec = StringUtils.trimToEmpty(materialBaseInfoPO.getSpecificationModel());
|
||||
if (!excelSpec.equals(dbSpec)) {
|
||||
@@ -2064,7 +2114,7 @@ public class StockInOrderApplicationService {
|
||||
}
|
||||
String excelSku = StringUtils.trimToEmpty(r.getSkuCode());
|
||||
String dbSku = StringUtils.trimToEmpty(materialBaseInfoPO.getBarCode());
|
||||
if (!excelSku.equals(dbSku)) {
|
||||
if (StringUtils.isNotEmpty(dbSku) && !excelSku.equals(dbSku)) {
|
||||
throw new ServiceException(String.format("导入失败:料号[%s](商品名称:%s)SKU码与物料档案不一致(Excel:%s / 档案:%s)",
|
||||
r.getMaterialCode(), r.getMaterialName(),
|
||||
excelSku.isEmpty() ? "空" : excelSku, dbSku.isEmpty() ? "空" : dbSku));
|
||||
@@ -2398,6 +2448,46 @@ public class StockInOrderApplicationService {
|
||||
return oid != null && loginOrganizationId.equals(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入校验:从按料号(SQL为LIKE模糊)查出的物料列表中挑选匹配记录。
|
||||
* 优先级:料号精确等值优先于模糊命中(避免子串料号误匹配);
|
||||
* 同级内优先 shipperId 精确匹配,其次 shipperName 等值匹配,最后取排序第一条(与原 get(0) 行为一致)。
|
||||
*/
|
||||
private MaterialBaseInfoPO pickMaterialByCode(List<MaterialBaseInfoPO> materialList, String materialCode, Long shipperId, String shipperName) {
|
||||
if (materialList == null || materialList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String code = StringUtils.trimToEmpty(materialCode);
|
||||
String name = StringUtils.trimToEmpty(shipperName);
|
||||
MaterialBaseInfoPO exactCodeFirst = null;
|
||||
MaterialBaseInfoPO anyFirst = null;
|
||||
// 第一轮:料号精确等值中优先 shipperId 精确匹配
|
||||
for (MaterialBaseInfoPO po : materialList) {
|
||||
if (anyFirst == null) {
|
||||
anyFirst = po;
|
||||
}
|
||||
if (StringUtils.isEmpty(code) || !code.equals(StringUtils.trimToEmpty(po.getMaterialCode()))) {
|
||||
continue;
|
||||
}
|
||||
if (exactCodeFirst == null) {
|
||||
exactCodeFirst = po;
|
||||
}
|
||||
if (shipperId != null && shipperId.equals(po.getShipperId())) {
|
||||
return po;
|
||||
}
|
||||
}
|
||||
// 第二轮:料号精确等值中按档案货主名称等值匹配
|
||||
if (StringUtils.isNotEmpty(name)) {
|
||||
for (MaterialBaseInfoPO po : materialList) {
|
||||
if (StringUtils.isNotEmpty(code) && code.equals(StringUtils.trimToEmpty(po.getMaterialCode()))
|
||||
&& name.equals(StringUtils.trimToEmpty(po.getShipperName()))) {
|
||||
return po;
|
||||
}
|
||||
}
|
||||
}
|
||||
return exactCodeFirst != null ? exactCodeFirst : anyFirst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据货主名称或编号获取货主ID(用于导入时提前获取货主ID)
|
||||
* @param shipperName 货主名称
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.mhd.wms.domain.materialInventory.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 入库业务单推送bms计费流水任务(XXL-Job:pushBillingRecord)执行日志对象 wms_push_billing_record_log
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2026-09-15
|
||||
*/
|
||||
@Data
|
||||
@TableName("WMS_PUSH_BILLING_RECORD_LOG")
|
||||
public class PushBillingRecordLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 日志类型:全部执行成功 */
|
||||
public static final String LOG_TYPE_SUCCESS = "SUCCESS";
|
||||
/** 日志类型:业务跳过(continue跳出) */
|
||||
public static final String LOG_TYPE_SKIP = "SKIP";
|
||||
/** 日志类型:执行异常(报错) */
|
||||
public static final String LOG_TYPE_ERROR = "ERROR";
|
||||
|
||||
@ApiModelProperty("主键ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("任务名称(XXL-Job任务标识)")
|
||||
private String jobName;
|
||||
|
||||
@ApiModelProperty("货主ID(任务参数)")
|
||||
private String shipperId;
|
||||
|
||||
@ApiModelProperty("物料库存ID")
|
||||
private Long materialInventoryId;
|
||||
|
||||
@ApiModelProperty("入库单号")
|
||||
private String inOrderNumber;
|
||||
|
||||
@ApiModelProperty("物料基础信息ID")
|
||||
private Long materialBaseInfoId;
|
||||
|
||||
@ApiModelProperty("LOT编号")
|
||||
private String lotNumber;
|
||||
|
||||
@ApiModelProperty("仓库编码")
|
||||
private String warehouseCode;
|
||||
|
||||
@ApiModelProperty("日志类型:SUCCESS-全部执行成功 SKIP-业务跳过 ERROR-执行异常")
|
||||
private String logType;
|
||||
|
||||
@ApiModelProperty("日志信息(成功说明/跳过原因/异常信息)")
|
||||
private String logMessage;
|
||||
|
||||
@ApiModelProperty("执行时间")
|
||||
private Date executionTime;
|
||||
|
||||
@ApiModelProperty("删除标记:0-无状态,1-正常,2-已删除")
|
||||
private Integer delFlag;
|
||||
}
|
||||
+2
@@ -136,4 +136,6 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
|
||||
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName);
|
||||
|
||||
Map<String, Object> queryMaterialClassify(Long id);
|
||||
|
||||
String queryWarehouseCode(Long id);
|
||||
}
|
||||
+2
@@ -140,4 +140,6 @@ public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory>
|
||||
public Map<String,Object> queryShipperParameters(@Param("shipperId") Long shipperId,@Param("parametersName") String parametersName);
|
||||
|
||||
public Map<String, Object> queryMaterialClassify(@Param("id") Long id);
|
||||
|
||||
public String queryWarehouseCode(@Param("id") Long id);
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.mhd.wms.domain.materialInventory.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.wms.domain.materialInventory.entity.PushBillingRecordLog;
|
||||
|
||||
/**
|
||||
* 入库业务单推送bms计费流水任务执行日志Mapper接口
|
||||
*
|
||||
* @author mhd
|
||||
* @date 2026-09-15
|
||||
*/
|
||||
public interface PushBillingRecordLogMapper extends BaseMapper<PushBillingRecordLog> {
|
||||
}
|
||||
+5
@@ -1286,4 +1286,9 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
public Map<String, Object> queryMaterialClassify(Long id) {
|
||||
return materialInventoryMapper.queryMaterialClassify(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryWarehouseCode(Long id) {
|
||||
return materialInventoryMapper.queryWarehouseCode(id);
|
||||
}
|
||||
}
|
||||
+3
@@ -277,4 +277,7 @@ public class MaterialInventoryPO extends MaterialBasePO {
|
||||
@ApiModelProperty("半月仓租单位")
|
||||
@Excel(name = "半月仓租单位")
|
||||
private String halfMonthWarehouseRentUnit;
|
||||
|
||||
@ApiModelProperty("业务计价类型")
|
||||
private String businessChargeType;
|
||||
}
|
||||
+4
@@ -149,4 +149,8 @@ public class MaterialInventoryDomainService {
|
||||
public Map<String,Object> queryMaterialClassify(Long id) {
|
||||
return materialInventoryService.queryMaterialClassify(id);
|
||||
}
|
||||
|
||||
public String queryWarehouseCode(Long id) {
|
||||
return materialInventoryService.queryWarehouseCode(id);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ spring:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
@@ -25,7 +25,7 @@ spring:
|
||||
# server-addr: 127.0.0.1:8848
|
||||
# server-addr: 10.33.0.129:6010
|
||||
# 线上测试环境配置 容器名+端口号
|
||||
server-addr: 10.102.192.31:6848
|
||||
server-addr: 10.102.192.30:6848
|
||||
username: nacos
|
||||
password: manhuoda@2023
|
||||
#线上正式环境
|
||||
|
||||
@@ -75,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="halfMonthWarehouseRentUnit" column="half_month_warehouse_rent_unit" />
|
||||
<result property="halfMonthWarehouseRent" column="half_month_warehouse_rent" />
|
||||
<result property="monthlyWarehouseRent" column="monthly_warehouse_rent" />
|
||||
<result property="businessChargeType" column="BUSINESS_CHARGE_TYPE" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -1822,8 +1823,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="queryPushBms" resultMap="MaterialInventoryResult">
|
||||
SELECT *
|
||||
FROM MATERIAL_INVENTORY
|
||||
SELECT *,
|
||||
(SELECT BUSINESS_CHARGE_TYPE FROM NGWL_TEST_OMS.RESERVATION_STOCK_IN_ORDER WHERE EXECUTION_IN_ORDER_NUMBER = a.in_order_number) as BUSINESS_CHARGE_TYPE
|
||||
FROM MATERIAL_INVENTORY a
|
||||
WHERE EXTRACT(DAY FROM CREATE_TIME) = EXTRACT(DAY FROM SYSDATE - 1) AND INVENTORY_QUANTITY > 0
|
||||
AND DEL_FLAG = 1 AND SHIPPER_ID = #{shipperId}
|
||||
</select>
|
||||
@@ -1894,4 +1896,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
1 = 1
|
||||
AND MATERIAL_CLASSIFY_ID = #{id} AND DEL_FLAG = 1
|
||||
</select>
|
||||
|
||||
<select id="queryWarehouseCode" resultType="java.lang.String">
|
||||
SELECT
|
||||
WAREHOUSE_CODE AS "warehouseCode"
|
||||
FROM
|
||||
NGWL_TEST_SYSTEM.WAREHOUSE
|
||||
WHERE
|
||||
1 = 1
|
||||
AND WAREHOUSE_ID = #{id} AND DEL_FLAG = 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
-- ----------------------------
|
||||
-- 入库业务单推送bms计费流水定时任务(XXL-Job: pushBillingRecord)执行日志表 -- 达梦(DM)数据库版
|
||||
-- 适用:mhd-wms-service 连接的达梦库(生产/测试按环境选择,在WMS服务连接的用户/模式下执行)
|
||||
-- 用途:记录任务执行过程中的例外情况(执行异常报错、业务continue跳过、生成业务单据失败),
|
||||
-- 本次执行全程无任何例外时保留一条成功记录(LOG_TYPE=SUCCESS)
|
||||
-- @date 2026-09-15
|
||||
-- ----------------------------
|
||||
|
||||
CREATE TABLE WMS_PUSH_BILLING_RECORD_LOG (
|
||||
ID BIGINT IDENTITY(1,1) NOT NULL,
|
||||
JOB_NAME VARCHAR(100) DEFAULT NULL,
|
||||
SHIPPER_ID VARCHAR(50) DEFAULT NULL,
|
||||
MATERIAL_INVENTORY_ID BIGINT DEFAULT NULL,
|
||||
IN_ORDER_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
MATERIAL_BASE_INFO_ID BIGINT DEFAULT NULL,
|
||||
LOT_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
WAREHOUSE_CODE VARCHAR(50) DEFAULT NULL,
|
||||
LOG_TYPE VARCHAR(20) DEFAULT NULL,
|
||||
LOG_MESSAGE VARCHAR(2000) DEFAULT NULL,
|
||||
EXECUTION_TIME DATETIME DEFAULT NULL,
|
||||
DEL_FLAG INT DEFAULT 1,
|
||||
CONSTRAINT PK_WMS_PUSH_BILLING_RECORD_LOG PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE WMS_PUSH_BILLING_RECORD_LOG IS '入库业务单推送bms计费流水任务执行日志表';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.ID IS '主键ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.JOB_NAME IS '任务名称(XXL-Job任务标识,如pushBillingRecord)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.SHIPPER_ID IS '货主ID(任务参数)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_INVENTORY_ID IS '物料库存ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.IN_ORDER_NUMBER IS '入库单号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_BASE_INFO_ID IS '物料基础信息ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOT_NUMBER IS 'LOT编号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.WAREHOUSE_CODE IS '仓库编码';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_TYPE IS '日志类型:SUCCESS-全部执行成功 SKIP-业务跳过(continue) ERROR-执行异常';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_MESSAGE IS '日志信息(成功说明/跳过原因/异常信息)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.EXECUTION_TIME IS '执行时间';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.DEL_FLAG IS '删除标记:0-无状态,1-正常,2-已删除';
|
||||
|
||||
CREATE INDEX IDX_WPBR_JOB_NAME ON WMS_PUSH_BILLING_RECORD_LOG (JOB_NAME);
|
||||
CREATE INDEX IDX_WPBR_SHIPPER_ID ON WMS_PUSH_BILLING_RECORD_LOG (SHIPPER_ID);
|
||||
CREATE INDEX IDX_WPBR_EXECUTION_TIME ON WMS_PUSH_BILLING_RECORD_LOG (EXECUTION_TIME);
|
||||
|
||||
-- ----------------------------
|
||||
-- 回滚脚本
|
||||
-- DROP TABLE WMS_PUSH_BILLING_RECORD_LOG;
|
||||
-- ----------------------------
|
||||
@@ -0,0 +1,46 @@
|
||||
-- ----------------------------
|
||||
-- 入库业务单推送bms计费流水定时任务(XXL-Job: pushBillingRecord)执行日志表 -- 达梦(DM)数据库版
|
||||
-- 适用:mhd-wms-service 连接的达梦库(生产/测试按环境选择,在WMS服务连接的用户/模式下执行)
|
||||
-- 用途:记录任务执行过程中的例外情况(执行异常报错、业务continue跳过、生成业务单据失败),
|
||||
-- 本次执行全程无任何例外时保留一条成功记录(LOG_TYPE=SUCCESS)
|
||||
-- @date 2026-09-15
|
||||
-- ----------------------------
|
||||
|
||||
CREATE TABLE WMS_PUSH_BILLING_RECORD_LOG (
|
||||
ID BIGINT IDENTITY(1,1) NOT NULL,
|
||||
JOB_NAME VARCHAR(100) DEFAULT NULL,
|
||||
SHIPPER_ID VARCHAR(50) DEFAULT NULL,
|
||||
MATERIAL_INVENTORY_ID BIGINT DEFAULT NULL,
|
||||
IN_ORDER_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
MATERIAL_BASE_INFO_ID BIGINT DEFAULT NULL,
|
||||
LOT_NUMBER VARCHAR(100) DEFAULT NULL,
|
||||
WAREHOUSE_CODE VARCHAR(50) DEFAULT NULL,
|
||||
LOG_TYPE VARCHAR(20) DEFAULT NULL,
|
||||
LOG_MESSAGE VARCHAR(2000) DEFAULT NULL,
|
||||
EXECUTION_TIME DATETIME DEFAULT NULL,
|
||||
DEL_FLAG INT DEFAULT 1,
|
||||
CONSTRAINT PK_WMS_PUSH_BILLING_RECORD_LOG PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE WMS_PUSH_BILLING_RECORD_LOG IS '入库业务单推送bms计费流水任务执行日志表';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.ID IS '主键ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.JOB_NAME IS '任务名称(XXL-Job任务标识,如pushBillingRecord)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.SHIPPER_ID IS '货主ID(任务参数)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_INVENTORY_ID IS '物料库存ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.IN_ORDER_NUMBER IS '入库单号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.MATERIAL_BASE_INFO_ID IS '物料基础信息ID';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOT_NUMBER IS 'LOT编号';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.WAREHOUSE_CODE IS '仓库编码';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_TYPE IS '日志类型:SUCCESS-全部执行成功 SKIP-业务跳过(continue) ERROR-执行异常';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.LOG_MESSAGE IS '日志信息(成功说明/跳过原因/异常信息)';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.EXECUTION_TIME IS '执行时间';
|
||||
COMMENT ON COLUMN WMS_PUSH_BILLING_RECORD_LOG.DEL_FLAG IS '删除标记:0-无状态,1-正常,2-已删除';
|
||||
|
||||
CREATE INDEX IDX_WPBR_JOB_NAME ON WMS_PUSH_BILLING_RECORD_LOG (JOB_NAME);
|
||||
CREATE INDEX IDX_WPBR_SHIPPER_ID ON WMS_PUSH_BILLING_RECORD_LOG (SHIPPER_ID);
|
||||
CREATE INDEX IDX_WPBR_EXECUTION_TIME ON WMS_PUSH_BILLING_RECORD_LOG (EXECUTION_TIME);
|
||||
|
||||
-- ----------------------------
|
||||
-- 回滚脚本
|
||||
-- DROP TABLE WMS_PUSH_BILLING_RECORD_LOG;
|
||||
-- ----------------------------
|
||||
Reference in New Issue
Block a user