提交代码

master
胡锐 4 months ago
parent b8afd0d323
commit f8043c4434
  1. 125
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapper.java
  2. 7
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapperExt.java
  3. 162
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountRecordMapper.java
  4. 7
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountRecordMapperExt.java
  5. 458
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountRecordSqlProvider.java
  6. 332
      service/src/main/java/com/hfkj/dao/BsAgentMerAccountSqlProvider.java
  7. 230
      service/src/main/java/com/hfkj/entity/BsAgentMerAccount.java
  8. 984
      service/src/main/java/com/hfkj/entity/BsAgentMerAccountExample.java
  9. 374
      service/src/main/java/com/hfkj/entity/BsAgentMerAccountRecord.java
  10. 1564
      service/src/main/java/com/hfkj/entity/BsAgentMerAccountRecordExample.java
  11. 28
      service/src/main/java/com/hfkj/service/agent/BsAgentMerAccountRecordService.java
  12. 67
      service/src/main/java/com/hfkj/service/agent/BsAgentMerAccountService.java
  13. 53
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerAccountRecordServiceImpl.java
  14. 215
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentMerAccountServiceImpl.java
  15. 2
      service/src/main/java/com/hfkj/service/merchant/BsMerchantAccountService.java
  16. 52
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java

@ -0,0 +1,125 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentMerAccount;
import com.hfkj.entity.BsAgentMerAccountExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsAgentMerAccountMapper extends BsAgentMerAccountMapperExt {
@SelectProvider(type=BsAgentMerAccountSqlProvider.class, method="countByExample")
long countByExample(BsAgentMerAccountExample example);
@DeleteProvider(type=BsAgentMerAccountSqlProvider.class, method="deleteByExample")
int deleteByExample(BsAgentMerAccountExample example);
@Delete({
"delete from bs_agent_mer_account",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_agent_mer_account (agent_id, mer_id, ",
"mer_no, amount, amount_consume, ",
"`status`, create_time, ",
"update_time, ext_1, ",
"ext_2, ext_3)",
"values (#{agentId,jdbcType=BIGINT}, #{merId,jdbcType=BIGINT}, ",
"#{merNo,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{amountConsume,jdbcType=DECIMAL}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsAgentMerAccount record);
@InsertProvider(type=BsAgentMerAccountSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsAgentMerAccount record);
@SelectProvider(type=BsAgentMerAccountSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
@Result(column="amount_consume", property="amountConsume", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsAgentMerAccount> selectByExample(BsAgentMerAccountExample example);
@Select({
"select",
"id, agent_id, mer_id, mer_no, amount, amount_consume, `status`, create_time, ",
"update_time, ext_1, ext_2, ext_3",
"from bs_agent_mer_account",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
@Result(column="amount_consume", property="amountConsume", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsAgentMerAccount selectByPrimaryKey(Long id);
@UpdateProvider(type=BsAgentMerAccountSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsAgentMerAccount record, @Param("example") BsAgentMerAccountExample example);
@UpdateProvider(type=BsAgentMerAccountSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsAgentMerAccount record, @Param("example") BsAgentMerAccountExample example);
@UpdateProvider(type=BsAgentMerAccountSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsAgentMerAccount record);
@Update({
"update bs_agent_mer_account",
"set agent_id = #{agentId,jdbcType=BIGINT},",
"mer_id = #{merId,jdbcType=BIGINT},",
"mer_no = #{merNo,jdbcType=VARCHAR},",
"amount = #{amount,jdbcType=DECIMAL},",
"amount_consume = #{amountConsume,jdbcType=DECIMAL},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsAgentMerAccount record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsAgentMerAccountMapperExt {
}

@ -0,0 +1,162 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentMerAccountRecord;
import com.hfkj.entity.BsAgentMerAccountRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface BsAgentMerAccountRecordMapper extends BsAgentMerAccountRecordMapperExt {
@SelectProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="countByExample")
long countByExample(BsAgentMerAccountRecordExample example);
@DeleteProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="deleteByExample")
int deleteByExample(BsAgentMerAccountRecordExample example);
@Delete({
"delete from bs_agent_mer_account_record",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into bs_agent_mer_account_record (agent_mer_account_id, agent_id, ",
"mer_no, `type`, transaction_amount, ",
"before_amount, after_amount, ",
"source_type, source_id, ",
"source_order_no, source_content, ",
"`status`, create_time, ",
"op_user_type, op_user_id, ",
"op_user_name, op_user_phone, ",
"ext_1, ext_2, ext_3)",
"values (#{agentMerAccountId,jdbcType=BIGINT}, #{agentId,jdbcType=BIGINT}, ",
"#{merNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{transactionAmount,jdbcType=DECIMAL}, ",
"#{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL}, ",
"#{sourceType,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ",
"#{sourceOrderNo,jdbcType=VARCHAR}, #{sourceContent,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{opUserType,jdbcType=INTEGER}, #{opUserId,jdbcType=BIGINT}, ",
"#{opUserName,jdbcType=VARCHAR}, #{opUserPhone,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsAgentMerAccountRecord record);
@InsertProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(BsAgentMerAccountRecord record);
@SelectProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_mer_account_id", property="agentMerAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="after_amount", property="afterAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
@Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
@Result(column="source_order_no", property="sourceOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<BsAgentMerAccountRecord> selectByExample(BsAgentMerAccountRecordExample example);
@Select({
"select",
"id, agent_mer_account_id, agent_id, mer_no, `type`, transaction_amount, before_amount, ",
"after_amount, source_type, source_id, source_order_no, source_content, `status`, ",
"create_time, op_user_type, op_user_id, op_user_name, op_user_phone, ext_1, ext_2, ",
"ext_3",
"from bs_agent_mer_account_record",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="agent_mer_account_id", property="agentMerAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="after_amount", property="afterAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
@Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
@Result(column="source_order_no", property="sourceOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="op_user_type", property="opUserType", jdbcType=JdbcType.INTEGER),
@Result(column="op_user_id", property="opUserId", jdbcType=JdbcType.BIGINT),
@Result(column="op_user_name", property="opUserName", jdbcType=JdbcType.VARCHAR),
@Result(column="op_user_phone", property="opUserPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
BsAgentMerAccountRecord selectByPrimaryKey(Long id);
@UpdateProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") BsAgentMerAccountRecord record, @Param("example") BsAgentMerAccountRecordExample example);
@UpdateProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") BsAgentMerAccountRecord record, @Param("example") BsAgentMerAccountRecordExample example);
@UpdateProvider(type=BsAgentMerAccountRecordSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(BsAgentMerAccountRecord record);
@Update({
"update bs_agent_mer_account_record",
"set agent_mer_account_id = #{agentMerAccountId,jdbcType=BIGINT},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"mer_no = #{merNo,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=INTEGER},",
"transaction_amount = #{transactionAmount,jdbcType=DECIMAL},",
"before_amount = #{beforeAmount,jdbcType=DECIMAL},",
"after_amount = #{afterAmount,jdbcType=DECIMAL},",
"source_type = #{sourceType,jdbcType=INTEGER},",
"source_id = #{sourceId,jdbcType=BIGINT},",
"source_order_no = #{sourceOrderNo,jdbcType=VARCHAR},",
"source_content = #{sourceContent,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"op_user_type = #{opUserType,jdbcType=INTEGER},",
"op_user_id = #{opUserId,jdbcType=BIGINT},",
"op_user_name = #{opUserName,jdbcType=VARCHAR},",
"op_user_phone = #{opUserPhone,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(BsAgentMerAccountRecord record);
}

@ -0,0 +1,7 @@
package com.hfkj.dao;
/**
* mapper扩展类
*/
public interface BsAgentMerAccountRecordMapperExt {
}

@ -0,0 +1,458 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentMerAccountRecord;
import com.hfkj.entity.BsAgentMerAccountRecordExample.Criteria;
import com.hfkj.entity.BsAgentMerAccountRecordExample.Criterion;
import com.hfkj.entity.BsAgentMerAccountRecordExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsAgentMerAccountRecordSqlProvider {
public String countByExample(BsAgentMerAccountRecordExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_agent_mer_account_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsAgentMerAccountRecordExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_agent_mer_account_record");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsAgentMerAccountRecord record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_agent_mer_account_record");
if (record.getAgentMerAccountId() != null) {
sql.VALUES("agent_mer_account_id", "#{agentMerAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.VALUES("transaction_amount", "#{transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.VALUES("before_amount", "#{beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.VALUES("after_amount", "#{afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.VALUES("source_type", "#{sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.VALUES("source_id", "#{sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.VALUES("source_order_no", "#{sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.VALUES("source_content", "#{sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.VALUES("op_user_type", "#{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.VALUES("op_user_id", "#{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.VALUES("op_user_name", "#{opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.VALUES("op_user_phone", "#{opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsAgentMerAccountRecordExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("agent_mer_account_id");
sql.SELECT("agent_id");
sql.SELECT("mer_no");
sql.SELECT("`type`");
sql.SELECT("transaction_amount");
sql.SELECT("before_amount");
sql.SELECT("after_amount");
sql.SELECT("source_type");
sql.SELECT("source_id");
sql.SELECT("source_order_no");
sql.SELECT("source_content");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("op_user_type");
sql.SELECT("op_user_id");
sql.SELECT("op_user_name");
sql.SELECT("op_user_phone");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_agent_mer_account_record");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsAgentMerAccountRecord record = (BsAgentMerAccountRecord) parameter.get("record");
BsAgentMerAccountRecordExample example = (BsAgentMerAccountRecordExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account_record");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getAgentMerAccountId() != null) {
sql.SET("agent_mer_account_id = #{record.agentMerAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.SET("after_amount = #{record.afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.SET("source_type = #{record.sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.SET("source_id = #{record.sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.SET("source_order_no = #{record.sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.SET("source_content = #{record.sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.SET("op_user_phone = #{record.opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account_record");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("agent_mer_account_id = #{record.agentMerAccountId,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}");
sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}");
sql.SET("after_amount = #{record.afterAmount,jdbcType=DECIMAL}");
sql.SET("source_type = #{record.sourceType,jdbcType=INTEGER}");
sql.SET("source_id = #{record.sourceId,jdbcType=BIGINT}");
sql.SET("source_order_no = #{record.sourceOrderNo,jdbcType=VARCHAR}");
sql.SET("source_content = #{record.sourceContent,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("op_user_type = #{record.opUserType,jdbcType=INTEGER}");
sql.SET("op_user_id = #{record.opUserId,jdbcType=BIGINT}");
sql.SET("op_user_name = #{record.opUserName,jdbcType=VARCHAR}");
sql.SET("op_user_phone = #{record.opUserPhone,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsAgentMerAccountRecordExample example = (BsAgentMerAccountRecordExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsAgentMerAccountRecord record) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account_record");
if (record.getAgentMerAccountId() != null) {
sql.SET("agent_mer_account_id = #{agentMerAccountId,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getTransactionAmount() != null) {
sql.SET("transaction_amount = #{transactionAmount,jdbcType=DECIMAL}");
}
if (record.getBeforeAmount() != null) {
sql.SET("before_amount = #{beforeAmount,jdbcType=DECIMAL}");
}
if (record.getAfterAmount() != null) {
sql.SET("after_amount = #{afterAmount,jdbcType=DECIMAL}");
}
if (record.getSourceType() != null) {
sql.SET("source_type = #{sourceType,jdbcType=INTEGER}");
}
if (record.getSourceId() != null) {
sql.SET("source_id = #{sourceId,jdbcType=BIGINT}");
}
if (record.getSourceOrderNo() != null) {
sql.SET("source_order_no = #{sourceOrderNo,jdbcType=VARCHAR}");
}
if (record.getSourceContent() != null) {
sql.SET("source_content = #{sourceContent,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getOpUserType() != null) {
sql.SET("op_user_type = #{opUserType,jdbcType=INTEGER}");
}
if (record.getOpUserId() != null) {
sql.SET("op_user_id = #{opUserId,jdbcType=BIGINT}");
}
if (record.getOpUserName() != null) {
sql.SET("op_user_name = #{opUserName,jdbcType=VARCHAR}");
}
if (record.getOpUserPhone() != null) {
sql.SET("op_user_phone = #{opUserPhone,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsAgentMerAccountRecordExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,332 @@
package com.hfkj.dao;
import com.hfkj.entity.BsAgentMerAccount;
import com.hfkj.entity.BsAgentMerAccountExample.Criteria;
import com.hfkj.entity.BsAgentMerAccountExample.Criterion;
import com.hfkj.entity.BsAgentMerAccountExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class BsAgentMerAccountSqlProvider {
public String countByExample(BsAgentMerAccountExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("bs_agent_mer_account");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(BsAgentMerAccountExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("bs_agent_mer_account");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(BsAgentMerAccount record) {
SQL sql = new SQL();
sql.INSERT_INTO("bs_agent_mer_account");
if (record.getAgentId() != null) {
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) {
sql.VALUES("amount", "#{amount,jdbcType=DECIMAL}");
}
if (record.getAmountConsume() != null) {
sql.VALUES("amount_consume", "#{amountConsume,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(BsAgentMerAccountExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("agent_id");
sql.SELECT("mer_id");
sql.SELECT("mer_no");
sql.SELECT("amount");
sql.SELECT("amount_consume");
sql.SELECT("`status`");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("bs_agent_mer_account");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
BsAgentMerAccount record = (BsAgentMerAccount) parameter.get("record");
BsAgentMerAccountExample example = (BsAgentMerAccountExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) {
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}");
}
if (record.getAmountConsume() != null) {
sql.SET("amount_consume = #{record.amountConsume,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}");
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}");
sql.SET("amount_consume = #{record.amountConsume,jdbcType=DECIMAL}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
BsAgentMerAccountExample example = (BsAgentMerAccountExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(BsAgentMerAccount record) {
SQL sql = new SQL();
sql.UPDATE("bs_agent_mer_account");
if (record.getAgentId() != null) {
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}");
}
if (record.getMerId() != null) {
sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
}
if (record.getMerNo() != null) {
sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) {
sql.SET("amount = #{amount,jdbcType=DECIMAL}");
}
if (record.getAmountConsume() != null) {
sql.SET("amount_consume = #{amountConsume,jdbcType=DECIMAL}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, BsAgentMerAccountExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,230 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_agent_mer_account
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsAgentMerAccount implements Serializable {
private Long id;
/**
* 代理商id
*/
private Long agentId;
/**
* 商户id
*/
private Long merId;
/**
* 商户编号
*/
private String merNo;
/**
* 余额
*/
private BigDecimal amount;
/**
* 消费金额
*/
private BigDecimal amountConsume;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public Long getMerId() {
return merId;
}
public void setMerId(Long merId) {
this.merId = merId;
}
public String getMerNo() {
return merNo;
}
public void setMerNo(String merNo) {
this.merNo = merNo;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getAmountConsume() {
return amountConsume;
}
public void setAmountConsume(BigDecimal amountConsume) {
this.amountConsume = amountConsume;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
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;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsAgentMerAccount other = (BsAgentMerAccount) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId()))
&& (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo()))
&& (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
&& (this.getAmountConsume() == null ? other.getAmountConsume() == null : this.getAmountConsume().equals(other.getAmountConsume()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode());
result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode());
result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
result = prime * result + ((getAmountConsume() == null) ? 0 : getAmountConsume().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", agentId=").append(agentId);
sb.append(", merId=").append(merId);
sb.append(", merNo=").append(merNo);
sb.append(", amount=").append(amount);
sb.append(", amountConsume=").append(amountConsume);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,984 @@
package com.hfkj.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BsAgentMerAccountExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public BsAgentMerAccountExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andAgentIdIsNull() {
addCriterion("agent_id is null");
return (Criteria) this;
}
public Criteria andAgentIdIsNotNull() {
addCriterion("agent_id is not null");
return (Criteria) this;
}
public Criteria andAgentIdEqualTo(Long value) {
addCriterion("agent_id =", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotEqualTo(Long value) {
addCriterion("agent_id <>", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdGreaterThan(Long value) {
addCriterion("agent_id >", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdGreaterThanOrEqualTo(Long value) {
addCriterion("agent_id >=", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdLessThan(Long value) {
addCriterion("agent_id <", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdLessThanOrEqualTo(Long value) {
addCriterion("agent_id <=", value, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdIn(List<Long> values) {
addCriterion("agent_id in", values, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotIn(List<Long> values) {
addCriterion("agent_id not in", values, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdBetween(Long value1, Long value2) {
addCriterion("agent_id between", value1, value2, "agentId");
return (Criteria) this;
}
public Criteria andAgentIdNotBetween(Long value1, Long value2) {
addCriterion("agent_id not between", value1, value2, "agentId");
return (Criteria) this;
}
public Criteria andMerIdIsNull() {
addCriterion("mer_id is null");
return (Criteria) this;
}
public Criteria andMerIdIsNotNull() {
addCriterion("mer_id is not null");
return (Criteria) this;
}
public Criteria andMerIdEqualTo(Long value) {
addCriterion("mer_id =", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotEqualTo(Long value) {
addCriterion("mer_id <>", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdGreaterThan(Long value) {
addCriterion("mer_id >", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdGreaterThanOrEqualTo(Long value) {
addCriterion("mer_id >=", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdLessThan(Long value) {
addCriterion("mer_id <", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdLessThanOrEqualTo(Long value) {
addCriterion("mer_id <=", value, "merId");
return (Criteria) this;
}
public Criteria andMerIdIn(List<Long> values) {
addCriterion("mer_id in", values, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotIn(List<Long> values) {
addCriterion("mer_id not in", values, "merId");
return (Criteria) this;
}
public Criteria andMerIdBetween(Long value1, Long value2) {
addCriterion("mer_id between", value1, value2, "merId");
return (Criteria) this;
}
public Criteria andMerIdNotBetween(Long value1, Long value2) {
addCriterion("mer_id not between", value1, value2, "merId");
return (Criteria) this;
}
public Criteria andMerNoIsNull() {
addCriterion("mer_no is null");
return (Criteria) this;
}
public Criteria andMerNoIsNotNull() {
addCriterion("mer_no is not null");
return (Criteria) this;
}
public Criteria andMerNoEqualTo(String value) {
addCriterion("mer_no =", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotEqualTo(String value) {
addCriterion("mer_no <>", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoGreaterThan(String value) {
addCriterion("mer_no >", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoGreaterThanOrEqualTo(String value) {
addCriterion("mer_no >=", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLessThan(String value) {
addCriterion("mer_no <", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLessThanOrEqualTo(String value) {
addCriterion("mer_no <=", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoLike(String value) {
addCriterion("mer_no like", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotLike(String value) {
addCriterion("mer_no not like", value, "merNo");
return (Criteria) this;
}
public Criteria andMerNoIn(List<String> values) {
addCriterion("mer_no in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotIn(List<String> values) {
addCriterion("mer_no not in", values, "merNo");
return (Criteria) this;
}
public Criteria andMerNoBetween(String value1, String value2) {
addCriterion("mer_no between", value1, value2, "merNo");
return (Criteria) this;
}
public Criteria andMerNoNotBetween(String value1, String value2) {
addCriterion("mer_no not between", value1, value2, "merNo");
return (Criteria) this;
}
public Criteria andAmountIsNull() {
addCriterion("amount is null");
return (Criteria) this;
}
public Criteria andAmountIsNotNull() {
addCriterion("amount is not null");
return (Criteria) this;
}
public Criteria andAmountEqualTo(BigDecimal value) {
addCriterion("amount =", value, "amount");
return (Criteria) this;
}
public Criteria andAmountNotEqualTo(BigDecimal value) {
addCriterion("amount <>", value, "amount");
return (Criteria) this;
}
public Criteria andAmountGreaterThan(BigDecimal value) {
addCriterion("amount >", value, "amount");
return (Criteria) this;
}
public Criteria andAmountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("amount >=", value, "amount");
return (Criteria) this;
}
public Criteria andAmountLessThan(BigDecimal value) {
addCriterion("amount <", value, "amount");
return (Criteria) this;
}
public Criteria andAmountLessThanOrEqualTo(BigDecimal value) {
addCriterion("amount <=", value, "amount");
return (Criteria) this;
}
public Criteria andAmountIn(List<BigDecimal> values) {
addCriterion("amount in", values, "amount");
return (Criteria) this;
}
public Criteria andAmountNotIn(List<BigDecimal> values) {
addCriterion("amount not in", values, "amount");
return (Criteria) this;
}
public Criteria andAmountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount between", value1, value2, "amount");
return (Criteria) this;
}
public Criteria andAmountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount not between", value1, value2, "amount");
return (Criteria) this;
}
public Criteria andAmountConsumeIsNull() {
addCriterion("amount_consume is null");
return (Criteria) this;
}
public Criteria andAmountConsumeIsNotNull() {
addCriterion("amount_consume is not null");
return (Criteria) this;
}
public Criteria andAmountConsumeEqualTo(BigDecimal value) {
addCriterion("amount_consume =", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotEqualTo(BigDecimal value) {
addCriterion("amount_consume <>", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeGreaterThan(BigDecimal value) {
addCriterion("amount_consume >", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("amount_consume >=", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeLessThan(BigDecimal value) {
addCriterion("amount_consume <", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeLessThanOrEqualTo(BigDecimal value) {
addCriterion("amount_consume <=", value, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeIn(List<BigDecimal> values) {
addCriterion("amount_consume in", values, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotIn(List<BigDecimal> values) {
addCriterion("amount_consume not in", values, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount_consume between", value1, value2, "amountConsume");
return (Criteria) this;
}
public Criteria andAmountConsumeNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("amount_consume not between", value1, value2, "amountConsume");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andExt1IsNull() {
addCriterion("ext_1 is null");
return (Criteria) this;
}
public Criteria andExt1IsNotNull() {
addCriterion("ext_1 is not null");
return (Criteria) this;
}
public Criteria andExt1EqualTo(String value) {
addCriterion("ext_1 =", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotEqualTo(String value) {
addCriterion("ext_1 <>", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThan(String value) {
addCriterion("ext_1 >", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1GreaterThanOrEqualTo(String value) {
addCriterion("ext_1 >=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThan(String value) {
addCriterion("ext_1 <", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1LessThanOrEqualTo(String value) {
addCriterion("ext_1 <=", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1Like(String value) {
addCriterion("ext_1 like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotLike(String value) {
addCriterion("ext_1 not like", value, "ext1");
return (Criteria) this;
}
public Criteria andExt1In(List<String> values) {
addCriterion("ext_1 in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotIn(List<String> values) {
addCriterion("ext_1 not in", values, "ext1");
return (Criteria) this;
}
public Criteria andExt1Between(String value1, String value2) {
addCriterion("ext_1 between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt1NotBetween(String value1, String value2) {
addCriterion("ext_1 not between", value1, value2, "ext1");
return (Criteria) this;
}
public Criteria andExt2IsNull() {
addCriterion("ext_2 is null");
return (Criteria) this;
}
public Criteria andExt2IsNotNull() {
addCriterion("ext_2 is not null");
return (Criteria) this;
}
public Criteria andExt2EqualTo(String value) {
addCriterion("ext_2 =", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotEqualTo(String value) {
addCriterion("ext_2 <>", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThan(String value) {
addCriterion("ext_2 >", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2GreaterThanOrEqualTo(String value) {
addCriterion("ext_2 >=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThan(String value) {
addCriterion("ext_2 <", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2LessThanOrEqualTo(String value) {
addCriterion("ext_2 <=", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2Like(String value) {
addCriterion("ext_2 like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotLike(String value) {
addCriterion("ext_2 not like", value, "ext2");
return (Criteria) this;
}
public Criteria andExt2In(List<String> values) {
addCriterion("ext_2 in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotIn(List<String> values) {
addCriterion("ext_2 not in", values, "ext2");
return (Criteria) this;
}
public Criteria andExt2Between(String value1, String value2) {
addCriterion("ext_2 between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt2NotBetween(String value1, String value2) {
addCriterion("ext_2 not between", value1, value2, "ext2");
return (Criteria) this;
}
public Criteria andExt3IsNull() {
addCriterion("ext_3 is null");
return (Criteria) this;
}
public Criteria andExt3IsNotNull() {
addCriterion("ext_3 is not null");
return (Criteria) this;
}
public Criteria andExt3EqualTo(String value) {
addCriterion("ext_3 =", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotEqualTo(String value) {
addCriterion("ext_3 <>", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThan(String value) {
addCriterion("ext_3 >", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3GreaterThanOrEqualTo(String value) {
addCriterion("ext_3 >=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThan(String value) {
addCriterion("ext_3 <", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3LessThanOrEqualTo(String value) {
addCriterion("ext_3 <=", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3Like(String value) {
addCriterion("ext_3 like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotLike(String value) {
addCriterion("ext_3 not like", value, "ext3");
return (Criteria) this;
}
public Criteria andExt3In(List<String> values) {
addCriterion("ext_3 in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotIn(List<String> values) {
addCriterion("ext_3 not in", values, "ext3");
return (Criteria) this;
}
public Criteria andExt3Between(String value1, String value2) {
addCriterion("ext_3 between", value1, value2, "ext3");
return (Criteria) this;
}
public Criteria andExt3NotBetween(String value1, String value2) {
addCriterion("ext_3 not between", value1, value2, "ext3");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,374 @@
package com.hfkj.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* bs_agent_mer_account_record
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class BsAgentMerAccountRecord implements Serializable {
private Long id;
/**
* 代理商商户账户id
*/
private Long agentMerAccountId;
/**
* 代理商id
*/
private Long agentId;
/**
* 商户编号
*/
private String merNo;
/**
* 类型 1进账 2出账
*/
private Integer type;
/**
* 交易金额
*/
private BigDecimal transactionAmount;
/**
* 变更前金额
*/
private BigDecimal beforeAmount;
/**
* 变更后金额
*/
private BigDecimal afterAmount;
/**
* 来源类型 1. 充值金额 2. 订单扣除
*/
private Integer sourceType;
/**
* 来源id
*/
private Long sourceId;
/**
* 来源订单号
*/
private String sourceOrderNo;
/**
* 来源内容
*/
private String sourceContent;
/**
* 状态 0删除 1正常
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 操作人类型 1管理员 2客户
*/
private Integer opUserType;
/**
* 操作人id
*/
private Long opUserId;
/**
* 操作人名称
*/
private String opUserName;
/**
* 操作人电话
*/
private String opUserPhone;
private String ext1;
private String ext2;
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAgentMerAccountId() {
return agentMerAccountId;
}
public void setAgentMerAccountId(Long agentMerAccountId) {
this.agentMerAccountId = agentMerAccountId;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getMerNo() {
return merNo;
}
public void setMerNo(String merNo) {
this.merNo = merNo;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public BigDecimal getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(BigDecimal transactionAmount) {
this.transactionAmount = transactionAmount;
}
public BigDecimal getBeforeAmount() {
return beforeAmount;
}
public void setBeforeAmount(BigDecimal beforeAmount) {
this.beforeAmount = beforeAmount;
}
public BigDecimal getAfterAmount() {
return afterAmount;
}
public void setAfterAmount(BigDecimal afterAmount) {
this.afterAmount = afterAmount;
}
public Integer getSourceType() {
return sourceType;
}
public void setSourceType(Integer sourceType) {
this.sourceType = sourceType;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
public String getSourceOrderNo() {
return sourceOrderNo;
}
public void setSourceOrderNo(String sourceOrderNo) {
this.sourceOrderNo = sourceOrderNo;
}
public String getSourceContent() {
return sourceContent;
}
public void setSourceContent(String sourceContent) {
this.sourceContent = sourceContent;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getOpUserType() {
return opUserType;
}
public void setOpUserType(Integer opUserType) {
this.opUserType = opUserType;
}
public Long getOpUserId() {
return opUserId;
}
public void setOpUserId(Long opUserId) {
this.opUserId = opUserId;
}
public String getOpUserName() {
return opUserName;
}
public void setOpUserName(String opUserName) {
this.opUserName = opUserName;
}
public String getOpUserPhone() {
return opUserPhone;
}
public void setOpUserPhone(String opUserPhone) {
this.opUserPhone = opUserPhone;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
BsAgentMerAccountRecord other = (BsAgentMerAccountRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getAgentMerAccountId() == null ? other.getAgentMerAccountId() == null : this.getAgentMerAccountId().equals(other.getAgentMerAccountId()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getTransactionAmount() == null ? other.getTransactionAmount() == null : this.getTransactionAmount().equals(other.getTransactionAmount()))
&& (this.getBeforeAmount() == null ? other.getBeforeAmount() == null : this.getBeforeAmount().equals(other.getBeforeAmount()))
&& (this.getAfterAmount() == null ? other.getAfterAmount() == null : this.getAfterAmount().equals(other.getAfterAmount()))
&& (this.getSourceType() == null ? other.getSourceType() == null : this.getSourceType().equals(other.getSourceType()))
&& (this.getSourceId() == null ? other.getSourceId() == null : this.getSourceId().equals(other.getSourceId()))
&& (this.getSourceOrderNo() == null ? other.getSourceOrderNo() == null : this.getSourceOrderNo().equals(other.getSourceOrderNo()))
&& (this.getSourceContent() == null ? other.getSourceContent() == null : this.getSourceContent().equals(other.getSourceContent()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getOpUserType() == null ? other.getOpUserType() == null : this.getOpUserType().equals(other.getOpUserType()))
&& (this.getOpUserId() == null ? other.getOpUserId() == null : this.getOpUserId().equals(other.getOpUserId()))
&& (this.getOpUserName() == null ? other.getOpUserName() == null : this.getOpUserName().equals(other.getOpUserName()))
&& (this.getOpUserPhone() == null ? other.getOpUserPhone() == null : this.getOpUserPhone().equals(other.getOpUserPhone()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getAgentMerAccountId() == null) ? 0 : getAgentMerAccountId().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getTransactionAmount() == null) ? 0 : getTransactionAmount().hashCode());
result = prime * result + ((getBeforeAmount() == null) ? 0 : getBeforeAmount().hashCode());
result = prime * result + ((getAfterAmount() == null) ? 0 : getAfterAmount().hashCode());
result = prime * result + ((getSourceType() == null) ? 0 : getSourceType().hashCode());
result = prime * result + ((getSourceId() == null) ? 0 : getSourceId().hashCode());
result = prime * result + ((getSourceOrderNo() == null) ? 0 : getSourceOrderNo().hashCode());
result = prime * result + ((getSourceContent() == null) ? 0 : getSourceContent().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getOpUserType() == null) ? 0 : getOpUserType().hashCode());
result = prime * result + ((getOpUserId() == null) ? 0 : getOpUserId().hashCode());
result = prime * result + ((getOpUserName() == null) ? 0 : getOpUserName().hashCode());
result = prime * result + ((getOpUserPhone() == null) ? 0 : getOpUserPhone().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", agentMerAccountId=").append(agentMerAccountId);
sb.append(", agentId=").append(agentId);
sb.append(", merNo=").append(merNo);
sb.append(", type=").append(type);
sb.append(", transactionAmount=").append(transactionAmount);
sb.append(", beforeAmount=").append(beforeAmount);
sb.append(", afterAmount=").append(afterAmount);
sb.append(", sourceType=").append(sourceType);
sb.append(", sourceId=").append(sourceId);
sb.append(", sourceOrderNo=").append(sourceOrderNo);
sb.append(", sourceContent=").append(sourceContent);
sb.append(", status=").append(status);
sb.append(", createTime=").append(createTime);
sb.append(", opUserType=").append(opUserType);
sb.append(", opUserId=").append(opUserId);
sb.append(", opUserName=").append(opUserName);
sb.append(", opUserPhone=").append(opUserPhone);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,28 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentMerAccountRecord;
import com.hfkj.entity.BsMerchantAccountRecord;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentMerAccountRecordService
* @author: HuRui
* @date: 2024/8/1
**/
public interface BsAgentMerAccountRecordService {
/**
* 创建
* @param data
*/
void create(BsAgentMerAccountRecord data);
/**
* 查询列表
* @param param
* @return
*/
List<BsAgentMerAccountRecord> getList(Map<String,Object> param);
}

@ -0,0 +1,67 @@
package com.hfkj.service.agent;
import com.hfkj.entity.BsAgentMerAccount;
import com.hfkj.entity.BsMerchantAccount;
import com.hfkj.entity.BsOrderRefund;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentMerAccountService
* @author: HuRui
* @date: 2024/8/1
**/
public interface BsAgentMerAccountService {
/**
* 编辑数据
* @param account
*/
void editData(BsAgentMerAccount account);
/**
* 查询账户
* @param agentId 代理商id
* @param merNo 商户号
*/
BsAgentMerAccount getAccount(Long agentId, String merNo);
/**
* 充值
*
* @param agentId 代理商id
* @param merNo 商户号
* @param amount 金额
*/
void recharge(Long agentId,String merNo, BigDecimal amount) throws Exception;
/**
* 扣除
*
* @param agentId 代理商id
* @param merNo 商户号
* @param amount 金额
* @param otherParam 其他参数
*/
void consume(Long agentId,String merNo, BigDecimal amount, Map<String, Object> otherParam) throws Exception;
/**
* 退款
*
* @param agentId 代理商id
* @param merNo
* @param amount
* @param orderRefund
*/
void refund(Long agentId, String merNo, BigDecimal amount, BsOrderRefund orderRefund) throws Exception;
/**
* 查询商户列表
* @param param
* @return
*/
List<Map<String,Object>> getMerList(Map<String,Object> param);
}

@ -0,0 +1,53 @@
package com.hfkj.service.agent.impl;
import com.hfkj.dao.BsAgentMerAccountRecordMapper;
import com.hfkj.entity.BsAgentMerAccountRecord;
import com.hfkj.entity.BsAgentMerAccountRecordExample;
import com.hfkj.service.agent.BsAgentMerAccountRecordService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentMerAccountRecordServiceImpl
* @author: HuRui
* @date: 2024/8/1
**/
@Service("agentMerAccountRecordService")
public class BsAgentMerAccountRecordServiceImpl implements BsAgentMerAccountRecordService {
@Resource
private BsAgentMerAccountRecordMapper agentMerAccountRecordMapper;
@Override
public void create(BsAgentMerAccountRecord data) {
data.setCreateTime(new Date());
agentMerAccountRecordMapper.insert(data);
}
@Override
public List<BsAgentMerAccountRecord> getList(Map<String, Object> param) {
BsAgentMerAccountRecordExample example = new BsAgentMerAccountRecordExample();
BsAgentMerAccountRecordExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
if (MapUtils.getLong(param, "agentMerAccountId") != null) {
criteria.andAgentMerAccountIdEqualTo(MapUtils.getLong(param, "agentMerAccountId"));
}
if (MapUtils.getLong(param, "agentId") != null) {
criteria.andAgentMerAccountIdEqualTo(MapUtils.getLong(param, "agentId"));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) {
criteria.andMerNoEqualTo(MapUtils.getString(param, "merNo"));
}
example.setOrderByClause("create_time desc");
return agentMerAccountRecordMapper.selectByExample(example);
}
}

@ -0,0 +1,215 @@
package com.hfkj.service.agent.impl;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
import com.hfkj.dao.BsAgentMerAccountMapper;
import com.hfkj.entity.*;
import com.hfkj.service.agent.BsAgentMerAccountRecordService;
import com.hfkj.service.agent.BsAgentMerAccountService;
import com.hfkj.sysenum.merchant.MerchantAccountRecordSourceTypeEnum;
import com.hfkj.sysenum.merchant.MerchantAccountRecordTypeEnum;
import org.apache.commons.collections4.MapUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @className: BsAgentMerAccountServiceImpl
* @author: HuRui
* @date: 2024/8/1
**/
@Service("agentMerAccountService")
public class BsAgentMerAccountServiceImpl implements BsAgentMerAccountService {
@Resource
private BsAgentMerAccountMapper agentMerAccountMapper;
@Resource
private BsAgentMerAccountRecordService agentMerAccountRecordService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
private final String LOCK_KEY = "AGENT_MERCHANT_ACCOUNT_LOCK_";
@Override
public void editData(BsAgentMerAccount account) {
account.setUpdateTime(new Date());
if (account.getId() == null) {
account.setAmount(new BigDecimal(0));
account.setAmountConsume(new BigDecimal(0));
account.setStatus(1);
account.setCreateTime(new Date());
agentMerAccountMapper.insert(account);
} else {
agentMerAccountMapper.updateByPrimaryKey(account);
}
}
@Override
public BsAgentMerAccount getAccount(Long agentId, String merNo) {
BsAgentMerAccountExample example = new BsAgentMerAccountExample();
example.createCriteria().andAgentIdEqualTo(agentId).andMerNoEqualTo(merNo);
List<BsAgentMerAccount> list = agentMerAccountMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到账户");
}
@Override
public void recharge(Long agentId, String merNo, BigDecimal amount) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId+"_"+merNo;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询账户
BsAgentMerAccount merAccount = getAccount(agentId,merNo);
// 变更前金额
BigDecimal beforeAmount = merAccount.getAmount();
// 计算金额
merAccount.setAmount(merAccount.getAmount().add(amount));
editData(merAccount);
// 变更后金额
BigDecimal afterAmount = merAccount.getAmount();
BsAgentMerAccountRecord record = new BsAgentMerAccountRecord();
record.setAgentId(agentId);
record.setAgentMerAccountId(merAccount.getId());
record.setMerNo(merAccount.getMerNo());
record.setType(MerchantAccountRecordTypeEnum.type1.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MerchantAccountRecordSourceTypeEnum.type1.getType());
try {
record.setSourceOrderNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
} catch (Exception e) {
e.printStackTrace();
}
record.setSourceContent("充值金额:" + record.getTransactionAmount());
agentMerAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (Exception e) {
e.printStackTrace();
// 释放锁
redisTemplate.delete(lockKey);
}
} else {
Thread.sleep(100);
recharge(agentId, merNo, amount);
}
}
@Override
public void consume(Long agentId, String merNo, BigDecimal amount, Map<String, Object> otherParam) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId+"_"+merNo;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询账户
BsAgentMerAccount merAccount = getAccount(agentId, merNo);
// 余额 是否小于 消费余额
if (merAccount.getAmount().compareTo(amount) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "余额不足,暂时无法交易");
}
// 变更前金额
BigDecimal beforeAmount = merAccount.getAmount();
// 计算消费后金额
merAccount.setAmount(merAccount.getAmount().subtract(amount));
// 累积消费金额
merAccount.setAmountConsume(merAccount.getAmountConsume().add(amount));
editData(merAccount);
// 变更后金额
BigDecimal afterAmount = merAccount.getAmount();
BsAgentMerAccountRecord record = new BsAgentMerAccountRecord();
record.setAgentId(agentId);
record.setAgentMerAccountId(merAccount.getId());
record.setMerNo(merAccount.getMerNo());
record.setType(MerchantAccountRecordTypeEnum.type2.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MapUtils.getInteger(otherParam, "sourceType"));
record.setSourceId(MapUtils.getLong(otherParam, "sourceId"));
record.setSourceOrderNo(MapUtils.getString(otherParam, "sourceOrderNo"));
record.setSourceContent(MapUtils.getString(otherParam, "sourceContent"));
agentMerAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (Exception e) {
e.printStackTrace();
// 释放锁
redisTemplate.delete(lockKey);
}
} else {
Thread.sleep(100);
consume(agentId, merNo, amount, otherParam);
}
}
@Override
public void refund(Long agentId, String merNo, BigDecimal amount, BsOrderRefund orderRefund) throws Exception {
// 锁编号
String lockKey = LOCK_KEY+agentId+"_"+merNo;
// 获取锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent(lockKey, "");
if (Boolean.TRUE.equals(lock)) {
try {
// 获取锁成功
// 查询车队油卡
BsAgentMerAccount merAccount = getAccount(agentId, merNo);
// 变更前金额
BigDecimal beforeAmount = merAccount.getAmount();
// 计算退款后的金额
merAccount.setAmount(merAccount.getAmount().add(amount));
// 累积消费金额
merAccount.setAmountConsume(merAccount.getAmountConsume().subtract(amount));
editData(merAccount);
// 变更后金额
BigDecimal afterAmount = merAccount.getAmount();
BsAgentMerAccountRecord record = new BsAgentMerAccountRecord();
record.setAgentId(agentId);
record.setAgentMerAccountId(merAccount.getId());
record.setMerNo(merAccount.getMerNo());
record.setType(MerchantAccountRecordTypeEnum.type1.getType());
record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount);
record.setAfterAmount(afterAmount);
record.setSourceType(MerchantAccountRecordSourceTypeEnum.type3.getType());
record.setSourceId(orderRefund.getId());
record.setSourceOrderNo(orderRefund.getRefundOrderNo());
agentMerAccountRecordService.create(record);
// 释放锁
redisTemplate.delete(lockKey);
} catch (Exception e) {
e.printStackTrace();
// 释放锁
redisTemplate.delete(lockKey);
}
} else {
Thread.sleep(100);
refund(agentId, merNo, amount, orderRefund);
}
}
@Override
public List<Map<String, Object>> getMerList(Map<String, Object> param) {
return null;
}
}

@ -15,7 +15,7 @@ import java.util.Map;
public interface BsMerchantAccountService { public interface BsMerchantAccountService {
/** /**
* 修改数据 * 编辑数据
* @param account * @param account
*/ */
void editData(BsMerchantAccount account); void editData(BsMerchantAccount account);

@ -6,6 +6,7 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.model.GasPayPriceModel; import com.hfkj.model.GasPayPriceModel;
import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderChildModel;
import com.hfkj.service.agent.BsAgentMerAccountService;
import com.hfkj.service.merchant.BsMerchantService; import com.hfkj.service.merchant.BsMerchantService;
import com.hfkj.service.agent.BsAgentMerService; import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.service.gas.BsGasClassGroupTaskService; import com.hfkj.service.gas.BsGasClassGroupTaskService;
@ -13,15 +14,19 @@ import com.hfkj.service.gas.BsGasOrderService;
import com.hfkj.service.gas.BsGasService; import com.hfkj.service.gas.BsGasService;
import com.hfkj.service.gas.BsGasStaffService; import com.hfkj.service.gas.BsGasStaffService;
import com.hfkj.service.sec.SecDictionaryService; import com.hfkj.service.sec.SecDictionaryService;
import com.hfkj.sysenum.MerchantSourceTypeEnum;
import com.hfkj.sysenum.MerchantStatusEnum; import com.hfkj.sysenum.MerchantStatusEnum;
import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum; import com.hfkj.sysenum.gas.GasOrderReceiptStatusEnum;
import com.hfkj.sysenum.gas.OrderOilStatus; import com.hfkj.sysenum.gas.OrderOilStatus;
import com.hfkj.sysenum.merchant.MerchantAccountRecordSourceTypeEnum;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/** /**
* 创建订单业务 * 创建订单业务
@ -42,6 +47,8 @@ public class OrderCreateService {
@Resource @Resource
private BsGasOrderService gasOrderService; private BsGasOrderService gasOrderService;
@Resource @Resource
private BsAgentMerAccountService agentMerAccountService;
@Resource
private BsGasClassGroupTaskService gasClassGroupTaskService; private BsGasClassGroupTaskService gasClassGroupTaskService;
@Resource @Resource
private BsAgentMerService agentMerService; private BsAgentMerService agentMerService;
@ -78,10 +85,6 @@ public class OrderCreateService {
if (!merchant.getStatus().equals(MerchantStatusEnum.status1.getNumber())) { if (!merchant.getStatus().equals(MerchantStatusEnum.status1.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前油站暂停交易"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前油站暂停交易");
} }
// 计算价格
GasPayPriceModel priceModel = gasService.refuelPriceCompute(orderChild.getProductPrice(), merchant.getMerNo(), orderChild.getGasOilNo(), orderChild.getAgentMerId());
BsGasOrder gasOrder = new BsGasOrder(); BsGasOrder gasOrder = new BsGasOrder();
gasOrder.setAbnormal(false); gasOrder.setAbnormal(false);
gasOrder.setMerNo(merchant.getMerNo()); gasOrder.setMerNo(merchant.getMerNo());
@ -96,6 +99,32 @@ public class OrderCreateService {
gasOrder.setStatus(OrderOilStatus.STATUS1.getNumber()); gasOrder.setStatus(OrderOilStatus.STATUS1.getNumber());
gasOrder.setReceiptStatus(GasOrderReceiptStatusEnum.status0.getStatus()); gasOrder.setReceiptStatus(GasOrderReceiptStatusEnum.status0.getStatus());
// 代理、业务员
if (orderChild.getAgentMerId() != null) {
// 查询代理
BsAgentMer agentMer = agentMerService.getDetail(orderChild.getAgentMerId());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法交易,代理商二维码已失效");
}
try {
// 扣除代理商商户金额
Map<String,Object> param = new HashMap<>();
param.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType());
param.put("sourceOrderNo", gasOrder.getOrderNo());
param.put("sourceOrderContent", "创建加油订单:"+gasOrder.getOrderNo()+",加油金额:¥" +orderChild.getProductPrice());
agentMerAccountService.consume(agentMer.getAgentId(), agentMer.getMerNo(), orderChild.getProductPrice(), param);
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "扣款失败,请稍后重新提交订单");
}
gasOrder.setAgentId(agentMer.getAgentId());
gasOrder.setAgentName(agentMer.getAgentName());
gasOrder.setAgentStaffId(agentMer.getAgentStaffId());
gasOrder.setAgentStaffName(agentMer.getAgentStaffName());
}
// 计算价格
GasPayPriceModel priceModel = gasService.refuelPriceCompute(orderChild.getProductPrice(), merchant.getMerNo(), orderChild.getGasOilNo(), orderChild.getAgentMerId());
gasOrder.setDeductionCouponPrice(new BigDecimal("0")); gasOrder.setDeductionCouponPrice(new BigDecimal("0"));
gasOrder.setDeductionOilPrice(priceModel.getTotalPreferences()); gasOrder.setDeductionOilPrice(priceModel.getTotalPreferences());
gasOrder.setPayablePrice(priceModel.getPayPrice()); gasOrder.setPayablePrice(priceModel.getPayPrice());
@ -117,25 +146,12 @@ public class OrderCreateService {
gasOrder.setGasLitersPreferences(priceModel.getLitersPreferences()); gasOrder.setGasLitersPreferences(priceModel.getLitersPreferences());
gasOrder.setGasPricePreferences(priceModel.getPricePreferences()); gasOrder.setGasPricePreferences(priceModel.getPricePreferences());
// 代理、业务员
if (orderChild.getAgentMerId() != null) {
// 查询代理
BsAgentMer agentMer = agentMerService.getDetail(orderChild.getAgentMerId());
if (agentMer == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理");
}
gasOrder.setAgentId(agentMer.getAgentId());
gasOrder.setAgentName(agentMer.getAgentName());
gasOrder.setAgentStaffId(agentMer.getAgentStaffId());
gasOrder.setAgentStaffName(agentMer.getAgentStaffName());
}
// 加油员 // 加油员
if (orderChild.getGasStaffId() != null) { if (orderChild.getGasStaffId() != null) {
// 查询员工 // 查询员工
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(orderChild.getGasStaffId()); BsGasStaff gasStaff = gasStaffService.getStaffDetailById(orderChild.getGasStaffId());
if (gasStaff == null) { if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知加油员"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油员");
} }
if (gasStaff.getMerId().equals(merchant.getId())) { if (gasStaff.getMerId().equals(merchant.getId())) {
gasOrder.setGasStaffId(gasStaff.getId()); gasOrder.setGasStaffId(gasStaff.getId());

Loading…
Cancel
Save