|
@@ -21,6 +21,7 @@ import com.idea.paymentManagement.mapper.PayLogMapper;
|
|
|
import com.idea.paymentManagement.model.MaintenanceFundsManagement;
|
|
|
import com.idea.paymentManagement.model.MaintenanceFundsManagementExample;
|
|
|
import com.idea.paymentManagement.model.PayLog;
|
|
|
+import com.idea.paymentManagement.model.PayLogExample;
|
|
|
import com.rockstar.common.base.BaseService;
|
|
|
import com.rockstar.frame.model.extend.DateTrans;
|
|
|
import com.rockstar.frame.model.extend.Tablepar;
|
|
@@ -29,6 +30,7 @@ import com.rockstar.util.StringUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
@@ -127,11 +129,13 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
|
|
|
|
|
|
contractManageMapper.updateByPrimaryKeySelective(contractManage);
|
|
|
|
|
|
+ String id = IdUtil.simpleUUID();
|
|
|
+ model.setId(id);
|
|
|
model.setHouseId(contractManage.getHouseId());
|
|
|
model.setCustomerManagementId(contractManage.getCustomerManagementId());
|
|
|
model.setCreatedId(ShiroUtils.getUserId());
|
|
|
model.setCreatedAt(new Date());
|
|
|
- int result = insertSelective(model);
|
|
|
+ int result = insertWithoutId(model);
|
|
|
|
|
|
// 新增一条定金收款记录
|
|
|
PayLog payLog = new PayLog();
|
|
@@ -139,6 +143,7 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
|
|
|
payLog.setHouseId(contractManage.getHouseId());
|
|
|
payLog.setContractId(model.getContractId());
|
|
|
payLog.setCustomerManagementId(contractManage.getCustomerManagementId());
|
|
|
+ payLog.setBusinessId(id);
|
|
|
// 收款类型 专项维修资金
|
|
|
payLog.setPayType(2);
|
|
|
// 款项内容 专项维修资金
|
|
@@ -185,6 +190,63 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 收款登记
|
|
|
+ * @param model
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public int edit(MaintenanceFundsManagement model){
|
|
|
+
|
|
|
+ // 更新合同 专项维修资金收取状态
|
|
|
+ ContractManage contractManage = contractManageMapper.selectByPrimaryKey(model.getContractId());
|
|
|
+ BigDecimal payMoney = model.getPayMoney();
|
|
|
+ BigDecimal maintenanceTotalPrice = contractManage.getMaintenanceTotalPrice();
|
|
|
+ if(payMoney.doubleValue() >= maintenanceTotalPrice.doubleValue()){
|
|
|
+ // 已收款
|
|
|
+ contractManage.setFundCollectionStatus(2);
|
|
|
+ }else {
|
|
|
+ // 部分收款
|
|
|
+ contractManage.setFundCollectionStatus(4);
|
|
|
+ }
|
|
|
+
|
|
|
+ contractManageMapper.updateByPrimaryKeySelective(contractManage);
|
|
|
+
|
|
|
+ model.setHouseId(contractManage.getHouseId());
|
|
|
+ model.setCustomerManagementId(contractManage.getCustomerManagementId());
|
|
|
+ model.setCreatedId(ShiroUtils.getUserId());
|
|
|
+ model.setCreatedAt(new Date());
|
|
|
+ int result = updateByPrimaryKeySelective(model);
|
|
|
+
|
|
|
+ // 更新对应的收款记录
|
|
|
+ PayLogExample payLogExample = new PayLogExample();
|
|
|
+ payLogExample.createCriteria().andBusinessIdEqualTo(model.getId()).andPayTypeEqualTo(2);
|
|
|
+ List<PayLog> payLogs = payLogMapper.selectByExample(payLogExample);
|
|
|
+ if(CollectionUtils.isNotEmpty(payLogs) && payLogs.size() == 1){
|
|
|
+ PayLog payLog = payLogs.get(0);
|
|
|
+ payLog.setPayMoney(model.getPayMoney());
|
|
|
+ payLog.setUpdatedAt(new Date());
|
|
|
+ payLog.setUpdatedBy(ShiroUtils.getUserId());
|
|
|
+ payLogMapper.updateByPrimaryKeySelective(payLog);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新对应的 未推送 未开票 专项维修资金 正式发票
|
|
|
+ InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
|
|
|
+ invoiceManageExample.createCriteria().andTypeEqualTo("2")
|
|
|
+ .andContractIdEqualTo(model.getContractId())
|
|
|
+ .andPaymentTypeEqualTo("2")
|
|
|
+ .andSendStatusEqualTo("0");
|
|
|
+ List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
|
|
|
+ if(CollectionUtils.isEmpty(invoiceManages) && invoiceManages.size() == 1){
|
|
|
+ InvoiceManage invoiceManage = invoiceManages.get(0);
|
|
|
+ invoiceManage.setInvoiceAmount(payMoney);
|
|
|
+ invoiceManageService.updateByPrimaryKeySelective(invoiceManage);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public PageInfo<ContractManageDto> listByModel(Tablepar tablepar, ContractManageDto model, DateTrans dt) {
|
|
|
PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
|
List<ContractManageDto> list = extendMapper.listByModel(model);
|