|
@@ -1,26 +1,28 @@
|
|
|
package com.fjhx.form.service.impl;
|
|
|
|
|
|
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.fjhx.account.entity.account.po.AccountPayment;
|
|
|
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.constant.SourceConstant;
|
|
|
+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.purchase.entity.subscribe.po.SubscribeDetail;
|
|
|
+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.po.Contract;
|
|
|
-import com.fjhx.sale.entity.contract.po.ContractProduct;
|
|
|
import com.fjhx.sale.entity.contract.vo.ContractVo;
|
|
|
import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseVo;
|
|
|
-import com.fjhx.sale.entity.sample.po.Sample;
|
|
|
+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.service.stock.StockService;
|
|
|
+import com.fjhx.wms.service.stock.StockWaitDetailsService;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
@@ -49,6 +51,14 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
private CustomerService customerService;
|
|
|
@Autowired
|
|
|
private StatisticsMapper statisticsMapper;
|
|
|
+ @Autowired
|
|
|
+ private SaleQuotationService saleQuotationService;
|
|
|
+ @Autowired
|
|
|
+ private ProduceOrderService produceOrderService;
|
|
|
+ @Autowired
|
|
|
+ private StockService stockService;
|
|
|
+ @Autowired
|
|
|
+ private StockWaitDetailsService stockWaitDetailsService;
|
|
|
|
|
|
|
|
|
* 工作统计
|
|
@@ -57,59 +67,104 @@ public class StatisticsServiceImpl implements StatisticsService {
|
|
|
public Map<String, Long> workStatistics() {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
|
-
|
|
|
- Long unreadMailCount = 0L;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ boolean flag;
|
|
|
+ Long companyId = SecurityUtils.getCompanyId();
|
|
|
+ if (Objects.equals(companyId, 100L)) {
|
|
|
+
|
|
|
+ companyId = null;
|
|
|
+ flag = true;
|
|
|
+ } else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ Long finalCompanyId = companyId;
|
|
|
+
|
|
|
|
|
|
- DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
- long waitFlowCount = flowExampleService.count(q -> q.eq(FlowExample::getStatus, 1).eq(FlowExample::getHandleUserId, userId));
|
|
|
- DynamicDataSourceContextHolder.poll();
|
|
|
-
|
|
|
- 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 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())
|
|
|
+ .eq(!flag, SaleQuotation::getCompanyId, finalCompanyId)
|
|
|
+ );
|
|
|
+
|
|
|
+ long waitProduceCount = produceOrderService.count(q -> q
|
|
|
+ .isNull(ProductionOrder::getProduceTime)
|
|
|
+ .eq(!flag, ProductionOrder::getCompanyId, finalCompanyId)
|
|
|
+ );
|
|
|
+
|
|
|
+ StockWaitDetailsSelectDto stockWaitDetailsSelectDto = new StockWaitDetailsSelectDto();
|
|
|
+ stockWaitDetailsSelectDto.setType(1);
|
|
|
+ long waitInStockCount = stockWaitDetailsService.getPage(stockWaitDetailsSelectDto).getTotal();
|
|
|
+
|
|
|
+ StockWaitDetailsSelectDto stockWaitDetailsSelectDto1 = new StockWaitDetailsSelectDto();
|
|
|
+ stockWaitDetailsSelectDto1.setType(2);
|
|
|
+ long waitOutStockCount = stockWaitDetailsService.getPage(stockWaitDetailsSelectDto1).getTotal();
|
|
|
+
|
|
|
+ long waitClaimCount = accountRunningWaterService.count(q -> q
|
|
|
+ .eq(AccountRunningWater::getReceived, 10)
|
|
|
+ .eq(AccountRunningWater::getIsClaim, 0)
|
|
|
+ .eq(!flag, AccountRunningWater::getCompanyId, finalCompanyId)
|
|
|
+ );
|
|
|
+
|
|
|
+ long stockWarnCount = stockService.stockWarningPage(new StockSelectDto()).getTotal();
|
|
|
|
|
|
|
|
|
- long sumCount = unreadMailCount + waitFlowCount + claimCount + waitPurchaseCount + sampleHandoverCount + contractHandoverCount + waitAccountPayCount;
|
|
|
+ long sumCount = waitFlowCount + waitQuotationCount + waitProduceCount + waitInStockCount + waitOutStockCount;
|
|
|
+
|
|
|
+ if (flag) {
|
|
|
+ sumCount += waitClaimCount;
|
|
|
+ } else {
|
|
|
+ sumCount += stockWarnCount;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
- 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("waitQuotationCount", waitQuotationCount);
|
|
|
+ map.put("waitProduceCount", waitProduceCount);
|
|
|
+ map.put("waitInStockCount", waitInStockCount);
|
|
|
+ map.put("waitOutStockCount", waitOutStockCount);
|
|
|
+ map.put("waitClaimCount", waitClaimCount);
|
|
|
+ map.put("stockWarnCount", stockWarnCount);
|
|
|
map.put("sumCount", sumCount);
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return map;
|
|
|
}
|
|
|
|