Commit e762121f authored by hezhen's avatar hezhen

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

parents 9539de93 d33fab28
package com.github.wxiaoqi.security.admin.vo; package com.github.wxiaoqi.security.admin.vo;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -57,8 +58,27 @@ public class SellingWalletVo { ...@@ -57,8 +58,27 @@ public class SellingWalletVo {
@ApiModelProperty("'类别:0-正;1-负(退款时)") @ApiModelProperty("'类别:0-正;1-负(退款时)")
private Integer status; private Integer status;
@JSONField(serialize = false)
private Integer sourceId;
@JSONField(serialize = false)
private BigDecimal commissionnm;
/** /**
* 所获佣金 * 所获佣金
*/ */
private BigDecimal commission; private BigDecimal commission;
/**
* 订单状态
*/
private Integer sellerStatus;
/**
* 订单文案
*/
private String statusText;
/**
* 是否显示 默认false
*/
private Boolean isShow;
} }
...@@ -105,22 +105,22 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -105,22 +105,22 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId); log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---parentId===" + parentId);
Integer positionId = 6; Integer positionId = 6;
Integer level = 0; Integer level = 0;
AppUserPosition position=positionBiz.getExtract(parentId); AppUserPosition position = positionBiz.getExtract(parentId);
if (position!=null){ if (position != null) {
positionId=position.getId(); positionId = position.getId();
} }
AppUserPosition position1=positionBiz.getExtract(userId); AppUserPosition position1 = positionBiz.getExtract(userId);
if (position!=null){ if (position != null) {
level=position1.getLevel(); level = position1.getLevel();
} }
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---positionId===" + positionId+"---level==="+level); log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "---positionId===" + positionId + "---level===" + level);
if(level!=0){ if (level != 0) {
log.info("购买计算用户拥金----payOrderWater--------userId===" + userId +"----无法享受拥金"); log.info("购买计算用户拥金----payOrderWater--------userId===" + userId + "----无法享受拥金");
return; return;
} }
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
//商品类型 //商品类型
Integer orderType=0; Integer orderType = 0;
for (OrderGoodsDTO goodsDto : goodsDTOList) { for (OrderGoodsDTO goodsDto : goodsDTOList) {
//商品id //商品id
Integer goodId = goodsDto.getGoodId(); Integer goodId = goodsDto.getGoodId();
...@@ -164,11 +164,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -164,11 +164,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
amount = amount.add(commission); amount = amount.add(commission);
} }
} }
log.info("购买计算用户未入账----payOrderWater--------userId===" + parentId+"----amount===="+amount+"--orderType==="+orderType); log.info("购买计算用户未入账----payOrderWater--------userId===" + parentId + "----amount====" + amount + "--orderType===" + orderType);
if(orderType==3){ if (orderType == 3) {
finishOrderWater(orderWaterDTO); finishOrderWater(orderWaterDTO);
}else if(orderType==1||orderType==2){ } else if (orderType == 1 || orderType == 2) {
myWaterBiz.updMyWalletUnbooked(parentId,amount,1); myWaterBiz.updMyWalletUnbooked(parentId, amount, 1);
} }
} }
...@@ -183,16 +183,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -183,16 +183,16 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
List<AppUserSellingWater> list = getWaterList(orderId); List<AppUserSellingWater> list = getWaterList(orderId);
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
Integer userId = 0; Integer userId = 0;
Integer orderType=0; Integer orderType = 0;
if (list.size() > 0) { if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) { for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId(); Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType(); orderType = sellingWater.getOrderType();
userId = sellingWater.getUserId(); userId = sellingWater.getUserId();
sellingWater.setWaiting(1); sellingWater.setWaiting(1);
updateById(sellingWater); updateById(sellingWater);
BigDecimal commission = sellingWater.getCommission(); BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission+"----orderType==="+orderType); log.info("订单完成计算用户拥金----finishOrderWater----id====" + id + "---commission==" + commission + "----orderType===" + orderType);
amount = amount.add(commission); amount = amount.add(commission);
} }
...@@ -200,14 +200,14 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -200,14 +200,14 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
int r = amount.compareTo(BigDecimal.ZERO); int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包 //更新钱包
if (r == 1 && userId > 0) { if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail(); MyWalletDetail detail = new MyWalletDetail();
detail.setUserId(userId); detail.setUserId(userId);
detail.setAmount(amount); detail.setAmount(amount);
detail.setCono(orderId); detail.setCono(orderId);
detail.setSource(1); detail.setSource(1);
myWaterBiz.updMyWater(detail); myWaterBiz.updMyWater(detail);
if(orderType==1||orderType==2){ if (orderType == 1 || orderType == 2) {
myWaterBiz.updMyWalletUnbooked(userId,amount,2); myWaterBiz.updMyWalletUnbooked(userId, amount, 2);
} }
} }
...@@ -228,11 +228,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -228,11 +228,11 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
BigDecimal amount = new BigDecimal("0.00"); BigDecimal amount = new BigDecimal("0.00");
BigDecimal unbooked = new BigDecimal("0.00"); BigDecimal unbooked = new BigDecimal("0.00");
Integer userId = 0; Integer userId = 0;
Integer orderType=0; Integer orderType = 0;
if (list.size() > 0) { if (list.size() > 0) {
for (AppUserSellingWater sellingWater : list) { for (AppUserSellingWater sellingWater : list) {
Integer id = sellingWater.getId(); Integer id = sellingWater.getId();
orderType=sellingWater.getOrderType(); orderType = sellingWater.getOrderType();
userId = sellingWater.getUserId(); userId = sellingWater.getUserId();
sellingWater.setWaiting(1); sellingWater.setWaiting(1);
updateById(sellingWater); updateById(sellingWater);
...@@ -240,22 +240,22 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -240,22 +240,22 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setStatus(1); sellingWater.setStatus(1);
insertSelective(sellingWater); insertSelective(sellingWater);
BigDecimal commission = sellingWater.getCommission(); BigDecimal commission = sellingWater.getCommission();
log.info("订单完成计算用户拥金----refundOrderWater----id====" + id + "---commission==" + commission+"---orderType===="+orderType); log.info("订单完成计算用户拥金----refundOrderWater----id====" + id + "---commission==" + commission + "---orderType====" + orderType);
unbooked=unbooked.add(commission); unbooked = unbooked.add(commission);
} }
log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked==="+unbooked); log.info("订单完成计算用户拥金----refundOrderWater----orderId====" + orderId + "---amount==" + amount + "---unbooked===" + unbooked);
int r = amount.compareTo(BigDecimal.ZERO); int r = amount.compareTo(BigDecimal.ZERO);
//更新钱包 //更新钱包
if (r == 1 && userId > 0) { if (r == 1 && userId > 0) {
MyWalletDetail detail=new MyWalletDetail(); MyWalletDetail detail = new MyWalletDetail();
detail.setUserId(userId); detail.setUserId(userId);
detail.setAmount(amount); detail.setAmount(amount);
detail.setCono(orderId); detail.setCono(orderId);
detail.setSource(1); detail.setSource(1);
myWaterBiz.updMyWater(detail); myWaterBiz.updMyWater(detail);
} }
if(orderType==1||orderType==2){ if (orderType == 1 || orderType == 2) {
myWaterBiz.updMyWalletUnbooked(userId,unbooked,2); myWaterBiz.updMyWalletUnbooked(userId, unbooked, 2);
} }
} }
...@@ -271,8 +271,8 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -271,8 +271,8 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
} }
public PageDataVO<UserIncomeBo> findMemberIdAndIncomeMapByMemberIds(Integer parentId,Integer pageNo,Integer pageSize) { public PageDataVO<UserIncomeBo> findMemberIdAndIncomeMapByMemberIds(Integer parentId, Integer pageNo, Integer pageSize) {
return PageDataVO.pageInfo(pageNo,pageSize,()->mapper.accquireIncomeByMemberIds(parentId)); return PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.accquireIncomeByMemberIds(parentId));
} }
public SellingWalletPagVo findSellingWaterPageByWaiting(Integer waiting, Integer userId, Integer pageNo, Integer pageSize) { public SellingWalletPagVo findSellingWaterPageByWaiting(Integer waiting, Integer userId, Integer pageNo, Integer pageSize) {
...@@ -297,7 +297,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -297,7 +297,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
return sellingWalletPagVo; return sellingWalletPagVo;
} }
List<Integer> memberIds = appUserSellingWaters.stream().map(AppUserSellingWater::getSourceId).collect(Collectors.toList()); List<Integer> memberIds = appUserSellingWaters.stream().map(AppUserSellingWater::getSourceId).distinct().collect(Collectors.toList());
Map<Integer, AppUserLogin> userIdAndAppUserLoginMap = appUserLoginBiz.findUserIdAndUserLoginMapByMemberIds(memberIds); Map<Integer, AppUserLogin> userIdAndAppUserLoginMap = appUserLoginBiz.findUserIdAndUserLoginMapByMemberIds(memberIds);
Map<Integer, AppUserDetail> userIdAndAppUserDetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(memberIds); Map<Integer, AppUserDetail> userIdAndAppUserDetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(memberIds);
...@@ -341,10 +341,91 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A ...@@ -341,10 +341,91 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
} }
public void deleteByMemberIds(Collection<Integer> userIds) { public void deleteByMemberIds(Collection<Integer> userIds) {
Example example = new Example(AppUserSellingWater.class); Example example = new Example(AppUserSellingWater.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.orIn("sourceId",userIds); criteria.orIn("sourceId", userIds);
criteria.orIn("userId",userIds); criteria.orIn("userId", userIds);
mapper.deleteByExample(example); mapper.deleteByExample(example);
} }
public SellingWalletPagVo findSellingWaterPageForAppByWaiting(Integer wating, Integer userId, Integer pageNo, Integer pageSize) {
SellingWalletPagVo sellingWalletPagVo = new SellingWalletPagVo();
PageDataVO<SellingWalletVo> pageDataVO = PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.selectSellerWalterByUserIdAndWating(userId, wating));
List<SellingWalletVo> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)) {
sellingWalletPagVo.setPageNum(pageNo);
sellingWalletPagVo.setPageSize(pageSize);
sellingWalletPagVo.setSellingWaters(Collections.EMPTY_LIST);
sellingWalletPagVo.setTotalCount(0);
sellingWalletPagVo.setTotalPage(0);
return sellingWalletPagVo;
}
List<Integer> memberIds = data.stream().map(SellingWalletVo::getSourceId).distinct().collect(Collectors.toList());
Map<Integer, AppUserLogin> userIdAndAppUserLoginMap = appUserLoginBiz.findUserIdAndUserLoginMapByMemberIds(memberIds);
Map<Integer, AppUserDetail> userIdAndAppUserDetailMap = appUserDetailBiz.findUserIdAndUserDetailMapByMemberIds(memberIds);
for (SellingWalletVo sellingWalletVo : data) {
String username = userIdAndAppUserLoginMap.get(sellingWalletVo.getSourceId()).getUsername();
sellingWalletVo.setUsername(username);
if (userIdAndAppUserDetailMap != null) {
AppUserDetail appUserDetail = userIdAndAppUserDetailMap.get(sellingWalletVo.getSourceId());
sellingWalletVo.setNickName(appUserDetail == null ? "" : appUserDetail.getNickname());
sellingWalletVo.setHeadUrl(appUserDetail == null ? "" : appUserDetail.getHeadimgurl());
}
//取消单
if (sellingWalletVo.getSellerStatus()==1) {
sellingWalletVo.setSellerStatus(SellerWallterStatus.CANCEL.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.CANCEL.getText());
sellingWalletVo.setIsShow(true);
}else {
if (sellingWalletVo.getWaiting()==SellerWallterStatus.POST.getCode()){
sellingWalletVo.setSellerStatus(SellerWallterStatus.POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.POST.getText());
sellingWalletVo.setIsShow(false);
}
if (sellingWalletVo.getWaiting()==SellerWallterStatus.NO_POST.getCode()){
sellingWalletVo.setSellerStatus(SellerWallterStatus.NO_POST.getCode());
sellingWalletVo.setStatusText(SellerWallterStatus.NO_POST.getText());
sellingWalletVo.setIsShow(false);
}
}
}
sellingWalletPagVo.setPageNum(pageNo);
sellingWalletPagVo.setPageSize(pageSize);
sellingWalletPagVo.setSellingWaters(data);
sellingWalletPagVo.setTotalCount(pageDataVO.getTotalCount().intValue());
sellingWalletPagVo.setTotalPage(pageDataVO.getTotalPage());
return sellingWalletPagVo;
}
private enum SellerWallterStatus {
CANCEL(2, "取消订单"),
POST(1, "已入账"),
NO_POST(0, "未入账");
private int code;
private String text;
SellerWallterStatus(int code, String text) {
this.code = code;
this.text = text;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
} }
\ No newline at end of file
...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.bo.UserIncomeBo; ...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo; import com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail; import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.UserTeamMemberVo; import com.github.wxiaoqi.security.admin.vo.UserTeamMemberVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
......
...@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.mapper; ...@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.bo.UserIncomeBo; import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater; import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater;
import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -20,4 +21,6 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> { ...@@ -20,4 +21,6 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> {
List<UserIncomeBo> accquireIncomeByMemberIds(@Param("parentId") Integer parentId); List<UserIncomeBo> accquireIncomeByMemberIds(@Param("parentId") Integer parentId);
BigDecimal selectTotalIncomeByUserId(@Param("userId") Integer userId); BigDecimal selectTotalIncomeByUserId(@Param("userId") Integer userId);
List<SellingWalletVo> selectSellerWalterByUserIdAndWating(@Param("userId") Integer userId, @Param("wating") Integer wating);
} }
...@@ -2,14 +2,12 @@ package com.github.wxiaoqi.security.admin.rest; ...@@ -2,14 +2,12 @@ package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.UserBusinessBiz; import com.github.wxiaoqi.security.admin.biz.UserBusinessBiz;
import com.github.wxiaoqi.security.admin.bo.PromoteBO; import com.github.wxiaoqi.security.admin.bo.PromoteBO;
import com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo;
import com.github.wxiaoqi.security.admin.vo.UserTeamMemberVo; import com.github.wxiaoqi.security.admin.vo.UserTeamMemberVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException; 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.vo.PageDataVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
......
...@@ -48,4 +48,17 @@ public class UserSellingWaterController { ...@@ -48,4 +48,17 @@ public class UserSellingWaterController {
} }
} }
@GetMapping("/pagea")
public ObjectRestResponse<SellingWalletPagVo> findSellingWaterPagea(@RequestParam(required = false,value = "type") Integer wating,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize,
HttpServletRequest request) {
try {
IJWTInfo infoFromToken = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request));
SellingWalletPagVo sellingWalletPagVo = appUserSellingWaterBiz.findSellingWaterPageForAppByWaiting(wating, Integer.valueOf(infoFromToken.getId()), pageNo, pageSize);
return ObjectRestResponse.succ(sellingWalletPagVo);
} catch (Exception e) {
throw new BaseException(e);
}
}
} }
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
SELECT SELECT
aur.user_id, aur.user_id,
aur.bind_time as `leagueTime`, aur.bind_time as `leagueTime`,
ausww.income IFNULL(ausww.income,0) AS `income`
FROM FROM
`app_user_relation` AS `aur` `app_user_relation` AS `aur`
LEFT JOIN (SELECT DISTINCT LEFT JOIN (SELECT DISTINCT
`source_id` AS userId, `source_id` AS userId,
IFNULL( IFNULL(
( (
( SELECT SUM( commission ) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 0 AND `waiting` = 1 ) - ( SELECT SUM( commission ) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 1 AND `waiting` = 1 ) ( SELECT IFNULL(SUM( commission ),0) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 0 ) - ( SELECT IFNULL(SUM( commission ),0) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 1 )
), ),
0 0
) AS `income` ) AS `income`
...@@ -31,4 +31,47 @@ FROM ...@@ -31,4 +31,47 @@ FROM
( SELECT IFNULL(SUM( commission ),0) AS upIncome FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id` = #{userId} ) AS `auswu`, ( SELECT IFNULL(SUM( commission ),0) AS upIncome FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id` = #{userId} ) AS `auswu`,
( SELECT IFNULL(SUM( commission ),0) AS `dowIncome` FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id` = #{userId} ) AS `auswd`; ( SELECT IFNULL(SUM( commission ),0) AS `dowIncome` FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id` = #{userId} ) AS `auswd`;
</select> </select>
<select id="selectSellerWalterByUserIdAndWating" resultType="com.github.wxiaoqi.security.admin.vo.SellingWalletVo">
<!-- SELECT
*
FROM
(
SELECT
ausw.*,
IFNULL( ausw.commission, 0 ) - IFNULL( auswt.commission, 0 ) AS `commissionnm`,
auswt.status AS sellerStatus,
IFNULL(auswt.status,0) AS `isShow`
FROM
( SELECT * FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id`=#{userId} <if test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `ausw`
LEFT JOIN ( SELECT * FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id`=#{userId} <if
test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `auswt` ON auswt.order_no = ausw.order_no
) AS `auswres`
ORDER BY crt_time DESC-->
SELECT w.*,o.commission as commission ,o.type AS `sellerStatus` FROM (
SELECT t.order_no,SUM(t.z)-SUM(t.f) as commission,IF(SUM(t.f)>0,'1',0)as type FROM (
SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=0 and commission>0
UNION
SELECT order_no,0 as z,commission as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=1 and commission>0
) as t
GROUP BY t.order_no
) o LEFT JOIN ( SELECT DISTINCT order_no,user_id,source_id,order_type,img,price,title,waiting,`crt_time` FROM
app_user_selling_water ) w
ON o.order_no=w.order_no
where 1=1
<if test="wating!=null">
and `waiting`= #{wating} and <![CDATA[
o.`type`<>1 ]]>
</if>
ORDER BY `crt_time`
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -54,6 +54,11 @@ public class RentVehiclePriceVO extends OrderPriceVO{ ...@@ -54,6 +54,11 @@ public class RentVehiclePriceVO extends OrderPriceVO{
*/ */
private BigDecimal buyVehicleAmount = BigDecimal.ZERO; private BigDecimal buyVehicleAmount = BigDecimal.ZERO;
/**
* 最后的租车金额
*/
private BigDecimal realVehicleAmount = BigDecimal.ZERO;
/** /**
* 优惠描述 * 优惠描述
*/ */
......
...@@ -344,7 +344,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -344,7 +344,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}}); }});
if(null == crosstown) { if(null == crosstown) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId())); throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet(StrUtil.format("退款第一部分押金失败,获取不了还车/定损记录,订单号:{}, crosstownTypeEnum: {}", orderMQDTO.getId(), crosstownTypeEnum)));
} }
if(null == crosstown.getRestDeposit() if(null == crosstown.getRestDeposit()
...@@ -365,12 +365,12 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -365,12 +365,12 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv); handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv);
if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) { if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) {
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(crosstown.getDeductionCost(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT)
); );
} }
//剩余押金 = 押金 - 违章保证金 - 定损金额 //剩余押金 = 押金 - 违章保证金 - 定损金额
oad.setDepositAmount(oad.getDepositAmount().subtract(illegalReserve).subtract(crosstown.getDeductionCost())); oad.setDepositAmount(oad.getDepositAmount().subtract(illegalReserve).subtract(csv.getDamagesAmount()));
handleCrosstownDetail(crosstown, oad); handleCrosstownDetail(crosstown, oad);
//退款 //退款
...@@ -409,11 +409,16 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -409,11 +409,16 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
csv.initParamJson(); csv.initParamJson();
//设置明细 //设置明细
orderRentVehicleBiz.updateSelectiveById(new OrderRentVehicleDetail(){{ orderRentVehicleBiz.updateSelectiveById(new OrderRentVehicleDetail(){{
setId(orderMQDTO.getId()); setId(orderMQDTO.getDetailId());
handelCostDetailExtend(csv); handelCostDetailExtend(csv);
}}); }});
orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData()); //捕捉异常
try {
orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData());
}catch (Exception e) {
log.error(e.getMessage(), e);
}
} }
} }
......
package com.xxfc.platform.order.biz.inner; package com.xxfc.platform.order.biz.inner;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
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.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -385,7 +386,7 @@ public class OrderMsgBiz { ...@@ -385,7 +386,7 @@ public class OrderMsgBiz {
BigDecimal residueAmount; BigDecimal residueAmount;
//查询订单退款记录 //查询订单退款记录
OrderAccount orderAccount; OrderAccount orderAccount;
if(RefundStatusEnum.RESIDUE_ILLEGAL.equals(baseOrder.getRefundStatus())) { if(RefundStatusEnum.RESIDUE_ILLEGAL.getCode().equals(baseOrder.getRefundStatus())) {
smstype = SmsTemplateDTO.REFUND_A; smstype = SmsTemplateDTO.REFUND_A;
orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{ orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
...@@ -395,7 +396,7 @@ public class OrderMsgBiz { ...@@ -395,7 +396,7 @@ public class OrderMsgBiz {
violateAmount = orderAccount.getDeductAmount(); violateAmount = orderAccount.getDeductAmount();
refundAmount = orderAccount.getAccountAmount(); refundAmount = orderAccount.getAccountAmount();
residueAmount = orvd.getReturnPayResidue(); residueAmount = orvd.getReturnPayResidue();
}else if(RefundStatusEnum.REFUND_DEPOSIT.equals(baseOrder.getRefundStatus())){ }else if(RefundStatusEnum.REFUND_DEPOSIT.getCode().equals(baseOrder.getRefundStatus())){
smstype = SmsTemplateDTO.REFUND_B; smstype = SmsTemplateDTO.REFUND_B;
orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{ orderAccount = orderAccountBiz.selectOne(new OrderAccount(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
...@@ -407,7 +408,7 @@ public class OrderMsgBiz { ...@@ -407,7 +408,7 @@ public class OrderMsgBiz {
residueAmount = BigDecimal.ZERO; residueAmount = BigDecimal.ZERO;
}else { }else {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, new HashSet<String>() {{ throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, new HashSet<String>() {{
add("当前退款状态不对,订单号:"+ baseOrder.getNo()); add(StrUtil.format("当前退款状态不对,订单号:{} baseOrder.getRefundStatus(): {}", baseOrder.getNo(), baseOrder.getRefundStatus()));
}}); }});
} }
......
...@@ -356,6 +356,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -356,6 +356,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rvp.setFreeDayNum(freeDayNum); rvp.setFreeDayNum(freeDayNum);
rvp.setFreeAmount(vehicleOrderItem.getCutAmount()); rvp.setFreeAmount(vehicleOrderItem.getCutAmount());
rvp.setBuyVehicleAmount(vehicleOrderItem.getBuyAmount()); rvp.setBuyVehicleAmount(vehicleOrderItem.getBuyAmount());
rvp.setRealVehicleAmount(vehicleOrderItem.getRealAmount());
rvp.setCouponDesc(couponDesc); rvp.setCouponDesc(couponDesc);
rvp.initParamJson(); rvp.initParamJson();
......
...@@ -27,11 +27,14 @@ public class VehicleModelQueryCondition { ...@@ -27,11 +27,14 @@ public class VehicleModelQueryCondition {
@ApiModelProperty(value = "是否删除") @ApiModelProperty(value = "是否删除")
private Integer isDel; private Integer isDel;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer status; private Integer status=1;
@ApiModelProperty("分类逗号分割") @ApiModelProperty("分类逗号分割")
String catasStr; String catasStr;
@ApiModelProperty("排除的车型id") @ApiModelProperty("排除的车型id")
String notInIds; String notInIds;
@ApiModelProperty(value = "分类列表", hidden = true) @ApiModelProperty(value = "分类列表", hidden = true)
Map<Integer, List<VehiclePlatCata>> catas; Map<Integer, List<VehiclePlatCata>> catas;
@ApiModelProperty(value = "分类列表(1-后台,2-app和小程序)", hidden = true)
private Integer pathType=2;
} }
...@@ -49,7 +49,9 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> { ...@@ -49,7 +49,9 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
* @return * @return
*/ */
public ObjectRestResponse findVehicleModelPage(VehicleModelQueryCondition vmqc) { public ObjectRestResponse findVehicleModelPage(VehicleModelQueryCondition vmqc) {
if (vmqc.getPathType()==1) {
vmqc.setStatus(null);
}
try { try {
PageDataVO<VehicleModelVo> mPageDataVO = PageDataVO.pageInfo(vmqc.getPage(), PageDataVO<VehicleModelVo> mPageDataVO = PageDataVO.pageInfo(vmqc.getPage(),
vmqc.getLimit(), () -> mapper.findVehicleModelPage(vmqc)); vmqc.getLimit(), () -> mapper.findVehicleModelPage(vmqc));
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleModelMapper"> <mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleModelMapper">
<select id="findVehicleModelPage" parameterType="com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition" <select id="findVehicleModelPage" parameterType="com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition"
resultType="com.xxfc.platform.vehicle.pojo.VehicleModelVo"> resultType="com.xxfc.platform.vehicle.pojo.VehicleModelVo">
SELECT * from SELECT * from
(select vm.*,v.sum,v2.leasableQuantity,vpc.`name` brandName,vpc2.name numberName from vehicle_model vm left JOIN (select vm.*,v.sum,v2.leasableQuantity,vpc.`name` brandName,vpc2.name numberName from vehicle_model vm left JOIN
(select model_id as mid, count(1) as sum FROM vehicle GROUP BY mid) v (select model_id as mid, count(1) as sum FROM vehicle GROUP BY mid) v
on vm.id=v.mid left JOIN on vm.id=v.mid left JOIN
(select model_id as mid2, count(1) as leasableQuantity FROM vehicle where`use_type`=1 GROUP BY model_id) v2 (select model_id as mid2, count(1) as leasableQuantity FROM vehicle where`use_type`=1 GROUP BY model_id) v2
on v.mid=v2.mid2 on v.mid=v2.mid2
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc on vm.brand=vpc.id left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc on vm.brand=vpc.id
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc2 on vm.number=vpc2.id left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc2 on vm.number=vpc2.id
where isdel = 0 where isdel = 0
) vmqc WHERE 1=1 ) vmqc WHERE 1=1
<if test="isDel !=null "> <if test="isDel !=null ">
and isdel=#{isDel} and isdel=#{isDel}
</if> </if>
<if test="status != null">
and status = #{status}
</if> <if test="status != null">
<if test="vehicleName !=null and vehicleName !=''"> and status = #{status}
AND vmqc.name LIKE CONCAT('%',#{vehicleName},'%') </if>
</if>
<if test="vehicleType!=null and vehicleType!=''"> <if test="vehicleName !=null and vehicleName !=''">
AND EXISTS (SELECT vc.vehicle_model_id FROM vehicle_cata vc WHERE vc.cata_id=#{vehicleType} AND vmqc.id=vc.vehicle_model_id ) AND vmqc.name LIKE CONCAT('%',#{vehicleName},'%')
</if> </if>
<if test="takeALieTheNumber!=null and takeALieTheNumber!=''"> <if test="vehicleType!=null and vehicleType!=''">
AND EXISTS(SELECT vc2.vehicle_model_id FROM vehicle_cata vc2 WHERE vc2.cata_id=#{takeALieTheNumber} AND vmqc.id=vc2.vehicle_model_id) AND EXISTS (SELECT vc.vehicle_model_id FROM vehicle_cata vc WHERE vc.cata_id=#{vehicleType} AND
</if> vmqc.id=vc.vehicle_model_id )
</if>
<if test="catas != null">
AND ( 1 <if test="takeALieTheNumber!=null and takeALieTheNumber!=''">
<foreach collection="catas" index="key" item="cataList"> AND EXISTS(SELECT vc2.vehicle_model_id FROM vehicle_cata vc2 WHERE vc2.cata_id=#{takeALieTheNumber} AND
&amp; ( vmqc.id=vc2.vehicle_model_id)
<foreach collection="cataList" index="cIndex" item="cata"> </if>
<if test=" cIndex != 0">
| <if test="catas != null">
</if> AND ( 1
(case when FIND_IN_SET(#{cata.id},vmqc.config) > 0 then 1 else 0 end) <foreach collection="catas" index="key" item="cataList">
</foreach> &amp; (
) <foreach collection="cataList" index="cIndex" item="cata">
</foreach> <if test=" cIndex != 0">
) > 0 |
</if> </if>
<if test="notInIds != null"> (case when FIND_IN_SET(#{cata.id},vmqc.config) > 0 then 1 else 0 end)
and vmqc.id not in ( </foreach>
)
</foreach>
) > 0
</if>
<if test="notInIds != null">
and vmqc.id not in (
<foreach collection="notInIds.split(',')" item="noIdItem" index="noIdIndex"> <foreach collection="notInIds.split(',')" item="noIdItem" index="noIdIndex">
#{noIdItem} #{noIdItem}
</foreach> </foreach>
) )
</if> </if>
ORDER BY vmqc.sort ASC ORDER BY vmqc.sort ASC
</select> </select>
<update id="updateScoreByModelIdAndavgScore"> <update id="updateScoreByModelIdAndavgScore">
update `vehicle_model` set `score`=(`score`+#{avgScore})/2 where `id`=#{modelId} update `vehicle_model` set `score`=(`score`+#{avgScore})/2 where `id`=#{modelId}
......
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