shiyunteng
2026-10-14 800fe7bbdcd513c06d23dd568850d8eb05dd4d63
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.by4cloud.platformx.business.service.impl;
 
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.by4cloud.platformx.business.dto.PaymentSlipQueryDTO;
import com.by4cloud.platformx.business.dto.SyncPaymentRecepitDTO;
import com.by4cloud.platformx.business.entity.PaymentReceive;
import com.by4cloud.platformx.business.entity.PaymentSlip;
import com.by4cloud.platformx.business.mapper.PaymentReceiveMapper;
import com.by4cloud.platformx.business.mapper.PaymentSlipMapper;
import com.by4cloud.platformx.business.service.PaymentSlipService;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.math.BigDecimal;
import java.util.Date;
 
@Service
@Slf4j
@RequiredArgsConstructor
public class PaymentSlipServiceImpl extends ServiceImpl<PaymentSlipMapper, PaymentSlip> implements PaymentSlipService {
 
    private final PaymentReceiveMapper paymentReceiveMapper;
 
    @Override
    public Page pageScope(Page page, PaymentSlipQueryDTO queryDTO) {
        return baseMapper.pageScope(page,queryDTO, DataScope.of("comp_id"));
    }
 
    @Override
    public R genReceivePayment(SyncPaymentRecepitDTO dto) {
        //装备
        BigDecimal reveiceZb = paymentReceiveMapper.genReceivePayment(null);
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceZb,null);
        //石煤机
        BigDecimal reveiceSmj = paymentReceiveMapper.genReceivePaymentSmj();
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceSmj,2089995177814495234L);
        //石工泵
        BigDecimal reveiceSgb = paymentReceiveMapper.genReceivePayment(2056556196124250113L);
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceSgb,2056556196124250113L);
        //通方公司
        BigDecimal reveiceTfgs = paymentReceiveMapper.genReceivePayment(2056556421857497090L);
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceTfgs,2056556421857497090L);
        //机械厂
        BigDecimal reveiceJxc = paymentReceiveMapper.genReceivePayment(2056556317461270529L);
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceJxc,2056556317461270529L);
        //一煤机
        BigDecimal reveiceYmj = paymentReceiveMapper.genReceivePayment(2056556535640576002L);
        saveReceive(DateUtil.offsetDay(new Date(),-1),reveiceYmj,2056556535640576002L);
 
        return R.ok();
    }
 
    private void saveReceive(Date offsetDay, BigDecimal reveiceZb,Long compId) {
        PaymentReceive receive = new PaymentReceive();
        receive.setReceiveDate(offsetDay);
        receive.setCompId(compId);
        receive.setReceiveAmount(reveiceZb);
        paymentReceiveMapper.insert(receive);
    }
 
 
}