winter 3 лет назад
Родитель
Сommit
0a59a049f4
13 измененных файлов: 194 добавлений и 45 удалений
  1. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java
  2. +9
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardSpendVo.java
  3. +8
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCardVo.java
  4. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCardInfoMapper.java
  5. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java
  6. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  7. +17
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java
  8. +23
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  9. +70
    -42
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  10. +6
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  11. +17
    -0
      mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml
  12. +8
    -0
      mallinkService/src/main/resources/mapper/WxCardSpendMapper.xml
  13. +27
    -0
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml

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

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


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


@TableName(value = "wx_card_info") @TableName(value = "wx_card_info")
@Data @Data
@@ -67,4 +68,7 @@ public class WxCardInfo extends TenantEntity {
@TableField(exist = false) @TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate")
protected Date enddate; protected Date enddate;
@TableField(exist = false)
private List<Long> couponIdList;
} }

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

@@ -2,6 +2,7 @@ package com.iformall.domain.vo;


import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;


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


import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
@@ -47,5 +48,13 @@ public class WxCardSpendVo extends WxCardSpend {
@io.swagger.annotations.ApiModelProperty(value="是否显示在卡消费订单",name="cardSpendListShow") @io.swagger.annotations.ApiModelProperty(value="是否显示在卡消费订单",name="cardSpendListShow")
@TableField(exist = false) @TableField(exist = false)
private Integer cardSpendListShow; private Integer cardSpendListShow;
//券上架时间
@TableField(exist = false)
private Date couponOnlineStartDate;
@TableField(exist = false)
private Date couponOnlineEndDate;
@TableField(exist = false)
private List<Long> cardIdList;


} }

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

@@ -104,4 +104,12 @@ public class WxCardVo extends WxCardInfo {
@TableField(exist = false) @TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="卡状态",name="statusStr") @io.swagger.annotations.ApiModelProperty(value="卡状态",name="statusStr")
protected String statusStr; protected String statusStr;
//券上架时间
@TableField(exist = false)
private Date couponOnlineStartDate;
@TableField(exist = false)
private Date couponOnlineEndDate;
@TableField(exist = false)
private List<Long> couponIdList;
} }

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

@@ -13,5 +13,7 @@ public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> {
void updateTransferStatusByCouponId(Long couponId); void updateTransferStatusByCouponId(Long couponId);
List<WxCardInfo> findList(WxCardInfo wxCardInfo); List<WxCardInfo> findList(WxCardInfo wxCardInfo);
List<Long> findIdList(WxCardInfo wxCardInfo);


} }

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

@@ -20,4 +20,6 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin
void realDelByMerchantId(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds); void realDelByMerchantId(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds);
List<Map<String,Object>> rentRateHistory(Map<String, Object> params); List<Map<String,Object>> rentRateHistory(Map<String, Object> params);
List<Map<String,Object>> rentRateHistoryByArea(Map<String, Object> params);
} }

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

