订单下单,订单取消调整

This commit is contained in:
曹磊 2024-06-20 16:41:00 +08:00
parent 888f7b7e8f
commit 0da3a423b5
18 changed files with 1946 additions and 880 deletions

View File

@ -144,7 +144,7 @@ public class Artificer implements Serializable {
* 技师类型 比例
*/
@TableField(exist = false)
private Integer technicianTypeRate;
private BigDecimal technicianTypeRate;
/**
* 是否是明星技师 1是 2否

View File

@ -102,7 +102,7 @@ public class Orders implements Serializable {
private Integer payWay;
/**
* 状态 1待支付 2待服务 3待评论 4已取消 5已完成 6进行中 7技师出发 8技师到达
* 状态 1待支付 2待服务 3待评论 4已取消 5已完成 6进行中 7技师出发 8技师到达 9用户已支付技师待接单 10待补单
*/
private Integer status;
@ -202,7 +202,7 @@ public class Orders implements Serializable {
/**
* 优惠券id
*/
private Long couponId;
private String couponId;
/**
* 优惠券金额
@ -278,7 +278,7 @@ public class Orders implements Serializable {
private Integer warning;
/**
* 是否是储蓄金支付 1是
* 是否是储蓄金支付 1是 -- 暂无用
*/
private Integer userArtificerMoney;
/**
@ -371,6 +371,12 @@ public class Orders implements Serializable {
@TableField(exist = false)
private String shopPhone;
/**
* 会员优惠比例
*/
@TableField(exist = false)
private BigDecimal vipRate;
@TableField(exist = false)
private String userRecharge;

View File

@ -110,7 +110,7 @@ public class MassagePackage implements Serializable {
/**
* 服务分类ID
*/
private Integer classifyId;
private Long classifyId;
/**
* 类型名称

View File

@ -100,7 +100,7 @@ public class UserPackage implements Serializable {
/**
* 服务分类ID
*/
private Integer classifyId;
private Long classifyId;
/**
* 服务分类名称

View File

@ -44,7 +44,7 @@ public class UserPackageDetail implements Serializable {
private Long massageTypeId;
/**
* 状态 1上 2下
* 状态是否使用0未使用1已使用
*/
private Integer status;

View File

@ -127,7 +127,7 @@ public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao
BigDecimal canCouponMoney = BigDecimal.ZERO;//当可用代金券时的金额
BigDecimal canVipMoney = BigDecimal.ZERO;//当可用vip时的金额
BigDecimal totalMoney = BigDecimal.ZERO;//总金额
List<Integer> classifyIdArr = Lists.newArrayList();
List<Long> classifyIdArr = Lists.newArrayList();
List<UserPackageOrdersMapping> ordersPackageList = userPackageOrder.getOrdersPackageList();
for (UserPackageOrdersMapping ordersPackage : ordersPackageList) {
MassagePackage massagePackage = massagePackageService.getById(ordersPackage.getPackageId());
@ -139,7 +139,7 @@ public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao
canVipMoney = canVipMoney.add(sum);
}
totalMoney = totalMoney.add(sum);
Integer classifyId = massagePackage.getClassifyId();
Long classifyId = massagePackage.getClassifyId();
classifyIdArr.add(classifyId);
}

View File

@ -11,11 +11,11 @@ public enum CommonEnum {
NONE(null,null,null,null),
/**距离服务开始n个小时以上免费取消*/
V3_ORDER_FORM_CANCEL_NOT_START_01(436, "v3_order_form", "距离服务开始n个小时以上免费取消", "4"),
V3_ORDER_FORM_CANCEL_NOT_START_01(436, "v3_order_form", "距离服务开始n分钟以上免费取消", "240"),
/**距离服务开始前取消n-n个小时内收取n元*/
V3_ORDER_FORM_CANCEL_NOT_START_02(437, "v3_order_form", "距离服务开始前取消n-n个小时内收取n元", "1.5,4,10"),
V3_ORDER_FORM_CANCEL_NOT_START_02(437, "v3_order_form", "距离服务开始前取消n-n分钟内收取n元", "90,240,10"),
/**距离服务开始前取消少于n个小时内收取n元*/
V3_ORDER_FORM_CANCEL_NOT_START_03(438, "v3_order_form", "距离服务开始前取消少于n个小时内收取n元", "1.5,30"),
V3_ORDER_FORM_CANCEL_NOT_START_03(438, "v3_order_form", "距离服务开始前取消少于n分钟内收取n元", "90,30"),
/**服务开始n分钟内取消订单扣项目费用n%车费全扣n%*/
V3_ORDER_FORM_CANCEL_START_01(439, "v3_order_form", "服务开始n分钟内取消订单扣项目费用n%车费全扣n%", "15,50,100"),

View File

@ -31,7 +31,6 @@ import java.util.Map;
@Service
public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo> implements CommonInfoService {
private final CommonInfoDao commonInfoDao;
private final UserRechargeDao userRechargeDao;
private final ArtificerPartitioningDetailsMapper artificerPartitioningDetailsMapper;
@ -142,54 +141,52 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
@Override
public CommonInfo isCheckChangeOrder(Date businessTime, Date nowTime) {
long bnDiffDay = DateUtil.between(businessTime, nowTime, DateUnit.DAY, false);
long bnDiffDay = DateUtil.between(nowTime, businessTime, DateUnit.MINUTE, false);
Map<Integer, CommonInfo> configMap = getMapByCondition(CommonEnum.GroupConditionEnum.V3_ORDER_FORM.getValue());
CommonInfo defCommonInfo = new CommonInfo();
if(bnDiffDay >= 0) {
if(bnDiffDay > 0) {
//正数 开始前
//距离服务开始n个小时以上免费取消 - 4
//距离服务开始n分钟以上免费取消 240
CommonInfo v3OrderFormCancelNotStart01 = configMap.getOrDefault(CommonEnum.V3_ORDER_FORM_CANCEL_NOT_START_01.getKey(), defCommonInfo);
Double v3OrderFormCancelNotStart01D = CommonConfigUtil.getDoubleValue(v3OrderFormCancelNotStart01.getValue());
if(v3OrderFormCancelNotStart01D == null) v3OrderFormCancelNotStart01D = -1D;
//距离服务开始前取消n-n个小时内收取n元 - 1.5,4,10
Long v3OrderFormCancelNotStart01D = CommonConfigUtil.getLongValue(v3OrderFormCancelNotStart01.getValue());
if(v3OrderFormCancelNotStart01D == null) v3OrderFormCancelNotStart01D = 240L;
//距离服务开始前取消n-n分钟内收取n元 90,240,10
CommonInfo v3OrderFormCancelNotStart02 = configMap.getOrDefault(CommonEnum.V3_ORDER_FORM_CANCEL_NOT_START_02.getKey(), defCommonInfo);
String[] v3OrderFormCancelNotStart02A = CommonConfigUtil.getArrayValue(v3OrderFormCancelNotStart01.getValue());
if(v3OrderFormCancelNotStart02A == null) v3OrderFormCancelNotStart02A = new String[]{ "-1","4","10" };
double v3OrderFormCancelNotStart02D = Double.parseDouble(v3OrderFormCancelNotStart02A[0]);
//距离服务开始前取消少于n个小时内收取n元 -1.5,30
String[] v3OrderFormCancelNotStart02A = CommonConfigUtil.getArrayValue(v3OrderFormCancelNotStart02.getValue());
if(v3OrderFormCancelNotStart02A == null) v3OrderFormCancelNotStart02A = new String[]{ "90","240","10" };
Long v3OrderFormCancelNotStart02D = CommonConfigUtil.getLongValue(v3OrderFormCancelNotStart02A[0]);
//距离服务开始前取消少于n分钟内收取n元 90,30
CommonInfo v3OrderFormCancelNotStart03 = configMap.getOrDefault(CommonEnum.V3_ORDER_FORM_CANCEL_NOT_START_03.getKey(), defCommonInfo);
String[] v3OrderFormCancelNotStart03A = CommonConfigUtil.getArrayValue(v3OrderFormCancelNotStart01.getValue());
if(v3OrderFormCancelNotStart03A == null) v3OrderFormCancelNotStart03A = new String[]{ "-1","30" };
double v3OrderFormCancelNotStart03D = Double.parseDouble(v3OrderFormCancelNotStart03A[0]);
String[] v3OrderFormCancelNotStart03A = CommonConfigUtil.getArrayValue(v3OrderFormCancelNotStart03.getValue());
if(v3OrderFormCancelNotStart03A == null) v3OrderFormCancelNotStart03A = new String[]{ "90","30" };
Long v3OrderFormCancelNotStart03D = CommonConfigUtil.getLongValue(v3OrderFormCancelNotStart03A[0]);
if(bnDiffDay > v3OrderFormCancelNotStart01D && v3OrderFormCancelNotStart01D != -1){
if(bnDiffDay >= v3OrderFormCancelNotStart01D){
//外面的
return v3OrderFormCancelNotStart01;
} else if(bnDiffDay <= v3OrderFormCancelNotStart01D && bnDiffDay >= v3OrderFormCancelNotStart02D && v3OrderFormCancelNotStart02D != -1){
} else if(bnDiffDay >= v3OrderFormCancelNotStart02D && bnDiffDay < v3OrderFormCancelNotStart01D ){
return v3OrderFormCancelNotStart02;
} else if(bnDiffDay < v3OrderFormCancelNotStart02D && bnDiffDay >= v3OrderFormCancelNotStart03D && v3OrderFormCancelNotStart03D != -1){
return v3OrderFormCancelNotStart03;
} else if(v3OrderFormCancelNotStart03D > bnDiffDay){
} else if(bnDiffDay < v3OrderFormCancelNotStart03D){
return v3OrderFormCancelNotStart03;
}
} else {
//负数开始后
long bnDiffMinute = DateUtil.between(businessTime, nowTime, DateUnit.MINUTE, false);
//服务开始n分钟内取消订单扣项目费用n%车费全扣n% - 15,50,100
//服务开始n分钟内取消订单扣项目费用n%车费全扣n% 15,50,100
CommonInfo v3OrderFormCancelStart01 = configMap.getOrDefault(CommonEnum.V3_ORDER_FORM_CANCEL_START_01.getKey(), defCommonInfo);
String[] v3OrderFormCancelStart01A = CommonConfigUtil.getArrayValue(v3OrderFormCancelStart01.getValue());
if(v3OrderFormCancelStart01A == null) v3OrderFormCancelStart01A = new String[]{ "-1","0","0" };
double v3OrderFormCancelStart01I = Double.parseDouble(v3OrderFormCancelStart01A[0]);
//服务开始n分钟后不可以取消订单 - 15
if(v3OrderFormCancelStart01A == null) v3OrderFormCancelStart01A = new String[]{ "15","50","100" };
Long v3OrderFormCancelStart01I = CommonConfigUtil.getLongValue(v3OrderFormCancelStart01A[0]);
//服务开始n分钟后不可以取消订单 15
CommonInfo v3OrderFormCancelStart02 = configMap.getOrDefault(CommonEnum.V3_ORDER_FORM_CANCEL_START_02.getKey(), defCommonInfo);
Double v3OrderFormCancelStart02I = CommonConfigUtil.getDoubleValue(v3OrderFormCancelStart02.getValue());
if(v3OrderFormCancelStart02I == null) v3OrderFormCancelStart02I = -1D;
Long v3OrderFormCancelStart02I = CommonConfigUtil.getLongValue(v3OrderFormCancelStart02.getValue());
if(v3OrderFormCancelStart02I == null) v3OrderFormCancelStart02I = 15L;
if(bnDiffMinute <= v3OrderFormCancelStart01I) {
return v3OrderFormCancelStart01;
} else if(bnDiffMinute >= v3OrderFormCancelStart02I){
} else if(bnDiffMinute > v3OrderFormCancelStart02I){
return v3OrderFormCancelStart02;
}
}
@ -223,6 +220,4 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
}
}
}

View File

@ -44,7 +44,7 @@ public class Coupon implements Serializable {
private Integer couType;
@ApiModelProperty("分类ID0为通用非0为具体分类ID")
private Integer classifyId;
private Long classifyId;
public Coupon() {}
}

View File

@ -60,7 +60,10 @@ public class CouponUser implements Serializable {
private Long couponIssueId;
@ApiModelProperty("分类ID0为通用非0为具体分类ID")
private Integer classifyId;
private Long classifyId;
@TableField(exist = false)
private String classifyName;
@TableField(exist = false)
private String nickName;

View File

@ -40,5 +40,6 @@ public interface MessageService extends IService<MessageInfo> {
Result selectArtificerScoreList(Integer page,Integer limit,String artificerName,String phone,Long userId);
void sendNoticeByCall(Long userId);
}

View File

@ -236,4 +236,17 @@ public class MessageServiceImpl extends
return Result.success().put("data",new PageUtils(baseMapper.selectArtificerScoreList(new Page<>(page,limit),artificerName,phone,userId)));
}
@Override
public void sendNoticeByCall(Long userId){
//技师电话通知业务
UserEntity byId = userService.getById(userId);
//accountId
String accountId = commonInfoService.findOne(428).getValue();
//token
String token = commonInfoService.findOne(429).getValue();
//templateId
String templateId = commonInfoService.findOne(430).getValue();
AppNotifyUtil.AppNotify(byId.getPhone(),accountId,token,templateId);
}
}

View File

@ -179,51 +179,46 @@ public class AliPayController {
payDetailsDao.updateState(payDetails.getId(), 1, sdf.format(new Date()), tradeNo);
if (payDetails.getType() == 1) {
Orders orders = ordersService.selectOrdersByOrderNo(payDetails.getOrderId());
orders.setStatus(2);
orders.setStatus(9);//用户已支付技师待接单
orders.setPayWay(6);
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
UserEntity user = userService.selectUserById(orders.getUserId());
UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
// 分佣在订单完成后进行计算 2024-06-20 by caolei
// UserEntity user = userService.selectUserById(orders.getUserId());
// UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
BigDecimal oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
// if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
// orders.setOneUserId(oneUser.getUserId());
// orders.setOneUserName(oneUser.getUserName());
// oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
// }
Artificer artificer = artificerService.getById(orders.getArtificerId());
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
// if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
//
// }
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
}
}
}
// if(artificerUser.getConsortiaId()!=null){
// Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
// if(consortia!=null && consortia.getUserId()!=null){
// UserEntity consortiaUser = userService.getById(consortia.getUserId());
// if(consortiaUser!=null){
// shopMoney = pingMoney.multiply(consortia.getRate());
// orders.setConsortiaId(consortia.getConsortiaId());
// orders.setShopUserId(consortiaUser.getUserId());
// orders.setShopUserName(consortiaUser.getUserName());
//
// }
// }
// }
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
@ -279,8 +274,6 @@ public class AliPayController {
}
}
Orders orders1 = ordersDao.selectById(orders.getParentId());
if(orders1.getAddNum()==null){
orders1.setAddNum(1);
@ -304,24 +297,25 @@ public class AliPayController {
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
// 分佣在订单完成后进行计算 2024-06-20 by caolei
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
// if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
// oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
// }
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
// if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
// oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
// }
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
// if(artificerUser.getConsortiaId()!=null){
// Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
// if(consortia!=null && consortia.getUserId()!=null){
// UserEntity consortiaUser = userService.getById(consortia.getUserId());
// if(consortiaUser!=null){
// shopMoney=pingMoney.multiply(consortia.getRate());
// }
// }
// }
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
@ -353,6 +347,8 @@ public class AliPayController {
messageInfo.setUserId("0");
messageInfo.setIsSee("0");
messageService.saveBody(messageInfo);
//电话通知 add 2024-06-20 by caolei
messageService.sendNoticeByCall(artificer.getUserId());
}
ordersService.sendMsg(orders);
@ -758,9 +754,6 @@ public class AliPayController {
}
}
}
}
//通知页面地址
@ -775,7 +768,11 @@ public class AliPayController {
payDetails.setCreateTime(sdf.format(new Date()));
payDetails.setOrderId(orders.getOrdersNo());
payDetails.setUserId(orders.getUserId());
payDetails.setMoney(orders.getPayMoney().doubleValue());
if(orders.getUserPackageDetailId() !=null ){
payDetails.setMoney(orders.getTaxiMoney().doubleValue());
}else{
payDetails.setMoney(orders.getPayMoney().doubleValue());
}
payDetails.setClassify(6);
payDetails.setType(1);
payDetailsDao.insert(payDetails);
@ -784,9 +781,17 @@ public class AliPayController {
payDetailsDao.updateById(payDetails1);
}
if (type == 1) {
return payApp(name, orders.getOrdersNo(), orders.getPayMoney().doubleValue());
if(orders.getUserPackageDetailId() !=null ){
return payApp(name, orders.getOrdersNo(), orders.getTaxiMoney().doubleValue());
}else{
return payApp(name, orders.getOrdersNo(), orders.getPayMoney().doubleValue());
}
} else {
return payH5(name, orders.getOrdersNo(), orders.getPayMoney().doubleValue(), returnUrl);
if(orders.getUserPackageDetailId() !=null ){
return payApp(name, orders.getOrdersNo(), orders.getTaxiMoney().doubleValue());
}else{
return payH5(name, orders.getOrdersNo(), orders.getPayMoney().doubleValue(), returnUrl);
}
}
}

