Sfoglia il codice sorgente

[修改][手续费][开发]

release_toaliyun_real
luozukai 6 anni fa
parent
commit
8c48676713
7 ha cambiato i file con 92 aggiunte e 18 eliminazioni
  1. +7
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java
  2. +4
    -2
      mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java
  3. +16
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  4. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java
  5. +26
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java
  6. +25
    -15
      mallinkService/src/main/resources/mapper/WxBillAllMapper.xml
  7. +3
    -1
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml

+ 7
- 0
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillAllController.java Vedi File

@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONArray;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.WxPayAccountBill;
import com.iformall.domain.vo.WxBillAll;
import com.iformall.domain.vo.WxBillExcelTemplate;
import com.iformall.service.WxBillAllService;
import com.iformall.service.WxPayAccountBillService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Map;

@@ -32,6 +35,9 @@ public class WxBillAllController extends BaseController {

private Logger logger = LoggerFactory.getLogger(WxBillAllController.class);

@Autowired
WxPayAccountBillService wxPayAccountBillService;

@GetMapping("oweBillCount")
@ApiImplicitParams({
@ApiImplicitParam(name = "contractId", value = "合同id", dataType = "long", paramType = "query", required = true),
@@ -49,6 +55,7 @@ public class WxBillAllController extends BaseController {
@SystemControllerLog(description = "账单总览-列表")
public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxBillAllController::list");
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxBillAll.getTenantId());
if (null == wxBillAll) {
wxBillAll = new WxBillAll();
}


+ 4
- 2
mallinkService/src/main/java/com/iformall/domain/po/WxBillRent.java Vedi File

@@ -197,14 +197,16 @@ public class WxBillRent extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "联营租金", name = "joinRentPrice")
private Long joinRentPrice;

@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
private Integer serviceChargePay;


@TableField(exist = false)
private String serviceChargePayBefore;
@TableField(exist = false)
private String serviceChargePayUpdate;

@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
private Integer serviceChargePay;

@io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay")
@TableField(exist = false)
private Long realReceivePay;


+ 16
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java Vedi File

@@ -3,6 +3,7 @@ package com.iformall.domain.po;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.common.SortColumn;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.vo.WxShopVo;
import com.iformall.enums.EnumBusiness;
@@ -247,4 +248,19 @@ public class WxMerchant extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value = "积分锁定0正常1锁定", name = "creditLocked")
private Integer creditLocked;

@TableField(exist = false)
@SortColumn(column = "couponSale")
private String couponSale;

@TableField(exist = false)
@SortColumn(column = "couponPrice")
private String couponPrice;

@TableField(exist = false)
@SortColumn(column = "tradeAmt")
private String tradeAmt;

@TableField(exist = false)
@SortColumn(column = "tradeDate")
private String tradeDate;
}

+ 11
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxBillAllVo.java Vedi File

@@ -113,4 +113,15 @@ public class WxBillAllVo {
}
return oweStr;
}

@io.swagger.annotations.ApiModelProperty(value = "手续费", name = "serviceChargePay")
@TableField(exist = false)
private Integer serviceChargePay;

@io.swagger.annotations.ApiModelProperty(value="实际应收金额",name="realReceivePay")
@TableField(exist = false)
private Long realReceivePay;

@io.swagger.annotations.ApiModelProperty(value = "滞纳金", name = "latePayPrice")
private Long latePayPrice;
}

+ 26
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java Vedi File

@@ -131,11 +131,14 @@ public class WxBillAllServiceImpl implements WxBillAllService {

@Autowired
WxBillSettleRecordMapper wxBillSettleRecordMapper;
@Autowired
WxPayAccountBillService wxPayAccountBillService;

@Override
public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) {
//更新各账单状态
//updateBillStatus(record);
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId());

if (StringUtils.isNotEmpty(record.getTypeStr())) {
List<Integer> typeList = JSONArray.parseArray(record.getTypeStr(), Integer.class);
@@ -143,6 +146,23 @@ public class WxBillAllServiceImpl implements WxBillAllService {
}
PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record));

//手续费 = 合同应收+手续费+滞纳金
pageInfo.getList().stream().forEach(e->{
//手续费 = 合同应收+手续费+滞纳金
if(e.getReceivePay() != null){
if(e.getLatePayPrice() == null) e.setLatePayPrice(0l);
BigDecimal servicePay;
if(e.getServiceChargePay() != null){
servicePay = new BigDecimal(e.getServiceChargePay());
}else{
servicePay = new BigDecimal(e.getReceivePay()).multiply(new BigDecimal(wxPayAccountBill.getServiceChargeRate())).divide(new BigDecimal(10000), 2, BigDecimal.ROUND_HALF_UP);
}
Long realReceivePay = servicePay.longValue() + e.getLatePayPrice() + e.getReceivePay();
e.setRealReceivePay(realReceivePay);
e.setServiceChargePay(servicePay.intValue());
}
});

