|
@@ -1,27 +1,23 @@
|
|
|
package com.fjhx.form.service.impl;
|
|
|
|
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
|
-import com.fjhx.account.service.account.AccountPaymentService;
|
|
|
import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
-import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.fjhx.flow.entity.flow.po.FlowExample;
|
|
|
import com.fjhx.flow.service.flow.FlowExampleService;
|
|
|
import com.fjhx.form.mapper.StatisticsMapper;
|
|
|
import com.fjhx.form.service.StatisticsService;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionOrder;
|
|
|
import com.fjhx.mes.service.production.ProduceOrderService;
|
|
|
-import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
|
|
|
import com.fjhx.sale.entity.contract.vo.ContractVo;
|
|
|
import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseVo;
|
|
|
import com.fjhx.sale.entity.sale.po.SaleQuotation;
|
|
|
-import com.fjhx.sale.mapper.contract.ContractProductMapper;
|
|
|
-import com.fjhx.sale.mapper.sample.SampleMapper;
|
|
|
import com.fjhx.sale.service.sale.SaleQuotationService;
|
|
|
import com.fjhx.wms.entity.stock.dto.StockSelectDto;
|
|
|
-import com.fjhx.wms.entity.stock.dto.StockWaitDetailsSelectDto;
|
|
|
+import com.fjhx.wms.entity.stock.dto.StockWaitSelectDto;
|
|
|
import com.fjhx.wms.service.stock.StockService;
|
|
|
import com.fjhx.wms.service.stock.StockWaitDetailsService;
|
|
|
+import com.fjhx.wms.service.stock.StockWaitService;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -38,16 +34,6 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
@Autowired
|
|
|
private AccountRunningWaterService accountRunningWaterService;
|
|
|
@Autowired
|
|
|
- private SubscribeDetailService subscribeDetailService;
|
|
|
- @Autowired
|
|
|
- private SampleMapper sampleMapper;
|
|
|
- @Autowired
|
|
|
- private ContractProductMapper contractProductMapper;
|
|
|
- @Autowired
|
|
|
- private AccountPaymentService accountPaymentService;
|
|
|
- @Autowired
|
|
|
- private CustomerService customerService;
|
|
|
- @Autowired
|
|
|
private StatisticsMapper statisticsMapper;
|
|
|
@Autowired
|
|
|
private SaleQuotationService saleQuotationService;
|
|
@@ -57,6 +43,8 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
private StockService stockService;
|
|
|
@Autowired
|
|
|
private StockWaitDetailsService stockWaitDetailsService;
|
|
|
+ @Autowired
|
|
|
+ private StockWaitService stockWaitService;
|
|
|
|
|
|
/**
|
|
|
* 工作统计
|
|
@@ -66,43 +54,39 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
|
//权限过滤:子公司看自己的,总公司看全部
|
|
|
- boolean flag;//是否是总公司
|
|
|
List<Long> companyIds = SecurityUtils.getCompanyIds();
|
|
|
|
|
|
- if (companyIds.contains(100L)) {
|
|
|
- //总公司直接忽略归属公司条件
|
|
|
- flag = true;
|
|
|
- } else {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- List<Long> finalCompanyIds = companyIds;//isEstimate
|
|
|
+ //是否是总公司
|
|
|
+ boolean isHeadOffice = companyIds.contains(100L);
|
|
|
|
|
|
//统计待审批数据
|
|
|
long waitFlowCount = flowExampleService.count(q -> q.in(FlowExample::getStatus, 1, 0).eq(FlowExample::getHandleUserId, userId));
|
|
|
//待报价 总公司对内报价单 子公司 报价评估
|
|
|
long waitQuotationCount = saleQuotationService.count(q -> q
|
|
|
- .ne(!flag, SaleQuotation::getStatus, FlowStatusEnum1.DRAFT.getKey())//子公司
|
|
|
- .ne(SaleQuotation::getStatus, FlowStatusEnum1.UPDATE.getKey())//总公司
|
|
|
- .in(!flag, SaleQuotation::getCompanyId, finalCompanyIds)
|
|
|
+ //总公司
|
|
|
+ .in(SaleQuotation::getCompanyId, companyIds)
|
|
|
+ .ne(SaleQuotation::getStatus, FlowStatusEnum1.UPDATE.getKey())
|
|
|
+ //子公司
|
|
|
+ .ne(!isHeadOffice, SaleQuotation::getStatus, FlowStatusEnum1.DRAFT.getKey())
|
|
|
);
|
|
|
//待投产
|
|
|
long waitProduceCount = produceOrderService.count(q -> q
|
|
|
.isNull(ProductionOrder::getProduceTime)
|
|
|
- .in(!flag, ProductionOrder::getCompanyId, finalCompanyIds)
|
|
|
+ .in(!isHeadOffice, ProductionOrder::getCompanyId, companyIds)
|
|
|
);
|
|
|
//待入库
|
|
|
- StockWaitDetailsSelectDto stockWaitDetailsSelectDto = new StockWaitDetailsSelectDto();
|
|
|
- stockWaitDetailsSelectDto.setType(1);
|
|
|
- long waitInStockCount = stockWaitDetailsService.getPage(stockWaitDetailsSelectDto).getTotal();
|
|
|
+ StockWaitSelectDto stockWaitSelectDto = new StockWaitSelectDto();
|
|
|
+ stockWaitSelectDto.setType(1);
|
|
|
+ long waitInStockCount = stockWaitService.getPage(stockWaitSelectDto).getTotal();
|
|
|
//待出库
|
|
|
- StockWaitDetailsSelectDto stockWaitDetailsSelectDto1 = new StockWaitDetailsSelectDto();
|
|
|
- stockWaitDetailsSelectDto1.setType(2);
|
|
|
- long waitOutStockCount = stockWaitDetailsService.getPage(stockWaitDetailsSelectDto1).getTotal();
|
|
|
+ StockWaitSelectDto stockWaitSelectDto1 = new StockWaitSelectDto();
|
|
|
+ stockWaitSelectDto1.setType(2);
|
|
|
+ long waitOutStockCount = stockWaitService.getPage(stockWaitSelectDto1).getTotal();
|
|
|
//到账认领待认领计数-总公司
|
|
|
long waitClaimCount = accountRunningWaterService.count(q -> q
|
|
|
.eq(AccountRunningWater::getReceived, 10)
|
|
|
.eq(AccountRunningWater::getIsClaim, 0)
|
|
|
- .in(!flag, AccountRunningWater::getCompanyId, finalCompanyIds)
|
|
|
+ .in(!isHeadOffice, AccountRunningWater::getCompanyId, companyIds)
|
|
|
);
|
|
|
//库存预警-子公司看
|
|
|
long stockWarnCount = stockService.stockWarningPage(new StockSelectDto()).getTotal();
|
|
@@ -110,13 +94,12 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
//总数
|
|
|
long sumCount = waitFlowCount + waitQuotationCount + waitProduceCount + waitInStockCount + waitOutStockCount;
|
|
|
|
|
|
- if (flag) {
|
|
|
+ if (isHeadOffice) {
|
|
|
sumCount += waitClaimCount;//总公司待认领
|
|
|
} else {
|
|
|
sumCount += stockWarnCount;//子公司库存预警
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//输出结果
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
map.put("waitFlowCount", waitFlowCount);
|
|
@@ -128,41 +111,6 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
map.put("stockWarnCount", stockWarnCount);
|
|
|
map.put("sumCount", sumCount);
|
|
|
|
|
|
-
|
|
|
-// //到账认领计数
|
|
|
-// long claimCount = accountRunningWaterService.count(q -> q.eq(AccountRunningWater::getReceived, 10).ne(AccountRunningWater::getIsClaim, 1));
|
|
|
-// //待采购数量
|
|
|
-// long waitPurchaseCount = subscribeDetailService.count(q -> q.in(SubscribeDetail::getStatus, Arrays.asList(15, 30)));
|
|
|
-// //样品交接单
|
|
|
-// Page<Object> page = new Page<>();
|
|
|
-// page.setCurrent(1);
|
|
|
-// page.setSize(1);
|
|
|
-// IWrapper<Sample> wrapper = IWrapper.getWrapper();
|
|
|
-// wrapper.eq("t2.`status`", 30);
|
|
|
-// wrapper.ge("t1.expend_quantity", 0);
|
|
|
-// long sampleHandoverCount = sampleMapper.sampleHandoverList(page, wrapper).getTotal();
|
|
|
-// //合同样品单
|
|
|
-// IWrapper<ContractProduct> wrapper1 = IWrapper.getWrapper();
|
|
|
-// wrapper.eq("t2.`status`", 30);
|
|
|
-// wrapper.ge("t1.expend_quantity", 0);
|
|
|
-// long contractHandoverCount = contractProductMapper.contractHandoverPage(page, wrapper1).getTotal();
|
|
|
-// //待打款
|
|
|
-// long waitAccountPayCount = accountPaymentService.count(q -> q.ne(AccountPayment::getStatus, 10));
|
|
|
-
|
|
|
- //总数
|
|
|
-// long sumCount = unreadMailCount + waitFlowCount + claimCount + waitPurchaseCount + sampleHandoverCount + contractHandoverCount + waitAccountPayCount;
|
|
|
-
|
|
|
-
|
|
|
-// map.put("unreadMailCount", unreadMailCount);
|
|
|
-// map.put("waitFlowCount", waitFlowCount);
|
|
|
-// map.put("claimCount", claimCount);
|
|
|
-// map.put("waitPurchaseCount", waitPurchaseCount);
|
|
|
-// map.put("sampleHandoverCount", sampleHandoverCount);
|
|
|
-// map.put("contractHandoverCount", contractHandoverCount);
|
|
|
-// map.put("waitAccountPayCount", waitAccountPayCount);
|
|
|
-// map.put("sumCount", sumCount);
|
|
|
-
|
|
|
-
|
|
|
return map;
|
|
|
}
|
|
|
|