|
|
|
@@ -1,11 +1,13 @@ |
|
|
|
package com.iformall.controller.sys; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxBusiness; |
|
|
|
import com.iformall.domain.po.WxSubBusiness; |
|
|
|
import com.iformall.domain.vo.WxBusinessDataVo; |
|
|
|
import com.iformall.domain.vo.WxMerchantSubsidyVo; |
|
|
|
import com.iformall.service.ExcelService; |
|
|
|
import com.iformall.service.WxBusinessService; |
|
|
|
import com.iformall.service.WxSubBusinessService; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
@@ -13,11 +15,14 @@ import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.http.HttpResponse; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@@ -29,9 +34,11 @@ public class WxBusinessController extends BaseController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxBusinessService wxBusinessService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxSubBusinessService wxSubBusinessService; |
|
|
|
@Autowired |
|
|
|
private ExcelService excelService; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("业态全列表接口") |
|
|
|
@GetMapping("listAll") |
|
|
|
@@ -59,15 +66,49 @@ public class WxBusinessController extends BaseController { |
|
|
|
wxBusiness.setTenantId(getTenantId()); |
|
|
|
if(wxBusiness.getStartdate() == null || wxBusiness.getEnddate() == null){ |
|
|
|
Date sDate = DateUtils.getFirstDayForCurrMonth(DateUtils.getLastMonthToDay()); |
|
|
|
Date d = DateUtils.getLastDayForMonth(DateUtils.getLastMonthToDay()); |
|
|
|
Date eDate = DateUtils.getLastDayForMonth(DateUtils.getLastMonthToDay()); |
|
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
SimpleDateFormat sdT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
wxBusiness.setStartdate(sdT.parse(sd.format(sDate)+" 00:00:00")); |
|
|
|
wxBusiness.setEnddate(sdT.parse(sd.format(d)+" 23:59:59")); |
|
|
|
wxBusiness.setEnddate(sdT.parse(sd.format(eDate)+" 23:59:59")); |
|
|
|
} |
|
|
|
return wxBusinessService.businessDataList(wxBusiness); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("导出业态数据列表") |
|
|
|
@GetMapping("exportBusinessDataList") |
|
|
|
@SystemControllerLog(description = "导出业态数据列表") |
|
|
|
public void exportBusinessDataList(@ModelAttribute WxBusiness wxBusiness, HttpServletResponse response) throws Exception{ |
|
|
|
logger.debug("[" + getIpAddr() + "] WxBusinessController::exportBusinessDataList"); |
|
|
|
wxBusiness.setTenantId(getTenantId()); |
|
|
|
if(wxBusiness.getStartdate() == null || wxBusiness.getEnddate() == null){ |
|
|
|
Date sDate = DateUtils.getFirstDayForCurrMonth(DateUtils.getLastMonthToDay()); |
|
|
|
Date eDate = DateUtils.getLastDayForMonth(DateUtils.getLastMonthToDay()); |
|
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
SimpleDateFormat sdT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
wxBusiness.setStartdate(sdT.parse(sd.format(sDate)+" 00:00:00")); |
|
|
|
wxBusiness.setEnddate(sdT.parse(sd.format(eDate)+" 23:59:59")); |
|
|
|
} |
|
|
|
List<Map<String,Object>> dataList = (List<Map<String,Object>>)wxBusinessService.businessDataList(wxBusiness).data; |
|
|
|
List<WxBusinessDataVo> exeList = new ArrayList<>(); |
|
|
|
for (Map<String,Object> m:dataList) { |
|
|
|
WxBusinessDataVo businessDataVo = new WxBusinessDataVo(); |
|
|
|
businessDataVo.setName((String)m.get("title")); |
|
|
|
if(m.get("comPrice") != null) |
|
|
|
businessDataVo.setComPrice(m.get("comPrice").toString()); |
|
|
|
if(m.get("rent") != null) |
|
|
|
businessDataVo.setRentRate(m.get("rent").toString()); |
|
|
|
if(m.get("rentSaleRate") != null) |
|
|
|
businessDataVo.setRentSaleRate(m.get("rentSaleRate").toString()); |
|
|
|
if(m.get("volume") != null) |
|
|
|
businessDataVo.setSale(m.get("volume").toString()); |
|
|
|
if(m.get("sale") != null) |
|
|
|
businessDataVo.setSaleRate(m.get("sale").toString()); |
|
|
|
exeList.add(businessDataVo); |
|
|
|
} |
|
|
|
excelService.exportExcel(exeList, null, "业态统计", WxBusinessDataVo.class, "业态统计列表.xlsx", response, false); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("贡献率排行") |
|
|
|
@GetMapping("devoteList") |
|
|
|
@SystemControllerLog(description = "贡献率排行") |
|
|
|
@@ -76,25 +117,8 @@ public class WxBusinessController extends BaseController { |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
public ResultData devoteList(@ModelAttribute WxBusiness wxBusiness,Integer pageNum, Integer pageSize) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxBusinessController::devoteList"); |
|
|
|
List<Map<String,String>> result = new ArrayList<>(); |
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
map.put("merchantName","西贝筱面"); |
|
|
|
map.put("sale","2323.23");//营业额 |
|
|
|
map.put("saleRate","32323.23");//商户销售坪效 |
|
|
|
map.put("devoteRate","1.23");//贡献率 |
|
|
|
result.add(map); |
|
|
|
map = new HashMap<>(); |
|
|
|
map.put("merchantName","肯德基"); |
|
|
|
map.put("sale","2323.23");//营业额 |
|
|
|
map.put("saleRate","32323.23");//商户销售坪效 |
|
|
|
map.put("devoteRate","1.23");//贡献率 |
|
|
|
result.add(map); |
|
|
|
PageInfo<Map<String,String>> page = new PageInfo<>(); |
|
|
|
page.setList(result); |
|
|
|
page.setTotal(2); |
|
|
|
page.setPageNum(1); |
|
|
|
page.setPageSize(20); |
|
|
|
return new ResultData(page); |
|
|
|
wxBusiness.setTenantId(getTenantId()); |
|
|
|
return new ResultData(wxBusinessService.devoteList(wxBusiness,pageNum,pageSize)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|