StatisticsFinancePageselectServiceImpl.java
8.47 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package com.lhcredit.project.business.statisticsFinancePageselect.service;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.lhcredit.project.business.apiFinance.domain.ApiFinance;
import com.lhcredit.project.business.apiFinance.service.IApiFinanceService;
import com.lhcredit.project.business.bCreditReport.domain.BCreditReport;
import com.lhcredit.project.business.bCreditReport.service.IBCreditReportService;
import com.lhcredit.project.business.frontDept.domain.FrontDept;
import com.lhcredit.project.business.frontDept.service.IFrontDeptService;
import com.lhcredit.project.business.frontUser.service.IFrontUserService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import com.lhcredit.project.business.statisticsFinancePageselect.mapper.StatisticsFinancePageselectMapper;
import com.lhcredit.project.business.statisticsFinancePageselect.domain.StatisticsFinancePageselect;
import com.lhcredit.common.utils.text.Convert;
import javax.annotation.Resource;
/**
* 前台财务调用统计 服务层实现
*
* @author lhcredit
* @date 2025-03-03
*/
@Service
public class StatisticsFinancePageselectServiceImpl implements IStatisticsFinancePageselectService {
@Resource
private StatisticsFinancePageselectMapper statisticsFinancePageselectMapper;
@Resource
private IFrontUserService userService;
@Resource
private IFrontDeptService deptService;
@Resource
private IApiFinanceService apiFinanceService;
@Resource
private IBCreditReportService bCreditReportService;
/**
* 查询前台财务调用统计信息
*
* @param id 前台财务调用统计ID
* @return 前台财务调用统计信息
*/
@Override
public StatisticsFinancePageselect selectStatisticsFinancePageselectById(Integer id) {
return statisticsFinancePageselectMapper.selectStatisticsFinancePageselectById(id);
}
/**
* 查询前台财务调用统计列表
*
* @param statisticsFinancePageselect 前台财务调用统计信息
* @return 前台财务调用统计集合
*/
@Override
public List<StatisticsFinancePageselect> selectStatisticsFinancePageselectList(StatisticsFinancePageselect statisticsFinancePageselect) {
return statisticsFinancePageselectMapper.selectStatisticsFinancePageselectList(statisticsFinancePageselect);
}
/**
* 字段转换
* @param statisticsFinancePageselect 前台财务调用统计信息
* @return 前台财务调用统计信息
*/
@Override
public StatisticsFinancePageselect changeModel(StatisticsFinancePageselect statisticsFinancePageselect) {
// //这里写各字段转换逻辑
if(statisticsFinancePageselect!=null){
// if(null!=(statisticsFinancePageselect.getUserId())){
// FrontUser frontUser = userService.selectFrontUserById(statisticsFinancePageselect.getUserId());
// statisticsFinancePageselect.setUserName(frontUser.getUserName());
// }
// if(null!=(statisticsFinancePageselect.getOrgId())){
// String allDeptNameForAdmin = deptService.getAllDeptNameForAdmin(statisticsFinancePageselect.getOrgId());
// statisticsFinancePageselect.setCreateBy(allDeptNameForAdmin);
// }
}
return statisticsFinancePageselect;
}
/**
* 列表转换
*
* @param statisticsFinancePageselectList 前台财务调用统计集合
* @return 前台财务调用统计集合
*/
@Override
public List<StatisticsFinancePageselect> changeModel(List<StatisticsFinancePageselect> statisticsFinancePageselectList) {
List<StatisticsFinancePageselect> result = new ArrayList<StatisticsFinancePageselect>();
if (statisticsFinancePageselectList.size() > 0) {
for (StatisticsFinancePageselect statisticsFinancePageselect:statisticsFinancePageselectList){
result.add(changeModel(statisticsFinancePageselect));
}
}
return result;
}
/**
* 新增前台财务调用统计
*
* @param statisticsFinancePageselect 前台财务调用统计信息
* @return 结果
*/
@Override
public int insertStatisticsFinancePageselect(StatisticsFinancePageselect statisticsFinancePageselect) {
return statisticsFinancePageselectMapper.insertStatisticsFinancePageselect(statisticsFinancePageselect);
}
/**
* 修改前台财务调用统计
*
* @param statisticsFinancePageselect 前台财务调用统计信息
* @return 结果
*/
@Override
public int updateStatisticsFinancePageselect(StatisticsFinancePageselect statisticsFinancePageselect) {
return statisticsFinancePageselectMapper.updateStatisticsFinancePageselect(statisticsFinancePageselect);
}
/**
* 删除前台财务调用统计对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteStatisticsFinancePageselectByIds(String ids) {
return statisticsFinancePageselectMapper.deleteStatisticsFinancePageselectByIds(Convert.toStrArray(ids));
}
@Override
public Integer selectCountByOrgId(String headId) {
return statisticsFinancePageselectMapper.selectCountByOrgId(headId);
}
@Override
public List<Object> selectCountByFinanceStatistics(Long orgId, String name) {
return statisticsFinancePageselectMapper.selectCountByFinanceStatistics(orgId,name);
}
@Override
public List<StatisticsFinancePageselect> getOrder(StatisticsFinancePageselect statisticsFinancePageselect) {
Long contractId = statisticsFinancePageselect.getParams().getLong("contractId");
if (Objects.nonNull(contractId)){
FrontDept frontDept = new FrontDept();
frontDept.setContractNum(contractId);
frontDept.setContractType("1");
FrontDept firstDept = Optional.ofNullable(deptService.selectFrontDeptList(frontDept))
.filter(depts -> !depts.isEmpty())
.map(depts -> depts.get(0))
.orElse(null);
if (Objects.nonNull(firstDept)){
Long orgId = firstDept.getId();
statisticsFinancePageselect.setOrgId(orgId);
}
}
List<StatisticsFinancePageselect> statisticsFinancePageselects = statisticsFinancePageselectMapper.selectStatisticsFinancePageselectList(statisticsFinancePageselect);
if (CollectionUtils.isEmpty(statisticsFinancePageselects)){
return new ArrayList<>();
}
statisticsFinancePageselects.forEach(statistics -> {
FrontDept frontDept = deptService.selectFrontDeptById(statistics.getOrgId());
statistics.setDeptName(frontDept.getDeptName());
});
return statisticsFinancePageselects;
}
@Override
public Integer updateStatus(String requestJson) {
JSONObject jsonObject = JSONObject.parseObject(requestJson);
List idList = jsonObject.getObject("idList", List.class);
if (CollectionUtils.isNotEmpty(idList)){
idList.forEach(id -> { //修改对账状态 type=1 信用报告数据 type=2 财务信息数据 type=3 税务信息数据
if (jsonObject.get("type").equals("1")){
BCreditReport bCreditReport = new BCreditReport();
bCreditReport.setId(id.toString());
bCreditReport.setReconciliation(jsonObject.getString("reconciliation"));
bCreditReportService.updateBCreditReport(bCreditReport);
}
if (jsonObject.get("type").equals("2")){
StatisticsFinancePageselect statisticsFinancePageselect = new StatisticsFinancePageselect();
statisticsFinancePageselect.setId(Integer.valueOf(id.toString()));
statisticsFinancePageselect.setReconciliation(jsonObject.getString("reconciliation"));
statisticsFinancePageselectMapper.updateStatisticsFinancePageselect(statisticsFinancePageselect);
}
if (jsonObject.get("type").equals("3")){
ApiFinance apiFinance = new ApiFinance();
apiFinance.setId(Integer.valueOf(id.toString()));
apiFinance.setReconciliation(jsonObject.getString("reconciliation"));
apiFinanceService.updateApiFinance(apiFinance);
}
});
return 1;
}
return 0;
}
}