|
|
|
@@ -18,6 +18,8 @@ import com.iformall.domain.po.WxMerchant; |
|
|
|
import com.iformall.domain.po.WxMerchantBUser; |
|
|
|
import com.iformall.domain.po.WxPropertyContract; |
|
|
|
import com.iformall.domain.po.WxRentContract; |
|
|
|
import com.iformall.domain.po.WxShop; |
|
|
|
import com.iformall.domain.po.WxShopUsers; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.domain.vo.RatioVo; |
|
|
|
import com.iformall.domain.vo.WxBillHotNotify; |
|
|
|
@@ -27,6 +29,7 @@ import com.iformall.enums.EnumBillAction; |
|
|
|
import com.iformall.enums.EnumBillAllType; |
|
|
|
import com.iformall.enums.EnumBillStatus; |
|
|
|
import com.iformall.enums.EnumRentShopType; |
|
|
|
import com.iformall.enums.EnumShopUsersStatus; |
|
|
|
import com.iformall.enums.EnumYesOrNo; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.WxAllBillMapper; |
|
|
|
@@ -118,31 +121,21 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill |
|
|
|
|
|
|
|
private void updateQueryParam(WxAllBill wxBillRent) { |
|
|
|
if (StringUtils.isNotBlank(wxBillRent.getShopNumber()) || null != wxBillRent.getFloorForRule() || null != wxBillRent.getFloor() || null != wxBillRent.getBuilding()) { |
|
|
|
List<Long> merchantIds = wxMerchantService.getFloorBuildMerchantIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(),wxBillRent.getShopTypeForRule(), 0, 0,wxBillRent.getShopNumber()); |
|
|
|
if (null != merchantIds) { |
|
|
|
wxBillRent.setMerchantIdList(merchantIds); |
|
|
|
List<Long> shopIds = wxShopService.getFloorBuildShopIds(wxBillRent, wxBillRent.getFloorForRule(), wxBillRent.getBuilding(), wxBillRent.getFloor(), 0,wxBillRent.getShopNumber()); |
|
|
|
if (null != shopIds && shopIds.size() > 0 ) { |
|
|
|
wxBillRent.setShopIdList(shopIds); |
|
|
|
}else { |
|
|
|
wxBillRent.setId(-1L); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(wxBillRent.getMerchantName()) || StringUtils.isNotBlank(wxBillRent.getShopTypeForRule())) { |
|
|
|
WxMerchant mq = new WxMerchant(); |
|
|
|
mq.updateTenantInfo(wxBillRent); |
|
|
|
mq.setName(StringUtils.trimToNull(wxBillRent.getMerchantName())); |
|
|
|
mq.setShopTypeForRule(wxBillRent.getShopTypeForRule()); |
|
|
|
List<Long> mids = wxMerchantService.findIdList(mq); |
|
|
|
if (null != mids && mids.size() > 0 ) { |
|
|
|
if (null != wxBillRent.getMerchantIdList()) { |
|
|
|
List<Long> _mids = (List<Long>) CollectionUtils.intersection(mids, wxBillRent.getMerchantIdList()); |
|
|
|
if (null == _mids || _mids.size() <= 0) { |
|
|
|
wxBillRent.setId(-1L); |
|
|
|
}else { |
|
|
|
wxBillRent.setMerchantIdList(_mids); |
|
|
|
} |
|
|
|
}else { |
|
|
|
wxBillRent.setMerchantIdList(mids); |
|
|
|
} |
|
|
|
//List<Long> _sids = (List<Long>) CollectionUtils.intersection(shopIds, wxBillRent.getShopIdList()); |
|
|
|
if (StringUtils.isNotBlank(wxBillRent.getCusName())) { |
|
|
|
WxShopUsers suq = new WxShopUsers(); |
|
|
|
suq.updateTenantInfo(wxBillRent); |
|
|
|
suq.setName(wxBillRent.getCusName()); |
|
|
|
List<Long> shopIds = wxShopService.getUserShopIds(suq); |
|
|
|
if (null != shopIds && shopIds.size() > 0 ) { |
|
|
|
wxBillRent.setCusNameShopIdList(shopIds);; |
|
|
|
}else { |
|
|
|
wxBillRent.setId(-1L); |
|
|
|
} |
|
|
|
@@ -170,36 +163,52 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill |
|
|
|
} |
|
|
|
if (null != page.getList() && page.getList().size() > 0 ) { |
|
|
|
|
|
|
|
List<Long> merchantIds = new ArrayList<Long>(); |
|
|
|
List<Long> shopIds = new ArrayList<Long>(); |
|
|
|
for (int i = 0 ; i < page.getList().size() ; i ++) { |
|
|
|
WxAllBill ab = page.getList().get(i); |
|
|
|
merchantIds.add(ab.getMerchantId()); |
|
|
|
if (null != ab.getShopId()) { |
|
|
|
shopIds.add(ab.getShopId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Map<Long, String> shopNumberMap = wxShopService.getMerchantShopNumberMap(record, merchantIds, null); |
|
|
|
WxMerchant mq = new WxMerchant(); |
|
|
|
mq.updateTenantInfo(record); |
|
|
|
mq.setIds(merchantIds); |
|
|
|
Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(mq); |
|
|
|
Map<Long, WxShop> shopMap = null; |
|
|
|
Map<Long, WxShopUsers> shopUserMap = null; |
|
|
|
if (shopIds.size() > 0 ) { |
|
|
|
WxShop sq = new WxShop(); |
|
|
|
sq.updateTenantInfo(record); |
|
|
|
sq.setIds(shopIds); |
|
|
|
shopMap = wxShopService.findShopMap(sq); |
|
|
|
|
|
|
|
WxShopUsers suq = new WxShopUsers(); |
|
|
|
suq.updateTenantInfo(record); |
|
|
|
suq.setShopIds(shopIds); |
|
|
|
suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); |
|
|
|
shopUserMap = wxShopService.getShopUserMap(suq); |
|
|
|
} |
|
|
|
|
|
|
|
WxEnergyFees fq = new WxEnergyFees(); |
|
|
|
fq.updateTenantInfo(record); |
|
|
|
Map<Long, WxEnergyFees> feesMap = wxEnergyService.getFeesMap(fq); |
|
|
|
for (int i = 0 ; i < page.getList().size() ; i ++) { |
|
|
|
WxAllBill e = page.getList().get(i); |
|
|
|
if (StringUtils.isBlank(e.getShopNumber())) { |
|
|
|
if (null != shopNumberMap) { |
|
|
|
e.setShopNumber(shopNumberMap.get(e.getMerchantId())); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != merchantMap) { |
|
|
|
WxMerchant m = merchantMap.get(e.getMerchantId()); |
|
|
|
if (null != m) { |
|
|
|
e.setMerchantName(m.getName()); |
|
|
|
e.setMerchantLinkPerson(m.getLinkPerson()); |
|
|
|
e.setMerchantPhone(m.getLinkPhone()); |
|
|
|
e.setRentName(wxShopService.getRentName(m)); |
|
|
|
} |
|
|
|
if (null != e.getShopId()) { |
|
|
|
if (null != shopMap) { |
|
|
|
WxShop shop = shopMap.get(e.getShopId()); |
|
|
|
if (null != shop) { |
|
|
|
e.setShopNumber(shop.getShopNumber()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (null != shopUserMap) { |
|
|
|
WxShopUsers wsu = shopUserMap.get(e.getShopId()); |
|
|
|
if (null != wsu) { |
|
|
|
if (StringUtils.isBlank(e.getCusName())) { |
|
|
|
e.setCusName(wsu.getName()); |
|
|
|
} |
|
|
|
e.setCusLinkPerson(wsu.getLinkPerson()); |
|
|
|
e.setCusPhone(wsu.getPhone()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != feesMap) { |
|
|
|
WxEnergyFees f = feesMap.get(e.getEnergyFeesId()); |
|
|
|
@@ -227,12 +236,22 @@ public class WxAllBillServiceImpl extends WxBillBaseService implements WxAllBill |
|
|
|
@Override |
|
|
|
public WxAllBill getById(TenantEntity tenantEntity,Long id) { |
|
|
|
WxAllBill bill = wxAllBillMapper.selectById(id, tenantEntity.getTenantId()); |
|
|
|
if (null != bill) { |
|
|
|
WxMerchant merchant = wxMerchantService.selectById(bill.getMerchantId()); |
|
|
|
if (null != merchant) { |
|
|
|
bill.setMerchantName(merchant.getName()); |
|
|
|
bill.setMerchantLinkPerson(merchant.getLinkPerson()); |
|
|
|
bill.setMerchantPhone(merchant.getLinkPhone()); |
|
|
|
if (null != bill && null != bill.getShopId()) { |
|
|
|
WxShop shop = wxShopService.getById(bill.getShopId()); |
|
|
|
WxShopUsers suq = new WxShopUsers(); |
|
|
|
suq.updateTenantInfo(tenantEntity); |
|
|
|
suq.setShopId(bill.getShopId()); |
|
|
|
suq.setStatus(EnumShopUsersStatus.LIVE.getCode()); |
|
|
|
WxShopUsers su = wxShopService.getOneShopUsers(suq); |
|
|
|
if (null != shop) { |
|
|
|
bill.setShopNumber(shop.getShopNumber()); |
|
|
|
} |
|
|
|
if (null != su) { |
|
|
|
if (StringUtils.isBlank(bill.getCusName())) { |
|
|
|
bill.setCusName(su.getName()); |
|
|
|
} |
|
|
|
bill.setCusLinkPerson(su.getLinkPerson()); |
|
|
|
bill.setCusPhone(su.getPhone()); |
|
|
|
} |
|
|
|
} |
|
|
|
return bill; |
|
|
|
|