| @@ -109,7 +109,6 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| //TODO 待优化数据 | |||||
| @ApiOperation("交易流水分页列表接口") | @ApiOperation("交易流水分页列表接口") | ||||
| @GetMapping("listUnverified") | @GetMapping("listUnverified") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -119,35 +118,35 @@ public class WxCouponOrderController extends BaseController { | |||||
| public ResultData listUnverified(String date, Integer pageNum, Integer pageSize) { | public ResultData listUnverified(String date, Integer pageNum, Integer pageSize) { | ||||
| return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, false); | return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, false); | ||||
| } | } | ||||
| // | |||||
| // @ApiOperation("核销流水分页列表接口") | |||||
| // @GetMapping("listVerified") | |||||
| // @ApiImplicitParams({ | |||||
| // @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"), | |||||
| // @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| // @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| // public ResultData listVerified(String date, Integer pageNum, Integer pageSize) { | |||||
| // return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, true); | |||||
| // } | |||||
| // | |||||
| // | |||||
| // @RedisCache | |||||
| // @ApiOperation("某日期交易总流水") | |||||
| // @GetMapping("getUnverifiedAmountOnDate") | |||||
| // @ApiImplicitParams({ | |||||
| // @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")}) | |||||
| // public ResultData getUnverifiedAmountOnDate(String date) { | |||||
| // return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, false); | |||||
| // } | |||||
| // @RedisCache | |||||
| // @ApiOperation("某日期核销总流水") | |||||
| // @GetMapping("getVerifiedAmountOnDate") | |||||
| // @ApiImplicitParams({ | |||||
| // @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")}) | |||||
| // public ResultData getVerifiedAmountOnDate(String date) { | |||||
| // return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, true); | |||||
| // } | |||||
| @ApiOperation("核销流水分页列表接口") | |||||
| @GetMapping("listVerified") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"), | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData listVerified(String date, Integer pageNum, Integer pageSize) { | |||||
| return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, true); | |||||
| } | |||||
| @RedisCache | |||||
| @ApiOperation("某日期交易总流水") | |||||
| @GetMapping("getUnverifiedAmountOnDate") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")}) | |||||
| public ResultData getUnverifiedAmountOnDate(String date) { | |||||
| return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, false); | |||||
| } | |||||
| @RedisCache | |||||
| @ApiOperation("某日期核销总流水") | |||||
| @GetMapping("getVerifiedAmountOnDate") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")}) | |||||
| public ResultData getVerifiedAmountOnDate(String date) { | |||||
| return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, true); | |||||
| } | |||||
| @ApiOperation(value = "卡券详情接口") | @ApiOperation(value = "卡券详情接口") | ||||
| @@ -38,6 +38,9 @@ public class DaliyAmountSchedule { | |||||
| @Autowired | @Autowired | ||||
| private WxOrderMapper wxOrderMapper; | private WxOrderMapper wxOrderMapper; | ||||
| @Autowired | |||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -47,6 +50,11 @@ public class DaliyAmountSchedule { | |||||
| dateMap.put("endDate", endDate); | dateMap.put("endDate", endDate); | ||||
| dateMap.put("merchantId", merchant.getId()); | dateMap.put("merchantId", merchant.getId()); | ||||
| dateMap.put("tenantId", merchant.getTenantId()); | dateMap.put("tenantId", merchant.getTenantId()); | ||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(merchant); | |||||
| merchantBUserQ.setMerchantId(merchant.getId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| dateMap.put("bUserIds", bUserIds); | |||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | ||||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | ||||
| @@ -259,10 +259,35 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if (pageIndex == null || pageSize == null) { | if (pageIndex == null || pageSize == null) { | ||||
| List<WxCouponOrder> list; | List<WxCouponOrder> list; | ||||
| if (isVerified) | |||||
| if (isVerified) { | |||||
| WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); | |||||
| merchantBUserQ.updateTenantInfo(wxMerchant); | |||||
| merchantBUserQ.setMerchantId(wxMerchant.getId()); | |||||
| List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); | |||||
| dateMap.put("bUserIds", bUserIds); | |||||
| list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | ||||
| else | |||||
| }else { | |||||
| dateMap.put("startDateTimes", startDate.getTime()); | |||||
| dateMap.put("endDateTimes", endDate.getTime()); | |||||
| List<Long> merchantIdList = new ArrayList<Long>(); | |||||
| merchantIdList.add(wxMerchant.getId()); | |||||
| List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(wxMerchant.getTenantId(), merchantIdList); | |||||
| if (null != merchantProductVos) { | |||||
| List<Long> couponIds = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < merchantProductVos.size(); i ++) { | |||||
| WxMerchantProductVo mp = merchantProductVos.get(i); | |||||
| if (mp.getMc() == 1) { | |||||
| if (!couponIds.contains(mp.getProductId())) { | |||||
| couponIds.add(mp.getProductId()); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (couponIds.size() > 0 ) { | |||||
| dateMap.put("couponIds", couponIds); | |||||
| } | |||||
| } | |||||
| list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | ||||
| } | |||||
| //logger.info("find " + list.size() + " coupon order from " + /startDate + " to " + new Date()); | //logger.info("find " + list.size() + " coupon order from " + /startDate + " to " + new Date()); | ||||
| resultMap.put("amount", list.stream().mapToInt(p -> p.getCouponPrice()).sum()); | resultMap.put("amount", list.stream().mapToInt(p -> p.getCouponPrice()).sum()); | ||||
| resultMap.put("orderCount", list.size()); | resultMap.put("orderCount", list.size()); | ||||
| @@ -878,8 +878,17 @@ | |||||
| co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor, | co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor, | ||||
| co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy | co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy | ||||
| FROM wx_coupon_order co where co.`tenant_id` = #{tenantId} | FROM wx_coupon_order co where co.`tenant_id` = #{tenantId} | ||||
| <if test=" null != id and '' != id"> | |||||
| and co.`id` = #{id} | |||||
| <if test=" null != id "> | |||||
| and co.id = #{id} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and co.order_id = #{orderId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and c.id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != cUserId and '' != cUserId"> | |||||
| and co.c_user_id = #{cUserId} | |||||
| </if> | </if> | ||||
| <choose> | <choose> | ||||
| <when test=" null != couponType"> | <when test=" null != couponType"> | ||||
| @@ -932,19 +941,6 @@ | |||||
| AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP} | AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP} | ||||
| </if> | </if> | ||||
| <if test=" null != id "> | |||||
| and co.id = #{id} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and co.order_id = #{orderId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and c.id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != cUserId and '' != cUserId"> | |||||
| and co.c_user_id = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != couponIds"> | <if test=" null != couponIds"> | ||||
| and co.coupon_id in | and co.coupon_id in | ||||
| <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")"> | <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")"> | ||||
| @@ -1058,42 +1054,39 @@ | |||||
| </select> | </select> | ||||
| <sql id="allCouponOrderColumns"> | |||||
| <select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap"> | |||||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, | co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, | ||||
| co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor, | co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor, | ||||
| co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` | co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` | ||||
| </sql> | |||||
| <select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap"> | |||||
| select <include refid="allCouponOrderColumns" /> | |||||
| from wx_coupon_order co,wx_coupon_merchant cm, | |||||
| (select tco.id as tcoid, | |||||
| (select count(*) from wx_coupon_merchant tcm | |||||
| where tcm.product_id = tco.coupon_id | |||||
| and tcm.status = 0) | |||||
| as mc | |||||
| from wx_coupon_order tco) com | |||||
| where com.mc = 1 | |||||
| and co.tenant_id = #{tenantId} | |||||
| and com.tcoid = co.id | |||||
| and cm.status = 0 | |||||
| and cm.merchant_id = #{merchantId} | |||||
| and cm.product_id = co.coupon_id | |||||
| <if test="startDate != null"> | |||||
| AND co.create_date > #{startDate,jdbcType=TIMESTAMP} | |||||
| from wx_coupon_order co | |||||
| where co.tenant_id = #{tenantId} | |||||
| <if test="startDateTimes != null"> | |||||
| AND co.create_date_times > #{startDateTimes} | |||||
| </if> | </if> | ||||
| <if test="endDate != null"> | |||||
| AND co.create_date < #{endDate,jdbcType=TIMESTAMP} | |||||
| <if test="endDateTimes != null"> | |||||
| AND co.create_date_times < #{endDateTimes} | |||||
| </if> | |||||
| <if test=" null != couponIds"> | |||||
| and co.coupon_id in | |||||
| <foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")"> | |||||
| #{couponIdItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap"> | <select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap"> | ||||
| select <include refid="allCouponOrderColumns" /> | |||||
| from wx_coupon_order co, wx_merchant_b_user mbu | |||||
| where mbu.id = co.b_user_id | |||||
| co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, | |||||
| co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor, | |||||
| co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` | |||||
| from wx_coupon_order co | |||||
| where co.coupon_order_status = '1' | |||||
| and co.tenant_id = #{tenantId} | and co.tenant_id = #{tenantId} | ||||
| <if test="merchantId != null"> | |||||
| and mbu.merchant_id = #{merchantId} | |||||
| <if test=" null != bUserIdList"> | |||||
| and co.b_user_id in | |||||
| <foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")"> | |||||
| #{bUserIdItem} | |||||
| </foreach> | |||||
| </if> | </if> | ||||
| <if test="startDate != null"> | <if test="startDate != null"> | ||||
| AND co.update_date > #{startDate,jdbcType=TIMESTAMP} | AND co.update_date > #{startDate,jdbcType=TIMESTAMP} | ||||
| @@ -1101,7 +1094,6 @@ | |||||
| <if test="endDate != null"> | <if test="endDate != null"> | ||||
| AND co.update_date < #{endDate,jdbcType=TIMESTAMP} | AND co.update_date < #{endDate,jdbcType=TIMESTAMP} | ||||
| </if> | </if> | ||||
| AND co.coupon_order_status = '1' | |||||
| </select> | </select> | ||||