|
@@ -10,9 +10,15 @@ import com.idea.buildManage.model.ParkInfoExample;
|
|
import com.idea.buildManage.model.ParkRoom;
|
|
import com.idea.buildManage.model.ParkRoom;
|
|
import com.idea.customerManagement.dto.ContractManageDto;
|
|
import com.idea.customerManagement.dto.ContractManageDto;
|
|
import com.idea.customerManagement.mapper.ContractManageMapper;
|
|
import com.idea.customerManagement.mapper.ContractManageMapper;
|
|
|
|
+import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
import com.idea.customerManagement.model.ContractManage;
|
|
import com.idea.customerManagement.model.ContractManage;
|
|
|
|
+import com.idea.customerManagement.model.CustomerManagement;
|
|
import com.idea.invoice.dto.InvoiceManageDto;
|
|
import com.idea.invoice.dto.InvoiceManageDto;
|
|
|
|
+import com.idea.invoice.model.InvoiceManage;
|
|
|
|
+import com.idea.invoice.model.InvoiceManageExample;
|
|
|
|
+import com.idea.invoice.model.ReceiptManage;
|
|
import com.idea.invoice.service.InvoiceManageService;
|
|
import com.idea.invoice.service.InvoiceManageService;
|
|
|
|
+import com.idea.invoice.service.ReceiptManageService;
|
|
import com.idea.paymentManagement.dto.PayLogDto;
|
|
import com.idea.paymentManagement.dto.PayLogDto;
|
|
import com.idea.paymentManagement.mapper.PayLogExtendMapper;
|
|
import com.idea.paymentManagement.mapper.PayLogExtendMapper;
|
|
import com.idea.paymentManagement.mapper.PayLogMapper;
|
|
import com.idea.paymentManagement.mapper.PayLogMapper;
|
|
@@ -26,6 +32,7 @@ import com.rockstar.frame.model.extend.Tablepar;
|
|
import com.rockstar.frame.service.FrameUserService;
|
|
import com.rockstar.frame.service.FrameUserService;
|
|
import com.rockstar.shiro.util.ShiroUtils;
|
|
import com.rockstar.shiro.util.ShiroUtils;
|
|
import com.rockstar.util.StringUtils;
|
|
import com.rockstar.util.StringUtils;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -46,6 +53,10 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
|
|
private FrameUserService frameUserService;
|
|
private FrameUserService frameUserService;
|
|
@Autowired
|
|
@Autowired
|
|
private InvoiceManageService invoiceManageService;
|
|
private InvoiceManageService invoiceManageService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CustomerManagementMapper customerManagementMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ReceiptManageService receiptManageService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -115,10 +126,12 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
|
|
*/
|
|
*/
|
|
public int add(PayLog model) {
|
|
public int add(PayLog model) {
|
|
|
|
|
|
|
|
+ String id = IdUtil.simpleUUID();
|
|
model.setCreatedBy(ShiroUtils.getUserId());
|
|
model.setCreatedBy(ShiroUtils.getUserId());
|
|
model.setCreatedAt(new Date());
|
|
model.setCreatedAt(new Date());
|
|
model.setStatus(0);
|
|
model.setStatus(0);
|
|
- int result = insertSelective(model);
|
|
|
|
|
|
+ model.setId(id);
|
|
|
|
+ int result = insertWithoutId(model);
|
|
// 更新合同 预收款 收款状态
|
|
// 更新合同 预收款 收款状态
|
|
ContractManage contractManage = contractManageMapper.selectByPrimaryKey(model.getContractId());
|
|
ContractManage contractManage = contractManageMapper.selectByPrimaryKey(model.getContractId());
|
|
if (model.getPayType() == 1) {
|
|
if (model.getPayType() == 1) {
|
|
@@ -131,22 +144,61 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
|
|
} else {
|
|
} else {
|
|
// 全部收款
|
|
// 全部收款
|
|
contractManage.setCollectionStatus(2);
|
|
contractManage.setCollectionStatus(2);
|
|
- // 新增待推送的开票信息
|
|
|
|
- InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId());
|
|
|
|
- // 正式发票
|
|
|
|
- invoiceManage.setType("2");
|
|
|
|
- // 房款
|
|
|
|
- invoiceManage.setPaymentType("1");
|
|
|
|
- invoiceManage.setSendStatus("0");
|
|
|
|
- invoiceManage.setInvoiceStatus("0");
|
|
|
|
- invoiceManage.setInvoiceTax(null);
|
|
|
|
- invoiceManage.setRemark(null);
|
|
|
|
- invoiceManage.setCreateUser(ShiroUtils.getUserId());
|
|
|
|
- invoiceManage.setCreateTime(new Date());
|
|
|
|
- invoiceManageService.insertSelective(invoiceManage);
|
|
|
|
|
|
+
|
|
|
|
+ // 查询合同的专项维修基础 收款情况
|
|
|
|
+ Integer fundCollectionStatus = contractManage.getFundCollectionStatus();
|
|
|
|
+ // 完全收款
|
|
|
|
+ if(fundCollectionStatus == 2){
|
|
|
|
+ // 查询该合同是否已生成 正式发票
|
|
|
|
+ InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
|
|
|
|
+ invoiceManageExample.createCriteria().andTypeEqualTo("1").andContractIdEqualTo(model.getContractId());
|
|
|
|
+ List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
|
|
|
|
+ if(CollectionUtils.isEmpty(invoiceManages)){
|
|
|
|
+ // 新增待推送的开票信息
|
|
|
|
+ InvoiceManageDto invoiceManage = invoiceManageService.getInfoByContract(model.getContractId());
|
|
|
|
+ // 正式发票
|
|
|
|
+ invoiceManage.setType("2");
|
|
|
|
+ // 房款
|
|
|
|
+ invoiceManage.setPaymentType("1");
|
|
|
|
+ invoiceManage.setSendStatus("0");
|
|
|
|
+ invoiceManage.setInvoiceStatus("0");
|
|
|
|
+ invoiceManage.setInvoiceTax(null);
|
|
|
|
+ invoiceManage.setRemark(null);
|
|
|
|
+ invoiceManage.setCreateUser(ShiroUtils.getUserId());
|
|
|
|
+ invoiceManage.setCreateTime(new Date());
|
|
|
|
+ invoiceManageService.insertSelective(invoiceManage);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
contractManageMapper.updateByPrimaryKeySelective(contractManage);
|
|
contractManageMapper.updateByPrimaryKeySelective(contractManage);
|
|
|
|
+ // 票据管理 新增一条记录
|
|
|
|
+ CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(contractManage.getCustomerManagementId());
|
|
|
|
+ ReceiptManage receiptManage = new ReceiptManage();
|
|
|
|
+ receiptManage.setBatchNumber(customerManagement.getBatchNumber());
|
|
|
|
+ receiptManage.setRoomSelectionNumber(customerManagement.getRoomSelectionNumber());
|
|
|
|
+ receiptManage.setBuyerName(customerManagement.getBuyerName());
|
|
|
|
+ receiptManage.setCustomerManagementId(model.getCustomerManagementId());
|
|
|
|
+ receiptManage.setBusinessId(id);
|
|
|
|
+ // 票据类型
|
|
|
|
+ String receiptType = "";
|
|
|
|
+ switch (model.getContentType()){
|
|
|
|
+ case 1: // 定金
|
|
|
|
+ receiptType = "2";
|
|
|
|
+ break;
|
|
|
|
+ case 2: // 首付
|
|
|
|
+ receiptType = "3";
|
|
|
|
+ break;
|
|
|
|
+ case 3: // 银行按揭
|
|
|
|
+ receiptType = "4";
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ receiptManage.setReceiptType(receiptType);
|
|
|
|
+ receiptManage.setReceiptMoney(model.getPayMoney());
|
|
|
|
+ // TODO: 2024/10/21 预收款登记暂无 流水号
|
|
|
|
+// receiptManage.setReceiptNumber();
|
|
|
|
+ receiptManageService.add(receiptManage);
|
|
|
|
+
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|