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

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

release_toaliyun_real
luozukai 6 лет назад
Родитель
Сommit
4f70cd391d
6 измененных файлов: 107 добавлений и 19 удалений
  1. +11
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillSettle.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillSettleRecordMapper.java
  3. +7
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxBillSettleServiceImpl.java
  4. +3
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  5. +81
    -15
      mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml
  6. +4
    -0
      mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml

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

@@ -31,19 +31,28 @@ public class WxBillSettle extends BaseEntity {
@io.swagger.annotations.ApiModelProperty(value="结算单号",name="settleNumber")
@Excel(name="结算单号",width = 20,orderNum = "1")
private String settleNumber;
@Transient
@Excel(name="结算商户",width = 20,orderNum = "2")
private String merchantName;
@io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId")
private Long merchantId;
@io.swagger.annotations.ApiModelProperty(value="0待确认1未清算结余金额2结算完成",name="status")
@Excel(name="结算状态",width = 20,orderNum = "8")
private Integer status;
@io.swagger.annotations.ApiModelProperty(value="审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回",name="applyStatus")
@Excel(name="审批状态",width = 20,orderNum = "9")
private Integer applyStatus;
@Excel(name="收款(元)",width = 20,orderNum = "4")
@io.swagger.annotations.ApiModelProperty(value="收款",name="receiveMoney")
private Long receiveMoney;
@io.swagger.annotations.ApiModelProperty(value="承付",name="payMoney")
@Excel(name="承付(元)",width = 20,orderNum = "5")
private Long payMoney;
@io.swagger.annotations.ApiModelProperty(value="结算时间",name="settletime")
@Excel(name="结算时间",width = 20,orderNum = "7")
private Date settletime;

@Excel(name="创建时间",width = 20,orderNum = "3")
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime")
private Date createtime;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime")
@@ -55,6 +64,7 @@ public class WxBillSettle extends BaseEntity {

//结余金额
@Transient
@Excel(name="结算金额(元)",width = 20,orderNum = "6")
private Long balance;

@Transient
@@ -66,4 +76,5 @@ public class WxBillSettle extends BaseEntity {
@Transient
@io.swagger.annotations.ApiModelProperty(value = "结单记录", name = "settleRecordList")
private List<WxBillSettleRecord> settleRecordList;

}

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxBillSettleRecordMapper.java Просмотреть файл

@@ -15,5 +15,6 @@ public interface WxBillSettleRecordMapper extends CommonMapper<WxBillSettleRecor

void update(WxBillSettleRecord record);

Long getSumMoneyBySettleId(WxBillSettle wxBillSettle);

}

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

@@ -56,7 +56,11 @@ public class WxBillSettleServiceImpl implements WxBillSettleService {

@Override
public PageInfo<WxBillSettle> listAsPage(WxBillSettle record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillSettleMapper.findList(record));
PageInfo<WxBillSettle> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillSettleMapper.findList(record));
pageInfo.getList().stream().forEach(e->{
e.setBalance(e.getReceiveMoney() - e.getPayMoney());
});
return pageInfo;
}

@Override
@@ -79,8 +83,8 @@ public class WxBillSettleServiceImpl implements WxBillSettleService {
billSettle.setSettleRecordList(wxBillSettleRecordMapper.findList(wxBillSettleRecord));

//计算结余金额
//todo:
Long sumSettleMoney = wxBillSettleRecordMapper.getSumMoneyBySettleId(billSettle);
billSettle.setBalance(billSettle.getReceiveMoney() - (billSettle.getPayMoney()+sumSettleMoney));
}

return billSettle;


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

@@ -373,7 +373,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
}
}
ratioVo.setUseRatio(ratioVo.getUseRatio().substring(0,ratioVo.getUseRatio().lastIndexOf(","))+"]");
if(!"[".equals(ratioVo.getUseRatio())) {
ratioVo.setUseRatio(ratioVo.getUseRatio().substring(0, ratioVo.getUseRatio().lastIndexOf(",")) + "]");
}
return ratioVo;
}



+ 81
- 15
mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml Просмотреть файл

@@ -8,12 +8,12 @@
<result column="merchant_id" property="merchantId"/>
<result column="status" property="status"/>
<result column="apply_status" property="applyStatus"/>
<result column="receive_money" property="receiveMoney"/>
<result column="pay_money" property="payMoney"/>
<result column="receiveMoney" property="receiveMoney"/>
<result column="payMoney" property="payMoney"/>
<result column="settletime" property="settletime"/>
<result column="createtime" property="createtime"/>
<result column="updatetime" property="updatetime"/>
<result column="merchantName" property="merchantName"/>

</resultMap>

@@ -24,22 +24,88 @@

<sql id="dynamicWhereConditions">
where 1=1
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != tenantId ">and `tenant_id` = #{tenantId}</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != id ">and s.`id` = #{id}</if>
<if test=" null != tenantId ">and s.`tenant_id` = #{tenantId}</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxBillSettle" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_bill_settle
select s.*,m.name merchantName,
(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
) receiveMoney,
(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
) payMoney
from wx_bill_settle s left JOIN wx_merchant m on(s.merchant_id=m.id)

<include refid="dynamicWhereConditions"/>
</select>



+ 4
- 0
mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml Просмотреть файл

@@ -45,6 +45,10 @@
<include refid="dynamicWhereConditions"/>
</select>

<select id="getSumMoneyBySettleId" parameterType="com.iformall.domain.po.WxBillSettle" resultType="long">
select sum(settle_money) from wx_bill_settle_record where settle_id = #{id}
</select>


</mapper>


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