Просмотр исходного кода

[租赁合同][修改][编辑时不再提示参数不为空]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
42471c02e6
1 измененных файлов: 23 добавлений и 30 удалений
  1. +23
    -30
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java

+ 23
- 30
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Просмотреть файл

@@ -192,24 +192,14 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}

if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) {
if (record.getRevenue() == null || record.getRevenue().intValue() == 0) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "营业额不能为空且大于0");
}
if (record.getPayRatio() == null || record.getPayRatio().intValue() == 0) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "支付比例不能为空且大于0");
}
BigDecimal hundred = new BigDecimal(100);
BigDecimal revenue = new BigDecimal(record.getRevenue()).divide(hundred);
BigDecimal payRatio = new BigDecimal(record.getPayRatio()).divide(hundred);
BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred);
BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(hundred);
BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN);
record.setPrice(price.multiply(hundred).intValue());
}
if (record.getPrice() == null || record.getPrice().intValue() == 0) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "租金不能为空且大于0");
}
if (record.getDeposit() == null || record.getDeposit().intValue() == 0) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "押金不能为空且大于0");
}
record.setPrice(record.getPrice() == null ? 0 : record.getPrice());
record.setDeposit(record.getDeposit() == null ? 0 : record.getDeposit());

record.setUpdatetime(new Date());
try {
@@ -226,22 +216,7 @@ public class WxRentContractServiceImpl implements WxRentContractService {
return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND);
}
wxRentContractMapper.updateByPrimaryKeySelective(record);
//建立账单
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) {
WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setMerchantId(record.getMerchantId());
List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent);
if (billRentList.size() == 0) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(record.getMerchantId());
wxMerchant.setTenantId(record.getTenantId());
//租金
buildRent(wxMerchant);
//押金
buildDeposit(wxMerchant);
}
}

} catch (Exception e) {
logger.error("更新租赁合同信息失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
@@ -700,10 +675,28 @@ public class WxRentContractServiceImpl implements WxRentContractService {

@Override
public ResultData updateRentContractStatus(Long id) {
//更新合同状态为签约
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setId(id);
wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode());
wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract);
//建立账单
WxRentContract record = wxRentContractMapper.selectByPrimaryKey(id);
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit() > 0 && record.getPrice() > 0) {
WxBillRent wxBillRent = new WxBillRent();
wxBillRent.setMerchantId(record.getMerchantId());
List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(wxBillRent);
if (billRentList.size() == 0) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(record.getMerchantId());
wxMerchant.setTenantId(record.getTenantId());
//租金
buildRent(wxMerchant);
//押金
buildDeposit(wxMerchant);
}
}
return new ResultData(Result.SUCCESS,"操作成功") ;
}



Загрузка…
Отмена
Сохранить