Map<String, Object> result = new HashMap<>();
result.put("pageInfo", pageInfo);
return result;
@@ -1676,6 +1696,7 @@ public class WxBillAllServiceImpl implements WxBillAllService {

@Override
public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) {
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(record.getTenantId());
PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record));
List<Map<String, Object>> list = pageInfo.getList();
for (Map<String, Object> map : list) {
@@ -1684,6 +1705,11 @@ public class WxBillAllServiceImpl implements WxBillAllService {
map.put("depositOwe", subZeroAndDot(map.get("depositOwe").toString()));
map.put("otherOwe", subZeroAndDot(map.get("otherOwe").toString()));
map.put("totalOwe", subZeroAndDot(map.get("totalOwe").toString()));

//加上手续费
//todo:把手续费率传进sql,在sql中算,汇总到max,直接出结果
map.put("totalReceivePay", subZeroAndDot(map.get("totalOwe").toString()));

}
pageInfo.setList(list);
Map<String, Object> result = new HashMap<>();


+ 25
- 15
mallinkService/src/main/resources/mapper/WxBillAllMapper.xml Vedi File

@@ -40,10 +40,13 @@
<result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>

<result column="freeze" property="freeze"/>
<result column="late_pay_price" property="latePayPrice"/>

</resultMap>


<select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap">

select
bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId,
bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay,
@@ -51,46 +54,46 @@
bill.pay_date payDate,expired_day expiredDay,bill.status,bill.starttime,
bill.endtime,bill.name,bill.rent_shop_type rentShopType,m.name merchantName,
s.shop_number shopNumber, s.manager, s.manager_phone managerPhone,bill.shop_info
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze
shopInfo,bill.comments,bill.price_detail,updatetime,bill.freeze,bill.late_pay_price
from (
select 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,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,freeze
price_detail,updatetime,freeze,late_pay_price
from wx_bill_rent where tenant_id=#{tenantId} and is_preview = 0
union all
select 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,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_rent_deposit where
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_rent_deposit where
tenant_id=#{tenantId}
union all
select 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,case when shop_info is null then '[]' else shop_info end shop_info,comments,''
price_detail,updatetime,freeze
price_detail,updatetime,freeze,late_pay_price
from wx_bill_property where tenant_id=#{tenantId} and is_preview = 0
union all
select 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,shop_info,NULL comments,'' price_detail,updatetime,freeze from wx_bill_property_deposit where
endtime,rent_shop_type,shop_info,NULL comments,'' price_detail,updatetime,freeze,'' late_pay_price from wx_bill_property_deposit where
tenant_id=#{tenantId}
union all
select 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,'[]' shop_info, NULL comments,price_detail,updatetime,freeze
rent_shop_type,'[]' shop_info, NULL comments,price_detail,updatetime,freeze,'' late_pay_price
from wx_bill_daily where tenant_id=#{tenantId}
union all
select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,concat('其他费用-',name) as bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price
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,concat('其他押金-',comments) as
bill_type,0 as
need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,starttime,endtime,
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze
rent_shop_type,'[]' shop_info,comments,'' price_detail,updatetime,freeze,'' late_pay_price
from wx_bill_other_deposit where tenant_id=#{tenantId}
) bill
left join wx_merchant m on bill.merchant_id=m.id
@@ -642,6 +645,7 @@
round((bill.depositReceivePay-bill.depositPay)/100,2) depositReceivePay,
round((bill.otherReceivePay-bill.otherPay)/100,2) otherReceivePay,
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay
+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay
-bill.rentPay-bill.propertyPay-bill.depositPay-bill.otherPay)/100,2) totalReceivePay
</when>
<otherwise>
@@ -649,7 +653,7 @@
round(bill.propertyReceivePay/100,2) propertyReceivePay,
round(bill.depositReceivePay/100,2) depositReceivePay,
round(bill.otherReceivePay/100,2) otherReceivePay,
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay)/100,2) totalReceivePay
round((bill.rentReceivePay+bill.propertyReceivePay+bill.depositReceivePay+bill.otherReceivePay+bill.rentLatePay+bill.propertyLatePay+bill.depositLatePay+bill.otherLatePay )/100,2) totalReceivePay
</otherwise>
</choose>

@@ -669,22 +673,28 @@
max(case oweList.bill_type when '租金' then oweList.pay else 0 end) rentPay,
max(case oweList.bill_type when '物业费' then oweList.pay else 0 end) propertyPay,
max(case oweList.bill_type when '欠缴押金' then oweList.pay else 0 end) depositPay,
max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay
max(case oweList.bill_type when '其他费用' then oweList.pay else 0 end) otherPay,

max(case oweList.bill_type when '租金' then oweList.latePayPrice else 0 end) rentLatePay,
max(case oweList.bill_type when '物业费' then oweList.latePayPrice else 0 end) propertyLatePay,
max(case oweList.bill_type when '欠缴押金' then oweList.latePayPrice else 0 end) depositLatePay,
max(case oweList.bill_type when '其他费用' then oweList.latePayPrice else 0 end) otherLatePay

from(
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay from (
select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day,sum(bill.receive_pay) receive_pay,sum(bill.pay) pay,sum(bill.late_pay_price) latePayPrice from (

select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0
endtime,rent_shop_type,late_pay_price from wx_bill_rent where tenant_id = #{tenantId} and is_preview = 0
<include refid="getOweBillAsPageConditions"/>
union all
select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0
endtime,rent_shop_type,late_pay_price from wx_bill_property where tenant_id = #{tenantId} and is_preview = 0
<include refid="getOweBillAsPageConditions"/>
union all
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay,
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from(
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from(
select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金'
bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,''
endtime,rent_shop_type from wx_bill_rent_deposit where tenant_id = #{tenantId}
@@ -702,7 +712,7 @@
) res
union all
select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay,
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from(
res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type,0 late_pay_price from(
select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as
need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type
from wx_bill_daily where tenant_id = #{tenantId} and type in(1,2,3)


+ 3
- 1
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Vedi File

@@ -505,7 +505,9 @@
<if test="endtime != null">
and o.create_date &lt;= #{endtime}
</if>
order by o.create_date desc
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by o.create_date desc</if>

</select>

<select id="findByTrade" parameterType="java.util.Map" resultMap="BaseResultMap">


Caricamento…
Annulla
Salva