fanli/src/main/java/com/yeshi/fanli/dao/mybatis/money/AccountDetailHongBaoMapMapper.java
New file @@ -0,0 +1,16 @@ package com.yeshi.fanli.dao.mybatis.money; import com.yeshi.fanli.dao.BaseMapper; import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap; public interface AccountDetailHongBaoMapMapper extends BaseMapper<AccountDetailHongBaoMap> { /** * 根据HongBaoId获取对象 * * @param hongBaoId * @return */ AccountDetailHongBaoMap selectByHongBaoId(Long hongBaoId); } fanli/src/main/java/com/yeshi/fanli/entity/bus/user/AccountDetails.java
@@ -24,6 +24,13 @@ @org.yeshi.utils.mybatis.Table("yeshi_ec_account_details") public class AccountDetails { public AccountDetails(Long id) { this.id = id; } public AccountDetails() { } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") fanli/src/main/java/com/yeshi/fanli/entity/bus/user/HongBao.java
@@ -147,6 +147,14 @@ @org.yeshi.utils.mybatis.Column(name = "urank") private Integer urank; public HongBao() { } public HongBao(Long id) { this.id = id; } @org.yeshi.utils.mybatis.Column(name = "hasChild") private Boolean hasChild; @@ -156,15 +164,9 @@ @org.yeshi.utils.mybatis.Column(name = "balance_time") @Column(name = "balance_time") private Date balanceTime; @Transient // 分享邀请金额总额 private BigDecimal ShareAndInviteMoney; public HongBao() { } private BigDecimal ShareAndInviteMoney; public HongBao(UserInfo userInfo, BigDecimal money, String param, int type, int state, long createtime, long preGettime, long getTime, String getIp, String beizhu) { fanli/src/main/java/com/yeshi/fanli/entity/money/AccountDetailHongBaoMap.java
New file @@ -0,0 +1,70 @@ package com.yeshi.fanli.entity.money; import java.util.Date; import org.yeshi.utils.mybatis.Column; import org.yeshi.utils.mybatis.Table; import com.yeshi.fanli.entity.bus.user.AccountDetails; import com.yeshi.fanli.entity.bus.user.HongBao; /** * 账户明细与红包映射记录 * * @author Administrator * */ @Table("yeshi_ec_account_details_hongbao_map") public class AccountDetailHongBaoMap { @Column(name = "ahm_id") private Long id; @Column(name = "ahm_hongbao_id") private HongBao hongBao; @Column(name = "ahm_account_details_id") private AccountDetails accountDetails; @Column(name = "ahm_createtime") private Date createTime; @Column(name = "ahm_updatetime") private Date updateTime; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public HongBao getHongBao() { return hongBao; } public void setHongBao(HongBao hongBao) { this.hongBao = hongBao; } public AccountDetails getAccountDetails() { return accountDetails; } public void setAccountDetails(AccountDetails accountDetails) { this.accountDetails = accountDetails; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } } fanli/src/main/java/com/yeshi/fanli/exception/HongBaoManageException.java
New file @@ -0,0 +1,32 @@ package com.yeshi.fanli.exception; public class HongBaoManageException extends Exception { /** * */ private static final long serialVersionUID = 1L; private int code; private String msg; public int getCode() { return code; } public String getMsg() { return msg; } public HongBaoManageException(int code, String msg) { this.code = code; this.msg = msg; } public HongBaoManageException() { } @Override public String getMessage() { return this.msg; } } fanli/src/main/java/com/yeshi/fanli/mapping/money/AccountDetailHongBaoMapMapper.xml
New file @@ -0,0 +1,93 @@ <?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"> <mapper namespace="com.yeshi.fanli.entity.dao.AccountDetailHongBaoMapMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap"> <id column="ahm_id" property="id" jdbcType="BIGINT" /> <result column="ahm_createtime" property="createTime" jdbcType="TIMESTAMP" /> <result column="ahm_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> <association property="hongBao" column="ahm_hongbao_id" javaType="com.yeshi.fanli.entity.bus.user.HongBao"> <id column="ahm_hongbao_id" property="id" jdbcType="BIGINT" /> </association> <association property="accountDetails" column="ahm_account_details_id" javaType="com.yeshi.fanli.entity.bus.user.AccountDetails"> <id column="ahm_account_details_id" property="id" jdbcType="BIGINT" /> </association> </resultMap> <sql id="Base_Column_List">ahm_id,ahm_hongbao_id,ahm_account_details_id,ahm_createtime,ahm_updatetime </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_account_details_hongbao_map where ahm_id = #{id,jdbcType=BIGINT} </select> <select id="selectByHongBaoId" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_account_details_hongbao_map where ahm_hongbao_id =#{0} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_account_details_hongbao_map where ahm_id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_account_details_hongbao_map (ahm_id,ahm_hongbao_id,ahm_account_details_id,ahm_createtime,ahm_updatetime) values (#{id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{accountDetails.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap" useGeneratedKeys="true" keyProperty="id"> insert into yeshi_ec_account_details_hongbao_map <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">ahm_id,</if> <if test="hongBao != null">ahm_hongbao_id,</if> <if test="accountDetails != null">ahm_account_details_id,</if> <if test="createTime != null">ahm_createtime,</if> <if test="updateTime != null">ahm_updatetime,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if> <if test="accountDetails != null">#{accountDetails.id,jdbcType=BIGINT},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap">update yeshi_ec_account_details_hongbao_map set ahm_hongbao_id = #{hongBao.id,jdbcType=BIGINT},ahm_account_details_id = #{accountDetails.id,jdbcType=BIGINT},ahm_createtime = #{createTime,jdbcType=TIMESTAMP},ahm_updatetime = #{updateTime,jdbcType=TIMESTAMP} where ahm_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.AccountDetailHongBaoMap"> update yeshi_ec_account_details_hongbao_map <set> <if test="hongBao != null">ahm_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if> <if test="accountDetails != null">ahm_account_details_id=#{accountDetails.id,jdbcType=BIGINT}, </if> <if test="createTime != null">ahm_createtime=#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">ahm_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> </set> where ahm_id = #{id,jdbcType=BIGINT} </update> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/AccountDetailsHongBaoMapServiceImpl.java
New file @@ -0,0 +1,39 @@ package com.yeshi.fanli.service.impl.hongbao; import java.util.Date; import javax.annotation.Resource; import org.springframework.transaction.annotation.Transactional; import com.yeshi.fanli.dao.mybatis.money.AccountDetailHongBaoMapMapper; import com.yeshi.fanli.entity.bus.user.AccountDetails; import com.yeshi.fanli.entity.bus.user.HongBao; import com.yeshi.fanli.entity.money.AccountDetailHongBaoMap; import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService; public class AccountDetailsHongBaoMapServiceImpl implements AccountDetailsHongBaoMapService { @Resource private AccountDetailHongBaoMapMapper accountDetailHongBaoMapMapper; @Transactional @Override public void saveAccountDetailsHongBaoMap(Long hongBaoId, Long accountDetailsId) { if (hongBaoId == null || accountDetailsId == null) return; // 保存账户明细与红包的关系 AccountDetailHongBaoMap map = new AccountDetailHongBaoMap(); map.setAccountDetails(new AccountDetails(accountDetailsId)); map.setCreateTime(new Date()); map.setHongBao(new HongBao()); map.setUpdateTime(new Date()); AccountDetailHongBaoMap oldMap = accountDetailHongBaoMapMapper.selectByHongBaoId(hongBaoId); if (oldMap == null) { accountDetailHongBaoMapMapper.insertSelective(oldMap); } } } fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/AccountDetailsHongBaoMapService.java
New file @@ -0,0 +1,18 @@ package com.yeshi.fanli.service.inter.hongbao; /** * 红包ID与账户明细的资金对应 * * @author Administrator * */ public interface AccountDetailsHongBaoMapService { /** * 保存红包与资金明细的关系 * * @param hongBaoId * @param accountDetailsId */ public void saveAccountDetailsHongBaoMap(Long hongBaoId, Long accountDetailsId); } fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -14,9 +14,9 @@ public static boolean IS_TASK = false; // 外网环境 public static boolean IS_OUTNET = true; public static boolean IS_OUTNET = false; public static boolean IS_TEST = false; public static boolean IS_TEST = true; public static int PAGE_SIZE = 20; public static int[] TASK_TYPE = { 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008// 微信任务类型编号 @@ -42,7 +42,6 @@ public final static String HB_STATEEXCEPTION = "红包状态异常"; public final static String HB_NOEXIST = "红包不存在"; public static final int MR_COUNT = 2; public static final String HONGBAO_GOODS_PROPORTION = "hongbao_goods_proportion"; public final static String BA_EXIST = "该类型账户已存在"; public final static String BA_SUCCESS = "创建成功"; fanli/src/main/resource/druid.properties
@@ -1,8 +1,8 @@ druid.driverClassName=com.mysql.jdbc.Driver #本地测试 #druid.url=jdbc:mysql://127.0.0.1:3306/ec_quan #druid.username=root #druid.password=hexiaohui druid.url=jdbc:mysql://192.168.1.122:3306/ec_quan druid.username=root druid.password=hexiaohui #druid.url=jdbc:mysql://192.168.1.253:3306/ec_quan @@ -22,9 +22,9 @@ #外网正式 druid.url=jdbc:mysql://172.16.16.17:3306/ec_quan druid.username=root druid.password=Yeshi2016@ #druid.url=jdbc:mysql://172.16.16.17:3306/ec_quan #druid.username=root #druid.password=Yeshi2016@ #外网本地测试 #druid.url=jdbc:mysql://gz-cdb-r13d0yi9.sql.tencentcdb.com:62929/ec_quan