winter 2 лет назад
Родитель
Сommit
a55f1566b4
10 измененных файлов: 231 добавлений и 33 удалений
  1. +7
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java
  2. +7
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillProperty.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxBillPropertyDeposit.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyDepositMapper.java
  5. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxBillPropertyMapper.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  7. +138
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java
  8. +12
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  9. +11
    -0
      mallinkService/src/main/resources/mapper/WxBillPropertyDepositMapper.xml
  10. +47
    -32
      mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml

+ 7
- 1
mallinkAdmin/src/main/java/com/iformall/controller/rent/WxBillPropertyController.java Просмотреть файл

@@ -6,6 +6,7 @@ import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.WxBillProperty;
import com.iformall.domain.po.WxUserDataRule;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.service.WxBillPropertyService;
import io.swagger.annotations.ApiImplicitParam;
@@ -34,13 +35,18 @@ public class WxBillPropertyController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
@SystemControllerLog(description = "物业账单-列表")
public ResultData list(@ModelAttribute WxBillProperty wxBillProperty, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxBillPropertyController::list");
if (null == wxBillProperty) {
wxBillProperty = new WxBillProperty();
}
wxBillProperty.updateTenantInfo(getTenantInfo());
WxUserDataRule dataRule = this.getCurrentDataFloors();
if (null != dataRule) {
wxBillProperty.setFloorForRule(dataRule.getFloorForRule());
wxBillProperty.setBusinessForRule(dataRule.getBusinessForRule());
}
wxBillProperty.setSortColumns(BaseEntity.SortField.Createtime_DESC,BaseEntity.SortField.Id_DESC);
PageInfo<WxBillProperty> result = wxBillPropertyService.listAsPage(wxBillProperty, pageNum, pageSize);
return new ResultData(result);


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

@@ -11,6 +11,7 @@ import lombok.ToString;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
* @author gongbiao
@@ -221,4 +222,10 @@ public class WxBillProperty extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor")
@TableField(exist = false)
private Long floor;
@TableField(exist = false)
private List<Long> propertyContractIds;
@TableField(exist = false)
private List<Long> merchantIds;
}

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

@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

