Commit 7e3c4409 by guojuxing

开票回调函数代码

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