| | |
| | | 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.project.ProjectTypeRelation; |
| | | import com.hx.phiappt.model.refund.*; |
| | | import com.hx.phiappt.model.user.*; |
| | | import com.hx.phiappt.model.user.club.UserClubMember; |
New file |
| | |
| | | package com.hx.phip.dao.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.project.ProjectTypeRelation; |
| | | |
| | | public interface ProjectTypeRelationMapper { |
| | | /**新增,返回主键*/ |
| | | int insert(ProjectTypeRelation projectTypeRelation); |
| | | /**新增,返回主键*/ |
| | | int insertById(ProjectTypeRelation projectTypeRelation); |
| | | /**查询条数*/ |
| | | int selectCount(SqlSentence sqlSentence); |
| | | /**查询条数*/ |
| | | int selectCountSql(SqlSentence sqlSentence); |
| | | /**查询列表,返回实体类的List*/ |
| | | List<ProjectTypeRelation> selectList(SqlSentence sqlSentence); |
| | | /**查询列表,返回Map的List*/ |
| | | List<Map<String,Object>> selectListMap(SqlSentence sqlSentence); |
| | | /**查询,返回单个实体*/ |
| | | ProjectTypeRelation selectOne(SqlSentence sqlSentence); |
| | | /**查询,返回单个map*/ |
| | | Map<String,Object> selectOneMap(SqlSentence sqlSentence); |
| | | /**查询,返回实体类没有大数据的*/ |
| | | ProjectTypeRelation selectOneByKey(Object object); |
| | | /**查询,返回实体类有大数据的*/ |
| | | ProjectTypeRelation selectOneByKeyBlob(Object object); |
| | | /**更新,返回更新数量*/ |
| | | int updateWhere(SqlSentence sqlSentence); |
| | | /**更新,返回更新数量*/ |
| | | int updateAll(ProjectTypeRelation projectTypeRelation); |
| | | /**删除,返回删除数量*/ |
| | | int deleteWhere(SqlSentence sqlSentence); |
| | | /**删除,返回删除数量*/ |
| | | int deleteById(Object object); |
| | | } |
New file |
| | |
| | | package com.hx.phip.service.club; |
| | | |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.user.club.UserClubMember; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author CJH |
| | | */ |
| | | public interface UserClubMemberService { |
| | | |
| | | /**创建俱乐部会员*/ |
| | | void createClubMember(Integer type, Integer durationType, Date startTime, Date endTime, Integer sourceType, String sourceId, String sourceOtherId |
| | | , String userId); |
| | | |
| | | /**作废俱乐部会员*/ |
| | | void cancelClubMember(Integer discardSource,String discardId,String discardOtherId,String discardReason, UserClubMember userClubMember); |
| | | |
| | | } |
New file |
| | |
| | | package com.hx.phip.service.club.impl; |
| | | |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.user.club.UserClubMember; |
| | | import com.hx.phip.dao.mapper.UserClubMemberMapper; |
| | | import com.hx.phip.service.club.UserClubMemberService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Transactional |
| | | @Service |
| | | public class UserClubMemberServiceImpl implements UserClubMemberService { |
| | | |
| | | @Resource |
| | | private UserClubMemberMapper userClubMemberMapper; |
| | | |
| | | |
| | | /**新增俱乐部*/ |
| | | @Override |
| | | public void createClubMember(Integer type, Integer durationType, Date startTime, Date endTime, Integer sourceType, String sourceId, String sourceOtherId |
| | | , String userId) { |
| | | |
| | | 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); |
| | | userClubMemberMapper.updateWhere(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); |
| | | userClubMemberMapper.insert(userClubMember); |
| | | |
| | | } |
| | | |
| | | /**作废俱乐部*/ |
| | | @Override |
| | | public void cancelClubMember(Integer discardSource,String discardId,String discardOtherId,String discardReason, UserClubMember userClubMember) { |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | values.put("status",UserClubMember.STATUS_DISCARD); |
| | | values.put("discardSource",discardSource); |
| | | values.put("discardId",discardId); |
| | | values.put("discardOtherId",discardOtherId); |
| | | values.put("discardReason",discardReason); |
| | | values.put("discardTime",new Date()); |
| | | values.put("id",userClubMember.getId()); |
| | | values.put("oldStatus",UserClubMember.STATUS_NORMAL); |
| | | sqlSentence.sqlWhere(" status = #{m.status},discardSource=#{m.discardSource},discardId =#{m.discardId},discardOtherId = #{m.discardOtherId}" + |
| | | ",discardReason = #{m.discardReason},discardTime = #{m.discardTime} WHERE id = #{m.id} AND status = #{m.oldStatus}",values); |
| | | userClubMemberMapper.updateWhere(sqlSentence); |
| | | } |
| | | } |
File was renamed from phi_platform_common/src/main/java/com/hx/phip/tool/club/UserCluebMemberTool.java |
| | |
| | | package com.hx.phip.tool.club; |
| | | package com.hx.phip.service.tool.club; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.common.UserProjectConstants; |
| | | 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.user.UserCardUsed; |
| | | import com.hx.phiappt.model.user.club.UserClubMember; |
| | | import com.hx.phip.dao.mapper.*; |
| | | import com.hx.phip.service.club.UserClubMemberService; |
| | | import com.hx.phip.vo.club.ChekCureVo; |
| | | import com.hx.util.DateUtil; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /**用户俱乐部会员 |
| | | * @author CJH |
| | | */ |
| | | public class UserCluebMemberTool { |
| | | @Component |
| | | public class UserCluebMemberServiceTool { |
| | | |
| | | /**订单下单结账校验是否符合会员条件*/ |
| | | public static void orderChekMember(String orderId,Integer marketType, CommonService commonService){ |
| | | @Resource |
| | | private CommonService commonService; |
| | | @Resource |
| | | private UserClubMemberService userClubMemberService; |
| | | |
| | | OrdersTotal ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class,orderId); |
| | | /**校验结果-不参与规则*/ |
| | | public static final int RESULT_NOT_JOIN = 1; |
| | | /**校验结果-符合规则*/ |
| | | public static final int RESULT_CONFORM = 2; |
| | | /**校验结果-不符合规则*/ |
| | | public static final int RESULT_NON_CONFORM = 3; |
| | | |
| | | /**订单下单结账校验是否符合会员条件 |
| | | * @param orderId 订单标识,与ordersTotal选一个,两个都有默认ordersTotal |
| | | * @param ordersTotal 订单标识,与orderId选一个,两个都有默认ordersTotal |
| | | * @param marketSystem 规则配置,不传拿最新的 |
| | | * @param marketType 俱乐部类型,MarketSystem里面的类型 |
| | | * @return 是否生成会员 |
| | | */ |
| | | public boolean orderChekMember(String orderId,OrdersTotal ordersTotal,MarketSystem marketSystem,Integer marketType){ |
| | | if(ordersTotal == null){ |
| | | throw new TipsException("订单标识错误!"); |
| | | ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class,orderId); |
| | | if(ordersTotal == null){ |
| | | throw new TipsException("订单标识错误!"); |
| | | } |
| | | } |
| | | |
| | | //充值单跳过 |
| | | if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType()) |
| | | || OrderTotalConstants.TYPE_CARD_BAG.equals(ordersTotal.getType())){ |
| | | return false; |
| | | } |
| | | //未支付跳过 |
| | | if(ordersTotal.getPayStatus() != OrderTotalConstants.PAY_STATUS_SUC){ |
| | | return false; |
| | | } |
| | | |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | //是否有传入的 |
| | | if(marketSystem == null){ |
| | | //查询活动配置 |
| | | values.put("type",marketType); |
| | | sqlSentence.sqlSentence("SELECT * FROM market_system WHERE isDel = 0 AND isUp = 1 AND type = #{m.type}",values); |
| | | marketSystem = commonService.selectOne(MarketSystemMapper.class,sqlSentence); |
| | | //没有活动一律跳过 |
| | | if(marketSystem == null){ |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //---判断是否在活动时间内 |
| | | if(marketSystem.getStartTime() != null){ |
| | | if(ordersTotal.getPayTime().getTime() < marketSystem.getStartTime().getTime()){ |
| | | return false; |
| | | } |
| | | } |
| | | if(marketSystem.getEndTime() != null){ |
| | | if(ordersTotal.getPayTime().getTime() > marketSystem.getEndTime().getTime()){ |
| | | return false; |
| | | } |
| | | } |
| | | //开始校验是否符合规则 |
| | | if(commonChekMember(null,null,ordersTotal,marketSystem) == RESULT_CONFORM){ |
| | | //生成俱乐部会员 |
| | | createClubMember(UserClubMember.TYPE_REGENERATION,ordersTotal,marketSystem,userClubMemberService); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /**订单退款校验是否符合会员条件 |
| | | * @param orderId 订单标识,与ordersTotal选一个,两个都有默认ordersTotal |
| | | * @param ordersTotal 订单标识,与orderId选一个,两个都有默认ordersTotal |
| | | * @param marketType 俱乐部类型,MarketSystem里面的类型 |
| | | */ |
| | | public void refundChekMember(String orderId,OrdersTotal ordersTotal,String refundId,Integer marketType){ |
| | | if(ordersTotal == null){ |
| | | ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class,orderId); |
| | | if(ordersTotal == null){ |
| | | throw new TipsException("订单标识错误!"); |
| | | } |
| | | } |
| | | //充值单跳过 |
| | | if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())){ |
| | | if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType()) |
| | | || OrderTotalConstants.TYPE_CARD_BAG.equals(ordersTotal.getType())){ |
| | | return; |
| | | } |
| | | //未支付跳过 |
| | |
| | | return; |
| | | } |
| | | |
| | | //查询活动配置 |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | //查找是否有会员 |
| | | UserClubMember userClubMember = getUserClubMember(ordersTotal.getUserId(),marketType,new Date(),commonService); |
| | | //没有会员就不需要再跑下面流程 |
| | | if(userClubMember == null){ |
| | | return; |
| | | } |
| | | |
| | | 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); |
| | | MarketSystem marketSystem = commonService.selectOneByKey(MarketSystemMapper.class,userClubMember.getSourceOtherId()); |
| | | if(marketSystem == null){ |
| | | return; |
| | | } |
| | | |
| | | //---判断是否在活动时间内 |
| | | if(marketSystem.getStartTime() != null){ |
| | | if(ordersTotal.getPayTime().getTime() < marketSystem.getStartTime().getTime()){ |
| | | //判断是否时间内的 |
| | | Date startTime = null; |
| | | Date endTime = userClubMember.getStartTime(); |
| | | if(marketSystem.getTimeType() == MarketSystem.TIME_TYPE_HOUR){ |
| | | startTime = DateUtil.addhour(endTime,-marketSystem.getTimeNum()); |
| | | } |
| | | if(startTime != null ){ |
| | | if(marketSystem.getStartTime() != null && marketSystem.getStartTime().getTime() > startTime.getTime()){ |
| | | startTime = marketSystem.getStartTime(); |
| | | } |
| | | }else{ |
| | | startTime = marketSystem.getStartTime(); |
| | | } |
| | | if(endTime != null ){ |
| | | if(marketSystem.getEndTime() != null && marketSystem.getEndTime().getTime() < endTime.getTime()){ |
| | | endTime = marketSystem.getEndTime(); |
| | | } |
| | | }else{ |
| | | endTime = marketSystem.getEndTime(); |
| | | } |
| | | |
| | | //判断订单是否在这个时间之内 |
| | | if(startTime != null){ |
| | | if(ordersTotal.getPayTime().getTime() < startTime.getTime()){ |
| | | return; |
| | | } |
| | | } |
| | | if(marketSystem.getEndTime() != null){ |
| | | if(ordersTotal.getPayTime().getTime() > marketSystem.getEndTime().getTime()){ |
| | | if(endTime != null){ |
| | | if(ordersTotal.getPayTime().getTime() > endTime.getTime()){ |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //当前退款的订单是在逻辑内的,但不符合规则 |
| | | if(commonChekMember(startTime,endTime,ordersTotal,marketSystem) == RESULT_NON_CONFORM){ |
| | | //不符合就作废会员信息 |
| | | userClubMemberService.cancelClubMember(UserClubMember.DISCARD_SOURCE_REFUND,refundId,ordersTotal.getId(),"订单退款",userClubMember); |
| | | //重新算出符合的出来 |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | StringBuilder sql = new StringBuilder(); |
| | | |
| | | int pageNum = 0; |
| | | int pageSize = 10; |
| | | |
| | | values.put("userId",ordersTotal.getId()); |
| | | sql.append("SELECT * FROM orders_total WHERE isDel = 0 AND userId = #{m.userId} AND status IN(2,3,9) AND payStatus = 3"); |
| | | if(startTime != null){ |
| | | values.put("startTime",startTime); |
| | | sql.append(" AND payTime >= #{m.startTime}"); |
| | | } |
| | | if(endTime != null){ |
| | | values.put("endTime",endTime); |
| | | sql.append(" AND payTime <= #{m.endTime}"); |
| | | } |
| | | sql.append(" ORDER BY payTime DESC LIMIT #{m.pageNum},#{m.pageSize}"); |
| | | sqlSentence.sqlSentence(sql.toString(),values); |
| | | |
| | | List<OrdersTotal> ordersTotalList; |
| | | boolean result = false; |
| | | while (true){ |
| | | values.put("pageNum",pageNum); |
| | | values.put("pageSize",pageSize); |
| | | ordersTotalList = commonService.selectList(OrdersTotalMapper.class,sqlSentence); |
| | | for(OrdersTotal ordersTotal1:ordersTotalList){ |
| | | //是否生成了会员,如果是,那么就跳出循环 |
| | | result = orderChekMember(null,ordersTotal1,marketSystem,MarketSystem.TYPE_REGENERATION); |
| | | if(result){ |
| | | break; |
| | | } |
| | | } |
| | | if(result){ |
| | | break; |
| | | } |
| | | if(ordersTotalList.size() < pageSize){ |
| | | break; |
| | | } |
| | | pageNum = pageNum+pageSize; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /**订单退款校验是否符合会员条件 |
| | | * @param orderId 订单标识 |
| | | * @param marketType 俱乐部类型,MarketSystem里面的类型 |
| | | */ |
| | | public void refundCancelChekMember(String orderId,OrdersTotal ordersTotal,String refundId,Integer marketType){ |
| | | if(ordersTotal == null){ |
| | | ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class,orderId); |
| | | if(ordersTotal == null){ |
| | | throw new TipsException("订单标识错误!"); |
| | | } |
| | | } |
| | | |
| | | //充值单跳过 |
| | | if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType()) |
| | | || OrderTotalConstants.TYPE_CARD_BAG.equals(ordersTotal.getType())){ |
| | | return; |
| | | } |
| | | //未支付跳过 |
| | | if(ordersTotal.getPayStatus() != OrderTotalConstants.PAY_STATUS_SUC){ |
| | | return; |
| | | } |
| | | |
| | | //查找是否有会员 |
| | | UserClubMember userClubMember = getUserClubMember(ordersTotal.getUserId(),marketType,new Date(),commonService); |
| | | if(userClubMember == null){ |
| | | //当前没有会员 |
| | | orderChekMember(null,ordersTotal,null,MarketSystem.TYPE_REGENERATION); |
| | | return; |
| | | }else{ |
| | | //---已经存在会员了情况下,需要判断成为会员的时间了,可以作废退款这个比这个还要新 |
| | | MarketSystem marketSystem = commonService.selectOneByKey(MarketSystemMapper.class,userClubMember.getSourceOtherId()); |
| | | if(marketSystem == null){ |
| | | return; |
| | | } |
| | | if(userClubMember.getStartTime().getTime() < ordersTotal.getPayTime().getTime()){ |
| | | //重新生成会员 |
| | | orderChekMember(null,ordersTotal,marketSystem,MarketSystem.TYPE_REGENERATION); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /**公用校验 |
| | | * @param startTime 规则内开始时间时间,不传以ordersTotal支付时间重新算 |
| | | * @param endTime 规则内结束时间时间,不传以ordersTotal支付时间重新算 |
| | | * @param ordersTotal 当前订单 |
| | | * @param marketSystem 当前配置 |
| | | */ |
| | | public int commonChekMember(Date startTime,Date endTime,OrdersTotal ordersTotal,MarketSystem marketSystem){ |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | //----获取指定的项目配置 |
| | | 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); |
| | |
| | | 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); |
| | | sqlSentence.sqlSentence("SELECT skuNo FROM project_type_relation WHERE isDel = 0 AND moduleType = 7 AND itemName IN("+ itemNameSql +")",values); |
| | | List<ProjectTypeRelation> projectTypeRelationList = commonService.selectList(ProjectTypeRelationMapper.class,sqlSentence); |
| | | for(ProjectTypeRelation projectTypeRelation:projectTypeRelationList){ |
| | | skuNoSet.add(projectTypeRelation.getSkuNo()); |
| | | } |
| | | } |
| | | //总疗程数,所有的项目疗程数总和 |
| | | |
| | | //当前订单的,总疗程数,所有的项目疗程数总和 |
| | | ChekCureVo chekCureVo = orderHandle(ordersTotal,skuNoSet,commonService); |
| | | if(!chekCureVo.isCureProject()){ |
| | | return; |
| | | return RESULT_NOT_JOIN; |
| | | } |
| | | int cureNum = chekCureVo.getCureNum(); |
| | | //判断是否符合规则 |
| | | if(cureNum >= marketSystem.getCureNum()){ |
| | | //生成俱乐部会员 |
| | | createClubMember(UserClubMember.TYPE_REGENERATION,ordersTotal,marketSystem,commonService); |
| | | }else { |
| | | //时间段内的订单算法 |
| | | if(cureNum < marketSystem.getCureNum()){ |
| | | //时间段内的订单算法,求他们的和 |
| | | values.clear(); |
| | | |
| | | Date startTime = null; |
| | | Date endTime = null; |
| | | if(marketSystem.getTimeType() == MarketSystem.TIME_TYPE_HOUR){ |
| | | if(endTime == null){ |
| | | endTime = ordersTotal.getPayTime(); |
| | | startTime = DateUtil.addhour(endTime,marketSystem.getTimeNum()); |
| | | } |
| | | if(marketSystem.getTimeType() == MarketSystem.TIME_TYPE_HOUR){ |
| | | if(startTime == null){ |
| | | startTime = DateUtil.addhour(endTime,-marketSystem.getTimeNum()); |
| | | } |
| | | } |
| | | if(startTime != null ){ |
| | | if(marketSystem.getStartTime() != null && marketSystem.getStartTime().getTime() > startTime.getTime()){ |
| | | startTime = marketSystem.getStartTime(); |
| | | } |
| | | }else{ |
| | | startTime = marketSystem.getStartTime(); |
| | | } |
| | | if(endTime != null ){ |
| | | if(marketSystem.getEndTime() != null && marketSystem.getEndTime().getTime() < endTime.getTime()){ |
| | | endTime = marketSystem.getEndTime(); |
| | | } |
| | | }else{ |
| | | endTime = marketSystem.getEndTime(); |
| | | } |
| | | |
| | | itemNameSql = new StringBuilder(); |
| | | values.put("userId",ordersTotal.getUserId()); |
| | | values.put("newId",ordersTotal.getId()); |
| | |
| | | for(OrdersTotal ordersTotal1:ordersTotalList){ |
| | | chekCureVo = orderHandle(ordersTotal1,skuNoSet,commonService); |
| | | cureNum =cureNum + chekCureVo.getCureNum(); |
| | | //判断是否符合条件了,如果符合,那么就跳出循环 |
| | | if(cureNum >= marketSystem.getCureNum()){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //查找符合的订单 |
| | | if(cureNum >= marketSystem.getCureNum()){ |
| | | //生成俱乐部会员 |
| | | createClubMember(UserClubMember.TYPE_REGENERATION,ordersTotal,marketSystem,commonService); |
| | | return RESULT_CONFORM; |
| | | } |
| | | |
| | | return RESULT_NON_CONFORM; |
| | | } |
| | | |
| | | /**单订单处理*/ |
| | |
| | | return chekCureVo; |
| | | } |
| | | |
| | | |
| | | /**获取二级子订单*/ |
| | | public static List<OrderItemSon> getOrderItemSonList(String orderItemId,String goodsType,CommonService commonService){ |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | //获取未退款的用户卡包 |
| | | values.put("effectiveStatus", UserProjectConstants.EFF_STATUS_CANCEL); |
| | | values.put("sourceId", orderItem.getId()); |
| | | sqlSentence.sqlSentence("SELECT id FROM user_card WHERE isDel = 0 AND effectiveStatus != #{m.effectiveStatus} AND sourceId = #{m.sourceId}",values); |
| | |
| | | values.clear(); |
| | | values.put("cardItemId",orderItem.getCommonId()); |
| | | 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); |
| | | " FROM card_item_info cii" + |
| | | " LEFT JOIN project p ON p.id = cii.commonId" + |
| | | " WHERE cii.isDel = 0 AND cii.cardItemId = #{m.cardItemId} AND cii.commonType IN('project')",values); |
| | | List<CardItemInfo> cardItemInfoListAll = commonService.selectList(CardItemInfoMapper.class,sqlSentence); |
| | | //存储卡项所有的子项,k值:权益标识 |
| | | Map<String,List<CardItemInfo>> cardItemInfoMapList = new HashMap<>(); |
| | |
| | | Set<String> NMSet; |
| | | for(UserCard userCard:userCardList){ |
| | | |
| | | //获取已退款的项目数量 |
| | | //获取已退款的卡项条目次数 |
| | | values.clear(); |
| | | values.put("sourceType", UserCardUsed.SOURCE_TYPE_USER_CARD_REFUND); |
| | | values.put("userCardId", userCard.getId()); |
| | | sqlSentence.sqlSentence("SELECT cardEquityId,cardItemInfoId,usedNum FROM user_card_used uc WHERE uc.isDel = 0 AND uc.userCardId #{m.userCardId} AND uc.sourceType = #{m.sourceType}",values); |
| | | sqlSentence.sqlSentence("SELECT uc.cardEquityId,uc.cardItemInfoId,uc.usedNum FROM user_card_used uc WHERE uc.isDel = 0 AND uc.userCardId = #{m.userCardId} AND uc.sourceType = #{m.sourceType}",values); |
| | | userCardUsedList = commonService.selectList(UserCardUsedMapper.class,sqlSentence); |
| | | |
| | | //根据权益分组已退款的卡项条目次数 |
| | | refundItemMapList = new HashMap<>(); |
| | | for(UserCardUsed userCardUsed:userCardUsedList){ |
| | | userCardUsedList2 = refundItemMapList.computeIfAbsent(userCardUsed.getCardEquityId(),k->new ArrayList<>()); |
| | |
| | | //最小公倍数算法 |
| | | minCommonMultiple(cardItemInfoList); |
| | | //排序,降序 |
| | | cardItemInfoList = cardItemInfoList.stream().sorted(Comparator.comparing(CardItemInfo::getCommonMultiple).reversed()) |
| | | .collect(Collectors.toList()); |
| | | cardItemInfoList = cardItemInfoList.stream().sorted(Comparator.comparing(CardItemInfo::getCommonMultiple).reversed()).collect(Collectors.toList()); |
| | | for(CardItemInfo cardItemInfo:cardItemInfoList){ |
| | | if(deductionSurp <= 0){ |
| | | break; |
| | |
| | | cardItemInfoList = cardItemInfoList.stream().sorted(Comparator.comparing(CardItemInfo::getCommonMultiple).reversed()).collect(Collectors.toList()); |
| | | |
| | | NMSet = new HashSet<>(); |
| | | //已经退款的先算 |
| | | //已经退款的先算,可以算是已选个数 |
| | | for (Map.Entry <String, UserCardUsed> entry : userCardUsedMap.entrySet()) { |
| | | for(CardItemInfo cardItemInfo:cardItemInfoList){ |
| | | if(cardItemInfo.getId().equals(entry.getValue().getCardItemInfoId())){ |
| | |
| | | } |
| | | |
| | | /**订单生成再生俱乐部会员*/ |
| | | public static void createClubMember(Integer type,OrdersTotal ordersTotal,MarketSystem marketSystem,CommonService commonService){ |
| | | public static void createClubMember(Integer type,OrdersTotal ordersTotal,MarketSystem marketSystem,UserClubMemberService userClubMemberService){ |
| | | |
| | | Integer durationType = UserClubMember.DURATION_TYPE_PARAGRAPH; |
| | | Date startTime = null; |
| | | Date startTime = ordersTotal.getPayTime(); |
| | | Date endTime = null; |
| | | if(marketSystem.getDurationType() == MarketSystem.DURATION_TYPE_ALL){ |
| | | durationType = UserClubMember.DURATION_TYPE_ALL; |
| | |
| | | startTime = marketSystem.getDurationStart(); |
| | | endTime = marketSystem.getDurationEnd(); |
| | | }else{ |
| | | startTime = ordersTotal.getPayTime(); |
| | | endTime = startTime; |
| | | if(marketSystem.getDurationYear() != null){ |
| | | endTime = DateUtil.addYear(endTime,marketSystem.getDurationYear()); |
| | |
| | | //时间精确到当天最后一秒 |
| | | endTime = DateUtil.dayToEndDateNoMillisecond(endTime); |
| | | } |
| | | insertClubMember(type,durationType,startTime,endTime,UserClubMember.SOURCE_TYPE_ORDER,ordersTotal.getId(),marketSystem.getId(),ordersTotal.getUserId(),commonService); |
| | | userClubMemberService.createClubMember(type,durationType,startTime,endTime,UserClubMember.SOURCE_TYPE_ORDER,ordersTotal.getId(),marketSystem.getId(),ordersTotal.getUserId()); |
| | | } |
| | | |
| | | /**保存俱乐部会员*/ |
| | | public static void insertClubMember(Integer type,Integer durationType,Date startTime,Date endTime,Integer sourceType,String sourceId,String sourceOtherId |
| | | ,String userId,CommonService commonService){ |
| | | |
| | | /**获取有效的俱乐部会员*/ |
| | | public static UserClubMember getUserClubMember(String userId,Integer marketType,Date curTime,CommonService commonService){ |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> values = new HashMap<>(); |
| | | |
| | | //有绑定的全部进行取消 |
| | | values.put("type",type); |
| | | values.put("status",UserClubMember.STATUS_NORMAL); |
| | | values.put("type",marketType); |
| | | 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); |
| | | sqlSentence.sqlSentence("SELECT * FROM user_club_member WHERE isDel = 0 AND type = #{m.type} AND status = #{m.status} AND userId = #{m.userId} ORDER BY durationType ASC,startTime DESC",values); |
| | | List<UserClubMember> userClubMemberList = commonService.selectList(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); |
| | | for(UserClubMember userClubMember:userClubMemberList){ |
| | | if(userClubMember.getEndTime() != null){ |
| | | if(userClubMember.getEndTime().getTime() < curTime.getTime()){ |
| | | continue; |
| | | } |
| | | } |
| | | return userClubMember; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?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.ProjectTypeRelationMapper"> |
| | | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,moduleType = #{moduleType},traditionFirstTypeName = #{traditionFirstTypeName},traditionSecondTypeName = #{traditionSecondTypeName},skuType = #{skuType},skuId = #{skuId},skuNo = #{skuNo},skuName = #{skuName},itemName = #{itemName},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | | <!-- 后续通过 namespace.id--> |
| | | <!--parameterType:输入参数的类型 |
| | | resultType:查询返回结果值的类型 ,返回类型 --> |
| | | <insert id="insert" parameterType="com.hx.phiappt.model.project.ProjectTypeRelation"> |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into project_type_relation (id,moduleType,traditionFirstTypeName,traditionSecondTypeName,skuType,skuId,skuNo,skuName,itemName,isDel,createTime,editTime) values (#{id},#{moduleType},#{traditionFirstTypeName},#{traditionSecondTypeName},#{skuType},#{skuId},#{skuNo},#{skuName},#{itemName},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.project.ProjectTypeRelation"> |
| | | insert into project_type_relation (id,moduleType,traditionFirstTypeName,traditionSecondTypeName,skuType,skuId,skuNo,skuName,itemName,isDel,createTime,editTime) values (#{id},#{moduleType},#{traditionFirstTypeName},#{traditionSecondTypeName},#{skuType},#{skuId},#{skuNo},#{skuName},#{itemName},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.project.ProjectTypeRelation" 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.project.ProjectTypeRelation" 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 project_type_relation |
| | | WHERE ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.project.ProjectTypeRelation" parameterType="java.lang.Object" > |
| | | select |
| | | id,moduleType,traditionFirstTypeName,traditionSecondTypeName,skuType,skuId,skuNo,skuName,itemName,isDel,createTime,editTime |
| | | from project_type_relation |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.project.ProjectTypeRelation" parameterType="java.lang.Object" > |
| | | select |
| | | id,moduleType,traditionFirstTypeName,traditionSecondTypeName,skuType,skuId,skuNo,skuName,itemName,isDel,createTime,editTime |
| | | from project_type_relation |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | update |
| | | project_type_relation |
| | | SET ${sqlSentence} |
| | | </update> |
| | | |
| | | <update id="updateAll" parameterType="com.hx.phiappt.model.project.ProjectTypeRelation"> |
| | | update project_type_relation |
| | | SET <include refid="Update_Column_All"/> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | delete from project_type_relation WHERE ${sqlSentence} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.Object"> |
| | | delete from project_type_relation WHERE id = #{value} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <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} |
| | | ,type = #{type},status = #{status},durationType = #{durationType},startTime = #{startTime},endTime = #{endTime},sourceType = #{sourceType},sourceId = #{sourceId},sourceOtherId = #{sourceOtherId},discardSource = #{discardSource},discardSourceId = #{discardSourceId},discardReason = #{discardReason},userId = #{userId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | |
| | | <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 into user_club_member (id,type,status,durationType,startTime,endTime,sourceType,sourceId,sourceOtherId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime) values (#{id},#{type},#{status},#{durationType},#{startTime},#{endTime},#{sourceType},#{sourceId},#{sourceOtherId},#{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 into user_club_member (id,type,status,durationType,startTime,endTime,sourceType,sourceId,sourceOtherId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime) values (#{id},#{type},#{status},#{durationType},#{startTime},#{endTime},#{sourceType},#{sourceId},#{sourceOtherId},#{discardSource},#{discardSourceId},#{discardReason},#{userId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.user.club.UserClubMember" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | |
| | | |
| | | <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 |
| | | id,type,status,durationType,startTime,endTime,sourceType,sourceId,sourceOtherId,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 |
| | | id,type,status,durationType,startTime,endTime,sourceType,sourceId,sourceOtherId,discardSource,discardSourceId,discardReason,userId,isDel,createTime,editTime |
| | | from user_club_member |
| | | WHERE id = #{value} |
| | | </select> |
| | |
| | | |
| | | import com.hx.common.BaseController; |
| | | import com.hx.phiappt.model.Employee; |
| | | import com.hx.phiappt.model.market.system.MarketSystem; |
| | | import com.hx.phip.dao.mapper.EmployeeMapper; |
| | | import com.hx.phip.tool.EmployeeTool; |
| | | import com.hx.phip.service.tool.club.UserCluebMemberServiceTool; |
| | | import com.hx.redis.RedisUtil; |
| | | import com.hz.crm.vo.order.OrderPayVo; |
| | | import com.platform.resultTool.PlatformResult; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | private static final Logger logger = LoggerFactory.getLogger(TestController.class.getName()); |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private UserCluebMemberServiceTool userCluebMemberServiceTool; |
| | | |
| | | /** |
| | | * |
| | | *俱乐部会员测试 |
| | | */ |
| | | @RequestMapping(value = "/redi",method = RequestMethod.POST) |
| | | public PlatformResult typeList(HttpServletRequest request) { |
| | | |
| | | Map<String,Object> data = new HashMap<>(); |
| | | |
| | | String key = "app_id"; |
| | | |
| | | redisUtil.set(key,"测试redis"); |
| | | data.put("data",redisUtil.get(key)); |
| | | |
| | | return PlatformResult.success(data); |
| | | @RequestMapping(value = "/club/member",method = RequestMethod.POST) |
| | | public PlatformResult typeList(@RequestBody OrderPayVo orderPayVo) { |
| | | userCluebMemberServiceTool.orderChekMember(orderPayVo.getOrderId(), null,null,MarketSystem.TYPE_REGENERATION); |
| | | return PlatformResult.success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @Description: |
| | | */ |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hx.common.BaseController; |
| | | import com.hx.common.service.CommonService; |
| | |
| | | import com.hx.phiappt.common.PlatformConstants; |
| | | import com.hx.phiappt.common.UserStatusConstants; |
| | | import com.hx.phiappt.constants.tool.PerformanceInfoTool; |
| | | import com.hx.phiappt.constants.tool.UserInfoTool; |
| | | import com.hx.phiappt.constants.tool.UserStatusTool; |
| | | import com.hx.phiappt.constants.tool.clubEquity.ClubEquityTool; |
| | | import com.hx.phiappt.dao.mapper.CouponNumberMapper; |
| | | import com.hx.phiappt.model.*; |
| | | import com.hx.phiappt.model.coupon.Coupon; |
| | | import com.hx.phiappt.model.coupon.CouponNumber; |
| | | import com.hx.phiappt.model.micro.MicroRecord; |
| | | import com.hx.phiappt.model.market.system.MarketSystem; |
| | | import com.hx.phiappt.model.order.*; |
| | | import com.hx.phiappt.model.performance.PerformanceInfo; |
| | | import com.hx.phiappt.model.userStatus.UserStatusLog; |
| | |
| | | import com.hx.phip.service.UserService; |
| | | import com.hx.phip.service.init.OrderInitService; |
| | | import com.hx.phip.service.order.OrderServiceV2; |
| | | import com.hx.phip.service.tool.club.UserCluebMemberServiceTool; |
| | | import com.hx.phip.util.api.ApiOrderUtil; |
| | | import com.hx.phip.util.api.OrderCreateUtil; |
| | | import com.hx.phip.util.api.OrderPayMoneyUtil; |
| | | import com.hx.phip.util.api.SendNoticeUtil; |
| | | import com.hx.util.DateUtil; |
| | | import com.hx.util.StringUtils; |
| | | import com.hx.util.thread.ExecutorServiceTool; |
| | | import com.hz.crm.dto.oldBrinNew.OldBrinNewDto; |
| | |
| | | private SUserTagInfoService sUserTagInfoService; |
| | | @Resource |
| | | private BotoxClubConfig botoxClubConfig; |
| | | @Resource |
| | | private UserCluebMemberServiceTool userCluebMemberServiceTool; |
| | | |
| | | /**固定线程池-改*/ |
| | | public static ExecutorServiceTool threadPool = new ExecutorServiceTool(5,100); |
| | |
| | | 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)); |
| | | //处理老带新 |
| | | JSONObject commissionObject = handOrderOldNew(ordersTotal, user); |
| | | |
| | | //更新用户最后下单时间 |
| | | updateUserLastTime(ordersTotal, user); |
| | | |
| | |
| | | import com.hx.phiappt.model.consume.ConsumeNotify; |
| | | import com.hx.phiappt.model.consume.ConsumePay; |
| | | import com.hx.phiappt.model.coupon.CouponOrderDiscountLog; |
| | | import com.hx.phiappt.model.market.system.MarketSystem; |
| | | import com.hx.phiappt.model.order.*; |
| | | import com.hx.phiappt.model.performance.PerformanceInfo; |
| | | import com.hx.phiappt.model.refund.*; |
| | |
| | | import com.hx.phiappt.vo.refund.RefundCashVo; |
| | | import com.hx.phip.config.BotoxClubConfig; |
| | | import com.hx.phip.config.CustomParameter; |
| | | import com.hx.phip.controller.order.OrderControllerV2; |
| | | import com.hx.phip.dao.mapper.*; |
| | | import com.hx.phip.service.CreateNoService; |
| | | import com.hx.phip.service.PaymentMethodService; |
| | |
| | | import com.hx.phip.service.refund.RefundRecordItemService; |
| | | import com.hx.phip.service.refund.RefundRecordMethodService; |
| | | import com.hx.phip.service.refund.RefundRecordService; |
| | | import com.hx.phip.service.tool.club.UserCluebMemberServiceTool; |
| | | import com.hx.phip.service.userLevel.UserLevelRuleService; |
| | | import com.hx.phip.tool.CreateNo; |
| | | import com.hx.phip.tool.deduction.DeductionSingleTool; |
| | |
| | | private SUserTagInfoService sUserTagInfoService; |
| | | @Resource |
| | | private BotoxClubConfig botoxClubConfig; |
| | | @Resource |
| | | private UserCluebMemberServiceTool userCluebMemberServiceTool; |
| | | |
| | | /** |
| | | * 获取退款页面详情 |
| | |
| | | //撤销【保妥适会员】标签 |
| | | ClubEquityTool.refundCancelLabel(commonService,sUserTagInfoService,ordersTotal,botoxClubConfig.getLabelTypeNo(),botoxClubConfig.getLabelNo()); |
| | | |
| | | //俱乐部会员处理 |
| | | if(StringUtils.noNull(refundRecord.getOrderId())){ |
| | | RefundRecord finalRefundRecord = refundRecord; |
| | | OrderControllerV2.threadPool.getThreadPool().execute(() ->{ |
| | | try{ |
| | | Thread.sleep(5000); |
| | | }catch (Exception ignored){ |
| | | } |
| | | userCluebMemberServiceTool.refundChekMember(finalRefundRecord.getOrderId(),null, finalRefundRecord.getId(), MarketSystem.TYPE_REGENERATION); |
| | | }); |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | /** |
| | |
| | | ordersNodeLog.setOrderId(ordersTotal.getId()); |
| | | commonService.insert(OrdersNodeLogMapper.class,ordersNodeLog); |
| | | |
| | | //俱乐部会员 |
| | | OrderControllerV2.threadPool.getThreadPool().execute(() ->{ |
| | | try{ |
| | | Thread.sleep(5000); |
| | | }catch (Exception ignored){ |
| | | } |
| | | userCluebMemberServiceTool.refundCancelChekMember(refundRecord.getOrderId(),null, refundRecord.getId(), MarketSystem.TYPE_REGENERATION); |
| | | }); |
| | | |
| | | } |
| | | |
| | | /**额外操作,不影响主流程*/ |
| | |
| | | }else{ |
| | | //-----复购订单 |
| | | //查找被邀请人下单(初诊单) |
| | | //复购单数量,是有现金消费的复购单 |
| | | //复购单数量,是有现金消费的复购单,初诊单后6月内 |
| | | values.clear(); |
| | | values.put("userId",user.getId()); |
| | | values.put("newId",ordersTotal.getId()); |
| | | sqlSentence.sqlSentence("SELECT ot.id,ot.payTime,(SELECT COUNT(*) FROM orders_total a" + |
| | | " JOIN orders_info info2 ON info2.orderId = a.id" + |
| | | " WHERE a.isDel = 0 AND a.userId = #{m.userId} AND a.status IN(2,3,9)" + |
| | | " AND a.payStatus = 3 AND info2.isBothTheOne = 3 AND a.snapPayTotal > 0 AND a.id != #{m.newId}) AS num" + |
| | | " AND a.payTime >= ot.payTime AND a.payTime <= DATE_FORMAT(DATE_ADD(ot.payTime,INTERVAL 6 MONTH),'%Y-%m-%d 23:59:59')" + |
| | | " AND a.payStatus = 3 AND info2.isBothTheOne = 3 AND info2.snapPayTotal > 0 AND a.id != #{m.newId}) AS num" + |
| | | " FROM orders_total ot" + |
| | | " JOIN orders_info info ON info.orderId = ot.id" + |
| | | " WHERE ot.isDel = 0 AND ot.userId = #{m.userId} AND ot.status IN(2,3,9)" + |