View File

@ -224,8 +224,6 @@ public class WxServiceImpl implements WxService {
}
}
}
}
PayDetails payDetails1 = payDetailsDao.selectByOrderId(orders.getOrdersNo());
if(payDetails1==null){
@ -234,7 +232,11 @@ public class WxServiceImpl implements WxService {
payDetails.setCreateTime(sdf.format(new Date()));
payDetails.setOrderId(orders.getOrdersNo());
payDetails.setUserId(orders.getUserId());
payDetails.setMoney(orders.getPayMoney().doubleValue());
if(orders.getUserPackageDetailId() !=null ){
payDetails.setMoney(orders.getTaxiMoney().doubleValue());
}else{
payDetails.setMoney(orders.getPayMoney().doubleValue());
}
payDetails.setClassify(classify);
payDetails.setType(1);
payDetailsDao.insert(payDetails);
@ -242,7 +244,11 @@ public class WxServiceImpl implements WxService {
payDetails1.setClassify(classify);
payDetailsDao.updateById(payDetails1);
}
return pay(orders.getPayMoney().doubleValue(), classify, orders.getUserId(), orders.getOrdersNo(),request);
if(orders.getUserPackageDetailId() !=null ){
return pay(orders.getTaxiMoney().doubleValue(), classify, orders.getUserId(), orders.getOrdersNo(),request);
}else{
return pay(orders.getPayMoney().doubleValue(), classify, orders.getUserId(), orders.getOrdersNo(),request);
}
}
@Override
@ -654,51 +660,46 @@ public class WxServiceImpl implements WxService {
payDetailsDao.updateState(payDetails.getId(), 1, sdf.format(new Date()), "");
if(payDetails.getType()==1){
Orders orders = ordersService.selectOrdersByOrderNo(payDetails.getOrderId());
orders.setStatus(2);
orders.setStatus(9);//用户已支付技师待接单
orders.setPayWay(payDetails.getClassify());
orders.setPayTime(sdf.format(new Date()));
BigDecimal pingMoney=orders.getPayMoney();
UserEntity user = userService.selectUserById(orders.getUserId());
UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
// 分佣在订单完成后进行计算 2024-06-20 by caolei
// UserEntity user = userService.selectUserById(orders.getUserId());
// UserEntity oneUser = userService.queryByInvitationCode(user.getInviterCode());
BigDecimal oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
orders.setOneUserId(oneUser.getUserId());
orders.setOneUserName(oneUser.getUserName());
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
// if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
// orders.setOneUserId(oneUser.getUserId());
// orders.setOneUserName(oneUser.getUserName());
// oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
//
// }
Artificer artificer = artificerService.getById(orders.getArtificerId());
UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
// UserEntity artificerUser = userService.selectUserById(artificer.getUserId());
// UserEntity oneArtificerUser = userService.queryByInvitationCode(artificerUser.getInviterCode());
BigDecimal oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
orders.setOneArtificerUserId(oneArtificerUser.getUserId());
orders.setOneArtificerUserName(oneArtificerUser.getUserName());
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
// if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
// orders.setOneArtificerUserId(oneArtificerUser.getUserId());
// orders.setOneArtificerUserName(oneArtificerUser.getUserName());
// oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
//
// }
BigDecimal shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney = pingMoney.multiply(consortia.getRate());
orders.setConsortiaId(consortia.getConsortiaId());
orders.setShopUserId(consortiaUser.getUserId());
orders.setShopUserName(consortiaUser.getUserName());
}
}
}
// if(artificerUser.getConsortiaId()!=null){
// Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
// if(consortia!=null && consortia.getUserId()!=null){
// UserEntity consortiaUser = userService.getById(consortia.getUserId());
// if(consortiaUser!=null){
// shopMoney = pingMoney.multiply(consortia.getRate());
// orders.setConsortiaId(consortia.getConsortiaId());
// orders.setShopUserId(consortiaUser.getUserId());
// orders.setShopUserName(consortiaUser.getUserName());
//
// }
// }
// }
pingMoney=pingMoney.subtract(orders.getArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
@ -748,8 +749,6 @@ public class WxServiceImpl implements WxService {
}
}
Orders orders1 = ordersDao.selectById(orders.getParentId());
if(orders1.getAddNum()==null){
orders1.setAddNum(1);
@ -773,24 +772,25 @@ public class WxServiceImpl implements WxService {
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
pingMoney=orders1.getSumMoney();
// 分佣在订单完成后进行计算 2024-06-20 by caolei
oneUserMoney=BigDecimal.ZERO;
if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
}
// if(oneUser!=null && oneUser.getIsAgency()!=null && oneUser.getIsAgency()==1){
// oneUserMoney=pingMoney.multiply(oneUser.getUserRate());
// }
oneArtificerMoney=BigDecimal.ZERO;
if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
}
// if(oneArtificerUser!=null && oneArtificerUser.getIsAgency()!=null && oneArtificerUser.getIsAgency()==1){
// oneArtificerMoney=pingMoney.multiply(oneArtificerUser.getShopRate());
// }
shopMoney=BigDecimal.ZERO;
if(artificerUser.getConsortiaId()!=null){
Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
if(consortia!=null && consortia.getUserId()!=null){
UserEntity consortiaUser = userService.getById(consortia.getUserId());
if(consortiaUser!=null){
shopMoney=pingMoney.multiply(consortia.getRate());
}
}
}
// if(artificerUser.getConsortiaId()!=null){
// Consortia consortia = consortiaService.getById(artificerUser.getConsortiaId());
// if(consortia!=null && consortia.getUserId()!=null){
// UserEntity consortiaUser = userService.getById(consortia.getUserId());
// if(consortiaUser!=null){
// shopMoney=pingMoney.multiply(consortia.getRate());
// }
// }
// }
pingMoney=pingMoney.subtract(orders1.getSumArtificerMoney());
pingMoney=pingMoney.subtract(oneUserMoney);
pingMoney=pingMoney.subtract(oneArtificerMoney);
@ -814,7 +814,6 @@ public class WxServiceImpl implements WxService {
orders1.setEndTime(endTime);
}
ordersDao.updateById(orders1);
}else{
@ -824,6 +823,8 @@ public class WxServiceImpl implements WxService {
messageInfo.setUserId("0");
messageInfo.setIsSee("0");
messageService.saveBody(messageInfo);
//电话通知 add 2024-06-20 by caolei
messageService.sendNoticeByCall(artificer.getUserId());
}
ordersService.sendMsg(orders);

View File

@ -10,7 +10,7 @@
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id=a.artificer_id ),0.00) as ordersScore,
(select count(*) from taking_commnt c where c.artificer_id=a.artificer_id ) as commentCount,
(st_distance (point (a.longitude, a.latitude),point(#{longitude},#{latitude}) ) *111195) as distance,
v.vip_name as technicianTypeName, (CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
from artificer a
left join tb_user u on a.user_id=u.user_id
left join sys_dict s on s.id=a.classify_id
@ -83,7 +83,7 @@
(select count(*) from collect_artificer o where o.artificer_id = a.artificer_id and o.user_id = #{userId} and classify = 1) as myCollectCount,
ifnull((select avg(c.score) from taking_commnt c where c.artificer_id = a.artificer_id), 0.00) as ordersScore,
(st_distance(point(a.longitude, a.latitude), point(#{longitude}, #{latitude})) * 111195) as distance,
v.vip_name as technicianTypeName,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) &lt;=7 THEN 1 ELSE 2 END) AS isNewer
from artificer a
left join tb_user u on a.user_id = u.user_id
left join sys_dict s on s.id=a.classify_id

View File

@ -54,7 +54,7 @@
</delete>
<select id="findPackageAndMassagePage" resultType="com.sqx.modules.bl.massage.entity.MassagePackage">
select a.id,title,a.type,b.value as type_name,old_price,price,package_img,content,content_img,add_num,sales,labels,'套餐' as flag
select a.id,title,a.type,b.value as type_name,old_price,price,package_img,content,content_img,add_num,sales,labels,'套餐' as flag,is_can_coupon,is_can_vip
from bl_massage_package a
left join sys_dict b on a.type = b.id
where a.status = 1
@ -62,7 +62,7 @@
and (a.city like concat('%',#{params.city},'%') or a.city='不限')
</if>
union all
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag,1 as is_can_coupon,1 as is_can_vip
from massage_type a
left join sys_dict b on a.classify_id = b.id
where a.status = 1

View File

@ -26,9 +26,10 @@
</update>
<select id="selectCouponByUserId" resultType="com.sqx.modules.coupon.entity.CouponUser">
select tcu.*, tu.user_name as nickName, tu.avatar as avatar, tu.phone as phone
select tcu.*, tu.user_name as nickName, tu.avatar as avatar, tu.phone as phone,d.value as classifyName
from coupon_user tcu
left join tb_user tu on tcu.user_id = tu.user_id
left join sys_dict d on tcu.classify_id = d.id
where 1 = 1
<if test="userId!=null">
and tcu.user_id = #{userId}