parent
d3ad77bc34
commit
a7f89b841c
@ -0,0 +1,125 @@ |
||||
package com.api.controller.v1; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.BsMer; |
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.openapi.v1.model.request.RequestQueryTransferInfoModel; |
||||
import com.hfkj.openapi.v1.model.request.RequestTransferAccountsModel; |
||||
import com.hfkj.openapi.v1.model.response.ResponseTransferAccountsModel; |
||||
import com.hfkj.openapi.v1.service.OpenApiTransferAccountsService; |
||||
import com.hfkj.openapi.v1.utils.SignatureUtil; |
||||
import com.hfkj.service.BsMerKeyService; |
||||
import com.hfkj.service.BsMerService; |
||||
import com.hfkj.service.BsTransferAccountsService; |
||||
import com.hfkj.sysenum.*; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.RequestBody; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 资金管理 |
||||
* @className: FundManageController |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Controller |
||||
@Api(value = "交易订单") |
||||
@RequestMapping(value = "/v1/fundManage") |
||||
public class FundManageController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(FundManageController.class); |
||||
|
||||
@Resource |
||||
private BsMerService merService; |
||||
@Resource |
||||
private BsMerKeyService merKeyService; |
||||
@Resource |
||||
private BsTransferAccountsService transferAccountsService; |
||||
@Resource |
||||
private OpenApiTransferAccountsService openApiTransferAccountsService; |
||||
|
||||
@RequestMapping(value="/transfer",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "转账") |
||||
public ResponseData transfer(@Validated @RequestBody RequestTransferAccountsModel body, HttpServletRequest request) { |
||||
log.info("========= Start 转账接口 Start ==========="); |
||||
log.info("请求参数:" + JSONObject.toJSONString(body)); |
||||
try { |
||||
// 验证签名
|
||||
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, ""); |
||||
} |
||||
if (transferAccountsService.getDetailByOrderNo(body.getOrderNo()) != null) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "订单号已存在"); |
||||
} |
||||
// 查询商户
|
||||
BsMer mer = merService.getMer(body.getMerchantNo()); |
||||
if (mer == null) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未知的商户号"); |
||||
} |
||||
if (!mer.getMerStatus().equals(MerStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "商户状态异常"); |
||||
} |
||||
|
||||
BsTransferAccounts transferAccounts = new BsTransferAccounts(); |
||||
transferAccounts.setMerId(mer.getId()); |
||||
transferAccounts.setMerNo(mer.getMerNo()); |
||||
transferAccounts.setMerName(mer.getMerName()); |
||||
transferAccounts.setMerAbbreviate(mer.getMerAbbreviate()); |
||||
transferAccounts.setOrderNo(body.getOrderNo()); |
||||
transferAccounts.setAmount(body.getAmount()); |
||||
transferAccounts.setContent(body.getContent()); |
||||
// 转账
|
||||
Map<String, Object> returnParam = openApiTransferAccountsService.transfer(transferAccounts); |
||||
log.info("返回参数:" + JSONObject.toJSONString(returnParam)); |
||||
return ResponseMsgUtil.success(returnParam); |
||||
|
||||
} catch (Exception e) { |
||||
log.info("出现异常:", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} finally { |
||||
log.info("========= END 转账接口 END ==========="); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/queryTransferInfo",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询结果") |
||||
public ResponseData queryTransferInfo(@Validated @RequestBody RequestQueryTransferInfoModel body, HttpServletRequest request) { |
||||
log.info("========= Start 查询结果 Start ==========="); |
||||
log.info("请求参数:" + JSONObject.toJSONString(body)); |
||||
try { |
||||
// 验证签名
|
||||
if (!SignatureUtil.checkSign(body.getSign(), body, merKeyService.getKeyByMerNo(body.getMerchantNo()))) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_SIGN_ERR, ""); |
||||
} |
||||
// 查询详情
|
||||
ResponseTransferAccountsModel transferInfo = openApiTransferAccountsService.queryTransferInfo(body.getOrderNo()); |
||||
log.info("返回参数:" + JSONObject.toJSONString(transferInfo)); |
||||
return ResponseMsgUtil.success(transferInfo); |
||||
|
||||
} catch (Exception e) { |
||||
log.info("出现异常:", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} finally { |
||||
log.info("========= END 查询结果 END ==========="); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,80 @@ |
||||
package com.hfkj.channel.tianque.service; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.channel.tianque.config.TianQueConfig; |
||||
import com.hfkj.channel.tianque.utils.RequestUtil; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 营销转账 |
||||
* @className: TianQueFundManageService |
||||
* @author: HuRui |
||||
* @date: 2023/10/8 |
||||
**/ |
||||
@Component |
||||
public class TianQueFundManageService { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(TianQueFundManageService.class); |
||||
|
||||
/** |
||||
* 营销转账 |
||||
* @param mno 商户号 |
||||
* @param orderNo 交易号 |
||||
* @param amount 交易金额 |
||||
* @param remark 备注 |
||||
* @param investor 服务费出资方,枚举值 01:服务商出资 02:商户出资 |
||||
* @return |
||||
*/ |
||||
public JSONObject orgTransfer(String mno, String orderNo, BigDecimal amount,String remark, String investor) { |
||||
log.info("========= Start 营销转账接口 Start ==========="); |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("mno", mno); |
||||
param.put("orderNo", orderNo); |
||||
param.put("amount", amount); |
||||
param.put("content", remark); |
||||
param.put("investor", investor); |
||||
|
||||
JSONObject responseBody = RequestUtil.request(TianQueConfig.requestUrl + "/capital/fundManage/orgTransfer", param); |
||||
log.info("请求参数:",JSONObject.toJSONString(param)); |
||||
log.info("响应参数:", responseBody.toJSONString()); |
||||
System.out.println("body:" + JSONObject.toJSONString(param)); |
||||
System.out.println("response:" + responseBody.toJSONString()); |
||||
if (!"0000".equals(responseBody.getString("bizCode"))) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, responseBody.getString("bizMsg")); |
||||
} |
||||
log.info("========= END 营销转账接口 END ==========="); |
||||
return responseBody; |
||||
} |
||||
|
||||
/** |
||||
* 转账结果查询 |
||||
* @param orderNo |
||||
* @return |
||||
*/ |
||||
public JSONObject getTransferInfo(String orderNo) { |
||||
log.info("========= Start 营销转账 Start ==========="); |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("orderNo", orderNo); |
||||
|
||||
JSONObject responseBody = RequestUtil.request(TianQueConfig.requestUrl + "/capital/fundManage/getTransferInfo", param); |
||||
log.info("请求参数:",JSONObject.toJSONString(param)); |
||||
log.info("响应参数:", responseBody.toJSONString()); |
||||
System.out.println("body:" + JSONObject.toJSONString(param)); |
||||
System.out.println("response:" + responseBody.toJSONString()); |
||||
if (!"0000".equals(responseBody.getString("bizCode"))) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.COMMON_ERROR, responseBody.getString("bizMsg")); |
||||
} |
||||
log.info("========= END 营销转账 END ==========="); |
||||
return responseBody; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,163 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.entity.BsTransferAccountsExample; |
||||
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 BsTransferAccountsMapper extends BsTransferAccountsMapperExt { |
||||
@SelectProvider(type=BsTransferAccountsSqlProvider.class, method="countByExample") |
||||
long countByExample(BsTransferAccountsExample example); |
||||
|
||||
@DeleteProvider(type=BsTransferAccountsSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsTransferAccountsExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_transfer_accounts", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_transfer_accounts (mer_id, mer_no, ", |
||||
"mer_name, mer_abbreviate, ", |
||||
"order_no, platform_order_no, ", |
||||
"receiver_platform_type, receiver_platform_no, ", |
||||
"amount, shd_fee_amt, ", |
||||
"settle_date, content, ", |
||||
"`status`, transfer_time, ", |
||||
"create_time, create_type, ", |
||||
"update_time, ext_1, ", |
||||
"ext_2, ext_3)", |
||||
"values (#{merId,jdbcType=BIGINT}, #{merNo,jdbcType=VARCHAR}, ", |
||||
"#{merName,jdbcType=VARCHAR}, #{merAbbreviate,jdbcType=VARCHAR}, ", |
||||
"#{orderNo,jdbcType=VARCHAR}, #{platformOrderNo,jdbcType=VARCHAR}, ", |
||||
"#{receiverPlatformType,jdbcType=INTEGER}, #{receiverPlatformNo,jdbcType=VARCHAR}, ", |
||||
"#{amount,jdbcType=DECIMAL}, #{shdFeeAmt,jdbcType=DECIMAL}, ", |
||||
"#{settleDate,jdbcType=DATE}, #{content,jdbcType=VARCHAR}, ", |
||||
"#{status,jdbcType=INTEGER}, #{transferTime,jdbcType=TIMESTAMP}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{createType,jdbcType=INTEGER}, ", |
||||
"#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", |
||||
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsTransferAccounts record); |
||||
|
||||
@InsertProvider(type=BsTransferAccountsSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsTransferAccounts record); |
||||
|
||||
@SelectProvider(type=BsTransferAccountsSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_abbreviate", property="merAbbreviate", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="platform_order_no", property="platformOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="receiver_platform_type", property="receiverPlatformType", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="receiver_platform_no", property="receiverPlatformNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), |
||||
@Result(column="content", property="content", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="transfer_time", property="transferTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), |
||||
@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<BsTransferAccounts> selectByExample(BsTransferAccountsExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, mer_id, mer_no, mer_name, mer_abbreviate, order_no, platform_order_no, receiver_platform_type, ", |
||||
"receiver_platform_no, amount, shd_fee_amt, settle_date, content, `status`, transfer_time, ", |
||||
"create_time, create_type, update_time, ext_1, ext_2, ext_3", |
||||
"from bs_transfer_accounts", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_abbreviate", property="merAbbreviate", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="platform_order_no", property="platformOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="receiver_platform_type", property="receiverPlatformType", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="receiver_platform_no", property="receiverPlatformNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="shd_fee_amt", property="shdFeeAmt", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="settle_date", property="settleDate", jdbcType=JdbcType.DATE), |
||||
@Result(column="content", property="content", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="transfer_time", property="transferTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="create_type", property="createType", jdbcType=JdbcType.INTEGER), |
||||
@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) |
||||
}) |
||||
BsTransferAccounts selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsTransferAccountsSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsTransferAccounts record, @Param("example") BsTransferAccountsExample example); |
||||
|
||||
@UpdateProvider(type=BsTransferAccountsSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsTransferAccounts record, @Param("example") BsTransferAccountsExample example); |
||||
|
||||
@UpdateProvider(type=BsTransferAccountsSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsTransferAccounts record); |
||||
|
||||
@Update({ |
||||
"update bs_transfer_accounts", |
||||
"set mer_id = #{merId,jdbcType=BIGINT},", |
||||
"mer_no = #{merNo,jdbcType=VARCHAR},", |
||||
"mer_name = #{merName,jdbcType=VARCHAR},", |
||||
"mer_abbreviate = #{merAbbreviate,jdbcType=VARCHAR},", |
||||
"order_no = #{orderNo,jdbcType=VARCHAR},", |
||||
"platform_order_no = #{platformOrderNo,jdbcType=VARCHAR},", |
||||
"receiver_platform_type = #{receiverPlatformType,jdbcType=INTEGER},", |
||||
"receiver_platform_no = #{receiverPlatformNo,jdbcType=VARCHAR},", |
||||
"amount = #{amount,jdbcType=DECIMAL},", |
||||
"shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL},", |
||||
"settle_date = #{settleDate,jdbcType=DATE},", |
||||
"content = #{content,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"transfer_time = #{transferTime,jdbcType=TIMESTAMP},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"create_type = #{createType,jdbcType=INTEGER},", |
||||
"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(BsTransferAccounts record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsTransferAccountsMapperExt { |
||||
} |
@ -0,0 +1,458 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.entity.BsTransferAccountsExample.Criteria; |
||||
import com.hfkj.entity.BsTransferAccountsExample.Criterion; |
||||
import com.hfkj.entity.BsTransferAccountsExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsTransferAccountsSqlProvider { |
||||
|
||||
public String countByExample(BsTransferAccountsExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_transfer_accounts"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsTransferAccountsExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_transfer_accounts"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsTransferAccounts record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_transfer_accounts"); |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerNo() != null) { |
||||
sql.VALUES("mer_no", "#{merNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerAbbreviate() != null) { |
||||
sql.VALUES("mer_abbreviate", "#{merAbbreviate,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOrderNo() != null) { |
||||
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPlatformOrderNo() != null) { |
||||
sql.VALUES("platform_order_no", "#{platformOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformType() != null) { |
||||
sql.VALUES("receiver_platform_type", "#{receiverPlatformType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformNo() != null) { |
||||
sql.VALUES("receiver_platform_no", "#{receiverPlatformNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAmount() != null) { |
||||
sql.VALUES("amount", "#{amount,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getShdFeeAmt() != null) { |
||||
sql.VALUES("shd_fee_amt", "#{shdFeeAmt,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getSettleDate() != null) { |
||||
sql.VALUES("settle_date", "#{settleDate,jdbcType=DATE}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.VALUES("content", "#{content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTransferTime() != null) { |
||||
sql.VALUES("transfer_time", "#{transferTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateType() != null) { |
||||
sql.VALUES("create_type", "#{createType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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(BsTransferAccountsExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("mer_id"); |
||||
sql.SELECT("mer_no"); |
||||
sql.SELECT("mer_name"); |
||||
sql.SELECT("mer_abbreviate"); |
||||
sql.SELECT("order_no"); |
||||
sql.SELECT("platform_order_no"); |
||||
sql.SELECT("receiver_platform_type"); |
||||
sql.SELECT("receiver_platform_no"); |
||||
sql.SELECT("amount"); |
||||
sql.SELECT("shd_fee_amt"); |
||||
sql.SELECT("settle_date"); |
||||
sql.SELECT("content"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("transfer_time"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("create_type"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("bs_transfer_accounts"); |
||||
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) { |
||||
BsTransferAccounts record = (BsTransferAccounts) parameter.get("record"); |
||||
BsTransferAccountsExample example = (BsTransferAccountsExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_transfer_accounts"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,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.getMerName() != null) { |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerAbbreviate() != null) { |
||||
sql.SET("mer_abbreviate = #{record.merAbbreviate,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOrderNo() != null) { |
||||
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPlatformOrderNo() != null) { |
||||
sql.SET("platform_order_no = #{record.platformOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformType() != null) { |
||||
sql.SET("receiver_platform_type = #{record.receiverPlatformType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformNo() != null) { |
||||
sql.SET("receiver_platform_no = #{record.receiverPlatformNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAmount() != null) { |
||||
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getShdFeeAmt() != null) { |
||||
sql.SET("shd_fee_amt = #{record.shdFeeAmt,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getSettleDate() != null) { |
||||
sql.SET("settle_date = #{record.settleDate,jdbcType=DATE}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.SET("content = #{record.content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTransferTime() != null) { |
||||
sql.SET("transfer_time = #{record.transferTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateType() != null) { |
||||
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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_transfer_accounts"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); |
||||
sql.SET("mer_no = #{record.merNo,jdbcType=VARCHAR}"); |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
sql.SET("mer_abbreviate = #{record.merAbbreviate,jdbcType=VARCHAR}"); |
||||
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); |
||||
sql.SET("platform_order_no = #{record.platformOrderNo,jdbcType=VARCHAR}"); |
||||
sql.SET("receiver_platform_type = #{record.receiverPlatformType,jdbcType=INTEGER}"); |
||||
sql.SET("receiver_platform_no = #{record.receiverPlatformNo,jdbcType=VARCHAR}"); |
||||
sql.SET("amount = #{record.amount,jdbcType=DECIMAL}"); |
||||
sql.SET("shd_fee_amt = #{record.shdFeeAmt,jdbcType=DECIMAL}"); |
||||
sql.SET("settle_date = #{record.settleDate,jdbcType=DATE}"); |
||||
sql.SET("content = #{record.content,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("transfer_time = #{record.transferTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("create_type = #{record.createType,jdbcType=INTEGER}"); |
||||
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}"); |
||||
|
||||
BsTransferAccountsExample example = (BsTransferAccountsExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsTransferAccounts record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_transfer_accounts"); |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerNo() != null) { |
||||
sql.SET("mer_no = #{merNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.SET("mer_name = #{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerAbbreviate() != null) { |
||||
sql.SET("mer_abbreviate = #{merAbbreviate,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getOrderNo() != null) { |
||||
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPlatformOrderNo() != null) { |
||||
sql.SET("platform_order_no = #{platformOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformType() != null) { |
||||
sql.SET("receiver_platform_type = #{receiverPlatformType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getReceiverPlatformNo() != null) { |
||||
sql.SET("receiver_platform_no = #{receiverPlatformNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getAmount() != null) { |
||||
sql.SET("amount = #{amount,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getShdFeeAmt() != null) { |
||||
sql.SET("shd_fee_amt = #{shdFeeAmt,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getSettleDate() != null) { |
||||
sql.SET("settle_date = #{settleDate,jdbcType=DATE}"); |
||||
} |
||||
|
||||
if (record.getContent() != null) { |
||||
sql.SET("content = #{content,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getTransferTime() != null) { |
||||
sql.SET("transfer_time = #{transferTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getCreateType() != null) { |
||||
sql.SET("create_type = #{createType,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
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, BsTransferAccountsExample 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,374 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_transfer_accounts |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsTransferAccounts implements Serializable { |
||||
private Long id; |
||||
|
||||
/** |
||||
* 商户id |
||||
*/ |
||||
private Long merId; |
||||
|
||||
/** |
||||
* 商户号 |
||||
*/ |
||||
private String merNo; |
||||
|
||||
/** |
||||
* 商户名称 |
||||
*/ |
||||
private String merName; |
||||
|
||||
/** |
||||
* 商户简称 |
||||
*/ |
||||
private String merAbbreviate; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
private String orderNo; |
||||
|
||||
/** |
||||
* 平台订单号 |
||||
*/ |
||||
private String platformOrderNo; |
||||
|
||||
/** |
||||
* 接收方平台 |
||||
*/ |
||||
private Integer receiverPlatformType; |
||||
|
||||
/** |
||||
* 接收方平台商户号 |
||||
*/ |
||||
private String receiverPlatformNo; |
||||
|
||||
/** |
||||
* 转账金额 |
||||
*/ |
||||
private BigDecimal amount; |
||||
|
||||
/** |
||||
* 交易手续费 |
||||
*/ |
||||
private BigDecimal shdFeeAmt; |
||||
|
||||
/** |
||||
* 结算日期 |
||||
*/ |
||||
private Date settleDate; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 状态 0:不可用 1:处理中 2:成功 3:失败 4:异常 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 转账时间 |
||||
*/ |
||||
private Date transferTime; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 创建方式 1:系统自动 2:API |
||||
*/ |
||||
private Integer createType; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
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 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 String getMerName() { |
||||
return merName; |
||||
} |
||||
|
||||
public void setMerName(String merName) { |
||||
this.merName = merName; |
||||
} |
||||
|
||||
public String getMerAbbreviate() { |
||||
return merAbbreviate; |
||||
} |
||||
|
||||
public void setMerAbbreviate(String merAbbreviate) { |
||||
this.merAbbreviate = merAbbreviate; |
||||
} |
||||
|
||||
public String getOrderNo() { |
||||
return orderNo; |
||||
} |
||||
|
||||
public void setOrderNo(String orderNo) { |
||||
this.orderNo = orderNo; |
||||
} |
||||
|
||||
public String getPlatformOrderNo() { |
||||
return platformOrderNo; |
||||
} |
||||
|
||||
public void setPlatformOrderNo(String platformOrderNo) { |
||||
this.platformOrderNo = platformOrderNo; |
||||
} |
||||
|
||||
public Integer getReceiverPlatformType() { |
||||
return receiverPlatformType; |
||||
} |
||||
|
||||
public void setReceiverPlatformType(Integer receiverPlatformType) { |
||||
this.receiverPlatformType = receiverPlatformType; |
||||
} |
||||
|
||||
public String getReceiverPlatformNo() { |
||||
return receiverPlatformNo; |
||||
} |
||||
|
||||
public void setReceiverPlatformNo(String receiverPlatformNo) { |
||||
this.receiverPlatformNo = receiverPlatformNo; |
||||
} |
||||
|
||||
public BigDecimal getAmount() { |
||||
return amount; |
||||
} |
||||
|
||||
public void setAmount(BigDecimal amount) { |
||||
this.amount = amount; |
||||
} |
||||
|
||||
public BigDecimal getShdFeeAmt() { |
||||
return shdFeeAmt; |
||||
} |
||||
|
||||
public void setShdFeeAmt(BigDecimal shdFeeAmt) { |
||||
this.shdFeeAmt = shdFeeAmt; |
||||
} |
||||
|
||||
public Date getSettleDate() { |
||||
return settleDate; |
||||
} |
||||
|
||||
public void setSettleDate(Date settleDate) { |
||||
this.settleDate = settleDate; |
||||
} |
||||
|
||||
public String getContent() { |
||||
return content; |
||||
} |
||||
|
||||
public void setContent(String content) { |
||||
this.content = content; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Date getTransferTime() { |
||||
return transferTime; |
||||
} |
||||
|
||||
public void setTransferTime(Date transferTime) { |
||||
this.transferTime = transferTime; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Integer getCreateType() { |
||||
return createType; |
||||
} |
||||
|
||||
public void setCreateType(Integer createType) { |
||||
this.createType = createType; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
BsTransferAccounts other = (BsTransferAccounts) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) |
||||
&& (this.getMerNo() == null ? other.getMerNo() == null : this.getMerNo().equals(other.getMerNo())) |
||||
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) |
||||
&& (this.getMerAbbreviate() == null ? other.getMerAbbreviate() == null : this.getMerAbbreviate().equals(other.getMerAbbreviate())) |
||||
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo())) |
||||
&& (this.getPlatformOrderNo() == null ? other.getPlatformOrderNo() == null : this.getPlatformOrderNo().equals(other.getPlatformOrderNo())) |
||||
&& (this.getReceiverPlatformType() == null ? other.getReceiverPlatformType() == null : this.getReceiverPlatformType().equals(other.getReceiverPlatformType())) |
||||
&& (this.getReceiverPlatformNo() == null ? other.getReceiverPlatformNo() == null : this.getReceiverPlatformNo().equals(other.getReceiverPlatformNo())) |
||||
&& (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount())) |
||||
&& (this.getShdFeeAmt() == null ? other.getShdFeeAmt() == null : this.getShdFeeAmt().equals(other.getShdFeeAmt())) |
||||
&& (this.getSettleDate() == null ? other.getSettleDate() == null : this.getSettleDate().equals(other.getSettleDate())) |
||||
&& (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getTransferTime() == null ? other.getTransferTime() == null : this.getTransferTime().equals(other.getTransferTime())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getCreateType() == null ? other.getCreateType() == null : this.getCreateType().equals(other.getCreateType())) |
||||
&& (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 + ((getMerId() == null) ? 0 : getMerId().hashCode()); |
||||
result = prime * result + ((getMerNo() == null) ? 0 : getMerNo().hashCode()); |
||||
result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); |
||||
result = prime * result + ((getMerAbbreviate() == null) ? 0 : getMerAbbreviate().hashCode()); |
||||
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode()); |
||||
result = prime * result + ((getPlatformOrderNo() == null) ? 0 : getPlatformOrderNo().hashCode()); |
||||
result = prime * result + ((getReceiverPlatformType() == null) ? 0 : getReceiverPlatformType().hashCode()); |
||||
result = prime * result + ((getReceiverPlatformNo() == null) ? 0 : getReceiverPlatformNo().hashCode()); |
||||
result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); |
||||
result = prime * result + ((getShdFeeAmt() == null) ? 0 : getShdFeeAmt().hashCode()); |
||||
result = prime * result + ((getSettleDate() == null) ? 0 : getSettleDate().hashCode()); |
||||
result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getTransferTime() == null) ? 0 : getTransferTime().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getCreateType() == null) ? 0 : getCreateType().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(", merId=").append(merId); |
||||
sb.append(", merNo=").append(merNo); |
||||
sb.append(", merName=").append(merName); |
||||
sb.append(", merAbbreviate=").append(merAbbreviate); |
||||
sb.append(", orderNo=").append(orderNo); |
||||
sb.append(", platformOrderNo=").append(platformOrderNo); |
||||
sb.append(", receiverPlatformType=").append(receiverPlatformType); |
||||
sb.append(", receiverPlatformNo=").append(receiverPlatformNo); |
||||
sb.append(", amount=").append(amount); |
||||
sb.append(", shdFeeAmt=").append(shdFeeAmt); |
||||
sb.append(", settleDate=").append(settleDate); |
||||
sb.append(", content=").append(content); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", transferTime=").append(transferTime); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", createType=").append(createType); |
||||
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(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@ |
||||
package com.hfkj.openapi.v1.model.request; |
||||
|
||||
import lombok.Data; |
||||
import org.hibernate.validator.constraints.Length; |
||||
|
||||
import javax.validation.constraints.DecimalMax; |
||||
import javax.validation.constraints.DecimalMin; |
||||
import javax.validation.constraints.NotBlank; |
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* 请求查询转账结果模型 |
||||
* @className: RequestTransferAccountsModel |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Data |
||||
public class RequestQueryTransferInfoModel { |
||||
|
||||
/** |
||||
* 商户号 |
||||
*/ |
||||
@NotBlank(message = "商户号必填项") |
||||
private String merchantNo; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
@NotBlank(message = "订单号必填项") |
||||
private String orderNo; |
||||
|
||||
/** |
||||
* 签名参数 |
||||
*/ |
||||
@NotBlank(message = "签名必填项") |
||||
private String sign; |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package com.hfkj.openapi.v1.model.request; |
||||
|
||||
import lombok.Data; |
||||
import org.hibernate.validator.constraints.Length; |
||||
import javax.validation.constraints.DecimalMax; |
||||
import javax.validation.constraints.DecimalMin; |
||||
import javax.validation.constraints.NotBlank; |
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* 请求转账模型 |
||||
* @className: RequestTransferAccountsModel |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Data |
||||
public class RequestTransferAccountsModel { |
||||
|
||||
/** |
||||
* 商户号 |
||||
*/ |
||||
@NotBlank(message = "商户号必填项") |
||||
private String merchantNo; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
@NotBlank(message = "订单号必填项") |
||||
private String orderNo; |
||||
|
||||
/** |
||||
* 转账金额 |
||||
*/ |
||||
@DecimalMax(value = "99999999", message = "转账最大金额99999999元") |
||||
@DecimalMin(value = "0.01", message = "转账最小金额0.01元") |
||||
@NotBlank(message = "转账金额必填项") |
||||
private BigDecimal amount; |
||||
|
||||
/** |
||||
* 转账金额 |
||||
*/ |
||||
@Length(max = 300, message = "订单标题长度限制在300字符以内") |
||||
private String content; |
||||
|
||||
/** |
||||
* 签名参数 |
||||
*/ |
||||
@NotBlank(message = "签名必填项") |
||||
private String sign; |
||||
|
||||
} |
@ -0,0 +1,61 @@ |
||||
package com.hfkj.openapi.v1.model.response; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @className: ResponseTransferAccountsModel |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Data |
||||
public class ResponseTransferAccountsModel { |
||||
|
||||
/** |
||||
* 商户号 |
||||
*/ |
||||
private String merchantNo; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
private String orderNo; |
||||
|
||||
/** |
||||
* 金额 |
||||
*/ |
||||
private BigDecimal amount; |
||||
|
||||
/** |
||||
* 手续费 |
||||
*/ |
||||
private BigDecimal shdFeeAmt; |
||||
|
||||
/** |
||||
* 结算时间 |
||||
*/ |
||||
private Date settleDate; |
||||
|
||||
/** |
||||
* 备注 |
||||
*/ |
||||
private String content; |
||||
|
||||
/** |
||||
* 状态 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 转账时间 |
||||
*/ |
||||
private Date transferTime; |
||||
|
||||
/** |
||||
* 签名 |
||||
*/ |
||||
private String sign; |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.hfkj.openapi.v1.service; |
||||
|
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.openapi.v1.model.request.RequestTransferAccountsModel; |
||||
import com.hfkj.openapi.v1.model.response.ResponseTransferAccountsModel; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 转账 |
||||
* @className: OpenApiTransferAccountsService |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
public interface OpenApiTransferAccountsService { |
||||
|
||||
/** |
||||
* 转账 |
||||
* @param transferAccounts |
||||
* @return |
||||
*/ |
||||
Map<String,Object> transfer(BsTransferAccounts transferAccounts) throws Exception; |
||||
|
||||
/** |
||||
* 查询详情 |
||||
* @param orderNo |
||||
* @return |
||||
*/ |
||||
ResponseTransferAccountsModel queryTransferInfo(String orderNo) throws Exception; |
||||
|
||||
} |
@ -0,0 +1,102 @@ |
||||
package com.hfkj.openapi.v1.service.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.channel.tianque.service.TianQueFundManageService; |
||||
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.entity.BsMerPlatformNo; |
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.openapi.v1.model.request.RequestTransferAccountsModel; |
||||
import com.hfkj.openapi.v1.model.response.ResponseTransferAccountsModel; |
||||
import com.hfkj.openapi.v1.service.OpenApiTransferAccountsService; |
||||
import com.hfkj.openapi.v1.utils.SignatureUtil; |
||||
import com.hfkj.service.BsMerKeyService; |
||||
import com.hfkj.service.BsMerPlatformNoService; |
||||
import com.hfkj.service.BsMerService; |
||||
import com.hfkj.service.BsTransferAccountsService; |
||||
import com.hfkj.sysenum.MerPlatformNoStatusEnum; |
||||
import com.hfkj.sysenum.PlatformTypeEnum; |
||||
import com.hfkj.sysenum.TransferAccountsCreateType; |
||||
import com.hfkj.sysenum.TransferAccountsStatus; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: OpenApiTransferAccountsServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Service("openApiTransferAccountsService") |
||||
public class OpenApiTransferAccountsServiceImpl implements OpenApiTransferAccountsService { |
||||
|
||||
@Resource |
||||
private TianQueFundManageService tianQueFundManageService; |
||||
@Resource |
||||
private BsTransferAccountsService transferAccountsService; |
||||
@Resource |
||||
private BsMerKeyService merKeyService; |
||||
@Resource |
||||
private BsMerPlatformNoService merPlatformNoService; |
||||
|
||||
@Override |
||||
public Map<String, Object> transfer(BsTransferAccounts transferAccounts) throws Exception { |
||||
// 查询渠道
|
||||
BsMerPlatformNo platform = merPlatformNoService.getPlatformNo(transferAccounts.getMerId(), PlatformTypeEnum.type5); |
||||
if (platform == null) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未开通权限"); |
||||
} |
||||
if (!platform.getStatus().equals(MerPlatformNoStatusEnum.status1.getNumber())) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未开通权限"); |
||||
} |
||||
|
||||
transferAccounts.setStatus(TransferAccountsStatus.status1.getNumber()); |
||||
transferAccounts.setCreateType(TransferAccountsCreateType.type2.getNumber()); |
||||
transferAccounts.setReceiverPlatformType(platform.getPlatformType()); |
||||
transferAccounts.setReceiverPlatformNo(platform.getPlatformNo()); |
||||
transferAccountsService.editData(transferAccounts); |
||||
|
||||
/* // 调用渠道转账
|
||||
JSONObject orgTransfer = tianQueFundManageService.orgTransfer( |
||||
transferAccounts.getReceiverPlatformNo(), |
||||
transferAccounts.getOrderNo(), |
||||
transferAccounts.getAmount(), |
||||
transferAccounts.getOrderNo(), |
||||
"01" |
||||
); |
||||
transferAccounts.setReceiverPlatformNo(orgTransfer.getString("transactionNo")); |
||||
transferAccounts.setSettleDate(DateUtil.format(orgTransfer.getString("clrDt"), "yyyyMMdd")); |
||||
transferAccounts.setTransferTime(DateUtil.format(orgTransfer.getString("transactionTime"), "yyyy-MM-dd HH:mm:ss")); |
||||
transferAccountsService.editData(transferAccounts);*/ |
||||
|
||||
Map<String,Object> map = new HashMap<>(); |
||||
map.put("orderNo", transferAccounts.getOrderNo()); |
||||
map.put("sign", SignatureUtil.createSign(map, merKeyService.getKeyByMerNo(transferAccounts.getMerNo()))); |
||||
return map; |
||||
} |
||||
|
||||
@Override |
||||
public ResponseTransferAccountsModel queryTransferInfo(String orderNo) throws Exception { |
||||
// 查询转账记录
|
||||
BsTransferAccounts transferInfo = transferAccountsService.getDetailByOrderNo(orderNo); |
||||
if (transferInfo == null) { |
||||
throw ErrorHelp.genException(SysCode.OpenApi, ErrorCode.OPEN_API_COMMON, "未找到转账记录"); |
||||
} |
||||
ResponseTransferAccountsModel response = new ResponseTransferAccountsModel(); |
||||
response.setMerchantNo(transferInfo.getMerNo()); |
||||
response.setOrderNo(transferInfo.getOrderNo()); |
||||
response.setAmount(transferInfo.getAmount()); |
||||
response.setShdFeeAmt(transferInfo.getShdFeeAmt()); |
||||
response.setSettleDate(transferInfo.getSettleDate()); |
||||
response.setContent(transferInfo.getContent()); |
||||
response.setTransferTime(transferInfo.getTransferTime()); |
||||
response.setSign(SignatureUtil.createSign(response, merKeyService.getKeyByMerNo(transferInfo.getMerNo()))); |
||||
return response; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.hfkj.service; |
||||
|
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
|
||||
/** |
||||
* @className: BsTransferAccountsService |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
public interface BsTransferAccountsService { |
||||
|
||||
/** |
||||
* 编辑数据 |
||||
* @param transferAccounts |
||||
*/ |
||||
void editData(BsTransferAccounts transferAccounts); |
||||
|
||||
/** |
||||
* 查询数据 |
||||
* @param orderNo 订单号 |
||||
* @return |
||||
*/ |
||||
BsTransferAccounts getDetailByOrderNo(String orderNo); |
||||
|
||||
} |
@ -0,0 +1,67 @@ |
||||
package com.hfkj.service.impl; |
||||
|
||||
import com.hfkj.common.utils.RedisUtil; |
||||
import com.hfkj.dao.BsTransferAccountsMapper; |
||||
import com.hfkj.entity.BsTransferAccounts; |
||||
import com.hfkj.entity.BsTransferAccountsExample; |
||||
import com.hfkj.service.BsTransferAccountsService; |
||||
import com.hfkj.sysenum.TransferAccountsStatus; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @className: BsTransferAccountsServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
@Service("transferAccountsService") |
||||
public class BsTransferAccountsServiceImpl implements BsTransferAccountsService { |
||||
|
||||
@Resource |
||||
private BsTransferAccountsMapper transferAccountsMapper; |
||||
@Autowired |
||||
private RedisUtil redisUtil; |
||||
|
||||
// 缓存目录
|
||||
private final static String TRANSFER_ACCOUNTS = "TRANSFER_ACCOUNTS:"; |
||||
// 缓存时间 1小时
|
||||
private final static long cacheTime = 60 * 60; |
||||
@Override |
||||
public void editData(BsTransferAccounts transferAccounts) { |
||||
if (transferAccounts.getId() == null) { |
||||
transferAccounts.setCreateTime(new Date()); |
||||
transferAccounts.setUpdateTime(new Date()); |
||||
transferAccountsMapper.insert(transferAccounts); |
||||
} else { |
||||
transferAccounts.setUpdateTime(new Date()); |
||||
transferAccountsMapper.updateByPrimaryKey(transferAccounts); |
||||
} |
||||
// 缓存
|
||||
redisUtil.set(TRANSFER_ACCOUNTS + transferAccounts.getOrderNo(), transferAccounts, cacheTime); |
||||
} |
||||
|
||||
@Override |
||||
public BsTransferAccounts getDetailByOrderNo(String orderNo) { |
||||
Object obj = redisUtil.get(TRANSFER_ACCOUNTS + orderNo); |
||||
if (obj != null) { |
||||
return (BsTransferAccounts) obj; |
||||
} |
||||
BsTransferAccountsExample example = new BsTransferAccountsExample(); |
||||
example.createCriteria() |
||||
.andOrderNoEqualTo(orderNo) |
||||
.andStatusNotEqualTo(TransferAccountsStatus.status0.getNumber()); |
||||
List<BsTransferAccounts> list = transferAccountsMapper.selectByExample(example); |
||||
if (!list.isEmpty()) { |
||||
BsTransferAccounts transferAccounts = list.get(0); |
||||
// 缓存
|
||||
redisUtil.set(TRANSFER_ACCOUNTS + transferAccounts.getOrderNo(), transferAccounts, cacheTime); |
||||
return transferAccounts; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.hfkj.sysenum; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 转账创建方式 |
||||
* @className: TransferAccountsCreateType |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
public enum TransferAccountsCreateType { |
||||
type1(0, "系统自动"), |
||||
type2(1, "API"), |
||||
; |
||||
|
||||
private Integer number; |
||||
|
||||
private String name; |
||||
|
||||
TransferAccountsCreateType(int number, String name) { |
||||
this.number = number; |
||||
this.name = name; |
||||
} |
||||
|
||||
public static TransferAccountsCreateType getNameByNumber(Integer number) { |
||||
for (TransferAccountsCreateType ele : values()) { |
||||
if (Objects.equals(number,ele.getNumber())) { |
||||
return ele; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public Integer getNumber() { |
||||
return number; |
||||
} |
||||
|
||||
public void setNumber(Integer number) { |
||||
this.number = number; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
@ -0,0 +1,52 @@ |
||||
package com.hfkj.sysenum; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 转账状态 |
||||
* @className: TransferAccountsStatus |
||||
* @author: HuRui |
||||
* @date: 2023/10/23 |
||||
**/ |
||||
public enum TransferAccountsStatus { |
||||
status0(0, "不可用"), |
||||
status1(1, "处理中"), |
||||
status2(2, "成功"), |
||||
status3(3, "失败"), |
||||
status4(4, "异常"), |
||||
; |
||||
|
||||
private Integer number; |
||||
|
||||
private String name; |
||||
|
||||
TransferAccountsStatus(int number, String name) { |
||||
this.number = number; |
||||
this.name = name; |
||||
} |
||||
|
||||
public static TransferAccountsStatus getNameByNumber(Integer number) { |
||||
for (TransferAccountsStatus ele : values()) { |
||||
if (Objects.equals(number,ele.getNumber())) { |
||||
return ele; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public Integer getNumber() { |
||||
return number; |
||||
} |
||||
|
||||
public void setNumber(Integer number) { |
||||
this.number = number; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
Loading…
Reference in new issue