|
@@ -2,6 +2,7 @@ package com.idea.invoice.service;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -23,6 +24,8 @@ import com.idea.invoice.mapper.InvoiceManageExtendMapper;
|
|
|
import com.idea.invoice.mapper.InvoiceManageMapper;
|
|
|
import com.idea.invoice.model.*;
|
|
|
import com.idea.invoice.util.InvoiceConstant;
|
|
|
+import com.idea.paymentManagement.model.PayLog;
|
|
|
+import com.idea.paymentManagement.model.PayLogExample;
|
|
|
import com.idea.paymentManagement.service.PayLogService;
|
|
|
import com.rockstar.common.base.BaseService;
|
|
|
import com.rockstar.common.domain.AjaxResult;
|
|
@@ -135,11 +138,10 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
|
List<InvoiceManageDto> list = extendMapper.listByModel(model);
|
|
|
for(InvoiceManageDto invoiceManage : list){
|
|
|
- BigDecimal totalPrice = invoiceManage.getTotalPrice();
|
|
|
- BigDecimal maintenanceTotalPrice = invoiceManage.getMaintenanceTotalPrice();
|
|
|
- String money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), null);
|
|
|
- invoiceManage.setReceivableMoney(totalPrice.add(maintenanceTotalPrice));
|
|
|
- invoiceManage.setReceivedMoney(new BigDecimal(money));
|
|
|
+// String money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), null);
|
|
|
+// invoiceManage.setReceivedMoney(new BigDecimal(money));
|
|
|
+ // 预收款发票 已收金额
|
|
|
+ invoiceManage.setReceivedMoney(invoiceManage.getInvoiceAmount());
|
|
|
}
|
|
|
return new PageInfo<>(list);
|
|
|
}
|
|
@@ -189,7 +191,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
// 房款
|
|
|
if(invoiceManage.getPaymentType().equals("1")){
|
|
|
money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), 1);
|
|
|
- invoiceManage.setReceivableMoney(invoiceManage.getTotalPrice());
|
|
|
+ invoiceManage.setReceivableMoney(invoiceManage.getBuyerMoney());
|
|
|
}
|
|
|
// 专项维修资金
|
|
|
if(invoiceManage.getPaymentType().equals("2")){
|
|
@@ -206,7 +208,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
* @param contractId
|
|
|
* @return
|
|
|
*/
|
|
|
- public InvoiceManageDto getInfoByContract(String contractId){
|
|
|
+ public InvoiceManageDto getInfoByContract(String contractId,String invoiceGoodsName,Integer payType){
|
|
|
|
|
|
InvoiceManageDto invoiceManage = new InvoiceManageDto();
|
|
|
// 合同信息
|
|
@@ -225,6 +227,19 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
builder.append(item.getName()).append("身份证号:").append(item.getIdentityCard()).append("\n");
|
|
|
}
|
|
|
}
|
|
|
+ PayLogExample payLogExample = new PayLogExample();
|
|
|
+ PayLogExample.Criteria criteria = payLogExample.createCriteria();
|
|
|
+ criteria.andContractIdEqualTo(contractId)
|
|
|
+ .andStatusEqualTo(0);
|
|
|
+ if(ObjectUtil.isNotNull(payType)){
|
|
|
+ criteria.andPayTypeEqualTo(payType);
|
|
|
+ }
|
|
|
+ List<PayLog> payLogs = payLogService.selectByExample(payLogExample);
|
|
|
+ BigDecimal money = BigDecimal.ZERO;
|
|
|
+ for(PayLog payLog : payLogs){
|
|
|
+ money = money.add(payLog.getPayMoney());
|
|
|
+ }
|
|
|
+
|
|
|
invoiceManage.setContractId(contractId);
|
|
|
invoiceManage.setCustomerManagementId(contract.getCustomerManagementId());
|
|
|
invoiceManage.setContractNumber(contract.getContractNumber());
|
|
@@ -233,10 +248,10 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
invoiceManage.setInvoiceHeaderNumber(buyer.getIdentityCard());
|
|
|
// TODO: 2024/10/17 商品编码目前为空 对接接口后调整
|
|
|
invoiceManage.setInvoiceGoodsCode(InvoiceConstant.INVOICE_GOODS_CODE_ADVANCE_PAYMENT);
|
|
|
- invoiceManage.setInvoiceGoodsName(room.getDiscName());
|
|
|
+ invoiceManage.setInvoiceGoodsName(invoiceGoodsName + room.getGroupName());
|
|
|
invoiceManage.setSpecifications(room.getBuildName()+ "-" + room.getRoomNo());
|
|
|
invoiceManage.setInvoiceCount(new BigDecimal(contract.getActualBuildArea().toString()));
|
|
|
- invoiceManage.setInvoiceAmount(contract.getBuyerMoney());
|
|
|
+ invoiceManage.setInvoiceAmount(money);
|
|
|
invoiceManage.setInvoiceTax("0");
|
|
|
invoiceManage.setRemark(builder.toString());
|
|
|
return invoiceManage;
|
|
@@ -286,6 +301,45 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param contractId
|
|
|
+ * @param paymentType 1-房款,2-专项维修资金
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public JSONObject getBankTaxRateByFloor(String contractId,String paymentType) {
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ String result = "";
|
|
|
+ String dictLabel = sysDictService.getDictLabel("PAYMENT_TYPE", paymentType);
|
|
|
+ InvoiceBankExample example = new InvoiceBankExample();
|
|
|
+ example.createCriteria().andSuitCostTypeLike("%" + dictLabel + "%");
|
|
|
+ List<InvoiceBank> bankList = invoiceBankService.selectByExample(example);
|
|
|
+ if (CollectionUtils.isNotEmpty(bankList)) {
|
|
|
+ ContractManage parkContractManage = contractManageService.selectByPrimaryKey(contractId);
|
|
|
+ ParkRoom parkRoom = parkRoomMapper.selectByPrimaryKey(parkContractManage.getHouseId());
|
|
|
+ if (StringUtils.isNotEmpty(parkRoom.getDiscId())) {
|
|
|
+ for (InvoiceBank invoiceBank : bankList) {
|
|
|
+ if (StringUtils.isNotEmpty(invoiceBank.getSuitFloor())) {
|
|
|
+ String[] floors = invoiceBank.getSuitFloor().split(",");
|
|
|
+ for (String floor : floors) {
|
|
|
+ if (parkRoom.getDiscId().contains(floor)) {
|
|
|
+ result = invoiceBank.getBankName() + invoiceBank.getBankBranchName() + invoiceBank.getBankNumber();
|
|
|
+ jsonObject.put("invoiceSellerBank", result);
|
|
|
+ // 预收款发票税率默认为0
|
|
|
+ jsonObject.put("invoiceTax", "0");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 批量开票列表
|
|
|
* @param invoiceManages
|