| @@ -153,4 +153,31 @@ public class DataTowerController extends BaseController { | |||
| } | |||
| @ApiOperation("查询出租率") | |||
| @GetMapping("/queryOccupancyRate") | |||
| @SystemControllerLog(description = "数据塔台-查询出租率") | |||
| public ResultData queryOccupancyRate() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryOccupancyRate"); | |||
| Map<String, Object> data = dataTowerService.queryOccupancyRate(getTenantInfo()); | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation("查询租金收缴率") | |||
| @GetMapping("/queryRentCollectionRate") | |||
| @SystemControllerLog(description = "数据塔台-查询出租率") | |||
| public ResultData queryRentCollectionRate() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryRentCollectionRate"); | |||
| Map<String, Object> data = dataTowerService.queryRentCollectionRate(getTenantInfo()); | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation("查询报单率") | |||
| @GetMapping("/queryDeclarationRate") | |||
| @SystemControllerLog(description = "数据塔台-查询报单率") | |||
| public ResultData queryDeclarationRate() { | |||
| logger.debug("[" + getIpAddr() + "] DataTowerController::queryDeclarationRate"); | |||
| Map<String, Object> data = dataTowerService.queryDeclarationRate(getTenantInfo()); | |||
| return new ResultData(data); | |||
| } | |||
| } | |||
| @@ -11,7 +11,15 @@ public interface DataTowerService { | |||
| Map<String,Object> queryRunningPotal(TenantEntity tenantEntity); | |||
| /** | |||
| * 把这个接口拆开 | |||
| * @param tenantEntity | |||
| * @return | |||
| */ | |||
| Map<String,Object> queryRunning(TenantEntity tenantEntity); | |||
| Map<String, Object> queryOccupancyRate(TenantEntity tenantInfo); | |||
| Map<String, Object> queryRentCollectionRate(TenantEntity tenantInfo); | |||
| Map<String, Object> queryDeclarationRate(TenantEntity tenantInfo); | |||
| Map<String,Object> queryCar(TenantEntity tenantEntity); | |||
| @@ -24,4 +32,7 @@ public interface DataTowerService { | |||
| ResultData queryWiWideDataUrl(TenantEntity tenantInfo, String url, Map<String, Object> params); | |||
| byte[] getWiWidePic(TenantEntity tenantInfo, String type, String id); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| @@ -517,6 +518,98 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| return datamap; | |||
| } | |||
| //出租率 | |||
| @Override | |||
| public Map<String, Object> queryOccupancyRate(TenantEntity tenantEntity) { | |||
| WxShop wxShop = new WxShop(); | |||
| wxShop.updateTenantInfo(tenantEntity); | |||
| wxShop.setStatus(EnumShopStatus.RENT.getCode()); | |||
| Integer yczsize = wxShopMapper.selectCount(new QueryWrapper<>(wxShop)); | |||
| wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); | |||
| Integer wczsize = wxShopMapper.selectCount(new QueryWrapper<>(wxShop)); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| int size = yczsize + wczsize; | |||
| if (size == 0) { | |||
| datamap.put("yczsl", 0); | |||
| datamap.put("wczsl", 0); | |||
| datamap.put("yczl", 0); | |||
| datamap.put("wczl", 0); | |||
| } else { | |||
| datamap.put("yczsl", yczsize); | |||
| datamap.put("wczsl", wczsize); | |||
| double yczld = ((double) yczsize / size) * 100; | |||
| double dczl = new BigDecimal(yczld).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| double wczld = ((double) wczsize / size) * 100; | |||
| double wczl = new BigDecimal(wczld).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| datamap.put("yczl", dczl); | |||
| datamap.put("wczl", wczl); | |||
| } | |||
| return datamap; | |||
| } | |||
| //租金收缴率 | |||
| @Override | |||
| public Map<String, Object> queryRentCollectionRate(TenantEntity tenantEntity) { | |||
| Map<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| } | |||
| Map<String, Object> payinfo = wxBillRentMapper.queryPayInfo(params); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| if (payinfo != null) { | |||
| BigDecimal receivepay = (BigDecimal) payinfo.get("receivepay"); | |||
| BigDecimal pay = (BigDecimal) payinfo.get("pay"); | |||
| if (receivepay.doubleValue() > 0) { | |||
| BigDecimal divide = pay.divide(receivepay, 2, BigDecimal.ROUND_HALF_UP); | |||
| double zjcjl = divide.multiply(new BigDecimal(100)).doubleValue(); | |||
| datamap.put("ysje", receivepay); | |||
| datamap.put("ssje", pay); | |||
| datamap.put("zjsjl", zjcjl); | |||
| } else { | |||
| datamap.put("ysje", 0); | |||
| datamap.put("ssje", 0); | |||
| datamap.put("zjsjl", 0); | |||
| } | |||
| } else { | |||
| datamap.put("ysje", 0); | |||
| datamap.put("ssje", 0); | |||
| datamap.put("zjsjl", 0); | |||
| } | |||
| return datamap; | |||
| } | |||
| //昨日报单率 | |||
| @Override | |||
| public Map<String, Object> queryDeclarationRate(TenantEntity tenantEntity) { | |||
| WxMerchant wxMerchant = new WxMerchant(); | |||
| wxMerchant.updateTenantInfo(tenantEntity); | |||
| wxMerchant.setStatus(1); | |||
| Integer merchantsize = wxMerchantMapper.selectCount(new QueryWrapper<>(wxMerchant)); | |||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| wxMerchantTradeDaily.updateTenantInfo(tenantEntity); | |||
| String reportdate = DateUtils.getTimeBefore(1, new Date()); | |||
| wxMerchantTradeDaily.setReportDate(reportdate); | |||
| List<WxMerchantTradeDaily> tradelist = wxMerchantTradeDailyMapper.findList(wxMerchantTradeDaily); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| int tradesize = tradelist.size(); | |||
| if (merchantsize > 0 && tradesize > 0) { | |||
| double shsbld = ((double) tradesize / merchantsize) * 100; | |||
| double shsbl = new BigDecimal(shsbld).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| datamap.put("shsbl", shsbl); | |||
| } else { | |||
| datamap.put("shsbl", 0); | |||
| } | |||
| int shsbjg = tradelist.stream().mapToInt(WxMerchantTradeDaily::getTradeAmtInteger).sum(); | |||
| datamap.put("shsbjg", shsbjg); | |||
| return datamap; | |||
| } | |||
| @Override | |||
| public Map<String, Object> queryCar(TenantEntity tenantEntity) { | |||
| logger.info("停车-月统计-开始"); | |||
| @@ -924,9 +924,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getCarHistoryAndTodayAndHB(TenantEntity tenantEntity, boolean withOthers ) { | |||
| String startdate; | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantEntitys",tenantEntitys); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||
| params.put("parentTenantId", tenantEntity.getParentTenantId()); | |||
| @@ -940,9 +938,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| params.put("startdate", startdate + " 00:00:00"); | |||
| params.put("enddate", systemTime + " 23:59:59"); | |||
| //TODO 待优化数据 | |||
| //List<Map<String, Object>> historylist = wxCarCmdLogMapper.queryHistory(params); | |||
| List<Map<String, Object>> historylist = null; | |||
| List<Map<String, Object>> historylist = wxCarCmdLogMapper.queryHistory(params); | |||
| if (true) { | |||
| return new ResultData(); | |||
| } | |||
| @@ -160,7 +160,6 @@ | |||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | |||
| where is_preview = 0 | |||
| and receive_date between #{startdate} and #{enddate} | |||
| and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| @@ -168,26 +167,30 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| group by tenant_id | |||
| <if test=" null != startTime "> | |||
| and receive_date >= #{startdate} | |||
| </if> | |||
| <if test=" null == tenantId or '' == tenantId"> | |||
| group by parent_tenant_id | |||
| <if test=" null != endTime"> | |||
| and receive_date < #{enddate} | |||
| </if> | |||
| </select> | |||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | |||
| where receive_date between #{startdate} and #{enddate} | |||
| and is_preview = 0 and status!=6 | |||
| where is_preview = 0 and status!=6 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and receive_date >= #{startdate} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and receive_date < #{enddate} | |||
| </if> | |||
| </select> | |||
| @@ -76,10 +76,7 @@ | |||
| <select id="queryHistory" resultType="hashmap" parameterType="hashmap"> | |||
| select count(c.id) carcount,c.create_date from ( | |||
| select id,DATE_FORMAT(create_date,'%Y-%m-%d') create_date | |||
| from | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_car_cmd_log${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_car_cmd_log where cmd_type=#{cmdType} | |||
| from wx_car_cmd_log where cmd_type=#{cmdType} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||