Commit 4a298647 by Huang Linyu

Merge branch 'f-6.7.0' of 192.168.10.6:caosy/fun-golf-service into f-6.7.0

parents b54b52b4 a940850d
...@@ -297,8 +297,10 @@ public class OrderDao extends GenericHibernateDao<Order, Integer> { ...@@ -297,8 +297,10 @@ public class OrderDao extends GenericHibernateDao<Order, Integer> {
} }
public PagedEntityBean<OrderListBean> queryCanInvoiceOrder(OrderQuery orderQuery) throws Exception{ public PagedEntityBean<OrderListBean> queryCanInvoiceOrder(OrderQuery orderQuery) throws Exception{
PagedEntityBean<OrderListBean> pagedEntityBean = new PagedEntityBean<OrderListBean>(); //16785744
String sql = "SELECT SQL_CALC_FOUND_ROWS od.voucherAmount,od.prePayCardAmount,od.invoiceAmount,od.insuranceAmount,od.prePayAmount,od.refundAmount,od.orderId,od.orderId,od.OrderType,od.OrderNo,od.orderName,od.Uid,od.orderDate from ord_order od WHERE 1 = 1 AND od.uid=:uid AND od.orderDate >=:DecOfPreviousYear AND od.processStatus&16785488 = 16 AND od.OrderCategory not in (11,12) AND od.invoiceId is null AND od.canInvoiceDate<CURRENT_TIMESTAMP AND od.PrePayAmount+od.invoiceAmount-od.VoucherAmount-od.PrePayCardAmount-od.RefundAmount>0"; int allMatchStatus = OrderStatusBitEnum.DEDUCTED.getValue() + OrderStatusBitEnum.CANCELED.getValue() + OrderStatusBitEnum.REFUNDING.getValue() + OrderStatusBitEnum.ALL_UNSUBSCRIBED.getValue() + OrderStatusBitEnum.CONFIRM_INVOICE.getValue();
PagedEntityBean<OrderListBean> pagedEntityBean = new PagedEntityBean<OrderListBean>();
String sql = "SELECT SQL_CALC_FOUND_ROWS od.voucherAmount,od.prePayCardAmount,od.invoiceAmount,od.insuranceAmount,od.prePayAmount,od.refundAmount,od.orderId,od.orderId,od.OrderType,od.OrderNo,od.orderName,od.Uid,od.orderDate from ord_order od WHERE 1 = 1 AND od.uid=:uid AND od.orderDate >=:DecOfPreviousYear AND od.processStatus&"+allMatchStatus+" = 16 AND od.OrderCategory not in (11,12) AND od.invoiceId is null AND od.canInvoiceDate<CURRENT_TIMESTAMP AND od.PrePayAmount+od.invoiceAmount-od.VoucherAmount-od.PrePayCardAmount-od.RefundAmount>0";
Session session = this.getSession(); Session session = this.getSession();
Query query = session.createSQLQuery(sql); Query query = session.createSQLQuery(sql);
query.setParameter("uid", orderQuery.getUid()); query.setParameter("uid", orderQuery.getUid());
......
...@@ -9,10 +9,14 @@ import java.util.Collections; ...@@ -9,10 +9,14 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
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;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ctrip.fun.common.core.exceptions.service.ServiceException; import com.ctrip.fun.common.core.exceptions.service.ServiceException;
import com.ctrip.fun.common.core.util.BeanConverter; import com.ctrip.fun.common.core.util.BeanConverter;
...@@ -1056,6 +1060,36 @@ public class VoucherService { ...@@ -1056,6 +1060,36 @@ public class VoucherService {
String commune_voucher = clientConfig.getMessage(); String commune_voucher = clientConfig.getMessage();
this.sendVoucherForPlaceOrderByConfig(uid, orderId, myselfOrder, commune_voucher); this.sendVoucherForPlaceOrderByConfig(uid, orderId, myselfOrder, commune_voucher);
} }
/**
*
* @param uid
* @return
* @throws Exception
*/
public void sendVoucherFor360PlaceOrder(String uid,String orderId) throws Exception{
UserExt userExt = this.userExtDao.getByUid(uid);
Date communeEnd = DateUtil.addDateField(userExt.getCommuneAgainTime(),Calendar.YEAR, 1);
String rule_String = null;
JSONObject jsobj = JSONObject.parseObject(clientConfigDao.getByType("chongzhiren_voucher_send_360").getMessage());
JSONArray config_360 = jsobj.getJSONArray("rules");
for(int i=0;i<config_360.size();i++){
rule_String = config_360.get(i).toString();
JSONObject json_rule = JSONObject.parseObject(rule_String);
Date communeEnd_start = DateUtil.parseDateTime(json_rule.getString("communeEnd_start"));
Date communeEnd_end = DateUtil.parseDateTime(json_rule.getString("communeEnd_end"));
if(communeEnd_start.getTime()<communeEnd.getTime()&&communeEnd.getTime()<communeEnd_end.getTime()){
break;
}
}
if(rule_String!=null){
this.sendVoucherForPlaceOrderByConfig(uid,orderId,true,rule_String);
}
}
/** /**
* 用于执行下单送券 * 用于执行下单送券
* @param uid 得券人uid * @param uid 得券人uid
......
...@@ -359,9 +359,13 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean, ...@@ -359,9 +359,13 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
operationMessageService.executeSendMessageOfVipCommune(order, 91); operationMessageService.executeSendMessageOfVipCommune(order, 91);
communeInviteActivityService.updateCommuneInviteActivityData(order.getOrderId()); communeInviteActivityService.updateCommuneInviteActivityData(order.getOrderId());
}else{ }else{
try {
this.getVoucherService().sendVoucherFor360PlaceOrder(order.getUid(), order.getOrderId()+"");
} catch (Exception e) {
e.printStackTrace();
}
getUserExtDao().setUserExtVipGradeRenewCommune(order.getUid()); getUserExtDao().setUserExtVipGradeRenewCommune(order.getUid());
operationMessageService.executeSendMessageOfVipCommune(order, 110); operationMessageService.executeSendMessageOfVipCommune(order, 110);
} }
} }
......
package com.ctrip.fun.golf.service.order; package com.ctrip.fun.golf.service.order;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.beanutils.BeanUtils;
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;
import com.ctrip.fun.common.vo.PagedResponseBean; import com.ctrip.fun.common.vo.PagedResponseBean;
import com.ctrip.fun.common.vo.Response; import com.ctrip.fun.common.vo.Response;
import com.ctrip.fun.common.vo.ResponseStatusEnum; import com.ctrip.fun.common.vo.ResponseStatusEnum;
...@@ -71,6 +69,26 @@ public class OpVoucherOrderService extends AbstractOpOrderService<VoucherOrderPr ...@@ -71,6 +69,26 @@ public class OpVoucherOrderService extends AbstractOpOrderService<VoucherOrderPr
return pagedResponseBean; return pagedResponseBean;
} }
@Override
public List<VoucherOrderListExcelBean> queryOrdersExcel(OpOrderQuery orderQuery) {
PagedResponseBean<VoucherOrderListBean> page = this.queryOrders(orderQuery);
List<VoucherOrderListExcelBean> excel_list = new ArrayList<VoucherOrderListExcelBean>();
if(page!=null&&page.getResult()!=null){
List<VoucherOrderListBean> list = (List<VoucherOrderListBean>) page.getResult();
try {
for(VoucherOrderListBean bean:list){
VoucherOrderListExcelBean excelBean = new VoucherOrderListExcelBean();
BeanUtils.copyProperties(excelBean, bean);
excel_list.add(excelBean);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return excel_list;
}
public Response<Object> updateOpenOrderPerson(String userId, OpOrderQuery orderQuery) { public Response<Object> updateOpenOrderPerson(String userId, OpOrderQuery orderQuery) {
Response<Object> response = new Response<Object>(); Response<Object> response = new Response<Object>();
CommuneOrderItem communeOrderItem = this.getOrderDao().findCommuneOrderItemById(orderQuery.getOrderId()); CommuneOrderItem communeOrderItem = this.getOrderDao().findCommuneOrderItemById(orderQuery.getOrderId());
...@@ -176,14 +194,6 @@ public class OpVoucherOrderService extends AbstractOpOrderService<VoucherOrderPr ...@@ -176,14 +194,6 @@ public class OpVoucherOrderService extends AbstractOpOrderService<VoucherOrderPr
return null; return null;
} }
@Override
public List<VoucherOrderListExcelBean> queryOrdersExcel(
OpOrderQuery orderQuery) {
// TODO Auto-generated method stub
return null;
}
public UserExtDao getUserExtDao() { public UserExtDao getUserExtDao() {
return userExtDao; return userExtDao;
} }
......
...@@ -8,6 +8,7 @@ import java.util.Map; ...@@ -8,6 +8,7 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.ctrip.fun.common.core.util.DateUtil;
import com.ctrip.fun.common.vo.order.OrderCategoryEnum; import com.ctrip.fun.common.vo.order.OrderCategoryEnum;
import com.ctrip.fun.golf.dao.market.CommuneInviteActivityDao; import com.ctrip.fun.golf.dao.market.CommuneInviteActivityDao;
import com.ctrip.fun.golf.dao.order.CommuneOrderItemDao; import com.ctrip.fun.golf.dao.order.CommuneOrderItemDao;
...@@ -48,29 +49,29 @@ public class CommuneNotifyService extends AbstractNotifyService { ...@@ -48,29 +49,29 @@ public class CommuneNotifyService extends AbstractNotifyService {
String ordersSn = notifyMap.get("out_trade_no").toString();//商户订单号 String ordersSn = notifyMap.get("out_trade_no").toString();//商户订单号
//根据订单号查询订单,修改订单相关信息 //根据订单号查询订单,修改订单相关信息
Order order = this.getOrderDao().getOrderByOrderNo(Long.parseLong(ordersSn)); Order order = this.getOrderDao().getOrderByOrderNo(Long.parseLong(ordersSn));
try { if(order.getProcessStatus()!=20){
this.getOrderDao().updateOrderStatusForMiniApps(Long.parseLong(ordersSn)); try {
} catch (Exception e) { this.getOrderDao().updateOrderStatusForMiniApps(Long.parseLong(ordersSn));
e.printStackTrace(); } catch (Exception e) {
} e.printStackTrace();
CommuneOrderItem communeOrderItem = communeOrderItemDao.getByOrderId(order.getOrderId()).get(0); }
String uid = order.getUid();//下单人id CommuneOrderItem communeOrderItem = communeOrderItemDao.getByOrderId(order.getOrderId()).get(0);
String recommendUid = communeOrderItem.getRecommendUid();//推荐人id String uid = order.getUid();//下单人id
this.doPaySuccess(order); String recommendUid = communeOrderItem.getRecommendUid();//推荐人id
//执行发券规则 this.doPaySuccess(order);
if(OrderCategoryEnum.COMMUNE.getKey() == order.getOrderCategory()){ //执行发券规则
if(order.getAmount().intValue()==980 ){ if(OrderCategoryEnum.COMMUNE.getKey() == order.getOrderCategory()){
//1:执行充值人的小程序送券 if(order.getAmount().intValue()==980 ){
voucherService.sendVoucherForPlaceOrder(uid, order.getOrderId()+"", true, "chongzhiren_voucher_send_980"); //1:执行充值人的小程序送券
//1:执行推荐人的小程序送券 voucherService.sendVoucherForPlaceOrder(uid, order.getOrderId()+"", true, "chongzhiren_voucher_send_980");
if(recommendUid!=null&&!"".equals(recommendUid)){ //1:执行推荐人的小程序送券
voucherService.sendVoucherForPlaceOrder(recommendUid, order.getOrderId()+"", false, "tuijianren_voucher_send_980"); if(recommendUid!=null&&!"".equals(recommendUid)){
} voucherService.sendVoucherForPlaceOrder(recommendUid, order.getOrderId()+"", false, "tuijianren_voucher_send_980");
}else if(order.getAmount().intValue()==360){ }
//1:执行续费人的小程序送券 }
voucherService.sendVoucherForPlaceOrder(uid, order.getOrderId()+"", true, "chongzhiren_voucher_send_360"); }
}
} }
} }
} }
return null; return null;
...@@ -111,6 +112,12 @@ public class CommuneNotifyService extends AbstractNotifyService { ...@@ -111,6 +112,12 @@ public class CommuneNotifyService extends AbstractNotifyService {
communeInviteActivityService.updateCommuneInviteActivityData(order.getOrderId()); communeInviteActivityService.updateCommuneInviteActivityData(order.getOrderId());
sendMessage(order, 91); sendMessage(order, 91);
}else{ }else{
//1:执行续费送券逻辑
try {
voucherService.sendVoucherFor360PlaceOrder(order.getUid(), order.getOrderId()+"");
} catch (Exception e) {
e.printStackTrace();
}
getUserExtDao().setUserExtVipGradeRenewCommune(order.getUid()); getUserExtDao().setUserExtVipGradeRenewCommune(order.getUid());
sendMessage(order, 110); sendMessage(order, 110);
} }
......
...@@ -115,7 +115,7 @@ public class UserOrderBehaviourStatisticsDaoTest { ...@@ -115,7 +115,7 @@ public class UserOrderBehaviourStatisticsDaoTest {
} }
@Test @Test
public void testOrderUpdate() throws Exception { public void testOrderUpdate() throws Exception {
voucherService.voucherUsedSend(1106088, "15021270276", "lichong", 1); voucherService.sendVoucherFor360PlaceOrder("15021268738", "111111");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment