chenjiahe
2024-02-22 ba0b13e643b3993464264be6683765bfa8211451
爆款活动
2个文件已添加
7个文件已修改
259 ■■■■■ 已修改文件
phi_platform_common/src/main/java/com/hx/phip/enums/SysFunctionLimitEnum.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/tool/money/MoneyRuleTool.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/OrdersTotalMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderControllerV2.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserMoneyUnclaimedController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/impl/UserMoneyServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/userMoney/impl/UserMoneyUnclaimedServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/UserMoneyUtil.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/enums/SysFunctionLimitEnum.java
New file
@@ -0,0 +1,91 @@
package com.hx.phip.enums;
import com.hx.phip.tool.money.MoneyRuleTool;
import com.hx.util.StringUtils;
import java.util.Arrays;
/**
 *  限制[用于金额底层配置关联]
 */
public enum SysFunctionLimitEnum {
    /**执行过*/
    RECEIVE_LIMIT_DEDUCTION("1","已执行关联订单项目"){
        @Override
        Boolean checkPass(String userId,String orderId) {
            return MoneyRuleTool.deduction(orderId);
        }
    },
    /**邀请用户下单*/
    RECEIVE_LIMIT_INVITE_ORDER("1","邀请用户下单"){
        @Override
        Boolean checkPass(String userId,String orderId) {
            return MoneyRuleTool.inviteOrder(orderId);
        }
    },
    ;
    /**序号*/
    private String code;
    /**名称*/
    private String name;
    SysFunctionLimitEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    /**校验是否满足--抽象方法*/
    abstract Boolean checkPass(String userId,String orderId);
    /**
     * 校验是否存在
     */
    public static Boolean checkCode(String code) {
        return Arrays.stream(SysFunctionLimitEnum.values()).anyMatch(a -> a.getCode().equals(code));
    }
    /**
     * 根据编号获取名称
     */
    public static String getNameByCode(String code) {
        for (SysFunctionLimitEnum sysFunctionLimitEnum : SysFunctionLimitEnum.values()) {
            if (sysFunctionLimitEnum.getCode().equals(code)) {
                return sysFunctionLimitEnum.getName();
            }
        }
        return null;
    }
    /**
     * 校验是否满足
     */
    public static Boolean checkPassByCode(String code,String userId,String orderId) {
        if (StringUtils.noNull(code)){
            for (SysFunctionLimitEnum value : SysFunctionLimitEnum.values()) {
                if (code.equals(value.getCode())){
                    return value.checkPass(userId,orderId);
                }
            }
        }
        return false;
    }
}
phi_platform_common/src/main/java/com/hx/phip/tool/money/MoneyRuleTool.java
New file
@@ -0,0 +1,69 @@
package com.hx.phip.tool.money;
import com.hx.common.service.CommonService;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.OrderTotalConstants;
import com.hx.phiappt.model.BaseEntity;
import com.hx.phip.dao.mapper.DeductionSingleMapper;
import com.hx.phip.dao.mapper.OrdersTotalMapper;
import com.hx.util.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
 * 金额规则领取校验
 */
@Component
public class MoneyRuleTool {
    @Resource
    private CommonService commonService;
    /**
     * 注入service
     */
    private static MoneyRuleTool moneyRuleTool;
    @PostConstruct
    public void init() {
        moneyRuleTool = this;
        moneyRuleTool.commonService = this.commonService;
    }
    /**订单是否划扣过*/
    public static Boolean deduction(String ordersTotalId) {
        if (StringUtils.isEmpty(ordersTotalId)){
            return false;
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> sqlMap = new HashMap<>();
        sqlMap.put("isDel",BaseEntity.NO);
        sqlMap.put("ordersTotalId",ordersTotalId);
        StringBuilder sql = new StringBuilder();
        sql.append(" SELECT COUNT(*) AS orderClassify FROM deduction_single AS ds ");
        sql.append(" JOIN deduction_project AS dp ON dp.deductionSingleId = ds.id ");
        sql.append(" JOIN user_project_item AS u ON u.id = dp.userProjectItemId ");
        sql.append(" WHERE ds.isDel = #{m.isDel} AND dp.isDel = #{m.isDel} AND u.isDel = #{m.isDel}");
        sql.append(" AND u.ordersTotalId = #{m.ordersTotalId} ");
        sqlSentence.sqlSentence(sql.toString(),sqlMap);
        return moneyRuleTool.commonService.selectCountSql(DeductionSingleMapper.class, sqlSentence) > 0;
    }
    /**邀请用户下单*/
    public static Boolean inviteOrder(String ordersTotalId) {
        if (StringUtils.isEmpty(ordersTotalId)){
            return false;
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> sqlMap = new HashMap<>();
        sqlMap.put("id",ordersTotalId);
        sqlMap.put("payStatus", OrderTotalConstants.PAY_STATUS_SUC);
        sqlMap.put("status", OrderTotalConstants.STATUS_CANCEL);
        sqlSentence.sqlSentence("SELECT COUNT(*) FROM orders_total WHERE isDel = 0 AND id = #{m.id} AND payStatus = #{m.payStatus} AND status != #{m.status}",sqlMap);
        return moneyRuleTool.commonService.selectCountSql(OrdersTotalMapper.class, sqlSentence) > 0;
    }
}
phi_platform_common/src/main/resources/mapper/platform/OrdersTotalMapper.xml
@@ -8,7 +8,7 @@
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,orderNo = #{orderNo},orderClassify = #{orderClassify},type = #{type},koapOrderId = #{koapOrderId},hisSynStatus = #{hisSynStatus},sealStatus = #{sealStatus},hisOrderId = #{hisOrderId},appointmentId = #{appointmentId},remarks = #{remarks},payTime = #{payTime},cancelTime = #{cancelTime},appId = #{appId},appIdCode = #{appIdCode},sourceCode = #{sourceCode},sourceName = #{sourceName},sourceOrderNo = #{sourceOrderNo},inviteeType = #{inviteeType},inviteeId = #{inviteeId},inviteeName = #{inviteeName},userBelongingType = #{userBelongingType},channelType = #{channelType},commonId = #{commonId},commonName = #{commonName},isGenerationPay = #{isGenerationPay},payUserId = #{payUserId},payUserNo = #{payUserNo},payUserName = #{payUserName},payUserCIQ = #{payUserCIQ},payUserMemberId = #{payUserMemberId},payUserMemberNo = #{payUserMemberNo},payUserLevel = #{payUserLevel},payUserAdviserId = #{payUserAdviserId},payUserAdviserNo = #{payUserAdviserNo},payUserAdviserName = #{payUserAdviserName},payUserShopId = #{payUserShopId},payUserShopNo = #{payUserShopNo},payUserShopName = #{payUserShopName},cjLabel = #{cjLabel},beauticianCorpUserId = #{beauticianCorpUserId},beauticianCorpUserName = #{beauticianCorpUserName},cashierId = #{cashierId},cashierName = #{cashierName},cashierShopId = #{cashierShopId},cashierShopName = #{cashierShopName},isSwitch = #{isSwitch},syncStatus = #{syncStatus},status = #{status},payStatus = #{payStatus},refundStatus = #{refundStatus},applyStatus = #{applyStatus},shopId = #{shopId},shopName = #{shopName},operatorType = #{operatorType},operatorId = #{operatorId},operatorName = #{operatorName},developerShopId = #{developerShopId},developerShopName = #{developerShopName},developerId = #{developerId},developerName = #{developerName},departmentCode = #{departmentCode},departmentName = #{departmentName},beauticianId = #{beauticianId},beauticianName = #{beauticianName},doctorId = #{doctorId},doctorName = #{doctorName},userId = #{userId},userName = #{userName},CIQ = #{CIQ},storedValueFund = #{storedValueFund},valueAddedFund = #{valueAddedFund},integral = #{integral},userLevel = #{userLevel},userShopId = #{userShopId},userShopNo = #{userShopNo},userShopName = #{userShopName},oriTotal = #{oriTotal},total = #{total},shouldTotal = #{shouldTotal},actualTotal = #{actualTotal},payTotal = #{payTotal},payRecharge = #{payRecharge},payIncrement = #{payIncrement},discountTotal = #{discountTotal},activityTotal = #{activityTotal},couponTotal = #{couponTotal},discountIntegral = #{discountIntegral},oriIntegralTotal = #{oriIntegralTotal},proIntegralTotal = #{proIntegralTotal},totalPoints = #{totalPoints},shouldTotalPoints = #{shouldTotalPoints},actualTotalPoints = #{actualTotalPoints},reTotal = #{reTotal},reIntegralTotal = #{reIntegralTotal},reCashTotal = #{reCashTotal},reCashPurenessTotal = #{reCashPurenessTotal},reRechargeTotal = #{reRechargeTotal},reIncrementTotal = #{reIncrementTotal},conversionCode = #{conversionCode},isSyncOrder = #{isSyncOrder},addTime = #{addTime},addWay = #{addWay},isGroupBuy = #{isGroupBuy},activityPageType = #{activityPageType},activityPageCode = #{activityPageCode},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
            ,orderNo = #{orderNo},orderClassify = #{orderClassify},type = #{type},koapOrderId = #{koapOrderId},hisSynStatus = #{hisSynStatus},sealStatus = #{sealStatus},hisOrderId = #{hisOrderId},appointmentId = #{appointmentId},remarks = #{remarks},payTime = #{payTime},cancelTime = #{cancelTime},appId = #{appId},appIdCode = #{appIdCode},sourceCode = #{sourceCode},sourceName = #{sourceName},sourceOrderNo = #{sourceOrderNo},inviteeType = #{inviteeType},inviteeId = #{inviteeId},inviteeName = #{inviteeName},userBelongingType = #{userBelongingType},channelType = #{channelType},commonId = #{commonId},commonName = #{commonName},isGenerationPay = #{isGenerationPay},payUserId = #{payUserId},payUserNo = #{payUserNo},payUserName = #{payUserName},payUserCIQ = #{payUserCIQ},payUserMemberId = #{payUserMemberId},payUserMemberNo = #{payUserMemberNo},payUserLevel = #{payUserLevel},payUserAdviserId = #{payUserAdviserId},payUserAdviserNo = #{payUserAdviserNo},payUserAdviserName = #{payUserAdviserName},payUserShopId = #{payUserShopId},payUserShopNo = #{payUserShopNo},payUserShopName = #{payUserShopName},cjLabel = #{cjLabel},beauticianCorpUserId = #{beauticianCorpUserId},beauticianCorpUserName = #{beauticianCorpUserName},cashierId = #{cashierId},cashierName = #{cashierName},cashierShopId = #{cashierShopId},cashierShopName = #{cashierShopName},isSwitch = #{isSwitch},syncStatus = #{syncStatus},status = #{status},payStatus = #{payStatus},refundStatus = #{refundStatus},applyStatus = #{applyStatus},shopId = #{shopId},shopName = #{shopName},operatorType = #{operatorType},operatorId = #{operatorId},operatorName = #{operatorName},developerShopId = #{developerShopId},developerShopName = #{developerShopName},developerId = #{developerId},developerName = #{developerName},departmentCode = #{departmentCode},departmentName = #{departmentName},beauticianId = #{beauticianId},beauticianName = #{beauticianName},doctorId = #{doctorId},doctorName = #{doctorName},userId = #{userId},userName = #{userName},CIQ = #{CIQ},storedValueFund = #{storedValueFund},valueAddedFund = #{valueAddedFund},integral = #{integral},userLevel = #{userLevel},userShopId = #{userShopId},userShopNo = #{userShopNo},userShopName = #{userShopName},oriTotal = #{oriTotal},total = #{total},shouldTotal = #{shouldTotal},actualTotal = #{actualTotal},payTotal = #{payTotal},payRecharge = #{payRecharge},payIncrement = #{payIncrement},discountTotal = #{discountTotal},activityTotal = #{activityTotal},couponTotal = #{couponTotal},discountIntegral = #{discountIntegral},oriIntegralTotal = #{oriIntegralTotal},proIntegralTotal = #{proIntegralTotal},totalPoints = #{totalPoints},shouldTotalPoints = #{shouldTotalPoints},actualTotalPoints = #{actualTotalPoints},reTotal = #{reTotal},reIntegralTotal = #{reIntegralTotal},reCashTotal = #{reCashTotal},reCashPurenessTotal = #{reCashPurenessTotal},reRechargeTotal = #{reRechargeTotal},reIncrementTotal = #{reIncrementTotal},conversionCode = #{conversionCode},isSyncOrder = #{isSyncOrder},addTime = #{addTime},addWay = #{addWay},isGroupBuy = #{isGroupBuy},activityPageType = #{activityPageType},activityPageCode = #{activityPageCode},activityPageName = #{activityPageName},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
     
@@ -19,11 +19,11 @@
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into orders_total (id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,isDel,createTime,editTime)  values (#{id},#{orderNo},#{orderClassify},#{type},#{koapOrderId},#{hisSynStatus},#{sealStatus},#{hisOrderId},#{appointmentId},#{remarks},#{payTime},#{cancelTime},#{appId},#{appIdCode},#{sourceCode},#{sourceName},#{sourceOrderNo},#{inviteeType},#{inviteeId},#{inviteeName},#{userBelongingType},#{channelType},#{commonId},#{commonName},#{isGenerationPay},#{payUserId},#{payUserNo},#{payUserName},#{payUserCIQ},#{payUserMemberId},#{payUserMemberNo},#{payUserLevel},#{payUserAdviserId},#{payUserAdviserNo},#{payUserAdviserName},#{payUserShopId},#{payUserShopNo},#{payUserShopName},#{cjLabel},#{beauticianCorpUserId},#{beauticianCorpUserName},#{cashierId},#{cashierName},#{cashierShopId},#{cashierShopName},#{isSwitch},#{syncStatus},#{status},#{payStatus},#{refundStatus},#{applyStatus},#{shopId},#{shopName},#{operatorType},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{departmentCode},#{departmentName},#{beauticianId},#{beauticianName},#{doctorId},#{doctorName},#{userId},#{userName},#{CIQ},#{storedValueFund},#{valueAddedFund},#{integral},#{userLevel},#{userShopId},#{userShopNo},#{userShopName},#{oriTotal},#{total},#{shouldTotal},#{actualTotal},#{payTotal},#{payRecharge},#{payIncrement},#{discountTotal},#{activityTotal},#{couponTotal},#{discountIntegral},#{oriIntegralTotal},#{proIntegralTotal},#{totalPoints},#{shouldTotalPoints},#{actualTotalPoints},#{reTotal},#{reIntegralTotal},#{reCashTotal},#{reCashPurenessTotal},#{reRechargeTotal},#{reIncrementTotal},#{conversionCode},#{isSyncOrder},#{addTime},#{addWay},#{isGroupBuy},#{activityPageType},#{activityPageCode},#{isDel},#{createTime},#{editTime})
        insert into orders_total (id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,activityPageName,isDel,createTime,editTime)  values (#{id},#{orderNo},#{orderClassify},#{type},#{koapOrderId},#{hisSynStatus},#{sealStatus},#{hisOrderId},#{appointmentId},#{remarks},#{payTime},#{cancelTime},#{appId},#{appIdCode},#{sourceCode},#{sourceName},#{sourceOrderNo},#{inviteeType},#{inviteeId},#{inviteeName},#{userBelongingType},#{channelType},#{commonId},#{commonName},#{isGenerationPay},#{payUserId},#{payUserNo},#{payUserName},#{payUserCIQ},#{payUserMemberId},#{payUserMemberNo},#{payUserLevel},#{payUserAdviserId},#{payUserAdviserNo},#{payUserAdviserName},#{payUserShopId},#{payUserShopNo},#{payUserShopName},#{cjLabel},#{beauticianCorpUserId},#{beauticianCorpUserName},#{cashierId},#{cashierName},#{cashierShopId},#{cashierShopName},#{isSwitch},#{syncStatus},#{status},#{payStatus},#{refundStatus},#{applyStatus},#{shopId},#{shopName},#{operatorType},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{departmentCode},#{departmentName},#{beauticianId},#{beauticianName},#{doctorId},#{doctorName},#{userId},#{userName},#{CIQ},#{storedValueFund},#{valueAddedFund},#{integral},#{userLevel},#{userShopId},#{userShopNo},#{userShopName},#{oriTotal},#{total},#{shouldTotal},#{actualTotal},#{payTotal},#{payRecharge},#{payIncrement},#{discountTotal},#{activityTotal},#{couponTotal},#{discountIntegral},#{oriIntegralTotal},#{proIntegralTotal},#{totalPoints},#{shouldTotalPoints},#{actualTotalPoints},#{reTotal},#{reIntegralTotal},#{reCashTotal},#{reCashPurenessTotal},#{reRechargeTotal},#{reIncrementTotal},#{conversionCode},#{isSyncOrder},#{addTime},#{addWay},#{isGroupBuy},#{activityPageType},#{activityPageCode},#{activityPageName},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.order.OrdersTotal">
        insert into orders_total (id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,isDel,createTime,editTime)  values (#{id},#{orderNo},#{orderClassify},#{type},#{koapOrderId},#{hisSynStatus},#{sealStatus},#{hisOrderId},#{appointmentId},#{remarks},#{payTime},#{cancelTime},#{appId},#{appIdCode},#{sourceCode},#{sourceName},#{sourceOrderNo},#{inviteeType},#{inviteeId},#{inviteeName},#{userBelongingType},#{channelType},#{commonId},#{commonName},#{isGenerationPay},#{payUserId},#{payUserNo},#{payUserName},#{payUserCIQ},#{payUserMemberId},#{payUserMemberNo},#{payUserLevel},#{payUserAdviserId},#{payUserAdviserNo},#{payUserAdviserName},#{payUserShopId},#{payUserShopNo},#{payUserShopName},#{cjLabel},#{beauticianCorpUserId},#{beauticianCorpUserName},#{cashierId},#{cashierName},#{cashierShopId},#{cashierShopName},#{isSwitch},#{syncStatus},#{status},#{payStatus},#{refundStatus},#{applyStatus},#{shopId},#{shopName},#{operatorType},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{departmentCode},#{departmentName},#{beauticianId},#{beauticianName},#{doctorId},#{doctorName},#{userId},#{userName},#{CIQ},#{storedValueFund},#{valueAddedFund},#{integral},#{userLevel},#{userShopId},#{userShopNo},#{userShopName},#{oriTotal},#{total},#{shouldTotal},#{actualTotal},#{payTotal},#{payRecharge},#{payIncrement},#{discountTotal},#{activityTotal},#{couponTotal},#{discountIntegral},#{oriIntegralTotal},#{proIntegralTotal},#{totalPoints},#{shouldTotalPoints},#{actualTotalPoints},#{reTotal},#{reIntegralTotal},#{reCashTotal},#{reCashPurenessTotal},#{reRechargeTotal},#{reIncrementTotal},#{conversionCode},#{isSyncOrder},#{addTime},#{addWay},#{isGroupBuy},#{activityPageType},#{activityPageCode},#{isDel},#{createTime},#{editTime})
        insert into orders_total (id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,activityPageName,isDel,createTime,editTime)  values (#{id},#{orderNo},#{orderClassify},#{type},#{koapOrderId},#{hisSynStatus},#{sealStatus},#{hisOrderId},#{appointmentId},#{remarks},#{payTime},#{cancelTime},#{appId},#{appIdCode},#{sourceCode},#{sourceName},#{sourceOrderNo},#{inviteeType},#{inviteeId},#{inviteeName},#{userBelongingType},#{channelType},#{commonId},#{commonName},#{isGenerationPay},#{payUserId},#{payUserNo},#{payUserName},#{payUserCIQ},#{payUserMemberId},#{payUserMemberNo},#{payUserLevel},#{payUserAdviserId},#{payUserAdviserNo},#{payUserAdviserName},#{payUserShopId},#{payUserShopNo},#{payUserShopName},#{cjLabel},#{beauticianCorpUserId},#{beauticianCorpUserName},#{cashierId},#{cashierName},#{cashierShopId},#{cashierShopName},#{isSwitch},#{syncStatus},#{status},#{payStatus},#{refundStatus},#{applyStatus},#{shopId},#{shopName},#{operatorType},#{operatorId},#{operatorName},#{developerShopId},#{developerShopName},#{developerId},#{developerName},#{departmentCode},#{departmentName},#{beauticianId},#{beauticianName},#{doctorId},#{doctorName},#{userId},#{userName},#{CIQ},#{storedValueFund},#{valueAddedFund},#{integral},#{userLevel},#{userShopId},#{userShopNo},#{userShopName},#{oriTotal},#{total},#{shouldTotal},#{actualTotal},#{payTotal},#{payRecharge},#{payIncrement},#{discountTotal},#{activityTotal},#{couponTotal},#{discountIntegral},#{oriIntegralTotal},#{proIntegralTotal},#{totalPoints},#{shouldTotalPoints},#{actualTotalPoints},#{reTotal},#{reIntegralTotal},#{reCashTotal},#{reCashPurenessTotal},#{reRechargeTotal},#{reIncrementTotal},#{conversionCode},#{isSyncOrder},#{addTime},#{addWay},#{isGroupBuy},#{activityPageType},#{activityPageCode},#{activityPageName},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.order.OrdersTotal" parameterType="com.hx.mybatisTool.SqlSentence" >
@@ -55,14 +55,14 @@
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.order.OrdersTotal" parameterType="java.lang.Object" >
        select 
            id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,isDel,createTime,editTime
            id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,activityPageName,isDel,createTime,editTime
        from orders_total
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.order.OrdersTotal" parameterType="java.lang.Object" >
        select 
            id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,isDel,createTime,editTime
            id,orderNo,orderClassify,type,koapOrderId,hisSynStatus,sealStatus,hisOrderId,appointmentId,remarks,payTime,cancelTime,appId,appIdCode,sourceCode,sourceName,sourceOrderNo,inviteeType,inviteeId,inviteeName,userBelongingType,channelType,commonId,commonName,isGenerationPay,payUserId,payUserNo,payUserName,payUserCIQ,payUserMemberId,payUserMemberNo,payUserLevel,payUserAdviserId,payUserAdviserNo,payUserAdviserName,payUserShopId,payUserShopNo,payUserShopName,cjLabel,beauticianCorpUserId,beauticianCorpUserName,cashierId,cashierName,cashierShopId,cashierShopName,isSwitch,syncStatus,status,payStatus,refundStatus,applyStatus,shopId,shopName,operatorType,operatorId,operatorName,developerShopId,developerShopName,developerId,developerName,departmentCode,departmentName,beauticianId,beauticianName,doctorId,doctorName,userId,userName,CIQ,storedValueFund,valueAddedFund,integral,userLevel,userShopId,userShopNo,userShopName,oriTotal,total,shouldTotal,actualTotal,payTotal,payRecharge,payIncrement,discountTotal,activityTotal,couponTotal,discountIntegral,oriIntegralTotal,proIntegralTotal,totalPoints,shouldTotalPoints,actualTotalPoints,reTotal,reIntegralTotal,reCashTotal,reCashPurenessTotal,reRechargeTotal,reIncrementTotal,conversionCode,isSyncOrder,addTime,addWay,isGroupBuy,activityPageType,activityPageCode,activityPageName,isDel,createTime,editTime
        from orders_total
        WHERE id = #{value}
    </select>
@@ -105,6 +105,7 @@
    
    
    
@@ -121,6 +122,7 @@
    
    
    
@@ -179,6 +181,7 @@
    
    
    
    <update id="updatePay">
        update
            orders_total
phi_platform_user/src/main/java/com/hx/phip/controller/order/OrderControllerV2.java
@@ -360,16 +360,16 @@
        //执行结账方法,结账成功要注意运行重新算订单部分金额信息方法
        Map<String, Object> map = orderServiceV2.orderPayMoney(payDto.getCouponCheckVersion(), ordersTotal,user,payUser,shop,info,orderItemList,operator,userMoney,userCouponIds,payDto,thirtApplication);
        //赠送增值金
        if(payDto.getGiveIncrease() != null && payDto.getGiveIncrease().compareTo(BigDecimal.ZERO) > 0){
            UserMoneyUtil.setNewUserMoneyUnclaimed(payDto.getPayUserId(),"老带新赠送(邀请人):邀请人增值金","结账处理老带新",ordersTotal.getOperatorId(),ordersTotal.getId(),ordersTotal.getAppIdCode(),ordersTotal.getId(),inviterMoney, UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND, OperationReasonConstants.OP_REASON_BRING_NEW_USER_GIFT,commonService,UserMoneyUnclaimed.YES);
        }
        if(map!=null && map.containsKey("orderId")){
            OrdersTotal sucOrdersTotal=commonService.selectOneByKey(OrdersTotalMapper.class,map.get("orderId"));
            if(OrderTotalConstants.PAY_STATUS_SUC==sucOrdersTotal.getPayStatus()){
                //处理再生俱乐部会员
                threadPool.getThreadPool().execute(() -> userCluebMemberServiceTool.orderChekMember(ordersTotal.getId(),null,null,MarketSystem.TYPE_REGENERATION));
                //赠送增值金
                if(payDto.getGiveIncrease() != null && payDto.getGiveIncrease().compareTo(BigDecimal.ZERO) > 0){
                    threadPool.getThreadPool().execute(() -> UserMoneyUtil.setUserMoneyHandle(payDto.getGiveIncreaseUserId(),UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND,payDto.getGiveIncrease(),BaseEntity.YES,OperationReasonConstants.OP_REASON_INVITE_ORDER,"好友下单-活动赠送","好友("+user.getName()+")下单赠送",ordersTotal.getOperatorId()
                            ,ordersTotal.getId(),ordersTotal.getActivityPageCode(),payDto.getGiveIncreaseId(),commonService));
                }
                //处理老带新
                JSONObject commissionObject = handOrderOldNew(ordersTotal, user);
                //更新用户最后下单时间
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserMoneyUnclaimedController.java
@@ -1,13 +1,12 @@
package com.hx.phip.controller.user;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hx.common.BaseController;
import com.hx.exception.TipsException;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.PlatformConstants;
import com.hx.phiappt.constants.enums.SysFunctionLimitEnum;
import com.hx.phip.enums.SysFunctionLimitEnum;
import com.hx.phiappt.constants.tool.employee.EmployeeTool;
import com.hx.phiappt.constants.tool.money.UserMoneyTool;
import com.hx.phiappt.dao.mapper.UserMoneyUnclaimedMapper;
phi_platform_user/src/main/java/com/hx/phip/service/impl/UserMoneyServiceImpl.java
@@ -1009,6 +1009,9 @@
            case OperationReasonConstants.OP_REASON_INVITE_ORDER:
                userMoneyLog.setRecordType(UserMoneyLog.RECORD_TYPE_INVITE_ORDER);
                break;
            case OperationReasonConstants.OP_REASON_INVITE_ORDER_CANCEL:
                userMoneyLog.setRecordType(UserMoneyLog.RECORD_TYPE_INVITE_ORDER_CANCEL);
                break;
            case OperationReasonConstants.OP_REASON_GIFT_0701:
                userMoneyLog.setRecordType(UserMoneyLog.RECORD_TYPE_REASON_GIFT_0701);
                break;
phi_platform_user/src/main/java/com/hx/phip/service/userMoney/impl/UserMoneyUnclaimedServiceImpl.java
@@ -10,7 +10,7 @@
import com.hx.phiappt.common.OrderItemConstants;
import com.hx.phiappt.common.OriginChannelConstants;
import com.hx.phiappt.common.PlatformConstants;
import com.hx.phiappt.constants.enums.SysFunctionLimitEnum;
import com.hx.phip.enums.SysFunctionLimitEnum;
import com.hx.phiappt.constants.tool.TimerHandleTool;
import com.hx.phiappt.constants.tool.UserInfoTool;
import com.hx.phiappt.constants.tool.money.UserMoneyTool;
phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
@@ -135,6 +135,8 @@
        //处理总退款方式数据
        refundCarryVo = refundRecordMotnedHandle(refundCarryVo,operationId,operationNme,refundRecord,ordersTotal,commonService);
        //更改总订单退款状态
        values.clear();
        values.put("orderId",ordersTotal.getId());
@@ -895,6 +897,60 @@
        }
    }
    /**页面活动赠送的增值金退款处理
     * @param ordersTotal 订单
     * @param refundRecord 退款订单
     * @param operationId 操作人标识
     * @param circulateNum 避免死循环,调用的时候传0
     * @param commonService 映射
     */
    public static void activityPageGiveIncrease(OrdersTotal ordersTotal,RefundRecord refundRecord,String operationId,int circulateNum,CommonService commonService){
        if(circulateNum > 1){
            return;
        }
        if(ordersTotal.getActivityPageType() != OrderTotalConstants.ACTIVITY_TYPE_BURST){
            return;
        }
        //订单取消状态才处理
        if(ordersTotal.getStatus() != OrderTotalConstants.STATUS_CANCEL){
            return;
        }
        //查找领取记录释放存在
        //领取记录是否已领取
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        values.put("orderId",ordersTotal.getId());
        values.put("commonId",ordersTotal.getActivityPageCode());
        sqlSentence.sqlSentence("SELECT * FROM user_money_unclaimed WHERE isDel = 0 AND orderId = #{m.orderId} AND commonId = #{m.commonId}",values);
        UserMoneyUnclaimed userMoneyUnclaimed = commonService.selectOne(UserMoneyUnclaimedMapper.class,sqlSentence);
        if(userMoneyUnclaimed == null){
            return;
        }
        if(userMoneyUnclaimed.getStatus() == UserMoneyUnclaimed.STATUS_SUCCEED){
            //已领取,那么就扣回来
            if(userMoneyUnclaimed.getOpNumber().compareTo(BigDecimal.ZERO) < 1){
                return;
            }
            UserMoneyUtil.setUserMoneyHandle(userMoneyUnclaimed.getUserId(),UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND,userMoneyUnclaimed.getOpNumber().negate(),BaseEntity.NO,OperationReasonConstants.OP_REASON_INVITE_ORDER_CANCEL,"好友订单退款-活动赠送扣除["+ordersTotal.getOrderNo()+"]","操作原因:退款审核通过,活动赠送扣除资金,退款方式:退回增值金",ordersTotal.getOperatorId()
                    ,ordersTotal.getId(),ordersTotal.getActivityPageCode(),null,commonService);
        }else{
            //没有领取就作废
            values.put("id",userMoneyUnclaimed.getId());
            values.put("isValid",UserMoneyUnclaimed.NO);
            values.put("status",UserMoneyUnclaimed.STATUS_WAI);
            sqlSentence.sqlWhere("isValid = #{m.isValid} WHERE id = #{m.id} AND status = #{m.status}",values);
            if(commonService.updateWhere(UserMoneyUnclaimedMapper.class,sqlSentence) != 1){
                circulateNum++;
                activityPageGiveIncrease(ordersTotal,refundRecord,operationId,circulateNum,commonService);
            }
        }
    }
    /**
     * 退款-处理活动规则增值金和积分
     */
phi_platform_user/src/main/java/com/hx/phip/util/api/UserMoneyUtil.java
@@ -464,23 +464,27 @@
     * @param userId 用户标识,处理的用户
     * @param fundType 资金类型(UserMoneyUnclaimed):储值金 0、增值金 1、积分 2、预定金 3
     * @param worth 操作金额(单位元)
     * @param opType 操作类型 是否需要领取(0 否系统处理 1 是需要用户领取后处理)
     * @param operationReason 操作类型(OperationReasonConstants)
     * @param originSubject  标题
     * @param remark  备注
     * @param operatorId 操作人
     * @param orderId 订单标识
     * @param commonId 公共标识(更具体的来源)
     * @param commonService
     * @param moneyRuleId 金额处理规则
     * @param commonService 映射
     */
    public static void setUserMoneyHandle(String userId,Integer fundType,BigDecimal worth,String operationReason,String originSubject
            ,String remark,String operatorId,String orderId,String commonId,CommonService commonService) {
    public static void setUserMoneyHandle(String userId,Integer fundType,BigDecimal worth,Integer opType,String operationReason,String originSubject
            ,String remark,String operatorId,String orderId,String commonId,String moneyRuleId,CommonService commonService) {
        UserMoneyUnclaimed userMoneyUnclaimed=new UserMoneyUnclaimed();
        userMoneyUnclaimed.setUserId(userId);
        userMoneyUnclaimed.setFundType(fundType);
        userMoneyUnclaimed.setMoneyRuleId(moneyRuleId);
        userMoneyUnclaimed.setOriginChannel(OriginChannelConstants.ORIGIN_CHANNEL_PHIS_COMMON);
        userMoneyUnclaimed.setOperationReason(operationReason);
        userMoneyUnclaimed.setOpType(BaseEntity.YES);
        userMoneyUnclaimed.setOpType(opType);
        userMoneyUnclaimed.setCommonId(commonId);
        userMoneyUnclaimed.setOpNumber(worth);
        Map<String, String> operator = ApiOrderUtil.getOperator(commonService, operatorId);//获取操作人信息