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

[物业合同][修改[只保留添加操作]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
b5241fa1a1
2 измененных файлов: 51 добавлений и 22 удалений
  1. +45
    -20
      mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java
  2. +6
    -2
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml

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

@@ -100,6 +100,34 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
public ResultData saveOrUpdate(WxPropertyContract record) {
//保存物业合同信息
if (record.getId() == null) {

if(null==record.getMerchantId()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"merchantId不能为空");
}
WxMerchant merchant = wxMerchantMapper.selectByPrimaryKey(record.getMerchantId());
if(merchant==null){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if(null==record.getReceivePeriod()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"付款周期不能为空");
}
if(null==record.getLease()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"租期不能为空");
}
if(null==record.getPrice()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"物业费不能为空");
}
if(null==record.getDeposit()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"押金不能为空");
}
if(record.getPrice().intValue()<=0){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"物业费要大于0");
}
if(record.getDeposit().intValue()<=0){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"押金要大于0");
}


final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
Calendar instance = Calendar.getInstance();
@@ -110,8 +138,25 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
Date date = new Date();
record.setCreatetime(date);
record.setUpdatetime(date);

try {
wxPropertyContractMapper.insertSelective(record);
//建立账单
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit()>0 && record.getPrice()>0) {
WxBillProperty wxBillProperty = new WxBillProperty();
wxBillProperty.setMerchantId(record.getMerchantId());
List<Map<String, Object>> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty);
if (billPropertyList.size() == 0) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(record.getMerchantId());
wxMerchant.setTenantId(record.getTenantId());
//物业账单
buildProperty(wxMerchant);
//物业押金账单
buildDeposit(wxMerchant);
}
}
} catch (Exception e) {
logger.error("保存物业合同信息失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
@@ -130,28 +175,8 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService
record.setPrice(record.getPrice() != null ? record.getPrice(): 0);
record.setDeposit(record.getDeposit() != null ? record.getDeposit(): 0);
record.setUpdatetime(new Date());
if(record.getPrice()==0 || record.getDeposit()==0){
record.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode());
}
try {
wxPropertyContractMapper.updateByPrimaryKeySelective(record);

//建立账单
if (record.getMerchantId() != null && record.getStatus().equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode())
&& record.getReceivePeriod() != null && record.getDeposit()>0 && record.getPrice()>0) {
WxBillProperty wxBillProperty = new WxBillProperty();
wxBillProperty.setMerchantId(record.getMerchantId());
List<Map<String, Object>> billPropertyList = wxBillPropertyMapper.queryBillPropertyList(wxBillProperty);
if (billPropertyList.size() == 0) {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(record.getMerchantId());
wxMerchant.setTenantId(record.getTenantId());
//物业账单
buildProperty(wxMerchant);
//物业押金账单
buildDeposit(wxMerchant);
}
}
} catch (Exception e) {
logger.error("更新物业合同信息失败,e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());


+ 6
- 2
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Просмотреть файл

@@ -34,7 +34,7 @@
<select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">

select count(bill.id) owncount,sum(bill.owe) owe from (
select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from (
select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent
union
select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit
@@ -46,6 +46,8 @@
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1
union
select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2
union
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other
) bill
where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
and bill.status=#{status}
@@ -54,7 +56,7 @@
<select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap">
select count(bill.id) paycount,sum(bill.pay) pay from (
select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from (
select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent
union
select id,merchant_id,shop_id,tenant_id,2 bill_type_value,'租赁押金' bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_rent_deposit
@@ -66,6 +68,8 @@
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type, '' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=1
union
select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_daily where type=2
union
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他' bill_type,'' need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status from wx_bill_other
) bill
where date_format(bill.receive_date,'%Y-%m')=#{month} and bill.tenant_id=#{tenantId}
and bill.status=#{status}


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