Commit 25d8190c authored by libin's avatar libin

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

parents 868a72e0 f67abe0d
...@@ -51,8 +51,14 @@ public abstract class RabbitCommonConfig { ...@@ -51,8 +51,14 @@ public abstract class RabbitCommonConfig {
if(null != myQueue) { if(null != myQueue) {
myQueue.forEach(en -> { myQueue.forEach(en -> {
registerBean(StrUtil.toCamelCase(en.getQueue()), Queue.class, en.getQueue(), Boolean.TRUE); //避免一个队列绑定多个exchange+key 时 再次创建queueBean
registerBean(StrUtil.toCamelCase(en.getQueue())+ "Binding", Binding.class, en.getQueue(), Binding.DestinationType.QUEUE, en.getExchange(), en.getKey(), Collections.EMPTY_MAP); try {
Queue queue = applicationContext.getBean(StrUtil.toCamelCase(en.getQueue()), Queue.class);
}catch (Exception e) {
registerBean(StrUtil.toCamelCase(en.getQueue()), Queue.class, en.getQueue(), Boolean.TRUE);
}
String bindName = StrUtil.toCamelCase(en.getQueue())+ "Binding"+ en.getExchange()+ "_"+ en.getKey();
registerBean(bindName, Binding.class, en.getQueue(), Binding.DestinationType.QUEUE, en.getExchange(), en.getKey(), Collections.EMPTY_MAP);
}); });
} }
} }
......
...@@ -76,6 +76,15 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel ...@@ -76,6 +76,15 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
} }
} }
} }
//永久稳定关系
public void foreverBind(Integer user_id ){
AppUserRelation relation=getMyBiz().getRelationByUserId(user_id);
if(relation!=null&&relation.getIsForever()==0){
relation.setIsForever(1);
getMyBiz().updRelation(relation);
}
}
/** /**
* 小程序分享上下线绑定 * 小程序分享上下线绑定
......
...@@ -22,9 +22,14 @@ import java.util.Map; ...@@ -22,9 +22,14 @@ import java.util.Map;
public class RabbitAdminConfig extends RabbitCommonConfig { public class RabbitAdminConfig extends RabbitCommonConfig {
public static final String ORDER_WATER_QUEUE = "order.water.queue"; public static final String ORDER_WATER_QUEUE = "order.water.queue";
public static final String ORDER_FINLISH_user_re_QUEUE = "order.cancel.userRe.queue";
static { static {
myQueue = new ArrayList<BindDTO>(){{ myQueue = new ArrayList<BindDTO>(){{
add(new BindDTO(ORDER_WATER_QUEUE, RabbitConstant.ADMIN_TOPIC, "order.#")); add(new BindDTO(ORDER_WATER_QUEUE, RabbitConstant.ADMIN_TOPIC, "order.pay"));
add(new BindDTO(ORDER_WATER_QUEUE, RabbitConstant.ADMIN_TOPIC, "order.finlish"));
add(new BindDTO(ORDER_WATER_QUEUE, RabbitConstant.ADMIN_TOPIC, "order.cancel"));
add(new BindDTO(ORDER_FINLISH_user_re_QUEUE, RabbitConstant.ADMIN_TOPIC, "order.finlish"));
}}; }};
} }
} }
......
...@@ -10,16 +10,19 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; ...@@ -10,16 +10,19 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import static com.github.wxiaoqi.security.admin.config.RabbitAdminConfig.*;
@Component @Component
@Slf4j @Slf4j
public class IntegralMQHandler { public class IntegralMQHandler {
@Autowired @Autowired
AppUserSellingWaterBiz waterBiz; AppUserSellingWaterBiz waterBiz;
@RabbitListener(queues = RabbitAdminConfig.ORDER_WATER_QUEUE) @RabbitListener(queues = ORDER_WATER_QUEUE)
public void integralHandler(String json) { public void integralHandler(String json) {
log.info("接收到的消息:json = {}", json); log.info("接收到的消息:json = {}", json);
try{ try{
OrderWaterDTO orderWaterDTO = JSONObject.parseObject(json, OrderWaterDTO.class); OrderWaterDTO orderWaterDTO = JSONObject.parseObject(json, OrderWaterDTO.class);
waterBiz.orderWater(orderWaterDTO); waterBiz.orderWater(orderWaterDTO);
}catch (Exception e){ }catch (Exception e){
...@@ -28,4 +31,19 @@ public class IntegralMQHandler { ...@@ -28,4 +31,19 @@ public class IntegralMQHandler {
} }
} }
@RabbitListener(queues = {ORDER_FINLISH_user_re_QUEUE})
public void integralHandler2(String json) {
log.info("接收到的消息:json = {}", json);
try{
OrderWaterDTO orderWaterDTO = JSONObject.parseObject(json, OrderWaterDTO.class);
waterBiz.orderWater(orderWaterDTO);
}catch (Exception e){
log.info("接收到的消息失败");
e.printStackTrace();
}
}
} }
...@@ -70,7 +70,7 @@ public class AppPermissionService { ...@@ -70,7 +70,7 @@ public class AppPermissionService {
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
@Autowired @Autowired
private MQSenderFeign mqSenderFeign; MQSenderFeign mqSenderFeign;
@Autowired @Autowired
ImFeign imFeign; ImFeign imFeign;
...@@ -287,7 +287,7 @@ public class AppPermissionService { ...@@ -287,7 +287,7 @@ public class AppPermissionService {
rsUserDetail.setCode(UUIDUtils.genCodes(8)); rsUserDetail.setCode(UUIDUtils.genCodes(8));
appUserDetailBiz.insertSelective(rsUserDetail); appUserDetailBiz.insertSelective(rsUserDetail);
log.error("注册:新增用户详情: " + userid); log.error("注册:新增用户详情: " + userid);
/*//绑定上下线关系 /* //绑定上下线关系
if(parentId!=null&&parentId>0){ if(parentId!=null&&parentId>0){
relationBiz.bindRelation(userid,parentId,1); relationBiz.bindRelation(userid,parentId,1);
}*/ }*/
...@@ -329,7 +329,7 @@ public class AppPermissionService { ...@@ -329,7 +329,7 @@ public class AppPermissionService {
} }
} }
private void sendQueue(String username, String password, String headimgurl, String nickname, String mobilecode, String openId, String unionid, Integer type, String code, String activityCode, Integer userid, Integer sign) { private void sendQueue(String username, String password, String headimgurl, String nickname, String mobilecode, String openId, String unionid, Integer type, String code, String activityCode, Integer userid,Integer sign) {
try { try {
RegisterQueueDTO registerQueueDTO = new RegisterQueueDTO(); RegisterQueueDTO registerQueueDTO = new RegisterQueueDTO();
//出参 //出参
...@@ -380,7 +380,7 @@ public class AppPermissionService { ...@@ -380,7 +380,7 @@ public class AppPermissionService {
String code1=null; String code1=null;
String activityCode=null; String activityCode=null;
if (StringUtils.isNotBlank(code)){ if (StringUtils.isNotBlank(code)){
//判断处理活动关键字 //判断处理活动关键字
String[] codes = code.split("_"); String[] codes = code.split("_");
if(codes.length > 1) { if(codes.length > 1) {
code1 = codes[0]; code1 = codes[0];
...@@ -388,7 +388,7 @@ public class AppPermissionService { ...@@ -388,7 +388,7 @@ public class AppPermissionService {
} }
} }
if (StringUtils.isNotBlank(code1)){ if (StringUtils.isNotBlank(code1)){
Integer parentId=appUserDetailBiz.getUserByCode(code1); Integer parentId=appUserDetailBiz.getUserByCode(code1);
//绑定上下线关系 //绑定上下线关系
if(parentId!=null&&parentId>0) { if(parentId!=null&&parentId>0) {
relationBiz.bindRelation(userid, parentId, 1); relationBiz.bindRelation(userid, parentId, 1);
...@@ -409,7 +409,6 @@ public class AppPermissionService { ...@@ -409,7 +409,6 @@ public class AppPermissionService {
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz; ...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.ActivityRule; import com.xxfc.platform.activity.entity.ActivityRule;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -53,11 +55,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -53,11 +55,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
} }
//领取优惠卷 //领取优惠卷
public void receiveCoupn(Integer userId) { public ObjectRestResponse receiveCoupn(Integer userId) {
ActivityRule rule = ruleBiz.getActity(); ActivityRule rule = ruleBiz.getActity();
if (rule == null) { if (rule == null) {
log.error("----没有开启的活动----"); log.error("----没有开启的活动----");
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"没有开启的活动");
} }
Integer activityId = rule.getId(); Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin(); ActivityUserJoin userJoin = new ActivityUserJoin();
...@@ -66,11 +68,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -66,11 +68,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
userJoin= selectOne(userJoin); userJoin= selectOne(userJoin);
if (userJoin == null ) { if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId); log.error("----用户没有此参与活动----userId====" + userId);
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"不是新用户,无法参与此活动");
} }
if(userJoin.getStatus()!=0){ if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId); log.error("----用户已领取----userId====" + userId);
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"用户已领取");
} }
String value=rule.getValue(); String value=rule.getValue();
JSONObject json=JSONObject.parseObject(value); JSONObject json=JSONObject.parseObject(value);
...@@ -88,6 +90,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -88,6 +90,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
} }
userJoin.setStatus(1); userJoin.setStatus(1);
updateById(userJoin); updateById(userJoin);
return ObjectRestResponse.succ();
} }
......
...@@ -148,6 +148,9 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -148,6 +148,9 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
//支付后更新优惠卷状态 //支付后更新优惠卷状态
public BigDecimal useTickerNo(Integer userId, String TickerNo, String orderNo,Integer channel,BigDecimal amout,Integer type){ public BigDecimal useTickerNo(Integer userId, String TickerNo, String orderNo,Integer channel,BigDecimal amout,Integer type){
BigDecimal couponAmout=new BigDecimal("0.00"); BigDecimal couponAmout=new BigDecimal("0.00");
if(couponAmout.compareTo(amout) >= 0) {
return BigDecimal.ZERO;
}
if (userId==null||userId==0||StringUtils.isBlank(TickerNo)){ if (userId==null||userId==0||StringUtils.isBlank(TickerNo)){
log.error("----参数不能为空"); log.error("----参数不能为空");
return couponAmout; return couponAmout;
...@@ -183,10 +186,13 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -183,10 +186,13 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
Integer type = coupon.getType(); Integer type = coupon.getType();
if (type != null) { if (type != null) {
BigDecimal useAmout = coupon.getUsedAmount(); BigDecimal useAmout = coupon.getUsedAmount();
if (amout.compareTo(useAmout) > 0) {
if (type == 3 || (type == 1 && (amout.compareTo(coupon.getWithAmount()) >= 0))) { if (type == 3 || (type == 1 && (amout.compareTo(coupon.getWithAmount()) >= 0))) {
//couponAmout = amout.subtract(useAmout); //couponAmout = amout.subtract(useAmout);
couponAmout=useAmout; if (amout.compareTo(useAmout) > 0) {
couponAmout= useAmout;
}else {
couponAmout= amout;
} }
} }
} }
......
...@@ -22,16 +22,13 @@ import java.util.ArrayList; ...@@ -22,16 +22,13 @@ import java.util.ArrayList;
public class RabbitActivityConfig extends RabbitCommonConfig { 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_REGISTER_QUEUE = "popularzie.register.queue";
// public static final String POPULARZIE_AUTH_QUEUE = "popularzie.auth.queue";
public static final String POPULARZIE_0101_QUEUE = "popularzie.0101.queue"; public static final String POPULARZIE_0101_QUEUE = "popularzie.0101.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.#")); add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register"));
// add(new BindDTO(POPULARZIE_REGISTER_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.register")); add(new BindDTO(POPULARZIE_0101_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.auth"));
// add(new BindDTO(POPULARZIE_AUTH_QUEUE, RabbitConstant.ADMIN_TOPIC, "appUser.login"));
}}; }};
} }
......
...@@ -82,8 +82,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -82,8 +82,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
if (userId == null) { if (userId == null) {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
joinBiz.receiveCoupn(userId); return joinBiz.receiveCoupn(userId);
return ObjectRestResponse.succ();
} }
......
...@@ -45,7 +45,10 @@ public class MsgBiz { ...@@ -45,7 +45,10 @@ public class MsgBiz {
public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type) throws Exception { public ObjectRestResponse getMsgList(Integer page, Integer limit, Integer type) throws Exception {
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null;
if(appUserDTO != null) {
userId = appUserDTO.getImUserid();
}
log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit, type); log.info("获取消息列表: page = {}, limit = {}, type = {}", page, limit, type);
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
...@@ -54,12 +57,7 @@ public class MsgBiz { ...@@ -54,12 +57,7 @@ public class MsgBiz {
List<Msg> msgList = null; List<Msg> msgList = null;
if (type != null) { if (type != null) {
query = new Query(Criteria.where("body.type").is(type)); query = new Query(Criteria.where("body.type").is(type));
if (appUserDTO != null) { msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo);
}
msgList = mongoTemplate.find(query, Msg.class, "s_msg");
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
...@@ -67,12 +65,7 @@ public class MsgBiz { ...@@ -67,12 +65,7 @@ public class MsgBiz {
ids.add(2); ids.add(2);
ids.add(4); ids.add(4);
query = new Query(Criteria.where("body.type").in(ids)); query = new Query(Criteria.where("body.type").in(ids));
if (appUserDTO != null) { msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo);
}
msgList = mongoTemplate.find(query, Msg.class, "s_msg");
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} }
...@@ -97,21 +90,15 @@ public class MsgBiz { ...@@ -97,21 +90,15 @@ public class MsgBiz {
public ObjectRestResponse get(String id){ public ObjectRestResponse get(String id){
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
if (appUserDTO == null) { Integer userId = null;
appUserDTO = new AppUserDTO(); if(appUserDTO != null) {
userId = appUserDTO.getImUserid();
} }
if(id == null) { if(id == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
List<Msg> msgList = null;
Query query = new Query(Criteria.where("id").is(new ObjectId(id))); Query query = new Query(Criteria.where("id").is(new ObjectId(id)));
if (appUserDTO != null) { List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), appUserDTO.getImUserid());
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
return ObjectRestResponse.succ(goodPageInfo);
}
msgList = mongoTemplate.find(query, Msg.class, "s_msg");
List<MsgVo> msgVoList = replaceMsgResult(msgList); List<MsgVo> msgVoList = replaceMsgResult(msgList);
if(msgVoList.size() > 0) { if(msgVoList.size() > 0) {
return ObjectRestResponse.succ(msgVoList.get(0)); return ObjectRestResponse.succ(msgVoList.get(0));
...@@ -136,9 +123,13 @@ public class MsgBiz { ...@@ -136,9 +123,13 @@ public class MsgBiz {
//添加点赞 //添加点赞
List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise"); List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise");
msg.setPraises(replacePraiseResult(praise)); msg.setPraises(replacePraiseResult(praise));
if(userId != null) {
msg.setIsPraise(this.exists(userId, msg.getId()) ? 1 : 0); msg.setIsPraise(this.exists(userId, msg.getId()) ? 1 : 0);
msg.setIsCollect(this.existsCollect(userId, msg.getId()) ? 1 : 0); msg.setIsCollect(this.existsCollect(userId, msg.getId()) ? 1 : 0);
} else {
msg.setIsPraise(0);
msg.setIsCollect(0);
}
} }
return list; return list;
} }
......
...@@ -33,4 +33,6 @@ public class RentVehiclePriceVO extends OrderPriceVO{ ...@@ -33,4 +33,6 @@ public class RentVehiclePriceVO extends OrderPriceVO{
BigDecimal damageSafePrice; BigDecimal damageSafePrice;
@ApiModelProperty(value = "费用详情") @ApiModelProperty(value = "费用详情")
private String costDetail; private String costDetail;
@ApiModelProperty(value = "优惠券扣除的费用")
private BigDecimal couponAmount;
} }
...@@ -53,4 +53,8 @@ public class TourPriceVO extends OrderPriceVO{ ...@@ -53,4 +53,8 @@ public class TourPriceVO extends OrderPriceVO{
//总人数 //总人数
@ApiModelProperty(value = "总人数") @ApiModelProperty(value = "总人数")
private Integer totalNumber; private Integer totalNumber;
//优惠券
@ApiModelProperty(value = "优惠券扣除的费用")
private BigDecimal couponAmount;
} }
...@@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.persistence.Column; import javax.persistence.Column;
import java.util.Arrays;
import java.util.List;
@Controller @Controller
@RequestMapping("orderRentVehicle") @RequestMapping("orderRentVehicle")
...@@ -79,6 +81,7 @@ public class OrderRentVehicleController extends CommonBaseController { ...@@ -79,6 +81,7 @@ public class OrderRentVehicleController extends CommonBaseController {
setHasMemberRight(vo.getHasMemberRight()); setHasMemberRight(vo.getHasMemberRight());
}}); }});
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.initDetailSecond(bo); orderRentVehicleService.initDetailSecond(bo);
return ObjectRestResponse.succ(orderRentVehicleService.calculatePrice(bo)); return ObjectRestResponse.succ(orderRentVehicleService.calculatePrice(bo));
} }
...@@ -117,5 +120,11 @@ public class OrderRentVehicleController extends CommonBaseController { ...@@ -117,5 +120,11 @@ public class OrderRentVehicleController extends CommonBaseController {
*/ */
@ApiModelProperty(value = "是否使用出租免费天数") @ApiModelProperty(value = "是否使用出租免费天数")
private Integer rentFreeDay; private Integer rentFreeDay;
/**
* 优惠券*
*/
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
} }
} }
\ No newline at end of file
...@@ -141,6 +141,11 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -141,6 +141,11 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
} }
} }
//如果有使用优惠券,则扣减
// if(BigDecimal.ZERO.compareTo(bo.getOrder().getCouponAmount()) >= 0) {
//
// }
super.handleDetail(bo); super.handleDetail(bo);
//发送定时取消订单(数据字典设置--5分钟) //发送定时取消订单(数据字典设置--5分钟)
...@@ -156,6 +161,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -156,6 +161,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Override @Override
public RentVehiclePriceVO calculatePrice(RentVehicleBO detail) { public RentVehiclePriceVO calculatePrice(RentVehicleBO detail) {
BigDecimal realAmount = BigDecimal.ZERO;
BigDecimal orderAmount = BigDecimal.ZERO; BigDecimal orderAmount = BigDecimal.ZERO;
BigDecimal goodsAmount = BigDecimal.ZERO; BigDecimal goodsAmount = BigDecimal.ZERO;
BigDecimal vehicleAmount = BigDecimal.ZERO; BigDecimal vehicleAmount = BigDecimal.ZERO;
...@@ -243,6 +249,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -243,6 +249,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//总价格(包含押金) //总价格(包含押金)
orderAmount = orderAmount.add(goodsAmount).add(vehicleModel.getDeposit()); orderAmount = orderAmount.add(goodsAmount).add(vehicleModel.getDeposit());
realAmount = orderAmount.subtract(couponAmount);
//生成订单明细 //生成订单明细
RentVehiclePriceVO rvp = new RentVehiclePriceVO(){{ RentVehiclePriceVO rvp = new RentVehiclePriceVO(){{
...@@ -254,9 +261,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -254,9 +261,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
setVehicleNum(1); setVehicleNum(1);
setDriverNum(1); setDriverNum(1);
}}; }};
rvp.setCouponAmount(couponAmount);
rvp.setOrderAmount(orderAmount); rvp.setOrderAmount(orderAmount);
rvp.setGoodsAmount(goodsAmount); rvp.setGoodsAmount(goodsAmount);
rvp.setRealAmount(orderAmount); rvp.setRealAmount(realAmount);
rvp.setDriverAmount(driverAmount); rvp.setDriverAmount(driverAmount);
rvp.setVehicleAmount(vehicleAmount); rvp.setVehicleAmount(vehicleAmount);
rvp.setDamageSafeAmount(damageSafeAmount); rvp.setDamageSafeAmount(damageSafeAmount);
......
...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException; ...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.OrderCostDetailBiz; import com.xxfc.platform.order.biz.OrderCostDetailBiz;
import com.xxfc.platform.order.biz.OrderTemplateBiz; import com.xxfc.platform.order.biz.OrderTemplateBiz;
import com.xxfc.platform.order.biz.OrderTourDetailBiz; import com.xxfc.platform.order.biz.OrderTourDetailBiz;
...@@ -78,6 +79,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -78,6 +79,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Autowired @Autowired
ThirdFeign thirdFeign; ThirdFeign thirdFeign;
@Autowired
ActivityFeign activityFeign;
@Autowired @Autowired
public HttpServletRequest request; public HttpServletRequest request;
...@@ -149,12 +153,16 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -149,12 +153,16 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Override @Override
public TourPriceVO calculatePrice(TourBO detail) { public TourPriceVO calculatePrice(TourBO detail) {
BigDecimal realAmount = BigDecimal.ZERO;
BigDecimal orderAmount = BigDecimal.ZERO; BigDecimal orderAmount = BigDecimal.ZERO;
BigDecimal goodsAmount = BigDecimal.ZERO; BigDecimal goodsAmount = BigDecimal.ZERO;
BigDecimal tourAmount = BigDecimal.ZERO; BigDecimal tourAmount = BigDecimal.ZERO;
BigDecimal realAmount = BigDecimal.ZERO; BigDecimal couponAmount = BigDecimal.ZERO;
BigDecimal insureAmount = BigDecimal.ZERO; BigDecimal insureAmount = BigDecimal.ZERO;
//当前用户
AppUserDTO dto = detail.getAppUserDTO();
if(StrUtil.isNotBlank(detail.getTourUserIds())) { if(StrUtil.isNotBlank(detail.getTourUserIds())) {
List<TourUser> users = new ArrayList<TourUser>(); List<TourUser> users = new ArrayList<TourUser>();
if(StrUtil.isNotBlank(detail.getTourUserIds())) { if(StrUtil.isNotBlank(detail.getTourUserIds())) {
...@@ -198,6 +206,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -198,6 +206,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//优惠券处理 //优惠券处理
//待完成 //待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) {
couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo().get(0), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
}
//总价 //总价
tourAmount = tourAmount.add(tourSpePriceVo.getTotalPrice()).add(tourSpePriceVo.getTotalChildPrice()); tourAmount = tourAmount.add(tourSpePriceVo.getTotalPrice()).add(tourSpePriceVo.getTotalChildPrice());
...@@ -205,11 +216,14 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -205,11 +216,14 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
goodsAmount = goodsAmount.add(tourAmount); goodsAmount = goodsAmount.add(tourAmount);
//总价格 //总价格
orderAmount = orderAmount.add(goodsAmount).add(insureAmount); orderAmount = orderAmount.add(goodsAmount).add(insureAmount);
//真实价格 //真实价格
realAmount = realAmount.add(tourSpePriceVo.getRealPrice()).add(tourSpePriceVo.getRealChildPrice()).add(insureAmount); realAmount = realAmount.add(tourSpePriceVo.getRealPrice()).add(tourSpePriceVo.getRealChildPrice()).add(insureAmount).subtract(couponAmount);
//生成订单明细 //生成订单明细
TourPriceVO tpv = BeanUtil.toBean(tourSpePriceVo, TourPriceVO.class); TourPriceVO tpv = BeanUtil.toBean(tourSpePriceVo, TourPriceVO.class);
tpv.setCouponAmount(couponAmount);
tpv.setOrderAmount(orderAmount); tpv.setOrderAmount(orderAmount);
tpv.setGoodsAmount(goodsAmount); tpv.setGoodsAmount(goodsAmount);
tpv.setRealAmount(realAmount); tpv.setRealAmount(realAmount);
......
...@@ -28,6 +28,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -28,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
...@@ -60,6 +61,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -60,6 +61,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
@Autowired @Autowired
MQServiceBiZ mqServiceBiZ; MQServiceBiZ mqServiceBiZ;
@Value("${universal.url}")
String weixinHost;
public JSONObject preparepay( OrderPayVo orderPayVo) { public JSONObject preparepay( OrderPayVo orderPayVo) {
if(null == orderPayVo) { if(null == orderPayVo) {
...@@ -89,7 +92,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -89,7 +92,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
} }
Integer type=orderPayVo.getType(); Integer type=orderPayVo.getType();
String jsParam=""; String jsParam="";
String notify_url="https://"+ SystemConfig.weixinHost+"/api/universal/pay/app/unauth/notify"; String notify_url=weixinHost+"/api/universal/pay/app/unauth/notify";
log.info("报名费回调路径notify_url:"+notify_url);
if(type!=null&&type==2){ if(type!=null&&type==2){
jsParam=WXPay.webPay( amount+"",orderPayVo.getBody(),notify_url,trade_no,orderPayVo.getBuyerIp(), orderPayVo.getBuyerAccount()); jsParam=WXPay.webPay( amount+"",orderPayVo.getBody(),notify_url,trade_no,orderPayVo.getBuyerIp(), orderPayVo.getBuyerAccount());
}else { }else {
...@@ -133,8 +137,26 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -133,8 +137,26 @@ 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){
//支付成功,添加积分
if(orderPay.getStatus() == 1) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", orderPay.getUserId());
jsonObject.put("amount", orderPay.getAmount());
jsonObject.put("channelId", orderPay.getOrderNo());
if(orderPay.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV");
} else if(orderPay.getChannel() == 2) { //旅游
jsonObject.put("integralRuleCode", "BUYROUT");
} else if(orderPay.getChannel() == 3) { //会员
jsonObject.put("integralRuleCode", "BUYMEMBER");
}
log.info("支付订单号:orderNo = {}, orderType = {}", orderPay.getOrderNo(), orderPay.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());
}
OrderPay pay= list.get(0); OrderPay pay= list.get(0);
if(StringUtils.isNotBlank(pay.getNotifyUrl())){ if(StringUtils.isNotBlank(pay.getNotifyUrl())){
String url=pay.getNotifyUrl(); String url=pay.getNotifyUrl();
...@@ -148,21 +170,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> { ...@@ -148,21 +170,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");
}
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