Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
赵辉
2026-02-25 16:15:09 +08:00
71 changed files with 2081 additions and 243 deletions
@@ -43,7 +43,7 @@ import java.util.stream.Collectors;
/**
* 租赁管理ApplicationService
*
*
* @author gen
* @date 2024-05-07
*/
@@ -67,8 +67,9 @@ public class LeaseApplicationService {
private StorageSectionApplicationService storageSectionApplicationService;
@Autowired
private IShipperLeaseDetailsService shipperLeaseDetailsService;
private IShipperLeaseDetailsService shipperLeaseDetailsService;
@Autowired
private SystemServiceFeign systemServiceFeign;
/**
* 分页查询租赁管理列表
@@ -76,36 +77,57 @@ public class LeaseApplicationService {
public List<LeasePO> queryList(LeaseDO leaseDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null){
Long loginUserOrganizationId = loginUser.getUserPo().getOrganizationId();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = leaseDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据organizationId来设置查询权限
// organizationId等于2827时查询全部,其他仅查询各自组织的信息
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId,使用前端传递的值进行过滤
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (leaseDO.getOrganizationId() == null) {
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
leaseDO.setOrganizationId(frontendOrganizationId);
leaseDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
leaseDO.setOrganizationId(null);
leaseDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
if (topOrganizationId != null && topOrganizationId != 1){
leaseDO.setTopOrganizationId(topOrganizationId);
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
leaseDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
leaseDO.setOrganizationId(userOrganizationId);
}
}
// 如果前端传递了organizationId,验证是否与当前登录用户的组织ID一致
if (leaseDO.getOrganizationId() != null && !leaseDO.getOrganizationId().equals(loginUserOrganizationId)) {
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
leaseDO.setOrganizationId(loginUserOrganizationId);
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (leaseDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
leaseDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
leaseDO.setTopOrganizationId(2827L);
}
}
}
return leaseDomainService.queryList(leaseDO);
}
/**
* 新增租赁管理
*/
@@ -125,12 +147,9 @@ public class LeaseApplicationService {
return leaseDomainService.insert(leaseDO);
}
@Autowired
private SystemServiceFeign systemServiceFeign;
private void setWarehouseInfo(LeaseDO leaseDO) {
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(leaseDO.getWarehouseId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))){
if (!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("获取仓库信息失败");
}
WarehouseFeignPO warehouseFeignPO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), WarehouseFeignPO.class);
@@ -170,19 +189,18 @@ public class LeaseApplicationService {
/**
* 获取租赁管理详细信息
*/
public LeasePO getInfo(Long leaseId)
{
public LeasePO getInfo(Long leaseId) {
return leaseDomainService.getInfo(leaseId);
}
/**
* @param leaseIds
* @return Boolean
* @description 批量作废租赁
* @author ZhouGY
* @date 2024/5/13 9:46
* @param leaseIds
* @return Boolean
*/
public Boolean nullifyByIds(List<Long> leaseIds){
public Boolean nullifyByIds(List<Long> leaseIds) {
return leaseDomainService.nullifyByIds(leaseIds);
}
@@ -196,8 +214,8 @@ public class LeaseApplicationService {
log.info("开始执行货主租赁明细定时任务");
// 计算前一天的日期,将时间设置为当天的0点0分0秒,只保留日期部分
final Date yesterday = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1));
LeaseDO leaseDO = new LeaseDO();
LeaseDO leaseDO = new LeaseDO();
leaseDO.setTime(yesterday);
//查询有效期内的租赁
List<LeasePO> leasePOS = queryList(leaseDO);
@@ -207,10 +225,10 @@ public class LeaseApplicationService {
List<LeasePO> casualRental = leasePOS.stream()
.filter(lease -> lease.getLeaseType().equals("散租"))
.collect(Collectors.toList());
List<ShipperLeaseDetails> shipperLeaseDetailsList = new ArrayList<>(); //需要保存或更新的数据
List<ShipperLeaseDetails> shipperLeaseDetailsToUpdate = new ArrayList<>(); //需要更新的数据
// 查询已存在的货主租赁明细数据(用于判断是新增还是更新)
ShipperLeaseDetailsDO queryDO = new ShipperLeaseDetailsDO();
queryDO.setBusinessDate(yesterday);
@@ -218,18 +236,18 @@ public class LeaseApplicationService {
// 构建已存在数据的Map,key为:业务日期+货主ID+仓库ID+租赁类型
Map<String, ShipperLeaseDetailsPO> existingMap = existingList.stream()
.collect(Collectors.toMap(
item -> buildKey(yesterday, item.getShipperId(), item.getWarehouseId(), item.getLeaseType()),
item -> item,
(existing, replacement) -> existing // 如果有重复key,保留第一个
item -> buildKey(yesterday, item.getShipperId(), item.getWarehouseId(), item.getLeaseType()),
item -> item,
(existing, replacement) -> existing // 如果有重复key,保留第一个
));
// 处理整租
for (LeasePO en : entireUnit) {
String key = buildKey(yesterday, en.getShipperId(), en.getWarehouseId(), en.getLeaseType());
ShipperLeaseDetails shipperLeaseDetails = new ShipperLeaseDetails();
BeanUtils.copyProperties(en, shipperLeaseDetails);
shipperLeaseDetails.setBusinessDate(yesterday);
// 如果已存在,则更新;否则新增
if (existingMap.containsKey(key)) {
ShipperLeaseDetailsPO existing = existingMap.get(key);
@@ -239,7 +257,7 @@ public class LeaseApplicationService {
shipperLeaseDetailsList.add(shipperLeaseDetails);
}
}
// 处理散租:从租赁管理页面维护的面积,效期内的散租客户面积之和
for (LeasePO ca : casualRental) {
String key = buildKey(yesterday, ca.getShipperId(), ca.getWarehouseId(), ca.getLeaseType());
@@ -249,7 +267,7 @@ public class LeaseApplicationService {
// 散租面积直接使用租赁管理页面维护的面积
shipperLeaseDetails.setLeaseArea(ca.getLeaseArea());
log.info("货主:{},仓库:{},散租面积:{}(来自租赁管理)", ca.getCargoOwnerName(), ca.getWarehouseName(), ca.getLeaseArea());
// 如果已存在,则更新;否则新增
if (existingMap.containsKey(key)) {
ShipperLeaseDetailsPO existing = existingMap.get(key);
@@ -259,22 +277,22 @@ public class LeaseApplicationService {
shipperLeaseDetailsList.add(shipperLeaseDetails);
}
}
// 批量新增货主租赁明细
if (shipperLeaseDetailsList.size() > 0) {
shipperLeaseDetailsService.saveBatch(shipperLeaseDetailsList);
log.info("新增货主租赁明细{}条", shipperLeaseDetailsList.size());
}
// 批量更新货主租赁明细
if (shipperLeaseDetailsToUpdate.size() > 0) {
shipperLeaseDetailsService.updateBatchById(shipperLeaseDetailsToUpdate);
log.info("更新货主租赁明细{}条", shipperLeaseDetailsToUpdate.size());
}
log.info("货主租赁明细定时任务执行完成,业务日期:{}", DateUtil.formatDate(yesterday));
}
/**
* 构建唯一key:业务日期+货主ID+仓库ID+租赁类型
*/
@@ -290,6 +308,55 @@ public class LeaseApplicationService {
* businessDateEnd 业务结束时间
*/
public List<WarehouseOccupancyRate> warehouseOccupancyRate(ShipperLeaseDetailsDO shipperLeaseDetailsDO) {
// 数据权限:根据 organizationId 来设置查询权限
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = shipperLeaseDetailsDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
shipperLeaseDetailsDO.setOrganizationId(frontendOrganizationId);
shipperLeaseDetailsDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
shipperLeaseDetailsDO.setOrganizationId(null);
shipperLeaseDetailsDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
shipperLeaseDetailsDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
shipperLeaseDetailsDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (shipperLeaseDetailsDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
shipperLeaseDetailsDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
shipperLeaseDetailsDO.setTopOrganizationId(2827L);
}
}
}
//仓库id 和 开始结束时间作为查询条件 查数据库 查出来当前仓库所有的
List<ShipperLeaseDetailsPO> shipperLeaseDetailsList = shipperLeaseDetailsService.queryList(shipperLeaseDetailsDO);
if (shipperLeaseDetailsList == null || shipperLeaseDetailsList.isEmpty()) {
@@ -305,7 +372,7 @@ public class LeaseApplicationService {
);
//获取总面积
BigDecimal totalArea = BigDecimal.ZERO;
StorageSectionDO storageSectionDO = new StorageSectionDO();
StorageSectionDO storageSectionDO = new StorageSectionDO();
storageSectionDO.setWarehouseId(shipperLeaseDetailsDO.getWarehouseId());
storageSectionDO.setOpeningUp(1);
List<StorageSectionPO> storageSectionPOS = storageSectionApplicationService.queryList(storageSectionDO);
@@ -323,14 +390,24 @@ public class LeaseApplicationService {
BigDecimal fractionalLeaseArea = BigDecimal.ZERO;
//计算整租和散租
for (ShipperLeaseDetailsPO shipperLeaseDetail : shipperLeaseDetails) {
if (shipperLeaseDetail.getLeaseType().equals("整租")){
if (shipperLeaseDetail.getLeaseType().equals("整租")) {
entireLeaseArea = entireLeaseArea.add(shipperLeaseDetail.getLeaseArea());
}else {
} else {
fractionalLeaseArea = fractionalLeaseArea.add(shipperLeaseDetail.getLeaseArea());
}
warehouseOccupancyRate.setWarehouseName(shipperLeaseDetail.getWarehouseName());
warehouseOccupancyRate.setBusinessDate(date);
warehouseOccupancyRate.setWarehouseId(shipperLeaseDetail.getWarehouseId());
// 设置组织相关字段(从第一个非空记录中获取)
if (warehouseOccupancyRate.getOrganizationId() == null && shipperLeaseDetail.getOrganizationId() != null) {
warehouseOccupancyRate.setOrganizationId(shipperLeaseDetail.getOrganizationId());
}
if (warehouseOccupancyRate.getOrganizationName() == null && shipperLeaseDetail.getOrganizationName() != null) {
warehouseOccupancyRate.setOrganizationName(shipperLeaseDetail.getOrganizationName());
}
if (warehouseOccupancyRate.getTopOrganizationId() == null && shipperLeaseDetail.getTopOrganizationId() != null) {
warehouseOccupancyRate.setTopOrganizationId(shipperLeaseDetail.getTopOrganizationId());
}
}
warehouseOccupancyRate.setEntireLeaseArea(entireLeaseArea);
warehouseOccupancyRate.setFractionalLeaseArea(fractionalLeaseArea);
@@ -39,10 +39,52 @@ public class BatchApplicationService {
public List<BatchPO> queryList(BatchDO batchDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
batchDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = batchDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
batchDO.setOrganizationId(frontendOrganizationId);
batchDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
batchDO.setOrganizationId(null);
batchDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
batchDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
batchDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (batchDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
batchDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
batchDO.setTopOrganizationId(2827L);
}
}
}
List<BatchPO> batchPOS = batchDomainService.queryList(batchDO);
@@ -37,10 +37,52 @@ public class BrandApplicationService {
public List<BrandPO> queryList(BrandDO brandDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
brandDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = brandDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
brandDO.setOrganizationId(frontendOrganizationId);
brandDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
brandDO.setOrganizationId(null);
brandDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
brandDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
brandDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (brandDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
brandDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
brandDO.setTopOrganizationId(2827L);
}
}
}
return brandDomainService.queryList(brandDO);
@@ -18,6 +18,7 @@ import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO
import com.mhd.common.core.domain.po.BillingRulesPO;
import com.mhd.common.core.domain.po.DocumentTypePO;
import com.mhd.common.core.domain.po.SettlementCustomersPO;
import com.mhd.common.core.domain.po.SysDictDataVo;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
@@ -27,6 +28,7 @@ import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.model.LoginUser;
import com.mhd.system.service.ISysDictTypeService;
@@ -60,6 +62,9 @@ public class ContractManageApplicationService {
@Autowired
private BmsServiceFeign bmsServiceFeign;
@Autowired
private SystemServiceFeign systemServiceFeign;
/**
* 分页查询合同管理列表
@@ -67,10 +72,40 @@ public class ContractManageApplicationService {
public List<ContractManagePO> queryList(ContractManageDO contractManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
contractManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = contractManageDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己且 topOrganizationId=2827
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
contractManageDO.setOrganizationId(frontendOrganizationId);
contractManageDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
contractManageDO.setOrganizationId(null);
contractManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId为当前组织ID,并且设置topOrganizationId=2827
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
contractManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
contractManageDO.setOrganizationId(userOrganizationId);
}
}
// 对于非2827组织,必须设置 topOrganizationId=2827
contractManageDO.setTopOrganizationId(2827L);
}
}
return contractManageDomainService.queryList(contractManageDO);
@@ -93,6 +128,7 @@ public class ContractManageApplicationService {
*/
checkContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
contractManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
@@ -102,6 +138,27 @@ public class ContractManageApplicationService {
return flag;
}
/**
* 处理数据字典
*/
private void handleDict(ContractManageDO ContractManageDO) {
if(StringUtils.isNotEmpty(ContractManageDO.getCustomerTypeCode())){
//查询数据字典
List<SysDictDataVo> sysDictDataVoList = new ArrayList<>();
AjaxResult ajaxResult = systemServiceFeign.selectListByDictType(DictCode.CUSTOMER_TYPE.getCode());
if("200".equals(String.valueOf(ajaxResult.get("code")))){
sysDictDataVoList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), SysDictDataVo.class);
}
if(sysDictDataVoList.size()>0){
SysDictDataVo sysDictDataVo = sysDictDataVoList.stream().filter(info-> ObjectUtil.equal(info.getDictValue(),ContractManageDO.getCustomerTypeCode())).findAny().orElse(null);
if(null != sysDictDataVo){
ContractManageDO.setCustomerType(sysDictDataVo.getDictLabel());
}
}
}
}
/**
* 处理数据
*/
@@ -260,6 +317,7 @@ public class ContractManageApplicationService {
checkContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO);
handleDict(contractManageDO);
return contractManageDomainService.update(contractManageDO);
}
@@ -43,10 +43,52 @@ public class MaterialBaseInfoApplicationService {
public List<MaterialBaseInfoPO> queryList(MaterialBaseInfoDO materialBaseInfoDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
materialBaseInfoDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = materialBaseInfoDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
materialBaseInfoDO.setOrganizationId(frontendOrganizationId);
materialBaseInfoDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
materialBaseInfoDO.setOrganizationId(null);
materialBaseInfoDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
materialBaseInfoDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
materialBaseInfoDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (materialBaseInfoDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
materialBaseInfoDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
materialBaseInfoDO.setTopOrganizationId(2827L);
}
}
}
return materialBaseInfoDomainService.queryList(materialBaseInfoDO);
@@ -29,10 +29,52 @@ public class MaterialClassifyApplicationService {
public List<MaterialClassifyPO> queryList(MaterialClassifyDO materialClassifyDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
materialClassifyDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = materialClassifyDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
materialClassifyDO.setOrganizationId(frontendOrganizationId);
materialClassifyDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
materialClassifyDO.setOrganizationId(null);
materialClassifyDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
materialClassifyDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
materialClassifyDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (materialClassifyDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
materialClassifyDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 如果 organizationId 不为 null,清空 topOrganizationId,确保查询使用 organizationId
materialClassifyDO.setTopOrganizationId(null);
}
}
}
return materialClassifyDomainService.queryList(materialClassifyDO);
@@ -38,10 +38,52 @@ public class PackApplicationService {
public List<PackPO> queryList(PackDO packDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
packDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = packDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
packDO.setOrganizationId(frontendOrganizationId);
packDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
packDO.setOrganizationId(null);
packDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
packDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
packDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (packDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
packDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
packDO.setTopOrganizationId(2827L);
}
}
}
return packDomainService.queryList(packDO);
@@ -76,15 +76,22 @@ public class ShipperLeaseDetailsApplicationService {
shipperLeaseDetailsDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
if (topOrganizationId != null && topOrganizationId != 1){
shipperLeaseDetailsDO.setTopOrganizationId(topOrganizationId);
}
// 其他组织:设置organizationId为当前组织ID,并且设置topOrganizationId=2827
// 如果前端传递了organizationId,验证是否与当前登录用户的组织ID一致
if (shipperLeaseDetailsDO.getOrganizationId() != null && !shipperLeaseDetailsDO.getOrganizationId().equals(loginUserOrganizationId)) {
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
shipperLeaseDetailsDO.setOrganizationId(loginUserOrganizationId);
Long frontendOrganizationId = shipperLeaseDetailsDO.getOrganizationId();
if (frontendOrganizationId != null && loginUserOrganizationId != null) {
if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
shipperLeaseDetailsDO.setOrganizationId(loginUserOrganizationId);
}
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (loginUserOrganizationId != null) {
shipperLeaseDetailsDO.setOrganizationId(loginUserOrganizationId);
}
}
// 对于非2827组织,必须设置 topOrganizationId=2827
shipperLeaseDetailsDO.setTopOrganizationId(2827L);
}
}
return shipperLeaseDetailsDomainService.queryList(shipperLeaseDetailsDO);
@@ -44,13 +44,56 @@ public class StorageLocationApplicationService {
public List<StorageLocationPO> queryList(StorageLocationDO storageLocationDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
storageLocationDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = storageLocationDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限:根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
storageLocationDO.setOrganizationId(frontendOrganizationId);
storageLocationDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
storageLocationDO.setOrganizationId(null);
storageLocationDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
storageLocationDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
if (userOrganizationId != null) {
storageLocationDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId 为 null 时,才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null,则优先使用 organizationId,不使用 topOrganizationId
if (storageLocationDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
storageLocationDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织,必须设置 topOrganizationId=2827
storageLocationDO.setTopOrganizationId(2827L);
}
}
// 只有当前端没有明确传仓库条件时,才使用用户关联仓库缓存进行过滤;
// 避免出现单据仓库=常温仓,但库位列表仍显示保税仓的错配问题。
// 避免出现"单据仓库=常温仓,但库位列表仍显示保税仓"的错配问题。
boolean hasWarehouseFilter = storageLocationDO.getWarehouseId() != null
|| (storageLocationDO.getWarehouseCode() != null && !storageLocationDO.getWarehouseCode().trim().isEmpty())
|| (storageLocationDO.getWarehouseName() != null && !storageLocationDO.getWarehouseName().trim().isEmpty());
@@ -28,14 +28,52 @@ public class StorageLocationGroupApplicationService {
public List<StorageLocationGroupPO> queryList(StorageLocationGroupDO storageLocationGroupDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
storageLocationGroupDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
Long organizationId = loginUser.getUserPo().getOrganizationId();
if (organizationId != null && organizationId != 1){
storageLocationGroupDO.setOrganizationId(organizationId);
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = storageLocationGroupDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
storageLocationGroupDO.setOrganizationId(frontendOrganizationId);
storageLocationGroupDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
storageLocationGroupDO.setOrganizationId(null);
storageLocationGroupDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
storageLocationGroupDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
storageLocationGroupDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (storageLocationGroupDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
storageLocationGroupDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
storageLocationGroupDO.setTopOrganizationId(2827L);
}
}
}
return storageLocationGroupDomainService.queryList(storageLocationGroupDO);
@@ -43,10 +43,52 @@ public class StorageSectionApplicationService {
public List<StorageSectionPO> queryList(StorageSectionDO storageSectionDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
storageSectionDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = storageSectionDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
storageSectionDO.setOrganizationId(frontendOrganizationId);
storageSectionDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
storageSectionDO.setOrganizationId(null);
storageSectionDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
storageSectionDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
storageSectionDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (storageSectionDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
storageSectionDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
storageSectionDO.setTopOrganizationId(2827L);
}
}
}
return storageSectionDomainService.queryList(storageSectionDO);
@@ -42,10 +42,52 @@ public class WarehouseApplicationService {
public List<WarehousePO> queryList(WarehouseDO warehouseDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long organizationId = loginUser.getUserPo().getOrganizationId();
if (organizationId != null && organizationId != 1){
warehouseDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = warehouseDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
warehouseDO.setOrganizationId(frontendOrganizationId);
warehouseDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
warehouseDO.setOrganizationId(null);
warehouseDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
warehouseDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
warehouseDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (warehouseDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
warehouseDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
warehouseDO.setTopOrganizationId(2827L);
}
}
}
return warehouseDomainService.queryList(warehouseDO);
@@ -163,6 +163,12 @@ public class ContractManage extends BaseVOEntity{
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType;
@ApiModelProperty("客户类型")
private String customerType;
@ApiModelProperty("客户类型编码")
private String customerTypeCode;
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@@ -172,6 +172,12 @@ public class ContractManagePO extends BaseVOEntity{
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType;
@ApiModelProperty("客户类型")
private String customerType;
@ApiModelProperty("客户类型编码")
private String customerTypeCode;
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@@ -202,6 +202,12 @@ public class ContractManageDO extends BaseVOEntity{
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType;
@ApiModelProperty("客户类型")
private String customerType;
@ApiModelProperty("客户类型编码")
private String customerTypeCode;
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@@ -193,6 +193,12 @@ public class ContractManageDTO extends BaseVOEntity{
@ApiModelProperty(name = "主体类型(1-货主,2-客户,3-承运商)")
private Integer principalType;
@ApiModelProperty("客户类型")
private String customerType;
@ApiModelProperty("客户类型编码")
private String customerTypeCode;
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
}
@@ -187,6 +187,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(effective_date,'%Y-%m-%d') <![CDATA[<=]]> #{contractManageDO.nowDateString}
)
</if>
<if test="contractManageDO.organizationId != null">
and organization_id = #{contractManageDO.organizationId}
</if>
<if test="contractManageDO.topOrganizationId != null">
and top_organization_id = #{contractManageDO.topOrganizationId}
</if>
</sql>
</mapper>
@@ -9,14 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectServiceItemsManagePo1">
<where>
<!-- &lt;!&ndash; 删除标记:0-无状态,1-正常,2-已删除,查询时只查询正常的数据 &ndash;&gt;-->
<!-- <choose>-->
<!-- <when test="delFlag != null">-->
<!-- and del_flag = #{delFlag}-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- and del_flag = 1-->
<!-- </otherwise>-->
<!-- </choose>-->
<choose>
<when test="delFlag != null">
and del_flag = #{delFlag}
</when>
<otherwise>
and del_flag = 1
</otherwise>
</choose>
<!-- <if test="createByName != null and createByName != ''">-->
<!-- and create_by_name like concat('%', #{createByName}, '%')-->
<!-- </if>-->
@@ -77,10 +77,48 @@ public class BillManageApplicationService {
public List<BillManagePO> queryList(BillManageDO billManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
billManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = billManageDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
billManageDO.setOrganizationId(frontendOrganizationId);
billManageDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
billManageDO.setOrganizationId(null);
billManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
billManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
billManageDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (billManageDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
billManageDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
billManageDO.setTopOrganizationId(2827L);
}
}
}
return billManageDomainService.queryList(billManageDO);
@@ -45,10 +45,40 @@ public class BillingRulesApplicationService {
public List<BillingRulesPO> queryList(BillingRulesDO billingRulesDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
billingRulesDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = billingRulesDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己且 topOrganizationId=2827
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
billingRulesDO.setOrganizationId(frontendOrganizationId);
billingRulesDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
billingRulesDO.setOrganizationId(null);
billingRulesDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId为当前组织ID并且设置topOrganizationId=2827
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
billingRulesDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
billingRulesDO.setOrganizationId(userOrganizationId);
}
}
// 对于非2827组织必须设置 topOrganizationId=2827
billingRulesDO.setTopOrganizationId(2827L);
}
}
return billingRulesDomainService.queryList(billingRulesDO);
@@ -72,10 +72,47 @@ public class BillingStatementApplicationService {
public List<BillingStatementPO> queryList(BillingStatementDO billingStatementDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
billingStatementDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = billingStatementDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
billingStatementDO.setOrganizationId(frontendOrganizationId);
billingStatementDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
billingStatementDO.setOrganizationId(null);
billingStatementDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
billingStatementDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
billingStatementDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (billingStatementDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
billingStatementDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
billingStatementDO.setTopOrganizationId(2827L);
}
}
}
return billingStatementDomainService.queryList(billingStatementDO);
@@ -86,10 +123,48 @@ public class BillingStatementApplicationService {
*/
public List<BillingStatementCollectPO> queryCollectList(BillingStatementCollectDO billingStatementCollectDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
billingStatementCollectDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = billingStatementCollectDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
billingStatementCollectDO.setOrganizationId(frontendOrganizationId);
billingStatementCollectDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
billingStatementCollectDO.setOrganizationId(null);
billingStatementCollectDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
billingStatementCollectDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
billingStatementCollectDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (billingStatementCollectDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
billingStatementCollectDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
billingStatementCollectDO.setTopOrganizationId(2827L);
}
}
}
return billingStatementDomainService.queryCollectList(billingStatementCollectDO);
@@ -84,10 +84,48 @@ public class BusinessDocumentApplicationService {
public List<BusinessDocumentPO> queryList(BusinessDocumentDO businessDocumentDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
businessDocumentDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = businessDocumentDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
businessDocumentDO.setOrganizationId(frontendOrganizationId);
businessDocumentDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
businessDocumentDO.setOrganizationId(null);
businessDocumentDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
businessDocumentDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
businessDocumentDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (businessDocumentDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
businessDocumentDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
businessDocumentDO.setTopOrganizationId(2827L);
}
}
}
return businessDocumentDomainService.queryList(businessDocumentDO);
@@ -48,10 +48,40 @@ public class DocumentTypeApplicationService {
public List<DocumentTypePO> queryList(DocumentTypeDO documentTypeDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
documentTypeDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = documentTypeDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己且 topOrganizationId=2827
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
documentTypeDO.setOrganizationId(frontendOrganizationId);
documentTypeDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
documentTypeDO.setOrganizationId(null);
documentTypeDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId为当前组织ID并且设置topOrganizationId=2827
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
documentTypeDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
documentTypeDO.setOrganizationId(userOrganizationId);
}
}
// 对于非2827组织必须设置 topOrganizationId=2827
documentTypeDO.setTopOrganizationId(2827L);
}
}
return documentTypeDomainService.queryList(documentTypeDO);
@@ -40,10 +40,48 @@ public class PaymentOrderApplicationService {
public List<PaymentOrderPO> queryList(PaymentOrderDO paymentOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
paymentOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = paymentOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
paymentOrderDO.setOrganizationId(frontendOrganizationId);
paymentOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
paymentOrderDO.setOrganizationId(null);
paymentOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
paymentOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
paymentOrderDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (paymentOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
paymentOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
paymentOrderDO.setTopOrganizationId(2827L);
}
}
}
return paymentOrderDomainService.queryList(paymentOrderDO);
@@ -47,10 +47,48 @@ public class ReceiptManageApplicationService {
public List<ReceiptManagePO> queryList(ReceiptManageDO receiptManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
receiptManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = receiptManageDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
receiptManageDO.setOrganizationId(frontendOrganizationId);
receiptManageDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
receiptManageDO.setOrganizationId(null);
receiptManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
receiptManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
receiptManageDO.setOrganizationId(userOrganizationId);
}
}
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (receiptManageDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
receiptManageDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
receiptManageDO.setTopOrganizationId(2827L);
}
}
}
return receiptManageDomainService.queryList(receiptManageDO);
@@ -72,10 +72,40 @@ public class SettlementCustomersApplicationService {
private void setTopOrganizationIdLogin(SettlementCustomersDO settlementCustomersDO){
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
settlementCustomersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = settlementCustomersDO.getOrganizationId(); // 前端传递的 organizationId
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己且 topOrganizationId=2827
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
settlementCustomersDO.setOrganizationId(frontendOrganizationId);
settlementCustomersDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
settlementCustomersDO.setOrganizationId(null);
settlementCustomersDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId为当前组织ID并且设置topOrganizationId=2827
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
settlementCustomersDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
settlementCustomersDO.setOrganizationId(userOrganizationId);
}
}
// 对于非2827组织必须设置 topOrganizationId=2827
settlementCustomersDO.setTopOrganizationId(2827L);
}
}
}
@@ -251,6 +281,7 @@ public class SettlementCustomersApplicationService {
saveEntity.setSettlementEntityId(userShipperPo.getUserId());
saveEntity.setSettlementEntity(userShipperPo.getUserName());
saveEntity.setSettlementMethodCode("monthly_settle");
saveEntity.setMainRole(2);
saveEntity(saveEntity);
});
}
@@ -275,6 +306,7 @@ public class SettlementCustomersApplicationService {
saveEntity.setSettlementEntityId(userDriverPo.getUserId());
saveEntity.setSettlementEntity(userDriverPo.getUserName());
saveEntity.setSettlementMethodCode("monthly_settle");
saveEntity.setMainRole(1);
saveEntity(saveEntity);
});
}
@@ -51,6 +51,9 @@ public class BillingStatementCollectPO extends BaseVOEntity {
@ApiModelProperty("所属组织")
private String organizationName;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@@ -45,6 +45,9 @@ public class BillingStatementCollectDO extends BaseVOEntity {
@ApiModelProperty("所属组织")
private String organizationName;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@@ -44,6 +44,9 @@ public class BillingStatementCollectDTO extends BaseVOEntity {
@ApiModelProperty("所属组织")
private String organizationName;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@@ -25,6 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="billManageDO.createByName != null and billManageDO.createByName != ''">
AND create_by_name like concat('%', #{billManageDO.createByName}, '%')
</if>
<if test="billManageDO.organizationId != null">
AND organization_id = #{billManageDO.organizationId}
</if>
<if test="billManageDO.topOrganizationId != null and billManageDO.topOrganizationId != ''">
AND top_organization_id = #{billManageDO.topOrganizationId}
</if>
@@ -100,6 +100,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="billingRulesDO.createByName != null and billingRulesDO.createByName != ''">
AND create_by_name like concat('%', #{billingRulesDO.createByName}, '%')
</if>
<if test="billingRulesDO.organizationId != null">
and organization_id = #{billingRulesDO.organizationId}
</if>
</sql>
</mapper>
@@ -41,8 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
SUM( IF(account_expense_type=1,billing_amount,0)) receivable,
SUM( IF(account_expense_type=2,billing_amount,0)) feesPayable,
GROUP_CONCAT(billing_state) AS billingStateCount,
settlement_entity,settlement_customers_code,SUM(billing_amount) bill_amount_sum,account_expense_type,COUNT(settlement_customers_code) count_fee,MIN(business_date) business_start_date ,MAX(business_date) business_end_date,organization_name,top_organization_id,billing_state,update_by_name,update_by,update_time,create_by_name,create_by,create_time
WM_CONCAT(billing_state) AS billingStateCount,
settlement_entity,settlement_customers_code,SUM(billing_amount) bill_amount_sum,account_expense_type,COUNT(settlement_customers_code) count_fee,MIN(business_date) business_start_date ,MAX(business_date) business_end_date,MAX(organization_id) organization_id,organization_name,top_organization_id,billing_state,update_by_name,update_by,update_time,create_by_name,create_by,create_time
from billing_statement
where del_flag = 1
<include refid="collect_where"/>
@@ -102,6 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="billingStatementDO.createByName != null and billingStatementDO.createByName != ''">
AND create_by_name like concat('%', #{billingStatementDO.createByName}, '%')
</if>
<if test="billingStatementDO.organizationId != null">
AND organization_id = #{billingStatementDO.organizationId}
</if>
<if test="billingStatementDO.topOrganizationId != null and billingStatementDO.topOrganizationId != ''">
AND top_organization_id = #{billingStatementDO.topOrganizationId}
</if>
@@ -234,6 +237,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="billingStatementCollectDO.billingState == null or billingStatementCollectDO.billingState == ''">
and billing_state <![CDATA[<]]> 4
</if>
<if test="billingStatementCollectDO.organizationId != null">
and organization_id = #{billingStatementCollectDO.organizationId}
</if>
<if test="billingStatementCollectDO.topOrganizationId != null and billingStatementCollectDO.topOrganizationId != ''">
and top_organization_id = #{billingStatementCollectDO.topOrganizationId}
</if>
<if test="billingStatementCollectDO.organizationName != null and billingStatementCollectDO.organizationName != ''">
and organization_name = #{billingStatementCollectDO.organizationName}
</if>
@@ -121,6 +121,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessDocumentDO.createByName != null and businessDocumentDO.createByName != ''">
AND create_by_name like concat('%', #{businessDocumentDO.createByName}, '%')
</if>
<if test="businessDocumentDO.organizationId != null">
AND organization_id = #{businessDocumentDO.organizationId}
</if>
<if test="businessDocumentDO.topOrganizationId != null and businessDocumentDO.topOrganizationId != ''">
AND top_organization_id = #{businessDocumentDO.topOrganizationId}
</if>
@@ -89,6 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{code}
</foreach>
</if>
<if test="documentTypeDO.organizationId != null">
and organization_id = #{documentTypeDO.organizationId}
</if>
</sql>
</mapper>
@@ -34,6 +34,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<sql id="common_where">
<if test="paymentOrderDO.organizationId != null">
AND a.organization_id = #{paymentOrderDO.organizationId}
</if>
<if test="paymentOrderDO.topOrganizationId != null and paymentOrderDO.topOrganizationId != ''">
AND a.top_organization_id = #{paymentOrderDO.topOrganizationId}
</if>
@@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
resultType="com.mhd.bms.domain.receiptManage.repository.po.ReceiptManagePO">
SELECT
a.* ,
CONCAT(b.bill_number) AS billNumbers
WM_CONCAT(b.bill_number) AS billNumbers
FROM
receipt_manage a
LEFT JOIN receipt_detail b ON a.receipt_manage_id = b.receipt_manage_id
@@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="receiptManageDO.createByName != null and receiptManageDO.createByName != ''">
AND a.create_by_name like concat('%', #{receiptManageDO.createByName}, '%')
</if>
<if test="receiptManageDO.organizationId != null">
AND a.organization_id = #{receiptManageDO.organizationId}
</if>
<if test="receiptManageDO.topOrganizationId != null and receiptManageDO.topOrganizationId != ''">
AND a.top_organization_id = #{receiptManageDO.topOrganizationId}
</if>
@@ -83,9 +83,6 @@
<if test="settlementCustomersDO.settlementCustomersCode != null and settlementCustomersDO.settlementCustomersCode != ''">
and settlement_customers_code like concat('%', #{settlementCustomersDO.settlementCustomersCode}, '%')
</if>
<if test="settlementCustomersDO.settlementEntity != null and settlementCustomersDO.settlementCustomersCode != ''">
and settlement_customers_code like concat('%', #{settlementCustomersDO.settlementCustomersCode}, '%')
</if>
<if test="settlementCustomersDO.settlementMethod != null and settlementCustomersDO.settlementMethod != ''">
and settlement_method like concat('%', #{settlementCustomersDO.settlementMethod}, '%')
</if>
@@ -104,9 +101,14 @@
<if test="settlementCustomersDO.mainRole != null and settlementCustomersDO.mainRole != ''">
and main_role = #{settlementCustomersDO.mainRole}
</if>
<if test="settlementCustomersDO.organizationId != null">
and organization_id = #{settlementCustomersDO.organizationId}
</if>
<if test="settlementCustomersDO.topOrganizationId != null and settlementCustomersDO.topOrganizationId != ''">
and top_organization_id = #{settlementCustomersDO.topOrganizationId}
</if>
<if test="settlementCustomersDO.customerType != null and settlementCustomersDO.customerType != ''">
and customer_type = #{settlementCustomersDO.customerType}
</if>
</sql>
</mapper>
@@ -32,13 +32,57 @@ public class DifferentManageApplicationService {
public List<DifferentManagePO> queryList(DifferentManageDO differentManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
differentManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = differentManageDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
differentManageDO.setOrganizationId(frontendOrganizationId);
differentManageDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
differentManageDO.setOrganizationId(null);
differentManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
differentManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
differentManageDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (differentManageDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
differentManageDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
differentManageDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
differentManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
differentManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
return differentManageDomainService.queryList(differentManageDO);
}
@@ -63,13 +63,57 @@ public class HandoverTaskOrderApplicationService {
public List<HandoverTaskOrderPO> queryList(HandoverTaskOrderDO handoverTaskOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
handoverTaskOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = handoverTaskOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
handoverTaskOrderDO.setOrganizationId(frontendOrganizationId);
handoverTaskOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
handoverTaskOrderDO.setOrganizationId(null);
handoverTaskOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
handoverTaskOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
handoverTaskOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (handoverTaskOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
handoverTaskOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
handoverTaskOrderDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
handoverTaskOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
handoverTaskOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
return handoverTaskOrderDomainService.queryList(handoverTaskOrderDO);
}
@@ -50,13 +50,57 @@ public class InventoryAdjustmentRecordApplicationService {
public List<InventoryAdjustmentRecordPO> queryList(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
inventoryAdjustmentRecordDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = inventoryAdjustmentRecordDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
inventoryAdjustmentRecordDO.setOrganizationId(frontendOrganizationId);
inventoryAdjustmentRecordDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
inventoryAdjustmentRecordDO.setOrganizationId(null);
inventoryAdjustmentRecordDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
inventoryAdjustmentRecordDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
inventoryAdjustmentRecordDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (inventoryAdjustmentRecordDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
inventoryAdjustmentRecordDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
inventoryAdjustmentRecordDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
inventoryAdjustmentRecordDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
inventoryAdjustmentRecordDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
List<InventoryAdjustmentRecordPO> inventoryAdjustmentRecordPOS = inventoryAdjustmentRecordDomainService.queryList(inventoryAdjustmentRecordDO);
@@ -64,13 +64,57 @@ public class InvestigationManageApplicationService {
public List<InvestigationManagePO> queryList(InvestigationManageDO investigationManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
investigationManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = investigationManageDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
investigationManageDO.setOrganizationId(frontendOrganizationId);
investigationManageDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
investigationManageDO.setOrganizationId(null);
investigationManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
investigationManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
investigationManageDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (investigationManageDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
investigationManageDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
investigationManageDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
return investigationManageDomainService.queryList(investigationManageDO);
}
@@ -59,10 +59,52 @@ public class MaterialBaseInfoApplicationService {
public List<MaterialBaseInfoPO> queryList(MaterialBaseInfoDO materialBaseInfoDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
materialBaseInfoDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = materialBaseInfoDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
materialBaseInfoDO.setOrganizationId(frontendOrganizationId);
materialBaseInfoDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
materialBaseInfoDO.setOrganizationId(null);
materialBaseInfoDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
materialBaseInfoDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
materialBaseInfoDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (materialBaseInfoDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
materialBaseInfoDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
materialBaseInfoDO.setTopOrganizationId(2827L);
}
}
}
List<MaterialBaseInfoPO> materialBaseInfoPOS = materialBaseInfoDomainService.queryList(materialBaseInfoDO);
@@ -51,12 +51,54 @@ public class MaterialInventoryApplicationService {
public List<MaterialInventoryPO> queryList(MaterialInventoryDO materialInventoryDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
materialInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = materialInventoryDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
materialInventoryDO.setOrganizationId(frontendOrganizationId);
materialInventoryDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
materialInventoryDO.setOrganizationId(null);
materialInventoryDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
materialInventoryDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
materialInventoryDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (materialInventoryDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
materialInventoryDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
materialInventoryDO.setTopOrganizationId(2827L);
}
}
// 前端有传warehouseId则优先使用传参未传时才使用用户关联仓库作为默认值
// 前端有传warehouseId则优先使用传参未传时才使用"用户关联仓库"作为默认值
if (materialInventoryDO.getWarehouseId() == null) {
AssociationWarehouseCacheDO associationWarehouseCacheDO =
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
@@ -61,13 +61,53 @@ public class PickingOrderApplicationService {
public List<PickingOrderPO> queryList(PickingOrderDO pickingOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
pickingOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = pickingOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
pickingOrderDO.setOrganizationId(frontendOrganizationId);
pickingOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
pickingOrderDO.setOrganizationId(null);
pickingOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
pickingOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
pickingOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (pickingOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
pickingOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
pickingOrderDO.setTopOrganizationId(2827L);
}
}
//AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
//pickingOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
List<PickingOrderPO> pickingOrderPOList = pickingOrderDomainService.queryList(pickingOrderDO);
@@ -571,6 +611,10 @@ public class PickingOrderApplicationService {
PickingMaterialDetailDO returnPickingMaterialDetailDO = new PickingMaterialDetailDO();
BeanUtils.copyProperties(pickingMaterialDetailPO, returnPickingMaterialDetailDO);
returnPickingMaterialDetailDO.setActualQuantity(pickingMaterialDetailDO.getActualQuantity());
returnPickingMaterialDetailDO.setTotalArea(pickingMaterialDetailDO.getTotalArea());
returnPickingMaterialDetailDO.setTotalVolume(pickingMaterialDetailDO.getTotalVolume());
returnPickingMaterialDetailDO.setTotalGrossWeight(pickingMaterialDetailDO.getTotalGrossWeight());
returnPickingMaterialDetailDO.setTotalNetWeight(pickingMaterialDetailDO.getTotalNetWeight());
//是否开启了序列号管理
if (pickingMaterialDetailPO.getSerialNumberManage() == 1){
if (CollectionUtils.isEmpty(pickingMaterialDetailDO.getMaterialDetailSerialNumberList())){
@@ -67,13 +67,57 @@ public class ShiftManageApplicationService {
public List<ShiftManagePO> queryList(ShiftManageDO shiftManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
shiftManageDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = shiftManageDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
shiftManageDO.setOrganizationId(frontendOrganizationId);
shiftManageDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
shiftManageDO.setOrganizationId(null);
shiftManageDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
shiftManageDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
shiftManageDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (shiftManageDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
shiftManageDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
shiftManageDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
shiftManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
shiftManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
return shiftManageDomainService.queryList(shiftManageDO);
}
@@ -119,7 +119,7 @@ public class ShiftMaterialDetailApplicationService {
}
// 性能优化批量获取批次属性避免N+1查询问题
// 1. 收集所有唯一的materialBaseInfoId
// 1. 收集所有唯一的materialBaseInfoId包括子项的此时子项还未构建所以直接遍历所有项
Set<Long> materialBaseInfoIdSet = list.stream()
.map(ShiftMaterialDetailPO::getMaterialBaseInfoId)
.filter(Objects::nonNull)
@@ -146,18 +146,47 @@ public class ShiftMaterialDetailApplicationService {
}
}
// 3. 为每个物料明细设置更多属性从库存表中获取值
setMaterialMoreDetailListFromInventory(list, batchDetailMap);
// 3. 构建父子关系类似queryListChildren的逻辑
List<ShiftMaterialDetailPO> parentList = list.stream()
.filter(e -> e.getLevel() != null && e.getLevel() == 1)
.collect(Collectors.toList());
return list;
// 递归构建子项关系
parentList.forEach(parent -> {
List<ShiftMaterialDetailPO> children = getChildren(parent.getUniqueId(), list, 2);
parent.setChildren(children);
});
// 4. 为每个物料明细包括子项设置更多属性从库存表中获取值
setMaterialMoreDetailListFromInventoryRecursively(parentList, batchDetailMap);
return parentList;
}
/**
* 为移位物料明细设置更多属性从库存表中获取值
* 递归获取子项
*/
private List<ShiftMaterialDetailPO> getChildren(Long parentUniqueId, List<ShiftMaterialDetailPO> allList, Integer maxLevel) {
List<ShiftMaterialDetailPO> childrenList = allList.stream()
.filter(materialDetailPO -> parentUniqueId != null && parentUniqueId.equals(materialDetailPO.getParentUniqueId()))
.collect(Collectors.toList());
if (!CollectionUtils.isEmpty(childrenList)) {
childrenList.forEach(child -> {
if (child.getLevel() != null && child.getLevel() < maxLevel) {
child.setChildren(getChildren(child.getUniqueId(), allList, maxLevel));
}
});
}
return childrenList;
}
/**
* 为移位物料明细设置更多属性从库存表中获取值递归处理子项
* @param shiftMaterialDetailPOList 移位物料明细列表
* @param batchDetailMap 批次属性Map
*/
private void setMaterialMoreDetailListFromInventory(List<ShiftMaterialDetailPO> shiftMaterialDetailPOList,
private void setMaterialMoreDetailListFromInventoryRecursively(List<ShiftMaterialDetailPO> shiftMaterialDetailPOList,
Map<Long, List<BatchDetailFeignPO>> batchDetailMap) {
if (CollectionUtils.isEmpty(shiftMaterialDetailPOList)) {
return;
@@ -235,6 +264,11 @@ public class ShiftMaterialDetailApplicationService {
shiftMaterialDetailPO.getUniqueId(), shiftMaterialDetailPO.getMaterialBaseInfoId(),
shiftMaterialDetailPO.getMaterialInventoryId(),
materialMoreDetailList != null ? materialMoreDetailList.size() : 0);
// 递归处理子项
if (!CollectionUtils.isEmpty(shiftMaterialDetailPO.getChildren())) {
setMaterialMoreDetailListFromInventoryRecursively(shiftMaterialDetailPO.getChildren(), batchDetailMap);
}
});
}
@@ -53,10 +53,52 @@ public class StatementStatisticsService {
public List<ImmediateInventoryPO> queryImmediateInventoryList(ImmediateInventoryDO immediateInventoryDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
immediateInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = immediateInventoryDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
immediateInventoryDO.setOrganizationId(frontendOrganizationId);
immediateInventoryDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
immediateInventoryDO.setOrganizationId(null);
immediateInventoryDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
immediateInventoryDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
immediateInventoryDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (immediateInventoryDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
immediateInventoryDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
immediateInventoryDO.setTopOrganizationId(2827L);
}
}
// 只有在用户没有明确指定仓库参数时才使用缓存中的仓库信息
// 如果用户已经传递了 warehouseIdwarehouseCode warehouseName优先使用这些值
@@ -68,10 +68,52 @@ public class StockInOrderApplicationService {
public List<StockInOrderPO> queryList(StockInOrderDO stockInOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
stockInOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockInOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
stockInOrderDO.setOrganizationId(frontendOrganizationId);
stockInOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
stockInOrderDO.setOrganizationId(null);
stockInOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
stockInOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockInOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (stockInOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockInOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
stockInOrderDO.setTopOrganizationId(2827L);
}
}
// 前端有传warehouseId则优先使用传参未传时才使用"用户关联仓库"作为默认值
if (stockInOrderDO.getWarehouseId() == null) {
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mhd.common.core.constant.SnowFlakeConstants;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.enums.DictCode;
@@ -23,14 +24,19 @@ import com.mhd.system.api.domain.WarehouseFeignPO;
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
import com.mhd.wms.domain.materialInventory.service.MaterialInventoryDomainService;
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.facade.IOutMaterialDetailService;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialCheckPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.outMaterialDetail.service.OutMaterialDetailDomainService;
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
import com.mhd.wms.domain.stockOutOrder.service.StockOutOrderDomainService;
@@ -69,6 +75,10 @@ public class StockOutOrderApplicationService {
private SystemServiceFeign systemServiceFeign;
@Autowired
private IdGenerator idGenerator;
@Autowired
private IStockOutOrderService stockOutOrderService;
@Autowired
private IOutMaterialDetailService outMaterialDetailService;
/**
@@ -85,6 +95,54 @@ public class StockOutOrderApplicationService {
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
stockOutOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}*/
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockOutOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
stockOutOrderDO.setOrganizationId(frontendOrganizationId);
stockOutOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
stockOutOrderDO.setOrganizationId(null);
stockOutOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
stockOutOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockOutOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (stockOutOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockOutOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
stockOutOrderDO.setTopOrganizationId(2827L);
}
}
}
return stockOutOrderDomainService.queryList(stockOutOrderDO);
}
@@ -522,10 +580,68 @@ public class StockOutOrderApplicationService {
return stockOutOrderDomainService.manualAssign(assembleStockOutOrderDO);
}
/**
* @description 手动分配
* @author ZhouGY
* @date 2024/5/28 13:47
* @param stockOutOrderDO
* @return Boolean
*/
public Boolean autoAssign(StockOutOrderDO stockOutOrderDO){
List<Long> outOrderIds = stockOutOrderDO.getOutOrderIds();
if (outOrderIds == null || outOrderIds.isEmpty()){
throw new ServiceException("出库单ID不能为空");
}
Boolean result = true;
for (Long outOrderId : outOrderIds){
StockOutOrderDO stockOutOrderD = new StockOutOrderDO();
StockOutOrder stockOutOrderDb = stockOutOrderService.getById(outOrderId);
if (stockOutOrderDb == null){
throw new ServiceException("出库单不存在");
}
BeanUtils.copyProperties(stockOutOrderDb, stockOutOrderD);
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailService.list(new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, stockOutOrderDb.getOutOrderNumber()));
List<OutMaterialDetailDO> materialDetailList = cn.hutool.core.bean.BeanUtil.copyToList(outMaterialDetailList, OutMaterialDetailDO.class);
for (OutMaterialDetailDO detail : materialDetailList) {
detail.setAllocationQuantity(detail.getQuantity());
String batchRefNo = detail.getBatchRefNo();
String sheetRefNo = detail.getSheetRefNo();
String boxPalletNo = detail.getBoxPalletNo();
Long materialBaseInfoId = detail.getMaterialBaseInfoId();
Long warehouseId = detail.getWarehouseId();
List<MaterialInventory> materialInventories = materialInventoryMapper.selectList(new QueryWrapper<MaterialInventory>().lambda()
.eq(MaterialInventory::getBatchRefNo, batchRefNo)
.eq(MaterialInventory::getSheetRefNo, sheetRefNo)
.eq(MaterialInventory::getBoxPalletNo, boxPalletNo)
.eq(MaterialInventory::getWarehouseId, warehouseId)
.eq(MaterialInventory::getMaterialBaseInfoId, materialBaseInfoId));
if (materialInventories == null || materialInventories.isEmpty()) {
throw new ServiceException("库存不存在:" + batchRefNo + " " + sheetRefNo + " " + boxPalletNo);
}
MaterialInventory materialInventory = materialInventories.get(0);
detail.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
detail.setStorageLocationId(materialInventory.getStorageLocationId());
detail.setStorageLocationName(materialInventory.getStorageLocationName());
detail.setStorageLocationCode(materialInventory.getStorageLocationCode());
detail.setStorageSectionId(materialInventory.getStorageSectionId());
detail.setStorageName(materialInventory.getStorageName());
detail.setStorageCode(materialInventory.getStorageCode());
}
stockOutOrderD.setMaterialDetailList(materialDetailList);
StockOutOrderDO assembleStockOutOrderDO = assembleParamByOutOrder(stockOutOrderD);
Boolean assignResult = stockOutOrderDomainService.autoAssign(assembleStockOutOrderDO);
if (!assignResult) {
result = false;
}
}
return result;
}
/*public Boolean autoAssign(StockOutOrderDO stockOutOrderDO){
StockOutOrderDO assembleStockOutOrderDO = assembleParamByOutOrder(stockOutOrderDO);
return stockOutOrderDomainService.autoAssign(assembleStockOutOrderDO);
}
}*/
/**
* @description 取消分配
@@ -46,13 +46,57 @@ public class StockOutTaskOrderApplicationService {
public List<StockOutTaskOrderPO> queryList(StockOutTaskOrderDO stockOutTaskOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
stockOutTaskOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null) {
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockOutTaskOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
stockOutTaskOrderDO.setOrganizationId(frontendOrganizationId);
stockOutTaskOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
stockOutTaskOrderDO.setOrganizationId(null);
stockOutTaskOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
stockOutTaskOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockOutTaskOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (stockOutTaskOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockOutTaskOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
stockOutTaskOrderDO.setTopOrganizationId(2827L);
}
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
stockOutTaskOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
if (associationWarehouseCacheDO != null) {
stockOutTaskOrderDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
return stockOutTaskOrderDomainService.queryList(stockOutTaskOrderDO);
}
@@ -91,10 +91,52 @@ public class StockReceiptOrderApplicationService {
public List<StockReceiptOrderPO> queryList(StockReceiptOrderDO stockReceiptOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
stockReceiptOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockReceiptOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
stockReceiptOrderDO.setOrganizationId(frontendOrganizationId);
stockReceiptOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
stockReceiptOrderDO.setOrganizationId(null);
stockReceiptOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
stockReceiptOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockReceiptOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (stockReceiptOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockReceiptOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
stockReceiptOrderDO.setTopOrganizationId(2827L);
}
}
try {
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
@@ -97,10 +97,52 @@ public class StockShelfOrderApplicationService {
public List<StockShelfOrderPO> queryList(StockShelfOrderDO stockShelfOrderDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
stockShelfOrderDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser != null && loginUser.getUserPo() != null){
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
Long frontendOrganizationId = stockShelfOrderDO.getOrganizationId(); // 前端传递的 organizationId
// 数据权限根据 organizationId 来设置查询权限
// 当前登录用户的 organizationId 2827 可查全部组织数据其他组织只能查自己
if (userOrganizationId != null && userOrganizationId == 2827L) {
// 南光组织organizationId=2827可以查询所有组织的数据
// 如果前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
// 如果前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId包括2827或其他组织使用前端传递的值进行过滤
stockShelfOrderDO.setOrganizationId(frontendOrganizationId);
stockShelfOrderDO.setTopOrganizationId(null); // 明确设置为 null避免使用 topOrganizationId 条件
} else {
// 前端没有传递 organizationId清空组织过滤条件查询所有组织的数据
stockShelfOrderDO.setOrganizationId(null);
stockShelfOrderDO.setTopOrganizationId(null);
}
} else {
// 其他组织设置organizationId只查询当前组织的数据
// 如果前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId != null && userOrganizationId != null) {
// 前端传递了 organizationId验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(userOrganizationId)) {
// 前端传递了其他组织的 organizationId强制使用当前登录用户的组织ID防止越权查询
stockShelfOrderDO.setOrganizationId(userOrganizationId);
}
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致使用前端传递的值
} else {
// 前端没有传递 organizationId使用当前登录用户的组织ID
if (userOrganizationId != null) {
stockShelfOrderDO.setOrganizationId(userOrganizationId);
}
}
// 只有当 organizationId null 才使用 topOrganizationId 作为查询条件
// 如果 organizationId 不为 null则优先使用 organizationId不使用 topOrganizationId
if (stockShelfOrderDO.getOrganizationId() == null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1) {
stockShelfOrderDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 对于非2827组织必须设置 topOrganizationId=2827
stockShelfOrderDO.setTopOrganizationId(2827L);
}
}
try {
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
@@ -147,6 +147,10 @@ public class InMaterialDetailImpl extends ServiceImpl<InMaterialDetailMapper, In
inMaterialDetail.setCreateBy(loginUser.getUserid());
inMaterialDetail.setCreateByName(loginUser.getUsername());
inMaterialDetail.setCreateTime(new Date());
// 新增入库单明细时如果计划数量为空则使用入库数量作为计划数量
if (inMaterialDetail.getQuantity() == null && inMaterialDetailDO.getInboundQuantity() != null) {
inMaterialDetail.setQuantity(inMaterialDetailDO.getInboundQuantity());
}
inMaterialDetailList.add(inMaterialDetail);
}
return saveBatch(inMaterialDetailList);
@@ -75,26 +75,54 @@ public class MaterialBarCodeImpl extends ServiceImpl<MaterialBarCodeMapper, Mate
}
LoginUser loginUser = SecurityUtils.getLoginUser();
UserPo userPo = loginUser.getUserPo();
//标记之前的数据删除
materialBarCodeMapper.update(null, new UpdateWrapper<MaterialBarCode>().lambda()
.set(MaterialBarCode::getDelFlag, 2)
.set(MaterialBarCode::getUpdateBy, loginUser.getUserid())
.set(MaterialBarCode::getUpdateByName, loginUser.getUsername())
.set(MaterialBarCode::getUpdateTime, new Date())
.eq(MaterialBarCode::getMaterialBaseInfoId, materialBarCodeDOList.get(0).getMaterialBaseInfoId())
.eq(MaterialBarCode::getDelFlag, 1));
Long materialBaseInfoId = materialBarCodeDOList.get(0).getMaterialBaseInfoId();
// 先物理删除该物料的所有旧条码记录包括已标记删除的避免唯一性约束冲突
// 因为唯一性约束 IDX_MATERIAL_BASE_ID_BAR_CODE 可能检查所有记录包括 delFlag=2 的记录
// 使用 Mapper delete 方法进行物理删除绕过逻辑删除拦截器
materialBarCodeMapper.delete(new QueryWrapper<MaterialBarCode>().lambda()
.eq(MaterialBarCode::getMaterialBaseInfoId, materialBaseInfoId));
// 去重处理确保没有重复的 material_base_info_id + bar_code 组合
// 使用 LinkedHashMap 保持顺序对所有记录进行去重
// 对于 barCode null 的记录使用 packDetailId 来区分因为唯一性约束可能不允许多个 null
java.util.Map<String, MaterialBarCode> uniqueMap = new java.util.LinkedHashMap<>();
List<MaterialBarCode> materialBarCodeList = new ArrayList<>();
for (MaterialBarCodeDO materialBarCodeDO : materialBarCodeDOList){
String barCode = materialBarCodeDO.getBarCode();
String key;
// 构建唯一性 keymaterial_base_info_id + bar_code
// 如果 barCode null 或空使用 packDetailId 来区分避免多条 null 值违反唯一性约束
if (barCode != null && !barCode.trim().isEmpty()) {
key = materialBaseInfoId + "_" + barCode.trim();
} else {
// barCode null 或空时使用 packDetailId 来区分
// 如果 packDetailId 也为 null则使用固定值只保留第一条
Long packDetailId = materialBarCodeDO.getPackDetailId();
key = materialBaseInfoId + "_null_" + (packDetailId != null ? packDetailId : "empty");
}
// 如果已存在相同的组合跳过保留第一个避免违反唯一性约束
if (uniqueMap.containsKey(key)) {
continue;
}
// 创建新的条码记录
MaterialBarCode materialBarCode = new MaterialBarCode();
BeanUtils.copyProperties(materialBarCodeDO,materialBarCode);
BeanUtils.copyProperties(materialBarCodeDO, materialBarCode);
materialBarCode.setOrganizationId(userPo.getOrganizationId());
materialBarCode.setOrganizationName(userPo.getOrganizationName());
materialBarCode.setTopOrganizationId(userPo.getTopOrganizationId());
materialBarCode.setCreateBy(loginUser.getUserid());
materialBarCode.setCreateByName(loginUser.getUsername());
materialBarCode.setCreateTime(new Date());
materialBarCode.setDelFlag(1);
// 添加到去重 Map 和列表
uniqueMap.put(key, materialBarCode);
materialBarCodeList.add(materialBarCode);
}
if (CollectionUtils.isEmpty(materialBarCodeList)) {
return true;
}
return this.saveBatch(materialBarCodeList);
}
@@ -157,7 +185,12 @@ public class MaterialBarCodeImpl extends ServiceImpl<MaterialBarCodeMapper, Mate
return null;
}
List<MaterialBarCodePO> materialBarCodePOList = new ArrayList<>();
BeanUtils.copyProperties(materialBarCodeList,materialBarCodePOList);
// 遍历列表逐个复制每个对象的属性
for (MaterialBarCode materialBarCode : materialBarCodeList) {
MaterialBarCodePO materialBarCodePO = new MaterialBarCodePO();
BeanUtils.copyProperties(materialBarCode, materialBarCodePO);
materialBarCodePOList.add(materialBarCodePO);
}
return materialBarCodePOList;
}
}
@@ -444,4 +444,8 @@ public class OutMaterialDetail extends BaseVOEntity {
@ApiModelProperty("复核总面积(SQM)")
@Excel(name = "复核总面积(SQM)")
private BigDecimal checkArea;
@ApiModelProperty("是否已分配")
@Excel(name = "是否已分配")
private String isAllocated;
}
@@ -299,10 +299,13 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
totalAllocationQuantity = totalAllocationQuantity.add(outMaterialDetail.getAlreadyAllocationQuantity());
}
stockOutOrderPO.setAllocationQuantity(totalAllocationQuantity);
//保存物料明细信息
saveOrUpdateBatch(outMaterialDetailList);
//分配(修改库存)
xgkc(outMaterialDetailList,outOrderNumber,loginUser);
//保存物料明细信息
outMaterialDetailList.forEach(outMaterialDetail -> {
outMaterialDetail.setIsAllocated("1");
});
saveOrUpdateBatch(outMaterialDetailList);
return stockOutOrderPO;
}
@@ -415,9 +418,11 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
public synchronized void xgkc(List<OutMaterialDetail> outMaterialDetailList,String outOrderNumber,LoginUser loginUser) {
StockOutOrder stockOutOrder = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda().eq(StockOutOrder::getOutOrderNumber, outOrderNumber));
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
BigDecimal alreadyAllocationQuantity = outMaterialDetail.getAlreadyAllocationQuantity();
// 如果已经分配数量大于0则跳过本次循环该明细已分配过不再重复处理
if (alreadyAllocationQuantity != null && alreadyAllocationQuantity.compareTo(BigDecimal.ZERO) > 0) {
Long materialDetailId = outMaterialDetail.getMaterialDetailId();
OutMaterialDetail isAllocatedDetail = outMaterialDetailMapper.selectById(materialDetailId);
String isAllocated = isAllocatedDetail.getIsAllocated();
// 如果已经分配过则跳过本次循环该明细已分配过不再重复处理
if (isAllocated != null && "1".equals(isAllocated)) {
continue;
}
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
@@ -462,4 +462,8 @@ public class OutMaterialDetailPO extends StockOutOrderBaseDO {
@ApiModelProperty("复核总面积(SQM)")
@Excel(name = "复核总面积(SQM)")
private BigDecimal checkArea;
@ApiModelProperty("是否已分配")
@Excel(name = "是否已分配")
private String isAllocated;
}
@@ -420,4 +420,7 @@ public class OutMaterialDetailDO extends BaseVOEntity {
@Excel(name = "复核总面积(SQM)")
private BigDecimal checkArea;
@ApiModelProperty("是否已分配")
@Excel(name = "是否已分配")
private String isAllocated;
}
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -139,7 +140,9 @@ public class OutOrderAbnormalImpl extends ServiceImpl<OutOrderAbnormalMapper, Ou
private List<OutOrderAbnormal> genPickingOrderMaterialDetailList(OutOrderAbnormalBaseDO OutOrderAbnormalBaseDO, List<PickingMaterialDetail> pickingMaterialDetailList){
LoginUser loginUser = SecurityUtils.getLoginUser();
List<OutOrderAbnormal> outOrderAbnormalList = new ArrayList<>();
//BigDecimal actualQuantity = BigDecimal.ZERO;
for (PickingMaterialDetail pickingMaterialDetail : pickingMaterialDetailList){
//actualQuantity = actualQuantity.add(pickingMaterialDetail.getPickingQuantity());
//拣货
if (pickingMaterialDetail.getPickingQuantity().compareTo(pickingMaterialDetail.getQuantity()) != 0){
//判断是否存在异常 根据设置的是否允许超收 取值动态赋值 先默认写死 收货异常
@@ -208,4 +211,4 @@ public class OutOrderAbnormalImpl extends ServiceImpl<OutOrderAbnormalMapper, Ou
return outOrderAbnormalList;
}
}
}
@@ -7,6 +7,7 @@ import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialD
import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDOByUpdate;
import com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO;
import com.mhd.wms.domain.pickingOrder.repository.todo.PickingOrderDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -23,6 +24,8 @@ public interface IPickingMaterialDetailService extends IService<PickingMaterialD
*/
public List<PickingMaterialDetailPO> queryList(PickingMaterialDetailDO pickingMaterialDetailDO);
public PickingMaterialDetailPO queryTotalsByOutNumberAndBaseId(Long outUniqueId);
/**
* 新增拣货单物料明细
*/
@@ -72,4 +75,4 @@ public interface IPickingMaterialDetailService extends IService<PickingMaterialD
* @return Boolean
*/
public Boolean addQuantity(PickingMaterialDetailDOByUpdate pickingMaterialDetailDOByUpdate);
}
}
@@ -5,6 +5,7 @@ import com.mhd.wms.domain.pickingMaterialDetail.entity.PickingMaterialDetail;
import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO;
import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDO;
import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDOByUpdate;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -21,6 +22,8 @@ public interface PickingMaterialDetailMapper extends BaseMapper<PickingMaterialD
*/
public List<PickingMaterialDetailPO> queryList(PickingMaterialDetailDO pickingMaterialDetailDO);
public PickingMaterialDetailPO queryTotalsByOutNumberAndBaseId(@Param("outUniqueId") Long outUniqueId);
/**
* @description 根据拣货单增加拣货数量
* @author ZhouGY
@@ -30,4 +33,4 @@ public interface PickingMaterialDetailMapper extends BaseMapper<PickingMaterialD
*/
public int addQuantity(PickingMaterialDetailDOByUpdate pickingMaterialDetailDOByUpdate);
}
}
@@ -61,6 +61,12 @@ public class PickingMaterialDetailImpl extends ServiceImpl<PickingMaterialDetail
return pickingMaterialDetailMapper.queryList(pickingMaterialDetailDO);
}
@Override
public PickingMaterialDetailPO queryTotalsByOutNumberAndBaseId(Long outUniqueId)
{
return pickingMaterialDetailMapper.queryTotalsByOutNumberAndBaseId(outUniqueId);
}
/**
* 新增拣货单物料明细
*/
@@ -41,6 +41,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -113,7 +114,9 @@ public class ShiftManageImpl extends ServiceImpl<ShiftManageMapper, ShiftManage>
setWarehouseInfo(e);
//设置物料信息
setMaterialDetailInfo(e);
e.setUniqueId(idGenerator.snowflakeId(SnowFlakeConstants.wmsId));
// 设置父级信息
Long parentUniqueId = idGenerator.snowflakeId(SnowFlakeConstants.wmsId);
e.setUniqueId(parentUniqueId);
e.setShiftNumber(shiftManage.getShiftNumber());
e.setOrganizationId(loginUser.getUserPo().getOrganizationId());
e.setOrganizationName(loginUser.getUserPo().getOrganizationName());
@@ -125,10 +128,74 @@ public class ShiftManageImpl extends ServiceImpl<ShiftManageMapper, ShiftManage>
e.setUpdateBy(loginUser.getUserid());
e.setUpdateTime(new Date());
e.setSerialNumberManage(e.getSerialNumberManage());
// 设置父级level为1
if (e.getLevel() == null) {
e.setLevel(1);
}
ShiftMaterialDetail shiftMaterialDetail = new ShiftMaterialDetail();
BeanUtils.copyProperties(e, shiftMaterialDetail);
shiftMaterialDetail.setNewStorageLocationName(newStorageLocationName);
shiftMaterialDetailList.add(shiftMaterialDetail);
// 处理子项
List<ShiftMaterialDetailDO> shiftMaterialDetailDOChildList = e.getChildren();
if (!CollectionUtils.isEmpty(shiftMaterialDetailDOChildList)) {
for (ShiftMaterialDetailDO shiftMaterialDetailDOChild : shiftMaterialDetailDOChildList) {
// 如果子项没有materialInventoryId则从父级继承库存相关信息
if (shiftMaterialDetailDOChild.getMaterialInventoryId() == null) {
// 从父级继承库存相关信息
shiftMaterialDetailDOChild.setMaterialInventoryId(e.getMaterialInventoryId());
shiftMaterialDetailDOChild.setMaterialBaseInfoId(e.getMaterialBaseInfoId());
shiftMaterialDetailDOChild.setMaterialCode(e.getMaterialCode());
shiftMaterialDetailDOChild.setMaterialName(e.getMaterialName());
shiftMaterialDetailDOChild.setBarCode(e.getBarCode());
shiftMaterialDetailDOChild.setInventoryQuantity(e.getInventoryQuantity());
shiftMaterialDetailDOChild.setOldWarehouseId(e.getOldWarehouseId());
shiftMaterialDetailDOChild.setOldWarehouseCode(e.getOldWarehouseCode());
shiftMaterialDetailDOChild.setOldWarehouseName(e.getOldWarehouseName());
shiftMaterialDetailDOChild.setOldStorageSectionId(e.getOldStorageSectionId());
shiftMaterialDetailDOChild.setOldStorageCode(e.getOldStorageCode());
shiftMaterialDetailDOChild.setOldStorageName(e.getOldStorageName());
shiftMaterialDetailDOChild.setOldStorageLocationId(e.getOldStorageLocationId());
shiftMaterialDetailDOChild.setOldStorageLocationCode(e.getOldStorageLocationCode());
shiftMaterialDetailDOChild.setOldStorageLocationName(e.getOldStorageLocationName());
shiftMaterialDetailDOChild.setBatchNumber(e.getBatchNumber());
shiftMaterialDetailDOChild.setMaterialStatusCode(e.getMaterialStatusCode());
shiftMaterialDetailDOChild.setMaterialStatusName(e.getMaterialStatusName());
shiftMaterialDetailDOChild.setContainerId(e.getContainerId());
shiftMaterialDetailDOChild.setContainerCode(e.getContainerCode());
shiftMaterialDetailDOChild.setContainerType(e.getContainerType());
shiftMaterialDetailDOChild.setContainerTypeName(e.getContainerTypeName());
} else {
// 如果子项有materialInventoryId则设置库存信息
setMaterialInventory(shiftMaterialDetailDOChild);
}
// 设置库位信息和物料信息
setWarehouseInfo(shiftMaterialDetailDOChild);
setMaterialDetailInfo(shiftMaterialDetailDOChild);
// 设置子项的uniqueId和parentUniqueId
Long childUniqueId = idGenerator.snowflakeId(SnowFlakeConstants.wmsId);
shiftMaterialDetailDOChild.setUniqueId(childUniqueId);
shiftMaterialDetailDOChild.setParentUniqueId(parentUniqueId);
shiftMaterialDetailDOChild.setShiftNumber(shiftManage.getShiftNumber());
shiftMaterialDetailDOChild.setOrganizationId(loginUser.getUserPo().getOrganizationId());
shiftMaterialDetailDOChild.setOrganizationName(loginUser.getUserPo().getOrganizationName());
shiftMaterialDetailDOChild.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
shiftMaterialDetailDOChild.setCreateByName(loginUser.getUsername());
shiftMaterialDetailDOChild.setCreateBy(loginUser.getUserid());
shiftMaterialDetailDOChild.setCreateTime(new Date());
shiftMaterialDetailDOChild.setUpdateByName(loginUser.getUsername());
shiftMaterialDetailDOChild.setUpdateBy(loginUser.getUserid());
shiftMaterialDetailDOChild.setUpdateTime(new Date());
// 设置子项level为2
shiftMaterialDetailDOChild.setLevel(2);
ShiftMaterialDetail shiftMaterialDetailChild = new ShiftMaterialDetail();
BeanUtils.copyProperties(shiftMaterialDetailDOChild, shiftMaterialDetailChild);
shiftMaterialDetailList.add(shiftMaterialDetailChild);
}
}
});
iShiftMaterialDetailService.saveBatch(shiftMaterialDetailList);
Boolean b;
@@ -115,5 +115,13 @@ public class ImmediateInventoryPO {
@ApiModelProperty("物料更多属性列表(批次属性)")
private List<MaterialMoreDetailPO> materialMoreDetailList;
@ApiModelProperty("组织ID")
private Long organizationId;
@ApiModelProperty("组织名称")
private String organizationName;
@ApiModelProperty("顶级组织ID")
private Long topOrganizationId;
}
@@ -46,6 +46,8 @@ import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailBas
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.outOrderAbnormal.repository.facade.IOutOrderAbnormalService;
import com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalBaseDO;
import com.mhd.wms.domain.pickingMaterialDetail.repository.facade.IPickingMaterialDetailService;
import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO;
import com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDO;
import com.mhd.wms.domain.pickingOrder.repository.todo.PickingOrderDO;
import com.mhd.wms.domain.pickingOrder.service.PickingOrderDomainService;
@@ -61,6 +63,7 @@ import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
import com.mhd.wms.domain.waveOrder.factorys.WaveOrderServiceFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -121,6 +124,8 @@ public class StockOutOrderDomainService {
private MaterialBaseInfoMapper materialBaseInfoMapper;
@Autowired
private MaterialInventoryMapper materialInventoryMapper;
@Autowired
private IPickingMaterialDetailService pickingMaterialDetailService;
/**
* 分页查询出库单列表
@@ -244,7 +249,29 @@ public class StockOutOrderDomainService {
return updateStockOutOrderByAllocation(stockOutOrderDb, stockOutOrderPO, 1);
}
/**
* @description 手动分配
* @author ZhouGY
* @date 2024/5/22 16:20
* @param stockOutOrderDO
* @return Boolean
*/
@Transactional(rollbackFor = Exception.class)
public Boolean autoAssign(StockOutOrderDO stockOutOrderDO){
StockOutOrder stockOutOrderDb = stockOutOrderService.getById(stockOutOrderDO.getOutOrderId());
if (stockOutOrderDb == null){
throw new ServiceException("出库单不存在");
}
if (stockOutOrderDb.getStatus() > 3){
throw new ServiceException("收货单已完成分配");
}
//修改物料明细信息
StockOutOrderPO stockOutOrderPO = outMaterialDetailService.batchAssignUpdate(stockOutOrderDb.getOutOrderNumber(), stockOutOrderDO.getMaterialDetailList());
//修改出库单
return updateStockOutOrderByAllocation(stockOutOrderDb, stockOutOrderPO, 1);
}
/*@Transactional(rollbackFor = Exception.class)
public Boolean autoAssign(StockOutOrderDO stockOutOrderDO){
StockOutOrder stockOutOrderDb = stockOutOrderService.getById(stockOutOrderDO.getOutOrderId());
if (stockOutOrderDb == null){
@@ -268,7 +295,7 @@ public class StockOutOrderDomainService {
StockOutOrderPO stockOutOrderPO = outMaterialDetailService.batchAssignUpdate(stockOutOrderDb.getOutOrderNumber(), stockOutOrderDO.getMaterialDetailList());
//修改出库单
return updateStockOutOrderByAllocation(stockOutOrderDb, stockOutOrderPO, 1);
}
}*/
/**
* @description 手动取消分配点击确认后直接取消分配
@@ -672,6 +699,7 @@ public class StockOutOrderDomainService {
* 获取出库单复核详细信息
*/
public StockOutOrderPO getCheckInfo(StockOutOrderDO stockOutOrderDO) {
String outOrderNumber = stockOutOrderDO.getOutOrderNumber();
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getDelFlag, 1)
.eq(StockOutOrder::getOutOrderNumber, stockOutOrderDO.getOutOrderNumber()));
@@ -681,8 +709,8 @@ public class StockOutOrderDomainService {
if (stockOutOrder.getReview() != 1){
throw new ServiceException("出库单【" + stockOutOrderDO.getOutOrderNumber() + "】不需要复核");
}
if (stockOutOrder.getStatus() != 7){
throw new ServiceException("出库单【" + stockOutOrderDO.getOutOrderNumber() + "】状态不是拣货完成");
if (stockOutOrder.getStatus() != 7 && stockOutOrder.getStatus() != 8){
throw new ServiceException("出库单【" + stockOutOrderDO.getOutOrderNumber() + "】状态不是拣货完成或复核中");
}
StockOutOrderPO stockOutOrderPO = new StockOutOrderPO();
BeanUtils.copyProperties(stockOutOrder, stockOutOrderPO);
@@ -692,6 +720,18 @@ public class StockOutOrderDomainService {
for (OutMaterialDetailPO outMaterialDetailPO : outMaterialDetailPOList) {
outMaterialDetailPO.setMaterialCode(outMaterialDetailPO.getMaterialNo());
outMaterialDetailPO.setMaterialName(outMaterialDetailPO.getCommodityName());
Long uniqueId = outMaterialDetailPO.getUniqueId();
PickingMaterialDetailPO pickingMaterialDetailPO = pickingMaterialDetailService.queryTotalsByOutNumberAndBaseId(uniqueId);
if (ObjectUtils.isNotEmpty(pickingMaterialDetailPO)) {
outMaterialDetailPO.setTotalArea(pickingMaterialDetailPO.getTotalArea());
outMaterialDetailPO.setTotalVolume(pickingMaterialDetailPO.getTotalVolume());
outMaterialDetailPO.setTotalNetWeight(pickingMaterialDetailPO.getTotalNetWeight());
outMaterialDetailPO.setTotalGrossWeight(pickingMaterialDetailPO.getTotalGrossWeight());
outMaterialDetailPO.setCheckArea(pickingMaterialDetailPO.getTotalArea());
outMaterialDetailPO.setCheckVolume(pickingMaterialDetailPO.getTotalVolume());
outMaterialDetailPO.setCheckNetWeight(pickingMaterialDetailPO.getTotalNetWeight());
outMaterialDetailPO.setCheckGrossWeight(pickingMaterialDetailPO.getTotalGrossWeight());
}
}
stockOutOrderPO.setMaterialDetailList(outMaterialDetailPOList);
BigDecimal weightLimit = BigDecimal.ZERO;
@@ -743,6 +783,7 @@ public class StockOutOrderDomainService {
// 3. 为每个物料明细设置更多属性从库存表中获取值
setMaterialMoreDetailListFromInventory(materialDetailList, batchDetailMap);
materialDetailList.removeIf(detail -> detail.getPickingQuantity() != null && detail.getPickingQuantity().compareTo(BigDecimal.ONE) < 0);
stockOutOrderPO.setMaterialDetailList(materialDetailList);
return stockOutOrderPO;
}
@@ -337,6 +337,7 @@ public class StockReceiptOrderDomainService {
throw new ServiceException("未选择收货单,或收货单不存在");
}
stockReceiptOrderDOQuery.setTaskDistribution(2);
stockReceiptOrderDOQuery.setReceiptOrderIds(receiptOrderIds);
List<StockReceiptOrderPO> stockReceiptOrderPOList = stockReceiptOrderService.queryList(stockReceiptOrderDOQuery);
if (CollectionUtils.isEmpty(stockReceiptOrderPOList)) {
throw new ServiceException("收货单不存在或已下发,请重新选择");
@@ -356,6 +357,8 @@ public class StockReceiptOrderDomainService {
.set(StockReceiptOrder::getUpdateBy, loginUser.getUserid())
.set(StockReceiptOrder::getUpdateByName, loginUser.getUsername())
.set(StockReceiptOrder::getUpdateTime, new Date())
.set(StockReceiptOrder::getOperatorsBy, stockReceiptOrderDO.getOperatorsBy())
.set(StockReceiptOrder::getOperatorsName, stockReceiptOrderDO.getOperatorsName())
.in(StockReceiptOrder::getReceiptOrderId, stockReceiptOrderDO.getReceiptOrderIds()));
}
@@ -173,6 +173,17 @@ public class StockOutOrderApi extends BaseController {
}
/**
* 手动分配
*/
@ApiOperation("自动分配")
@PostMapping("/autoAssign")
public AjaxResult autoAssign(@RequestBody StockOutOrderDTO stockOutOrderDTO) {
StockOutOrderDO stockOutOrderDO = new StockOutOrderDO();
BeanUtils.copyProperties(stockOutOrderDTO, stockOutOrderDO);
return toAjax(stockOutOrderApplicationService.autoAssign(stockOutOrderDO));
}
/**
* 取消分配
*/
@@ -325,12 +336,12 @@ public class StockOutOrderApi extends BaseController {
/**
* 自动分配
*/
@ApiOperation("自动分配")
/*@ApiOperation("自动分配")
@PostMapping("/autoAssign")
public AjaxResult autoAssign(@RequestBody StockOutOrderDTO stockOutOrderDTO) {
StockOutOrderDO stockOutOrderDO = JSONUtil.toBean(JSONUtil.toJsonStr(stockOutOrderDTO), StockOutOrderDO.class);
return toAjax(stockOutOrderApplicationService.autoAssign(stockOutOrderDO));
}
}*/
@ApiOperation("关闭出库单")
@@ -433,6 +433,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="boxPalletNo" column="box_pallet_no" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialInventoryId" column="material_inventory_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
</resultMap>
<select id="queryImmediateInventoryList" parameterType="com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO"
resultMap="queryImmediateInventoryListResult">
@@ -541,13 +544,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.sheet_ref_no,
a.box_pallet_no,
b.material_base_info_id,
a.material_inventory_id
a.material_inventory_id,
a.organization_id,
a.organization_name,
a.top_organization_id
FROM
material_inventory a
left join material_base_info b on a.material_base_info_id=b.material_base_info_id
WHERE
a.del_flag = 1
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.out_order_abnormal_id, a.organization_id, a.organization_name, a.top_organization_id, a.abnormal_number, a.out_order_number, a.picking_order_number, a.out_task_order_number, a.type, a.quantity, a.actual_quantity, a.abnormal_actual_quantity, a.abnormal_type, a.abnormal_reason, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag </sql>
<sql id="selectOutOrderAbnormalPo11">
a.out_order_abnormal_id, a.organization_id, a.organization_name, a.top_organization_id, a.abnormal_number, a.picking_order_number, a.out_task_order_number, a.type, a.actual_quantity, a.abnormal_actual_quantity, a.abnormal_type, a.abnormal_reason, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag </sql>
a.out_order_abnormal_id, a.organization_id, a.organization_name, a.top_organization_id, a.abnormal_number, a.picking_order_number, a.out_task_order_number, a.type, a.actual_quantity, a.quantity, a.abnormal_actual_quantity, a.abnormal_type, a.abnormal_reason, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag </sql>
<sql id="selectOutOrderAbnormalPo1">
<if test="organizationId != null ">
@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryList" parameterType="com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalDO" resultMap="OutOrderAbnormalResult">
select
<include refid="selectOutOrderAbnormalPo11"/>
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPo"/>
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPoYc"/>
from out_order_abnormal a
left join stock_out_order b on a.out_order_number = b.out_order_number
<where>
@@ -182,6 +182,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="queryTotalsByOutNumberAndBaseId" resultType="com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO">
SELECT
b.TOTAL_AREA,b.TOTAL_VOLUME,b.TOTAL_NET_WEIGHT,b.TOTAL_GROSS_WEIGHT
FROM
PICKING_MATERIAL_DETAIL b
WHERE
b.OUT_UNIQUE_ID = #{outUniqueId}
</select>
<update id="addQuantity" parameterType="com.mhd.wms.domain.pickingMaterialDetail.repository.todo.PickingMaterialDetailDOByUpdate">
UPDATE picking_material_detail
<set>
@@ -107,6 +107,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.priority_level_name, b.direct_warehouse, b.review, b.annex_url, b.quantity
</sql>
<sql id="joinStockOutOrderPoYc">
,b.notice_number, b.out_order_number, b.warehouse_id, b.warehouse_code, b.warehouse_name, b.shipper_id, b.shipper_code,
b.shipper_name, b.order_type_code, b.order_type_name, b.customer_id, b.customer_name, b.expect_time, b.supply_chain_number, b.priority_level_code,
b.priority_level_name, b.direct_warehouse, b.review, b.annex_url
</sql>
<sql id="selectStockOutOrderPo1">
<if test="outOrderId != null ">
and a.out_order_id = #{outOrderId}