|
@@ -9,18 +9,25 @@ import com.lframework.starter.web.core.components.resp.InvokeResult; |
|
@@ -9,18 +9,25 @@ import com.lframework.starter.web.core.components.resp.InvokeResult; |
|
9
|
import javax.annotation.Resource;
|
9
|
import javax.annotation.Resource;
|
|
10
|
import javax.validation.constraints.NotBlank;
|
10
|
import javax.validation.constraints.NotBlank;
|
|
11
|
import com.lframework.starter.web.inner.bo.system.user.QuerySysUserBo;
|
11
|
import com.lframework.starter.web.inner.bo.system.user.QuerySysUserBo;
|
|
|
|
12
|
+import com.lframework.starter.web.inner.entity.SysDataDicItem;
|
|
12
|
import com.lframework.starter.web.inner.entity.SysDept;
|
13
|
import com.lframework.starter.web.inner.entity.SysDept;
|
|
13
|
import com.lframework.starter.web.inner.entity.SysUser;
|
14
|
import com.lframework.starter.web.inner.entity.SysUser;
|
|
|
|
15
|
+import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
|
|
14
|
import com.lframework.starter.web.inner.service.system.SysDeptService;
|
16
|
import com.lframework.starter.web.inner.service.system.SysDeptService;
|
|
15
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
17
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
|
16
|
import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
|
18
|
import com.lframework.starter.web.inner.vo.system.user.QuerySysUserVo;
|
|
|
|
19
|
+import com.lframework.xingyun.sc.bo.ledger.detail.GetFundOrderingUnitDetailBo;
|
|
17
|
import com.lframework.xingyun.sc.bo.ledger.fund.GetFundCoordinationBo;
|
20
|
import com.lframework.xingyun.sc.bo.ledger.fund.GetFundCoordinationBo;
|
|
18
|
import com.lframework.xingyun.sc.bo.ledger.fund.QueryFundCoordinationBo;
|
21
|
import com.lframework.xingyun.sc.bo.ledger.fund.QueryFundCoordinationBo;
|
|
|
|
22
|
+import com.lframework.xingyun.sc.bo.ledger.rel.GetFundOrderingUnitBo;
|
|
19
|
import com.lframework.xingyun.sc.entity.FundCoordination;
|
23
|
import com.lframework.xingyun.sc.entity.FundCoordination;
|
|
|
|
24
|
+import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo;
|
|
20
|
import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
|
25
|
import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
|
|
|
|
26
|
+import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService;
|
|
21
|
import com.lframework.xingyun.sc.vo.ledger.fund.CreateFundCoordinationVo;
|
27
|
import com.lframework.xingyun.sc.vo.ledger.fund.CreateFundCoordinationVo;
|
|
22
|
import com.lframework.xingyun.sc.vo.ledger.fund.QueryFundCoordinationVo;
|
28
|
import com.lframework.xingyun.sc.vo.ledger.fund.QueryFundCoordinationVo;
|
|
23
|
import com.lframework.xingyun.sc.vo.ledger.fund.UpdateFundCoordinationVo;
|
29
|
import com.lframework.xingyun.sc.vo.ledger.fund.UpdateFundCoordinationVo;
|
|
|
|
30
|
+import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo;
|
|
24
|
import io.swagger.annotations.ApiImplicitParam;
|
31
|
import io.swagger.annotations.ApiImplicitParam;
|
|
25
|
import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
|
32
|
import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
|
|
26
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
33
|
import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
|
@@ -32,7 +39,12 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -32,7 +39,12 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
32
|
import org.springframework.validation.annotation.Validated;
|
39
|
import org.springframework.validation.annotation.Validated;
|
|
33
|
import org.springframework.web.bind.annotation.*;
|
40
|
import org.springframework.web.bind.annotation.*;
|
|
34
|
import javax.validation.Valid;
|
41
|
import javax.validation.Valid;
|
|
|
|
42
|
+import java.time.LocalDate;
|
|
|
|
43
|
+import java.time.temporal.ChronoUnit;
|
|
|
|
44
|
+import java.util.ArrayList;
|
|
|
|
45
|
+import java.util.Comparator;
|
|
35
|
import java.util.List;
|
46
|
import java.util.List;
|
|
|
|
47
|
+import java.util.Map;
|
|
36
|
import java.util.stream.Collectors;
|
48
|
import java.util.stream.Collectors;
|
|
37
|
|
49
|
|
|
38
|
/**
|
50
|
/**
|
|
@@ -51,6 +63,10 @@ public class FundCoordinationController extends DefaultBaseController { |
|
@@ -51,6 +63,10 @@ public class FundCoordinationController extends DefaultBaseController { |
|
51
|
private SysDeptService sysDeptService;
|
63
|
private SysDeptService sysDeptService;
|
|
52
|
@Resource
|
64
|
@Resource
|
|
53
|
private SysUserService sysUserService;
|
65
|
private SysUserService sysUserService;
|
|
|
|
66
|
+ @Resource
|
|
|
|
67
|
+ private ReceiptLedgerInfoService receiptLedgerInfoService;
|
|
|
|
68
|
+ @Resource
|
|
|
|
69
|
+ private SysDataDicItemService sysDataDicItemService;
|
|
54
|
|
70
|
|
|
55
|
/**
|
71
|
/**
|
|
56
|
* 查询列表
|
72
|
* 查询列表
|
|
@@ -147,4 +163,87 @@ public class FundCoordinationController extends DefaultBaseController { |
|
@@ -147,4 +163,87 @@ public class FundCoordinationController extends DefaultBaseController { |
|
147
|
}
|
163
|
}
|
|
148
|
return InvokeResultBuilder.success(results);
|
164
|
return InvokeResultBuilder.success(results);
|
|
149
|
}
|
165
|
}
|
|
|
|
166
|
+
|
|
|
|
167
|
+ @ApiOperation("查询")
|
|
|
|
168
|
+ @PostMapping("/getBaseInfo")
|
|
|
|
169
|
+ public InvokeResult<List<GetFundCoordinationBo>> getBaseInfo(@RequestBody(required = false) List<String> ids) {
|
|
|
|
170
|
+ if (CollectionUtil.isEmpty(ids)) {
|
|
|
|
171
|
+ return InvokeResultBuilder.success(CollectionUtil.emptyList());
|
|
|
|
172
|
+ }
|
|
|
|
173
|
+ QueryReceiptLedgerInfoVo vo = new QueryReceiptLedgerInfoVo();
|
|
|
|
174
|
+ vo.setCustomerShortId(ids.get(0));
|
|
|
|
175
|
+ vo.setIncludeEndAccountReceivable(true);
|
|
|
|
176
|
+ List<ReceiptLedgerInfo> query = receiptLedgerInfoService.query(vo);
|
|
|
|
177
|
+ if (CollectionUtil.isEmpty(query)) {
|
|
|
|
178
|
+ return InvokeResultBuilder.success(CollectionUtil.emptyList());
|
|
|
|
179
|
+ }
|
|
|
|
180
|
+ List<GetFundCoordinationBo> data = new ArrayList<>();
|
|
|
|
181
|
+ GetFundCoordinationBo getFundCoordinationBo = new GetFundCoordinationBo();
|
|
|
|
182
|
+ ReceiptLedgerInfo receiptLedgerInfo = query.get(0);
|
|
|
|
183
|
+ //客户类型
|
|
|
|
184
|
+ getFundCoordinationBo.setCustomerType(receiptLedgerInfo.getCustomerType());
|
|
|
|
185
|
+// SysDataDicItem type = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", receiptLedgerInfo.getCustomerType());
|
|
|
|
186
|
+// getFundCoordinationBo.setCustomerTypeName(type == null ? "" : type.getName());
|
|
|
|
187
|
+ //客户简称
|
|
|
|
188
|
+ getFundCoordinationBo.setCustomerShortId(receiptLedgerInfo.getCustomerShortId());
|
|
|
|
189
|
+ getFundCoordinationBo.setCustomerShortName(receiptLedgerInfo.getCustomerShortName());
|
|
|
|
190
|
+ //授权额度
|
|
|
|
191
|
+ if (receiptLedgerInfo.getQuota() != null) {
|
|
|
|
192
|
+ getFundCoordinationBo.setCreditLimit(receiptLedgerInfo.getQuota().stripTrailingZeros().toPlainString() + "万");
|
|
|
|
193
|
+ }
|
|
|
|
194
|
+ //结算期限
|
|
|
|
195
|
+ getFundCoordinationBo.setSettlementPeriod(receiptLedgerInfo.getSettleTerm());
|
|
|
|
196
|
+ Map<String, List<ReceiptLedgerInfo>> map = query.stream()
|
|
|
|
197
|
+ .collect(Collectors.groupingBy(ReceiptLedgerInfo::getCustomerId));
|
|
|
|
198
|
+ StringBuilder customerNameStr = new StringBuilder();
|
|
|
|
199
|
+ //订货单位集合
|
|
|
|
200
|
+ List<GetFundOrderingUnitBo> fundOrderingUnitList = new ArrayList<>();
|
|
|
|
201
|
+ for (Map.Entry<String, List<ReceiptLedgerInfo>> entry : map.entrySet()) {
|
|
|
|
202
|
+ String customerId = entry.getKey();
|
|
|
|
203
|
+ List<ReceiptLedgerInfo> receiptList = entry.getValue();
|
|
|
|
204
|
+ customerNameStr.append(receiptList.get(0).getCustomerName()).append("、");
|
|
|
|
205
|
+ GetFundOrderingUnitBo bo = new GetFundOrderingUnitBo();
|
|
|
|
206
|
+ bo.setOrderingUnit(customerId);
|
|
|
|
207
|
+ bo.setOrderingUnitName(receiptList.get(0).getCustomerName());
|
|
|
|
208
|
+ System.out.println("Customer ID: " + customerId);
|
|
|
|
209
|
+ //订货单位应收款明细
|
|
|
|
210
|
+ List<GetFundOrderingUnitDetailBo> fundOrderingUnitDetailList = new ArrayList<>();
|
|
|
|
211
|
+ for (ReceiptLedgerInfo receipt : receiptList) {
|
|
|
|
212
|
+ GetFundOrderingUnitDetailBo bo1 = new GetFundOrderingUnitDetailBo();
|
|
|
|
213
|
+ bo1.setDeliveryDate(receipt.getShipmentDate());
|
|
|
|
214
|
+ if (receipt.getStartAccountReceivable() != null) {
|
|
|
|
215
|
+ bo1.setAccountsReceivable(receipt.getStartAccountReceivable().stripTrailingZeros().toPlainString());
|
|
|
|
216
|
+ }
|
|
|
|
217
|
+ SysDataDicItem sysDataDicItem = sysDataDicItemService.findByCode("DEBT_STATUS", receipt.getDebtStatus());
|
|
|
|
218
|
+ if (!(sysDataDicItem != null && (sysDataDicItem.getCode().equals("FIRST_COORDINATE")
|
|
|
|
219
|
+ || sysDataDicItem.getCode().equals("SECOND") || sysDataDicItem.getCode().equals("CLEAR_DEBTS")))) {
|
|
|
|
220
|
+ continue;
|
|
|
|
221
|
+ }
|
|
|
|
222
|
+ bo1.setStatus(sysDataDicItem.getName());
|
|
|
|
223
|
+ bo1.setDueDate(receipt.getProcessedDate());
|
|
|
|
224
|
+ if (bo1.getDueDate() != null) {
|
|
|
|
225
|
+ long daysBetween = ChronoUnit.DAYS.between(bo1.getDueDate(), LocalDate.now());
|
|
|
|
226
|
+ bo1.setTimeout(String.valueOf(daysBetween));
|
|
|
|
227
|
+ }
|
|
|
|
228
|
+ fundOrderingUnitDetailList.add(bo1);
|
|
|
|
229
|
+ }
|
|
|
|
230
|
+ //排序
|
|
|
|
231
|
+ fundOrderingUnitDetailList.sort((a, b) -> {
|
|
|
|
232
|
+ Long aVal = a.getTimeout() == null ? null : Long.valueOf(a.getTimeout());
|
|
|
|
233
|
+ Long bVal = b.getTimeout() == null ? null : Long.valueOf(b.getTimeout());
|
|
|
|
234
|
+ return Comparator.<Long>reverseOrder().compare(aVal, bVal);
|
|
|
|
235
|
+ });
|
|
|
|
236
|
+ bo.setFundOrderingUnitDetailList(fundOrderingUnitDetailList);
|
|
|
|
237
|
+ fundOrderingUnitList.add(bo);
|
|
|
|
238
|
+ }
|
|
|
|
239
|
+ //订货单位名称
|
|
|
|
240
|
+ if (customerNameStr.length() > 0) {
|
|
|
|
241
|
+ customerNameStr.deleteCharAt(customerNameStr.length() - 1);
|
|
|
|
242
|
+ }
|
|
|
|
243
|
+ getFundCoordinationBo.setOrderingUnitName(customerNameStr.toString());
|
|
|
|
244
|
+ getFundCoordinationBo.setFundOrderingUnitList(fundOrderingUnitList);
|
|
|
|
245
|
+ data.add(getFundCoordinationBo);
|
|
|
|
246
|
+
|
|
|
|
247
|
+ return InvokeResultBuilder.success(data);
|
|
|
|
248
|
+ }
|
|
150
|
} |
249
|
} |