| @@ -122,12 +122,12 @@ public class WxCouponController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData findCountData(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | public ResultData findCountData(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | ||||
| //默认时间本月第一天,截止到当天 | |||||
| Map<String,Object> result = new HashedMap(); | Map<String,Object> result = new HashedMap(); | ||||
| if(wxCoupon.getStartdate() == null){ | if(wxCoupon.getStartdate() == null){ | ||||
| //获取当前月第一天 | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.add(Calendar.MONTH, 0); | c.add(Calendar.MONTH, 0); | ||||
| c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天 | |||||
| c.set(Calendar.DAY_OF_MONTH,1); | |||||
| wxCoupon.setStartdate(c.getTime()); | wxCoupon.setStartdate(c.getTime()); | ||||
| } | } | ||||
| if(wxCoupon.getEnddate() == null){ | if(wxCoupon.getEnddate() == null){ | ||||
| @@ -182,7 +182,7 @@ public class WxCouponController extends BaseController { | |||||
| for (WxCoupon coupon:paymentList){ | for (WxCoupon coupon:paymentList){ | ||||
| payMentMap.put(coupon.getXtime(),coupon.getSumPayment()); | payMentMap.put(coupon.getXtime(),coupon.getSumPayment()); | ||||
| } | } | ||||
| result.put("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize)); | |||||
| result.put("list",wxCouponService.findCouponData(wxCoupon,pageNum,pageSize)); | |||||
| result.put("saleHistory",saleMap); | result.put("saleHistory",saleMap); | ||||
| result.put("paymentHistory",payMentMap); | result.put("paymentHistory",payMentMap); | ||||
| result.put("saleCardCount",wxCouponService.findSaleCardCount(wxCoupon)); | result.put("saleCardCount",wxCouponService.findSaleCardCount(wxCoupon)); | ||||
| @@ -11,15 +11,19 @@ public class BaseMsg implements Serializable { | |||||
| private static final long serialVersionUID = 923764283764823L; | private static final long serialVersionUID = 923764283764823L; | ||||
| //唯一标识 | //唯一标识 | ||||
| @Transient | |||||
| private String uuid; | private String uuid; | ||||
| //消息类型 1短信 2回调短信 3邮件 4微信小程序模板 5微信公众号模板 6系统通知 | //消息类型 1短信 2回调短信 3邮件 4微信小程序模板 5微信公众号模板 6系统通知 | ||||
| @Transient | |||||
| private Integer msgType; | private Integer msgType; | ||||
| //消息状态 0默认1发送成功2消费成功3消费失败 | //消息状态 0默认1发送成功2消费成功3消费失败 | ||||
| @Transient | |||||
| private Integer msgStatus; | private Integer msgStatus; | ||||
| //结果信息 | //结果信息 | ||||
| @Transient | |||||
| private String statusMessage; | private String statusMessage; | ||||
| //延迟消息1s,5s,10s,30s,1m,2m,3m,4m,5m,6m,7m,8m,9m,10m,20m,30m,1h,2h | //延迟消息1s,5s,10s,30s,1m,2m,3m,4m,5m,6m,7m,8m,9m,10m,20m,30m,1h,2h | ||||
| @@ -41,4 +41,17 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| Long findTranCardCount(WxCoupon wxCoupon); | Long findTranCardCount(WxCoupon wxCoupon); | ||||
| Long findSubsidyMoney(WxCoupon wxCoupon); | Long findSubsidyMoney(WxCoupon wxCoupon); | ||||
| //-------卷-------- | |||||
| Long findCouponSendCount(WxCoupon wxCoupon); | |||||
| Long findCouponOrderCount(WxCoupon wxCoupon); | |||||
| Long findCouponGetCount(WxCoupon wxCoupon); | |||||
| Long findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| Long priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| Long priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -13,5 +13,6 @@ public interface WxMsgRecordMapper extends CommonMapper<WxMsgRecord, String> { | |||||
| List<WxMsgRecord> findList(WxMsgRecord record); | List<WxMsgRecord> findList(WxMsgRecord record); | ||||
| void update(WxMsgRecord record); | void update(WxMsgRecord record); | ||||
| void save(WxMsgRecord record); | |||||
| } | } | ||||
| @@ -99,4 +99,41 @@ public interface WxCouponService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| Long findSubsidyMoney(WxCoupon wxCoupon); | Long findSubsidyMoney(WxCoupon wxCoupon); | ||||
| //----------------卷-------------- | |||||
| /** | |||||
| * 卷发放数量 | |||||
| * @return | |||||
| */ | |||||
| Long findCouponSendCount(WxCoupon wxCoupon); | |||||
| /** | |||||
| * 卷购买数量 | |||||
| * @return | |||||
| */ | |||||
| Long findCouponOrderCount(WxCoupon wxCoupon); | |||||
| /** | |||||
| * 卷领取数量 | |||||
| * @return | |||||
| */ | |||||
| Long findCouponGetCount(WxCoupon wxCoupon); | |||||
| /** | |||||
| * 卷核销数量 | |||||
| * @return | |||||
| */ | |||||
| Long findCouponPaymentCount(WxCoupon wxCoupon); | |||||
| /** | |||||
| * 有价卷销售数量 | |||||
| * @return | |||||
| */ | |||||
| Long priceCouponSaleCount(WxCoupon wxCoupon); | |||||
| /** | |||||
| * 有价卷核销数量 | |||||
| * @return | |||||
| */ | |||||
| Long priceCouponPaymentCount(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -354,4 +354,34 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public PageInfo<WxCoupon> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) { | public PageInfo<WxCoupon> findCouponData(WxCoupon record, Integer pageNum, Integer pageSize) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public Long findCouponSendCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public Long findCouponOrderCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public Long findCouponGetCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public Long findCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public Long priceCouponSaleCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public Long priceCouponPaymentCount(WxCoupon wxCoupon) { | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -24,11 +24,11 @@ public class WxMsgRecordServiceImpl implements WxMsgRecordService { | |||||
| if(data instanceof WxMsgRecord){ | if(data instanceof WxMsgRecord){ | ||||
| WxMsgRecord msgRecord = (WxMsgRecord)data; | WxMsgRecord msgRecord = (WxMsgRecord)data; | ||||
| msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | ||||
| wxMsgRecordMapper.insertSelective(msgRecord); | |||||
| wxMsgRecordMapper.save(msgRecord); | |||||
| }else if(data instanceof WxMsg || data instanceof MailMsg){ | }else if(data instanceof WxMsg || data instanceof MailMsg){ | ||||
| WxMsgRecord msgRecord = new WxMsgRecord(); | WxMsgRecord msgRecord = new WxMsgRecord(); | ||||
| msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | ||||
| wxMsgRecordMapper.insertSelective(msgRecord); | |||||
| wxMsgRecordMapper.save(msgRecord); | |||||
| } | } | ||||
| } | } | ||||
| @@ -713,7 +713,7 @@ | |||||
| </select> | </select> | ||||
| <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns"/>, | |||||
| select c.*, | |||||
| (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | ||||
| (select count(distinct wcs.coupon_order_id) from wx_card_info ci | (select count(distinct wcs.coupon_order_id) from wx_card_info ci | ||||
| left join wx_coupon wc on wc.id = ci.coupon_id | left join wx_coupon wc on wc.id = ci.coupon_id | ||||
| @@ -728,29 +728,31 @@ | |||||
| where wc.id = c.id) as sum_payment | where wc.id = c.id) as sum_payment | ||||
| from wx_coupon c where 1=1 | from wx_coupon c where 1=1 | ||||
| <if test=" null != title "> | <if test=" null != title "> | ||||
| and `title` like concat('%', #{title},'%') | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | </if> | ||||
| order by status asc,create_date desc | order by status asc,create_date desc | ||||
| </select> | </select> | ||||
| <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns"/>, | |||||
| select c.*, | |||||
| (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | (select count(distinct wco.owner_id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | ||||
| (select count(distinct wcs.coupon_order_id) from wx_card_info ci | |||||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | |||||
| where wc.id = c.id) as transfer_count, | |||||
| (select sum(ci.sale_amount) from wx_card_info ci | |||||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||||
| where wc.id = c.id) as sale_amount, | |||||
| (select sum(wcs.real_payment) from wx_card_info ci | |||||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||||
| left join wx_card_spend wcs on wcs.card_id = ci.id | |||||
| where wc.id = c.id) as sum_payment | |||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | |||||
| (select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as payment_count | |||||
| from wx_coupon c where 1=1 | from wx_coupon c where 1=1 | ||||
| <if test=" null != type "> | |||||
| and c.type = #{type} | |||||
| </if> | |||||
| <if test=" null != title "> | <if test=" null != title "> | ||||
| and `title` like concat('%', #{title},'%') | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | </if> | ||||
| order by status asc,create_date desc | order by status asc,create_date desc | ||||
| </select> | </select> | ||||
| <select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||||
| select sum(subsidy_num) from wx_coupon c | |||||
| where c.create_date between #{startdate} and #{enddate} | |||||
| <if test="title != null"> | |||||
| and c.title like concat('%', #{title},'%') | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -77,5 +77,17 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <insert id="save" parameterType="com.iformall.domain.po.WxMsgRecord" > | |||||
| INSERT INTO wx_msg_record( `uuid`, `msg_type`, | |||||
| `domain`, `msg`, `send_time`, `model_id`, `model_type`, | |||||
| `signature`, `sender`, `sender_user_id`, `sender_user_name`, | |||||
| `receiver`, `receiver_user_id`, `receiver_user_name`, | |||||
| `msg_status`, `status_message`, `msg_json`) | |||||
| VALUES(#{uuid},#{msgType}, | |||||
| #{domain},#{msg},#{sendTime},#{modelId},#{modelType},#{signature},#{sender}, | |||||
| #{senderUserId},#{senderUserName},#{receiver},#{receiverUserId},#{receiverUserName}, | |||||
| #{msgStatus},#{statusMessage},#{msgJson}); | |||||
| </insert> | |||||
| </mapper> | </mapper> | ||||