/**
* @author gongbiao
@@ -93,4 +94,6 @@ public class WxBillPropertyDeposit extends TenantEntity {
private String serviceChargePayBefore;
@TableField(exist = false)
private String serviceChargePayUpdate;
@TableField(exist = false)
private List<Long> propertyContractIdList;
}

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

@@ -13,6 +13,8 @@ import java.util.Map;
public interface WxBillPropertyDepositMapper extends CommonMapper<WxBillPropertyDeposit, Long> {

List<WxBillPropertyDeposit> findList(WxBillPropertyDeposit wxBillPropertyDeposit);
List<Long> findPropertyContractIds(WxBillPropertyDeposit wxBillPropertyDeposit);

List<WxBillPropertyDeposit> queryBillDepositList(WxBillPropertyDeposit record);



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

@@ -17,6 +17,8 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long>
List<WxBillProperty> findList(WxBillProperty wxBillProperty);

List<WxBillProperty> queryBillPropertyList(WxBillProperty record);
List<Long> queryPropertyContractIdList(WxBillProperty record);

Map<String,Object> queryPayInfo(Map<String,Object> params);



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

@@ -107,5 +107,7 @@ public interface WxShopService {
WxShop getShopByShopNumber(TenantEntity tenantEntity,String shopNumber);
List<Long> getShopIds(WxShop wxShop);
Map<Long,WxShop> findShopMap(WxShop wxShop);

}

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

@@ -15,12 +15,16 @@ import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxBillActionMapper;
import com.iformall.mapper.WxBillPropertyDepositMapper;
import com.iformall.mapper.WxBillPropertyMapper;
import com.iformall.mapper.WxPropertyContractMapper;
import com.iformall.service.*;
import com.iformall.utils.DateUtils;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@@ -42,6 +46,9 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {

@Autowired
WxBillPropertyDepositMapper wxBillPropertyDepositMapper;
@Autowired
WxPropertyContractMapper wxPropertyContractMapper;

@Autowired
WxBillActionService wxBillActionService;
@@ -55,6 +62,15 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
WxPayAccountBillService wxPayAccountBillService;
@Autowired
WxBillPropertyDepositService wxBillPropertyDepositService;
@Lazy
@Autowired
WxMerchantService wxMerchantService;
@Lazy
@Autowired
WxShopService wxShopService;


@Override
@@ -69,6 +85,128 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService {
PageInfo<WxBillProperty> pageInfo = new PageInfo<>(billRentList);
return pageInfo;
}
private PageInfo<WxBillProperty> getBillPropertyList(Integer pageIndex, Integer pageSize,WxPayAccountBill wxPayAccountBill,WxBillProperty record) {
if(null != record.getDepositStatus()) {
WxBillPropertyDeposit bdq1 = new WxBillPropertyDeposit();
bdq1.updateTenantInfo(record);
bdq1.setStatus(record.getDepositStatus());
List<Long> rentids = wxBillPropertyDepositMapper.findPropertyContractIds(bdq1);
if (null != rentids && rentids.size() > 0 ) {
record.setPropertyContractIds(rentids);
}else {
record.setId(-1L);
}
}
if (null != record.getFloorForRule() || null != record.getFloor() || null != record.getBuilding()) {
List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(record, record.getFloorForRule(), record.getBuilding(), record.getFloor(), 0, 0);
if (null != merchantIds) {
record.setMerchantIds(merchantIds);
}else {
record.setId(-1L);
}
}
if (StringUtils.isNotBlank(record.getMerchantName())) {
WxMerchant mq = new WxMerchant();
mq.updateTenantInfo(record);
mq.setName(StringUtils.trimToNull(record.getMerchantName()));
List<Long> mids = wxMerchantService.findIdList(mq);
if (null != mids && mids.size() > 0 ) {
if (null != record.getMerchantIds()) {
List<Long> _mids = (List<Long>) CollectionUtils.intersection(mids, record.getMerchantIds());
if (null == _mids || _mids.size() <= 0) {
record.setId(-1L);
}else {
record.setMerchantIds(_mids);
}
}else {
record.setMerchantIds(mids);
}
}else {
record.setId(-1L);
}
}
PageInfo<WxBillProperty> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillPropertyMapper.queryBillPropertyList(record));
if (null == page) {
return null;
}
List<Long> propertyContractIdList = wxBillPropertyMapper.queryPropertyContractIdList(record);
Map<Long,WxPropertyContract> propertyContractMap = new HashMap<Long,WxPropertyContract>();
Map<Long,WxBillPropertyDeposit> billDepositMap = new HashMap<Long,WxBillPropertyDeposit>();
if ( null != propertyContractIdList && propertyContractIdList.size() > 0 ) {
WxPropertyContract rcq = new WxPropertyContract();
rcq.updateTenantInfo(record);
rcq.setIds(propertyContractIdList);
List<WxPropertyContract> rlist = wxPropertyContractMapper.findList(rcq);
if (null != rlist && rlist.size() > 0 ) {
for (int i = 0 ; i < rlist.size(); i++) {
WxPropertyContract rc = rlist.get(i);
propertyContractMap.put(rc.getId(), rc);
}
}
WxBillPropertyDeposit bdq = new WxBillPropertyDeposit();
bdq.updateTenantInfo(record);
bdq.setPropertyContractIdList(propertyContractIdList);
List<WxBillPropertyDeposit> bdlist = wxBillPropertyDepositMapper.findList(bdq);
if (null != bdlist && bdlist.size() > 0 ) {
for (int i = 0 ; i < bdlist.size(); i++) {
WxBillPropertyDeposit rc = bdlist.get(i);
billDepositMap.put(rc.getId(), rc);
}
}
}
WxMerchant wq = new WxMerchant();
wq.updateTenantInfo(record);
Map<Long,WxMerchant> merchantMap = wxMerchantService.findMerchantMap(wq);
WxShop sq = new WxShop();
sq.updateTenantInfo(record);
Map<Long,WxShop> shopMap = wxShopService.findShopMap(sq);
if (null != page.getList()) {
for (int i = 0 ; i < page.getList().size() ; i ++) {
WxBillProperty e = page.getList().get(i);
//手续费 = 合同应收+手续费+滞纳金
computeTotalMoney(wxPayAccountBill, e);
if (null != e.getMerchantId()) {
WxMerchant m = merchantMap.get(e.getMerchantId());
if (null != m ) {
e.setMerchantName(m.getName());
}
}
if (null != e.getShopId()) {
WxShop shop = shopMap.get(e.getShopId());
if (null != shop) {
e.setShopNumber(shop.getShopNumber());
}
}
WxPropertyContract rent = propertyContractMap.get(e.getPropertyContractId());
if (null != rent) {
// if (StringUtils.isNoneBlank(rent.getLatePayRatio())) {
// e.setLatePayRatio(Integer.parseInt(rent.getLatePayRatio()));
// }
e.setLatePayDay(rent.getLatePayDay());
}
WxBillPropertyDeposit bd = billDepositMap.get(e.getPropertyContractId());
if (null != bd) {
e.setDeposit(bd.getReceivePay());
e.setDepositStatus(bd.getStatus());
}
}
}
return page;
}

public void computeTotalMoney(WxPayAccountBill wxPayAccountBill, WxBillProperty e) {
//手续费 = 合同应收+手续费+滞纳金


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

@@ -31,6 +31,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service
public class WxShopServiceImpl implements WxShopService {
@@ -713,4 +715,14 @@ public class WxShopServiceImpl implements WxShopService {
public List<Long> getShopIds(WxShop wxShop) {
return wxShopMapper.findIdList(wxShop);
}

@Override
public Map<Long, WxShop> findShopMap(WxShop wxShop) {
Map<Long, WxShop> shopMap = new HashMap<Long,WxShop>();
List<WxShop> list = wxShopMapper.findList(wxShop);
if(!list.isEmpty()){
shopMap = list.stream().collect(Collectors.toMap(WxShop::getId, Function.identity()));
}
return shopMap;
}
}

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

@@ -67,6 +67,12 @@
<if test=" null != rentShopType ">and `rent_shop_type` = #{rentShopType}</if>
<if test=" null != payWay ">and `pay_way` = #{payWay}</if>
<if test=" null != propertyContractIdList ">
and property_contract_id in
<foreach collection="propertyContractIdList" index="index" item="pidItem" open="(" separator="," close=")">
#{pidItem}
</foreach>
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -81,6 +87,11 @@
<include refid="dynamicWhereConditions" />
</select>
<select id="findPropertyContractIds" parameterType="com.iformall.domain.po.WxBillPropertyDeposit" resultMap="BaseResultMap">
select distinct property_contract_id from wx_bill_property_deposit
<include refid="dynamicWhereConditions" />
</select>
<select id="queryBillDepositList" parameterType="com.iformall.domain.po.WxBillPropertyDeposit"
resultMap="BaseResultMap">
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,


+ 47
- 32
mallinkService/src/main/resources/mapper/WxBillPropertyMapper.xml Просмотреть файл

@@ -86,6 +86,20 @@
<if test=" null != payWay ">and `pay_way` = #{payWay}</if>
<if test=" null != latePayStatus ">and `late_pay_status` = #{latePayStatus}</if>

<if test=" null != propertyContractIds ">
and property_contract_id in
<foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
#{pidItem}
</foreach>
</if>
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")">
#{midItem}
</foreach>
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -102,25 +116,13 @@
<include refid="dynamicWhereConditions"/>
</select>

<select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap">
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,m.`name`
merchant_name,s.shop_number,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,
br.`revenue`,r.`late_pay_ratio`,br.`late_pay_time`,br.`property_contract_id`,d.receive_pay deposit,
br.late_pay_price,d.`status`
deposit_status,br.`shop_info`,br.pay_way,br.late_pay_status,
br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,
r.late_pay_day,r.late_pay_ratio,br.freeze,br.service_charge_pay
from wx_bill_property br left join wx_merchant m on br.merchant_id=m.id
left join wx_shop s on br.shop_id=s.id
left join wx_property_contract r on br.property_contract_id=r.id
left join wx_bill_property_deposit d on br.property_contract_id=d.property_contract_id
<where>

<sql id="queryBillPropertyListConditions">
<where>
br.is_preview = 0
<if test=" null != freeze ">and br.`freeze` = #{freeze}</if>
<if test=" null != id ">and br.`id` = #{id}</if>
<if test=" null != merchantId ">and br.`merchant_id` = #{merchantId}</if>
<if test=" null != merchantName and ''!=merchantName ">and m.`name` like concat('%',#{merchantName},'%')</if>
<if test=" null != status ">and br.`status` = #{status}</if>
<if test=" null != applyStatus ">and br.`apply_status` = #{applyStatus}</if>
<if test=" null != isDel ">and br.`is_del` = #{isDel}</if>
@@ -130,26 +132,39 @@
<if test=" null != payWay ">and br.`pay_way` = #{payWay}</if>
<if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if>
<if test=" null != latePayStatus ">and br.`late_pay_status` = #{latePayStatus}</if>
<if test=" null != depositStatus ">and d.`status` = #{depositStatus}</if>

<if test=" null != building or null != floor">
and br.merchant_id in(
select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
inner join wx_merchant m on ms.merchant_id = m.id
inner join wx_shop s on s.id=ms.shop_id
where s.is_del=0
<if test=" null != building ">
and s.`building`= #{building}
</if>
<if test=" null != floor">
and s.`floor` = #{floor}
</if>
)

</if>

<if test=" null != propertyContractIds ">
and br.property_contract_id in
<foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
#{pidItem}
</foreach>
</if>
<if test=" null != merchantIds ">
and br.merchant_id in
<foreach collection="merchantIds" index="index" item="midItem" open="(" separator="," close=")">
#{midItem}
</foreach>
</if>
</where>
</sql>

<select id="queryBillPropertyList" parameterType="com.iformall.domain.po.WxBillProperty" resultMap="BaseResultMap">
select br.`id`,br.`receive_pay`,br.`pay`,br.`receive_date`,br.`pay_date`,br.`createtime`,br.`expired_day`,
case when br.status=1 then br.owe else 0 end owe,br.`status`,br.`need_pay`,br.`updatetime`,br.`merchant_id`,br.`rent_shop_type`,br.`period`,
br.`revenue`,br.`late_pay_time`,br.`property_contract_id`,br.late_pay_price,br.`shop_info`,br.pay_way,br.late_pay_status,
br.`comments`,br.starttime,br.endtime,br.`apply_status`,br.`apply_pay_img`,br.`apply_update_time`,br.freeze,br.service_charge_pay,
br.`late_pay_ratio`
from wx_bill_property br
<include refid="queryBillPropertyListConditions"/>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</select>
<select id="queryPropertyContractIdList" parameterType="com.iformall.domain.po.WxBillProperty" resultType="Long">
select distinct property_contract_id
from wx_bill_property
<include refid="queryBillPropertyListConditions"/>
</select>

<select id="queryPayInfo" resultType="hashmap" parameterType="hashmap">
select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property


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