| @@ -80,6 +80,9 @@ public class Test { | |||
| @Autowired | |||
| private WxBillSettleRecordService wxBillSettleRecordService; | |||
| @Autowired | |||
| private WxBillPropertyService wxBillPropertyService; | |||
| @Before | |||
| public void setUp() { | |||
| mockHttpServletRequest = new MockHttpServletRequest(webApplicationContext.getServletContext()); | |||
| @@ -148,8 +151,12 @@ public class Test { | |||
| WxBillAll wxBillAll = new WxBillAll(); | |||
| wxBillAll.setTenantId("456"); | |||
| wxBillAll.setMerchantId(324754110547066880l); | |||
| wxBillAll.setPageIndex(1); | |||
| wxBillAll.setPageSize(6); | |||
| System.out.println("--------"+JsonUtil.obj2Json(wxBillAllService.listBill(wxBillAll))); | |||
| } | |||
| @org.junit.Test | |||
| public void testPro(){ | |||
| System.out.println("--------"+JsonUtil.obj2Json(wxBillPropertyService.detail(329481088662077445l))); | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| import javax.persistence.Transient; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| @@ -74,6 +75,9 @@ public class WxBillAllVo { | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") | |||
| private Date updatetime; | |||
| @Transient | |||
| private Integer freeze; | |||
| public String getReceivePayStr() { | |||
| if(getReceivePay()!=null) { | |||
| receivePayStr = new BigDecimal(getReceivePay()).divide(new BigDecimal(100)).toString(); | |||
| @@ -65,6 +65,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | |||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryOrdered(HashMap<String,Object> params); | |||
| List<MarkingSceneDataVo> queryForSceneRepotyMechantHistoryOrdered(HashMap<String,Object> params); | |||
| @@ -316,6 +316,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||
| queryDto.setEndTime(convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||
| } | |||
| //TODO 商户发券数据,下个版本需求 | |||
| if(Objects.equals(markingCouponDataReportDto.getType(),EnumCouponSendSendType.MERCHANT.getCode())) { | |||
| markingCouponDataReportDto.setType(null); | |||
| } | |||
| //停车发券数 停车发券被核销数, 核销发券数 核销发券被核销数, B端刷卡支付发券数 刷卡支付发券被核销数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<MarkingSceneDataVo> list; | |||
| @@ -332,6 +337,9 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| }else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.C_ORDER.getCode())){ | |||
| queryDto.setChannelType(EnumCouponSendSendType.C_ORDER.getCode()); | |||
| list = wxCouponActionLogMapper.sceneDataList(queryDto); | |||
| }else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.MERCHANT.getCode())){ | |||
| queryDto.setChannelType(markingCouponDataReportDto.getType()); | |||
| list = wxCouponActionLogMapper.sceneDataList(queryDto); | |||
| }else{ | |||
| PageHelper.clearPage(); | |||
| list = new ArrayList<>(); | |||
| @@ -383,6 +391,17 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| params.put("channelType", EnumCouponSendSendType.C_ORDER.getCode()); | |||
| List<MarkingSceneDataReportVo> list4 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); | |||
| countMap = list4.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); | |||
| } else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.MERCHANT.getCode())){ | |||
| //购买发数 | |||
| params.clear(); | |||
| params.put("tenantId", tenantId); | |||
| if (markingCouponDataReportDto.getStartTime() != null) | |||
| params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||
| if (markingCouponDataReportDto.getEndTime() != null) | |||
| params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||
| params.put("channelType", markingCouponDataReportDto.getType()); | |||
| List<MarkingSceneDataReportVo> list5 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params); | |||
| countMap = list5.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getXTime, p -> p.getTempCount())); | |||
| } | |||
| Map<String, Integer> triggerCountMap = new HashMap<>(); | |||
| @@ -430,6 +449,17 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyHistoryOrdered(params); | |||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | |||
| }else if (markingCouponDataReportDto.getType().equals(EnumCouponSendSendType.MERCHANT.getCode())) { | |||
| //购买发券数 | |||
| params.clear(); | |||
| params.put("tenantId", tenantId); | |||
| if (markingCouponDataReportDto.getStartTime() != null) | |||
| params.put("startTime", convertDateAndAdd(markingCouponDataReportDto.getStartTime(),0)); | |||
| if (markingCouponDataReportDto.getEndTime() != null) | |||
| params.put("endTime", convertDateAndAdd(markingCouponDataReportDto.getEndTime(), 1)); | |||
| params.put("channelType", markingCouponDataReportDto.getType()); | |||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCouponOrderMapper.queryForSceneRepotyMechantHistoryOrdered(params); | |||
| triggerCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getXtime, p -> p.getTriggerCount())); | |||
| } | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2); | |||
| @@ -205,7 +205,7 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| WxBillOtherDeposit dbBill = wxBillOtherDepositMapper.selectByPrimaryKey(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| wxBillOtherDeposit.setPay(dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| wxBillOtherDeposit.setPayDate(new Date()); | |||
| addBillAction(bill.getBillId(), dbBill.getReceivePay()); | |||
| } | |||
| } | |||
| @@ -215,14 +215,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| propertyDeposit.setId(bill.getBillId()); | |||
| if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); | |||
| if(status != null){ | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setPayDate(new Date()); | |||
| propertyDeposit.setStatus(status); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| } | |||
| if(EnumBillRentStatus.PAID.getCode().equals(status)){ | |||
| WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| propertyDeposit.setPay(dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| addBillAction(bill.getBillId(), dbBill.getReceivePay()); | |||
| } | |||
| } | |||
| @@ -250,14 +250,14 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||
| propertyDeposit.setId(bill.getBillId()); | |||
| if(freezeStatus != null) wxBillRent.setFreeze(freezeStatus); | |||
| if(status != null){ | |||
| wxBillRent.setStatus(status); | |||
| wxBillRent.setPayDate(new Date()); | |||
| propertyDeposit.setStatus(status); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| } | |||
| if(EnumBillRentStatus.PAID.getCode().equals(status)){ | |||
| WxBillPropertyDeposit dbBill = wxBillPropertyDepositMapper.selectByPrimaryKey(wxBillRent.getId()); | |||
| if(dbBill!=null) { | |||
| propertyDeposit.setPay(dbBill.getReceivePay()); | |||
| wxBillRent.setPayDate(new Date()); | |||
| propertyDeposit.setPayDate(new Date()); | |||
| addBillAction(bill.getBillId(), dbBill.getReceivePay()); | |||
| } | |||
| } | |||
| @@ -16,10 +16,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.PressUtils; | |||
| import com.iformall.utils.RedisLock; | |||
| import com.iformall.utils.Utility; | |||
| import com.iformall.utils.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -642,17 +639,27 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| private WxCouponOrder createCouponOrder(WxOrder order, WxCUser user, WxCoupon coupon) { | |||
| Date curr = new Date(); | |||
| Date valid_date = null; | |||
| int limit_days = Constant.WX_LIMIT_DAYS; | |||
| if (coupon.getValidType().equals(EnumValidStatus.VALID_RANGE.getCode()) || | |||
| coupon.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { | |||
| valid_date = coupon.getValidEndDate(); | |||
| if (coupon.getSalePrice() > 0) { | |||
| // 有价券核销有效期不能大于分账过期时间 | |||
| Date limit_date = DateUtils.getTimeAfterDays(limit_days, curr); | |||
| if (valid_date.after(limit_date)) { | |||
| valid_date = limit_date; | |||
| } | |||
| } | |||
| } else { | |||
| Calendar calendar = Calendar.getInstance(); | |||
| calendar.setTime(curr); | |||
| calendar.set(Calendar.HOUR_OF_DAY, 0); | |||
| calendar.set(Calendar.MINUTE, 0); | |||
| calendar.set(Calendar.SECOND, 0); | |||
| calendar.add(Calendar.DAY_OF_MONTH, 1 + coupon.getValidDays()); | |||
| valid_date = calendar.getTime(); | |||
| if (coupon.getSalePrice() > 0) { | |||
| // 有价券核销有效期不能大于分账过期时间 | |||
| if (coupon.getValidDays() < Constant.WX_LIMIT_DAYS) { | |||
| limit_days = coupon.getValidDays(); | |||
| } | |||
| } else { | |||
| limit_days = coupon.getValidDays(); | |||
| } | |||
| valid_date = DateUtils.getTimeAfterDays(limit_days, curr); | |||
| } | |||
| boolean isCard = false; | |||
| // 检查是否是储值卡 | |||
| @@ -105,7 +105,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||
| Integer billTypeValue = ((Long) bill.get("billTypeValue")).intValue(); | |||
| if(EnumBillType.SETTLE.getCode().equals(billTypeValue)){ | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(record.getBillId(), EnumFilterSettle.NO.getCode()); | |||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(record.getBillId(), EnumFilterSettle.YES.getCode()); | |||
| owe = wxBillSettle.getBalance(); | |||
| bill.put("owe",owe); | |||
| logger.info("wxBillSettle.balance:{}",owe); | |||
| @@ -8,6 +8,8 @@ public class Constant { | |||
| public static final int SYS_MENU_MAX = 2000; // 系统菜单最大值 | |||
| public static final int WX_LIMIT_DAYS = 30; // 微信分账限制30天 | |||
| // 1小时过期, | |||
| public final static int H_EXPIRE = 3600000; | |||
| @@ -1250,4 +1250,14 @@ public class DateUtils { | |||
| LocalDate startLocalDate = LocalDate.of(startYear,startMonth,startDay); | |||
| return startLocalDate.until(endLocalDate, ChronoUnit.DAYS); | |||
| } | |||
| /* | |||
| public static void main(String[] args) throws Exception { | |||
| SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | |||
| Date ll; | |||
| ll = dd.parse("2019-07-27 11:00:00"); | |||
| Date next = DateUtils.getTimeAfterDays(30, ll); | |||
| System.out.println(next); | |||
| } | |||
| */ | |||
| } | |||
| @@ -38,8 +38,8 @@ | |||
| <result column="price_detail" property="priceDetail"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| <result column="freeze" property="freeze"/> | |||
| </resultMap> | |||
| @@ -46,7 +46,7 @@ | |||
| </select> | |||
| <select id="findBySettleId" parameterType="com.iformall.domain.po.WxBillSettleBill" resultMap="BaseResultMap"> | |||
| select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.receive_pay,0) receivePay from wx_bill_settle_bill bl left join | |||
| select bill.starttime,bill.endtime,bl.bill_id,bl.bill_type,bill.bill_type billName,IFNULL(bill.owe,0) receivePay from wx_bill_settle_bill bl left join | |||
| (select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金-租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type,starttime,endtime from wx_bill_rent where is_preview = 0 | |||
| union all | |||
| @@ -213,6 +213,20 @@ | |||
| group by xTime | |||
| </select> | |||
| <select id="queryForSceneRepotyMechantHistoryOrdered" resultType="com.iformall.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount | |||
| from wx_coupon_order c left join wx_coupon_action_log cal on cal.tenant_id = c.tenant_id | |||
| where cal.coupon_order_id=c.id | |||
| and c.tenant_id=#{tenantId} | |||
| <if test=" null != channelType and null != channelType"> | |||
| and cal.channel_type=#{channelType} | |||
| </if> | |||
| <if test=" null != startTime and null != endTime"> | |||
| and c.create_date BETWEEN #{startTime} and #{endTime} | |||
| </if> | |||
| group by xTime | |||
| </select> | |||
| <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 | |||