|
@@ -47,11 +47,9 @@ import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.sql.Timestamp;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@Api(tags = "收票 数据接口")
|
|
@@ -97,7 +95,7 @@ public class BizCollectionController extends BaseController {
|
|
|
setTenantId(collection);
|
|
|
try {
|
|
|
Long id = collection.getId();
|
|
|
- collection.setFormDate(collection.getFormDate() != null ? collection.getFormDate() :DateTime.now().toTimestamp());
|
|
|
+ collection.setFormDate(collection.getFormDate() != null ? collection.getFormDate() : DateTime.now().toTimestamp());
|
|
|
collection.setId(collection.getId() == null || collection.getId().equals(0L) ? snowflakeIdWorker.nextId() : collection.getId());
|
|
|
|
|
|
if (collection.getFlowNo() == null || collection.getFlowNo().isEmpty()) {
|
|
@@ -156,6 +154,46 @@ public class BizCollectionController extends BaseController {
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出收款管理
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:collection:export')")
|
|
|
+ @Log(title = "收款管理", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, BizCollection conditions) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ setTenantId(conditions);
|
|
|
+ startPage();
|
|
|
+ startOrderBy();
|
|
|
+ List<BizCollection> list = collectionService.getListByBean(conditions);
|
|
|
+ list.forEach(l -> {
|
|
|
+ switch (l.getStatus()){
|
|
|
+ case 0:
|
|
|
+ l.setStatusName("未审核");
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ l.setStatusName("审核通过");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ l.setStatusName("审核不通过");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ switch (l.getArriveStatus()){
|
|
|
+ case 0:
|
|
|
+ l.setArriveStatusName("未支付");
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ l.setArriveStatusName("已支付");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ l.setArriveStatusName("部分支付");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ ExcelUtil<BizCollection> util = new ExcelUtil<BizCollection>(BizCollection.class);
|
|
|
+ util.exportExcel(response, list, "收款信息");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("获取待收款合同")
|
|
|
@GetMapping("/getWaitForCollection")
|
|
|
@PreAuthorize("@ss.hasPermi('business:waitForCollection:list')")
|
|
@@ -222,18 +260,15 @@ public class BizCollectionController extends BaseController {
|
|
|
AtomicBoolean collectionCheck = new AtomicBoolean(true);
|
|
|
collection.getDetails().forEach(l -> {
|
|
|
l.setCollectionId(collection.getId());
|
|
|
-// l.getDetails().forEach(v -> {
|
|
|
-// l.setId(l.getId() == null || l.getId().equals(0L) ? 0L : l.getId());
|
|
|
BigDecimal arriveAmount = l.getArriveAmount();
|
|
|
Map<String, Object> map = new HashMap<>(2);
|
|
|
map.put("contractDetailId", l.getContractDetailId());
|
|
|
map.put("verifyStatus", 1);
|
|
|
List<BizCollectionDetail> vDetail = collectionDetailService.getList(map);
|
|
|
-// .eq("contract_detail_id", v.getContractDetailId()).ne("id", v.getId()).list();
|
|
|
arriveAmount = arriveAmount.add(BigDecimal.valueOf(vDetail.stream().mapToDouble(t -> t.getArriveAmount().doubleValue()).sum()));
|
|
|
BizArchiveInputDetail contractDetail = contractDetailService.getById(l.getContractDetailId());
|
|
|
collectionCheck.set(collectionCheck.get() && (contractDetail.getAmount().compareTo(arriveAmount) >= 0));
|
|
|
-// });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
if (!collectionCheck.get()) {
|
|
@@ -252,8 +287,8 @@ public class BizCollectionController extends BaseController {
|
|
|
collection.setVerifyDate(collection.getVerifyDate() == null ? DateTime.now().toTimestamp() : collection.getVerifyDate());
|
|
|
BizArchiveInput contract = archiveInputService.getById(collection.getContractId());
|
|
|
if (contract != null) {
|
|
|
- if(collection.getVerifyDate()!= null){
|
|
|
- contract.setCollectionStatus((byte) (collection.getStatus()==1?2:3));
|
|
|
+ if (collection.getVerifyDate() != null) {
|
|
|
+ contract.setCollectionStatus((byte) (collection.getStatus() == 1 ? 2 : 3));
|
|
|
archiveInputService.saveOrUpdate(contract);
|
|
|
}
|
|
|
}
|
|
@@ -273,6 +308,7 @@ public class BizCollectionController extends BaseController {
|
|
|
String message = collectionService.importLoop(orderList, SecurityUtils.getUserId(), getTenantId() == null ? 0 : getTenantId());
|
|
|
return success(message);
|
|
|
}
|
|
|
+
|
|
|
@Log(title = "收款导入", businessType = BusinessType.IMPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('business:collection:import')")
|
|
|
@PostMapping("/importOnce")
|
|
@@ -316,6 +352,7 @@ public class BizCollectionController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Log(title = "合同收款模板导出", businessType = BusinessType.EXPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('business:collection:import')")
|
|
|
@PostMapping("/exportOnce")
|
|
@@ -343,7 +380,6 @@ public class BizCollectionController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private BizCollection getForId(Long collectionId) {
|
|
|
BizCollection collection = collectionService.getById(collectionId);
|
|
|
if (collection != null) {
|
|
@@ -356,9 +392,11 @@ public class BizCollectionController extends BaseController {
|
|
|
collection.setContractAmount(archiveInput.getTrueAmount());
|
|
|
collection.setOrderRemark(archiveInput.getRemark());
|
|
|
BizCollection collectionCondition = new BizCollection();
|
|
|
- collection.setActuallyDate( new Timestamp(archiveInput.getFormDate().getTime()));
|
|
|
+ if (archiveInput.getFormDate() != null) {
|
|
|
+ collection.setActuallyDate(new Timestamp(archiveInput.getFormDate().getTime()));
|
|
|
+ }
|
|
|
collectionCondition.setContractId(archiveInput.getId());
|
|
|
- collectionCondition.setStatus((byte)1);
|
|
|
+ collectionCondition.setStatus((byte) 1);
|
|
|
List<BizCollection> collections = collectionService.getListByBean(collectionCondition);
|
|
|
collection.setNonpayment(archiveInput.getTrueAmount().subtract(BigDecimal.valueOf(collections.stream().mapToDouble(v -> v.getAmount().doubleValue()).sum())).compareTo(BigDecimal.ZERO) > 0);
|
|
|
collection.setNonpaymentAmount(archiveInput.getTrueAmount().subtract(BigDecimal.valueOf(collections.stream().mapToDouble(v -> v.getArriveAmount().doubleValue()).sum())));
|
|
@@ -391,11 +429,11 @@ public class BizCollectionController extends BaseController {
|
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
return toAjax(collectionService.removeBatchByIds(ids));
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation("获取账户")
|
|
|
@GetMapping("/listAccount")
|
|
|
@PreAuthorize("@ss.hasPermi('business:payment:query')")
|
|
|
- public TableDataInfo listAccount(BizAccount bizAccount) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public TableDataInfo listAccount(BizAccount bizAccount) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(bizAccount);
|
|
|
startPage();
|
|
|
List<BizAccount> list = accountService.getList(bizAccount);
|