chenjiahe
2024-01-19 d83d729f80576bb4c7e73bcfff5c403a23f23b82
再生俱乐部首次提交
7个文件已添加
2个文件已修改
675 ■■■■■ 已修改文件
phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/MarketSystemMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/MarketSystemProjectMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserClubMemberMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/tool/club/UserCluebMemberTool.java 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/MarketSystemMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/MarketSystemProjectMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/UserClubMemberMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/AutoDomeUtil.java
@@ -10,10 +10,13 @@
import com.hx.phiappt.model.cardItem.CardEquity;
import com.hx.phiappt.model.consume.ConsumeNotify;
import com.hx.phiappt.model.consume.PayNo;
import com.hx.phiappt.model.market.system.MarketSystem;
import com.hx.phiappt.model.market.system.MarketSystemProject;
import com.hx.phiappt.model.order.*;
import com.hx.phiappt.model.project.ProjectShopPrice;
import com.hx.phiappt.model.refund.*;
import com.hx.phiappt.model.user.*;
import com.hx.phiappt.model.user.club.UserClubMember;
/**
 * 自动生成工具 
@@ -42,7 +45,7 @@
        urlData.serviceImplUrlData(controllerPackRoot,packageName + ".service.impl");
        urlData.mapperUrlData(commonPackRootResourse, "mapper.platform");
        Class<?> clas = OrderInfo.class;
        Class<?> clas = UserClubMember.class;
        //dao
         GeneratorUtil.generatorDao(clas,urlData);
        //mapper
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/MarketSystemMapper.java
New file
@@ -0,0 +1,37 @@
package com.hx.phip.dao.mapper;
import java.util.List;
import java.util.Map;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.market.system.MarketSystem;
public interface MarketSystemMapper {
    /**新增,返回主键*/
    int insert(MarketSystem marketSystem);
    /**新增,返回主键*/
    int insertById(MarketSystem marketSystem);
    /**查询条数*/
    int selectCount(SqlSentence sqlSentence);
    /**查询条数*/
    int selectCountSql(SqlSentence sqlSentence);
    /**查询列表,返回实体类的List*/
    List<MarketSystem> selectList(SqlSentence sqlSentence);
    /**查询列表,返回Map的List*/
    List<Map<String,Object>> selectListMap(SqlSentence sqlSentence);
    /**查询,返回单个实体*/
    MarketSystem selectOne(SqlSentence sqlSentence);
    /**查询,返回单个map*/
    Map<String,Object> selectOneMap(SqlSentence sqlSentence);
    /**查询,返回实体类没有大数据的*/
    MarketSystem selectOneByKey(Object object);
    /**查询,返回实体类有大数据的*/
    MarketSystem selectOneByKeyBlob(Object object);
    /**更新,返回更新数量*/
    int updateWhere(SqlSentence sqlSentence);
    /**更新,返回更新数量*/
    int updateAll(MarketSystem marketSystem);
    /**删除,返回删除数量*/
    int deleteWhere(SqlSentence sqlSentence);
    /**删除,返回删除数量*/
    int deleteById(Object object);
}
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/MarketSystemProjectMapper.java
New file
@@ -0,0 +1,37 @@
package com.hx.phip.dao.mapper;
import java.util.List;
import java.util.Map;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.market.system.MarketSystemProject;
public interface MarketSystemProjectMapper {
    /**新增,返回主键*/
    int insert(MarketSystemProject marketSystemProject);
    /**新增,返回主键*/
    int insertById(MarketSystemProject marketSystemProject);
    /**查询条数*/
    int selectCount(SqlSentence sqlSentence);
    /**查询条数*/
    int selectCountSql(SqlSentence sqlSentence);
    /**查询列表,返回实体类的List*/
    List<MarketSystemProject> selectList(SqlSentence sqlSentence);
    /**查询列表,返回Map的List*/
    List<Map<String,Object>> selectListMap(SqlSentence sqlSentence);
    /**查询,返回单个实体*/
    MarketSystemProject selectOne(SqlSentence sqlSentence);
    /**查询,返回单个map*/
    Map<String,Object> selectOneMap(SqlSentence sqlSentence);
    /**查询,返回实体类没有大数据的*/
    MarketSystemProject selectOneByKey(Object object);
    /**查询,返回实体类有大数据的*/
    MarketSystemProject selectOneByKeyBlob(Object object);
    /**更新,返回更新数量*/
    int updateWhere(SqlSentence sqlSentence);
    /**更新,返回更新数量*/
    int updateAll(MarketSystemProject marketSystemProject);
    /**删除,返回删除数量*/
    int deleteWhere(SqlSentence sqlSentence);
    /**删除,返回删除数量*/
    int deleteById(Object object);
}
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserClubMemberMapper.java
New file
@@ -0,0 +1,37 @@
package com.hx.phip.dao.mapper;
import java.util.List;
import java.util.Map;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.user.club.UserClubMember;
public interface UserClubMemberMapper {
    /**新增,返回主键*/
    int insert(UserClubMember userClubMember);
    /**新增,返回主键*/
    int insertById(UserClubMember userClubMember);
    /**查询条数*/
    int selectCount(SqlSentence sqlSentence);
    /**查询条数*/
    int selectCountSql(SqlSentence sqlSentence);
    /**查询列表,返回实体类的List*/
    List<UserClubMember> selectList(SqlSentence sqlSentence);
    /**查询列表,返回Map的List*/
    List<Map<String,Object>> selectListMap(SqlSentence sqlSentence);
    /**查询,返回单个实体*/
    UserClubMember selectOne(SqlSentence sqlSentence);
    /**查询,返回单个map*/
    Map<String,Object> selectOneMap(SqlSentence sqlSentence);
    /**查询,返回实体类没有大数据的*/
    UserClubMember selectOneByKey(Object object);
    /**查询,返回实体类有大数据的*/
    UserClubMember selectOneByKeyBlob(Object object);
    /**更新,返回更新数量*/
    int updateWhere(SqlSentence sqlSentence);
    /**更新,返回更新数量*/
    int updateAll(UserClubMember userClubMember);
    /**删除,返回删除数量*/
    int deleteWhere(SqlSentence sqlSentence);
    /**删除,返回删除数量*/
    int deleteById(Object object);
}
phi_platform_common/src/main/java/com/hx/phip/tool/club/UserCluebMemberTool.java
New file
@@ -0,0 +1,285 @@
package com.hx.phip.tool.club;
import com.hx.common.service.CommonService;
import com.hx.exception.TipsException;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.OrderItemConstants;
import com.hx.phiappt.common.OrderTotalConstants;
import com.hx.phiappt.constants.enums.GroupTypeEnum;
import com.hx.phiappt.constants.enums.ProjectRelationTypeEnum;
import com.hx.phiappt.dao.mapper.ProjectTypeRelationMapper;
import com.hx.phiappt.model.cardItem.CardEquity;
import com.hx.phiappt.model.cardItem.CardItemInfo;
import com.hx.phiappt.model.market.system.MarketSystem;
import com.hx.phiappt.model.market.system.MarketSystemProject;
import com.hx.phiappt.model.order.OrderItem;
import com.hx.phiappt.model.order.OrderItemSon;
import com.hx.phiappt.model.order.OrdersTotal;
import com.hx.phiappt.model.project.ProjectTypeRelation;
import com.hx.phiappt.model.user.club.UserClubMember;
import com.hx.phip.dao.mapper.*;
import com.hx.util.DateUtil;
import java.util.*;
/**用户俱乐部会员
 * @author CJH
 */
