|
@@ -30,7 +30,6 @@ import org.springframework.stereotype.Service;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class StatisticsServiceImpl implements StatisticsService {
|
|
public class StatisticsServiceImpl implements StatisticsService {
|
|
@@ -68,15 +67,15 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
|
|
|
//权限过滤:子公司看自己的,总公司看全部
|
|
//权限过滤:子公司看自己的,总公司看全部
|
|
boolean flag;//是否是总公司
|
|
boolean flag;//是否是总公司
|
|
- Long companyId = SecurityUtils.getCompanyId();
|
|
|
|
- if (Objects.equals(companyId, 100L)) {
|
|
|
|
|
|
+ List<Long> companyIds = SecurityUtils.getCompanyIds();
|
|
|
|
+
|
|
|
|
+ if (companyIds.contains(100L)) {
|
|
//总公司直接忽略归属公司条件
|
|
//总公司直接忽略归属公司条件
|
|
- companyId = null;
|
|
|
|
flag = true;
|
|
flag = true;
|
|
} else {
|
|
} else {
|
|
flag = false;
|
|
flag = false;
|
|
}
|
|
}
|
|
- Long finalCompanyId = companyId;//isEstimate
|
|
|
|
|
|
+ List<Long> finalCompanyIds = companyIds;//isEstimate
|
|
|
|
|
|
//统计待审批数据
|
|
//统计待审批数据
|
|
long waitFlowCount = flowExampleService.count(q -> q.in(FlowExample::getStatus, 1, 0).eq(FlowExample::getHandleUserId, userId));
|
|
long waitFlowCount = flowExampleService.count(q -> q.in(FlowExample::getStatus, 1, 0).eq(FlowExample::getHandleUserId, userId));
|
|
@@ -84,12 +83,12 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
long waitQuotationCount = saleQuotationService.count(q -> q
|
|
long waitQuotationCount = saleQuotationService.count(q -> q
|
|
.ne(!flag, SaleQuotation::getStatus, FlowStatusEnum1.DRAFT.getKey())//子公司
|
|
.ne(!flag, SaleQuotation::getStatus, FlowStatusEnum1.DRAFT.getKey())//子公司
|
|
.ne(SaleQuotation::getStatus, FlowStatusEnum1.UPDATE.getKey())//总公司
|
|
.ne(SaleQuotation::getStatus, FlowStatusEnum1.UPDATE.getKey())//总公司
|
|
- .eq(!flag, SaleQuotation::getCompanyId, finalCompanyId)
|
|
|
|
|
|
+ .in(!flag, SaleQuotation::getCompanyId, finalCompanyIds)
|
|
);
|
|
);
|
|
//待投产
|
|
//待投产
|
|
long waitProduceCount = produceOrderService.count(q -> q
|
|
long waitProduceCount = produceOrderService.count(q -> q
|
|
.isNull(ProductionOrder::getProduceTime)
|
|
.isNull(ProductionOrder::getProduceTime)
|
|
- .eq(!flag, ProductionOrder::getCompanyId, finalCompanyId)
|
|
|
|
|
|
+ .in(!flag, ProductionOrder::getCompanyId, finalCompanyIds)
|
|
);
|
|
);
|
|
//待入库
|
|
//待入库
|
|
StockWaitDetailsSelectDto stockWaitDetailsSelectDto = new StockWaitDetailsSelectDto();
|
|
StockWaitDetailsSelectDto stockWaitDetailsSelectDto = new StockWaitDetailsSelectDto();
|
|
@@ -103,7 +102,7 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
long waitClaimCount = accountRunningWaterService.count(q -> q
|
|
long waitClaimCount = accountRunningWaterService.count(q -> q
|
|
.eq(AccountRunningWater::getReceived, 10)
|
|
.eq(AccountRunningWater::getReceived, 10)
|
|
.eq(AccountRunningWater::getIsClaim, 0)
|
|
.eq(AccountRunningWater::getIsClaim, 0)
|
|
- .eq(!flag, AccountRunningWater::getCompanyId, finalCompanyId)
|
|
|
|
|
|
+ .in(!flag, AccountRunningWater::getCompanyId, finalCompanyIds)
|
|
);
|
|
);
|
|
//库存预警-子公司看
|
|
//库存预警-子公司看
|
|
long stockWarnCount = stockService.stockWarningPage(new StockSelectDto()).getTotal();
|
|
long stockWarnCount = stockService.stockWarningPage(new StockSelectDto()).getTotal();
|
|
@@ -171,11 +170,10 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
public List<ContractVo> getRecentContractShipmentList() {
|
|
public List<ContractVo> getRecentContractShipmentList() {
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper();
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper();
|
|
|
|
|
|
- //权限过滤:近期出货合同-子公司看自己的,总公司看全部
|
|
|
|
- Long companyId = SecurityUtils.getCompanyId();
|
|
|
|
- if (!Objects.equals(companyId, 100L)) {
|
|
|
|
- wrapper.eq("c.company_id", companyId);
|
|
|
|
- }
|
|
|
|
|
|
+ //权限过滤:近期出货合同
|
|
|
|
+ wrapper.in("c.company_id", SecurityUtils.getCompanyIds());
|
|
|
|
+
|
|
|
|
+
|
|
wrapper.eq("c.status", 30);
|
|
wrapper.eq("c.status", 30);
|
|
wrapper.ge("DATEDIFF(c.delivery_time,NOW())", 0);
|
|
wrapper.ge("DATEDIFF(c.delivery_time,NOW())", 0);
|
|
wrapper.le("DATEDIFF(c.delivery_time,NOW())", 7);
|
|
wrapper.le("DATEDIFF(c.delivery_time,NOW())", 7);
|
|
@@ -187,11 +185,9 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
public List<EhsdPurchaseVo> getRecentPurchaseArrivalList() {
|
|
public List<EhsdPurchaseVo> getRecentPurchaseArrivalList() {
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper();
|
|
IWrapper<Object> wrapper = IWrapper.getWrapper();
|
|
|
|
|
|
- //权限过滤:近期出货合同-子公司看自己的,总公司看全部
|
|
|
|
- Long companyId = SecurityUtils.getCompanyId();
|
|
|
|
- if (!Objects.equals(companyId, 100L)) {
|
|
|
|
- wrapper.eq("p.company_id", companyId);
|
|
|
|
- }
|
|
|
|
|
|
+ //权限过滤:近期出货合同
|
|
|
|
+ wrapper.in("p.company_id", SecurityUtils.getCompanyIds());
|
|
|
|
+
|
|
|
|
|
|
wrapper.ge("DATEDIFF(p.delivery_time,NOW())", 0);
|
|
wrapper.ge("DATEDIFF(p.delivery_time,NOW())", 0);
|
|
wrapper.le("DATEDIFF(p.delivery_time,NOW())", 7);
|
|
wrapper.le("DATEDIFF(p.delivery_time,NOW())", 7);
|