| @@ -2,10 +2,12 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.service.WxBillAllService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| @@ -70,4 +73,38 @@ public class WxBillAllController extends BaseController { | |||
| } | |||
| /** | |||
| * 欠缴商户列表 | |||
| * @param wxBillAll | |||
| * @param pageNum | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| @GetMapping("oweMerchantlist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "费用收缴数据-欠缴商户列表") | |||
| public ResultData oweMerchantlist(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::oweMerchantlist"); | |||
| if (null == wxBillAll) { | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| wxBillAll.setTenantId(getTenantId()); | |||
| Map<String, Object> result = wxBillAllService.getOweBillAsPage(wxBillAll, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("导出欠缴商户列表") | |||
| @GetMapping("/exportOweMerchantlist") | |||
| @SystemControllerLog(description = "费用收缴数据-欠缴商户列表-导出") | |||
| public void exportOweMerchantlist(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweMerchantlist"); | |||
| if (null == wxBillAll){ | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| wxBillAll.setTenantId(getTenantId()); | |||
| wxBillAllService.exportOweMerchant(wxBillAll, request, response); | |||
| } | |||
| } | |||
| @@ -0,0 +1,109 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import java.math.BigDecimal; | |||
| public class OweMerchantVo { | |||
| @Excel(name="商户名",width = 20,orderNum = "1") | |||
| private String name; | |||
| @Excel(name="楼座",width = 20,orderNum = "2") | |||
| private Long building; | |||
| @Excel(name="楼层",width = 20,orderNum = "3") | |||
| private Long floor; | |||
| @Excel(name="负责人",width = 20,orderNum = "4") | |||
| private String linkPerson; | |||
| @Excel(name="负责人电话",width = 20,orderNum = "5") | |||
| private String linkPhone; | |||
| @Excel(name="欠缴租金(元)",width = 20,orderNum = "6") | |||
| private BigDecimal rentOwe; | |||
| @Excel(name="欠缴物业费(元)",width = 20,orderNum = "7") | |||
| private BigDecimal propertyOwe; | |||
| @Excel(name="欠缴押金(元)",width = 20,orderNum = "8") | |||
| private BigDecimal depositOwe; | |||
| @Excel(name="其他费用(元)",width = 20,orderNum = "9") | |||
| private BigDecimal otherOwe; | |||
| @Excel(name="欠缴总额(元)",width = 20,orderNum = "10") | |||
| private BigDecimal totalOwe; | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public Long getBuilding() { | |||
| return building; | |||
| } | |||
| public void setBuilding(Long building) { | |||
| this.building = building; | |||
| } | |||
| public Long getFloor() { | |||
| return floor; | |||
| } | |||
| public void setFloor(Long floor) { | |||
| this.floor = floor; | |||
| } | |||
| public String getLinkPerson() { | |||
| return linkPerson; | |||
| } | |||
| public void setLinkPerson(String linkPerson) { | |||
| this.linkPerson = linkPerson; | |||
| } | |||
| public String getLinkPhone() { | |||
| return linkPhone; | |||
| } | |||
| public void setLinkPhone(String linkPhone) { | |||
| this.linkPhone = linkPhone; | |||
| } | |||
| public BigDecimal getRentOwe() { | |||
| return rentOwe; | |||
| } | |||
| public void setRentOwe(BigDecimal rentOwe) { | |||
| this.rentOwe = rentOwe; | |||
| } | |||
| public BigDecimal getPropertyOwe() { | |||
| return propertyOwe; | |||
| } | |||
| public void setPropertyOwe(BigDecimal propertyOwe) { | |||
| this.propertyOwe = propertyOwe; | |||
| } | |||
| public BigDecimal getDepositOwe() { | |||
| return depositOwe; | |||
| } | |||
| public void setDepositOwe(BigDecimal depositOwe) { | |||
| this.depositOwe = depositOwe; | |||
| } | |||
| public BigDecimal getOtherOwe() { | |||
| return otherOwe; | |||
| } | |||
| public void setOtherOwe(BigDecimal otherOwe) { | |||
| this.otherOwe = otherOwe; | |||
| } | |||
| public BigDecimal getTotalOwe() { | |||
| return totalOwe; | |||
| } | |||
| public void setTotalOwe(BigDecimal totalOwe) { | |||
| this.totalOwe = totalOwe; | |||
| } | |||
| } | |||
| @@ -53,6 +53,59 @@ public class WxBillAll { | |||
| @io.swagger.annotations.ApiModelProperty(value = "租赁店铺类型", name = "rentShopType") | |||
| private Integer rentShopType; | |||
| //费用收缴数据 | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴租金", name = "rentOwe") | |||
| private Integer rentOwe; | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴物业费", name = "propertyOwe") | |||
| private Integer propertyOwe; | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴押金", name = "depositOwe") | |||
| private Integer depositOwe; | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴其他费用", name = "otherOwe") | |||
| private Integer otherOwe; | |||
| @io.swagger.annotations.ApiModelProperty(value = "欠缴总额", name = "totalOwe") | |||
| private Integer totalOwe; | |||
| public Integer getRentOwe() { | |||
| return rentOwe; | |||
| } | |||
| public void setRentOwe(Integer rentOwe) { | |||
| this.rentOwe = rentOwe; | |||
| } | |||
| public Integer getPropertyOwe() { | |||
| return propertyOwe; | |||
| } | |||
| public void setPropertyOwe(Integer propertyOwe) { | |||
| this.propertyOwe = propertyOwe; | |||
| } | |||
| public Integer getDepositOwe() { | |||
| return depositOwe; | |||
| } | |||
| public void setDepositOwe(Integer depositOwe) { | |||
| this.depositOwe = depositOwe; | |||
| } | |||
| public Integer getOtherOwe() { | |||
| return otherOwe; | |||
| } | |||
| public void setOtherOwe(Integer otherOwe) { | |||
| this.otherOwe = otherOwe; | |||
| } | |||
| public Integer getTotalOwe() { | |||
| return totalOwe; | |||
| } | |||
| public void setTotalOwe(Integer totalOwe) { | |||
| this.totalOwe = totalOwe; | |||
| } | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| @@ -58,6 +58,8 @@ public enum EnumChart { | |||
| INDEX_SHOP_RENT(49, "商铺出租数据"), | |||
| INDEX_BILL_RECE_RATE(50, "费用收缴数据"), | |||
| INDEX_COUPON_SCENE(51, "场景发券"), | |||
| INDEX_SALE_DATA(52, "营销数据"), | |||
| ; | |||
| public static EnumChart getEnum(Integer code) { | |||
| @@ -69,5 +69,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<WxCoupon> findCouponByTopic(WxTopic wxTopic); | |||
| Long priceCouponCancelCount(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon); | |||
| } | |||
| @@ -1,8 +1,10 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.WxOrderGroup; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.domain.vo.WxOrderGroupMarketing; | |||
| import java.util.List; | |||
| @@ -33,5 +35,6 @@ public interface WxOrderGroupMapper extends CommonMapper<WxOrderGroup, Long> { | |||
| long queryOrderGroupVerifyCount(Map<String, Object> params); | |||
| List<WxCouponStatisVo> queryOrderGroupCountHistory(WxCoupon wxCoupon); | |||
| } | |||
| @@ -16,6 +16,8 @@ public interface MarkingDataReportService { | |||
| Map<String,Object> getSceneData(String tenantId); | |||
| Map<String,Object> getSceneDataHistory(String tenantId,String startDate,String endDate); | |||
| PageInfo<MarkingCouponDataReportVo> getCouponDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||
| @@ -35,4 +35,13 @@ public interface WxBillAllService { | |||
| * 发送欠缴通知邮件 | |||
| */ | |||
| void sendOweBillForEmail(); | |||
| /** | |||
| * 欠缴商户分页列表 | |||
| * @return | |||
| */ | |||
| Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize); | |||
| void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response); | |||
| } | |||
| @@ -139,6 +139,12 @@ public interface WxCouponService { | |||
| */ | |||
| List<WxCouponStatisVo> priceCouponPaymentCount(WxCoupon wxCoupon); | |||
| /** | |||
| * 有价卷退款数量 | |||
| * @return | |||
| */ | |||
| Long priceCouponCancelCount(WxCoupon wxCoupon); | |||
| String findSumPriceSaleMoney(WxCoupon wxCoupon); | |||
| String findSumPricePayMent(WxCoupon wxCoupon); | |||
| String findSumSubsidyMoney(WxCoupon wxCoupon); | |||
| @@ -174,4 +180,13 @@ public interface WxCouponService { | |||
| * @return | |||
| */ | |||
| Long sumJoin(WxCoupon wxCoupon); | |||
| /** | |||
| * 查询售出卡数量历史 | |||
| * @return | |||
| */ | |||
| List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon); | |||
| } | |||
| @@ -11,6 +11,7 @@ import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -420,6 +421,78 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| return new PageInfo<>(list); | |||
| } | |||
| @Override | |||
| public Map<String, Object> getSceneDataHistory(String tenantId,String startDate, String endDate) { | |||
| Map<String ,Object> result = new HashedMap(); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantId); | |||
| if (StringUtils.isNotBlank(startDate)) | |||
| params.put("startTime", startDate); | |||
| if (StringUtils.isNotBlank(endDate)) | |||
| params.put("endTime", endDate); | |||
| List<String> days = DateUtils.getTjTimeList(startDate,endDate,"0"); | |||
| TreeMap<String, Object> historyMap = new TreeMap<>(); | |||
| //停车发券 | |||
| params.put("channelType", EnumCouponSendSendType.CAR_STOP.getCode()); | |||
| List<MarkingSceneDataVo> carStopList = wxCouponActionLogMapper.sceneDataList(params); | |||
| Map<String, Integer> countMap = carStopList.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getSendCount())); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| result.put("carStopHistory",historyMap); | |||
| //核销发券 | |||
| params.put("channelType", EnumCouponSendSendType.COUPON_VERIFY.getCode()); | |||
| List<MarkingSceneDataVo> couponVerifyList = wxCouponActionLogMapper.sceneDataList(params); | |||
| countMap = couponVerifyList.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getSendCount())); | |||
| historyMap = new TreeMap<>(); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| result.put("couponVerifyHistory",historyMap); | |||
| //交易发券 | |||
| params.put("channelType", EnumCouponSendSendType.C_ORDER.getCode()); | |||
| List<MarkingSceneDataVo> orderList = wxCouponActionLogMapper.sceneDataList(params); | |||
| countMap = orderList.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getSendCount())); | |||
| historyMap = new TreeMap<>(); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| result.put("orderHistory",historyMap); | |||
| //收银台发券 | |||
| params.put("channelType", EnumCouponSendSendType.B_MICROPAY.getCode()); | |||
| List<MarkingSceneDataVo> micropayList = wxCouponActionLogMapper.sceneDataList(params); | |||
| countMap = micropayList.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getSendCount())); | |||
| historyMap = new TreeMap<>(); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| result.put("micropayHistory",historyMap); | |||
| return result; | |||
| } | |||
| @Override | |||
| public Map<String, Object> listOrderReportByDate(WxOrderReportDto wxOrderReportDto) { | |||
| @@ -7,8 +7,10 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.msg.MailMsg; | |||
| import com.iformall.domain.vo.OweMerchantVo; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillAllVo; | |||
| import com.iformall.domain.vo.WxNotRentShopVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -20,6 +22,7 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -738,4 +741,35 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| } | |||
| @Override | |||
| public Map<String, Object> getOweBillAsPage(WxBillAll record, Integer pageNum, Integer pageSize) { | |||
| PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxBillAllMapper.getOweBillAsPage(record)); | |||
| Map<String, Object> result = new HashMap<>(); | |||
| result.put("pageInfo", pageInfo); | |||
| return result; | |||
| } | |||
| @Override | |||
| public void exportOweMerchant(WxBillAll record, HttpServletRequest request, HttpServletResponse response) { | |||
| List<Map<String, Object>> data = wxBillAllMapper.getOweBillAsPage(record); | |||
| List<OweMerchantVo> list = new ArrayList<>(); | |||
| for (Map<String, Object> map:data) { | |||
| OweMerchantVo oweMerchantVo = new OweMerchantVo(); | |||
| oweMerchantVo.setBuilding((Long)map.get("building")); | |||
| oweMerchantVo.setDepositOwe((BigDecimal) map.get("depositOwe")); | |||
| oweMerchantVo.setFloor((Long)map.get("floor")); | |||
| oweMerchantVo.setLinkPerson((String)map.get("manager")); | |||
| oweMerchantVo.setName((String)map.get("merchantName")); | |||
| oweMerchantVo.setLinkPhone((String)map.get("managerPhone")); | |||
| oweMerchantVo.setOtherOwe((BigDecimal) map.get("otherOwe")); | |||
| oweMerchantVo.setPropertyOwe((BigDecimal) map.get("propertyOwe")); | |||
| oweMerchantVo.setRentOwe((BigDecimal) map.get("rentOwe")); | |||
| oweMerchantVo.setTotalOwe((BigDecimal) map.get("totalOwe")); | |||
| list.add(oweMerchantVo); | |||
| } | |||
| String name = "欠缴商户列表"; | |||
| excelService.exportExcel(list,null, name, OweMerchantVo.class,name+".xls",response); | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.service.WxChartDataService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -69,6 +70,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| WxBillDepositMapper wxBillDepositMapper; | |||
| @Autowired | |||
| WxBillOtherMapper wxBillOtherMapper; | |||
| @Autowired | |||
| MarkingDataReportService markingDataReportService; | |||
| @Override | |||
| public ResultData queryData(Map<String, String> paramsMap) { | |||
| @@ -290,6 +293,18 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| return getBillReceRate(tenantId, startdate); | |||
| } | |||
| //首页场景发券 | |||
| if (chart.equals(EnumChart.INDEX_COUPON_SCENE.getCode())) { | |||
| return new ResultData(markingDataReportService.getSceneDataHistory(tenantId, paramsMap.get("startdate"), paramsMap.get("enddate"))); | |||
| } | |||
| //首页营销数据 | |||
| if (chart.equals(EnumChart.INDEX_SALE_DATA.getCode())) { | |||
| return getSaleDataHistory(tenantId, startdate,enddate); | |||
| } | |||
| return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); | |||
| } | |||
| @@ -1873,6 +1888,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| List<WxCouponStatisVo> paymentCountList = wxCouponService.findCouponPaymentCount(wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon); | |||
| List<WxCouponStatisVo> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon); | |||
| Long priceCouponCancelCount = wxCouponService.priceCouponCancelCount(wxCoupon); | |||
| Map<String,String> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| @@ -1895,10 +1911,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| result.put("paymentCountList",paymentCountMap); | |||
| result.put("priceCouponSaleCountList",priceCouponSaleCountMap); | |||
| result.put("priceCouponPaymentCountList",priceCouponPaymentCountMap); | |||
| result.put("sumPriceSaleMoney",wxCouponService.findSumPriceSaleMoney(wxCoupon)); | |||
| result.put("sumPricePayMent",wxCouponService.findSumPricePayMent(wxCoupon)); | |||
| result.put("sumSubsidyMoney",wxCouponService.findSumSubsidyMoney(wxCoupon)); | |||
| result.put("priceCouponCancelCount",priceCouponCancelCount); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -2218,7 +2234,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getIndexShopRentData(String tenantId, String startDateStr) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| Date startDate = DateUtils.getDateFromString(startDateStr+"-01","yyyy-MM-dd").getTime(); | |||
| Date startDate = DateUtils.getDateFromString(startDateStr,"yyyy-MM-dd").getTime(); | |||
| Date endDate = DateUtils.getLastDayForMonth(startDate); | |||
| WxShop query = new WxShop(); | |||
| query.setTenantId(tenantId); | |||
| @@ -2267,7 +2283,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getBillReceRate(String tenantId, String startDateStr) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| Date startDate = DateUtils.getDateFromString(startDateStr+"-01","yyyy-MM-dd").getTime(); | |||
| Date startDate = DateUtils.getDateFromString(startDateStr,"yyyy-MM-dd").getTime(); | |||
| Date endDate = DateUtils.getLastDayForMonth(startDate); | |||
| //租金收缴率 | |||
| @@ -2403,4 +2419,64 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| return new ResultData(datamap); | |||
| } | |||
| /** | |||
| * 营销数据 | |||
| * @param tenantId | |||
| * @return | |||
| */ | |||
| private ResultData getSaleDataHistory(String tenantId, String startdate,String enddate) { | |||
| Date startDate = DateUtils.getDateFromString(startdate,"yyyy-MM-dd").getTime(); | |||
| Date endDate = DateUtils.getDateFromString(enddate,"yyyy-MM-dd").getTime(); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| //卷数据 | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| params.put("tenantId", tenantId); | |||
| params.put("startTime", startDate); | |||
| params.put("endTime", endDate); | |||
| List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataMap(params); | |||
| List<String> days = DateUtils.getTjTimeList(startdate,enddate,"0"); | |||
| TreeMap<String, Object> historyMap = new TreeMap<>(); | |||
| Map<String, Integer> countMap = couponDatalist.stream().collect(Collectors.toMap(MarkingCouponDataReportVo::getCreateTime, p -> p.getCouponCount())); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| datamap.put("couponHistory",historyMap); | |||
| //卡数据 | |||
| WxCoupon couponQuery = new WxCoupon(); | |||
| couponQuery.setTenantId(tenantId); | |||
| couponQuery.setStartdate(startDate); | |||
| couponQuery.setEnddate(endDate); | |||
| List<WxCouponStatisVo> couponStatisVoList = wxCouponService.findSaleCardCountHistory(couponQuery); | |||
| countMap = couponStatisVoList.stream().collect(Collectors.toMap(WxCouponStatisVo::getXtime, p -> Integer.parseInt(p.getXcount()))); | |||
| historyMap = new TreeMap<>(); | |||
| for (String date:days) { | |||
| historyMap.put(date.substring(5,date.length()).replace("-","/"),"0"); | |||
| } | |||
| for (String key : countMap.keySet()) { | |||
| String keySub = key.substring(5,key.length()).replace("-","/"); | |||
| historyMap.put(keySub,countMap.get(key)); | |||
| } | |||
| datamap.put("cardHistory",historyMap); | |||
| //砍价数据 | |||
| List<WxCouponStatisVo> pressSendHistory = wxCouponService.pressSendHistory(couponQuery); | |||
| Map<String,String> pressSendHistoryMap = getDateMap(startDate,endDate); | |||
| for (WxCouponStatisVo coupon:pressSendHistory){ | |||
| pressSendHistoryMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| } | |||
| datamap.put("pressSendHistory",pressSendHistoryMap); | |||
| //拼团 | |||
| long groupCount = wxOrderGroupMapper.queryOrderGroupCount(params); | |||
| return new ResultData(datamap); | |||
| } | |||
| } | |||
| @@ -458,4 +458,15 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| Long count = wxCouponMapper.sumJoin(wxCoupon); | |||
| return (count==null)?0l:count; | |||
| } | |||
| @Override | |||
| public Long priceCouponCancelCount(WxCoupon wxCoupon) { | |||
| Long count = wxCouponMapper.priceCouponCancelCount(wxCoupon); | |||
| return (count==null)?0l:count; | |||
| } | |||
| @Override | |||
| public List<WxCouponStatisVo> findSaleCardCountHistory(WxCoupon wxCoupon) { | |||
| return wxCouponMapper.findSaleCardCountHistory(wxCoupon); | |||
| } | |||
| } | |||
| @@ -526,11 +526,15 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| taskInfoMap.put("businessId",mapInfo.get("businessId")); | |||
| taskInfoMap.put("businessType",mapInfo.get("flowType")); | |||
| List<Map<String,Object>> variables = (List)mapInfo.get("variables"); //定制variables,回传 | |||
| Map<String,Object> variablesMap = new HashedMap(); | |||
| if(CollectionUtils.isNotEmpty(variables)){ | |||
| for (Map<String,Object> m:variables) { | |||
| taskInfoMap.put((String)m.get("key"),m.get("value")); | |||
| variablesMap.put((String)m.get("key"),m.get("value")); | |||
| } | |||
| } | |||
| taskInfoMap.put("businessType",mapInfo.get("flowType")); | |||
| taskInfoMap.put("variables",variablesMap); | |||
| result.add(taskInfoMap); | |||
| } | |||
| } | |||
| @@ -482,4 +482,68 @@ | |||
| left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||
| where m.status=1 | |||
| </select> | |||
| <select id="getOweBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,m.name merchantName,bill.bill_type billType, | |||
| m.link_phone managerPhone,m.`link_person` manager,m.email, | |||
| bill.receive_date receiveDate,bill.expired_day expiredDay,ws.building,ws.floor, | |||
| round(bill.rentOwe/100,2) rentOwe,round(bill.propertyOwe/100,2) propertyOwe, | |||
| round(bill.depositOwe/100,2) depositOwe,round(bill.otherOwe/100,2) otherOwe, | |||
| round((bill.rentOwe+bill.propertyOwe+bill.depositOwe+bill.otherOwe)/100,2) totalOwe | |||
| from ( | |||
| select oweList.*, | |||
| max(case oweList.bill_type when '租金' then oweList.owe else 0 end) rentOwe, | |||
| max(case oweList.bill_type when '物业费' then oweList.owe else 0 end) propertyOwe, | |||
| max(case oweList.bill_type when '欠缴押金' then oweList.owe else 0 end) depositOwe, | |||
| max(case oweList.bill_type when '其他费用' then oweList.owe else 0 end) otherOwe | |||
| from( | |||
| select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 and tenant_id = #{tenantId} | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property where is_preview = 0 and tenant_id = #{tenantId} | |||
| union | |||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( | |||
| select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,2 bill_type_value,'欠缴押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent_deposit where tenant_id = #{tenantId} | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,4 bill_type_value,'欠缴押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property_deposit where tenant_id = #{tenantId} | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'欠缴押金' name,8 bill_type_value,'欠缴押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other_deposit where tenant_id = #{tenantId} | |||
| ) res | |||
| union | |||
| select res.id,res.merchant_id,res.shop_id,res.tenant_id,res.name,res.bill_type_value,res.bill_type,res.need_pay, | |||
| res.receive_pay,res.pay,res.owe owe,res.receive_date,res.pay_date,res.expired_day,res.status,res.starttime,res.endtime,res.rent_shop_type from( | |||
| select id,merchant_id,shop_id,tenant_id,'其他费用' name,5 bill_type_value,'其他费用' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type in(1,2) and tenant_id = #{tenantId} | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'其他费用' name,7 bill_type_value,'其他费用' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other where tenant_id = #{tenantId} | |||
| ) res | |||
| ) bill | |||
| where bill.status not in(3,5,6) | |||
| group by bill.merchant_id,bill.bill_type | |||
| ) oweList group by oweList.merchant_id | |||
| ) bill | |||
| left join wx_merchant m on bill.merchant_id=m.id | |||
| left join wx_merchant_shop ms on ms.`merchant_id` = m.id | |||
| left join wx_shop ws on ms.`shop_id` = ws.id | |||
| where m.status=1 and m.tenant_id = #{tenantId} | |||
| </select> | |||
| </mapper> | |||
| @@ -107,7 +107,7 @@ | |||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_other | |||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||
| where status = 1 and tenant_id=#{tenantId} and receive_date between #{startdate} and #{enddate} | |||
| group by tenant_id | |||
| </select> | |||
| @@ -752,4 +752,21 @@ | |||
| where ct.`sub_target_id` = #{id} | |||
| </select> | |||
| <select id="priceCouponCancelCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select count(c.id) from wx_coupon c | |||
| left join wx_coupon_order wco on c.id = wco.coupon_id | |||
| where c.type not in(8,9,100) | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| and wco.coupon_order_status = 3 | |||
| </select> | |||
| <select id="findSaleCardCountHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(co.id) xcount | |||
| from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_coupon_order co on co.id = ci.id | |||
| where c.type = 100 | |||
| and c.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| </mapper> | |||
| @@ -165,6 +165,18 @@ | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <select id="queryOrderGroupCountHistory" parameterType="hashmap" resultType="long"> | |||
| select count(*) total from wx_order_group | |||
| <where> | |||
| <if test=" null != tenantId"> | |||
| and tenant_id=#{tenantId} | |||
| </if> | |||
| <if test=" null != startdate and null!=enddate "> | |||
| and create_date BETWEEN #{startdate} and #{enddate} | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <select id="queryOrderGroupSuccessCount" parameterType="hashmap" resultType="long"> | |||
| select count(*) total from wx_order_group where status=11 | |||
| @@ -500,7 +500,7 @@ | |||
| </select> | |||
| <select id="getCountByWxShop" parameterType="com.iformall.domain.po.WxShop" resultType="Long"> | |||
| select count(id) from wx_shop w left join wx_merchant_shop ms ON | |||
| select count(*) from wx_shop w left join wx_merchant_shop ms ON | |||
| ms.shop_id = w.id where w.tenant_id=#{tenantId} and w.is_del=0 | |||
| <if test="null != startdate"> | |||
| and ms.`create_date` >= #{startdate} | |||