Merge branch 'master-fwq-金额规则配置' into chenjiahe-爆款活动
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},opType = #{opType},opName = #{opName},opId = #{opId},originChannel = #{originChannel},orderId = #{orderId},orderItemId = #{orderItemId},orderType = #{orderType},totalQuantity = #{totalQuantity},notUsedQuantity = #{notUsedQuantity},usedQuantity = #{usedQuantity},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},remarks = #{remarks},commonId = #{commonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | ,userId = #{userId},opType = #{opType},opName = #{opName},opId = #{opId},originChannel = #{originChannel},orderId = #{orderId},orderItemId = #{orderItemId},orderType = #{orderType},totalQuantity = #{totalQuantity},notUsedQuantity = #{notUsedQuantity},usedQuantity = #{usedQuantity},isLimitTime = #{isLimitTime},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},remarks = #{remarks},commonId = #{commonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into user_integral_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalQuantity},#{notUsedQuantity},#{usedQuantity},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | insert into user_integral_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalQuantity},#{notUsedQuantity},#{usedQuantity},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.UserIntegralRecord"> |
| | | insert into user_integral_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalQuantity},#{notUsedQuantity},#{usedQuantity},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.UserIntegralRecord" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.UserIntegralRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | from user_integral_record |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.UserIntegralRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalQuantity,notUsedQuantity,usedQuantity,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | from user_integral_record |
| | | WHERE id = #{value} |
| | | </select> |
| | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <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},isNeedReceive = #{isNeedReceive},isUserReceive = #{isUserReceive},waitReceiveLimit = #{waitReceiveLimit},waitReceiveLimitDay = #{waitReceiveLimitDay},isReceiveLimit = #{isReceiveLimit},receiveLimitType = #{receiveLimitType},receiveLimitData = #{receiveLimitData},receiveMoneyLimit = #{receiveMoneyLimit},receiveMoneyLimitDay = #{receiveMoneyLimitDay},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,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,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},#{isNeedReceive},#{isUserReceive},#{waitReceiveLimit},#{waitReceiveLimitDay},#{isReceiveLimit},#{receiveLimitType},#{receiveLimitData},#{receiveMoneyLimit},#{receiveMoneyLimitDay},#{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,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,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},#{isNeedReceive},#{isUserReceive},#{waitReceiveLimit},#{waitReceiveLimitDay},#{isReceiveLimit},#{receiveLimitType},#{receiveLimitData},#{receiveMoneyLimit},#{receiveMoneyLimitDay},#{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,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,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,isNeedReceive,isUserReceive,waitReceiveLimit,waitReceiveLimitDay,isReceiveLimit,receiveLimitType,receiveLimitData,receiveMoneyLimit,receiveMoneyLimitDay,isDel,createTime,editTime |
| | | from user_money_unclaimed |
| | | WHERE id = #{value} |
| | | </select> |
| | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,userId = #{userId},opType = #{opType},opName = #{opName},opId = #{opId},originChannel = #{originChannel},orderId = #{orderId},orderItemId = #{orderItemId},orderType = #{orderType},totalAmount = #{totalAmount},notUsedAmount = #{notUsedAmount},usedAmount = #{usedAmount},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},remarks = #{remarks},commonId = #{commonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | ,userId = #{userId},opType = #{opType},opName = #{opName},opId = #{opId},originChannel = #{originChannel},orderId = #{orderId},orderItemId = #{orderItemId},orderType = #{orderType},totalAmount = #{totalAmount},notUsedAmount = #{notUsedAmount},usedAmount = #{usedAmount},isLimitTime = #{isLimitTime},limitStartTime = #{limitStartTime},limitEndTime = #{limitEndTime},expirationTime = #{expirationTime},remarks = #{remarks},commonId = #{commonId},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into user_value_added_fund_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalAmount},#{notUsedAmount},#{usedAmount},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | insert into user_value_added_fund_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalAmount},#{notUsedAmount},#{usedAmount},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.UserValueAddedFundRecord"> |
| | | insert into user_value_added_fund_record (id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime) values (#{id},#{userId},#{opType},#{opName},#{opId},#{originChannel},#{orderId},#{orderItemId},#{orderType},#{totalAmount},#{notUsedAmount},#{usedAmount},#{isLimitTime},#{limitStartTime},#{limitEndTime},#{expirationTime},#{remarks},#{commonId},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.UserValueAddedFundRecord" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.UserValueAddedFundRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | from user_value_added_fund_record |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.UserValueAddedFundRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | id,userId,opType,opName,opId,originChannel,orderId,orderItemId,orderType,totalAmount,notUsedAmount,usedAmount,isLimitTime,limitStartTime,limitEndTime,expirationTime,remarks,commonId,isDel,createTime,editTime |
| | | from user_value_added_fund_record |
| | | WHERE id = #{value} |
| | | </select> |
| | |
| | | package com.hx.phip.controller.user; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hx.common.BaseController; |
| | | import com.hx.exception.TipsException; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.common.PlatformConstants; |
| | | import com.hx.phiappt.constants.enums.SysFunctionLimitEnum; |
| | | import com.hx.phiappt.constants.tool.employee.EmployeeTool; |
| | | import com.hx.phiappt.constants.tool.money.UserMoneyTool; |
| | | import com.hx.phiappt.dao.mapper.UserMoneyUnclaimedMapper; |
| | | import com.hx.phiappt.dto.money.MoneyRuleValueDto; |
| | | import com.hx.phiappt.model.BaseEntity; |
| | | import com.hx.phiappt.model.User; |
| | | import com.hx.phiappt.model.UserIntegralRecord; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //查询不可使用原因 |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(0); |
| | | if (userMoneyUnclaimed.getIsSelectNotUse() != null && userMoneyUnclaimed.getIsSelectNotUse().equals(BaseEntity.YES)){ |
| | | String canUseReason = getCanUseReason(userMoneyUnclaimedInfo); |
| | | if (StringUtils.noNull(canUseReason)){ |
| | | userMoneyUnclaimedInfo.setIsShowNotUse(1); |
| | | userMoneyUnclaimedInfo.setNotUseReason(canUseReason); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return PlatformResult.success(data); |
| | | } |
| | | |
| | | /**获取不可领取原因*/ |
| | | private String getCanUseReason(UserMoneyUnclaimed userMoneyUnclaimed) { |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() != null && userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | // 具体限制类型 |
| | | if (userMoneyUnclaimed.getReceiveLimitType() != null){ |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | if (limitList != null && limitList.size() > 0){ |
| | | //判断校验逻辑 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | boolean isPass = false; |
| | | StringBuilder msg = new StringBuilder(); |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | if (msg.length() > 0){ |
| | | msg.append(","); |
| | | } |
| | | msg.append(SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode())); |
| | | isPass = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!isPass){ |
| | | return "未达成其中一个条件:" + msg; |
| | | } |
| | | } else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return "未达成条件:"+SysFunctionLimitEnum.getNameByCode(moneyRuleValueDto.getFunctionCode()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 领取用户资产 |
| | | * @param request 请求 |
| | |
| | | opNumber = userMoneyUnclaimed.getOpNumber(); |
| | | } |
| | | // 获取有效期 |
| | | Date expirationTime = UserMoneyTool.getUserIntegralExpirationTime(commonService); |
| | | //Date expirationTime = UserMoneyTool.getUserIntegralExpirationTime(commonService); |
| | | //外面处理结束时间传进来 |
| | | Date expirationTime = userMoneyUnclaimed.getLimitEndTime(); |
| | | // 添加记录 |
| | | UserIntegralRecord userIntegralRecord = new UserIntegralRecord(userMoneyUnclaimed.getUserId(), userMoneyUnclaimed.getOrderId(), userMoneyUnclaimed.getOrderItemId(), |
| | | UserIntegralRecord userIntegralRecord = new UserIntegralRecord(userMoneyUnclaimed.getUserId() |
| | | , userMoneyUnclaimed.getOrderId(), userMoneyUnclaimed.getOrderItemId(), |
| | | userMoneyUnclaimed.getOperationReason(), opNumber, expirationTime, userMoneyUnclaimed.getId()); |
| | | userIntegralRecord.setIsLimitTime(userMoneyUnclaimed.getIsLimitTime()); |
| | | int insert = commonService.insert(UserIntegralRecordMapper.class, userIntegralRecord); |
| | | if (insert != 1) { |
| | | throw new TipsException("新增数据失败!"); |
| | |
| | | opNumber = userMoneyUnclaimed.getOpNumber(); |
| | | } |
| | | // 获取有效期 |
| | | Date expirationTime = UserMoneyTool.getUserValueAddedFundExpirationTime(commonService); |
| | | //Date expirationTime = UserMoneyTool.getUserValueAddedFundExpirationTime(commonService); |
| | | //外面处理结束时间传进来 |
| | | Date expirationTime = userMoneyUnclaimed.getLimitEndTime(); |
| | | // 添加记录 |
| | | UserValueAddedFundRecord userValueAddedFundRecord = new UserValueAddedFundRecord(userMoneyUnclaimed.getUserId(), userMoneyUnclaimed.getOrderId(), userMoneyUnclaimed.getOrderItemId(), |
| | | UserValueAddedFundRecord userValueAddedFundRecord = new UserValueAddedFundRecord(userMoneyUnclaimed.getUserId() |
| | | , userMoneyUnclaimed.getOrderId(), userMoneyUnclaimed.getOrderItemId(), |
| | | userMoneyUnclaimed.getOperationReason(), opNumber, expirationTime, userMoneyUnclaimed.getId()); |
| | | userValueAddedFundRecord.setIsLimitTime(userMoneyUnclaimed.getIsLimitTime()); |
| | | int insert = commonService.insert(UserValueAddedFundRecordMapper.class, userValueAddedFundRecord); |
| | | if (insert != 1) { |
| | | throw new TipsException("新增数据失败!"); |
| | |
| | | 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, "资金类型不能为空"); |
| | |
| | | } |
| | | } |
| | | |
| | | // 来源渠道 |
| | | if (StringUtils.isEmpty(userMoneyUnclaimed.getOriginChannel())) { |
| | | // 默认来源渠道为 预约后台 |
| | | userMoneyUnclaimed.setOriginChannel(OriginChannelConstants.ORIGIN_CHANNEL_PHIS); |
| | | // throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "来源渠道不能为空"); |
| | | } |
| | | /* else { |
| | | if (checkConstantNotHaveValue(OriginChannelConstants.class, userMoneyUnclaimed.getOriginChannel())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "来源渠道错误,渠道不存在"); |
| | | } |
| | | }*/ |
| | | |
| | | // 操作原因 |
| | | if (StringUtils.isEmpty(userMoneyUnclaimed.getOperationReason())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作原因不能为空"); |
| | | } else { |
| | | if (checkConstantNotHaveValue(OperationReasonConstants.class, userMoneyUnclaimed.getOperationReason())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作原因错误,原因不存在"); |
| | | } |
| | | } |
| | | if (checkConstantNotHaveValue(OperationReasonConstants.class, userMoneyUnclaimed.getOperationReason())) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作原因错误,原因不存在"); |
| | | } |
| | | |
| | | // 操作类型 |
| | | 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 { |
| | | // 判断是否是支持的类型 |
| | | if (UserMoneyUnclaimed.OP_TYPE_SYSTEM != userMoneyUnclaimed.getOpType() && UserMoneyUnclaimed.OP_TYPE_RECEIVE != userMoneyUnclaimed.getOpType()) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作类型错误"); |
| | | } |
| | | } |
| | | // 获取金额配置,(有传标识则拿对应的配置,否则拿默认配置) |
| | | MoneyRule moneyRule = getMoneyRule(userMoneyUnclaimed.getMoneyRuleId(),userMoneyUnclaimed.getFundType()); |
| | | logger.info("操作资金-moneyRule规则数据:"+JSON.toJSONString(moneyRule)); |
| | | |
| | | // 是否发送短信 |
| | | 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())) { |
| | | flag = false; |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | // 用户设置了不用再领取增值金 |
| | | logger.info("操作用户资金(待领取记录)-用户设置是否需要领取状态:{}", userInfo.getIsReceiveValueAddedFund()); |
| | | } |
| | | } |
| | | // 校验是否要发送短信 |
| | | if (flag) { |
| | | checkIsNeedSentSMS(userMoneyUnclaimed); |
| | | } |
| | | } |
| | | //获得操作类型 |
| | | logger.info("操作待领取资金-请求的类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | checkGetOpType(userMoneyUnclaimed,moneyRule); |
| | | logger.info("操作待领取资金-最终的类型(0系统1领取):"+userMoneyUnclaimed.getOpType()); |
| | | |
| | | // 判断操作数量或金额 |
| | | if (userMoneyUnclaimed.getOpNumber() == null) { |
| | |
| | | } |
| | | } |
| | | }*/ |
| | | //设置待领取的有效时间 |
| | | if (moneyRule != null){ |
| | | if (moneyRule.getWaitReceiveLimit().equals(BaseEntity.YES)){ |
| | | userMoneyUnclaimed.setIsLimitTime(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 { |
| | | // 走原本默认的设置 |
| | | userMoneyUnclaimed.setIsLimitTime(BaseEntity.YES); |
| | | // 获取有效期时间配置 待领取默认30天领取 |
| | | int validityPeriod = UserMoneyTool.getUnclaimedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | } |
| | | // 默认来源渠道为 预约后台 |
| | | if (StringUtils.isEmpty(userMoneyUnclaimed.getOriginChannel())) { |
| | | userMoneyUnclaimed.setOriginChannel(OriginChannelConstants.ORIGIN_CHANNEL_PHIS); |
| | | } |
| | | // 填充金额规则数据 |
| | | if (moneyRule != null){ |
| | | userMoneyUnclaimed.setMoneyRuleId(moneyRule.getId()); |
| | | userMoneyUnclaimed.setIsNeedReceive(moneyRule.getIsNeedReceive()); |
| | | userMoneyUnclaimed.setIsUserReceive(moneyRule.getIsUserReceive()); |
| | | userMoneyUnclaimed.setWaitReceiveLimit(moneyRule.getWaitReceiveLimit()); |
| | | userMoneyUnclaimed.setWaitReceiveLimitDay(moneyRule.getWaitReceiveLimitDay()); |
| | | userMoneyUnclaimed.setIsReceiveLimit(moneyRule.getIsReceiveLimit()); |
| | | userMoneyUnclaimed.setReceiveLimitType(moneyRule.getReceiveLimitType()); |
| | | userMoneyUnclaimed.setReceiveLimitData(moneyRule.getReceiveLimitData()); |
| | | userMoneyUnclaimed.setReceiveMoneyLimit(moneyRule.getReceiveMoneyLimit()); |
| | | userMoneyUnclaimed.setReceiveMoneyLimitDay(moneyRule.getReceiveMoneyLimitDay()); |
| | | } |
| | | //要领取的资金填充发送短信信息 |
| | | if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()){ |
| | | //暂时默认增值金会发送短信 |
| | | if (UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND == userMoneyUnclaimed.getFundType()) { |
| | | checkIsNeedSentSMS(userMoneyUnclaimed); |
| | | } |
| | | //其他处理 |
| | | |
| | | // 获取有效期时间配置 待领取默认30天领取 |
| | | int validityPeriod = UserMoneyTool.getUnclaimedValidityTime(commonService); |
| | | // 获取时间 |
| | | Date limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | // 设置有效期时间 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | } |
| | | } |
| | | |
| | | /**校验并获得资金操作类型(系统/领取)*/ |
| | | private void checkGetOpType(UserMoneyUnclaimed userMoneyUnclaimed, MoneyRule moneyRule) { |
| | | // 负数默认系统处理 |
| | | if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) > 0) { |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | return; |
| | | } |
| | | // 如果是请求需要系统处理,则直接返回 |
| | | if (userMoneyUnclaimed.getOpType() != null && UserMoneyUnclaimed.OP_TYPE_SYSTEM == userMoneyUnclaimed.getOpType()){ |
| | | return; |
| | | } |
| | | |
| | | // 未有操作类型默认为系统处理(其中增值金默认需要领取) |
| | | if (userMoneyUnclaimed.getOpType() == null) { |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | } |
| | | // 判断是否是支持的类型 |
| | | if (UserMoneyUnclaimed.OP_TYPE_SYSTEM != userMoneyUnclaimed.getOpType() && UserMoneyUnclaimed.OP_TYPE_RECEIVE != userMoneyUnclaimed.getOpType()) { |
| | | throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作类型错误"); |
| | | } |
| | | |
| | | // 有规则,且规则不需要校验用户勾选,则校验基础规则中是否需要领取 |
| | | if (moneyRule != null && moneyRule.getIsUserReceive().equals(BaseEntity.NO)){ |
| | | logger.info("操作用户资金(待领取记录)-不校验用户设置是否需要领取状态-是否需要用户领取:"+moneyRule.getIsNeedReceive()); |
| | | if (moneyRule.getIsNeedReceive().equals(BaseEntity.NO)){ |
| | | //不需要领取,设置为系统处理 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | }else { |
| | | //需要领取 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE); |
| | | } |
| | | }else { |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM); |
| | | // 需要判断用户是否勾选(暂时只有增值金需要判断用户是否勾选) |
| | | if (UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND == userMoneyUnclaimed.getFundType()){ |
| | | UserInfo userInfo = userInfoMapper.selectOneByUserId(userMoneyUnclaimed.getUserId()); |
| | | if (userInfo != null){ |
| | | logger.info("操作用户资金(待领取记录)-用户设置增值金是否需要领取状态:{}", userInfo.getIsReceiveValueAddedFund()); |
| | | if (userInfo.getIsReceiveValueAddedFund() != null && BaseEntity.YES.equals(userInfo.getIsReceiveValueAddedFund())){ |
| | | // 用户设置了不用再领取,设置为系统处理 |
| | | userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取金额规则信息 |
| | | * @param moneyRuleId 金额规则 |
| | | * @param fundType 操作的金额类型 |
| | | * */ |
| | | private MoneyRule getMoneyRule(String moneyRuleId,Integer fundType) { |
| | | MoneyRule moneyRule = null; |
| | | if (StringUtils.noNull(moneyRuleId)){ |
| | | moneyRule = moneyRuleMapper.selectOneByKey(moneyRuleId); |
| | | if (moneyRule == null){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "标识错误,金额规则信息查询失败"); |
| | | } |
| | | if (moneyRule.getMoneyType().equals(MoneyRule.MONEY_TYPE_ADDED_FUND)){ |
| | | //增值金校验 |
| | | if (!fundType.equals(UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作资金类型与金额规则类型不匹配,当前操作【增值金】"); |
| | | } |
| | | }else if (moneyRule.getMoneyType().equals(MoneyRule.MONEY_TYPE_INTEGRAL)){ |
| | | //积分校验 |
| | | if (!fundType.equals(UserMoneyUnclaimed.FUND_TYPE_INTEGRAL)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作资金类型与金额规则类型不匹配,当前操作【积分】"); |
| | | } |
| | | } |
| | | }else { |
| | | //查找增值金/积分默认配置信息 |
| | | if (fundType.equals(UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND) || fundType.equals(UserMoneyUnclaimed.FUND_TYPE_INTEGRAL)){ |
| | | 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); |
| | | sqlMap.put("moneyType",-1); |
| | | if (fundType.equals(UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND)){ |
| | | //增值金 |
| | | sqlMap.put("moneyType",MoneyRule.MONEY_TYPE_ADDED_FUND); |
| | | }else if (fundType.equals(UserMoneyUnclaimed.FUND_TYPE_INTEGRAL)){ |
| | | //积分 |
| | | sqlMap.put("moneyType",MoneyRule.MONEY_TYPE_INTEGRAL); |
| | | } |
| | | sqlSentence.sqlSentence("SELECT * FROM money_rule WHERE isDel = #{m.isDel} " + |
| | | " AND isUp = #{m.isUp} AND isDefault = #{m.isDefault} AND moneyType = #{m.moneyType} ",sqlMap); |
| | | moneyRule = moneyRuleMapper.selectOne(sqlSentence); |
| | | } |
| | | } |
| | | return moneyRule; |
| | | } |
| | | |
| | | /** |
| | |
| | | logger.info("待领取资产处理跳过,数据id:{},原因:数据已失效无法领取", userMoneyUnclaimed.getId()); |
| | | return; |
| | | } |
| | | // 添加用户日志 |
| | | if (BaseEntity.NO.equals(isReceive)) { |
| | | addUserLog(userMoneyUnclaimed, BaseEntity.YES); |
| | | //计算有效结束时间,操作资金处理用到结束时间 |
| | | Date limitEndTime = null; |
| | | //有限制时间规则 |
| | | if (StringUtils.noNull(userMoneyUnclaimed.getMoneyRuleId())){ |
| | | if (userMoneyUnclaimed.getReceiveMoneyLimit() != null && userMoneyUnclaimed.getReceiveMoneyLimit().equals(BaseEntity.YES)){ |
| | | //要领取的资金判断是否满足条件 |
| | | if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType() && checkCanNotReceive(userMoneyUnclaimed)){ |
| | | throw new PlatTipsException(PlatformCode.ERROR_TIPS,"领取失败,未满足领取条件"); |
| | | } |
| | | //有限制,限制结束时间计算 |
| | | logger.info("待领取资产处理,数据id:{},关联规则限制天数{}",userMoneyUnclaimed.getId(),userMoneyUnclaimed.getWaitReceiveLimitDay()); |
| | | limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(),userMoneyUnclaimed.getWaitReceiveLimitDay()); |
| | | }else { |
| | | //无限制,默认100年 |
| | | limitEndTime = DateUtil.addYear(userMoneyUnclaimed.getLimitStartTime(), 100); |
| | | } |
| | | }else { |
| | | // 已领取调整领取时间 |
| | | int validityPeriod = UserMoneyTool.getReceivedValidityTime(commonService); |
| | | // 获取时间 |
| | | limitEndTime = DateUtil.addDay(userMoneyUnclaimed.getLimitStartTime(), validityPeriod); |
| | | } |
| | | // 传进去下面的资金处理 |
| | | userMoneyUnclaimed.setLimitEndTime(limitEndTime); |
| | | // 操作资金处理 |
| | | switch (userMoneyUnclaimed.getFundType()) { |
| | | case UserMoneyUnclaimed.FUND_TYPE_STORED_VALUE_FUND: |
| | |
| | | userIntegralRecordService.handleData(userMoneyUnclaimed); |
| | | break; |
| | | } |
| | | // 添加用户日志 |
| | | if (BaseEntity.NO.equals(isReceive)) { |
| | | addUserLog(userMoneyUnclaimed, BaseEntity.YES); |
| | | } |
| | | // 更新状态成已处理 |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String, Object> sqlValue = new HashMap<>(); |
| | | String sql = " status=#{m.status},receiveTime=#{m.nowTime},limitEndTime=#{m.limitEndTime},editTime=#{m.nowTime} WHERE id=#{m.id}"; |
| | | Map<String, Object> sqlValue = new HashMap<>(); |
| | | sqlValue.put("limitEndTime", limitEndTime); |
| | | sqlValue.put("status", UserMoneyUnclaimed.STATUS_SUCCEED); |
| | | 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); |
| | | sqlSentence.sqlSentence(sql, sqlValue); |
| | | commonService.updateWhere(UserMoneyUnclaimedMapper.class, sqlSentence); |
| | | if (commonService.updateWhere(UserMoneyUnclaimedMapper.class, sqlSentence) != 1){ |
| | | logger.error("领取金额状态修改失败,sql{},map{}",sqlSentence.getSqlSentence(),JSON.toJSONString(sqlValue)); |
| | | throw new TipsException("金额领取处理失败,错误代码[01]"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是不是 不可领取的状态 |
| | | * @param userMoneyUnclaimed 参数 |
| | | * @return true是不可领取 |
| | | * */ |
| | | private boolean checkCanNotReceive(UserMoneyUnclaimed userMoneyUnclaimed) { |
| | | //无限制可以领取 |
| | | if (userMoneyUnclaimed.getIsReceiveLimit() == null || !userMoneyUnclaimed.getIsReceiveLimit().equals(BaseEntity.YES)){ |
| | | return false; |
| | | } |
| | | List<MoneyRuleValueDto> limitList = JSONArray.parseArray(userMoneyUnclaimed.getReceiveLimitData(), MoneyRuleValueDto.class); |
| | | logger.info("待领取资产处理,数据id:{},限制数据{},解析的数据{}" |
| | | ,userMoneyUnclaimed.getId(),userMoneyUnclaimed.getReceiveLimitData(),JSON.toJSONString(limitList)); |
| | | if (limitList == null || limitList.size() < 1){ |
| | | return false; |
| | | } |
| | | // 无具体限制类型 |
| | | if (userMoneyUnclaimed.getReceiveLimitType() == null){ |
| | | return false; |
| | | } |
| | | //判断校验逻辑 |
| | | if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.YES)){ |
| | | //满足其一 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //满足一个则设为通过,退出循环 |
| | | if (SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return false; |
| | | } |
| | | } |
| | | } else if (userMoneyUnclaimed.getReceiveLimitType().equals(BaseEntity.NO)){ |
| | | //都要满足 |
| | | for (MoneyRuleValueDto moneyRuleValueDto : limitList) { |
| | | //存在一个不满足则退出循环 |
| | | if (!SysFunctionLimitEnum.checkPassByCode(moneyRuleValueDto.getFunctionCode() |
| | | ,userMoneyUnclaimed.getUserId(),userMoneyUnclaimed.getOrderId())){ |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /**转赠*/ |
| | | @Override |
| | | public void turn(UserTurnDto userTurnDto) { |