Commit 881ee7cb authored by libin's avatar libin

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 235aa57b 9ca2791e
...@@ -293,8 +293,8 @@ public class AppPermissionService { ...@@ -293,8 +293,8 @@ public class AppPermissionService {
}*/ }*/
//临时会员绑定 //临时会员绑定
insertUserMemberByUserIdAndPhone(userid, username); insertUserMemberByUserIdAndPhone(userid, username);
//参加新人活动 /*//参加新人活动
jionActivity(userid); jionActivity(userid);*/
//创建钱包 //创建钱包
walletBiz.createWalletByUserId(appUserLogin.getId()); walletBiz.createWalletByUserId(appUserLogin.getId());
// 登录结果要做做统一处理 // 登录结果要做做统一处理
...@@ -892,8 +892,8 @@ public class AppPermissionService { ...@@ -892,8 +892,8 @@ public class AppPermissionService {
relationBiz.bindByUserId(userid, small_id); relationBiz.bindByUserId(userid, small_id);
//发送短信通知用户 //发送短信通知用户
thirdFeign.sendCode(username, password, SystemConfig.TEMPLATECODE); thirdFeign.sendCode(username, password, SystemConfig.TEMPLATECODE);
//参加新人活动 /* //参加新人活动
jionActivity(userid); jionActivity(userid);*/
// 登录结果要做做统一处理 // 登录结果要做做统一处理
JSONObject data = autoLogin(userid, username, headimgurl, nickname,null); JSONObject data = autoLogin(userid, username, headimgurl, nickname,null);
// 到im注册,获取返回结果 // 到im注册,获取返回结果
......
...@@ -18,6 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -18,6 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
...@@ -118,8 +120,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -118,8 +120,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
List<UserCouponVo> list=mapper.getUserCouponsByType(userId,type,time,channel); List<UserCouponVo> list=mapper.getUserCouponsByType(userId,type,time,channel);
if(amout.compareTo(new BigDecimal("0.00"))>0&&list.size()>0){ if(amout.compareTo(new BigDecimal("0.00"))>0&&list.size()>0){
for (UserCouponVo couponVo:list){ for (UserCouponVo couponVo:list){
Integer status=2; Integer status=2;
if(amout.compareTo(couponVo.getUsedAmount())>=0){
if(couponVo.getChannel()==1){ if(couponVo.getChannel()==1){
if (amout.compareTo(couponVo.getWithAmount())>=0){ if (amout.compareTo(couponVo.getWithAmount())>=0){
status=1; status=1;
...@@ -127,11 +128,12 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -127,11 +128,12 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
}else if (couponVo.getChannel()==3){ }else if (couponVo.getChannel()==3){
status=1; status=1;
} }
}
couponVo.setStatus(status); couponVo.setStatus(status);
} }
} }
list.sort(Comparator.comparing(UserCouponVo::getStatus));
return ObjectRestResponse.succ(list); return ObjectRestResponse.succ(list);
} }
......
...@@ -3,11 +3,7 @@ package com.xxfc.platform.activity.config; ...@@ -3,11 +3,7 @@ package com.xxfc.platform.activity.config;
import com.github.wxiaoqi.security.common.config.RabbitCommonConfig; import com.github.wxiaoqi.security.common.config.RabbitCommonConfig;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO; import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant; import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import org.springframework.amqp.core.Binding; import com.xxfc.platform.universal.constant.MQconstant;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -23,12 +19,17 @@ public class RabbitActivityConfig extends RabbitCommonConfig { ...@@ -23,12 +19,17 @@ public class RabbitActivityConfig extends RabbitCommonConfig {
public static final String INTEGRAL_QUEUE = "integral_queue"; public static final String INTEGRAL_QUEUE = "integral_queue";
public static final String POPULARZIE_0101_QUEUE = "popularzie.0101.queue"; public static final String POPULARZIE_0101_QUEUE = "popularzie.0101.queue";
//新人注册有礼
public static final String ACTIVITY_NEW_QUEUE = "activity.new.queue";
public static final String INTEGRAL_HANDLE_QUEUE = "integral_handle_queue";
static { static {
myQueue = new ArrayList<BindDTO>(){{ myQueue = new ArrayList<BindDTO>(){{
add(new BindDTO(INTEGRAL_QUEUE, RabbitConstant.ORDER_TOPIC, "order.#")); add(new BindDTO(INTEGRAL_QUEUE, RabbitConstant.ORDER_TOPIC, "order.#"));
add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register")); add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register"));
add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth")); add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth"));
add(new BindDTO(ACTIVITY_NEW_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register"));
add(new BindDTO(ACTIVITY_NEW_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth"));
add(new BindDTO(INTEGRAL_HANDLE_QUEUE, MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY));
}}; }};
} }
......
...@@ -4,6 +4,7 @@ package com.xxfc.platform.activity.handler; ...@@ -4,6 +4,7 @@ package com.xxfc.platform.activity.handler;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import com.xxfc.platform.activity.biz.IntegralUserRecordBiz; import com.xxfc.platform.activity.biz.IntegralUserRecordBiz;
import com.xxfc.platform.activity.config.RabbitActivityConfig;
import com.xxfc.platform.activity.vo.IntegralUserRecordDto; import com.xxfc.platform.activity.vo.IntegralUserRecordDto;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -26,7 +27,7 @@ public class IntegralMQHandler { ...@@ -26,7 +27,7 @@ public class IntegralMQHandler {
@Autowired @Autowired
IntegralUserRecordBiz integralUserRecordBiz; IntegralUserRecordBiz integralUserRecordBiz;
@RabbitListener(queues = "integral_handle_queue") @RabbitListener(queues = {RabbitActivityConfig.INTEGRAL_HANDLE_QUEUE})
public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) { public void integralHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
ExecutorService executorService = Executors.newCachedThreadPool(); ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() { executorService.execute(new Runnable() {
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO; import com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import com.xxfc.platform.activity.biz.ActivityPopularizeBiz; import com.xxfc.platform.activity.biz.ActivityPopularizeBiz;
import com.xxfc.platform.activity.biz.ActivityUserJoinBiz;
import com.xxfc.platform.activity.biz.IntegralUserRecordBiz; import com.xxfc.platform.activity.biz.IntegralUserRecordBiz;
import com.xxfc.platform.activity.config.RabbitActivityConfig; import com.xxfc.platform.activity.config.RabbitActivityConfig;
import com.xxfc.platform.activity.entity.ActivityPopularize; import com.xxfc.platform.activity.entity.ActivityPopularize;
...@@ -30,6 +31,9 @@ public class PopularizeMQHandler { ...@@ -30,6 +31,9 @@ public class PopularizeMQHandler {
@Autowired @Autowired
ActivityPopularizeBiz activityPopularizeBiz; ActivityPopularizeBiz activityPopularizeBiz;
@Autowired
ActivityUserJoinBiz activityUserJoinBiz;
//@RabbitListener(queues = {RabbitActivityConfig.POPULARZIE_REGISTER_QUEUE,RabbitActivityConfig.POPULARZIE_AUTH_QUEUE}) //@RabbitListener(queues = {RabbitActivityConfig.POPULARZIE_REGISTER_QUEUE,RabbitActivityConfig.POPULARZIE_AUTH_QUEUE})
@RabbitListener(queues = {RabbitActivityConfig.POPULARZIE_0101_QUEUE}) @RabbitListener(queues = {RabbitActivityConfig.POPULARZIE_0101_QUEUE})
public void popularizeHandler(Message message, @Headers Map<String, Object> headers, Channel channel) { public void popularizeHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
...@@ -63,6 +67,41 @@ public class PopularizeMQHandler { ...@@ -63,6 +67,41 @@ public class PopularizeMQHandler {
} }
}); });
} }
//新人注册有礼
@RabbitListener(queues = {RabbitActivityConfig.ACTIVITY_NEW_QUEUE})
public void activityNewHandler(Message message, @Headers Map<String, Object> headers, Channel channel) {
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.execute(new Runnable() {
@Override
public void run() {
try {
String messageId = message.getMessageProperties().getMessageId();
String msg = new String(message.getBody(), "UTF-8");
log.info("接收到的消息:msg = {}, 消息ID是:messageId = {} ", msg, messageId);
if (StringUtils.isNotBlank(msg)) {
RegisterQueueDTO registerQueueDTO = JSONObject.parseObject(msg, RegisterQueueDTO.class);
if(registerQueueDTO!=null&&(registerQueueDTO.getSign()==RegisterQueueDTO.SIGN_NEW||registerQueueDTO.getSign()==RegisterQueueDTO.SIGN_ACTIVATE)){
activityUserJoinBiz.joinActivity(registerQueueDTO.getAppUserId());
}
}
executorService.shutdown();
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
// 手动签收
channel.basicAck(deliveryTag, false);
} catch (Exception e) {
log.info("接收到的消息失败");
try {
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} catch (IOException i) {
i.printStackTrace();
}
e.printStackTrace();
}
}
});
}
} }
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
and u.is_use=0 and u.expire_time &lt;#{time} and u.is_use=0 and u.expire_time &lt;#{time}
</if> </if>
<if test="channel!=null and channel!=''"> <if test="channel!=null and channel!=''">
and (c.channel=#{channel} or c.channel=1 ) and (c.channel=#{channel} or c.channel=0 )
</if> </if>
<choose> <choose>
<when test="type==1"> <when test="type==1">
......
...@@ -234,5 +234,5 @@ public class BaseOrder implements Serializable { ...@@ -234,5 +234,5 @@ public class BaseOrder implements Serializable {
*/ */
@ApiModelProperty(value = "优惠券优惠的价格") @ApiModelProperty(value = "优惠券优惠的价格")
@Column(name = "coupon_amount") @Column(name = "coupon_amount")
private Integer couponAmount; private BigDecimal couponAmount;
} }
...@@ -94,6 +94,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{ ...@@ -94,6 +94,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "是否使用出租免费天数") @ApiModelProperty(value = "是否使用出租免费天数")
private Integer rentFreeDay; private Integer rentFreeDay;
/**
* 优惠券*
*/
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
public void setStartTime(Long startTime) { public void setStartTime(Long startTime) {
this.startTime = startTime; this.startTime = startTime;
this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8))); this.bookStartDate = DEFAULT_DATE_TIME_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
...@@ -70,8 +70,8 @@ public class AddTourDTO extends AddOrderCommonDTO{ ...@@ -70,8 +70,8 @@ public class AddTourDTO extends AddOrderCommonDTO{
Integer hasInsure; Integer hasInsure;
/** /**
* 优惠券ids * 优惠券*
*/ */
@ApiModelProperty(value = "优惠券ids") @ApiModelProperty(value = "优惠卷卷号")
private String couponIds; private String tickerNos;
} }
...@@ -58,6 +58,7 @@ public class OrderRentVehicleController extends CommonBaseController { ...@@ -58,6 +58,7 @@ public class OrderRentVehicleController extends CommonBaseController {
setBookEndDate(vo.getBookEndDate()); setBookEndDate(vo.getBookEndDate());
}}); }});
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData()); bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
orderRentVehicleService.createOrder(bo); orderRentVehicleService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
......
package com.xxfc.platform.order.rest; package com.xxfc.platform.order.rest;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO; import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
...@@ -28,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -28,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
@Controller @Controller
@RequestMapping("orderTour") @RequestMapping("orderTour")
@IgnoreClientToken @IgnoreClientToken
...@@ -55,6 +58,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -55,6 +58,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiOperation(value = "确认旅游订单") @ApiOperation(value = "确认旅游订单")
public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){ public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){
TourBO bo = BeanUtil.toBean(vo, TourBO.class); TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
orderTourService.createOrder(bo); orderTourService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
...@@ -70,6 +74,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -70,6 +74,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
bo.setChildNum(vo.getChildNumber()); bo.setChildNum(vo.getChildNumber());
TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData(); TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData();
bo.setTourGood(tourGood); bo.setTourGood(tourGood);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
return ObjectRestResponse.succ(orderTourService.calculatePrice(bo)); return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
} }
...@@ -96,5 +101,11 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -96,5 +101,11 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要") @ApiModelProperty(value = "是否保险标记 1--要保险;0--不需要")
Integer hasInsure; Integer hasInsure;
/**
* 优惠券*
*/
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
} }
} }
\ No newline at end of file
...@@ -142,9 +142,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -142,9 +142,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
} }
//如果有使用优惠券,则扣减 //如果有使用优惠券,则扣减
// if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) >= 0) { if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
// activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
// } }
super.handleDetail(bo); super.handleDetail(bo);
......
...@@ -138,6 +138,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -138,6 +138,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//扣減庫存 //扣減庫存
tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT); tourFeign.stock(bo.getSpePriceId(), bo.getTotalNumber(), TourFeign.STOCK_SUBTRACT);
//如果有使用优惠券,则扣减
if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) < 0) {
activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo().get(0), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
}
super.handleDetail(bo); super.handleDetail(bo);
//发送定时取消订单(30分钟) //发送定时取消订单(30分钟)
......
...@@ -22,10 +22,12 @@ public class MQServiceBiZ { ...@@ -22,10 +22,12 @@ public class MQServiceBiZ {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ObjectRestResponse sendMessage(String exchange, String routKey, String json) { public ObjectRestResponse sendMessage(String exchange, String routKey, String json) {
log.info("发送消息到消息队列:exchange = {}, routingKey = {}, json = {}", exchange, routKey, json); log.info("发送消息到消息队列:exchange = {}, routingKey = {}, json = {}", exchange, routKey, json);
log.info("开始发送消息。。。");
Message message = MessageBuilder.withBody(json.getBytes()) Message message = MessageBuilder.withBody(json.getBytes())
.setContentType(MessageProperties.CONTENT_TYPE_JSON).setContentEncoding("utf-8") .setContentType(MessageProperties.CONTENT_TYPE_JSON).setContentEncoding("utf-8")
.setMessageId(UUID.randomUUID() + "").build(); .setMessageId(UUID.randomUUID() + "").build();
rabbitTemplate.convertAndSend(exchange, routKey, message); rabbitTemplate.convertAndSend(exchange, routKey, message);
log.info("发送成功。。。");
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
} }
...@@ -148,7 +148,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -148,7 +148,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", newValue.getUserId()); jsonObject.put("userId", newValue.getUserId());
jsonObject.put("amount", newValue.getAmount()); jsonObject.put("amount", newValue.getAmount());
jsonObject.put("channelId", newValue.getOrderNo()); jsonObject.put("channelId", newValue.getId());
if(newValue.getChannel() == 1) {//租车 if(newValue.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV"); jsonObject.put("integralRuleCode", "RENTRV");
} else if(newValue.getChannel() == 2) { //旅游 } else if(newValue.getChannel() == 2) { //旅游
......
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 to comment