Commit 203575c9 authored by hanfeng's avatar hanfeng

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

parents 662eef7a f7bd0a98
...@@ -104,13 +104,15 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -104,13 +104,15 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
Integer parentId = relation.getParentId(); Integer parentId = relation.getParentId();
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId); log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId);
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
//商品类型
Integer orderType=0;
for (OrderGoodsDTO goodsDto : goodsDTOList) { for (OrderGoodsDTO goodsDto : goodsDTOList) {
//商品id //商品id
Integer goodId = goodsDto.getGoodId(); Integer goodId = goodsDto.getGoodId();
//商品价格 //商品价格
BigDecimal price = goodsDto.getPrice(); BigDecimal price = goodsDto.getPrice();
//商品类型
Integer orderType = goodsDto.getType(); orderType = goodsDto.getType();
//商品比例 //商品比例
Integer extract = commissionBiz.getExtract(orderType, goodId); Integer extract = commissionBiz.getExtract(orderType, goodId);
AppUserVo userVo = detailBiz.getUserInfoById(parentId); AppUserVo userVo = detailBiz.getUserInfoById(parentId);
...@@ -149,15 +151,14 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -149,15 +151,14 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
insertSelective(sellingWater); insertSelective(sellingWater);
log.info("购买计算用户拥成功----payOrderWater--------userId===" + userId); log.info("购买计算用户拥成功----payOrderWater--------userId===" + userId);
amount = amount.add(commission); amount = amount.add(commission);
}
log.info("购买计算用户未入账----payOrderWater--------userId===" + userId+"----amount===="+amount+"--orderType==="+orderType);
if(orderType==3){
finishOrderWater(orderWaterDTO);
}else if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(userId,amount,1);
} }
} }
log.info("购买计算用户未入账----payOrderWater--------userId===" + parentId+"----amount===="+amount+"--orderType==="+orderType);
if(orderType==3){
finishOrderWater(orderWaterDTO);
}else if(orderType==1||orderType==2){
myWaterBiz.updMyWalletUnbooked(parentId,amount,1);
}
} }
//订单完成计算用户拥金 //订单完成计算用户拥金
...@@ -270,6 +271,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -270,6 +271,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo(); SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo();
Example example = new Example(AppUserSellingWater.class); Example example = new Example(AppUserSellingWater.class);
example.setOrderByClause("crt_time DESC");
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
if (waiting != null) { if (waiting != null) {
criteria.andEqualTo("waiting", waiting); criteria.andEqualTo("waiting", waiting);
......
...@@ -80,7 +80,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -80,7 +80,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
walletpg.setWithdrawaling(withDrawaling); walletpg.setWithdrawaling(withDrawaling);
walletpg.setWithdrawals(walletpg.getWithdrawals()==null?new BigDecimal(0):walletpg.getWithdrawals()); walletpg.setWithdrawals(walletpg.getWithdrawals()==null?new BigDecimal(0):walletpg.getWithdrawals());
walletpg.setUnbooked(walletpg.getUnbooked()==null?new BigDecimal(0):walletpg.getUnbooked()); walletpg.setUnbooked(walletpg.getUnbooked()==null?new BigDecimal(0):walletpg.getUnbooked());
walletpg.setTotalAmount(walletpg.getTodayAmount()==null?walletpg.getUnbooked():walletpg.getTotalAmount().add(walletpg.getUnbooked())); walletpg.setTotalAmount(walletpg.getTodayAmount()==null?new BigDecimal(0):walletpg.getTotalAmount());
walletpg.setTotalConsumption(totalConsumpution); walletpg.setTotalConsumption(totalConsumpution);
walletPageVos.add(walletpg); walletPageVos.add(walletpg);
} }
......
...@@ -41,6 +41,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -41,6 +41,7 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("stauts", state); criteria.andEqualTo("stauts", state);
criteria.andEqualTo("userId", userId); criteria.andEqualTo("userId", userId);
example.setOrderByClause("crt_time DESC");
PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletCath> walletCathPage = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<MyWalletCath> walletCaths = walletCathPage.getData(); List<MyWalletCath> walletCaths = walletCathPage.getData();
......
...@@ -19,6 +19,7 @@ import tk.mybatis.mapper.entity.Example; ...@@ -19,6 +19,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -42,6 +43,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -42,6 +43,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
Example example = new Example(MyWalletDetail.class); Example example = new Example(MyWalletDetail.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId); criteria.andEqualTo("userId",userId);
example.setOrderByClause("crt_time DESC");
PageDataVO<MyWalletDetail> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example)); PageDataVO<MyWalletDetail> walletDetailPageVoPageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectByExample(example));
List<MyWalletDetail> walletDetails = walletDetailPageVoPageDataVO.getData(); List<MyWalletDetail> walletDetails = walletDetailPageVoPageDataVO.getData();
...@@ -84,6 +86,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet ...@@ -84,6 +86,7 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
walletDetailAdminVos.add(walletDetailAdminVo); walletDetailAdminVos.add(walletDetailAdminVo);
walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle()); walletDetailAdminVo.setSourceName(StringUtils.isEmpty(detailListDTO.getTitle())?detailListDTO.getActivityName():detailListDTO.getTitle());
} }
walletDetailAdminVos.sort(Comparator.comparing(WalletDetailAdminVo::getCrtTime).reversed());
pageDataVO.setPageNum(walletDetailFindDTO.getPage()); pageDataVO.setPageNum(walletDetailFindDTO.getPage());
pageDataVO.setPageSize(walletDetailFindDTO.getLimit()); pageDataVO.setPageSize(walletDetailFindDTO.getLimit());
pageDataVO.setTotalCount(walletDetailPage.getTotalCount()); pageDataVO.setTotalCount(walletDetailPage.getTotalCount());
......
...@@ -102,7 +102,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -102,7 +102,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
date = sdf.parse(sdf.format(new Date())); date = sdf.parse(sdf.format(new Date()));
if (time < date.getTime() && time > date.getTime()) { if (time < (date.getTime()+24*3600*1000) && time > date.getTime()) {
isToday = true; isToday = true;
} }
} catch (ParseException e) { } catch (ParseException e) {
...@@ -113,6 +113,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -113,6 +113,7 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
//钱包未入账的处理type1-进;2-出 //钱包未入账的处理type1-进;2-出
public void updMyWalletUnbooked(Integer userId,BigDecimal amount,Integer type){ public void updMyWalletUnbooked(Integer userId,BigDecimal amount,Integer type){
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----type==="+type);
MyWallet wallet=new MyWallet(); MyWallet wallet=new MyWallet();
wallet.setUserId(userId); wallet.setUserId(userId);
wallet=selectOne(wallet); wallet=selectOne(wallet);
...@@ -133,8 +134,9 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{ ...@@ -133,8 +134,9 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
unbooked=wallet.getUnbooked().subtract(amount); unbooked=wallet.getUnbooked().subtract(amount);
} }
} }
log.info("---钱包未入账的处理updMyWalletUnbooked----userId==="+userId+"----unbooked==="+unbooked);
wallet.setUnbooked(unbooked); wallet.setUnbooked(unbooked);
mapper.updMyWater(wallet); updateSelectiveById(wallet);
} }
} }
......
...@@ -89,7 +89,7 @@ public class WaterMQHandler { ...@@ -89,7 +89,7 @@ public class WaterMQHandler {
setImg(orderMQDTO.getPicture()); setImg(orderMQDTO.getPicture());
setPrice(orderMQDTO.getGoodsAmount()); setPrice(orderMQDTO.getGoodsAmount());
setTitle(orderMQDTO.getName()); setTitle(orderMQDTO.getName());
setType(OrderGoodsDTO.TYPE_RENT); setType(OrderGoodsDTO.TYPE_TOUR);
}}); }});
}} }}
); );
......
...@@ -2,6 +2,8 @@ package com.github.wxiaoqi.security.admin.rpc; ...@@ -2,6 +2,8 @@ package com.github.wxiaoqi.security.admin.rpc;
import com.ace.cache.annotation.Cache; import com.ace.cache.annotation.Cache;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService; import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService; import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.ImiVo; import com.github.wxiaoqi.security.admin.vo.ImiVo;
...@@ -16,6 +18,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -16,6 +18,7 @@ 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.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import io.swagger.annotations.ApiModelProperty;
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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -40,6 +43,8 @@ public class AppUserRest { ...@@ -40,6 +43,8 @@ public class AppUserRest {
@Autowired @Autowired
private UserAuthConfig userAuthConfig; private UserAuthConfig userAuthConfig;
@Autowired
private AppUserLoginBiz appUserLoginBiz;
// @Cache(key="permission") // @Cache(key="permission")
// @RequestMapping(value = "/permissions", method = RequestMethod.GET) // @RequestMapping(value = "/permissions", method = RequestMethod.GET)
...@@ -235,4 +240,19 @@ public class AppUserRest { ...@@ -235,4 +240,19 @@ public class AppUserRest {
public ImiVo findUserInfoByImiId(@PathVariable(value = "imiId") Integer imiId){ public ImiVo findUserInfoByImiId(@PathVariable(value = "imiId") Integer imiId){
return appPermissionService.findUserInoByImiId(imiId); return appPermissionService.findUserInoByImiId(imiId);
} }
@ApiModelProperty("检查手机号是否注册过")
@GetMapping("/unauth/check")
public ObjectRestResponse check(@RequestParam(value = "phone") String phone){
if (StringUtils.isBlank(phone)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
AppUserLogin rsUserLogin = appUserLoginBiz.checkeUserLogin(phone);
if (rsUserLogin == null){
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "手机号未注册");
}
return ObjectRestResponse.succ();
}
} }
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
<select id="selectByLeaderId" resultType="com.github.wxiaoqi.security.admin.entity.AppUserRelation"> <select id="selectByLeaderId" resultType="com.github.wxiaoqi.security.admin.entity.AppUserRelation">
select `parent_id` as `parentId`,`user_id`as `userId`,`bind_time` as `bindTime` from `app_user_relation` where `parent_id`=#{leaderId} and `is_del`=0 select `parent_id` as `parentId`,`user_id`as `userId`,`bind_time` as `bindTime` from `app_user_relation` where `parent_id`=#{leaderId} and `is_del`=0 order by `bind_time` DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if
test="userName != null and userName != ''"> test="userName != null and userName != ''">
WHERE nickname =#{userName} OR realname =#{userName} WHERE nickname =#{userName} OR realname =#{userName}
</if> ) AS `aud` ON aud.userid = aul.id </if> ) AS `aud` ON aud.userid = aul.id order by wc.crt_time DESC
</select> </select>
<select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <select id="findUserWithDrawingByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
......
...@@ -30,6 +30,7 @@ FROM ...@@ -30,6 +30,7 @@ FROM
WHERE `nickname`=#{userName} OR `realname`=#{userName} WHERE `nickname`=#{userName} OR `realname`=#{userName}
</if>) AS `aud` ON aud.userid = aul.id </if>) AS `aud` ON aud.userid = aul.id
LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON ausw.order_id = wd.cono LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON ausw.order_id = wd.cono
ORDER BY `crtTime` DESC
</select> </select>
<select id="findpersonalConsumptionsByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"> <select id="findpersonalConsumptionsByUserIds" resultType="com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO">
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
w.user_id AS `userId`, w.user_id AS `userId`,
w.balance, w.balance,
w.withdrawals, w.withdrawals,
w.total_amount AS `totalAmount`, (w.total_amount+w.unbooked) AS `totalAmount`,
w.today_amount AS `todayAmount`, w.today_amount AS `todayAmount`,
w.unbooked, w.unbooked,
w.is_frozen AS `isFrozen`, w.is_frozen AS `isFrozen`,
...@@ -65,6 +65,6 @@ FROM ...@@ -65,6 +65,6 @@ FROM
</if> ) AS `aul` ON aul.id = w.user_id </if> ) AS `aul` ON aul.id = w.user_id
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if test="username != null and username != ''"> INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail` <if test="username != null and username != ''">
WHERE nickname =#{username} OR realname =#{username} WHERE nickname =#{username} OR realname =#{username}
</if> ) AS `aud` ON aud.userid = aul.id </if> ) AS `aud` ON aud.userid = aul.id ORDER BY `totalAmount` DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
...@@ -34,7 +35,7 @@ public interface ActivityFeign { ...@@ -34,7 +35,7 @@ public interface ActivityFeign {
@RequestMapping(value = "/user/use", method = RequestMethod.POST) @RequestMapping(value = "/user/use", method = RequestMethod.POST)
public BigDecimal use( public BigDecimal use(
@RequestParam(value = "userId") Integer userId, @RequestParam(value = "userId") Integer userId,
@RequestParam(value = "tickerNo") String tickerNo, @RequestParam(value = "tickerNos") List<String> tickerNos,
@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "orderNo") String orderNo,
@RequestParam(value = "channel") Integer channel, @RequestParam(value = "channel") Integer channel,
@RequestParam(value = "amount") BigDecimal amount, @RequestParam(value = "amount") BigDecimal amount,
......
...@@ -93,6 +93,29 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -93,6 +93,29 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//判断用户是否已领取或无法领取优惠卷
public ObjectRestResponse checkUserCoupon(Integer userId){
ActivityRule rule = ruleBiz.getActity();
if (rule == null) {
log.error("----没有开启的活动----");
return ObjectRestResponse.createFailedResult(101,"无有效活动");
}
Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin();
userJoin.setActivityId(activityId);
userJoin.setUserId(userId);
userJoin= selectOne(userJoin);
if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId);
return ObjectRestResponse.createFailedResult(102,"不是新用户,无法参与此活动");
}
if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId);
return ObjectRestResponse.createFailedResult(103,"用户已领取");
}
return ObjectRestResponse.succ();
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import com.xxfc.platform.activity.vo.UserCouponVo; ...@@ -11,6 +11,7 @@ import com.xxfc.platform.activity.vo.UserCouponVo;
import com.xxfc.platform.universal.weixin.util.Snowflake; import com.xxfc.platform.universal.weixin.util.Snowflake;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.mapper.UserCouponMapper; import com.xxfc.platform.activity.mapper.UserCouponMapper;
...@@ -147,38 +148,37 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -147,38 +148,37 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return mapper.getUserCoupon(tickerNo); return mapper.getUserCoupon(tickerNo);
} }
//支付后更新优惠卷状态 //支付后更新优惠卷状态:type.1-
public BigDecimal useTickerNo(Integer userId, String TickerNo, String orderNo,Integer channel,BigDecimal amout,Integer type){ public BigDecimal useTickerNo(Integer userId, List<String> tickerNos, 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) { if(couponAmout.compareTo(amout) >= 0) {
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
if (userId==null||userId==0||StringUtils.isBlank(TickerNo)){ if (userId==null||userId==0||tickerNos==null||tickerNos.size()==0){
log.error("----参数不能为空"); log.error("----参数不能为空");
return couponAmout; return couponAmout;
} }
Example example=new Example(UserCoupon.class); Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("tickerNo",TickerNo).andEqualTo("isDel",0); example.createCriteria().andIn("tickerNo", tickerNos).andEqualTo("isDel",0);
List<UserCoupon> list=selectByExample(example); List<UserCoupon> list=selectByExample(example);
if(list.size()==0){ if(list.size()==0){
log.error(userId+"----没有可用优惠卷--tickerNo==="+TickerNo); log.error(userId+"----没有可用优惠卷--");
return couponAmout; return couponAmout;
} }
for (UserCoupon userCoupon:list) {
UserCoupon userCoupon=list.get(0); if(userCoupon!=null&&userCoupon.getIsUse()==1){
if(userCoupon!=null&&userCoupon.getIsUse()==1){ log.error(userId+"----该优惠卷已使用--tickerNo==");
log.error(userId+"----该优惠卷已使用--tickerNo=="+TickerNo); continue;
return couponAmout; }
} if (type==1){
if (type==1){ userCoupon.setIsUse(1);
userCoupon.setIsUse(1); userCoupon.setOrderNo(orderNo);
userCoupon.setOrderNo(orderNo); userCoupon.setUseTime(System.currentTimeMillis());
userCoupon.setUseTime(System.currentTimeMillis()); updateSelectiveById(userCoupon);
updateSelectiveById(userCoupon); }
couponAmout=couponAmout.add(getCouponAmout(userCoupon.getCouponId(),channel,amout));
} }
return couponAmout;
return getCouponAmout(userCoupon.getCouponId(),channel,amout);
} }
public BigDecimal getCouponAmout(Integer couponId,Integer channel,BigDecimal amout) { public BigDecimal getCouponAmout(Integer couponId,Integer channel,BigDecimal amout) {
......
...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
@RestController @RestController
@RequestMapping("user") @RequestMapping("user")
...@@ -57,13 +58,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -57,13 +58,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping(value = "/use", method = RequestMethod.POST) @RequestMapping(value = "/use", method = RequestMethod.POST)
public BigDecimal use( public BigDecimal use(
@RequestParam(value = "userId",defaultValue ="0" ) Integer userId, @RequestParam(value = "userId",defaultValue ="0" ) Integer userId,
@RequestParam(value = "tickerNo",defaultValue ="" ) String tickerNo, @RequestParam(value = "tickerNos",defaultValue ="" ) List<String> tickerNos,
@RequestParam(value = "orderNo",defaultValue ="" ) String orderNo, @RequestParam(value = "orderNo",defaultValue ="" ) String orderNo,
@RequestParam(value = "channel",defaultValue ="1" ) Integer channel, @RequestParam(value = "channel",defaultValue ="1" ) Integer channel,
@RequestParam(value = "amount",defaultValue ="0.00" ) BigDecimal amount, @RequestParam(value = "amount",defaultValue ="0.00" ) BigDecimal amount,
@RequestParam(value = "type",defaultValue ="1" ) Integer type @RequestParam(value = "type",defaultValue ="1" ) Integer type
) { ) {
return baseBiz.useTickerNo(userId,tickerNo,orderNo,channel,amount,type); return baseBiz.useTickerNo(userId,tickerNos,orderNo,channel,amount,type);
} }
@ApiOperation("优惠卷取消使用") @ApiOperation("优惠卷取消使用")
...@@ -85,6 +86,17 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -85,6 +86,17 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return joinBiz.receiveCoupn(userId); return joinBiz.receiveCoupn(userId);
} }
@ApiOperation("检查用户是否可领取")
@RequestMapping(value = "/coupon/check", method = RequestMethod.GET)
public ObjectRestResponse check() {
AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getUserid();
if (userId == null) {
return ObjectRestResponse.createDefaultFail();
}
return joinBiz.checkUserCoupon(userId);
}
......
...@@ -494,7 +494,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> { ...@@ -494,7 +494,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData(); AppUserDTO appUserDTO = userFeign.userDetailById(baseOrder.getUserId()).getData();
//处理App用户提醒短信的发送 //处理App用户提醒短信的发送
//orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO); orderMsgBiz.handelAppUserMsg(orvd, omd, baseOrder, appUserDTO);
//处理后台用户提醒短信的发送 //处理后台用户提醒短信的发送
orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY); orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_PAY);
......
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import cn.hutool.json.JSONUtil;
import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.entity.OrderVehicleCrosstown;
import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.OrderRefund; import com.xxfc.platform.order.entity.OrderRefund;
import com.xxfc.platform.order.mapper.OrderRefundMapper; import com.xxfc.platform.order.mapper.OrderRefundMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
/** /**
* 订单退款记录表 * 订单退款记录表
...@@ -15,4 +33,51 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +33,51 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
@Autowired
ThirdFeign thirdFeign;
@Autowired
BaseOrderBiz baseOrderBiz;
@Autowired
OrderRentVehicleBiz orderRentVehicleBiz;
@Autowired
OrderVehicalCrosstownBiz crosstownBiz;
public void refundDeposit(){
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
BigDecimal illegalReserve = new BigDecimal(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.ILLEGAL_RESERVE).getDetail());
List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class)
//订单已完成的租车订单
.where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE)
.andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH)
// .andLike(BaseOrder::getId, "%"+ String.valueOf(i))
).build());
//处理自动退押金
for(BaseOrder baseOrder : lists) {
OrderRentVehicleDetail orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail() {{
setOrderId(baseOrder.getId());
}});
//未退还, 进行保留违章预备金 的退还
if(RefundStatusEnum.NONE.getCode().equals(baseOrder.getRefundStatus())) {
OrderVehicleCrosstown crosstown = crosstownBiz.selectOne(new OrderVehicleCrosstown(){{
setOrderId(baseOrder.getId());
setType(CrosstownTypeEnum.TOUR.getCode());
}});
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
}
refundDesc += ")";
//退款子流程: 订单基础,退款描述,退款金额
baseOrderBiz.refundSubProcess(baseOrder, refundDesc, refundAmont, RefundTypeEnum.RentVehicle.getCode(), RefundStatusEnum.RESIDUE_ILLEGAL.getCode());
//设置剩余
}
}
}
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ import java.util.Map; ...@@ -18,7 +18,7 @@ import java.util.Map;
* @date 2019/1/7 * @date 2019/1/7
*/ */
@Configuration @Configuration
public class RabbitUserConfig { public class RabbitDelayConfig {
public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange"; public static final String ORDER_CANCEL_EXC = "order_cancel_delay_exchange";
public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue"; public static final String ORDER_CANCEL_QUE = "order_cancel_delay_queue";
......
package com.xxfc.platform.order.config;
import com.github.wxiaoqi.security.common.config.RabbitCommonConfig;
import com.github.wxiaoqi.security.common.config.rabbit.BindDTO;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import static com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
* @author zhoujw
* @date 2019/7/15
*/
@Configuration
public class RabbitOrderConfig extends RabbitCommonConfig {
//优惠券
public static final String ORDER_DEPOSIT_REFUND_QUEUE = "order.deposit.refund.queue";
static {
myQueue = new ArrayList<BindDTO>(){{
add(new BindDTO(ORDER_DEPOSIT_REFUND_QUEUE, ORDER_TOPIC, KEY_ORDER_FINLISH));
}};
}
}
...@@ -13,9 +13,8 @@ import org.springframework.stereotype.Component; ...@@ -13,9 +13,8 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_QUE; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_QUE;
/** /**
* activeMq消费者类 * activeMq消费者类
......
...@@ -7,10 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,10 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_EXC; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_EXC;
import static com.xxfc.platform.order.config.RabbitUserConfig.ORDER_CANCEL_KEY; import static com.xxfc.platform.order.config.RabbitDelayConfig.ORDER_CANCEL_KEY;
/** /**
* rabbitMq生产者类 * rabbitMq生产者类
......
...@@ -39,6 +39,7 @@ import java.math.BigDecimal; ...@@ -39,6 +39,7 @@ import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.*; import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
...@@ -141,7 +142,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -141,7 +142,7 @@ 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); activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo(), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
} }
//获取可用车辆 //获取可用车辆
...@@ -245,9 +246,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -245,9 +246,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//优惠券处理 //优惠券处理
//待完成 //待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) { 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); couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo(), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) { if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0)); detail.getOrder().setCouponTickerNos(detail.getTickerNo().stream().collect(Collectors.joining(",")));
} }
} }
......
...@@ -140,7 +140,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -140,7 +140,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//如果有使用优惠券,则扣减 //如果有使用优惠券,则扣减
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); activityFeign.use(bo.getAppUserDTO().getUserid(), bo.getTickerNo(), bo.getOrder().getNo(), channel, bo.getOrder().getGoodsAmount(), ActivityFeign.TYPE_USE);
} }
super.handleDetail(bo); super.handleDetail(bo);
...@@ -217,9 +217,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To ...@@ -217,9 +217,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//优惠券处理 //优惠券处理
//待完成 //待完成
if(null != detail.getTickerNo() && detail.getTickerNo().size() > 0) { 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); couponAmount = activityFeign.use(dto.getUserid(), detail.getTickerNo(), detail.getOrder().getNo(), channel, goodsAmount, ActivityFeign.TYPE_NO_USE);
if(couponAmount.compareTo(BigDecimal.ZERO) > 0) { if(couponAmount.compareTo(BigDecimal.ZERO) > 0) {
detail.getOrder().setCouponTickerNos(detail.getTickerNo().get(0)); detail.getOrder().setCouponTickerNos(detail.getTickerNo()
.stream().collect(Collectors.joining(",")));
} }
} }
......
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