winter 1 год назад
Родитель
Сommit
492d299be6
5 измененных файлов: 118 добавлений и 76 удалений
  1. +6
    -4
      mallinkService/src/main/java/com/iformall/domain/po/WxAllBill.java
  2. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  3. +66
    -47
      mallinkService/src/main/java/com/iformall/service/impl/WxAllBillServiceImpl.java
  4. +26
    -23
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  5. +18
    -0
      mallinkService/src/main/resources/mapper/WxAllBillMapper.xml

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

@@ -415,13 +415,15 @@ public class WxAllBill extends TenantEntity {
@TableField(exist = false)
private String energyFeesIdStr;
@TableField(exist = false)
private String merchantLinkPerson;
private String cusLinkPerson;
@TableField(exist = false)
private String merchantPhone;
private String cusPhone;
@TableField(exist = false)
private String queryShopNumber;
@TableField(exist = false)
private String rentName;
@TableField(exist = false)
private Date receiveDateEnd;
@TableField(exist = false)
private List<Long> shopIdList;
@TableField(exist = false)
private List<Long> cusNameShopIdList;
}

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

@@ -122,8 +122,6 @@ public interface WxShopService {
Map<Long,String> getMerchantShopNumberMap(TenantEntity tenantEntity,List<Long> merchantIds,Integer isDel);
List<Long> getFloorBuildShopIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer shopDel) ;
List<Long> getMerchantIds(WxShop wxShop);
List<String> getShopNumberList(WxShop wxShop);
@@ -146,5 +144,7 @@ public interface WxShopService {
Map<Long,WxShopUsers> getShopUserMap(WxShopUsers wxShopUsers);
WxShopUsers getCurrentShopUser(TenantEntity tenantEntity,Long shopId);
List<Long> getFloorBuildShopIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer shopDel ,String shopNumber) ;
}

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

@@ -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;


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

@@ -1006,29 +1006,6 @@ public class WxShopServiceImpl implements WxShopService {
return null;
}
@Override
public List<Long> getFloorBuildShopIds(TenantEntity tenantEntity, String floorRule, Long building, Long floor,Integer shopDel) {
if (null != floorRule || null != building || null != floor) {
WxShop shopQ = new WxShop();
if (null != shopDel) {
shopQ.setIsDel(shopDel);
}
shopQ.updateTenantInfo(tenantEntity);
if (null != floorRule) {
shopQ.setFloorForRule(floorRule);
}
if (null != building) {
shopQ.setBuilding(building);
}
if (null != floor) {
shopQ.setFloor(floor);
}
List<Long> shopIds = wxShopMapper.findIdList(shopQ);
return shopIds;
}
return null;
}

@Override
public List<Long> getMerchantIds(WxShop wxShop) {
List<Long> shopIds = this.getShopIds(wxShop);
@@ -1049,6 +1026,7 @@ public class WxShopServiceImpl implements WxShopService {

@Override
public WxShopUsers getOneShopUsers(WxShopUsers wxShopUsers) {
wxShopUsers.setSortColumn(" status asc, type desc");
List<WxShopUsers> list = wxShopUsersMapper.findList(wxShopUsers);
if (null != list && list.size() > 0) {
return list.get(0);
@@ -1148,4 +1126,29 @@ public class WxShopServiceImpl implements WxShopService {
};
return list.get(0);
}

@Override
public List<Long> getFloorBuildShopIds(TenantEntity tenantEntity, String floorRule, Long building, Long floor,
Integer shopDel, String shopNumber) {
WxShop shopQ = new WxShop();
if (null != shopDel) {
shopQ.setIsDel(shopDel);
}
shopQ.updateTenantInfo(tenantEntity);
if (null != floorRule) {
shopQ.setFloorForRule(floorRule);
}
if (null != building) {
shopQ.setBuilding(building);
}
if (null != floor) {
shopQ.setFloor(floor);
}
if (StringUtils.isNotBlank(shopNumber)) {
shopQ.setShopNumber(shopNumber);
}
List<Long> shopIds = wxShopMapper.findIdList(shopQ);
return shopIds;
}
}

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

@@ -61,6 +61,7 @@
where `tenant_id` = #{tenantId}
<if test=" null != id ">and `id` = #{id}</if>
<if test=" null != parentTenantId and '' != parentTenantId"> and `parent_tenant_id` = #{parentTenantId}</if>
<if test=" null != shopId ">and `shop_id` = #{shopId}</if>
<if test=" null != createBy ">and `create_by` = #{createBy}</if>
<if test=" null != createByName and '' != createByName"> and `create_by_name` like concat('%',#{createByName},'%')</if>
<if test=" null != billType ">and `bill_type` = #{billType}</if>
@@ -132,6 +133,23 @@
<if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if>
<if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if>
<if test=" null != energyReadingId ">and `energy_reading_id` = #{energyReadingId}</if>
<if test=" null != cusName and '' != cusName">
and ( cus_name like concat('%',#{cusName},'%')
<if test=" null != cusNameShopIdList ">
or `shop_id` in
<foreach collection="cusNameShopIdList" index="index" item="cusShopidItem" open="(" separator="," close=")">
#{cusShopidItem}
</foreach>
</if>
)
</if>
<if test=" null != shopIdList ">
and `shop_id` in
<foreach collection="shopIdList" index="index" item="shopidItem" open="(" separator="," close=")">
#{shopidItem}
</foreach>
</if>
<if test=" null != energyFeesIds ">
and `energy_fees_id` in
<foreach collection="energyFeesIds" index="index" item="eidItem" open="(" separator="," close=")">


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