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.money.MoneyRule; |
| | | |
| | | public interface MoneyRuleMapper { |
| | | /**新增,返回主键*/ |
| | | int insert(MoneyRule moneyRule); |
| | | /**新增,返回主键*/ |
| | | int insertById(MoneyRule moneyRule); |
| | | /**查询条数*/ |
| | | int selectCount(SqlSentence sqlSentence); |
| | | /**查询条数*/ |
| | | int selectCountSql(SqlSentence sqlSentence); |
| | | /**查询列表,返回实体类的List*/ |
| | | List<MoneyRule> selectList(SqlSentence sqlSentence); |
| | | /**查询列表,返回Map的List*/ |
| | | List<Map<String,Object>> selectListMap(SqlSentence sqlSentence); |
| | | /**查询,返回单个实体*/ |
| | | MoneyRule selectOne(SqlSentence sqlSentence); |
| | | /**查询,返回单个map*/ |
| | | Map<String,Object> selectOneMap(SqlSentence sqlSentence); |
| | | /**查询,返回实体类没有大数据的*/ |
| | | MoneyRule selectOneByKey(Object object); |
| | | /**查询,返回实体类有大数据的*/ |
| | | MoneyRule selectOneByKeyBlob(Object object); |
| | | /**更新,返回更新数量*/ |
| | | int updateWhere(SqlSentence sqlSentence); |
| | | /**更新,返回更新数量*/ |
| | | int updateAll(MoneyRule moneyRule); |
| | | /**删除,返回删除数量*/ |
| | | int deleteWhere(SqlSentence sqlSentence); |
| | | /**删除,返回删除数量*/ |
| | | int deleteById(Object object); |
| | | } |
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.MoneyRuleMapper"> |
| | | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,moneyType = #{moneyType},isNeedReceive = #{isNeedReceive},isUserReceive = #{isUserReceive},waitReceiveLimit = #{waitReceiveLimit},waitReceiveLimitDay = #{waitReceiveLimitDay},isReceiveLimit = #{isReceiveLimit},receiveLimitType = #{receiveLimitType},receiveLimitData = #{receiveLimitData},receiveMoneyLimit = #{receiveMoneyLimit},receiveMoneyLimitDay = #{receiveMoneyLimitDay},isUp = #{isUp},isDefault = #{isDefault},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | | <!-- 后续通过 namespace.id--> |
| | | <!--parameterType:输入参数的类型 |
| | | resultType:查询返回结果值的类型 ,返回类型 --> |
| | | <insert id="insert" parameterType="com.hx.phiappt.model.money.MoneyRule"> |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into money_rule (id,moneyType,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,isUp,isDefault,isDel,createTime,editTime) values (#{id},#{moneyType},#{isNeedReceive},#{isUserReceive},#{waitReceiveLimit},#{waitReceiveLimitDay},#{isReceiveLimit},#{receiveLimitType},#{receiveLimitData},#{receiveMoneyLimit},#{receiveMoneyLimitDay},#{isUp},#{isDefault},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.money.MoneyRule"> |
| | | insert into money_rule (id,moneyType,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,isUp,isDefault,isDel,createTime,editTime) values (#{id},#{moneyType},#{isNeedReceive},#{isUserReceive},#{waitReceiveLimit},#{waitReceiveLimitDay},#{isReceiveLimit},#{receiveLimitType},#{receiveLimitData},#{receiveMoneyLimit},#{receiveMoneyLimitDay},#{isUp},#{isDefault},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.money.MoneyRule" 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.money.MoneyRule" 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 money_rule |
| | | WHERE ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.money.MoneyRule" parameterType="java.lang.Object" > |
| | | select |
| | | id,moneyType,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,isUp,isDefault,isDel,createTime,editTime |
| | | from money_rule |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.money.MoneyRule" parameterType="java.lang.Object" > |
| | | select |
| | | id,moneyType,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,isUp,isDefault,isDel,createTime,editTime |
| | | from money_rule |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | update |
| | | money_rule |
| | | SET ${sqlSentence} |
| | | </update> |
| | | |
| | | <update id="updateAll" parameterType="com.hx.phiappt.model.money.MoneyRule"> |
| | | update money_rule |
| | | SET <include refid="Update_Column_All"/> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | delete from money_rule WHERE ${sqlSentence} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.Object"> |
| | | delete from money_rule WHERE id = #{value} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,userId = #{userId},fundType = #{fundType},originChannel = #{originChannel},originSubject = #{originSubject},opType = #{opType},commonId = #{commonId},opNumber = #{opNumber},fundOpType = #{fundOpType},status = #{status},operatorId = #{operatorId},operatorName = #{operatorName},operatorType = #{operatorType},operatorShopId = #{operatorShopId},operatorShopName = #{operatorShopName},operationReason = #{operationReason},orderType = #{orderType},orderId = #{orderId},orderNo = #{orderNo},orderItemId = #{orderItemId},isValid = #{isValid},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},receiveTime = #{receiveTime},isSentSMS = #{isSentSMS},SMSStatus = #{SMSStatus},SMSUrl = #{SMSUrl},SMSInfo = #{SMSInfo},remarks = #{remarks},isSyncHis = #{isSyncHis},appId = #{appId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | ,userId = #{userId},fundType = #{fundType},originChannel = #{originChannel},originSubject = #{originSubject},opType = #{opType},commonId = #{commonId},opNumber = #{opNumber},fundOpType = #{fundOpType},status = #{status},operatorId = #{operatorId},operatorName = #{operatorName},operatorType = #{operatorType},operatorShopId = #{operatorShopId},operatorShopName = #{operatorShopName},operationReason = #{operationReason},orderType = #{orderType},orderId = #{orderId},orderNo = #{orderNo},orderItemId = #{orderItemId},isValid = #{isValid},isLimitTime = #{isLimitTime},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},receiveTime = #{receiveTime},isSentSMS = #{isSentSMS},SMSStatus = #{SMSStatus},SMSUrl = #{SMSUrl},SMSInfo = #{SMSInfo},remarks = #{remarks},isSyncHis = #{isSyncHis},appId = #{appId},moneyRuleId = #{moneyRuleId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into user_money_unclaimed (id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,isDel,createTime,editTime) values (#{id},#{userId},#{fundType},#{originChannel},#{originSubject},#{opType},#{commonId},#{opNumber},#{fundOpType},#{status},#{operatorId},#{operatorName},#{operatorType},#{operatorShopId},#{operatorShopName},#{operationReason},#{orderType},#{orderId},#{orderNo},#{orderItemId},#{isValid},#{limitStartTime},#{limitEndTime},#{expirationTime},#{receiveTime},#{isSentSMS},#{SMSStatus},#{SMSUrl},#{SMSInfo},#{remarks},#{isSyncHis},#{appId},#{isDel},#{createTime},#{editTime}) |
| | | insert into user_money_unclaimed (id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,isLimitTime,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,moneyRuleId,isDel,createTime,editTime) values (#{id},#{userId},#{fundType},#{originChannel},#{originSubject},#{opType},#{commonId},#{opNumber},#{fundOpType},#{status},#{operatorId},#{operatorName},#{operatorType},#{operatorShopId},#{operatorShopName},#{operationReason},#{orderType},#{orderId},#{orderNo},#{orderItemId},#{isValid},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{receiveTime},#{isSentSMS},#{SMSStatus},#{SMSUrl},#{SMSInfo},#{remarks},#{isSyncHis},#{appId},#{moneyRuleId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.userMoney.UserMoneyUnclaimed"> |
| | | insert into user_money_unclaimed (id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,isDel,createTime,editTime) values (#{id},#{userId},#{fundType},#{originChannel},#{originSubject},#{opType},#{commonId},#{opNumber},#{fundOpType},#{status},#{operatorId},#{operatorName},#{operatorType},#{operatorShopId},#{operatorShopName},#{operationReason},#{orderType},#{orderId},#{orderNo},#{orderItemId},#{isValid},#{limitStartTime},#{limitEndTime},#{expirationTime},#{receiveTime},#{isSentSMS},#{SMSStatus},#{SMSUrl},#{SMSInfo},#{remarks},#{isSyncHis},#{appId},#{isDel},#{createTime},#{editTime}) |
| | | insert into user_money_unclaimed (id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,isLimitTime,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,moneyRuleId,isDel,createTime,editTime) values (#{id},#{userId},#{fundType},#{originChannel},#{originSubject},#{opType},#{commonId},#{opNumber},#{fundOpType},#{status},#{operatorId},#{operatorName},#{operatorType},#{operatorShopId},#{operatorShopName},#{operationReason},#{orderType},#{orderId},#{orderNo},#{orderItemId},#{isValid},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{receiveTime},#{isSentSMS},#{SMSStatus},#{SMSUrl},#{SMSInfo},#{remarks},#{isSyncHis},#{appId},#{moneyRuleId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.userMoney.UserMoneyUnclaimed" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.userMoney.UserMoneyUnclaimed" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,isDel,createTime,editTime |
| | | id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,isLimitTime,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,moneyRuleId,isDel,createTime,editTime |
| | | from user_money_unclaimed |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.userMoney.UserMoneyUnclaimed" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,isDel,createTime,editTime |
| | | id,userId,fundType,originChannel,originSubject,opType,commonId,opNumber,fundOpType,status,operatorId,operatorName,operatorType,operatorShopId,operatorShopName,operationReason,orderType,orderId,orderNo,orderItemId,isValid,isLimitTime,limitStartTime,limitEndTime,expirationTime,receiveTime,isSentSMS,SMSStatus,SMSUrl,SMSInfo,remarks,isSyncHis,appId,moneyRuleId,isDel,createTime,editTime |
| | | from user_money_unclaimed |
| | | WHERE id = #{value} |
| | | </select> |
| | |
| | | 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.phiappt.constants.tool.TimerHandleTool; |
| | | import com.hx.phiappt.constants.tool.UserInfoTool; |
| | | import com.hx.phiappt.constants.tool.money.UserMoneyTool; |
| | | import com.hx.phiappt.dto.money.MoneyRuleValueDto; |
| | | import com.hx.phiappt.model.*; |
| | | import com.hx.phiappt.model.giving.TurnAdd; |
| | | import com.hx.phiappt.model.money.MoneyRule; |
| | | import com.hx.phip.config.CustomParameter; |
| | | import com.hx.phip.dao.mapper.*; |
| | | import com.hx.phip.entity.enums.UserMoneyEnum; |
| | |
| | | private UserValueAddedFundRecordService userValueAddedFundRecordService; |
| | | @Resource |
| | | private TurnAddMapper turnAddMapper; |
| | | @Resource |
| | | private MoneyRuleMapper moneyRuleMapper; |
| | | |
| | | /** |
| | | * 查询列表 |
| | |
| | | if (StringUtils.isEmpty(userMoneyUnclaimed.getUserId())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户id不能为空"); |
| | | } |
| | | |
| | | // 资金类型判断 |
| | | if (userMoneyUnclaimed.getFundType() == null) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "资金类型不能为空"); |
| | |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "资金类型错误,类型不存在"); |
| | | } |
| | | } |
| | | |
| | | //获取金额配置 |
| | | MoneyRule moneyRule = getMoneyRule(userMoneyUnclaimed.getMoneyRuleId()); |
| | | if (moneyRule != null){ |
| | | logger.info("操作资金-moneyRule规则数据:"+JSON.toJSONString(moneyRule)); |
| | | //增值金校验 |
| | | if (moneyRule.getMoneyType().equals(MoneyRule.MONEY_TYPE_ADDED_FUND) |
| | | && !userMoneyUnclaimed.getFundType().equals(UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作资金类型与金额规则类型匹配!"); |
| | | } |
| | | //积分校验 |
| | | if (moneyRule.getMoneyType().equals(MoneyRule.MONEY_TYPE_INTEGRAL) |
| | | && !userMoneyUnclaimed.getFundType().equals(UserMoneyUnclaimed.FUND_TYPE_INTEGRAL)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作资金类型与金额规则类型匹配!"); |
| | | } |
| | | } |
| | | // 来源渠道 |
| | | if (StringUtils.isEmpty(userMoneyUnclaimed.getOriginChannel())) { |
| | | // 默认来源渠道为 预约后台 |
| | |
| | | } |
| | | } |
| | | |
| | | // 操作类型 |
| | | //操作类型,默认为系统处理 |
| | | if (userMoneyUnclaimed.getOpType() == null) { |
| | | // 默认为系统处理 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | // 增值金默认需要领取 |
| | | if (UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND == userMoneyUnclaimed.getFundType()) { |
| | | // 增值金默认需要领取 负数不用用户领取和判断是否需要发送短信提醒领取 |
| | | if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) < 0) { |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE); |
| | | } |
| | | } |
| | | } else { |
| | | }else { |
| | | // 判断是否是支持的类型 |
| | | if (UserMoneyUnclaimed.OP_TYPE_SYSTEM != userMoneyUnclaimed.getOpType() && UserMoneyUnclaimed.OP_TYPE_RECEIVE != userMoneyUnclaimed.getOpType()) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作类型错误"); |
| | | } |
| | | //增值金默认需要领取 |
| | | if (UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND == userMoneyUnclaimed.getFundType()) { |
| | | if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) < 0) { |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE); |
| | | }else { |
| | | //负数不用用户领取和判断是否需要发送短信提醒领取 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | } |
| | | }else { |
| | | //其他金额类型默认不需要领取 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | } |
| | | } |
| | | |
| | | // 是否发送短信 |
| | | if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()) { |
| | | boolean flag = true; |
| | | // 查询用户设置是否领取状态 |
| | | UserInfo userInfo = userInfoMapper.selectOneByUserId(userMoneyUnclaimed.getUserId()); |
| | | if (userInfo != null) { |
| | | // 不需要领取处理数据 |
| | | if (userInfo.getIsReceiveValueAddedFund() != null && BaseEntity.NO.equals(userInfo.getIsReceiveValueAddedFund())) { |
| | | //规则不需要校验用户勾选 |
| | | if (moneyRule != null && moneyRule.getIsUserReceive().equals(BaseEntity.NO)){ |
| | | if (moneyRule.getIsNeedReceive().equals(BaseEntity.YES)){ |
| | | logger.info("操作用户资金(待领取记录)-不校验用户设置是否需要领取状态-但是需要用户领取"); |
| | | //需要领取 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE); |
| | | }else if (moneyRule.getIsNeedReceive().equals(BaseEntity.NO)){ |
| | | logger.info("操作用户资金(待领取记录)-不校验用户设置是否需要领取状态-并且不需要用户领取"); |
| | | //不需要领取 |
| | | flag = false; |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | // 用户设置了不用再领取增值金 |
| | | logger.info("操作用户资金(待领取记录)-用户设置是否需要领取状态:{}", userInfo.getIsReceiveValueAddedFund()); |
| | | } |
| | | }else { |
| | | // 查询用户设置是否领取状态 |
| | | UserInfo userInfo = userInfoMapper.selectOneByUserId(userMoneyUnclaimed.getUserId()); |
| | | if (userInfo != null) { |
| | | // 不需要领取处理数据 |
| | | if (userInfo.getIsReceiveValueAddedFund() != null && BaseEntity.NO.equals(userInfo.getIsReceiveValueAddedFund())) { |
| | | // 用户设置了不用再领取增值金 |
| | | flag = false; |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | logger.info("操作用户资金(待领取记录)-用户设置是否需要领取状态:{}", userInfo.getIsReceiveValueAddedFund()); |
| | | } |
| | | } |
| | | } |
| | | // 校验是否要发送短信 |
| | |
| | | checkIsNeedSentSMS(userMoneyUnclaimed); |
| | | } |
| | | } |
| | | |
| | | // 判断操作数量或金额 |
| | | if (userMoneyUnclaimed.getOpNumber() == null) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作数量或金额不能为空"); |
| | |
| | | } |
| | | }*/ |
| | | |
| | | // 获取有效期时间配置 待领取默认30天领取 |
| | | int validityPeriod = UserMoneyTool.getUnclaimedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | if (moneyRule != null){ |
| | | if (moneyRule.getWaitReceiveLimit().equals(BaseEntity.YES)){ |
| | | // 获取有效期时间配置 待领取默认30天领取 |
| | | int validityPeriod = moneyRule.getWaitReceiveLimitDay(); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | }else if (moneyRule.getWaitReceiveLimit().equals(BaseEntity.NO)){ |
| | | userMoneyUnclaimed.setIsLimitTime(BaseEntity.NO); |
| | | // 获取时间(这里默认给100年,实际上是需要判断是否限制的字段) |
| | | Date limitEndTime = DateUtil.addYear(userMoneyUnclaimed.getLimitStartTime(),100); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | } |
| | | }else { |
| | | // 获取有效期时间配置 待领取默认30天领取 |
| | | int validityPeriod = UserMoneyTool.getUnclaimedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | } |
| | | } |
| | | |
| | | /**获取金额规则信息*/ |
| | | private MoneyRule getMoneyRule(String moneyRuleId) { |
| | | MoneyRule moneyRule = null; |
| | | if (StringUtils.noNull(moneyRuleId)){ |
| | | moneyRule = moneyRuleMapper.selectOneByKey(moneyRuleId); |
| | | if (moneyRule == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "资金规则信息不存在"); |
| | | } |
| | | }else { |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String,Object> sqlMap = new HashMap<>(); |
| | | sqlMap.put("isDel",BaseEntity.NO); |
| | | sqlMap.put("isUp",BaseEntity.YES); |
| | | sqlMap.put("isDefault",BaseEntity.YES); |
| | | sqlSentence.sqlSentence("SELECT * FROM money_rule WHERE isDle = #{m.isDel} " + |
| | | " AND isUp = #{m.isUp} AND isDefault = #{m.isDefault} ",sqlMap); |
| | | moneyRule = moneyRuleMapper.selectOne(sqlSentence); |
| | | } |
| | | return moneyRule; |
| | | } |
| | | |
| | | /** |
| | |
| | | logger.info("待领取资产处理跳过,数据id:{},原因:数据已失效无法领取", userMoneyUnclaimed.getId()); |
| | | return; |
| | | } |
| | | //获取关联的规则 |
| | | MoneyRule moneyRule = getMoneyRule(userMoneyUnclaimed.getMoneyRuleId()); |
| | | if (moneyRule != null && moneyRule.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | //有领取限制 |
| | | List<MoneyRuleValueDto> moneyRuleValueDtoList = JSONArray.parseArray(moneyRule.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | boolean isPass = false; |
| | | if (moneyRule.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : moneyRuleValueDtoList) { |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode(),userMoneyUnclaimed.getUserId())){ |
| | | isPass = true; |
| | | break; |
| | | } |
| | | } |
| | | }else if (moneyRule.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : moneyRuleValueDtoList) { |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode(),userMoneyUnclaimed.getUserId())){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!isPass){ |
| | | logger.info("待领取资产处理跳过,数据id:{},原因:用户不满足金额的领取限制", userMoneyUnclaimed.getId()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 添加用户日志 |
| | | if (BaseEntity.NO.equals(isReceive)) { |
| | | addUserLog(userMoneyUnclaimed, BaseEntity.YES); |
| | |
| | | sqlValue.put("nowTime", new Date()); |
| | | sqlValue.put("id", userMoneyUnclaimed.getId()); |
| | | sqlValue.put("status", UserMoneyUnclaimed.STATUS_SUCCEED); |
| | | // 已领取调整领取时间 |
| | | int validityPeriod = UserMoneyTool.getReceivedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | sqlValue.put("limitEndTime", limitEndTime); |
| | | if (moneyRule != null){ |
| | | //有限制 |
| | | if (moneyRule.getReceiveMoneyLimit().equals(BaseEntity.YES)){ |
| | | //无限制,默认100年 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(),moneyRule.getWaitReceiveLimitDay()); |
| | | sqlValue.put("limitEndTime", limitEndTime); |
| | | }else { |
| | | //无限制,默认100年 |
| | | Date limitEndTime = DateUtil.addYear(userMoneyUnclaimed.getLimitStartTime(), 100); |
| | | sqlValue.put("limitEndTime", limitEndTime); |
| | | } |
| | | }else { |
| | | // 已领取调整领取时间 |
| | | int validityPeriod = UserMoneyTool.getReceivedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | sqlValue.put("limitEndTime", limitEndTime); |
| | | } |
| | | sqlSentence.sqlSentence(sql, sqlValue); |
| | | commonService.updateWhere(UserMoneyUnclaimedMapper.class, sqlSentence); |
| | | } |