Commit 1354a17d by Huang Linyu

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

parents 08c31b9d 871789f8
...@@ -172,6 +172,7 @@ public class VoucherDao extends GenericHibernateDao<Voucher, Integer> { ...@@ -172,6 +172,7 @@ public class VoucherDao extends GenericHibernateDao<Voucher, Integer> {
StringBuilder sb = new StringBuilder( StringBuilder sb = new StringBuilder(
"select count(*) as count from bsc_voucher v where 1=1 "); "select count(*) as count from bsc_voucher v where 1=1 ");
sb.append(" and v.uid='").append(uid).append("'"); sb.append(" and v.uid='").append(uid).append("'");
sb.append(" and v.isShare=0");
sb.append(" and v.Used=").append(VourcherUsedEnum.UNUSED.getKey().intValue()); sb.append(" and v.Used=").append(VourcherUsedEnum.UNUSED.getKey().intValue());
sb.append(" and DATE_FORMAT(EndUseDate, '%Y-%m-%d') >= DATE_FORMAT(now(), '%Y-%m-%d') "); sb.append(" and DATE_FORMAT(EndUseDate, '%Y-%m-%d') >= DATE_FORMAT(now(), '%Y-%m-%d') ");
if (!isNew) { if (!isNew) {
...@@ -516,6 +517,7 @@ public class VoucherDao extends GenericHibernateDao<Voucher, Integer> { ...@@ -516,6 +517,7 @@ public class VoucherDao extends GenericHibernateDao<Voucher, Integer> {
criteria.add(Restrictions.eq("used", queryBean.getUsed())); criteria.add(Restrictions.eq("used", queryBean.getUsed()));
} }
criteria.add(Restrictions.eq("uid", queryBean.getUid())); criteria.add(Restrictions.eq("uid", queryBean.getUid()));
criteria.add(Restrictions.eq("isShare", 0));
if (queryBean.getType() != null && queryBean.getType() != 0) { if (queryBean.getType() != null && queryBean.getType() != 0) {
criteria.add(Restrictions.eq("type", queryBean.getType())); criteria.add(Restrictions.eq("type", queryBean.getType()));
} }
......
...@@ -867,12 +867,40 @@ public class VoucherService { ...@@ -867,12 +867,40 @@ public class VoucherService {
voucherGetLog.setCreateTime(new Date()); voucherGetLog.setCreateTime(new Date());
voucherGetLog.setNewVoucherid(newVoucher.getId()); voucherGetLog.setNewVoucherid(newVoucher.getId());
voucherGetLogDao.save(voucherGetLog); voucherGetLogDao.save(voucherGetLog);
//执行分享掉再送券活动
this.voucherUsedSend(voucher.getId(), voucherShareLog.getUid(), voucherShareLog.getId()+"", VoucherSourceEnum.RULE_VOUCHERUSED_PRESENT.getValue());
//设置状态 //设置状态
response.setStatus(1); response.setStatus(1);
response.setMessage("抢券成功"); response.setMessage("抢券成功");
response.setBody("success"); response.setBody("success");
return response; return response;
} }
/**
* //执行用户券下单或者分享使用掉了券,再补发送券活动
* @param voucher 使用的券对象
* @param uid 券送给谁
* @param remark 本次发券备注:分享id,或者订单号
* @param source 券来源
*/
public void voucherUsedSend(int usedVoucherId,String uid,String remark,int source){
Voucher voucher = voucherDao.findById(usedVoucherId);
ClientConfig clientConfig = clientConfigDao.getByType("voucher_used_send");
JSONObject jsobj = JSONObject.parseObject(clientConfig.getMessage());
if(jsobj.get(voucher.getRuleId()+"")!=null){
String[] newRuleIds = jsobj.get(voucher.getRuleId()+"").toString().split(",");
for(String newRuleId:newRuleIds){
VoucherRule roucherRule = voucherRuleDao.findById(Integer.parseInt(newRuleId));
for(int i=0;i<roucherRule.getQuantity();i++){
Voucher againVoucher = this.getVoucherFromRule(roucherRule);
againVoucher.setNo("");
againVoucher.setUid(uid);
againVoucher.setSourceRemark(remark);
againVoucher.setSource(source);
voucherDao.save(againVoucher);
}
}
}
}
public Response<VoucherItemDTO> executeGetRedeemCodeForMallOrder(VoucherQueryDto query) { public Response<VoucherItemDTO> executeGetRedeemCodeForMallOrder(VoucherQueryDto query) {
Response<VoucherItemDTO> response = new Response<VoucherItemDTO>(); Response<VoucherItemDTO> response = new Response<VoucherItemDTO>();
......
...@@ -28,6 +28,7 @@ import com.ctrip.fun.common.vo.ResponseStatusEnum; ...@@ -28,6 +28,7 @@ import com.ctrip.fun.common.vo.ResponseStatusEnum;
import com.ctrip.fun.common.vo.basic.AbstractRuleConditionBean; import com.ctrip.fun.common.vo.basic.AbstractRuleConditionBean;
import com.ctrip.fun.common.vo.basic.MultipleCourseConditionBean; import com.ctrip.fun.common.vo.basic.MultipleCourseConditionBean;
import com.ctrip.fun.common.vo.basic.VipGradeEnum; import com.ctrip.fun.common.vo.basic.VipGradeEnum;
import com.ctrip.fun.common.vo.basic.VoucherSourceEnum;
import com.ctrip.fun.common.vo.order.AbstractOrderBean; import com.ctrip.fun.common.vo.order.AbstractOrderBean;
import com.ctrip.fun.common.vo.order.AbstractOrderListItemBean; import com.ctrip.fun.common.vo.order.AbstractOrderListItemBean;
import com.ctrip.fun.common.vo.order.CustomerInfoBean; import com.ctrip.fun.common.vo.order.CustomerInfoBean;
...@@ -1104,6 +1105,9 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex ...@@ -1104,6 +1105,9 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
if(usedCount != order.getVoucherCount()){ if(usedCount != order.getVoucherCount()){
throw new OrderException(-100, "您的抵用劵使用错误"); throw new OrderException(-100, "您的抵用劵使用错误");
} }
for(VoucherItemBean bean: beanlist){
//this.voucherService.voucherUsedSend(bean.getId(), order.getUid(), order.getOrderNo()+"", VoucherSourceEnum.RULE_VOUCHERUSED_PRESENT.getValue());
}
} }
} }
if (order.getPrePayCardAmount().doubleValue() > 0) { if (order.getPrePayCardAmount().doubleValue() > 0) {
......
...@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; ...@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
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.RSA; import com.ctrip.fun.common.core.util.RSA;
import com.ctrip.fun.common.vo.basic.VoucherSourceEnum;
import com.ctrip.fun.common.vo.integral.IntegralLogTypeEnum; import com.ctrip.fun.common.vo.integral.IntegralLogTypeEnum;
import com.ctrip.fun.common.vo.order.OrderCategoryEnum; import com.ctrip.fun.common.vo.order.OrderCategoryEnum;
import com.ctrip.fun.common.vo.order.OrderProcessEnum; import com.ctrip.fun.common.vo.order.OrderProcessEnum;
...@@ -277,6 +278,12 @@ public abstract class AbstractNotifyService extends CorePaymentService { ...@@ -277,6 +278,12 @@ public abstract class AbstractNotifyService extends CorePaymentService {
try { try {
this.voucherService.userVoucher(order.getVoucherCount(), order.getOrderNo(), this.voucherService.userVoucher(order.getVoucherCount(), order.getOrderNo(),
order.getVoucherIDList()); order.getVoucherIDList());
if(order.getVoucherIDList()!=null&&!"".equals(order.getVoucherIDList())){
for(String usedVoucherId: order.getVoucherIDList().split(",")){
//this.voucherService.voucherUsedSend(Integer.parseInt(usedVoucherId), order.getUid(), order.getOrderNo()+"", VoucherSourceEnum.RULE_VOUCHERUSED_PRESENT.getValue());
}
}
} catch (Exception e) { } catch (Exception e) {
logger.warn(e.getMessage(), e); logger.warn(e.getMessage(), e);
handPayException(order, e); handPayException(order, e);
......
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