Commit 7e3c4409 by guojuxing

开票回调函数代码

parent 9c5589c8
......@@ -156,6 +156,16 @@ public class TabInvoiceManage {
*/
private Date updateTime;
/**
* 发起人
*/
private String initiator;
/**
* 发起人类型 1:计费中心 2:应用市场
*/
private Integer initiateType;
public Integer getInvoiceManageId() {
return invoiceManageId;
}
......@@ -395,4 +405,20 @@ public class TabInvoiceManage {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getInitiator() {
return initiator;
}
public void setInitiator(String initiator) {
this.initiator = initiator;
}
public Integer getInitiateType() {
return initiateType;
}
public void setInitiateType(Integer initiateType) {
this.initiateType = initiateType;
}
}
\ No newline at end of file
......@@ -2,8 +2,11 @@ package com.gic.finance.service.outer.impl;
import java.util.Date;
import com.gic.finance.constant.InvoiceInitiateTypeConstants;
import com.gic.finance.dto.callback.InvoiceCallbackDTO;
import com.gic.finance.entity.TabInvoiceAccount;
import com.gic.finance.service.InvoiceAccountService;
import com.gic.finance.util.AsynCallbackUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,14 +26,15 @@ import com.gic.finance.service.InvoiceManageService;
import com.gic.store.utils.CreateSerialNumberUtils;
@Service("invoiceManageApiService")
public class InvoiceManageApiServiceImpl implements InvoiceManageApiService{
public class InvoiceManageApiServiceImpl implements InvoiceManageApiService {
@Autowired
private InvoiceManageService invoiceManageService;
@Autowired
private InvoiceAccountService invoiceAccountService;
@Override
public ServiceResponse<Void> applyInvoice(InvoiceManageDTO invoiceManageDTO) {
ServiceResponse paramResponse = ValidParamsUtils.allCheckValidate(invoiceManageDTO, InvoiceManageDTO.ApplyInvoiceValid.class);
public ServiceResponse<Void> applyInvoiceInit(InvoiceManageDTO invoiceManageDTO) {
ServiceResponse paramResponse = ValidParamsUtils.allCheckValidate(invoiceManageDTO,
InvoiceManageDTO.ApplyInvoiceValid.class);
if (!paramResponse.isSuccess()) {
return paramResponse;
}
......@@ -57,6 +61,23 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService{
}
@Override
public ServiceResponse<Void> applyInvoice(InvoiceManageDTO invoiceManageDTO) {
//计费中心
invoiceManageDTO.setInitiateType(InvoiceInitiateTypeConstants.BILLING);
return applyInvoiceInit(invoiceManageDTO);
}
@Override
public ServiceResponse<Void> applyInvoiceForApp(InvoiceManageDTO invoiceManageDTO) {
if (StringUtils.isBlank(invoiceManageDTO.getInitiator())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "发起人(initiator)主键不能为空");
}
//应用市场类型
invoiceManageDTO.setInitiateType(InvoiceInitiateTypeConstants.APP);
return applyInvoiceInit(invoiceManageDTO);
}
@Override
public ServiceResponse<Void> invoice(Integer invoiceManageId, String expressMailName, String expressMailNumber) {
TabInvoiceManage tabInvoiceManage = invoiceManageService.getById(invoiceManageId);
if (tabInvoiceManage == null) {
......@@ -67,11 +88,16 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService{
if (StringUtils.isBlank(expressMailName) || StringUtils.isBlank(expressMailNumber)) {
//待邮寄
invoiceManageDTO.setInvoiceStatus(InvoiceStatusEnum.TO_BE_MAILED.getCode());
tabInvoiceManage.setInvoiceStatus(InvoiceStatusEnum.TO_BE_MAILED.getCode());
} else {
invoiceManageDTO.setInvoiceStatus(InvoiceStatusEnum.MAILED.getCode());
//物流信息
invoiceManageDTO.setExpressMailName(expressMailName);
invoiceManageDTO.setExpressMailNumber(expressMailNumber);
tabInvoiceManage.setInvoiceStatus(InvoiceStatusEnum.MAILED.getCode());
tabInvoiceManage.setExpressMailName(expressMailName);
tabInvoiceManage.setExpressMailNumber(expressMailNumber);
}
//todo 操作人相关信息
......@@ -82,6 +108,13 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService{
}
invoiceManageDTO.setInvoicerId(account.getInvoiceAccountId());
invoiceManageService.update(invoiceManageDTO);
//回调
if (tabInvoiceManage.getInitiateType().intValue() == InvoiceInitiateTypeConstants.APP) {
InvoiceCallbackDTO callbackDTO = EntityUtil.changeEntityNew(InvoiceCallbackDTO.class, tabInvoiceManage);
AsynCallbackUtils.callBack(callbackDTO, "com.gic.open.api.service.market.InvoiceCallbackApiService",
"invoiceCallback");
}
return ServiceResponse.success();
}
......@@ -101,6 +134,15 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService{
//todo 操作人相关信息
invoiceManageService.update(invoiceManageDTO);
//回调
if (tabInvoiceManage.getInitiateType().intValue() == InvoiceInitiateTypeConstants.APP) {
tabInvoiceManage.setInvoiceStatus(InvoiceStatusEnum.REJECT.getCode());
tabInvoiceManage.setRejectReason(rejectReason);
InvoiceCallbackDTO callbackDTO = EntityUtil.changeEntityNew(InvoiceCallbackDTO.class, tabInvoiceManage);
AsynCallbackUtils.callBack(callbackDTO, "com.gic.open.api.service.market.InvoiceCallbackApiService",
"invoiceCallback");
}
return ServiceResponse.success();
}
......
......@@ -32,6 +32,8 @@
<result column="express_mail_number" jdbcType="VARCHAR" property="expressMailNumber" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="initiator" jdbcType="VARCHAR" property="initiator" />
<result column="initiate_type" jdbcType="INTEGER" property="initiateType" />
</resultMap>
<sql id="Base_Column_List">
invoice_manage_id, invoice_apply_serial, platform_type, invoice_type, billing_amount,
......@@ -39,7 +41,7 @@
operator_phone_area_code, enterprise_id, enterprise_name, company_name, logo, account_name,
tax_number, address, bank, account_phone, bank_account, shipping_name, shipping_phone,
shipping_address, invoicer_id, express_mail_name, express_mail_number, create_time,
update_time
update_time, initiator, initiate_type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -62,7 +64,8 @@
account_phone, bank_account, shipping_name,
shipping_phone, shipping_address, invoicer_id,
express_mail_name, express_mail_number, create_time,
update_time)
update_time, initiator, initiate_type
)
values (#{invoiceManageId,jdbcType=INTEGER}, #{invoiceApplySerial,jdbcType=VARCHAR},
#{platformType,jdbcType=INTEGER}, #{invoiceType,jdbcType=INTEGER}, #{billingAmount,jdbcType=DOUBLE},
#{invoiceStatus,jdbcType=INTEGER}, #{rejectReason,jdbcType=VARCHAR}, #{operatorId,jdbcType=VARCHAR},
......@@ -73,7 +76,8 @@
#{accountPhone,jdbcType=VARCHAR}, #{bankAccount,jdbcType=VARCHAR}, #{shippingName,jdbcType=VARCHAR},
#{shippingPhone,jdbcType=VARCHAR}, #{shippingAddress,jdbcType=VARCHAR}, #{invoicerId,jdbcType=INTEGER},
#{expressMailName,jdbcType=VARCHAR}, #{expressMailNumber,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
#{updateTime,jdbcType=TIMESTAMP}, #{initiator,jdbcType=VARCHAR}, #{initiateType,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.finance.entity.TabInvoiceManage">
insert into tab_invoice_manage
......@@ -168,6 +172,12 @@
<if test="updateTime != null">
update_time,
</if>
<if test="initiator != null">
initiator,
</if>
<if test="initiateType != null">
initiate_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="invoiceManageId != null">
......@@ -260,6 +270,12 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="initiator != null">
#{initiator,jdbcType=VARCHAR},
</if>
<if test="initiateType != null">
#{initiateType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.finance.entity.TabInvoiceManage">
......@@ -352,6 +368,12 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="initiator != null">
initiator = #{initiator,jdbcType=VARCHAR},
</if>
<if test="initiateType != null">
initiate_type = #{initiateType,jdbcType=INTEGER},
</if>
</set>
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</update>
......@@ -385,7 +407,9 @@
express_mail_name = #{expressMailName,jdbcType=VARCHAR},
express_mail_number = #{expressMailNumber,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
initiator = #{initiator,jdbcType=VARCHAR},
initiate_type = #{initiateType,jdbcType=INTEGER}
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</update>
......
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