Commit 4fc26df5 by guojuxing

余额账户信息接口

parent 755c77b1
package com.gic.enterprise.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 账户
* @ClassName: BillingAccountDTO

* @Description: 

* @author guojuxing

* @date 2019/8/16 3:13 PM

*/
public class BillingAccountDTO implements Serializable{
private static final long serialVersionUID = 3522330358092424524L;
/**
*
*/
private Integer accountId;
/**
*
*/
private Integer enterpriseId;
/**
* 账户余额
*/
private Double accountBalance;
/**
* 授信额度
*/
private Integer creditLine;
/**
* 1:自动续充, 0:手动充
*/
private Integer autoRecharge;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}
public Integer getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(Integer enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Double getAccountBalance() {
return accountBalance;
}
public void setAccountBalance(Double accountBalance) {
this.accountBalance = accountBalance;
}
public Integer getCreditLine() {
return creditLine;
}
public void setCreditLine(Integer creditLine) {
this.creditLine = creditLine;
}
public Integer getAutoRecharge() {
return autoRecharge;
}
public void setAutoRecharge(Integer autoRecharge) {
this.autoRecharge = autoRecharge;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.gic.enterprise.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.BillingAccountDTO;
/**
* 计费中心账户
* @ClassName: BillingAccountApiService

* @Description: 

* @author guojuxing

* @date 2019/8/16 3:16 PM

*/
public interface BillingAccountApiService {
/**
* 根据商户ID查询余额账户
* @Title: getByEnterpriseId

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return com.gic.api.base.commons.ServiceResponse<com.gic.enterprise.dto.BillingAccountDTO>


 */
ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId);
}
package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabBillingAccount;
import org.apache.ibatis.annotations.Param;
public interface TabBillingAccountMapper {
/**
......@@ -50,4 +51,14 @@ public interface TabBillingAccountMapper {
* @return 更新条目数
*/
int updateByPrimaryKey(TabBillingAccount record);
/**
* 根据商户ID查询余额账户
* @Title: selectByEnterpriseId

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return com.gic.enterprise.entity.TabBillingAccount


 */
TabBillingAccount selectByEnterpriseId(@Param("enterpriseId") Integer enterpriseId);
}
\ No newline at end of file
package com.gic.enterprise.entity;
import java.util.Date;
/**
* tab_billing_account
*/
......@@ -29,6 +31,16 @@ public class TabBillingAccount {
*/
private Integer autoRecharge;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
public Integer getAccountId() {
return accountId;
}
......@@ -68,4 +80,20 @@ public class TabBillingAccount {
public void setAutoRecharge(Integer autoRecharge) {
this.autoRecharge = autoRecharge;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabBillingAccount;
/**
* 计费中心账户
* @ClassName: BillingAccountService

* @Description: 

* @author guojuxing

* @date 2019/8/16 3:18 PM

*/
public interface BillingAccountService {
/**
* 根据商户ID查询余额账户
* @Title: getByEnterpriseId

* @Description:

 * @author guojuxing
* @param enterpriseId

* @return com.gic.enterprise.entity.TabBillingAccount


 */
TabBillingAccount getByEnterpriseId(Integer enterpriseId);
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.dao.mapper.TabBillingAccountMapper;
import com.gic.enterprise.entity.TabBillingAccount;
import com.gic.enterprise.service.BillingAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("billingAccountService")
public class BillingAccountServiceImpl implements BillingAccountService{
@Autowired
private TabBillingAccountMapper tabBillingAccountMapper;
@Override
public TabBillingAccount getByEnterpriseId(Integer enterpriseId) {
return tabBillingAccountMapper.selectByEnterpriseId(enterpriseId);
}
}
package com.gic.enterprise.service.outer;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.BillingAccountDTO;
import com.gic.enterprise.entity.TabBillingAccount;
import com.gic.enterprise.entity.TabEnterprise;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.BillingAccountApiService;
import com.gic.enterprise.service.BillingAccountService;
import com.gic.enterprise.service.EnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("billingAccountApiService")
public class BillingAccountApiServiceImpl implements BillingAccountApiService{
@Autowired
private BillingAccountService billingAccountService;
@Autowired
private EnterpriseService enterpriseService;
@Override
public ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId) {
TabEnterprise tabEnterprise = enterpriseService.getEnterpriseById(enterpriseId);
if (tabEnterprise == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID有误");
}
TabBillingAccount account = billingAccountService.getByEnterpriseId(enterpriseId);
return ServiceResponse.success(EntityUtil.changeEntityNew(BillingAccountDTO.class, account));
}
}
......@@ -31,4 +31,6 @@
<!--支付信息-->
<dubbo:service interface="com.gic.enterprise.service.BillingPayInfoApiService" ref="billingPayInfoApiService" timeout="60000" />
<dubbo:service interface="com.gic.enterprise.service.PackApiService" ref="packApiService" timeout="6000" />
<!--计费中心余额账户-->
<dubbo:service interface="com.gic.enterprise.service.BillingAccountApiService" ref="billingAccountApiService" timeout="6000" />
</beans>
......@@ -7,9 +7,11 @@
<result column="account_balance" jdbcType="DOUBLE" property="accountBalance" />
<result column="credit_line" jdbcType="INTEGER" property="creditLine" />
<result column="auto_recharge" jdbcType="INTEGER" property="autoRecharge" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
account_id, enterprise_id, account_balance, credit_line, auto_recharge
account_id, enterprise_id, account_balance, credit_line, auto_recharge, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -23,9 +25,10 @@
</delete>
<insert id="insert" parameterType="com.gic.enterprise.entity.TabBillingAccount">
insert into tab_billing_account (account_id, enterprise_id, account_balance,
credit_line, auto_recharge)
credit_line, auto_recharge, create_time, update_time)
values (#{accountId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{accountBalance,jdbcType=DOUBLE},
#{creditLine,jdbcType=INTEGER}, #{autoRecharge,jdbcType=INTEGER})
#{creditLine,jdbcType=INTEGER}, #{autoRecharge,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabBillingAccount">
insert into tab_billing_account
......@@ -45,6 +48,12 @@
<if test="autoRecharge != null">
auto_recharge,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accountId != null">
......@@ -62,6 +71,12 @@
<if test="autoRecharge != null">
#{autoRecharge,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabBillingAccount">
......@@ -79,6 +94,12 @@
<if test="autoRecharge != null">
auto_recharge = #{autoRecharge,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where account_id = #{accountId,jdbcType=INTEGER}
</update>
......@@ -87,7 +108,16 @@
set enterprise_id = #{enterpriseId,jdbcType=INTEGER},
account_balance = #{accountBalance,jdbcType=DOUBLE},
credit_line = #{creditLine,jdbcType=INTEGER},
auto_recharge = #{autoRecharge,jdbcType=INTEGER}
auto_recharge = #{autoRecharge,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where account_id = #{accountId,jdbcType=INTEGER}
</update>
<select id="selectByEnterpriseId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_billing_account
where enterprise_id = #{enterpriseId}
</select>
</mapper>
\ No newline at end of file
package com.gic.enterprise.web.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.service.BillingAccountApiService;
import com.gic.enterprise.service.PackApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
/**
* 计费中心余额账户
* @ClassName: BillingAccountController

* @Description: 

* @author guojuxing

* @date 2019/8/16 3:53 PM

*/
@RestController
@RequestMapping("/billing-account")
public class BillingAccountController {
private static final Logger LOGGER = LoggerFactory.getLogger(BillingAccountController.class);
@Autowired
private BillingAccountApiService billingAccountApiService;
@Autowired
private PackApiService packApiService;
@RequestMapping("/billing-account-info")
public RestResponse billingAccountInfo() {
Integer enterprise = 1111;
return ResultControllerUtils.commonResult(billingAccountApiService.getByEnterpriseId(enterprise));
}
}
......@@ -41,4 +41,7 @@
<!--发票管理-->
<dubbo:reference interface="com.gic.finance.service.InvoiceManageApiService" id="invoiceManageApiService" timeout="60000" />
<!--计费中心余额账户-->
<dubbo:reference interface="com.gic.enterprise.service.BillingAccountApiService" id="billingAccountApiService" timeout="60000" />
</beans>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment