提交代码

master
胡锐 2 weeks ago
parent 9d59e98491
commit 8295ca6282
  1. 49
      bweb/src/main/java/com/bweb/controller/BsAgentController.java
  2. 30
      bweb/src/main/java/com/bweb/controller/BsUserSpreadController.java
  3. 4
      openapi/src/main/java/com/openapi/controller/BsGasOrderController.java
  4. 7
      service/src/main/java/com/hfkj/common/pay/util/SignatureUtil.java
  5. 25
      service/src/main/java/com/hfkj/dao/BsUserSpreadAccountMapper.java
  6. 35
      service/src/main/java/com/hfkj/dao/BsUserSpreadAccountRecordMapper.java
  7. 14
      service/src/main/java/com/hfkj/dao/BsUserSpreadAccountRecordMapperExt.java
  8. 14
      service/src/main/java/com/hfkj/dao/BsUserSpreadAccountRecordSqlProvider.java
  9. 14
      service/src/main/java/com/hfkj/dao/BsUserSpreadAccountSqlProvider.java
  10. 16
      service/src/main/java/com/hfkj/entity/BsUserSpreadAccount.java
  11. 70
      service/src/main/java/com/hfkj/entity/BsUserSpreadAccountExample.java
  12. 16
      service/src/main/java/com/hfkj/entity/BsUserSpreadAccountRecord.java
  13. 70
      service/src/main/java/com/hfkj/entity/BsUserSpreadAccountRecordExample.java
  14. 11
      service/src/main/java/com/hfkj/service/agent/BsAgentService.java
  15. 43
      service/src/main/java/com/hfkj/service/agent/impl/BsAgentServiceImpl.java
  16. 8
      service/src/main/java/com/hfkj/service/spread/BsUserSpreadAccountRecordService.java
  17. 2
      service/src/main/java/com/hfkj/service/spread/BsUserSpreadAccountService.java
  18. 24
      service/src/main/java/com/hfkj/service/spread/impl/BsUserSpreadAccountRecordServiceImpl.java
  19. 4
      service/src/main/java/com/hfkj/service/spread/impl/BsUserSpreadAccountServiceImpl.java
  20. 12
      service/src/main/java/com/hfkj/service/spread/impl/BsUserSpreadPowerServiceImpl.java
  21. 43
      service/src/main/java/com/hfkj/sysenum/agent/AgentStatusEnum.java