@@ -48,7 +48,7 @@ public interface WxShopService {
PageInfo<Map<String,Object>> findListMap(WxShop record,Integer pageIndex,Integer pageSize); PageInfo<Map<String,Object>> findListMap(WxShop record,Integer pageIndex,Integer pageSize);
List<Map<String,Object>> rentRateHistory(TenantEntity tenantEntity,Map<String, Object> params);
List<Map<String,Object>> rentRateHistory(TenantEntity tenantEntity,Map<String, Object> params,boolean byArea);


/** /**
* 保存或更新实体 * 保存或更新实体


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

@@ -4,8 +4,10 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker; import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxCardInfo; import com.iformall.domain.po.WxCardInfo;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.vo.WxCardVo; import com.iformall.domain.vo.WxCardVo;
import com.iformall.mapper.WxCardInfoMapper; import com.iformall.mapper.WxCardInfoMapper;
import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.service.ExcelService; import com.iformall.service.ExcelService;
import com.iformall.service.WxCardInfoService; import com.iformall.service.WxCardInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -23,9 +25,24 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {


@Autowired @Autowired
ExcelService excelService; ExcelService excelService;
@Autowired
WxCouponChannelMapper wxCouponChannelMapper;


@Override @Override
public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) {
if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) {
WxCouponChannel wxCouponChannelQ = new WxCouponChannel();
wxCouponChannelQ.updateTenantInfo(record);
wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate());
wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate());
List<Long> ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ);
if (null == ccIds || ccIds.size() <= 0 ) {
record.setId(-999L);
}else {
record.setCouponIdList(ccIds);
}
}
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findVoList(record)); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findVoList(record));
} }




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

@@ -79,6 +79,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
@Autowired @Autowired
WxCashOutService wxCashOutService; WxCashOutService wxCashOutService;
@Autowired
WxCouponChannelMapper wxCouponChannelMapper;


@Override @Override
public WxCouponMerchant checkMerchantInCoupon(WxCardInfo cardInfo, Long merchantId) { public WxCouponMerchant checkMerchantInCoupon(WxCardInfo cardInfo, Long merchantId) {
@@ -383,6 +386,26 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {


@Override @Override
public PageInfo<WxCardSpendVo> listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize) { public PageInfo<WxCardSpendVo> listAsPage(WxCardSpendVo record, Integer pageIndex, Integer pageSize) {
if (null != record.getCouponOnlineStartDate() || null != record.getCouponOnlineEndDate() ) {
WxCouponChannel wxCouponChannelQ = new WxCouponChannel();
wxCouponChannelQ.updateTenantInfo(record);
wxCouponChannelQ.setStartdate(record.getCouponOnlineStartDate());
wxCouponChannelQ.setEnddate(record.getCouponOnlineEndDate());
List<Long> ccIds = wxCouponChannelMapper.findCouponIdList(wxCouponChannelQ);
if (null == ccIds || ccIds.size() <= 0 ) {
record.setId(-999L);
}else {
WxCardInfo cardInfo = new WxCardInfo();
cardInfo.updateTenantInfo(record);
cardInfo.setCouponIdList(ccIds);
List<Long> cardIdList = wxCardInfoMapper.findIdList(cardInfo);
if (null == cardIdList || cardIdList.size() <= 0 ) {
record.setId(-999L);
}else {
record.setCardIdList(ccIds);
}
}
}
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record)); return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSpendMapper.findCardSpendVoList(record));
} }




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

@@ -259,11 +259,7 @@ public class WxChartServiceImpl implements WxChartDataService {


//出租率 //出租率
if (chart.equals(EnumChart.CZL.getCode())) { if (chart.equals(EnumChart.CZL.getCode())) {
if (1 == chartByArea) {
return getRentRate(tenantEntity,false);
}else {
return getRentRate(tenantEntity,true);
}
return getRentRate(tenantEntity);
} }
//租金收缴率 //租金收缴率
if (chart.equals(EnumChart.ZJSJL.getCode())) { if (chart.equals(EnumChart.ZJSJL.getCode())) {
@@ -479,12 +475,17 @@ public class WxChartServiceImpl implements WxChartDataService {


//商铺出租率走势 //商铺出租率走势
if (chart.equals(EnumChart.RENT_RATE_HISTORY.getCode())) { if (chart.equals(EnumChart.RENT_RATE_HISTORY.getCode())) {
return getRentRateHistory(tenantEntity,paramsMap);
if (1 == chartByArea) {
return getRentRateHistory(tenantEntity,paramsMap,true);
}else {
return getRentRateHistory(tenantEntity,paramsMap,false);
}
} }


//业务分析 //业务分析
if (chart.equals(EnumChart.BUSINESS.getCode())) { if (chart.equals(EnumChart.BUSINESS.getCode())) {
return getBusiness(tenantEntity,paramsMap);
return getBusiness(tenantEntity,paramsMap);
} }


//电能分析 //电能分析
@@ -792,7 +793,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @param tenantEntity * @param tenantEntity
* @return * @return
*/ */
private ResultData getRentRateHistory(TenantEntity tenantEntity,Map<String, String> paramsMap) {
private ResultData getRentRateHistory(TenantEntity tenantEntity,Map<String, String> paramsMap,boolean byArea) {
Integer dateType = Integer.parseInt(paramsMap.get("dateType")); Integer dateType = Integer.parseInt(paramsMap.get("dateType"));


Map<String, Object> queryMap = new HashMap<>(); Map<String, Object> queryMap = new HashMap<>();
@@ -819,10 +820,33 @@ public class WxChartServiceImpl implements WxChartDataService {
// get all // get all
WxShop query = new WxShop(); WxShop query = new WxShop();
query.updateTenantInfo(tenantEntity); query.updateTenantInfo(tenantEntity);
Long total = wxShopMapper.getCountByWxShop(query);
// List<WxShop> allList = wxShopMapper.findList(query);

List<Map<String,Object>> mapList = wxShopService.rentRateHistory(tenantEntity,queryMap);
Map<String,String> result = null;
if (!byArea) {
result = rentHistoryByCount(tenantEntity, paramsMap, query, queryMap, dateType);
}else {
result = rentHistoryByArea(tenantEntity, paramsMap, query, queryMap, dateType);
}
if (null != result) {
return new ResultData(result);
}else {
result = new HashMap<String,String>();
if (dateType == 1) {
//出租率-日
String systemTime = DateUtils.getSystemTime("yyyy/MM/dd");
result.put(systemTime, "0%");
} else {
//出租率-月
String systemTime = DateUtils.getSystemTime("yyyy/MM");
result.put(systemTime, "0%");
}
return new ResultData(result);
}
}
private Map<String,String> rentHistoryByCount(TenantEntity tenantEntity,Map<String, String> paramsMap,WxShop query,Map<String, Object> queryMap,Integer dateType) {
Long total = wxShopMapper.getCountByWxShop(query);;
List<Map<String,Object>> mapList = wxShopService.rentRateHistory(tenantEntity,queryMap,false);
if(CollectionUtils.isNotEmpty(mapList)){ if(CollectionUtils.isNotEmpty(mapList)){
String startTime = (String)mapList.get(0).get("xTime"); String startTime = (String)mapList.get(0).get("xTime");
String endTime = (String)mapList.get(mapList.size()-1).get("xTime"); String endTime = (String)mapList.get(mapList.size()-1).get("xTime");
@@ -839,19 +863,33 @@ public class WxChartServiceImpl implements WxChartDataService {
rentTotal += map.get(key); rentTotal += map.get(key);
resultMap.put(key,formatDouble(rentTotal/all*100)+"%"); resultMap.put(key,formatDouble(rentTotal/all*100)+"%");
} }
return new ResultData(resultMap);
return resultMap;
} }
Map<Object, Object> result = new HashMap<>();
if (dateType == 1) {
//出租率-日
String systemTime = DateUtils.getSystemTime("yyyy/MM/dd");
result.put(systemTime, "0%");
} else {
//出租率-月
String systemTime = DateUtils.getSystemTime("yyyy/MM");
result.put(systemTime, "0%");
return null;
}
private Map<String,String> rentHistoryByArea(TenantEntity tenantEntity,Map<String, String> paramsMap,WxShop query,Map<String, Object> queryMap,Integer dateType) {
Long total = wxShopMapper.findAreaSum(query);
List<Map<String,Object>> mapList = wxShopService.rentRateHistory(tenantEntity,queryMap,true);
if(CollectionUtils.isNotEmpty(mapList)){
String startTime = (String)mapList.get(0).get("xTime");
String endTime = (String)mapList.get(mapList.size()-1).get("xTime");
List<String> days = DateUtils.getTjTimeList(startTime, endTime, 1==dateType.intValue()?"0":"1");
Map<String,Long> map = getMap(days);
for (Map<String,Object> m : mapList) {
map.put((String)m.get( "xTime"),(Long)m.get("buildArea"));
}

double all = total;
Map<String,String> resultMap = new LinkedMap();
double rentTotal = 0;
for (String key : map.keySet()) {
rentTotal += map.get(key);
resultMap.put(key,formatDouble(rentTotal/all*100)+"%");
}
return resultMap;
} }
return new ResultData(result);
return null;
} }


public Map<String,Long> getMap(List<String> days){ public Map<String,Long> getMap(List<String> days){
@@ -2688,29 +2726,19 @@ public class WxChartServiceImpl implements WxChartDataService {
* 出租率 * 出租率
* @param tenantEntity * @param tenantEntity
*/ */
private ResultData getRentRate(TenantEntity tenantEntity,boolean byArea) {
private ResultData getRentRate(TenantEntity tenantEntity) {
HashMap<String, Object> datamap = new HashMap<>(); HashMap<String, Object> datamap = new HashMap<>();
//出租与未出租 //出租与未出租
int yczsize = 0; int yczsize = 0;
int wczsize = 0; int wczsize = 0;
if (byArea) {
WxShop wxShop = new WxShop();
wxShop.updateTenantInfo(tenantEntity);
wxShop.setStatus(EnumShopStatus.RENT.getCode());
yczsize = wxShopMapper.findAreaSum(wxShop).intValue();
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
wczsize = wxShopMapper.findAreaSum(wxShop).intValue();
}else {
WxShop wxShop = new WxShop();
wxShop.updateTenantInfo(tenantEntity);
wxShop.setStatus(EnumShopStatus.RENT.getCode());
List<WxShop> yczlist = wxShopMapper.findList(wxShop);
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
List<WxShop> wczlist = wxShopMapper.findList(wxShop);
yczsize = yczlist.size();
wczsize = wczlist.size();
}
WxShop wxShop = new WxShop();
wxShop.updateTenantInfo(tenantEntity);
wxShop.setStatus(EnumShopStatus.RENT.getCode());
List<WxShop> yczlist = wxShopMapper.findList(wxShop);
wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode());
List<WxShop> wczlist = wxShopMapper.findList(wxShop);
yczsize = yczlist.size();
wczsize = wczlist.size();
int size = yczsize + wczsize; int size = yczsize + wczsize;
if (size == 0) { if (size == 0) {
datamap.put("yczsl", 0); datamap.put("yczsl", 0);


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

@@ -534,7 +534,7 @@ public class WxShopServiceImpl implements WxShopService {
} }


@Override @Override
public List<Map<String,Object>> rentRateHistory(TenantEntity tenantEntity,Map<String, Object> params){
public List<Map<String,Object>> rentRateHistory(TenantEntity tenantEntity,Map<String, Object> params,boolean byArea){
String building = StringUtils.trimToNull((String)params.get("building")); String building = StringUtils.trimToNull((String)params.get("building"));
String floor = StringUtils.trimToNull((String)params.get("floor")); String floor = StringUtils.trimToNull((String)params.get("floor"));
String businessId = StringUtils.trimToNull((String)params.get("businessId")); String businessId = StringUtils.trimToNull((String)params.get("businessId"));
@@ -558,7 +558,11 @@ public class WxShopServiceImpl implements WxShopService {
params.put("shopIds", shopIds); params.put("shopIds", shopIds);
} }
} }
return wxMerchantShopMapper.rentRateHistory(params);
if (!byArea) {
return wxMerchantShopMapper.rentRateHistory(params);
}else {
return wxMerchantShopMapper.rentRateHistoryByArea(params);
}
} }
@Override @Override


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

@@ -74,6 +74,12 @@
<if test=" null != startdate and null!=enddate"> <if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate} and `create_date` between #{startdate} and #{enddate}
</if> </if>
<if test=" null != couponIdList ">
and ci.coupon_id in
<foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")">
#{cidItem}
</foreach>
</if>
<if test=" null != ids "> <if test=" null != ids ">
and id in and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -196,6 +202,12 @@
#{sItem} #{sItem}
</foreach> </foreach>
</if> </if>
<if test=" null != couponIdList ">
and ci.coupon_id in
<foreach collection="couponIdList" index="index" item="cidItem" open="(" separator="," close=")">
#{cidItem}
</foreach>
</if>
<if test=" null != ids "> <if test=" null != ids ">
and ci.id in and ci.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -225,4 +237,9 @@
<include refid="dynamicWhereConditions" /> <include refid="dynamicWhereConditions" />
</select> </select>
<select id="findIdList" parameterType="com.iformall.domain.po.WxCardInfo" resultType="Long">
select id from wx_card_info
<include refid="dynamicWhereConditions" />
</select>
</mapper> </mapper>

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

@@ -346,6 +346,14 @@
#{sItem} #{sItem}
</foreach> </foreach>
</if> </if>
<if test=" null != cardIdList ">
and cs.`card_id` in
<foreach collection="cardIdList" index="index" item="cardIdItem" open="(" separator="," close=")">
#{cardIdItem}
</foreach>
</if>
<if test=" null != ids "> <if test=" null != ids ">
and cs.id in and cs.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">


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

@@ -145,6 +145,33 @@
group by xTime group by xTime
order by xTime order by xTime
</select> </select>
<select id="rentRateHistoryByArea" resultType="hashmap" parameterType="hashmap">
select
<if test="1 == dateType">
DATE_FORMAT(w.create_date,'%Y/%m/%d') xTime
</if>
<if test="2 == dateType">
DATE_FORMAT(w.create_date,'%Y/%m') xTime
</if>
,sum(s.build_area) buildArea
from wx_merchant_shop w left join wx_shop s on s.id = w.shop_id
where w.is_del=0
<if test=" null != tenantId and '' != tenantId">
and w.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and w.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != shopIds ">
and w.shop_id in
<foreach collection="shopIds" index="index" item="shopIdItem" open="(" separator="," close=")">
#{shopIdItem}
</foreach>
</if>
group by xTime
order by xTime
</select>
</mapper> </mapper>

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