public class UserCluebMemberTool {
    /**订单下单结账校验是否符合会员条件*/
    public static void orderChekMember(String orderId,Integer marketType, CommonService commonService){
        OrdersTotal ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class,orderId);
        if(ordersTotal == null){
            throw new TipsException("订单标识错误!");
        }
        //充值单跳过
        if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())){
            return;
        }
        //未支付跳过
        if(ordersTotal.getPayStatus() != OrderTotalConstants.PAY_STATUS_SUC){
            return;
        }
        //查询活动配置
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        values.put("type",marketType);
        sqlSentence.sqlSentence("SELECT * FROM market_system WHERE isDel = 0 AND isUp = 1 AND type = #{m.type}",values);
        MarketSystem marketSystem = commonService.selectOneByKey(MarketSystemMapper.class,sqlSentence);
        if(marketSystem == null){
            return;
        }
        //---判断是否在活动时间内
        if(marketSystem.getStartTime() != null){
            if(ordersTotal.getPayTime().getTime() < marketSystem.getStartTime().getTime()){
                return;
            }
        }
        if(marketSystem.getEndTime() != null){
            if(ordersTotal.getPayTime().getTime() > marketSystem.getEndTime().getTime()){
                return;
            }
        }
        //----获取指定的项目配置
        values.clear();
        values.put("marketSystemId",marketSystem.getId());
        sqlSentence.sqlSentence("SELECT type,typeCode,typeId FROM market_system_project WHERE isDel = 0 AND marketSystemId = #{m.marketSystemId}",values);
        List<MarketSystemProject> marketSystemProjectList = commonService.selectList(MarketSystemProjectMapper.class,sqlSentence);
        //指定活动项目编号匹配存储
        Set<String> skuNoSet = new HashSet<>();
        StringBuilder itemNameSql = new StringBuilder();
        for(MarketSystemProject marketSystemProject:marketSystemProjectList){
            if(marketSystemProject.getType() == MarketSystemProject.TYPE_PROJECT_MAPPER){
                if(itemNameSql.length() > 0){
                    itemNameSql.append(",");
                }
                itemNameSql.append("'").append(marketSystemProject.getTypeCode()).append("'");
            }else{
                skuNoSet.add(marketSystemProject.getTypeCode());
            }
        }
        if(itemNameSql.length() > 0){
            values.clear();
            values.put("moduleType", ProjectRelationTypeEnum.MODULE_TYPE_ZS_PROJECT.getCode());
            values.put("itemNameList",itemNameSql.toString());
            sqlSentence.sqlSentence("SELECT skuNo FROM project_type_relation WHERE isDel = 0 AND moduleType = 7 AND itemName IN(${m.itemNameList})",values);
            List<ProjectTypeRelation> projectTypeRelationList = commonService.selectList(ProjectTypeRelationMapper.class,sqlSentence);
            for(ProjectTypeRelation projectTypeRelation:projectTypeRelationList){
                skuNoSet.add(projectTypeRelation.getSkuNo());
            }
        }
        //---获取购买的子单
        values.clear();
        values.put("orderId",ordersTotal.getId());
        sqlSentence.sqlSentence("SELECT id,type,commonId,goodsNo,goodsName,usedTotal,hasReNum FROM order_item WHERE isDel = 0 AND orderId = #{m.orderId}",values);
        List<OrderItem> orderItemList = commonService.selectList(OrderItemMapper.class,sqlSentence);
        //已经算了疗程数的项目编号
        Set<String> mateSkuNoSet = new HashSet<>();
        //总疗程数,所有的项目疗程数总和
        int cureNum = 0;
        //存储卡项所有的子项,k值:权益标识
        Map<String,List<CardItemInfo>> cardItemInfoMapList;
        List<OrderItemSon> orderItemSonList;
        List<CardEquity> cardEquityList;
        List<CardItemInfo> cardItemInfoList;
        int cureItemMax;
        int cureItemNum;
        int deductionSurp;
        int deductionNum;
        for(OrderItem orderItem:orderItemList){
            if(OrderItemConstants.TYPE_PROJECT.equals(orderItem.getType())){
                //项目,没有包含
                if(skuNoSet.contains(orderItem.getGoodsNo())){
                    //疗程次数叠加,退款的也需要减去
                    cureNum = cureNum+orderItem.getUsedTotal()-orderItem.getHasReNum();
                }
            }else if(OrderItemConstants.TYPE_PROMOTION.equals(orderItem.getType())){
                //促销
                orderItemSonList = getOrderItemSonList(orderItem.getId(),OrderItemConstants.TYPE_PROJECT,commonService);
                for(OrderItemSon orderItemSon:orderItemSonList){
                    if(skuNoSet.contains(orderItemSon.getGoodsNo())){
                        //疗程次数叠加,退款的也需要减去
                        cureNum = cureNum+orderItem.getUsedTotal()-orderItem.getHasReNum();
                    }
                }
            }else if(OrderItemConstants.TYPE_CARD.equals(orderItem.getType())){
                //卡项,注意,不是卡包
                //TODO 退款没有减去
                cardEquityList = getCardEquityList(orderItem.getCommonId(),commonService);
                cardItemInfoMapList = getCardItemInfoList(orderItem.getCommonId(),commonService);
                for(CardEquity cardEquity:cardEquityList){
                    cardItemInfoList = cardItemInfoMapList.get(cardEquity.getId());
                    if(cardItemInfoList==null || cardItemInfoList.size()==0){
                        continue;
                    }
                    //判断权益类型
                    if(cardEquity.getEquityType().equals(CardEquity.EQUITY_TYPE_PROJECT)){
                        for(CardItemInfo cardItemInfo:cardItemInfoList){
                            //固定项目类型
                            if(cardItemInfo.getUserNum() != null){
                                cureNum = cureNum+cardItemInfo.getUserNum()*cardItemInfo.getMaxNum()*orderItem.getBuyNum();
                            }
                        }
                    }else if(cardEquity.getEquityType().equals(CardEquity.EQUITY_TYPE_TIME_CARD)){
                        //TODO 这里还没有做完
                        //只存储最大的一个疗程数
                        cureItemMax = 0;
                        //剩余抵扣次数
                        deductionSurp = cardEquity.getValue();
                        //次卡
                        for(CardItemInfo cardItemInfo:cardItemInfoList){
                            if(cardItemInfo.getUserNum() != null){
                                deductionNum = cardEquity.getValue()/cardItemInfo.getEveryDrawNum();
                                cureItemNum = cardItemInfo.getUserNum()*deductionNum*orderItem.getBuyNum();
                                if(cureItemNum>cureItemMax){
                                    cureItemMax = cureItemMax;
                                }
                            }
                        }
                    }
                }
            }
        }
        //判断是否符合规则
        if(cureNum >= marketSystem.getCureNum()){
            //生成俱乐部会员
            createClubMember(UserClubMember.TYPE_REGENERATION,ordersTotal,marketSystem,commonService);
        }
    }
    /**获取二级子订单*/
    public static List<OrderItemSon> getOrderItemSonList(String orderItemId,String goodsType,CommonService commonService){
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        values.put("orderItemId",orderItemId);
        values.put("goodsType",goodsType);
        sqlSentence.sqlSentence("SELECT id,type,goodsId,goodsNo,goodsName,usedTotal,hasReNum FROM order_item_source WHERE isDel = 0 AND orderItemId = #{m.orderItemId} AND type = #{m.type}",values);
        return commonService.selectList(OrderItemSonMapper.class,sqlSentence);
    }
    /**获取所有的权益*/
    public static List<CardEquity> getCardEquityList(String cardItemId, CommonService commonService){
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        values.put("cardItemId",cardItemId);
        sqlSentence.sqlSentence("SELECT cii.id,cii.equityType,cii.value,cii.shareMoney" +
                " FROM card_equity cii WHERE cii.isDel = 0 AND cii.cardItemId = #{m.cardItemId}",values);
        return commonService.selectList(CardEquityMapper.class,sqlSentence);
    }
    /**获取卡项所有的项目*/
    public static Map<String,List<CardItemInfo>> getCardItemInfoList(String cardItemId, CommonService commonService){
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        values.put("cardItemId",cardItemId);
        sqlSentence.sqlSentence("SELECT cii.id,cii.cardEquityId,cii.commonCode,cii.commonId,cii.commonName,cii.commonType,cii.maxNum,cii.everyDrawNum,p.treatmentItemsNum AS userNum" +
                " LEFT JOIN project p ON p.id = cii.commonId AND p.isExecutable = 1" +
                " FROM card_item_info cii WHERE cii.isDel = 0 AND cii.cardItemId = #{m.cardItemId} AND cii.commonType IN('project')",values);
        List<CardItemInfo> cardItemInfoList = commonService.selectList(CardItemInfoMapper.class,sqlSentence);
        Map<String,List<CardItemInfo>> cardItemInfoMapList = new HashMap<>();
        List<CardItemInfo> cardItemInfoList1;
        for(CardItemInfo cardItemInfo:cardItemInfoList){
            cardItemInfoList1 = cardItemInfoMapList.computeIfAbsent(cardItemInfo.getCardEquityId(),k->new ArrayList<>());
            cardItemInfoList1.add(cardItemInfo);
        }
        return cardItemInfoMapList;
    }
    /**订单生成再生俱乐部会员*/
    public static void createClubMember(Integer type,OrdersTotal ordersTotal,MarketSystem marketSystem,CommonService commonService){
        Integer durationType = UserClubMember.DURATION_TYPE_PARAGRAPH;
        Date startTime = null;
        Date endTime = null;
        if(marketSystem.getDurationType() == MarketSystem.DURATION_TYPE_ALL){
            durationType = UserClubMember.DURATION_TYPE_ALL;
        }else if(marketSystem.getDurationType() == MarketSystem.DURATION_TYPE_PARAGRAPH){
            startTime = marketSystem.getDurationStart();
            endTime = marketSystem.getDurationEnd();
        }else{
            startTime = ordersTotal.getPayTime();
            endTime = startTime;
            if(marketSystem.getDurationYear() != null){
                endTime = DateUtil.addYear(endTime,marketSystem.getDurationYear());
            }
            if(marketSystem.getDurationMonth() != null){
                endTime = DateUtil.addMonth(endTime,marketSystem.getDurationMonth());
            }
            if(marketSystem.getDurationDay() != null){
                endTime = DateUtil.addDay(endTime,marketSystem.getDurationDay());
            }
            //时间精确到当天最后一秒
            endTime = DateUtil.dayToEndDateNoMillisecond(endTime);
        }
        insertClubMember(type,durationType,startTime,endTime,UserClubMember.SOURCE_TYPE_ORDER,ordersTotal.getId(),marketSystem.getId(),ordersTotal.getUserId(),commonService);
    }
    /**保存俱乐部会员*/
    public static void insertClubMember(Integer type,Integer durationType,Date startTime,Date endTime,Integer sourceType,String sourceId,String sourceOtherId
            ,String userId,CommonService commonService){
        SqlSentence sqlSentence = new SqlSentence();
        Map<String,Object> values = new HashMap<>();
        //有绑定的全部进行取消
        values.put("type",type);
        values.put("status",UserClubMember.STATUS_NORMAL);
        values.put("userId",userId);
        sqlSentence.sqlUpdate(" isDel = 2 WHERE isDel = 0 AND type = #{m.type} AND status = #{m.status} AND userId = #{m.userId}",values);
        commonService.updateWhere(UserClubMemberMapper.class,sqlSentence);
        UserClubMember userClubMember = new UserClubMember();
        userClubMember.setType(type);
        userClubMember.setStatus(UserClubMember.STATUS_NORMAL);
        userClubMember.setDurationType(durationType);
        userClubMember.setStartTime(startTime);
        userClubMember.setEndTime(endTime);
        userClubMember.setSourceType(sourceType);
        userClubMember.setSourceId(sourceId);
        userClubMember.setSourceOtherId(sourceOtherId);
        userClubMember.setUserId(userId);
        commonService.insert(UserClubMemberMapper.class,userClubMember);
    }
}
phi_platform_common/src/main/resources/mapper/platform/MarketSystemMapper.xml
New file
@@ -0,0 +1,90 @@
<?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">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.phip.dao.mapper.MarketSystemMapper">
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,title = #{title},type = #{type},isUp = #{isUp},timeType = #{timeType},timeNum = #{timeNum},startTime = #{startTime},endTime = #{endTime},headId = #{headId},headName = #{headName},ruleInfo = #{ruleInfo},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
    <!--  后续通过  namespace.id-->
    <!--parameterType:输入参数的类型
    resultType:查询返回结果值的类型  ,返回类型  -->
    <insert id="insert" parameterType="com.hx.phiappt.model.market.system.MarketSystem">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into market_system (id,title,type,isUp,timeType,timeNum,startTime,endTime,headId,headName,ruleInfo,isDel,createTime,editTime)  values (#{id},#{title},#{type},#{isUp},#{timeType},#{timeNum},#{startTime},#{endTime},#{headId},#{headName},#{ruleInfo},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.market.system.MarketSystem">
        insert into market_system (id,title,type,isUp,timeType,timeNum,startTime,endTime,headId,headName,ruleInfo,isDel,createTime,editTime)  values (#{id},#{title},#{type},#{isUp},#{timeType},#{timeNum},#{startTime},#{endTime},#{headId},#{headName},#{ruleInfo},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.market.system.MarketSystem" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectOne" resultType="com.hx.phiappt.model.market.system.MarketSystem" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            select
                COUNT(*)
            from market_system
                WHERE ${sqlSentence}
    </select>
    <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
     </select>
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.market.system.MarketSystem" parameterType="java.lang.Object" >
        select
            id,title,type,isUp,timeType,timeNum,startTime,endTime,headId,headName,ruleInfo,isDel,createTime,editTime
        from market_system
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.market.system.MarketSystem" parameterType="java.lang.Object" >
        select
            id,title,type,isUp,timeType,timeNum,startTime,endTime,headId,headName,ruleInfo,isDel,createTime,editTime
        from market_system
        WHERE id = #{value}
    </select>
    <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
        update
            market_system
        SET ${sqlSentence}
    </update>
    <update id="updateAll" parameterType="com.hx.phiappt.model.market.system.MarketSystem">
        update market_system
            SET <include refid="Update_Column_All"/>
        WHERE id = #{id}
    </update>
    <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
        delete from market_system WHERE ${sqlSentence}
    </delete>
    <delete id="deleteById"  parameterType="java.lang.Object">
        delete from market_system WHERE id = #{value}
    </delete>
</mapper>
phi_platform_common/src/main/resources/mapper/platform/MarketSystemProjectMapper.xml
New file
@@ -0,0 +1,90 @@
<?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">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.phip.dao.mapper.MarketSystemProjectMapper">
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,type = #{type},typeCode = #{typeCode},typeId = #{typeId},marketSystemId = #{marketSystemId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
    <!--  后续通过  namespace.id-->
    <!--parameterType:输入参数的类型
    resultType:查询返回结果值的类型  ,返回类型  -->
    <insert id="insert" parameterType="com.hx.phiappt.model.market.system.MarketSystemProject">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into market_system_project (id,type,typeCode,typeId,marketSystemId,isDel,createTime,editTime)  values (#{id},#{type},#{typeCode},#{typeId},#{marketSystemId},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.market.system.MarketSystemProject">
        insert into market_system_project (id,type,typeCode,typeId,marketSystemId,isDel,createTime,editTime)  values (#{id},#{type},#{typeCode},#{typeId},#{marketSystemId},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.market.system.MarketSystemProject" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectOne" resultType="com.hx.phiappt.model.market.system.MarketSystemProject" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            select
                COUNT(*)
            from market_system_project
                WHERE ${sqlSentence}
    </select>
    <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
     </select>
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.market.system.MarketSystemProject" parameterType="java.lang.Object" >
        select
            id,type,typeCode,typeId,marketSystemId,isDel,createTime,editTime
        from market_system_project
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.market.system.MarketSystemProject" parameterType="java.lang.Object" >
        select
            id,type,typeCode,typeId,marketSystemId,isDel,createTime,editTime
        from market_system_project
        WHERE id = #{value}
    </select>
    <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
        update
            market_system_project
        SET ${sqlSentence}
    </update>
    <update id="updateAll" parameterType="com.hx.phiappt.model.market.system.MarketSystemProject">
        update market_system_project
            SET <include refid="Update_Column_All"/>
        WHERE id = #{id}
    </update>
    <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
        delete from market_system_project WHERE ${sqlSentence}
    </delete>
    <delete id="deleteById"  parameterType="java.lang.Object">
        delete from market_system_project WHERE id = #{value}
    </delete>
</mapper>
phi_platform_common/src/main/resources/mapper/platform/UserClubMemberMapper.xml
New file
@@ -0,0 +1,90 @@
<?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">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.phip.dao.mapper.UserClubMemberMapper">
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,type = #{type},status = #{status},startTime = #{startTime},endTime = #{endTime},sourceType = #{sourceType},sourceId = #{sourceId},discardSource = #{discardSource},discardSourceId = #{discardSourceId},discardReason = #{discardReason},userId = #{userId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
    <!--  后续通过  namespace.id-->
    <!--parameterType:输入参数的类型
    resultType:查询返回结果值的类型  ,返回类型  -->
    <insert id="insert" parameterType="com.hx.phiappt.model.user.club.UserClubMember">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into user_club_member (id,type,status,startTime,endTime,sourceType,sourceId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime)  values (#{id},#{type},#{status},#{startTime},#{endTime},#{sourceType},#{sourceId},#{discardSource},#{discardSourceId},#{discardReason},#{userId},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.user.club.UserClubMember">
        insert into user_club_member (id,type,status,startTime,endTime,sourceType,sourceId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime)  values (#{id},#{type},#{status},#{startTime},#{endTime},#{sourceType},#{sourceId},#{discardSource},#{discardSourceId},#{discardReason},#{userId},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.user.club.UserClubMember" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectOne" resultType="com.hx.phiappt.model.user.club.UserClubMember" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            select
                COUNT(*)
            from user_club_member
                WHERE ${sqlSentence}
    </select>
    <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
     </select>
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.user.club.UserClubMember" parameterType="java.lang.Object" >
        select
            id,type,status,startTime,endTime,sourceType,sourceId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime
        from user_club_member
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.user.club.UserClubMember" parameterType="java.lang.Object" >
        select
            id,type,status,startTime,endTime,sourceType,sourceId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime
        from user_club_member
        WHERE id = #{value}
    </select>
    <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
        update
            user_club_member
        SET ${sqlSentence}
    </update>
    <update id="updateAll" parameterType="com.hx.phiappt.model.user.club.UserClubMember">
        update user_club_member
            SET <include refid="Update_Column_All"/>
        WHERE id = #{id}
    </update>
    <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
        delete from user_club_member WHERE ${sqlSentence}
    </delete>
    <delete id="deleteById"  parameterType="java.lang.Object">
        delete from user_club_member WHERE id = #{value}
    </delete>
</mapper>
phi_platform_user/src/main/java/com/hx/phip/util/api/OrderCreateUtil.java
@@ -640,10 +640,10 @@
        //荣爷说项目疗程次数为空值,默认为1
        //设置一级子订单单次疗程数量,该值获取的是项目的疗程次数(为了计算订单的总疗程次数)
        if(project.getIsExecutable()!=null && project.getIsExecutable()==BaseEntity.YES){
            Integer useredTotal=project==null?0:project.getTreatmentItemsNum()==null?1:project.getTreatmentItemsNum()==0?1:project.getTreatmentItemsNum();
            Integer useredTotal= project.getTreatmentItemsNum() == null ?1: project.getTreatmentItemsNum() == 0 ?1:project.getTreatmentItemsNum();
            vo.setSingle(useredTotal);//订单单次疗程数量
        }else if(project.getIsExecutable()!=null && project.getIsExecutable()==BaseEntity.NO){
            Integer useredTotal=project==null?0:project.getTreatmentItemsNum()==null?0:project.getTreatmentItemsNum();
            Integer useredTotal= project.getTreatmentItemsNum() == null ?0:project.getTreatmentItemsNum();
            vo.setSingle(useredTotal);//订单单次疗程数量
        }else{
            vo.setSingle(0);//订单单次疗程数量