Commit 5741e09e authored by jiaorz's avatar jiaorz

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

# Conflicts:
#	ace-common/src/main/java/com/github/wxiaoqi/security/common/config/rabbit/RabbitConstant.java
#	xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/config/RabbitActivityConfig.java
parents 36307334 5514e644
......@@ -82,7 +82,7 @@ public class AppUserVo {
@ApiModelProperty(value = "邀请人id:")
private Integer inviterAccount;
@ApiModelProperty(value = "1-新人用户;2-未激活;3-激活:")
@ApiModelProperty(value = "1-未激活;2-激活:")
private Integer state;
}
......@@ -49,4 +49,6 @@ public class WalletDetailAdminVo {
@ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime;
private String sourceName;
}
......@@ -30,6 +30,9 @@ public class WalletPageVo {
@ApiModelProperty(value = "已提现金额")
private BigDecimal withdrawals;
@ApiModelProperty("提现中的金额")
private BigDecimal withdrawaling;
@ApiModelProperty(value = "总消费")
private BigDecimal totalConsumption;
......
......@@ -33,6 +33,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
@Autowired
private MyWalletDetailBiz myWalletDetailBiz;
@Autowired
private MyWalletCathBiz myWalletCathBiz;
public AppletWalletVo findMyWallet(Integer userId) {
AppletWalletVo appletWalletVo = new AppletWalletVo();
......@@ -56,6 +59,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
return walletPageVo;
}
List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList());
Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds);
Map<Integer,BigDecimal> userIdAndWithdrawalingMap = myWalletCathBiz.findUserIdAndWithdrawalingMapByUserIds(userIds);
List<WalletPageVo> walletPageVos = new ArrayList<>();
WalletPageVo walletpg ;
for (WalletListDTO wallet : wallets) {
......@@ -63,16 +70,16 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
BeanUtils.copyProperties(wallet,walletpg);
walletpg.setUsername(StringUtils.isEmpty(wallet.getRealname())?wallet.getNickname():wallet.getRealname());
walletpg.setPhone(wallet.getUsername());
BigDecimal totalConsumpution = userIdAndTotalConsumptionMap==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndTotalConsumptionMap.get(wallet.getUserId());
BigDecimal withDrawaling = userIdAndWithdrawalingMap==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId())==null?new BigDecimal(0):userIdAndWithdrawalingMap.get(wallet.getUserId());
walletpg.setWithdrawaling(withDrawaling);
walletpg.setTotalConsumption(totalConsumpution);
walletPageVos.add(walletpg);
}
List<Integer> userIds = wallets.stream().map(WalletListDTO::getUserId).collect(Collectors.toList());
Map<Integer, BigDecimal> userIdAndTotalConsumptionMap = myWalletDetailBiz.finduserIdAndPersonalTotalConsumptionMapByUserIds(userIds);
Optional.ofNullable(userIdAndTotalConsumptionMap).ifPresent(x->{
for (WalletPageVo wtpg : walletPageVos) {
wtpg.setTotalConsumption(x.get(wtpg.getUserId()));
}
});
walletPageVos.sort(Comparator.comparing(WalletPageVo::getTotalAmount).reversed());
walletPageVo.setPageNum(walletFindDTO.getPage());
walletPageVo.setPageSize(walletFindDTO.getLimit());
......
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
......@@ -10,6 +11,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import com.github.wxiaoqi.security.admin.vo.WalletCathVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Maps;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -19,6 +21,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author libin
......@@ -84,7 +87,6 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
PageDataVO<WalletCathAdminVo> walletCathAdminVoPage = new PageDataVO<>();
// List<WalletCathListDTO> walletCathListDTOS = mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUserName(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState());
PageDataVO<WalletCathListDTO> walletCathListDTOPage = PageDataVO.pageInfo(walletCathFindDTO.getPage(),
walletCathFindDTO.getLimit(),
() -> mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUsername(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState()));
......@@ -112,4 +114,9 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
return walletCathAdminVoPage;
}
public Map<Integer, BigDecimal> findUserIdAndWithdrawalingMapByUserIds(List<Integer> userIds) {
List<PersonalConsumptionDTO> personalConsumptions = mapper.findUserWithDrawingByUserIds(userIds);
Map<Integer, BigDecimal> userIdAndPersonalConsumptionMap = personalConsumptions.stream().collect(Collectors.toMap(PersonalConsumptionDTO::getUserId, PersonalConsumptionDTO::getTotalConsumption));
return userIdAndPersonalConsumptionMap;
}
}
......@@ -14,6 +14,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
......@@ -73,13 +74,15 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
return pageDataVO;
}
List<WalletDetailAdminVo> walletDetailAdminVos = new ArrayList<>();
WalletDetailAdminVo walletDetailAdminVo;
for (WalletDetailListDTO detailListDTO : detailListDTOS) {
walletDetailAdminVo = new WalletDetailAdminVo();
BeanUtils.copyProperties(detailListDTO,walletDetailAdminVo);
walletDetailAdminVo.setUsername(StringUtils.isEmpty(detailListDTO.getRealname())?detailListDTO.getNickname():detailListDTO.getRealname());
walletDetailAdminVos.add(walletDetailAdminVo);
walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle());
}
pageDataVO.setPageNum(walletDetailFindDTO.getPage());
pageDataVO.setPageSize(walletDetailFindDTO.getLimit());
......
......@@ -3,15 +3,11 @@ package com.github.wxiaoqi.security.admin.config;
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.RabbitConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
......@@ -23,13 +19,13 @@ public class RabbitAdminConfig extends RabbitCommonConfig {
public static final String ORDER_WATER_QUEUE = "order.water.queue";
public static final String ORDER_FINLISH_user_re_QUEUE = "order.cancel.userRe.queue";
public static final String ORDER_FINLISH_USER_RE_QUEUE = "order.cancel.userRe.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
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"));
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_PAY));
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_FINLISH));
add(new BindDTO(ORDER_WATER_QUEUE, ADMIN_TOPIC, KEY_ORDER_CANCEL));
add(new BindDTO(ORDER_FINLISH_USER_RE_QUEUE, ADMIN_TOPIC, KEY_ORDER_FINLISH));
}};
}
}
......
......@@ -32,7 +32,7 @@ public class IntegralMQHandler {
}
@RabbitListener(queues = {ORDER_FINLISH_user_re_QUEUE})
@RabbitListener(queues = {ORDER_FINLISH_USER_RE_QUEUE})
public void integralHandler2(String json) {
log.info("接收到的消息:json = {}", json);
try{
......
......@@ -12,7 +12,7 @@ import java.util.List;
public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
//查询用户信息
public AppUserVo getUserInfo(@Param("userId") Integer userId);
AppUserVo getUserInfo(@Param("userId") Integer userId);
List<AppUserManageVo> selectAppUserManage(AppUserManageDTO appUserManageDTO);
......
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import org.apache.ibatis.annotations.Param;
......@@ -20,4 +21,5 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
@Param("phone") String phone,
@Param("state") Integer state);
List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds);
}
......@@ -50,7 +50,7 @@ import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.KEY_REGISTER_SUCCESS;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* @author keliii
......@@ -340,7 +340,14 @@ public class AppPermissionService {
registerQueueDTO.setInParamDTO(new RegisterParamDTO(username, password, headimgurl,
nickname, mobilecode, openId, unionid, type, code, activityCode));
// 注册成功,发送队列
mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, KEY_REGISTER_SUCCESS, JSONUtil.toJsonStr(registerQueueDTO));
switch (sign){
case 1 :
mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, KEY_APPUSER_REGISTER, JSONUtil.toJsonStr(registerQueueDTO));
case 2 :
mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, KEY_APPUSER_AUTH, JSONUtil.toJsonStr(registerQueueDTO));
default:
break;
}
}catch (Exception e){
log.error(e.getMessage(), e);
}
......@@ -387,15 +394,17 @@ public class AppPermissionService {
activityCode = codes[1];
}
}
if (StringUtils.isNotBlank(code1)){
Integer parentId=appUserDetailBiz.getUserByCode(code1);
Integer parentId=0;
if (StringUtils.isNotBlank(code1)) {
parentId = appUserDetailBiz.getUserByCode(code1);
//绑定上下线关系
if(parentId!=null&&parentId>0) {
if (parentId != null && parentId > 0) {
relationBiz.bindRelation(userid, parentId, 1);
}
}
//活动消息
Integer state=userVo.getState();
if(state!=null&&state==1&&StringUtils.isNotBlank(activityCode)){
if(state!=null&&state==1){
if(userVo.getInviterAccount()==null||userVo.getInviterAccount()==0){
userVo.setInviterAccount(parentId);
}
......@@ -403,9 +412,6 @@ public class AppPermissionService {
appUserDetailBiz.updUuserInfoById(userVo);
sendQueue(username,null, headimgurl, nickname, null, null, null, null, code1, activityCode, userid,RegisterQueueDTO.SIGN_ACTIVATE);
}
}
}catch (Exception e){
e.printStackTrace();
}
......
......@@ -30,6 +30,7 @@
<result column="source" property="source"/>
<result column="code" property="code"/>
<result column="invitera_ccount" property="inviterAccount"/>
<result column="state" property="state"/>
</resultMap>
......
......@@ -26,4 +26,12 @@
WHERE nickname =#{userName} OR realname =#{userName}
</if> ) AS `aud` ON aud.userid = aul.id
</select>
<select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` from `my_wallet_cath` where `stauts`=0 AND `user_id` in
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
GROUP BY `user_id`
</select>
</mapper>
\ No newline at end of file
......@@ -11,7 +11,8 @@
wd.itype,
wd.activity_id AS `activityId`,
wd.activity_name AS `activityName`,
aul.username,
wd.crt_time AS `crtTime`,
aul.username AS `phone`,
aud.nickname,
aud.realname,
ausw.price,
......@@ -19,7 +20,7 @@
ausw.waiting,
ausw.title
FROM
(select id,user_id,source,amount,cono,itype,activity_id,activity_name FROM `my_wallet_detail` <if test="sourceType != null">
(select id,user_id,source,amount,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail` <if test="sourceType != null">
WHERE `source`=#{sourceType}
</if>) AS `wd`
LEFT JOIN (SELECT id,username FROM `app_user_login`<if test="phone != null and phone != ''">
......
......@@ -121,11 +121,11 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
if(amout.compareTo(new BigDecimal("0.00"))>0&&list.size()>0){
for (UserCouponVo couponVo:list){
Integer status=2;
if(couponVo.getChannel()==1){
if(couponVo.getType()==1){
if (amout.compareTo(couponVo.getWithAmount())>=0){
status=1;
}
}else if (couponVo.getChannel()==3){
}else if (couponVo.getType()==3){
status=1;
}
......
......@@ -11,6 +11,7 @@ import lombok.Data;
@Data
public class BannerVo {
private String title;
/**
* 封面地址
......
......@@ -38,7 +38,8 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo();
bannerVo.setCover(banner.getCover());
banner.setUrl(banner.getUrl());
bannerVo.setUrl(banner.getUrl());
bannerVo.setTitle(banner.getTitle());
bannerVos.add(bannerVo);
});
return bannerVos;
......
......@@ -59,12 +59,12 @@ public class BaseOrder implements Serializable {
@Column(name = "status")
@ApiModelProperty(value = "订单状态"
+"0--删除"
+"1--创建订单"
+"2--取消"
+"3--待付款"
+"4--待出行"
+"5--出行中(进行中)"
+"0--删除"
+"1--创建订单"
+"2--取消"
+"3--待付款"
+"4--待出行"
+"5--出行中(进行中)"
+"6--已完成")
private Integer status;
......
package com.xxfc.platform.order.pojo.mq;
import lombok.Data;
@Data
public class OrderMQDTO {
public static final Integer ORDER_CRT = 1;
public static final Integer ORDER_CANCEL = 2;
public static final Integer ORDER_PAY = 4;
public static final Integer ORDER_FINISH = 6;
Integer orderId;
/**
* 标记是什么操作
* 0--删除"
* 1--创建订单"
* 2--取消"
*
* 4--已支付"
*
* 6--已完成
*/
Integer sign;
}
......@@ -17,11 +17,11 @@ import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import com.xxfc.platform.order.contant.enumerate.RefundTypeEnum;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.BaseOrderMapper;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.OrderListVo;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo;
import com.xxfc.platform.vehicle.common.RestResponse;
......@@ -512,4 +512,16 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
return zero;
}
private void sendQueue(Integer orderId, Integer sign) {
try {
OrderMQDTO orderMQDTO = new OrderMQDTO(){{
setOrderId(orderId);
setSign(sign);
}};
//mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, KEY_REGISTER_SUCCESS, JSONUtil.toJsonStr(orderMQDTO));
}catch (Exception e){
log.error(e.getMessage(), e);
}
}
}
\ No newline at end of file
......@@ -209,16 +209,17 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
insureAmount = insureAmount.add(INSURE_PRICE.multiply(new BigDecimal(String.valueOf(detail.getTotalNumber() * detail.getTourGood().getNumber()))));
}
//总价
tourAmount = tourAmount.add(tourSpePriceVo.getTotalPrice()).add(tourSpePriceVo.getTotalChildPrice());
//商品价格
goodsAmount = goodsAmount.add(tourAmount);
//优惠券处理
//待完成
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());
//商品价格
goodsAmount = goodsAmount.add(tourAmount);
//总价格
orderAmount = orderAmount.add(goodsAmount).add(insureAmount);
......
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