@ -105,6 +105,55 @@ public class BsAgentController {
} }
} }
@RequestMapping(value = "/disable", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "禁用代理商")
public ResponseData disable(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("agentNo"))) {
log.error("BsAgentController --> disable() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询代理商
BsAgent agent = agentService.getAgentByAgentNo(body.getString("agentNo"));
if (agent == null) {
log.error("BsAgentController --> disable() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理商");
}
agentService.disable(body.getString("agentNo"));
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("BsAgentController --> disable() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/enable", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "启用代理商")
public ResponseData enable(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("agentNo"))) {
log.error("BsAgentController --> enable() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询代理商
BsAgent agent = agentService.getAgentByAgentNo(body.getString("agentNo"));
if (agent == null) {
log.error("BsAgentController --> enable() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的代理商");
}
agentService.enable(body.getString("agentNo"));
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("BsAgentController --> enable() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/queryAgentDetail", method = RequestMethod.GET) @RequestMapping(value = "/queryAgentDetail", method = RequestMethod.GET)
@ResponseBody @ResponseBody

@ -272,7 +272,8 @@ public class BsUserSpreadController {
@RequestMapping(value = "/getRecordList", method = RequestMethod.GET) @RequestMapping(value = "/getRecordList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询记录列表") @ApiOperation(value = "查询记录列表")
public ResponseData getRecordList(@RequestParam(value = "userId", required = true) Long userId, public ResponseData getRecordList(@RequestParam(value = "userId", required = false) Long userId,
@RequestParam(value = "userPhone", required = false) String userPhone,
@RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "sourceType", required = false) Integer sourceType, @RequestParam(value = "sourceType", required = false) Integer sourceType,
@RequestParam(value = "createTimeS", required = false) Long createTimeS, @RequestParam(value = "createTimeS", required = false) Long createTimeS,
@ -282,6 +283,7 @@ public class BsUserSpreadController {
try { try {
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
param.put("userId", userId); param.put("userId", userId);
param.put("userPhone", userPhone);
param.put("type", type); param.put("type", type);
param.put("sourceType", sourceType); param.put("sourceType", sourceType);
param.put("createTimeS", createTimeS); param.put("createTimeS", createTimeS);
@ -295,4 +297,30 @@ public class BsUserSpreadController {
} }
} }
@RequestMapping(value = "/countRecordAmount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "统计记录")
public ResponseData countRecordAmount(@RequestParam(value = "userId", required = false) Long userId,
@RequestParam(value = "userPhone", required = false) String userPhone,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "sourceType", required = false) Integer sourceType,
@RequestParam(value = "createTimeS", required = false) Long createTimeS,
@RequestParam(value = "createTimeE", required = false) Long createTimeE) {
try {
Map<String,Object> param = new HashMap<>();
param.put("userId", userId);
param.put("userPhone", userPhone);
param.put("type", type);
param.put("sourceType", sourceType);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
return ResponseMsgUtil.success(userSpreadAccountRecordService.countRecordAmount(param));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
} }

@ -24,6 +24,7 @@ import com.hfkj.service.agent.BsAgentApiAccountService;
import com.hfkj.service.agent.BsAgentApiLogService; import com.hfkj.service.agent.BsAgentApiLogService;
import com.hfkj.service.agent.BsAgentApiParamService; import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentMerService; import com.hfkj.service.agent.BsAgentMerService;
import com.hfkj.sysenum.agent.AgentStatusEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -73,6 +74,9 @@ public class BsGasOrderController {
if (account == null) { if (account == null) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易账户"); throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的交易账户");
} }
if (!account.getStatus().equals(AgentStatusEnum.status1.getCode())) {
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "交易账户已被禁用");
}
// 余额是否小于消费余额 // 余额是否小于消费余额
if (account.getAmount().compareTo(body.getRefuelingAmount()) == -1) { if (account.getAmount().compareTo(body.getRefuelingAmount()) == -1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "账户余额不足"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "账户余额不足");

@ -86,10 +86,11 @@ public class SignatureUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("appid", "hfc030e3c3217dfc"); obj.put("appId", "hfa52e9d683e7056");
obj.put("phone", "18328378446"); obj.put("pageNum", "1");
obj.put("pageSize", "100");
String sign = createSign(JSONObject.parseObject(obj.toJSONString()), "8518b90a06b4ac67fd2ff8d8ae4c2d62"); String sign = createSign(JSONObject.parseObject(obj.toJSONString()), "251529f314cc2a8679280d88626b1ef2");
System.out.println(sign); System.out.println(sign);
} }

@ -39,14 +39,16 @@ public interface BsUserSpreadAccountMapper extends BsUserSpreadAccountMapperExt
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
@Insert({ @Insert({
"insert into bs_user_spread_account (user_id, amount, ", "insert into bs_user_spread_account (user_id, user_phone, ",
"cash_out_amount, `status`, ", "amount, cash_out_amount, ",
"create_time, update_time, ", "`status`, create_time, ",
"ext_1, ext_2, ext_3)", "update_time, ext_1, ",
"values (#{userId,jdbcType=BIGINT}, #{amount,jdbcType=DECIMAL}, ", "ext_2, ext_3)",
"#{cashOutAmount,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", "values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", "#{amount,jdbcType=DECIMAL}, #{cashOutAmount,jdbcType=DECIMAL}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsUserSpreadAccount record); int insert(BsUserSpreadAccount record);
@ -59,6 +61,7 @@ public interface BsUserSpreadAccountMapper extends BsUserSpreadAccountMapperExt
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL), @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
@Result(column="cash_out_amount", property="cashOutAmount", jdbcType=JdbcType.DECIMAL), @Result(column="cash_out_amount", property="cashOutAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -72,14 +75,15 @@ public interface BsUserSpreadAccountMapper extends BsUserSpreadAccountMapperExt
@Select({ @Select({
"select", "select",
"id, user_id, amount, cash_out_amount, `status`, create_time, update_time, ext_1, ", "id, user_id, user_phone, amount, cash_out_amount, `status`, create_time, update_time, ",
"ext_2, ext_3", "ext_1, ext_2, ext_3",
"from bs_user_spread_account", "from bs_user_spread_account",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL), @Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
@Result(column="cash_out_amount", property="cashOutAmount", jdbcType=JdbcType.DECIMAL), @Result(column="cash_out_amount", property="cashOutAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -103,6 +107,7 @@ public interface BsUserSpreadAccountMapper extends BsUserSpreadAccountMapperExt
@Update({ @Update({
"update bs_user_spread_account", "update bs_user_spread_account",
"set user_id = #{userId,jdbcType=BIGINT},", "set user_id = #{userId,jdbcType=BIGINT},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"amount = #{amount,jdbcType=DECIMAL},", "amount = #{amount,jdbcType=DECIMAL},",
"cash_out_amount = #{cashOutAmount,jdbcType=DECIMAL},", "cash_out_amount = #{cashOutAmount,jdbcType=DECIMAL},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",

@ -40,19 +40,21 @@ public interface BsUserSpreadAccountRecordMapper extends BsUserSpreadAccountReco
@Insert({ @Insert({
"insert into bs_user_spread_account_record (user_spread_account_id, user_id, ", "insert into bs_user_spread_account_record (user_spread_account_id, user_id, ",
"`type`, transaction_amount, ", "user_phone, `type`, ",
"before_amount, after_amount, ", "transaction_amount, before_amount, ",
"source_type, source_id, ", "after_amount, source_type, ",
"source_order_no, source_content, ", "source_id, source_order_no, ",
"`status`, create_time, ", "source_content, `status`, ",
"ext_1, ext_2, ext_3)", "create_time, ext_1, ",
"ext_2, ext_3)",
"values (#{userSpreadAccountId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, ", "values (#{userSpreadAccountId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, ",
"#{type,jdbcType=INTEGER}, #{transactionAmount,jdbcType=DECIMAL}, ", "#{userPhone,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, ",
"#{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL}, ", "#{transactionAmount,jdbcType=DECIMAL}, #{beforeAmount,jdbcType=DECIMAL}, ",
"#{sourceType,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ", "#{afterAmount,jdbcType=DECIMAL}, #{sourceType,jdbcType=INTEGER}, ",
"#{sourceOrderNo,jdbcType=VARCHAR}, #{sourceContent,jdbcType=VARCHAR}, ", "#{sourceId,jdbcType=BIGINT}, #{sourceOrderNo,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{sourceContent,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(BsUserSpreadAccountRecord record); int insert(BsUserSpreadAccountRecord record);
@ -66,6 +68,7 @@ public interface BsUserSpreadAccountRecordMapper extends BsUserSpreadAccountReco
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_spread_account_id", property="userSpreadAccountId", jdbcType=JdbcType.BIGINT), @Result(column="user_spread_account_id", property="userSpreadAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL), @Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL), @Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@ -84,9 +87,9 @@ public interface BsUserSpreadAccountRecordMapper extends BsUserSpreadAccountReco
@Select({ @Select({
"select", "select",
"id, user_spread_account_id, user_id, `type`, transaction_amount, before_amount, ", "id, user_spread_account_id, user_id, user_phone, `type`, transaction_amount, ",
"after_amount, source_type, source_id, source_order_no, source_content, `status`, ", "before_amount, after_amount, source_type, source_id, source_order_no, source_content, ",
"create_time, ext_1, ext_2, ext_3", "`status`, create_time, ext_1, ext_2, ext_3",
"from bs_user_spread_account_record", "from bs_user_spread_account_record",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -94,6 +97,7 @@ public interface BsUserSpreadAccountRecordMapper extends BsUserSpreadAccountReco
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="user_spread_account_id", property="userSpreadAccountId", jdbcType=JdbcType.BIGINT), @Result(column="user_spread_account_id", property="userSpreadAccountId", jdbcType=JdbcType.BIGINT),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER), @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL), @Result(column="transaction_amount", property="transactionAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL), @Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@ -123,6 +127,7 @@ public interface BsUserSpreadAccountRecordMapper extends BsUserSpreadAccountReco
"update bs_user_spread_account_record", "update bs_user_spread_account_record",
"set user_spread_account_id = #{userSpreadAccountId,jdbcType=BIGINT},", "set user_spread_account_id = #{userSpreadAccountId,jdbcType=BIGINT},",
"user_id = #{userId,jdbcType=BIGINT},", "user_id = #{userId,jdbcType=BIGINT},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"`type` = #{type,jdbcType=INTEGER},", "`type` = #{type,jdbcType=INTEGER},",
"transaction_amount = #{transactionAmount,jdbcType=DECIMAL},", "transaction_amount = #{transactionAmount,jdbcType=DECIMAL},",
"before_amount = #{beforeAmount,jdbcType=DECIMAL},", "before_amount = #{beforeAmount,jdbcType=DECIMAL},",

@ -3,6 +3,9 @@ package com.hfkj.dao;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.Map;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
@ -10,4 +13,15 @@ public interface BsUserSpreadAccountRecordMapperExt {
@Select("select count(1) from bs_user_spread_account_record where user_id = #{userId} and DATE(create_time) = DATE(NOW()) and source_type = 2") @Select("select count(1) from bs_user_spread_account_record where user_id = #{userId} and DATE(create_time) = DATE(NOW()) and source_type = 2")
Integer withdrawChance(@Param("userId") Long userId); Integer withdrawChance(@Param("userId") Long userId);
@Select("<script>" +
" select sum(transaction_amount) from bs_user_spread_account_record where 1 = 1" +
" <if test='param.userId != null'> and user_id = #{param.userId} </if>" +
" <if test='param.userPhone != null'> and user_phone like concat('%',#{param.userPhone},'%') </if>" +
" <if test='param.type != null'> and type = #{param.type} </if>" +
" <if test='param.sourceType != null'> and source_type = #{param.sourceType} </if>" +
" <if test='param.createTimeS != null'> <![CDATA[ and create_time >= #{param.createTimeS} ]]> </if> " +
" <if test='param.createTimeE != null'> <![CDATA[ and create_time <= #{param.createTimeE} ]]> </if>" +
"</script>")
BigDecimal countRecordAmount(@Param("param") Map<String,Object> param);
} }

@ -36,6 +36,10 @@ public class BsUserSpreadAccountRecordSqlProvider {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
}
if (record.getType() != null) { if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}"); sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
} }
@ -100,6 +104,7 @@ public class BsUserSpreadAccountRecordSqlProvider {
} }
sql.SELECT("user_spread_account_id"); sql.SELECT("user_spread_account_id");
sql.SELECT("user_id"); sql.SELECT("user_id");
sql.SELECT("user_phone");
sql.SELECT("`type`"); sql.SELECT("`type`");
sql.SELECT("transaction_amount"); sql.SELECT("transaction_amount");
sql.SELECT("before_amount"); sql.SELECT("before_amount");
@ -142,6 +147,10 @@ public class BsUserSpreadAccountRecordSqlProvider {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
}
if (record.getType() != null) { if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
} }
@ -205,6 +214,7 @@ public class BsUserSpreadAccountRecordSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("user_spread_account_id = #{record.userSpreadAccountId,jdbcType=BIGINT}"); sql.SET("user_spread_account_id = #{record.userSpreadAccountId,jdbcType=BIGINT}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}"); sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}"); sql.SET("transaction_amount = #{record.transactionAmount,jdbcType=DECIMAL}");
sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}"); sql.SET("before_amount = #{record.beforeAmount,jdbcType=DECIMAL}");
@ -236,6 +246,10 @@ public class BsUserSpreadAccountRecordSqlProvider {
sql.SET("user_id = #{userId,jdbcType=BIGINT}"); sql.SET("user_id = #{userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getType() != null) { if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}"); sql.SET("`type` = #{type,jdbcType=INTEGER}");
} }

@ -32,6 +32,10 @@ public class BsUserSpreadAccountSqlProvider {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) { if (record.getAmount() != null) {
sql.VALUES("amount", "#{amount,jdbcType=DECIMAL}"); sql.VALUES("amount", "#{amount,jdbcType=DECIMAL}");
} }
@ -75,6 +79,7 @@ public class BsUserSpreadAccountSqlProvider {
sql.SELECT("id"); sql.SELECT("id");
} }
sql.SELECT("user_id"); sql.SELECT("user_id");
sql.SELECT("user_phone");
sql.SELECT("amount"); sql.SELECT("amount");
sql.SELECT("cash_out_amount"); sql.SELECT("cash_out_amount");
sql.SELECT("`status`"); sql.SELECT("`status`");
@ -108,6 +113,10 @@ public class BsUserSpreadAccountSqlProvider {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) { if (record.getAmount() != null) {
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}"); sql.SET("amount = #{record.amount,jdbcType=DECIMAL}");
} }
@ -150,6 +159,7 @@ public class BsUserSpreadAccountSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}"); sql.SET("amount = #{record.amount,jdbcType=DECIMAL}");
sql.SET("cash_out_amount = #{record.cashOutAmount,jdbcType=DECIMAL}"); sql.SET("cash_out_amount = #{record.cashOutAmount,jdbcType=DECIMAL}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
@ -172,6 +182,10 @@ public class BsUserSpreadAccountSqlProvider {
sql.SET("user_id = #{userId,jdbcType=BIGINT}"); sql.SET("user_id = #{userId,jdbcType=BIGINT}");
} }
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getAmount() != null) { if (record.getAmount() != null) {
sql.SET("amount = #{amount,jdbcType=DECIMAL}"); sql.SET("amount = #{amount,jdbcType=DECIMAL}");
} }

@ -24,6 +24,11 @@ public class BsUserSpreadAccount implements Serializable {
*/ */
private Long userId; private Long userId;
/**
* 用户手机号
*/
private String userPhone;
/** /**
* 账户余额 * 账户余额
*/ */
@ -73,6 +78,14 @@ public class BsUserSpreadAccount implements Serializable {
this.userId = userId; this.userId = userId;
} }
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public BigDecimal getAmount() { public BigDecimal getAmount() {
return amount; return amount;
} }
@ -151,6 +164,7 @@ public class BsUserSpreadAccount implements Serializable {
BsUserSpreadAccount other = (BsUserSpreadAccount) that; BsUserSpreadAccount other = (BsUserSpreadAccount) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount())) && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
&& (this.getCashOutAmount() == null ? other.getCashOutAmount() == null : this.getCashOutAmount().equals(other.getCashOutAmount())) && (this.getCashOutAmount() == null ? other.getCashOutAmount() == null : this.getCashOutAmount().equals(other.getCashOutAmount()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
@ -167,6 +181,7 @@ public class BsUserSpreadAccount implements Serializable {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
result = prime * result + ((getCashOutAmount() == null) ? 0 : getCashOutAmount().hashCode()); result = prime * result + ((getCashOutAmount() == null) ? 0 : getCashOutAmount().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
@ -186,6 +201,7 @@ public class BsUserSpreadAccount implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", userId=").append(userId); sb.append(", userId=").append(userId);
sb.append(", userPhone=").append(userPhone);
sb.append(", amount=").append(amount); sb.append(", amount=").append(amount);
sb.append(", cashOutAmount=").append(cashOutAmount); sb.append(", cashOutAmount=").append(cashOutAmount);
sb.append(", status=").append(status); sb.append(", status=").append(status);

@ -246,6 +246,76 @@ public class BsUserSpreadAccountExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserPhoneIsNull() {
addCriterion("user_phone is null");
return (Criteria) this;
}
public Criteria andUserPhoneIsNotNull() {
addCriterion("user_phone is not null");
return (Criteria) this;
}
public Criteria andUserPhoneEqualTo(String value) {
addCriterion("user_phone =", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotEqualTo(String value) {
addCriterion("user_phone <>", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThan(String value) {
addCriterion("user_phone >", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThanOrEqualTo(String value) {
addCriterion("user_phone >=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThan(String value) {
addCriterion("user_phone <", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThanOrEqualTo(String value) {
addCriterion("user_phone <=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLike(String value) {
addCriterion("user_phone like", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotLike(String value) {
addCriterion("user_phone not like", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneIn(List<String> values) {
addCriterion("user_phone in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotIn(List<String> values) {
addCriterion("user_phone not in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneBetween(String value1, String value2) {
addCriterion("user_phone between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotBetween(String value1, String value2) {
addCriterion("user_phone not between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andAmountIsNull() { public Criteria andAmountIsNull() {
addCriterion("amount is null"); addCriterion("amount is null");
return (Criteria) this; return (Criteria) this;

@ -26,6 +26,11 @@ public class BsUserSpreadAccountRecord implements Serializable {
*/ */
private Long userId; private Long userId;
/**
* 用户手机号
*/
private String userPhone;
/** /**
* 类型 1进账 2出账 * 类型 1进账 2出账
*/ */
@ -108,6 +113,14 @@ public class BsUserSpreadAccountRecord implements Serializable {
this.userId = userId; this.userId = userId;
} }
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public Integer getType() { public Integer getType() {
return type; return type;
} }
@ -227,6 +240,7 @@ public class BsUserSpreadAccountRecord implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserSpreadAccountId() == null ? other.getUserSpreadAccountId() == null : this.getUserSpreadAccountId().equals(other.getUserSpreadAccountId())) && (this.getUserSpreadAccountId() == null ? other.getUserSpreadAccountId() == null : this.getUserSpreadAccountId().equals(other.getUserSpreadAccountId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getTransactionAmount() == null ? other.getTransactionAmount() == null : this.getTransactionAmount().equals(other.getTransactionAmount())) && (this.getTransactionAmount() == null ? other.getTransactionAmount() == null : this.getTransactionAmount().equals(other.getTransactionAmount()))
&& (this.getBeforeAmount() == null ? other.getBeforeAmount() == null : this.getBeforeAmount().equals(other.getBeforeAmount())) && (this.getBeforeAmount() == null ? other.getBeforeAmount() == null : this.getBeforeAmount().equals(other.getBeforeAmount()))
@ -249,6 +263,7 @@ public class BsUserSpreadAccountRecord implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserSpreadAccountId() == null) ? 0 : getUserSpreadAccountId().hashCode()); result = prime * result + ((getUserSpreadAccountId() == null) ? 0 : getUserSpreadAccountId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getTransactionAmount() == null) ? 0 : getTransactionAmount().hashCode()); result = prime * result + ((getTransactionAmount() == null) ? 0 : getTransactionAmount().hashCode());
result = prime * result + ((getBeforeAmount() == null) ? 0 : getBeforeAmount().hashCode()); result = prime * result + ((getBeforeAmount() == null) ? 0 : getBeforeAmount().hashCode());
@ -274,6 +289,7 @@ public class BsUserSpreadAccountRecord implements Serializable {
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", userSpreadAccountId=").append(userSpreadAccountId); sb.append(", userSpreadAccountId=").append(userSpreadAccountId);
sb.append(", userId=").append(userId); sb.append(", userId=").append(userId);
sb.append(", userPhone=").append(userPhone);
sb.append(", type=").append(type); sb.append(", type=").append(type);
sb.append(", transactionAmount=").append(transactionAmount); sb.append(", transactionAmount=").append(transactionAmount);
sb.append(", beforeAmount=").append(beforeAmount); sb.append(", beforeAmount=").append(beforeAmount);

@ -306,6 +306,76 @@ public class BsUserSpreadAccountRecordExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andUserPhoneIsNull() {
addCriterion("user_phone is null");
return (Criteria) this;
}
public Criteria andUserPhoneIsNotNull() {
addCriterion("user_phone is not null");
return (Criteria) this;
}
public Criteria andUserPhoneEqualTo(String value) {
addCriterion("user_phone =", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotEqualTo(String value) {
addCriterion("user_phone <>", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThan(String value) {
addCriterion("user_phone >", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneGreaterThanOrEqualTo(String value) {
addCriterion("user_phone >=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThan(String value) {
addCriterion("user_phone <", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLessThanOrEqualTo(String value) {
addCriterion("user_phone <=", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneLike(String value) {
addCriterion("user_phone like", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotLike(String value) {
addCriterion("user_phone not like", value, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneIn(List<String> values) {
addCriterion("user_phone in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotIn(List<String> values) {
addCriterion("user_phone not in", values, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneBetween(String value1, String value2) {
addCriterion("user_phone between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andUserPhoneNotBetween(String value1, String value2) {
addCriterion("user_phone not between", value1, value2, "userPhone");
return (Criteria) this;
}
public Criteria andTypeIsNull() { public Criteria andTypeIsNull() {
addCriterion("`type` is null"); addCriterion("`type` is null");
return (Criteria) this; return (Criteria) this;

@ -33,6 +33,17 @@ public interface BsAgentService {
*/ */
BsAgent updateAgent(BsAgent agent); BsAgent updateAgent(BsAgent agent);
/**
* 禁用
* @param agentNo
*/
void disable(String agentNo);
/**
* 启用
* @param agentNo
*/
void enable(String agentNo);
/** /**
* 查询代理商 * 查询代理商
* @param id * @param id

@ -12,6 +12,8 @@ import com.hfkj.service.agent.BsAgentApiParamService;
import com.hfkj.service.agent.BsAgentService; import com.hfkj.service.agent.BsAgentService;
import com.hfkj.service.sec.SecUserService; import com.hfkj.service.sec.SecUserService;
import com.hfkj.sysenum.SecUserObjectTypeEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum;
import com.hfkj.sysenum.agent.AgentStaffStatusEnum;
import com.hfkj.sysenum.agent.AgentStatusEnum;
import com.hfkj.sysenum.agent.AgentTypeEnum; import com.hfkj.sysenum.agent.AgentTypeEnum;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -106,6 +108,47 @@ public class BsAgentServiceImpl implements BsAgentService {
return agent; return agent;
} }
@Override
public void disable(String agentNo) {
// 代理商
BsAgent agent = getAgentByAgentNo(agentNo);
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商");
}
agent.setStatus(AgentStatusEnum.status2.getCode());
updateAgent(agent);
// 代理商账户
if (agent.getType().equals(AgentTypeEnum.type2.getCode())) {
BsAgentApiAccount account = agentApiAccountService.getAccount(agent.getId());
if (account != null) {
account.setStatus(AgentStatusEnum.status2.getCode());
agentApiAccountService.update(account);
}
}
}
@Override
public void enable(String agentNo) {
// 代理商
BsAgent agent = getAgentByAgentNo(agentNo);
if (agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到代理商");
}
agent.setStatus(AgentStatusEnum.status1.getCode());
updateAgent(agent);
// 代理商账户
if (agent.getType().equals(AgentTypeEnum.type2.getCode())) {
BsAgentApiAccount account = agentApiAccountService.getAccount(agent.getId());
if (account != null) {
account.setStatus(AgentStatusEnum.status1.getCode());
agentApiAccountService.update(account);
}
}
}
@Override @Override
public BsAgent getAgentById(Long id) { public BsAgent getAgentById(Long id) {
return agentMapper.selectByPrimaryKey(id); return agentMapper.selectByPrimaryKey(id);

@ -2,6 +2,7 @@ package com.hfkj.service.spread;
import com.hfkj.entity.BsUserSpreadAccountRecord; import com.hfkj.entity.BsUserSpreadAccountRecord;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,6 +39,13 @@ public interface BsUserSpreadAccountRecordService {
*/ */
List<BsUserSpreadAccountRecord> getList(Map<String,Object> param); List<BsUserSpreadAccountRecord> getList(Map<String,Object> param);
/**
* 统计记录金额
* @param param
* @return
*/
BigDecimal countRecordAmount(Map<String,Object> param);
/** /**
* 每日可提现次数 * 每日可提现次数
* @param userId * @param userId

@ -19,7 +19,7 @@ public interface BsUserSpreadAccountService {
* 创建数据 * 创建数据
* @param userId * @param userId
*/ */
void create(Long userId); void create(Long userId,String userPhone);
/** /**
* 修改数据 * 修改数据

@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -58,6 +59,10 @@ public class BsUserSpreadAccountRecordServiceImpl implements BsUserSpreadAccount
criteria.andUserIdEqualTo(MapUtils.getLong(param, "userId")); criteria.andUserIdEqualTo(MapUtils.getLong(param, "userId"));
} }
if (StringUtils.isNotBlank(MapUtils.getString(param, "userPhone"))) {
criteria.andUserPhoneLike("%"+MapUtils.getString(param, "userPhone")+"%");
}
if (MapUtils.getInteger(param, "type") != null) { if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type")); criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
} }
@ -78,6 +83,25 @@ public class BsUserSpreadAccountRecordServiceImpl implements BsUserSpreadAccount
return userSpreadAccountRecordMapper.selectByExample(example); return userSpreadAccountRecordMapper.selectByExample(example);
} }
@Override
public BigDecimal countRecordAmount(Map<String, Object> param) {
if (MapUtils.getLong(param, "createTimeS") != null) {
param.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeS")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), DateUtil.Y_M_D_HMS));
}
// 统计
BigDecimal decimal = userSpreadAccountRecordMapper.countRecordAmount(param);
if (decimal != null) {
return decimal;
} else {
return new BigDecimal("0");
}
}
@Override @Override
public int withdrawChance(Long userId) { public int withdrawChance(Long userId) {
return userSpreadAccountRecordMapper.withdrawChance(userId); return userSpreadAccountRecordMapper.withdrawChance(userId);

@ -50,9 +50,10 @@ public class BsUserSpreadAccountServiceImpl implements BsUserSpreadAccountServic
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
private static final String LOCK_KEY = "USER_SPREAD_ACCOUNT_LOCK_"; private static final String LOCK_KEY = "USER_SPREAD_ACCOUNT_LOCK_";
@Override @Override
public void create(Long userId) { public void create(Long userId,String userPhone) {
BsUserSpreadAccount account = new BsUserSpreadAccount(); BsUserSpreadAccount account = new BsUserSpreadAccount();
account.setUserId(userId); account.setUserId(userId);
account.setUserPhone(userPhone);
account.setAmount(new BigDecimal("0")); account.setAmount(new BigDecimal("0"));
account.setCashOutAmount(new BigDecimal("0")); account.setCashOutAmount(new BigDecimal("0"));
account.setStatus(1); account.setStatus(1);
@ -204,6 +205,7 @@ public class BsUserSpreadAccountServiceImpl implements BsUserSpreadAccountServic
BsUserSpreadAccountRecord record = new BsUserSpreadAccountRecord(); BsUserSpreadAccountRecord record = new BsUserSpreadAccountRecord();
record.setUserSpreadAccountId(account.getId()); record.setUserSpreadAccountId(account.getId());
record.setUserId(account.getUserId()); record.setUserId(account.getUserId());
record.setUserPhone(account.getUserPhone());
record.setType(MerchantAccountRecordTypeEnum.type1.getType()); record.setType(MerchantAccountRecordTypeEnum.type1.getType());
record.setTransactionAmount(amount); record.setTransactionAmount(amount);
record.setBeforeAmount(beforeAmount); record.setBeforeAmount(beforeAmount);

@ -4,11 +4,13 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.dao.BsUserSpreadPowerMapper; import com.hfkj.dao.BsUserSpreadPowerMapper;
import com.hfkj.entity.BsUser;
import com.hfkj.entity.BsUserSpreadAccount; import com.hfkj.entity.BsUserSpreadAccount;
import com.hfkj.entity.BsUserSpreadPower; import com.hfkj.entity.BsUserSpreadPower;
import com.hfkj.entity.BsUserSpreadPowerExample; import com.hfkj.entity.BsUserSpreadPowerExample;
import com.hfkj.service.spread.BsUserSpreadAccountService; import com.hfkj.service.spread.BsUserSpreadAccountService;
import com.hfkj.service.spread.BsUserSpreadPowerService; import com.hfkj.service.spread.BsUserSpreadPowerService;
import com.hfkj.service.user.BsUserService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -28,6 +30,8 @@ public class BsUserSpreadPowerServiceImpl implements BsUserSpreadPowerService {
private BsUserSpreadPowerMapper userSpreadPowerMapper; private BsUserSpreadPowerMapper userSpreadPowerMapper;
@Resource @Resource
private BsUserSpreadAccountService userSpreadAccountService; private BsUserSpreadAccountService userSpreadAccountService;
@Resource
private BsUserService userService;
@Override @Override
public void editData(BsUserSpreadPower data) { public void editData(BsUserSpreadPower data) {
@ -53,8 +57,14 @@ public class BsUserSpreadPowerServiceImpl implements BsUserSpreadPowerService {
power.setUserId(userId); power.setUserId(userId);
editData(power); editData(power);
// 查询用户详情
BsUser user = userService.getUser(userId);
if (user == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户信息");
}
// 创建推广账户 // 创建推广账户
userSpreadAccountService.create(userId); userSpreadAccountService.create(userId, user.getPhone());
} }
@Override @Override

@ -0,0 +1,43 @@
package com.hfkj.sysenum.agent;
import lombok.Getter;
import java.util.Objects;
/**
* @className: AgentTypeEnum
* @author: HuRui
* @date: 2024/8/27
**/
@Getter
public enum AgentStatusEnum {
/**
* 删除
*/
status0(0 , "删除"),
/**
* 正常
*/
status1(1 , "正常"),
/**
* 禁用
*/
status2(2 , "禁用"),
;
private Integer code;
private String name;
AgentStatusEnum(int code , String name) {
this.code = code;
this.name = name;
}
public static AgentStatusEnum getDataByType(Integer type) {
for (AgentStatusEnum ele : values()) {
if(Objects.equals(type,ele.code)) return ele;
}
return null;
}
}
Loading…
Cancel
Save