Commit 63d59c19 by 陶光胜

Merge branch 'developer' into 'master'

Developer

See merge request !6
parents 9e31853f 63133826
......@@ -11,7 +11,9 @@ public enum InvoiceStatusEnum {
TO_BE_MAILED(2, "待邮寄"),
MAILED(3, "已邮寄"),
REJECT(4, "已驳回"),
CANCEL(5, "已取消");
CANCEL(5, "已取消"),
TO_BE_SEND(6, "待发送"),
SEND(7, "已发送");
private int code;
private String message;
......
......@@ -7,7 +7,7 @@ package com.gic.finance.constant;
* @date 2019/8/14 2:35 PM

*/
public enum InvoiceTypeEnum {
NORMAL(1, "纸质普通发票"),
NORMAL(1, "电子普通发票"),
VAT_INVOICE(2, "纸质增值税专用发票");
private int code;
......
......@@ -43,7 +43,7 @@ public class InvoiceManageDTO implements Serializable {
private Integer platformType;
/**
* (发票类型)1:纸质普通发票 2: 纸质增值税专用发票
* (发票类型)1:电子普通发票 2: 纸质增值税专用发票
*/
@NotNull(message = "发票类型不能为空", groups = { ApplyInvoiceValid.class })
@Size(message = "发票类型值不规范", min = 1, max = 2)
......@@ -145,19 +145,16 @@ public class InvoiceManageDTO implements Serializable {
/**
* 收货人
*/
@NotBlank(message = "收货人不能为空", groups = { ApplyInvoiceValid.class })
private String shippingName;
/**
* 收货电话
*/
@NotBlank(message = "收货电话不能为空", groups = { ApplyInvoiceValid.class })
private String shippingPhone;
/**
* 收货地址
*/
@NotBlank(message = "收货地址不能为空", groups = { ApplyInvoiceValid.class })
private String shippingAddress;
/**
......@@ -195,6 +192,17 @@ public class InvoiceManageDTO implements Serializable {
*/
private Integer initiateType;
/**
* 电子发票类型,接收人邮箱
*/
private String email;
/**
* 营业执照 图片地址
*/
@NotBlank(message = "营业执照不能为空", groups = { ApplyInvoiceValid.class })
private String businessLicense;
public Integer getInvoiceManageId() {
return invoiceManageId;
}
......@@ -450,4 +458,22 @@ public class InvoiceManageDTO implements Serializable {
public void setInitiateType(Integer initiateType) {
this.initiateType = initiateType;
}
public String getEmail() {
return email;
}
public InvoiceManageDTO setEmail(String email) {
this.email = email;
return this;
}
public String getBusinessLicense() {
return businessLicense;
}
public InvoiceManageDTO setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
return this;
}
}
......@@ -93,6 +93,16 @@ public class InvoiceCallbackDTO implements Serializable{
*/
private String initiator;
/**
* 电子发票类型,接收人邮箱
*/
private String email;
/**
* 营业执照 图片地址
*/
private String businessLicense;
public String getInvoiceApplySerial() {
return invoiceApplySerial;
}
......@@ -220,4 +230,22 @@ public class InvoiceCallbackDTO implements Serializable{
public void setInitiator(String initiator) {
this.initiator = initiator;
}
public String getEmail() {
return email;
}
public InvoiceCallbackDTO setEmail(String email) {
this.email = email;
return this;
}
public String getBusinessLicense() {
return businessLicense;
}
public InvoiceCallbackDTO setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
return this;
}
}
......@@ -38,7 +38,7 @@ public interface InvoiceManageApiService {
ServiceResponse<String> applyInvoiceForApp(InvoiceManageDTO invoiceManageDTO);
/**
* 开票。待邮寄/邮寄
* 开票。待邮寄/邮寄 (纸质)
* @Title: invoice

* @Description:

 * @author guojuxing
......@@ -50,6 +50,15 @@ public interface InvoiceManageApiService {
ServiceResponse<Void> invoice(Integer invoiceManageId, String expressMailName, String expressMailNumber, OperationUserInfoDTO dto);
/**
* 发送发票(电子发票)
* @param invoiceManageId
* @param sendStatus InvoiceStatusEnum枚举
* @param dto
* @return
*/
ServiceResponse<Void> invoiceOfElectronic(Integer invoiceManageId, Integer sendStatus, OperationUserInfoDTO dto);
/**
* 驳回
* @Title: rejectInvoice

* @Description:
......
......@@ -22,7 +22,7 @@ public class TabInvoiceManage {
private Integer platformType;
/**
* (发票类型)1:纸质普通发票 2: 纸质增值税专用发票
* (发票类型)1:电子普通发票 2: 纸质增值税专用发票
*/
private Integer invoiceType;
......@@ -166,6 +166,16 @@ public class TabInvoiceManage {
*/
private Integer initiateType;
/**
* 电子发票类型,接收人邮箱
*/
private String email;
/**
* 营业执照 图片地址
*/
private String businessLicense;
public Integer getInvoiceManageId() {
return invoiceManageId;
}
......@@ -421,4 +431,22 @@ public class TabInvoiceManage {
public void setInitiateType(Integer initiateType) {
this.initiateType = initiateType;
}
public String getEmail() {
return email;
}
public TabInvoiceManage setEmail(String email) {
this.email = email;
return this;
}
public String getBusinessLicense() {
return businessLicense;
}
public TabInvoiceManage setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
return this;
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.util.Date;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.UserApiService;
import com.gic.finance.constant.InvoiceTypeEnum;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -57,6 +58,15 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService {
invoiceManageDTO.setUpdateTime(new Date());
invoiceManageDTO.setInvoiceStatus(InvoiceStatusEnum.TO_BE_ISSUED.getCode());
invoiceManageDTO.setInvoiceApplySerial(CreateRandomUtils.createSerialNumber());
//电子发票
boolean isElectronicInvoice = invoiceManageDTO.getInvoiceType().intValue() == InvoiceTypeEnum.NORMAL.getCode();
if (isElectronicInvoice) {
if (StringUtils.isBlank(invoiceManageDTO.getEmail())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "接收人邮箱不能为空");
}
}
if (StringUtils.isBlank(invoiceManageDTO.getEnterpriseName())) {
invoiceManageDTO.setEnterpriseName("暂无商户名称");
}
......@@ -96,6 +106,7 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService {
}
InvoiceManageDTO invoiceManageDTO = new InvoiceManageDTO();
invoiceManageDTO.setInvoiceManageId(invoiceManageId);
if (StringUtils.isBlank(expressMailName) || StringUtils.isBlank(expressMailNumber)) {
//待邮寄
invoiceManageDTO.setInvoiceStatus(InvoiceStatusEnum.TO_BE_MAILED.getCode());
......@@ -113,11 +124,11 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService {
getOperationUserInfo(invoiceManageDTO, dto);
//开票户信息插入
TabInvoiceAccount account = invoiceAccountService.getEnable();
if (account == null) {
return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "没有启用的开票户信息,请启用");
}
invoiceManageDTO.setInvoicerId(account.getInvoiceAccountId());
// TabInvoiceAccount account = invoiceAccountService.getEnable();
// if (account == null) {
// return ServiceResponse.failure(ErrorCode.SYSTEM_ERROR.getCode(), "没有启用的开票户信息,请启用");
// }
// invoiceManageDTO.setInvoicerId(account.getInvoiceAccountId());
invoiceManageService.update(invoiceManageDTO);
//回调
......@@ -132,6 +143,32 @@ public class InvoiceManageApiServiceImpl implements InvoiceManageApiService {
}
@Override
public ServiceResponse<Void> invoiceOfElectronic(Integer invoiceManageId, Integer sendStatus, OperationUserInfoDTO dto) {
TabInvoiceManage tabInvoiceManage = invoiceManageService.getById(invoiceManageId);
if (tabInvoiceManage == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "发票管理主键有误");
}
InvoiceManageDTO invoiceManageDTO = new InvoiceManageDTO();
invoiceManageDTO.setInvoiceManageId(invoiceManageId);
invoiceManageDTO.setInvoiceStatus(sendStatus);
tabInvoiceManage.setInvoiceStatus(sendStatus);
getOperationUserInfo(invoiceManageDTO, dto);
invoiceManageService.update(invoiceManageDTO);
//回调
if (tabInvoiceManage.getInitiateType().intValue() == InvoiceInitiateTypeConstants.APP) {
InvoiceCallbackDTO callbackDTO = EntityUtil.changeEntityNew(InvoiceCallbackDTO.class, tabInvoiceManage);
AsyncCallbackUtils.callBack(callbackDTO, "com.gic.open.api.service.market.InvoiceCallbackApiService",
"invoiceCallback");
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> rejectInvoice(Integer invoiceManageId, String rejectReason, OperationUserInfoDTO dto) {
TabInvoiceManage tabInvoiceManage = invoiceManageService.getById(invoiceManageId);
if (tabInvoiceManage == null) {
......
......@@ -34,6 +34,8 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="initiator" jdbcType="VARCHAR" property="initiator" />
<result column="initiate_type" jdbcType="INTEGER" property="initiateType" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
</resultMap>
<sql id="Base_Column_List">
invoice_manage_id, invoice_apply_serial, platform_type, invoice_type, billing_amount,
......@@ -41,7 +43,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, initiator, initiate_type
update_time, initiator, initiate_type, email, business_license
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -64,7 +66,7 @@
account_phone, bank_account, shipping_name,
shipping_phone, shipping_address, invoicer_id,
express_mail_name, express_mail_number, create_time,
update_time, initiator, initiate_type
update_time, initiator, initiate_type, email, business_license
)
values (#{invoiceManageId,jdbcType=INTEGER}, #{invoiceApplySerial,jdbcType=VARCHAR},
#{platformType,jdbcType=INTEGER}, #{invoiceType,jdbcType=INTEGER}, #{billingAmount,jdbcType=DOUBLE},
......@@ -76,7 +78,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}, #{initiator,jdbcType=VARCHAR}, #{initiateType,jdbcType=INTEGER}
#{updateTime,jdbcType=TIMESTAMP}, #{initiator,jdbcType=VARCHAR}, #{initiateType,jdbcType=INTEGER},
#{email,jdbcType=VARCHAR}, #{businessLicense,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.finance.entity.TabInvoiceManage">
......@@ -178,6 +181,12 @@
<if test="initiateType != null">
initiate_type,
</if>
<if test="email != null">
email,
</if>
<if test="businessLicense != null">
business_license,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="invoiceManageId != null">
......@@ -276,6 +285,12 @@
<if test="initiateType != null">
#{initiateType,jdbcType=INTEGER},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="businessLicense != null">
#{businessLicense,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.finance.entity.TabInvoiceManage">
......@@ -374,6 +389,12 @@
<if test="initiateType != null">
initiate_type = #{initiateType,jdbcType=INTEGER},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="businessLicense != null">
business_license = #{businessLicense,jdbcType=VARCHAR},
</if>
</set>
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</update>
......@@ -409,7 +430,9 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
initiator = #{initiator,jdbcType=VARCHAR},
initiate_type = #{initiateType,jdbcType=INTEGER}
initiate_type = #{initiateType,jdbcType=INTEGER},
email = #{email,jdbcType=VARCHAR},
business_license = #{businessLicense,jdbcType=VARCHAR}
where invoice_manage_id = #{invoiceManageId,jdbcType=INTEGER}
</update>
......
......@@ -3,6 +3,8 @@ package com.gic.finance.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.finance.constant.InvoiceStatusEnum;
import com.gic.finance.constant.InvoiceTypeEnum;
import com.gic.finance.dto.InvoiceAccountDTO;
import com.gic.finance.service.InvoiceAccountApiService;
import com.gic.finance.web.utils.UserInfoUtils;
......@@ -47,7 +49,7 @@ public class InvoiceManageController {
}
/**
* 同意审批
* 同意审批(纸质)
* @param dto
* @return
*/
......@@ -58,6 +60,22 @@ public class InvoiceManageController {
}
/**
* 审批(电子发票)
* @param dto
* @param isSend true:已发送
* @return
*/
@RequestMapping("/invoice-of-electronic")
public RestResponse invoiceOfElectronic(InvoiceManageDTO dto, boolean isSend) {
Integer sendStatus = InvoiceStatusEnum.TO_BE_SEND.getCode();
if (isSend) {
sendStatus = InvoiceStatusEnum.SEND.getCode();
}
return ResultControllerUtils.commonResult(invoiceManageApiService.invoiceOfElectronic(dto.getInvoiceManageId(),
sendStatus, UserInfoUtils.getOpertaionUserInfo()));
}
/**
* 驳回审批
* @param dto
* @return
......
......@@ -78,6 +78,11 @@ public class InvoiceManageListVO implements Serializable{
*/
private String expressMailNumber;
/**
* 发票类型)1:电子普通发票 2: 纸质增值税专用发票
*/
private Integer invoiceType;
public Integer getInvoiceManageId() {
return invoiceManageId;
}
......@@ -174,4 +179,13 @@ public class InvoiceManageListVO implements Serializable{
public void setExpressMailNumber(String expressMailNumber) {
this.expressMailNumber = expressMailNumber;
}
public Integer getInvoiceType() {
return invoiceType;
}
public InvoiceManageListVO setInvoiceType(Integer invoiceType) {
this.invoiceType = invoiceType;
return this;
}
}
......@@ -22,7 +22,7 @@ public class InvoiceManagerDetailVO implements Serializable{
private Integer invoiceManageId;
/**
* (发票类型)1:纸质普通发票 2: 纸质增值税专用发票
* (发票类型)1:电子普通发票 2: 纸质增值税专用发票
*/
private Integer invoiceType;
......@@ -141,6 +141,16 @@ public class InvoiceManagerDetailVO implements Serializable{
*/
private String shippingAddress;
/**
* 电子发票类型,接收人邮箱
*/
private String email;
/**
* 营业执照 图片地址
*/
private String businessLicense;
public Integer getInvoiceManageId() {
return invoiceManageId;
}
......@@ -153,6 +163,10 @@ public class InvoiceManagerDetailVO implements Serializable{
this.invoiceType = invoiceType;
}
public Integer getInvoiceType() {
return invoiceType;
}
public String getInvoiceTypeStr() {
return InvoiceTypeEnum.getMessageByCode(invoiceType);
}
......@@ -344,4 +358,22 @@ public class InvoiceManagerDetailVO implements Serializable{
public void setShippingAddress(String shippingAddress) {
this.shippingAddress = shippingAddress;
}
public String getEmail() {
return email;
}
public InvoiceManagerDetailVO setEmail(String email) {
this.email = email;
return this;
}
public String getBusinessLicense() {
return businessLicense;
}
public InvoiceManagerDetailVO setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
return this;
}
}
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