fei.wang
2024-05-13 b9b58b9ef261cb290d93465f88a2cbd814b576f0
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
 
package com.flow.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.flow.mapper.ChongZhMapper;
import com.flow.mapper.ManagerMapper;
import com.flow.mapper.TbFuwuqiMapper;
import com.flow.mapper.zongInvoicesMapper;
import com.flow.pojo.*;
import com.flow.service.DuanxinlogService;
import com.flow.service.zongInvoicesService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Random;
 
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service
public class ZongInvoiceServiceImpl extends ServiceImpl<zongInvoicesMapper, Zonginvoices> implements zongInvoicesService {
    private String SecretId = "AKIDrjZOI4e6KLZu9FAsSRN8eOwSt52lbMBz";
    private String SecretKey = "xnRtHUL3YqdMyOLVSBjKkz1pQoxujS4d";
    @Autowired
    ManagerMapper managerMapper;
 
    @Autowired
    DuanxinlogService duanxinlogService;
    public ZongInvoiceServiceImpl() {
    }
 
    public PageInfo<Zonginvoices> findinvoicesjilu(Integer page, Integer limit) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("none", "0");
        PageHelper.startPage(page, limit);
        List<Zonginvoices> cardList = ((zongInvoicesMapper)this.baseMapper).selectList(queryWrapper);
        PageInfo<Zonginvoices> info = new PageInfo(cardList);
        return info;
    }
 
    public PageInfo<Zonginvoices> findinvoicesjilu(Integer page, Integer limit, Zonginvoices zonginvoices) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("none", "0");
        queryWrapper.eq("company", zonginvoices.getCompany());
        PageHelper.startPage(page, limit);
        List<Zonginvoices> cardList = ((zongInvoicesMapper)this.baseMapper).selectList(queryWrapper);
        PageInfo<Zonginvoices> info = new PageInfo(cardList);
        return info;
    }
 
    public int zongfpadd(Zonginvoices zonginvoices) throws TencentCloudSDKException {
        Credential cred = new Credential(this.SecretId, this.SecretKey);
        HttpProfile httpProfile = new HttpProfile();
        httpProfile.setEndpoint("sms.tencentcloudapi.com");
        ClientProfile clientProfile = new ClientProfile();
        clientProfile.setHttpProfile(httpProfile);
        SmsClient client = new SmsClient(cred, "ap-beijing", clientProfile);
        SendSmsRequest req = new SendSmsRequest();
//        String[] phoneNumberSet1 = new String[]{"15210640466"};
//        req.setPhoneNumberSet(phoneNumberSet1);
        QueryWrapper sms = new QueryWrapper();
        sms.eq("none", "0");
        sms.eq("smsreception", "1");
        List<Manager> managerList = (managerMapper).selectList(sms);
        String phone = new String();
        for (int s=0;s<managerList.size();s++){
//                        System.out.println(managerList.get(s).getPhone());
//                        phoneNumberSet1[s] = managerList.get(s).getPhone();
            String[] phoneNumberSet12  = {managerList.get(s).getPhone()};
            System.out.println(phoneNumberSet12);
            req.setPhoneNumberSet(phoneNumberSet12);
            if (s+1==managerList.size()){
                phone+=managerList.get(s).getPhone();
            }else{
                phone+=managerList.get(s).getPhone()+",";
            }
            req.setSmsSdkAppId("1400838975");
            req.setSignName("北京华星北斗智控");
            req.setTemplateId("2127736");
 
            String[] templateParamSet1 = {String.valueOf(zonginvoices.getCompany())};
 
            req.setTemplateParamSet(templateParamSet1);
            // 返回的resp是一个SendSmsResponse的实例,与请求对象对应
            SendSmsResponse resp = client.SendSms(req);
            System.out.println(SendSmsResponse.toJsonString(resp));
        }
//        req.setSmsSdkAppId("1400838975");
//        req.setSignName("北京华星北斗智控");
//        req.setTemplateId("2127736");
//            String[] templateParamSet1 = new String[]{cardNum};
//            req.setTemplateParamSet(templateParamSet1);
//            SendSmsResponse resp = client.SendSms(req);
//            System.out.println(SendSmsResponse.toJsonString(resp));
        Duanxinlog duanxinlog = new Duanxinlog();
        duanxinlog.setIdentification("申请开发票");
        duanxinlog.setReceiver(zonginvoices.getFptt());
        duanxinlog.setNumber(phone);
        duanxinlog.setContent(zonginvoices.getFptt()+"提交了开具发票申请,请及时处理。");
        this.duanxinlogService.addDuanxinlog(duanxinlog);
 
        return ((zongInvoicesMapper)this.baseMapper).insert(zonginvoices);
    }
 
    public Zonginvoices findsqnum(Zonginvoices zonginvoices) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("sqnum", zonginvoices.getSqnum());
        return (Zonginvoices)((zongInvoicesMapper)this.baseMapper).selectOne(queryWrapper);
    }
    public int UpdateKaiPiao(Zonginvoices zonginvoices) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("sqnum", zonginvoices.getSqnum());
//        TbFuwuqi tbFuwuqi1 = (TbFuwuqi)((TbFuwuqiMapper)this.baseMapper).selectOne(queryWrapper);
//        OperationLog operationLog = new OperationLog();
//        operationLog.setCaozuotype("修改");
//        operationLog.setCaozuocontent("修改服务器:"+tbFuwuqi1.getServername());
//        operationLogService.addOperationLog(operationLog);
 
        return ((zongInvoicesMapper) this.baseMapper).update(zonginvoices, queryWrapper);
    }
 
 
    public int DeleteKaiPiao(String kaipiaoId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("sqnum", kaipiaoId);
        Zonginvoices zonginvoices = new Zonginvoices();
        zonginvoices.setNone("1");
//        Company company1 = (Company)((CompanyMapper)this.baseMapper).selectOne(queryWrapper);
//        OperationLog operationLog = new OperationLog();
//        operationLog.setCaozuotype("删除");
//        operationLog.setCaozuocontent("删除公司:"+company1.getCompanyname());
//        operationLogService.addOperationLog(operationLog);
        return ((zongInvoicesMapper)this.baseMapper).update(zonginvoices, queryWrapper);
    }
 
    public int adddanhao(Zonginvoices zonginvoices) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("sqnum", zonginvoices.getSqnum());
        return ((zongInvoicesMapper)this.baseMapper).update(zonginvoices, queryWrapper);
    }
 
    public PageInfo<Zonginvoices> tableSearch(Zonginvoices manager, int page, int limit) throws Exception {
        QueryWrapper queryWrapper = new QueryWrapper();
        PageHelper.startPage(page, limit);
        PageInfo<Zonginvoices> info = null;
        queryWrapper.like("fptt", manager.getFptt());
        queryWrapper.eq("none", 0);
        info = new PageInfo(((zongInvoicesMapper) this.baseMapper).selectList(queryWrapper));
 
 
        return info;
    }
 
}