| @@ -11,6 +11,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -224,7 +225,11 @@ public class WxCUserDataController extends BaseController { | |||||
| Date endTime = c.getTime();//明天0点 | Date endTime = c.getTime();//明天0点 | ||||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | ||||
| Date startTime = c.getTime(); | Date startTime = c.getTime(); | ||||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| wxCouponOrder.setStartTime(startTime); | |||||
| wxCouponOrder.setEndTime(endTime); | |||||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder);//月消费金额 | |||||
| c.clear(); | c.clear(); | ||||
| c.setTime(endTime); | c.setTime(endTime); | ||||
| Date eTime = c.getTime(); | Date eTime = c.getTime(); | ||||
| @@ -101,14 +101,14 @@ public class WxCouponOrderController extends BaseController { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
| try { | try { | ||||
| wxCouponOrder.setStartDate( sdf.parse(startDate)); | |||||
| wxCouponOrder.setStartTime( sdf.parse(startDate)); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| wxCouponOrder.setStartDate(null); | |||||
| wxCouponOrder.setStartTime(null); | |||||
| } | } | ||||
| try { | try { | ||||
| wxCouponOrder.setEndDate( sdf.parse(endDate)); | |||||
| wxCouponOrder.setEndTime( sdf.parse(endDate)); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| wxCouponOrder.setEndDate(null); | |||||
| wxCouponOrder.setEndTime(null); | |||||
| } | } | ||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | ||||
| wxCouponOrderService.exportData(request, response, wxCouponOrder); | wxCouponOrderService.exportData(request, response, wxCouponOrder); | ||||
| @@ -15,6 +15,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.vo.WxCUserVo; | import com.iformall.domain.vo.WxCUserVo; | ||||
| import com.iformall.domain.vo.WxLevelMerchantCVo; | import com.iformall.domain.vo.WxLevelMerchantCVo; | ||||
| import com.iformall.enums.EnumAssignTagsTrigger; | import com.iformall.enums.EnumAssignTagsTrigger; | ||||
| import com.iformall.enums.EnumCouponOrderStatus; | |||||
| import com.iformall.enums.EnumLevelConfigDiscountStatus; | import com.iformall.enums.EnumLevelConfigDiscountStatus; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| @@ -81,6 +82,8 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| WxCouponOrderService wxCouponOrderService; | |||||
| /** | /** | ||||
| * 用户登录 | * 用户登录 | ||||
| @@ -454,6 +457,10 @@ public class WxUserGrantController extends BaseController { | |||||
| userVo.setAddress(wxCUserBasicInfo.getAddress()); | userVo.setAddress(wxCUserBasicInfo.getAddress()); | ||||
| } | } | ||||
| } | } | ||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setcUserId(user.getId()); | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||||
| userVo.setCouponOrderCount(wxCouponOrderService.queryCountTotal(wxCouponOrder)); | |||||
| return new ResultData(userVo); | return new ResultData(userVo); | ||||
| } | } | ||||
| @@ -90,7 +90,13 @@ public class WxCouponOrder implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String salePriceStr; | private String salePriceStr; | ||||
| @Transient | @Transient | ||||
| private Integer salePrice; | |||||
| private Integer salePrice; | |||||
| @Transient | |||||
| private Date startTime; | |||||
| @Transient | |||||
| private Date endTime; | |||||
| public String getCouponPriceStr() { | public String getCouponPriceStr() { | ||||
| if(couponPrice!=null) { | if(couponPrice!=null) { | ||||
| @@ -236,6 +242,22 @@ public class WxCouponOrder implements Serializable { | |||||
| this.autoRefund = autoRefund; | this.autoRefund = autoRefund; | ||||
| } | } | ||||
| public Date getStartTime() { | |||||
| return startTime; | |||||
| } | |||||
| public void setStartTime(Date startTime) { | |||||
| this.startTime = startTime; | |||||
| } | |||||
| public Date getEndTime() { | |||||
| return endTime; | |||||
| } | |||||
| public void setEndTime(Date endTime) { | |||||
| this.endTime = endTime; | |||||
| } | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | ||||
| TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), | TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), | ||||
| @@ -21,6 +21,9 @@ public class WxCUserVo extends WxCUser { | |||||
| private Integer discountRate; | private Integer discountRate; | ||||
| private Integer amount; | private Integer amount; | ||||
| private Integer couponOrderCount; | |||||
| public Date getBirthdate() { | public Date getBirthdate() { | ||||
| return birthdate; | return birthdate; | ||||
| } | } | ||||
| @@ -85,4 +88,12 @@ public class WxCUserVo extends WxCUser { | |||||
| public void setAmount(Integer amount) { | public void setAmount(Integer amount) { | ||||
| this.amount = amount; | this.amount = amount; | ||||
| } | } | ||||
| public Integer getCouponOrderCount() { | |||||
| return couponOrderCount; | |||||
| } | |||||
| public void setCouponOrderCount(Integer couponOrderCount) { | |||||
| this.couponOrderCount = couponOrderCount; | |||||
| } | |||||
| } | } | ||||
| @@ -111,11 +111,6 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | ||||
| private List<WxMerchantVo> merchantVoList; | private List<WxMerchantVo> merchantVoList; | ||||
| @Transient | |||||
| private Date startDate; | |||||
| @Transient | |||||
| private Date endDate; | |||||
| @Transient | @Transient | ||||
| private Long couponId; | private Long couponId; | ||||
| @@ -143,22 +138,6 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| this.couponType = couponType; | this.couponType = couponType; | ||||
| } | } | ||||
| public Date getStartDate() { | |||||
| return startDate; | |||||
| } | |||||
| public void setStartDate(Date startDate) { | |||||
| this.startDate = startDate; | |||||
| } | |||||
| public Date getEndDate() { | |||||
| return endDate; | |||||
| } | |||||
| public void setEndDate(Date endDate) { | |||||
| this.endDate = endDate; | |||||
| } | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| @@ -12,13 +12,15 @@ import java.util.Map; | |||||
| public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | ||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | |||||
| Integer countList(WxCouponOrder wxCouponOrder); | |||||
| //统一的计数接口 | |||||
| int findCount(WxCouponOrder wxCouponOrder); | |||||
| //统一额度统计接口 | |||||
| int queryPriceTotal(WxCouponOrder wxCouponOrder); | |||||
| Integer dayCountCarList(Map params); | |||||
| List<WxCouponOrderCarCVo> findCarListOfCUser(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrderCarCVo> findCarListOfCUser(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | ||||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | ||||
| @@ -30,19 +32,6 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id); | WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id); | ||||
| List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder); | List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder); | ||||
| WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id); | WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id); | ||||
| /** | |||||
| * 查询用户核销/领券数 | |||||
| * @param cUserId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int findOrderedCountByCUser(@Param("cUserId")Long cUserId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| int findVerifiedCountByCUser(@Param("cUserId")Long cUserId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| //营销报表 券数据图表 | //营销报表 券数据图表 | ||||
| List<MarkingCouponDataReportVo> couponDataMap(HashMap<String,Object> params); | List<MarkingCouponDataReportVo> couponDataMap(HashMap<String,Object> params); | ||||
| @@ -54,14 +43,6 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | ||||
| /** | |||||
| * 查询商场领券数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int findCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| /** | /** | ||||
| * 日期分组 消费总数 | * 日期分组 消费总数 | ||||
| * @param tenantId | * @param tenantId | ||||
| @@ -70,28 +51,10 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | ||||
| /** | |||||
| * 查询时间段内消费总数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int queryPriceTotal(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | |||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | ||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryOrdered(HashMap<String,Object> params); | List<MarkingSceneDataVo> queryForSceneRepotyHistoryOrdered(HashMap<String,Object> params); | ||||
| /** | |||||
| * 查询核销/领券数 | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int findOrderedCount(@Param("tenantId")String tenantId, @Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| int findVerifiedCount(@Param("tenantId")String tenantId, @Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| List<WxCouponOrder> findExpiredFreeCouponOrderByValidDate(); | List<WxCouponOrder> findExpiredFreeCouponOrderByValidDate(); | ||||
| @@ -151,13 +151,16 @@ public interface WxCouponOrderService { | |||||
| */ | */ | ||||
| List<CUserDateAmountVo> queryPriceTotalGroup(String tenantId, Date startTime,Date endTime); | List<CUserDateAmountVo> queryPriceTotalGroup(String tenantId, Date startTime,Date endTime); | ||||
| /** | /** | ||||
| * 查询时间段内消费总数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * 查询消费额 | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| int queryPriceTotal(String tenantId, Date startTime, Date endTime); | |||||
| int queryPriceTotal(WxCouponOrder wxCouponOrder); | |||||
| /** | |||||
| * 查询领取数 | |||||
| * @return | |||||
| */ | |||||
| int queryCountTotal(WxCouponOrder wxCouponOrder); | |||||
| ////// ------- 卡 | ////// ------- 卡 | ||||
| @@ -248,8 +248,13 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| cal.add(Calendar.DAY_OF_YEAR, 1); | cal.add(Calendar.DAY_OF_YEAR, 1); | ||||
| Date endTime = cal.getTime(); | Date endTime = cal.getTime(); | ||||
| long verifiedCount = wxCouponOrderMapper.findVerifiedCount(tenantId, startTime, endTime); | |||||
| long orderedCount = wxCouponOrderMapper.findOrderedCount(tenantId, startTime, endTime); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| wxCouponOrder.setStartTime(startTime); | |||||
| wxCouponOrder.setEndTime(endTime); | |||||
| long orderedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||||
| long verifiedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| couponMap.put("verifiedCount", verifiedCount); | couponMap.put("verifiedCount", verifiedCount); | ||||
| couponMap.put("orderedCount", orderedCount); | couponMap.put("orderedCount", orderedCount); | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| @@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | import com.iformall.domain.dto.MarkingCouponDataReportDto; | ||||
| import com.iformall.domain.dto.WxOrderReportDto; | import com.iformall.domain.dto.WxOrderReportDto; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -71,9 +72,17 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| public Map<String, Object> getCouponData(String tenantId) { | public Map<String, Object> getCouponData(String tenantId) { | ||||
| //今日领取券数 | //今日领取券数 | ||||
| //查询coupon order表 | //查询coupon order表 | ||||
| int todayCouponCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(0), addDay(1)); | |||||
| int yesterdayCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(-1), addDay(0)); | |||||
| int lastWeekCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(-7), addDay(-6)); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| wxCouponOrder.setStartTime(addDay(0)); | |||||
| wxCouponOrder.setEndTime(addDay(1)); | |||||
| int todayCouponCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| wxCouponOrder.setStartTime(addDay(-1)); | |||||
| wxCouponOrder.setEndTime(addDay(0)); | |||||
| int yesterdayCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| wxCouponOrder.setStartTime(addDay(-7)); | |||||
| wxCouponOrder.setEndTime(addDay(-6)); | |||||
| int lastWeekCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | NumberFormat nf = NumberFormat.getPercentInstance(); | ||||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | ||||
| @@ -413,29 +413,36 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| Calendar endC = Calendar.getInstance(); | Calendar endC = Calendar.getInstance(); | ||||
| Calendar startC = Calendar.getInstance(); | Calendar startC = Calendar.getInstance(); | ||||
| Date endTime = new Date(); | |||||
| Date startTime = new Date(); | |||||
| endC.setTime(endTime); | |||||
| startC.setTime(startTime); | |||||
| endC.setTime(new Date()); | |||||
| startC.setTime(new Date()); | |||||
| endC.set(Calendar.HOUR_OF_DAY, 18); | endC.set(Calendar.HOUR_OF_DAY, 18); | ||||
| startC.set(Calendar.HOUR_OF_DAY, 6); | startC.set(Calendar.HOUR_OF_DAY, 6); | ||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setcUserId(param.getId()); | |||||
| for (int ago = 0; ago > -30 ; ago-- ) { | for (int ago = 0; ago > -30 ; ago-- ) { | ||||
| wxCouponOrder.setStartTime(startC.getTime()); | |||||
| wxCouponOrder.setEndTime(endC.getTime()); | |||||
| int verifiedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| if (endC.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY | if (endC.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY | ||||
| && endC.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { | && endC.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { | ||||
| workDayCount += wxCouponOrderMapper.findVerifiedCountByCUser(param.getId(),startTime,endTime); | |||||
| workDayCount += verifiedCount; | |||||
| } else { | } else { | ||||
| WeekendDayCount += wxCouponOrderMapper.findVerifiedCountByCUser(param.getId(),startTime,endTime); | |||||
| WeekendDayCount += verifiedCount; | |||||
| } | } | ||||
| endC.add(Calendar.DAY_OF_YEAR, -1); | endC.add(Calendar.DAY_OF_YEAR, -1); | ||||
| wxCouponOrder.setStartTime(endC.getTime()); | |||||
| wxCouponOrder.setEndTime(startC.getTime()); | |||||
| verifiedCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| if (endC.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY | if (endC.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY | ||||
| && endC.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { | && endC.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) { | ||||
| workNightCount += wxCouponOrderMapper.findVerifiedCountByCUser(param.getId(),startTime,endTime); | |||||
| workNightCount += verifiedCount; | |||||
| } else { | } else { | ||||
| WeekendNightCount += wxCouponOrderMapper.findVerifiedCountByCUser(param.getId(),startTime,endTime); | |||||
| WeekendNightCount += verifiedCount; | |||||
| } | } | ||||
| startC.add(Calendar.DAY_OF_YEAR, -1); | startC.add(Calendar.DAY_OF_YEAR, -1); | ||||
| @@ -462,12 +469,16 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| private List<WxTags> assignTypeId21(WxCUserBasicInfo user, WxCUser param) { | private List<WxTags> assignTypeId21(WxCUserBasicInfo user, WxCUser param) { | ||||
| List<WxTags> resList = null; | List<WxTags> resList = null; | ||||
| Calendar c = Calendar.getInstance(); | |||||
| Date endTime = new Date(); | |||||
| c.setTime(endTime); | |||||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||||
| Date startTime = c.getTime(); | |||||
| int count = wxCouponOrderMapper.findVerifiedCountByCUser(param.getId(),startTime,endTime); | |||||
| Calendar startC = Calendar.getInstance(); | |||||
| startC.setTime(new Date()); | |||||
| startC.add(Calendar.DAY_OF_YEAR, -30); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setcUserId(param.getId()); | |||||
| wxCouponOrder.setStartTime(startC.getTime()); | |||||
| wxCouponOrder.setEndTime(new Date()); | |||||
| int count = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| float verifiedRate = (float)count/30; | float verifiedRate = (float)count/30; | ||||
| if (verifiedRate > 1F/4) | if (verifiedRate > 1F/4) | ||||
| @@ -659,9 +659,17 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| HashMap<String, Object> datamap = new HashMap<>(); | HashMap<String, Object> datamap = new HashMap<>(); | ||||
| //今日领取券数 | //今日领取券数 | ||||
| //查询coupon order表 | //查询coupon order表 | ||||
| int todayCouponCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(0), addDay(1)); | |||||
| int yesterdayCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(-1), addDay(0)); | |||||
| int lastWeekCount = wxCouponOrderMapper.findCountByDateLimit(tenantId, addDay(-7), addDay(-6)); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| wxCouponOrder.setStartTime(addDay(0)); | |||||
| wxCouponOrder.setEndTime(addDay(1)); | |||||
| int todayCouponCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| wxCouponOrder.setStartTime(addDay(-1)); | |||||
| wxCouponOrder.setEndTime( addDay(0)); | |||||
| int yesterdayCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| wxCouponOrder.setStartTime(addDay(-7)); | |||||
| wxCouponOrder.setEndTime( addDay(-6)); | |||||
| int lastWeekCount = wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | NumberFormat nf = NumberFormat.getPercentInstance(); | ||||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | ||||
| String couponUpDay = "--"; | String couponUpDay = "--"; | ||||
| @@ -911,14 +919,21 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| Date endTime = c.getTime();//明天0点 | Date endTime = c.getTime();//明天0点 | ||||
| c.add(Calendar.DAY_OF_YEAR, -30); | c.add(Calendar.DAY_OF_YEAR, -30); | ||||
| Date startTime = c.getTime(); | Date startTime = c.getTime(); | ||||
| int thisMonthCount = wxCouponOrderMapper.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setStartTime(startTime); | |||||
| wxCouponOrder.setEndTime(endTime); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| int thisMonthCount = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder);//月消费金额 | |||||
| c.clear(); | c.clear(); | ||||
| c.add(Calendar.DAY_OF_YEAR, -1); | c.add(Calendar.DAY_OF_YEAR, -1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | c.set(Calendar.HOUR_OF_DAY, 0); | ||||
| c.set(Calendar.MINUTE, 0); | c.set(Calendar.MINUTE, 0); | ||||
| c.set(Calendar.SECOND, 0); | c.set(Calendar.SECOND, 0); | ||||
| startTime = c.getTime(); | startTime = c.getTime(); | ||||
| int todayCount = wxCouponOrderMapper.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||||
| wxCouponOrder.setStartTime(startTime); | |||||
| wxCouponOrder.setEndTime(endTime); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| int todayCount = wxCouponOrderMapper.queryPriceTotal(wxCouponOrder);//月消费金额 | |||||
| DecimalFormat df = new DecimalFormat("0.00"); | DecimalFormat df = new DecimalFormat("0.00"); | ||||
| datamap.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | datamap.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 | ||||
| String thisMonthCountStr = df.format((float) thisMonthCount / 100); | String thisMonthCountStr = df.format((float) thisMonthCount / 100); | ||||
| @@ -750,10 +750,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int queryPriceTotal(String tenantId, Date startTime, Date endTime) { | |||||
| return wxCouponOrderMapper.queryPriceTotal(tenantId, startTime, endTime); | |||||
| public int queryPriceTotal(WxCouponOrder wxCouponOrder) { | |||||
| return wxCouponOrderMapper.queryPriceTotal(wxCouponOrder); | |||||
| } | } | ||||
| @Override | |||||
| public int queryCountTotal(WxCouponOrder wxCouponOrder) { | |||||
| return wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData listCardVoAsPage(WxCardCVo record, Integer pageIndex, Integer pageSize) { | public ResultData listCardVoAsPage(WxCardCVo record, Integer pageIndex, Integer pageSize) { | ||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findCardListOfCUser(record))); | return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findCardListOfCUser(record))); | ||||
| @@ -221,7 +221,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| couponOrderQ.setcUserId(user.getId()); | couponOrderQ.setcUserId(user.getId()); | ||||
| if (counpon.getSendType().equals(EnumCouponSendType.PASSIVE)) | if (counpon.getSendType().equals(EnumCouponSendType.PASSIVE)) | ||||
| couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | ||||
| countCouponOrder = wxCouponOrderMapper.countList(couponOrderQ); | |||||
| countCouponOrder = wxCouponOrderMapper.findCount(couponOrderQ); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | ||||
| @@ -100,14 +100,6 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCountByDateLimit" resultType="java.lang.Integer"> | |||||
| select COUNT(*) FROM wx_coupon_order | |||||
| where tenant_id = #{tenantId} | |||||
| and create_date >= #{startTime} | |||||
| and create_date <= #{endTime} | |||||
| </select> | |||||
| <select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | <select id="couponDataMap" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | ||||
| SELECT DATE_FORMAT(create_date,'%m/%d') as createTime, | SELECT DATE_FORMAT(create_date,'%m/%d') as createTime, | ||||
| COUNT(DISTINCT c_user_id) as couponUserCount, | COUNT(DISTINCT c_user_id) as couponUserCount, | ||||
| @@ -214,34 +206,57 @@ | |||||
| group by xTime | group by xTime | ||||
| </select> | </select> | ||||
| <select id="findVerifiedCountByCUser" resultType="java.lang.Integer"> | |||||
| select COUNT(*) FROM wx_coupon_order | |||||
| where c_user_id = #{cUserId} | |||||
| and update_date >= #{startTime} | |||||
| and update_date <= #{endTime} | |||||
| and coupon_order_status = 1 | |||||
| </select> | |||||
| <select id="findOrderedCountByCUser" resultType="java.lang.Integer"> | |||||
| select COUNT(*) FROM wx_coupon_order | |||||
| where c_user_id = #{cUserId} | |||||
| <select id="queryPriceTotal" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer" > | |||||
| SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order | |||||
| where 1=1 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != couponOrderStatus"> | |||||
| and coupon_order_status = #{couponOrderStatus} | |||||
| </if> | |||||
| <if test=" null != cUserId"> | |||||
| and c_user_id = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and coupon_id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != couponType "> | |||||
| and coupon_type = #{couponType} | |||||
| </if> | |||||
| <if test=" null != startTime"> | |||||
| and create_date >= #{startTime} | and create_date >= #{startTime} | ||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and create_date <= #{endTime} | and create_date <= #{endTime} | ||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="findVerifiedCount" resultType="java.lang.Integer"> | |||||
| select COUNT(*) FROM wx_coupon_order | |||||
| where tenant_id = #{tenantId} | |||||
| and update_date >= #{startTime} | |||||
| and update_date <= #{endTime} | |||||
| and coupon_order_status = 1 | |||||
| </select> | |||||
| <select id="findOrderedCount" resultType="java.lang.Integer"> | |||||
| <select id="findCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer"> | |||||
| select COUNT(*) FROM wx_coupon_order | select COUNT(*) FROM wx_coupon_order | ||||
| where tenant_id = #{tenantId} | |||||
| where 1=1 | |||||
| <if test=" null != tenantId"> | |||||
| and tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != couponOrderStatus"> | |||||
| and coupon_order_status = #{couponOrderStatus} | |||||
| </if> | |||||
| <if test=" null != cUserId"> | |||||
| and c_user_id = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and coupon_id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != couponType "> | |||||
| and coupon_type = #{couponType} | |||||
| </if> | |||||
| <if test=" null != startTime"> | |||||
| and create_date >= #{startTime} | and create_date >= #{startTime} | ||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and create_date <= #{endTime} | and create_date <= #{endTime} | ||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | <select id="queryPriceTotalGroup" resultType="com.iformall.domain.vo.CUserDateAmountVo" > | ||||
| @@ -249,10 +264,6 @@ | |||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | ||||
| </select> | </select> | ||||
| <select id="queryPriceTotal" resultType="java.lang.Integer" > | |||||
| SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order | |||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} | |||||
| </select> | |||||
| <select id="findExpiredFreeCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | <select id="findExpiredFreeCouponOrderByValidDate" parameterType="com.iformall.domain.po.WxCouponOrder" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon_order | select <include refid="allColumns" /> from wx_coupon_order | ||||
| @@ -355,11 +366,11 @@ | |||||
| </if> | </if> | ||||
| <if test="startDate != null"> | <if test="startDate != null"> | ||||
| AND co.create_date > #{startDate,jdbcType=TIMESTAMP} | |||||
| AND co.create_date > #{startTime,jdbcType=TIMESTAMP} | |||||
| </if> | </if> | ||||
| <if test="endDate != null"> | <if test="endDate != null"> | ||||
| AND co.create_date < #{endDate,jdbcType=TIMESTAMP} | |||||
| AND co.create_date < #{endTime,jdbcType=TIMESTAMP} | |||||
| </if> | </if> | ||||
| <if test=" null != id "> | <if test=" null != id "> | ||||