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

[合同][修改][开发账单结算]

release_toaliyun_real
luozukai 6 лет назад
Родитель
Сommit
f456b96780
7 измененных файлов: 168 добавлений и 27 удалений
  1. +14
    -8
      mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java
  2. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillSettle.java
  3. +6
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxBillSettleBill.java
  4. +36
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumSettleWay.java
  5. +5
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java
  6. +91
    -8
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  7. +12
    -10
      mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml

+ 14
- 8
mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java Просмотреть файл

@@ -2,23 +2,23 @@ package com.iformall.controller;


import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.vo.WxBillAll;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.service.WxBillAllService;
import com.iformall.service.WxBillSettleService;
import com.iformall.service.WxMerchantBUserService;
import com.iformall.service.WxMerchantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
@@ -34,12 +34,10 @@ public class WxBillController extends BaseController {

@Autowired
WxBillAllService wxBillAllService;

@Autowired
WxMerchantBUserService wxMerchantBUserService;

@Autowired
WxMerchantService wxMerchantService;
@Autowired
WxBillSettleService wxBillSettleService;

@ApiOperation("所有欠缴和待缴的数据")
@PostMapping("listBillOweAndWaitPay")
@@ -90,4 +88,12 @@ public class WxBillController extends BaseController {
return wxBillAllService.listBill(wxBillAll);
}


@GetMapping("/findSettleById")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
@ApiOperation("账单管理-结算单-id查找")
public ResultData findById(Long id) {
return new ResultData(Result.SUCCESS, "查询成功", wxBillSettleService.getById(id));
}

}

+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxBillSettle.java Просмотреть файл

@@ -83,4 +83,8 @@ public class WxBillSettle extends BaseEntity {
@Transient
@io.swagger.annotations.ApiModelProperty(value="结束时间",name="endtime")
private Date endTime;

@Transient
@io.swagger.annotations.ApiModelProperty(value="清算方向 1商场结款 2商户结款",name="settleWay")
private Integer settleWay;
}

+ 6
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxBillSettleBill.java Просмотреть файл

@@ -37,10 +37,15 @@ public class WxBillSettleBill extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime")
private Date updatetime;

@io.swagger.annotations.ApiModelProperty(value="账单类型/名称",name="billName")
@Transient
private String billName;
@io.swagger.annotations.ApiModelProperty(value="应收金额",name="receivePay")
@Transient
private String receivePay;


@io.swagger.annotations.ApiModelProperty(value="账单开始时间",name="starttime")
private Date starttime;
@io.swagger.annotations.ApiModelProperty(value="账单结束时间",name="endtime")
private Date endtime;
}

+ 36
- 0
mallinkService/src/main/java/com/iformall/enums/EnumSettleWay.java Просмотреть файл

