Commit 0d2ea255 authored by hezhen's avatar hezhen

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 2857ca2e 05dfbed8
...@@ -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,13 @@ public class RabbitActivityConfig extends RabbitCommonConfig { ...@@ -23,12 +19,13 @@ 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 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(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() {
......
package com.xxfc.platform.app.biz; package com.xxfc.platform.app.biz;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.EntityUtils; import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo; import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 系统配置表 * 系统配置表
...@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> { ...@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
*/ */
public int updateConfig(Cofig cofig) { public int updateConfig(Cofig cofig) {
EntityUtils.setUpdatedInfo(cofig); EntityUtils.setUpdatedInfo(cofig);
return mapper.updateConfig(cofig); return mapper.updateByPrimaryKeySelective(cofig);
} }
public WithDrawRuleVo getWithDrawRule(){ public WithDrawRuleVo getWithDrawRule(){
...@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> { ...@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
withDrawRuleVo.setDescription(cofig.getValue()); withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo; return withDrawRuleVo;
} }
public void updateConfigStatus(int id) {
Cofig cofig = new Cofig();
cofig.setId(id);
cofig.setIsDel(1);
mapper.updateByPrimaryKeySelective(cofig);
}
public TableResultResponse<Cofig> listWithPage(Map<String, Object> params) {
Query query = new Query(params);
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
PageDataVO<Cofig> cofigPage = PageDataVO.pageInfo(query.getPage(), query.getLimit(), () -> mapper.selectByExample(example));
return new TableResultResponse<>(cofigPage.getTotalCount(),cofigPage.getData()) ;
}
} }
\ No newline at end of file
package com.xxfc.platform.app.rest.admin; package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.app.biz.CofigBiz; import com.xxfc.platform.app.biz.CofigBiz;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import java.util.List;
import java.util.Map;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
...@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController;
public class CofigAdminController extends BaseController<CofigBiz,Cofig> { public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
@Override
public TableResultResponse<Cofig> list(@RequestParam Map<String, Object> params) {
return getBaseBiz().listWithPage(params);
}
/** /**
* 修改通用配置 * 修改通用配置
* @param cofig * @param cofig
...@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> { ...@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
} }
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
@Override
public ObjectRestResponse<Cofig> remove(@PathVariable int id) {
getBaseBiz().updateConfigStatus(id);
return ObjectRestResponse.succ();
}
} }
\ No newline at end of file
...@@ -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分钟)
......
...@@ -137,9 +137,29 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -137,9 +137,29 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
orderPay.setStatus(1); orderPay.setStatus(1);
orderPay.setSerialNumber(serialNumber); orderPay.setSerialNumber(serialNumber);
int num=mapper.updateByExampleSelective(orderPay,example); int num=mapper.updateByExampleSelective(orderPay,example);
log.error("---支付回调处理---num====="+num+"----orderNo======="+orderNo); log.error("---支付回调处理---num====="+num+"----orderNo======="+orderNo);
if(num>0){ if(num>0){
//支付成功,添加积分
OrderPay pay= list.get(0); OrderPay pay= list.get(0);
OrderPay newValue = mapper.selectOne(orderPay);
log.info("支付回调信息:newValue = {}", newValue);
if(newValue.getStatus() == 1) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", newValue.getUserId());
jsonObject.put("amount", newValue.getAmount());
jsonObject.put("channelId", newValue.getOrderNo());
if(newValue.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV");
} else if(newValue.getChannel() == 2) { //旅游
jsonObject.put("integralRuleCode", "BUYROUT");
} else if(newValue.getChannel() == 3) { //会员
jsonObject.put("integralRuleCode", "BUYMEMBER");
}
log.info("支付订单号:orderNo = {}, orderType = {}", newValue.getOrderNo(), newValue.getChannel());
log.info("支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}", MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
mqServiceBiZ.sendMessage(MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
}
if(StringUtils.isNotBlank(pay.getNotifyUrl())){ if(StringUtils.isNotBlank(pay.getNotifyUrl())){
String url=pay.getNotifyUrl(); String url=pay.getNotifyUrl();
Integer type=pay.getType()==null?1:pay.getType(); Integer type=pay.getType()==null?1:pay.getType();
...@@ -152,23 +172,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -152,23 +172,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
result= HTTPUtils.doGet(url); result= HTTPUtils.doGet(url);
} }
log.error("---支付回调处理---orderNo======="+orderNo+"---result==="+result); log.error("---支付回调处理---orderNo======="+orderNo+"---result==="+result);
//支付成功,添加积分
if(pay.getStatus() == 1) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", pay.getUserId());
jsonObject.put("amount", pay.getAmount());
jsonObject.put("channelId", pay.getOrderNo());
if(pay.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV");
} else if(pay.getChannel() == 2) { //旅游
jsonObject.put("integralRuleCode", "BUYROUT");
} else if(pay.getChannel() == 3) { //会员
jsonObject.put("integralRuleCode", "BUYMEMBER");
}
log.info("支付订单号:orderNo = {}, orderType = {}", pay.getOrderNo(), pay.getChannel());
log.info("支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}", MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
mqServiceBiZ.sendMessage(MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
}
} }
} }
} }
......
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