@@ -0,0 +1,36 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumSettleWay {

M(1, "商场结款"),
B(2, "商户结款"),
;

public static EnumSettleWay getEnum(Integer code) {
for (EnumSettleWay value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumSettleWay(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

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

@@ -69,6 +69,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService {
WxBillSettle billSettle = wxBillSettleMapper.selectByPrimaryKey(id);

if(billSettle != null) {
if(billSettle.getReceiveMoney() > billSettle.getPayMoney()){
billSettle.setSettleWay(EnumSettleWay.B.getCode());
}else{
billSettle.setSettleWay(EnumSettleWay.M.getCode());
}
WxBillSettleBill wxBillSettleBill = new WxBillSettleBill();
wxBillSettleBill.setTenantId(billSettle.getTenantId());
wxBillSettleBill.setSettleId(billSettle.getId());


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

@@ -240,58 +240,141 @@
<select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll">
select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
select bill.settle_number,bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,DATEDIFF(now(),bill.receive_date) expiredDay,bill.status,
bill.tenant_id tenantId,m.name merchantName,s.shop_number shopNumber,bill.starttime,bill.endtime,bill.name,pb.pay_bill_status payBillStatus,
pb.pay_time_end tradeTime,pb.transaction_id transactionId,pb.pay_amount payAmount,bill.rent_shop_type
rentShopType,bill.price_detail priceDetail from (
select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
select '' settle_number,id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_rent where is_preview = 0 and tenant_id=#{tenantId} and rent_contract_id in (select id from
wx_rent_contract where status in
(2,3,4))
union all
select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
select '' settle_number,id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_rent_deposit where tenant_id=#{tenantId} and rent_contract_id in (select id from wx_rent_contract
where status in (2,3,4))
union all
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
select '' settle_number,id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_property where is_preview = 0 and tenant_id=#{tenantId} and property_contract_id in (select id from
wx_property_contract
where status in(2,3,4))
union all
select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
select '' settle_number,id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,''
price_detail
from wx_bill_property_deposit where tenant_id=#{tenantId} and property_contract_id in (select id from
wx_property_contract where status in
(2,3,4))
union all
select id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name,
select '' settle_number,id,merchant_id,shop_id,tenant_id,case when type=1 then '水费' when type=2 then '电费' else '空调费' end name,
case when type=1 then 5 when type=2 then 6 else 9 end bill_type_value,
case when type=1 then '水费' when type=2 then '电费' else '空调费' end bill_type, 0 as need_pay,receive_pay,
pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,rent_shop_type,price_detail
from wx_bill_daily where tenant_id=#{tenantId}
union all
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as
select '' settle_number,id,merchant_id,shop_id,tenant_id,name,7 bill_type_vaue,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,''
price_detail
from wx_bill_other where tenant_id=#{tenantId}
union all
select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as
select '' settle_number,id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type,''
price_detail
from wx_bill_other_deposit where tenant_id=#{tenantId}

union all
select s.settle_number,s.id,s.merchant_id,'' shop_id,s.tenant_id,'结算单' name, 10 bill_type_value,'结算单' bill_type,0 need_pay,
((select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb left join
(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,rent_shop_type from wx_bill_rent where is_preview = 0
union all
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,rent_shop_type from
wx_bill_rent_deposit
union all
select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
wx_bill_property where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
wx_bill_property_deposit
union all
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=1
union all
select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=2
union all
select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=3
union all
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other
union all
select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
) bill
on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=0)
-
(select IFNULL(sum(bill.receive_pay),0) from wx_bill_settle_bill bb left join
(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,rent_shop_type from wx_bill_rent where is_preview = 0
union all
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,rent_shop_type from
wx_bill_rent_deposit
union all
select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
wx_bill_property where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
wx_bill_property_deposit
union all
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=1
union all
select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=2
union all
select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
type=3
union all
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other
union all
select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
) bill
on(bb.bill_id=bill.id) where bb.settle_id = s.id and bb.type=1
)
-
(select IFNULL(sum(settle_money),0) from wx_bill_settle_record where settle_id = s.id)
) receive_pay
,0 pay,0 owe,s.createtime receive_date,'' pay_date,0 expired_day,status,'' starttime,'' endtime,'' rent_shop_type,'' price_detail
from wx_bill_settle s where s.tenant_id=#{tenantId} and s.status >0

) bill
left join wx_merchant m on bill.merchant_id=m.id
left join wx_shop s on bill.shop_id=s.id
left join wx_pay_bill pb on bill.id=pb.bill_id
where 1=1


<if test=" null != id ">
and bill.id=#{id}
</if>


+ 12
- 10
mallinkService/src/main/resources/mapper/WxBillSettleBillMapper.xml Просмотреть файл

@@ -14,6 +14,8 @@

<result column="billName" property="billName"/>
<result column="receivePay" property="receivePay"/>
<result column="starttime" property="starttime"/>
<result column="endtime" property="endtime"/>

</resultMap>

@@ -44,39 +46,39 @@
</select>

<select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap">
select bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join
select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join
(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,rent_shop_type from wx_bill_rent where is_preview = 0
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0
union all
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,rent_shop_type from
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_rent_deposit
union all
select id,merchant_id,shop_id,tenant_id,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_property where is_preview = 0
union all
select id,merchant_id,shop_id,tenant_id,4 bill_type_value,'物业押金'
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from
bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from
wx_bill_property_deposit
union all
select id,merchant_id,shop_id,tenant_id,5 bill_type_value,'水费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where
type=1
union all
select id,merchant_id,shop_id,tenant_id,6 bill_type_value,'电费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where
type=2
union all
select id,merchant_id,shop_id,tenant_id,9 bill_type_value,'空调费' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_daily where
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_daily where
type=3
union all
select id,merchant_id,shop_id,tenant_id,7 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other
union all
select id,merchant_id,shop_id,tenant_id,8 bill_type_value,'其他押金' bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_other_deposit
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_other_deposit
) bill
on(bl.bill_id = bill.id)
where 1=1


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