parent
4070796ec9
commit
7c7640f9ad
@ -0,0 +1,36 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 查询红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class CxhzDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
|
||||
private CxhzJsonDataDTO jsonData; |
||||
|
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 查询红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class CxhzJsonDataDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "申请来源") |
||||
private String sqly; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "开票日期起") |
||||
private String kprqq; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "开票日期止") |
||||
private String kprqz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "红字发票信息确认单id") |
||||
private String hzfpxxqrdid; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "红字发票信息确认单编号") |
||||
private String hzfpxxqrdbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "蓝字发票号码") |
||||
private String lzfphm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "每页条数") |
||||
private String pageSize; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "页数") |
||||
private String pageNumber; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,42 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 通用查询接口DTO |
||||
* |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class FileAcquisitionDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "全电发票号码") |
||||
private String fphm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "开票日期,格式:yyyyMMddHHmmss\t") |
||||
private String kprq; |
||||
|
||||
|
||||
} |
@ -0,0 +1,30 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 通用查询接口DTO |
||||
* |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class FileAcquisitionDetailDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "全电发票号码") |
||||
private String fphm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "开票日期") |
||||
private String kprq; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "文件格式") |
||||
private String wjgs; |
||||
|
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 全电发票文件获取 |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class FileAcquisitionOnDTO { |
||||
|
||||
|
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
private FileAcquisitionOnDetailDTO jsonData; |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 全电发票文件获取 |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class FileAcquisitionOnDetailDTO { |
||||
|
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "发票号码") |
||||
private String fphm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "开票日期") |
||||
private String kprq; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "文件格式") |
||||
private String wjgs; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,42 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 快速红冲 |
||||
*/ |
||||
@Data |
||||
public class KshcDTO { |
||||
|
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@ApiModelProperty(value = "true本接口不支持同步") |
||||
@NotEmpty |
||||
private Boolean async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
@ApiModelProperty(value = "冲红原因代码") |
||||
@NotEmpty |
||||
private String chyydm; |
||||
|
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "原发票号码") |
||||
private String yfphm; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,45 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 通用查询接口DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class QueryDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "渠道标识") |
||||
private String appkey; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "地区编码") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "false") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "任务id") |
||||
private String requestId; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "tycxjk") |
||||
private String serviceId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 审核红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class ShhzDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
private ShhzJsonDataDTO jsonData; |
||||
|
||||
|
||||
} |
@ -0,0 +1,30 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 审核红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class ShhzJsonDataDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "确认类型") |
||||
private String qrlx; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "红字发票信息确认单id") |
||||
private String hzfpxxqrdid; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方纳税人识别号") |
||||
private String xsfnsrsbh; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 申请红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class SqhzDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
private SqhzJsonDataDTO jsonData; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,64 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 申请红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class SqhzJsonDataDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "冲红原因代码") |
||||
private String chyydm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方纳税人识别号") |
||||
private String gmfnsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "红字合计金额") |
||||
private String hzcxje; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "红字合计税额") |
||||
private String hzcxse; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "申请来源") |
||||
private String sqly; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "特定要素类型代码(参考码表)") |
||||
private String tdyslxdm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销售方纳税人识别号") |
||||
private String xsfnsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "原发票号码") |
||||
private String yfphm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "原开票日期") |
||||
private String ykprq; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "原纸质发票代码") |
||||
private String yzzfpdm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "原纸质发票号码") |
||||
private String yzzfphm; |
||||
|
||||
private List<SqhzJsonDataDetailDTO> hzqrxxmxlist; |
||||
|
||||
|
||||
} |
@ -0,0 +1,57 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 申请红字信息表 |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class SqhzJsonDataDetailDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "单价") |
||||
private String dj; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "单位") |
||||
private String dw; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "规格型号") |
||||
private String ggxh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "金额") |
||||
private String je; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "蓝字明细序号") |
||||
private String lzmxxh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "税额") |
||||
private String se; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "数量") |
||||
private String sl; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "税率") |
||||
private String slv; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "商品编码") |
||||
private String spbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "商品名称") |
||||
private String xmmc; |
||||
|
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class YhdjDTO { |
||||
|
||||
@ApiModelProperty(value = "渠道标识") |
||||
private String appkey; |
||||
@ApiModelProperty(value = "false") |
||||
private Boolean async; |
||||
@ApiModelProperty(value = "yhdj") |
||||
private String serviceId; |
||||
|
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
|
||||
|
||||
YhdjDetailDTO jsonData; |
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author dxk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class YhdjDetailDTO { |
||||
|
||||
@ApiModelProperty(value = "*办税人员姓名(税局实名认证的人员)") |
||||
private String bsryxm; |
||||
@ApiModelProperty(value = "*登录身份(1:财务负责人,2:法定代表人,3:办税人,4:购票员,5:普通管理员,99:其他) 备注:如果选择99|其他,则办税人员名称、手机号码、身份证件号码.可以不传") |
||||
private String dlsf; |
||||
@ApiModelProperty(value = "*办税人员登录密码") |
||||
private String dlsfmm; |
||||
@ApiModelProperty(value = "*登录方式(参考码表)") |
||||
private String dlfs; |
||||
@ApiModelProperty(value = "*登录密码") |
||||
private String dlmm; |
||||
@ApiModelProperty(value = "*登录账号") |
||||
private String dlzh; |
||||
@ApiModelProperty(value = "*纳税人名称") |
||||
private String nsrmc; |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
@ApiModelProperty(value = "*办税人员身份证件号码(税局实名认证的人员)") |
||||
private String bsrysfzjhm; |
||||
@ApiModelProperty(value = "*办税人员手机号码(税局实名认证的人员)") |
||||
private String bsrysjhm; |
||||
@ApiModelProperty(value = "中间号码") |
||||
private String zjh; |
||||
|
||||
@ApiModelProperty(value = "*登陆标志1 新版") |
||||
private String loginType; |
||||
|
||||
|
||||
} |
@ -0,0 +1,113 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddDTO { |
||||
|
||||
@ApiModelProperty(value = "渠道标识") |
||||
private String appkey; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "true") |
||||
private String async; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "办税人身份证号") |
||||
private String bsrysfzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*地区编码(参考码表)") |
||||
private String dqbm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "*纳税人识别号") |
||||
private String nsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "lzfpkj") |
||||
private String serviceId; |
||||
|
||||
InvoiceAllAddInfoDTO jsonData; |
||||
|
||||
// 2023/3/9 新增字段
|
||||
@ApiModelProperty(value = "放弃享受减按1%征收率原因") |
||||
private String kjlx; |
||||
|
||||
@ApiModelProperty(value = "出行人") |
||||
private String cxr; |
||||
|
||||
@ApiModelProperty(value = "出行人证件类型") |
||||
private String cxrzjlx; |
||||
|
||||
@ApiModelProperty(value = "出行人证件号码") |
||||
private String cxrzjhm; |
||||
|
||||
@ApiModelProperty(value = "出行日期") |
||||
private String cxrq; |
||||
|
||||
@ApiModelProperty(value = "出发地") |
||||
private String cfd; |
||||
|
||||
@ApiModelProperty(value = "到达地") |
||||
private String ddd; |
||||
|
||||
@ApiModelProperty(value = "交通工具类型") |
||||
private String jtgjlx; |
||||
|
||||
@ApiModelProperty(value = "等级") |
||||
private String dengj; |
||||
|
||||
@ApiModelProperty(value = "货物运输服务") |
||||
private String hwysfw; |
||||
|
||||
@ApiModelProperty(value = "起运地") |
||||
private String qyd; |
||||
|
||||
@ApiModelProperty(value = "运输工具号牌") |
||||
private String ysgjhp; |
||||
|
||||
@ApiModelProperty(value = "运输工具种类") |
||||
private String ysgjzl; |
||||
|
||||
@ApiModelProperty(value = "运输货物名称") |
||||
private String yshwmc; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,131 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 发票开具 2 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddInfoDTO { |
||||
|
||||
@ApiModelProperty(value = "备注") |
||||
private String bz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "发票类型代码") |
||||
private String fplxdm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "发票请求流水号") |
||||
private String fpqqlsh; |
||||
|
||||
@ApiModelProperty(value = "购方信息确认") |
||||
private String gfxxconfirm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方地址") |
||||
private String gmfdz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方开户行") |
||||
private String gmfkhh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方联系电话") |
||||
private String gmflxdh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方名称") |
||||
private String gmfmc; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方税号") |
||||
private String gmfnsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "购买方银行账号") |
||||
private String gmfyhzh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "合计金额") |
||||
private String hjje; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "合计税额") |
||||
private String hjse; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "含税标志 1-不含税 2-含税") |
||||
private String hsbz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "经办人姓名") |
||||
private String jbrxm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "经办人证件号码") |
||||
private String jbrzjhm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "经办人证件种类代码") |
||||
private String jbrzjzldm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "经办人纳税人识别号") |
||||
private String jrznsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "价税合计") |
||||
private String jshj; |
||||
|
||||
@ApiModelProperty(value = "") |
||||
private String kjly; |
||||
|
||||
// 特定业务必填
|
||||
// @NotEmpty
|
||||
@ApiModelProperty(value = "特定要素类型代码") |
||||
private String tdyslxdm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方地址") |
||||
private String xsfdz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方开户行") |
||||
private String xsfkhh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方联系电话") |
||||
private String xsflxdh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方名称") |
||||
private String xsfmc; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方税号") |
||||
private String xsfnsrsbh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "销方银行账号") |
||||
private String xsfyhzh; |
||||
|
||||
|
||||
List<InvoiceAllAddfjxxListDTO> fjxxList; |
||||
|
||||
List<InvoiceAllAddmxListDTO> mxList; |
||||
|
||||
List<InvoiceAllAddtdywxxDTO> tdywxx; |
||||
|
||||
List<InvoiceAllAddextDTO> ext; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,22 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddextDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "0") |
||||
private String zdhqbsdz; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddfjxxListDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "附加信息名称") |
||||
private String fjxxmc; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "附加信息内容") |
||||
private String fjxxnr; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,63 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddmxListDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "单价") |
||||
private String dj; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "单位") |
||||
private String dw; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "发票行性质") |
||||
private String fphxz; |
||||
|
||||
@ApiModelProperty(value = "规格型号") |
||||
private String ggxh; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "金额") |
||||
private String je; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "税额") |
||||
private String se; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "税率") |
||||
private String slv; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "商品数量") |
||||
private String spsl; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "税收分类编码") |
||||
private String ssflbm; |
||||
|
||||
@ApiModelProperty(value = "特定征税方式代码") |
||||
private String tdzsfsdm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "项目名称") |
||||
private String xmmc; |
||||
|
||||
@ApiModelProperty(value = "税收优惠政策类型代码") |
||||
private String zzstsgldm; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,22 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddtdywxxDTO { |
||||
|
||||
|
||||
List<InvoiceAllAddtdywxxjzfwDTO> jzfw; |
||||
|
||||
List<InvoiceAllAddtdywxxbdcjyzlfwDTO> bdcjyzlfw; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,46 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddtdywxxbdcjyzlfwDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "房屋产权证书/不动产权证号码") |
||||
private String fwcqzshm; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "不动产地址") |
||||
private String bdcdz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "不动产详细地址") |
||||
private String bdcxxdz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "租赁期起") |
||||
private String zlqq; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "租赁期止") |
||||
private String zlqz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "跨地市标志") |
||||
private String kdsbz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "面积单位") |
||||
private String mjdw; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,39 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.add; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
/** |
||||
* 发票开具 1 DTO |
||||
* @author kk |
||||
* @date 2022年12月09日 17:16 |
||||
*/ |
||||
@Data |
||||
public class InvoiceAllAddtdywxxjzfwDTO { |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "建筑服务发生地") |
||||
private String jzfwfsd; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "发生地详细地址") |
||||
private String fsdxxdz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "建筑项目名称") |
||||
private String jzxmmc; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "跨地市标志") |
||||
private String kdsbz; |
||||
|
||||
@NotEmpty |
||||
@ApiModelProperty(value = "土地增值税项目编号") |
||||
private String tdzzsxmbh; |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,28 @@ |
||||
package com.jianshui.invoice.domain.dto.jcsk.red; |
||||
|
||||
import lombok.Data; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
@Data |
||||
public class AddRedInvoiceDTO { |
||||
@NotEmpty(message = "发票类型代码不能为空") |
||||
private String fplxdm; // 发票类型代码
|
||||
|
||||
@NotEmpty(message = "发票请求流水号不能为空") |
||||
private String fpqqlsh; // 发票请求流水号
|
||||
|
||||
@NotEmpty(message = "原发票类型代码不能为空") |
||||
private String yfplxdm; // 原发票类型代码
|
||||
|
||||
@NotEmpty(message = "原全电发票号码不能为空") |
||||
private String yfphm; // 原全电发票号码
|
||||
|
||||
@NotEmpty(message = "红字发票信息确认单id不能为空") |
||||
private String hzfpxxqrdid; // 红字发票信息确认单id
|
||||
|
||||
@NotEmpty(message = "销方税号不能为空") |
||||
private String xsfnsrsbh; // 销方税号
|
||||
|
||||
private String ytdyslxdm; // 原特定要素类型代码
|
||||
} |
@ -0,0 +1,228 @@ |
||||
package com.jianshui.invoice.service.impl.adapter.request; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.jianshui.common.core.domain.entity.Companyservice; |
||||
import com.jianshui.common.enums.ErrorCode; |
||||
import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; |
||||
import com.jianshui.common.utils.IdcardUtils; |
||||
import com.jianshui.common.utils.StringUtils; |
||||
import com.jianshui.common.utils.encrypt.AisinoInvoiceDecryptUtil; |
||||
import com.jianshui.invoice.domain.BillDetail; |
||||
import com.jianshui.invoice.domain.BillInfo; |
||||
import com.jianshui.invoice.domain.Redinfo; |
||||
import com.jianshui.invoice.domain.Redinfodetail; |
||||
import com.jianshui.invoice.domain.dto.DownloadRedInfoDTO; |
||||
import com.jianshui.invoice.domain.dto.adapter.request.aisino_jn.HxBillDetailDTO; |
||||
import com.jianshui.invoice.domain.dto.adapter.request.aisino_jn.HxBillInfoDTO; |
||||
import com.jianshui.invoice.domain.dto.adapter.request.aisino_jn.HxRedInfoDTO; |
||||
import com.jianshui.invoice.domain.dto.adapter.request.aisino_jn.HxRedInfoDetailsDTO; |
||||
import com.jianshui.invoice.service.IInvoiceRequestService; |
||||
import com.jianshui.system.service.ICompanyserviceService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.*; |
||||
|
||||
/** |
||||
* @Description 航信入口报文适配器 |
||||
* @Author 巩权林 |
||||
* @Date 2022/3/19 21:28 |
||||
**/ |
||||
@Slf4j |
||||
@Component("jn_jcsk_invoice_request_adapter") |
||||
public class JcskInvoiceRequestAdapterImpl implements IInvoiceRequestService { |
||||
|
||||
@Autowired |
||||
private ICompanyserviceService companyserviceService; |
||||
|
||||
/** |
||||
* 解密函数 |
||||
* |
||||
* @param request |
||||
* @param companyservice |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public JSONObject decrypt(HttpServletRequest request, Companyservice companyservice, String serviceKey) { |
||||
// 根据servletRequest获取原始请求报文
|
||||
// String rawInput = HttpHelper.getBodyString(request);
|
||||
// if (StringUtils.isEmpty(rawInput)) {
|
||||
// throw new JianshuiParamErrorException(ErrorCode.EMPTY_PARAMS,"invoice);
|
||||
// }
|
||||
// JSONObject rawJson = JSONObject.parseObject(rawInput);
|
||||
// 因为航信的报文都是Form,所以这里要按form的来
|
||||
//方式一:getParameterMap(),获得请求参数map
|
||||
Map<String, String[]> map = request.getParameterMap(); |
||||
//参数名称
|
||||
Set<String> key = map.keySet(); |
||||
//参数迭代器
|
||||
Iterator<String> iterator = key.iterator(); |
||||
// JSONObject rawJson = JSONObject.parseObject(JSONObject.toJSONString(params));
|
||||
JSONObject rawJson = new JSONObject(); |
||||
while (iterator.hasNext()) { |
||||
String k = iterator.next(); |
||||
rawJson.put(k, map.get(k)[0]); |
||||
} |
||||
|
||||
|
||||
if (StringUtils.isEmpty(rawJson)) { |
||||
throw new JianshuiParamErrorException(ErrorCode.ERROR_PARAMS, companyservice, "invoice"); |
||||
} |
||||
|
||||
String order = rawJson.getString("order"); |
||||
String identity = rawJson.getString("identity"); |
||||
|
||||
log.info("【航信转invoice请求适配器】客户请求报文原始数据:{},销方id:{},serviceKey:{}", rawJson, companyservice.getCompanyid(), serviceKey); |
||||
|
||||
// 开始解析报文
|
||||
if (order == null || "".equals(order.trim())) { |
||||
throw new JianshuiParamErrorException(ErrorCode.ERROR_PARAMS, companyservice, "invoice"); |
||||
} |
||||
|
||||
String JKey = companyservice.getSecret(); // 解密用的secret
|
||||
if (StringUtils.isEmpty(JKey)) { |
||||
throw new JianshuiParamErrorException(ErrorCode.IDENTITY_NOT_SET, companyservice, "jcsk"); |
||||
} |
||||
|
||||
// 平台解密
|
||||
try { |
||||
order = AisinoInvoiceDecryptUtil.decrypt(order, JKey); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
throw new JianshuiParamErrorException(ErrorCode.DECRYPT_ERROR, companyservice, "jcsk"); |
||||
} |
||||
|
||||
|
||||
log.info("销项报文:identity=" + identity + ",order=" + order); |
||||
|
||||
// 报文内容体
|
||||
JSONObject json = new JSONObject(); |
||||
try { |
||||
// 根据用户封装参数进行区别处理
|
||||
JSONObject orderJson = JSONObject.parseObject(order); |
||||
String myIdentity = orderJson.getString("identity"); |
||||
if (myIdentity != null) { |
||||
// order里面有identity的情况,取出来order
|
||||
JSONObject tempJson = new JSONObject(); |
||||
tempJson = orderJson.getJSONObject("order"); |
||||
if (tempJson != null) { |
||||
orderJson = tempJson; |
||||
} |
||||
} |
||||
|
||||
json = orderJson; |
||||
|
||||
// 如果是开票或者查询
|
||||
if (StringUtils.equals(serviceKey, "add") || StringUtils.equals(serviceKey, "query")) { |
||||
// 开始把航信报文转成billInfo
|
||||
HxBillInfoDTO hxBillInfo = json.toJavaObject(HxBillInfoDTO.class); |
||||
BillInfo billInfo = new BillInfo(); |
||||
BeanUtils.copyProperties(hxBillInfo, billInfo); |
||||
if(StringUtils.isNotEmpty(hxBillInfo.getEmail())){ |
||||
billInfo.setBuyerEmail(hxBillInfo.getEmail()); |
||||
} |
||||
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
||||
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
||||
if (StringUtils.isNotEmpty(bankNo)) { |
||||
String raw = billInfo.getBuyerAccount(); |
||||
billInfo.setBuyerAccount(bankNo); |
||||
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
||||
} |
||||
} |
||||
// 处理detail
|
||||
List<HxBillDetailDTO> hxBillDetailList = hxBillInfo.getDetail(); |
||||
List<BillDetail> detailList = new ArrayList<>(); |
||||
if (hxBillDetailList != null && hxBillDetailList.size() > 0) { |
||||
for (HxBillDetailDTO detial : hxBillDetailList) { |
||||
BillDetail temp = new BillDetail(); |
||||
BeanUtils.copyProperties(detial, temp); |
||||
detailList.add(temp); |
||||
} |
||||
billInfo.setBillDetailList(detailList); |
||||
} |
||||
|
||||
if (StringUtils.isEmpty(billInfo.getBuyerBank()) && StringUtils.isNotEmpty(billInfo.getBuyerAccount())) { |
||||
String bankNo = IdcardUtils.getBankNo(billInfo.getBuyerAccount()); |
||||
if (StringUtils.isNotEmpty(bankNo)) { |
||||
String raw = billInfo.getBuyerAccount(); |
||||
billInfo.setBuyerAccount(bankNo); |
||||
billInfo.setBuyerBank(raw.replace(bankNo, "")); |
||||
} |
||||
} |
||||
// 处理销方信息
|
||||
if (StringUtils.isEmpty(billInfo.getSellerBank()) && StringUtils.isNotEmpty(billInfo.getSellerAccount())) { |
||||
String bankNo = IdcardUtils.getBankNo(billInfo.getSellerAccount()); |
||||
if (StringUtils.isNotEmpty(bankNo)) { |
||||
String raw = billInfo.getSellerAccount(); |
||||
billInfo.setSellerAccount(bankNo); |
||||
billInfo.setSellerBank(raw.replace(bankNo, "")); |
||||
} |
||||
} |
||||
|
||||
json = (JSONObject) JSONObject.toJSON(billInfo); |
||||
} |
||||
|
||||
// 如果是redinfo
|
||||
if (StringUtils.equals(serviceKey, "add_redinfo")) { |
||||
// 开始把航信报文转成billInfo
|
||||
HxRedInfoDTO hxBillInfo = json.toJavaObject(HxRedInfoDTO.class); |
||||
Redinfo billInfo = new Redinfo(); |
||||
BeanUtils.copyProperties(hxBillInfo, billInfo); |
||||
|
||||
|
||||
// 处理detail
|
||||
List<HxRedInfoDetailsDTO> hxBillDetailList = hxBillInfo.getRedinfodetailList(); |
||||
List<Redinfodetail> detailList = new ArrayList<>(); |
||||
for (int i = 0; i < hxBillDetailList.size(); i++) { |
||||
HxRedInfoDetailsDTO detial = hxBillDetailList.get(i); |
||||
Redinfodetail temp = new Redinfodetail(); |
||||
BeanUtils.copyProperties(detial, temp); |
||||
temp.setIndex(i); |
||||
detailList.add(temp); |
||||
} |
||||
billInfo.setRedinfodetailList(detailList); |
||||
json = (JSONObject) JSONObject.toJSON(billInfo); |
||||
} |
||||
|
||||
// 如果是发票作废
|
||||
if (StringUtils.equals(serviceKey, "deprecate")) { |
||||
return json; |
||||
} |
||||
|
||||
// 如果是红字信息表下载
|
||||
if (StringUtils.equals(serviceKey, "download_redinfo")) { |
||||
DownloadRedInfoDTO downloadRedInfoDTO = json.toJavaObject(DownloadRedInfoDTO.class); |
||||
json = (JSONObject) JSONObject.toJSON(downloadRedInfoDTO); |
||||
return json; |
||||
} |
||||
|
||||
// 如果是发票打印
|
||||
if (StringUtils.equals(serviceKey, "batch_print")) { |
||||
// JSONArray detail = json.getJSONArray("dyfpxx");
|
||||
// for (int i = 0; i < detail.size(); i++) {
|
||||
// JSONObject temp = (JSONObject) detail.get(i);
|
||||
// String fplxdm = ElephantUtils.transElephantType(temp.getString("fpzldm"), 1);
|
||||
// temp.put("fpzldm", fplxdm);
|
||||
// detail.set(i, temp);
|
||||
// }
|
||||
return json; |
||||
} |
||||
|
||||
} catch (JianshuiParamErrorException e) { |
||||
throw e; |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
throw new JianshuiParamErrorException(ErrorCode.DECRYPT_ERROR, companyservice, "invoice"); |
||||
} |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
public String covertMethodName(String method) { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,246 @@ |
||||
package com.jianshui.invoice.service.impl.adapter.response; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.jianshui.common.core.domain.AjaxResult; |
||||
import com.jianshui.common.core.domain.entity.Companyservice; |
||||
import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; |
||||
import com.jianshui.common.utils.DictUtils; |
||||
import com.jianshui.common.utils.StringUtils; |
||||
import com.jianshui.common.utils.bean.BeanUtils; |
||||
import com.jianshui.invoice.domain.BillInfo; |
||||
import com.jianshui.invoice.domain.Invoice; |
||||
import com.jianshui.invoice.domain.InvoiceDetail; |
||||
import com.jianshui.invoice.domain.Redinfo; |
||||
import com.jianshui.invoice.domain.dto.HXResponse; |
||||
import com.jianshui.invoice.domain.dto.adapter.response.aisino_jn.AisinoJnInvoiceDetailResponse; |
||||
import com.jianshui.invoice.domain.dto.adapter.response.aisino_jn.AisinoJnInvoiceResponse; |
||||
import com.jianshui.invoice.service.IInvoiceResponseService; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description 航信出口报文适配器 |
||||
* @Author 巩权林 |
||||
* @Date 2022/3/19 21:28 |
||||
**/ |
||||
@Component("jn_jcsk_invoice_response_adapter") |
||||
public class JcskInvoiceResponseAdapterImpl implements IInvoiceResponseService { |
||||
|
||||
@Override |
||||
public JSONObject response(HXResponse result, Companyservice companyservice, String query) { |
||||
|
||||
// 如果是开具
|
||||
if (StringUtils.equals("add", query)) { |
||||
return result; |
||||
} |
||||
|
||||
// 如果是发票查询
|
||||
if (StringUtils.equals("query", query)) { |
||||
// 判断有无data
|
||||
Object datas = result.getData(); |
||||
|
||||
// 如果datas不为Null
|
||||
if (datas != null) { |
||||
// 如果返回将诶过为invioce
|
||||
List<AisinoJnInvoiceResponse> responses = new ArrayList<>(); |
||||
if (datas instanceof List) { |
||||
for (int ij = 0; ij < ((List<?>) datas).size(); ij++) { |
||||
Object data = ((List<?>) datas).get(ij); |
||||
// 转为HxInvoice
|
||||
Invoice invoice = (Invoice) data; |
||||
if (invoice == null) { |
||||
continue; |
||||
} |
||||
AisinoJnInvoiceResponse invoiceResponse = new AisinoJnInvoiceResponse(); |
||||
BeanUtils.copyProperties(invoice, invoiceResponse); |
||||
String invoiceType = DictUtils.getDictLabel("invoice_type", invoice.getInvoiceType()); |
||||
if (invoiceType != null) { |
||||
invoiceResponse.setInvoiceType(invoiceType); |
||||
} |
||||
|
||||
// 处理发票状态
|
||||
|
||||
// 处理Detail
|
||||
List<InvoiceDetail> detailList = invoice.getInvoiceDetailList(); |
||||
if (detailList != null) { |
||||
List<AisinoJnInvoiceDetailResponse> invoiceDetailResponses = new ArrayList<>(); |
||||
for (int i = 0; i < detailList.size(); i++) { |
||||
AisinoJnInvoiceDetailResponse response = new AisinoJnInvoiceDetailResponse(); |
||||
InvoiceDetail tempDetail = detailList.get(i); |
||||
BeanUtils.copyProperties(tempDetail, response); |
||||
Integer hsbz = tempDetail.getHsbz(); |
||||
if (hsbz == 0) { |
||||
response.setHsbz("false"); |
||||
response.setTaxamt(null); |
||||
// 如果不含税
|
||||
} else { |
||||
// 如果含税
|
||||
response.setHsbz("true"); |
||||
response.setTaxfreeamt(response.getTaxamt()); |
||||
} |
||||
invoiceDetailResponses.add(response); |
||||
} |
||||
invoiceResponse.setInvoiceDetailList(invoiceDetailResponses); |
||||
} |
||||
responses.add(invoiceResponse); |
||||
} |
||||
|
||||
JSONObject queryResult = new JSONObject(); |
||||
queryResult.put("result", result.getMessage()); |
||||
queryResult.put("list", responses); |
||||
return queryResult; |
||||
} |
||||
|
||||
} |
||||
JSONObject queryResult = new JSONObject(); |
||||
queryResult.put("result", result.getMessage()); |
||||
queryResult.put("list", new ArrayList<>()); |
||||
} |
||||
|
||||
// 如果是开具红票
|
||||
if (StringUtils.equals("add_redinfo", query)) { |
||||
return result; |
||||
} |
||||
|
||||
// 如果是下载红票
|
||||
if (StringUtils.equals("download_redinfo", query)) { |
||||
|
||||
Object datas = result.getData(); |
||||
|
||||
// 如果datas不为Null
|
||||
if (datas != null) { |
||||
// 如果返回将诶过为invioce
|
||||
// List<AisinoJnInvoiceResponse> responses = new ArrayList<>();
|
||||
// if (datas instanceof List) {
|
||||
// }
|
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
// 如果是打印
|
||||
if (StringUtils.equals("printer", query)) { |
||||
|
||||
Object datas = result.getData(); |
||||
|
||||
// 如果datas不为Null
|
||||
if (datas != null) { |
||||
// 如果返回将诶过为invioce
|
||||
// List<AisinoJnInvoiceResponse> responses = new ArrayList<>();
|
||||
// if (datas instanceof List) {
|
||||
// }
|
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
// 作废查询
|
||||
if (StringUtils.equals("deprecate_query", query)) { |
||||
Object datas = result.getData(); |
||||
if (datas != null) { |
||||
JSONObject dataJson = (JSONObject) datas; |
||||
// String status = dataJson.getString("status");
|
||||
JSONObject result2 = new JSONObject(); |
||||
result2.put("message", "操作完成"); |
||||
result2.put("status", "0000"); |
||||
result2.put("data", dataJson); |
||||
// if (StringUtils.equals(status, "3")) {
|
||||
// result2.put("code", "0000");
|
||||
// result2.put("msg", "作废成功");
|
||||
// } else if (StringUtils.equals(status, "1")) {
|
||||
// result2.put("code", "9998");
|
||||
// result2.put("msg", "作废中");
|
||||
// } else {
|
||||
// result2.put("code", "9998");
|
||||
// result2.put("msg", "作废失败");
|
||||
// }
|
||||
return result2; |
||||
} |
||||
} |
||||
|
||||
if (StringUtils.equals("sign_e_seal", query)) { |
||||
AjaxResult resp = AjaxResult.success(); |
||||
Object data = result.getData(); |
||||
if (!StringUtils.equals("0000", result.getStatus())) { |
||||
resp = AjaxResult.error(result.getMessage()); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
JSONObject dataJson = (JSONObject) data; |
||||
if (StringUtils.equals("0000", dataJson.getString("CODE"))) { |
||||
// result.put("code", "200");
|
||||
// result.put("data", dataJson.getJSONObject("data"));
|
||||
resp.put("data", dataJson.getJSONObject("DATA")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
}else{ |
||||
// result.put("code", dataJson.getString("CODE"));
|
||||
// result.put("message", dataJson.getJSONObject("MESSAGE"));
|
||||
resp.put("code", dataJson.getString("CODE")); |
||||
resp.put("message", dataJson.getString("MESSAGE")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
} |
||||
if (StringUtils.equals("register_e_seal", query)) { |
||||
AjaxResult resp = AjaxResult.success(); |
||||
Object data = result.getData(); |
||||
if (!StringUtils.equals("0000", result.getStatus())) { |
||||
resp = AjaxResult.error(result.getMessage()); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
JSONObject dataJson = (JSONObject) data; |
||||
if (StringUtils.equals("0000", dataJson.getString("CODE"))) { |
||||
// result.put("code", "200");
|
||||
// result.put("data", dataJson.getJSONObject("data"));
|
||||
resp.put("data", dataJson.getJSONObject("DATA")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
}else{ |
||||
// result.put("code", dataJson.getString("CODE"));
|
||||
// result.put("message", dataJson.getJSONObject("MESSAGE"));
|
||||
resp.put("code", dataJson.getString("CODE")); |
||||
resp.put("message", dataJson.getString("MESSAGE")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
} |
||||
if (StringUtils.equals("create_e_seal", query)) { |
||||
AjaxResult resp = AjaxResult.success(); |
||||
Object data = result.getData(); |
||||
if (!StringUtils.equals("0000", result.getStatus())) { |
||||
resp = AjaxResult.error(result.getMessage()); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
JSONObject dataJson = (JSONObject) data; |
||||
if (StringUtils.equals("0000", dataJson.getString("CODE"))) { |
||||
// result.put("code", "200");
|
||||
// result.put("data", dataJson.getJSONObject("data"));
|
||||
resp.put("data", dataJson.getJSONObject("DATA")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
}else{ |
||||
// result.put("code", dataJson.getString("CODE"));
|
||||
// result.put("message", dataJson.getJSONObject("MESSAGE"));
|
||||
resp.put("code", dataJson.getString("CODE")); |
||||
resp.put("message", dataJson.getString("MESSAGE")); |
||||
return JSONObject.parseObject(JSONObject.toJSONString(resp)); |
||||
} |
||||
} |
||||
|
||||
|
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Object response(JianshuiParamErrorException result, Companyservice companyservice) { |
||||
// JSONObject myResult = new JSONObject();
|
||||
// myResult.put("status", result.getErrorCode());
|
||||
// myResult.put("message", result.getMsg());
|
||||
// return myResult;
|
||||
AjaxResult resp = AjaxResult.error(result.getErrorCode(), null); |
||||
resp.put("msg", result.getMsg()); |
||||
return resp; |
||||
} |
||||
|
||||
@Override |
||||
public AjaxResult callback(BillInfo billInfo, Invoice invoice, Redinfo redinfo, Companyservice companyservice, String src) { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,716 @@ |
||||
package com.jianshui.invoice.service.impl.api; |
||||
|
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import cn.hutool.core.convert.Convert; |
||||
import cn.hutool.core.util.StrUtil; |
||||
import cn.hutool.json.JSONUtil; |
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.jianshui.common.core.domain.AjaxResult; |
||||
import com.jianshui.common.core.domain.entity.Companyservice; |
||||
import com.jianshui.common.enums.ErrorCode; |
||||
import com.jianshui.common.exception.jianshui.JianshuiParamErrorException; |
||||
import com.jianshui.common.exception.jianshui.JianshuiServiceException; |
||||
import com.jianshui.common.utils.BeanToMapUtils; |
||||
import com.jianshui.common.utils.StringUtils; |
||||
import com.jianshui.common.utils.TimeUtil; |
||||
import com.jianshui.common.utils.ValidateUtils; |
||||
import com.jianshui.common.utils.uuid.IdUtils; |
||||
import com.jianshui.invoice.constant.aisino.console.AisinoConsoleConstants; |
||||
import com.jianshui.invoice.domain.*; |
||||
import com.jianshui.invoice.domain.dto.*; |
||||
import com.jianshui.invoice.domain.dto.api.aisino.console.*; |
||||
import com.jianshui.invoice.domain.vo.api.aisino.console.AisinoConsoleInvoiceAddVO; |
||||
import com.jianshui.invoice.mapper.BillInfoMapper; |
||||
import com.jianshui.invoice.mapper.InvoiceMapper; |
||||
import com.jianshui.invoice.mapper.RedinfoMapper; |
||||
import com.jianshui.invoice.mapper.SkDyjMapper; |
||||
import com.jianshui.invoice.service.IInvoiceApiService; |
||||
import com.jianshui.invoice.utils.BillInfoUtils; |
||||
import com.jianshui.invoice.utils.aisino.console.AisinoConsoleUtil; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.util.CollectionUtils; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
|
||||
/** |
||||
* 金财数科 |
||||
*/ |
||||
@Component("jcsk_invoice") |
||||
@Slf4j |
||||
public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
||||
|
||||
@Autowired |
||||
private BillInfoMapper billInfoMapper; |
||||
@Autowired |
||||
private InvoiceMapper invoiceMapper; |
||||
|
||||
@Autowired |
||||
private SkDyjMapper skDyjMapper; |
||||
|
||||
@Autowired |
||||
private RedinfoMapper redinfoMapper; |
||||
|
||||
|
||||
/** |
||||
* 1.发票开具 SID = 1 |
||||
* |
||||
* @param billInfo |
||||
* @param companyservice |
||||
* @return com.jianshui.invoice.domain.dto.HXResponse |
||||
* @author dxk |
||||
* @date 2022/6/27 16:50 |
||||
*/ |
||||
@Override |
||||
public HXResponse addInvoice(BillInfo billInfo, Companyservice companyservice) throws IllegalAccessException, InstantiationException { |
||||
|
||||
// 预处理:处理billinfo,计算税额等
|
||||
try { |
||||
billInfo = BillInfoUtils.processBillInfo(billInfo, companyservice); |
||||
} catch (JianshuiParamErrorException e) { |
||||
return new HXResponse(e.getMessage()); |
||||
} catch (Exception e) { |
||||
log.error("【销项】【总部控制台发票】开票接口校验异常", e); |
||||
return new HXResponse("格式校验失败,请检查报文!"); |
||||
} |
||||
|
||||
// 发票类型处理 必填
|
||||
Integer invoceTypeTemp = CovertInvoiceType(billInfo.getInvoiceType()); |
||||
if (invoceTypeTemp == -1) { |
||||
return new HXResponse("发票类型不存在!"); |
||||
} |
||||
|
||||
billInfo.setInvoiceType(String.valueOf(invoceTypeTemp)); |
||||
|
||||
// 转换报文为总部控制台请求报文
|
||||
AisinoConsoleInvoiceAddDTO aisinoConsoleInvoiceAddDTO = BeanUtil.copyProperties(billInfo, AisinoConsoleInvoiceAddDTO.class); |
||||
|
||||
List<BillDetail> billDetailList = billInfo.getBillDetailList(); |
||||
if (CollectionUtils.isEmpty(billDetailList)) { |
||||
return new HXResponse("发票明细不存在,请检查报文!"); |
||||
} |
||||
|
||||
aisinoConsoleInvoiceAddDTO.setInvoiceType(invoceTypeTemp); |
||||
|
||||
//购方地址电话
|
||||
String buyerAddress = billInfo.getBuyerAddress(); |
||||
String buyerTelPhone = billInfo.getBuyerTelephone(); |
||||
aisinoConsoleInvoiceAddDTO.setCustomerAddressTel(buyerAddress + buyerTelPhone); |
||||
|
||||
//购方银行账户
|
||||
String buyerBank = billInfo.getBuyerBank(); |
||||
String buyerAccount = billInfo.getBuyerAccount(); |
||||
aisinoConsoleInvoiceAddDTO.setCustomerBankAccountNr(buyerBank + buyerAccount); |
||||
|
||||
//销方银行账户
|
||||
String sellerBank = billInfo.getSellerBank(); |
||||
String sellerAccount = billInfo.getSellerAccount(); |
||||
if (StrUtil.isEmpty(sellerBank) || StrUtil.isEmpty(sellerAccount)) { |
||||
return new HXResponse("销方银行账户不存在!"); |
||||
} |
||||
aisinoConsoleInvoiceAddDTO.setSellerBankAccountNr(sellerBank + sellerAccount); |
||||
|
||||
// 销方地址电话
|
||||
// 2022/12/21 中举说浪潮的地址和电话都放到 sellerAddress字段里了
|
||||
/*String sellerAddress = billInfo.getSellerAddress(); |
||||
String sellerTelephone = billInfo.getSellerTelephone(); |
||||
if (StrUtil.isEmpty(sellerAddress) || StrUtil.isEmpty(sellerTelephone)) { |
||||
return new HXResponse("销方地址电话不存在!"); |
||||
} |
||||
aisinoConsoleInvoiceAddDTO.setSellerAddressTel(sellerAddress + sellerTelephone);*/ |
||||
String sellerAddress = billInfo.getSellerAddress(); |
||||
if (StrUtil.isEmpty(sellerAddress)) { |
||||
return new HXResponse("销方地址电话不存在!"); |
||||
} |
||||
aisinoConsoleInvoiceAddDTO.setSellerAddressTel(sellerAddress); |
||||
|
||||
//清单标志
|
||||
String qdbz = billInfo.getQdbz(); |
||||
if (StrUtil.isEmpty(qdbz)) { |
||||
return new HXResponse("清单标志不存在!"); |
||||
} |
||||
boolean qdbzTemp = qdbz.equals("1") ? true : false; |
||||
aisinoConsoleInvoiceAddDTO.setListed(qdbzTemp); |
||||
|
||||
// 销售单号 非必填
|
||||
//aisinoConsoleInvoiceAddDTO.setDocumentNr("");
|
||||
// 开票校验标识 问了下主任这里默认塞 0 标识开票
|
||||
aisinoConsoleInvoiceAddDTO.setCheckEWM(0); |
||||
|
||||
//税额
|
||||
BigDecimal tax = billInfo.getTax(); |
||||
aisinoConsoleInvoiceAddDTO.setTax(Convert.toDouble(tax)); |
||||
|
||||
//数量 非必填
|
||||
//aisinoConsoleInvoiceAddDTO.setQuantity(0.0D);
|
||||
|
||||
//专票必填
|
||||
if (invoceTypeTemp == 0) { |
||||
if (StrUtil.isEmpty(aisinoConsoleInvoiceAddDTO.getCustomerTaxNr())) { |
||||
return new HXResponse("购方税号不存在,专票!"); |
||||
} |
||||
if (StrUtil.isEmpty(aisinoConsoleInvoiceAddDTO.getCustomerAddressTel())) { |
||||
return new HXResponse("购方地址电话不存在,专票!"); |
||||
} |
||||
if (StrUtil.isEmpty(aisinoConsoleInvoiceAddDTO.getCustomerBankAccountNr())) { |
||||
return new HXResponse("购方银行账户不存在,专票!"); |
||||
} |
||||
} |
||||
|
||||
//处理备注
|
||||
String kpType = billInfo.getKptype() == null ? "":billInfo.getKptype() ; |
||||
String redInvoiceCode = billInfo.getRedInvoiceInfoCode() == null ? "":billInfo.getRedInvoiceInfoCode(); |
||||
if("2".equals(kpType) && invoceTypeTemp == 0){ |
||||
//专票:红字信息表编号 开具红字发票:备注中注明“开具红字增值税专用发票信息表编号 XXXXXXXXXXXXXXXX”
|
||||
aisinoConsoleInvoiceAddDTO.setMemo("开具红字增值税专用发票信息表编号"+redInvoiceCode); |
||||
}else if("2".equals(kpType) && invoceTypeTemp == 2){ |
||||
//普票:开具负数发票(普通发票负数发票):备注中注明“对应正数发票代码 XXXXXXXXXX 号 码 YYYYYYYY”字样,其中“X”为发票左上角 10 或是 12 位代码数字,“Y”为发票右上角 8位号码数字
|
||||
aisinoConsoleInvoiceAddDTO.setMemo("对应正数发票代码"+billInfo.getOriginFpdm()+"号码"+billInfo.getOriginFphm()); |
||||
} |
||||
|
||||
//明细处理前条件校验
|
||||
ValidateUtils.validate(aisinoConsoleInvoiceAddDTO, companyservice, null); |
||||
|
||||
//发票明细处理
|
||||
List<AisinoConsoleInvoiceAddDetailDTO> invoiceItems = new ArrayList<>(); |
||||
List<Map<String,Object>> listMap = new ArrayList<>(); |
||||
for (BillDetail billDetail : billDetailList) { |
||||
AisinoConsoleInvoiceAddDetailDTO addDetailDTO = BeanUtil.copyProperties(billDetail, AisinoConsoleInvoiceAddDetailDTO.class); |
||||
|
||||
//通过含税标志,区分含税单价不含税单价
|
||||
Integer hsbz = billDetail.getHsbz(); |
||||
if (hsbz == null) { |
||||
return new HXResponse("含税标志不存在!"); |
||||
} |
||||
addDetailDTO.setIncludeTax(hsbz == 1 ? true : false); |
||||
//税率
|
||||
addDetailDTO.setTaxRate(Convert.toDouble(billDetail.getTaxrate())); |
||||
//金额
|
||||
Double je = 0D; |
||||
if (hsbz == 1) { |
||||
je = Convert.toDouble(billDetail.getTaxamt()); |
||||
} else if (hsbz == 0) { |
||||
je = Convert.toDouble(billDetail.getTaxfreeamt()); |
||||
} else { |
||||
return new HXResponse("金额不存在!"); |
||||
} |
||||
addDetailDTO.setValue(je); |
||||
//单价
|
||||
addDetailDTO.setPrice(Convert.toDouble(billDetail.getPrice())); |
||||
|
||||
//是否享受优惠政策
|
||||
Integer yhzcbs = billDetail.getYhzcbs(); |
||||
if (yhzcbs == null) { |
||||
return new HXResponse("优惠政策标识不存在!"); |
||||
} |
||||
addDetailDTO.setTaxPre(String.valueOf(yhzcbs)); |
||||
//享受优惠政策内容 非必填
|
||||
//addDetailDTO.setTaxPreCon("");
|
||||
//企业自编码 非必填
|
||||
//addDetailDTO.setCropGoodsNo("");
|
||||
|
||||
ValidateUtils.validate(addDetailDTO, companyservice, null); |
||||
invoiceItems.add(addDetailDTO); |
||||
Map<String,Object> mapDetail = BeanToMapUtils.fastJsonBean2Map(addDetailDTO); |
||||
listMap.add(mapDetail); |
||||
} |
||||
aisinoConsoleInvoiceAddDTO.setInvoiceItems(invoiceItems); |
||||
|
||||
// 发起请求
|
||||
AjaxResult ajaxResult = null; |
||||
try { |
||||
//hutool的beancopy别名会与JSONUTIl冲突
|
||||
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(aisinoConsoleInvoiceAddDTO); |
||||
map.put("invoiceItems",listMap); |
||||
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.INVOICE_ADD, JSONUtil.parse(map), companyservice); |
||||
} catch (Exception e) { |
||||
log.error("【销项发票】【总部控制台接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(aisinoConsoleInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); |
||||
e.printStackTrace(); |
||||
throw new JianshuiServiceException("系统异常!"); |
||||
} |
||||
log.info("【销项发票】【总部控制台发票】发票开具请求拉取结果{}", ajaxResult.toString()); |
||||
|
||||
//返回报文解析
|
||||
if (ajaxResult.isError()) { |
||||
throw new JianshuiServiceException(ajaxResult.getMsg()); |
||||
} |
||||
|
||||
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); |
||||
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; |
||||
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
||||
if ("4011".equals(retcode)) { |
||||
//回写发票代码、发票号码信息
|
||||
if(StrUtil.isEmpty(retmsg)){ |
||||
return new HXResponse(retcode); |
||||
} |
||||
AisinoConsoleInvoiceAddVO aisinoConsoleInvoiceAddVO = BeanUtil.copyProperties(resultJSON, AisinoConsoleInvoiceAddVO.class); |
||||
if(StrUtil.isEmpty(aisinoConsoleInvoiceAddVO.getInfoNumber())){ |
||||
throw new JianshuiServiceException("开具的发票号码不存在!"); |
||||
} |
||||
//更新发票状态
|
||||
billInfo.setState(2); |
||||
billInfoMapper.updateBillInfo(billInfo); |
||||
|
||||
//插入invoice
|
||||
Invoice invoice = BeanUtil.copyProperties(billInfo,Invoice.class); |
||||
List<InvoiceDetail> invoiceDetailList = BeanUtil.copyToList(billInfo.getBillDetailList(),InvoiceDetail.class); |
||||
invoice.setInvoiceDetailList(invoiceDetailList); |
||||
|
||||
//发票代码
|
||||
invoice.setFpdm(aisinoConsoleInvoiceAddVO.getInfoTypeCode()); |
||||
//发票号码
|
||||
invoice.setFphm(aisinoConsoleInvoiceAddVO.getInfoNumber()); |
||||
//上一张发票代码
|
||||
invoice.setOriginFpdm(aisinoConsoleInvoiceAddVO.getHisInfoTypeCode()); |
||||
//上一张发票号码
|
||||
invoice.setOriginFphm(aisinoConsoleInvoiceAddVO.getHisInfoNumber()); |
||||
//上一张发票种类
|
||||
String hisInvoceTypeTemp = CovertInvoiceTypeReverse(aisinoConsoleInvoiceAddVO.getHisInfoKind()); |
||||
invoice.setInvoiceType(hisInvoceTypeTemp); |
||||
invoice.setBillInfoId(billInfo.getId()); |
||||
|
||||
long id = 0L; |
||||
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
||||
invoiceQueryWrapper.eq("fpdm",invoice.getFpdm()).eq("fphm",invoice.getFphm()); |
||||
List<Invoice> invoices = invoiceMapper.selectList(invoiceQueryWrapper); |
||||
if(CollectionUtils.isEmpty(invoices)){ |
||||
invoiceMapper.insertInvoice(invoice); |
||||
invoices = invoiceMapper.selectList(invoiceQueryWrapper); |
||||
id = invoices.get(0).getId(); |
||||
}else{ |
||||
Invoice invoiceT = invoices.get(0); |
||||
invoiceT = BeanUtil.copyProperties(invoice,Invoice.class); |
||||
invoiceMapper.updateInvoice(invoiceT); |
||||
id = invoiceT.getId(); |
||||
} |
||||
invoiceDetailList.forEach(i -> i.setInvoiceId(invoice.getId())); |
||||
invoiceMapper.batchInvoiceDetail(invoiceDetailList); |
||||
|
||||
HXResponse response = new HXResponse("0000", "同步成功"); |
||||
response.put("fpqqlsh", billInfo.getSystemOrderno()); |
||||
return response; |
||||
} else { |
||||
return new HXResponse(retmsg); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 发票打印 |
||||
* @author dxk |
||||
* @date 2022/6/29 13:48 |
||||
* @param invoice |
||||
* @param companyservice |
||||
* @return com.jianshui.common.core.domain.AjaxResult |
||||
*/ |
||||
@Override |
||||
public AjaxResult printInvoice(Invoice invoice, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 发票作废 |
||||
* @author dxk |
||||
* @date 2022/6/30 9:43 |
||||
* @param invoice |
||||
* @param companyservice |
||||
* @return com.jianshui.invoice.domain.dto.HXResponse |
||||
*/ |
||||
@Override |
||||
public HXResponse deprecateInvoice(JSONObject invoice, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public AjaxResult reInvoice(BillInfo billInfo, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 单个发票查询 |
||||
* @param billInfo |
||||
* @param companyservice |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public HXResponse queryInvoice(QueryBillInfoDTO billInfo, Companyservice companyservice) {return null;} |
||||
|
||||
/** |
||||
* 发票批量查询 |
||||
* @param billInfo |
||||
* @param byWhat |
||||
* @param companyservice |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public HXResponse batchQueryInvoices(BillInfo billInfo, String byWhat, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HXResponse scopeQueryInvoices(JSONObject queryJson, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
/** 红字信息表上传*/ |
||||
@Override |
||||
public HXResponse uploadRedInfo(Redinfo redinfo, Companyservice companyservice) { |
||||
|
||||
// 前置处理
|
||||
redinfo.setCompanyId(companyservice.getCompanyid()); |
||||
redinfo.setSystemOrderno(IdUtils.randomSystemOrderno()); |
||||
if (StringUtils.isEmpty(redinfo.getOutTradeOrderno())) { |
||||
// 把 outTradeOrderno作为用户的申请单号
|
||||
throw new JianshuiParamErrorException(ErrorCode.EMPTY_REDINFO_NO, companyservice, "invoice"); |
||||
} |
||||
redinfo.setOutTradeOrderno(redinfo.getOutTradeOrderno()); |
||||
redinfo.setFpqqlsh(redinfo.getSystemOrderno()); |
||||
redinfo.setRedInfoStatus("0"); |
||||
redinfo.setSellerName(companyservice.getSellername()); |
||||
redinfo.setSellerTaxnum(companyservice.getSellertax()); |
||||
redinfo.setBillInputTime(TimeUtil.dateFormat(new Date(), "yyyyMMddHHmmss")); |
||||
List<Redinfodetail> redinfodetailList = redinfo.getRedinfodetailList(); |
||||
BigDecimal taxfreeamt = new BigDecimal(0); // 不含税金额
|
||||
BigDecimal tax = new BigDecimal(0); // 税额
|
||||
for (Redinfodetail detail : redinfodetailList) { |
||||
taxfreeamt = taxfreeamt.add(detail.getTaxfreeamt()); |
||||
tax = tax.add(detail.getTax()); |
||||
} |
||||
redinfo.setTax(tax); |
||||
redinfo.setTaxfreeamt(taxfreeamt); |
||||
redinfo.setTaxamt(tax.add(taxfreeamt)); |
||||
redinfoMapper.insertRedinfo(redinfo); |
||||
int index = 0; |
||||
|
||||
String spbm = ""; |
||||
|
||||
for (Redinfodetail detail : redinfodetailList) { |
||||
detail.setBillno(redinfo.getRedInfoNo()); |
||||
detail.setRedinfoId(redinfo.getId()); |
||||
detail.setIndex(++index); |
||||
detail.setBillno(redinfo.getRedInfoNo()); |
||||
taxfreeamt = taxfreeamt.add(detail.getTaxfreeamt()); |
||||
tax = tax.add(detail.getTax()); |
||||
|
||||
// 商品编码
|
||||
spbm = detail.getSpbm(); |
||||
} |
||||
|
||||
// TODO: 2023/3/9 设备号是 jspbh 并非billNO? 申请方税号reqnsrsbh
|
||||
//
|
||||
redinfo.setJspbh("661024643068230218103524".substring(0,12)); |
||||
redinfo.setReqnsrsbh("9113093067851155XY"); |
||||
redinfo.setFjh("123"); |
||||
redinfo.setMultTaxRate("0"); |
||||
redinfo.setBillInputTime("2022-11-11"); |
||||
redinfo.setBmbbh("2323232"); |
||||
redinfo.setTaxrate(new BigDecimal("0.03")); |
||||
//
|
||||
|
||||
redinfoMapper.batchRedinfodetail(redinfodetailList); |
||||
|
||||
// 参数校验及参数处理
|
||||
AisinoConsoleInvoiceRedUploadDTO redUploadDTO = BeanUtil.copyProperties(redinfo,AisinoConsoleInvoiceRedUploadDTO.class); |
||||
// 填开日期
|
||||
redUploadDTO.setDate(redinfo.getBillInputTime()); |
||||
// 信息表类型
|
||||
redUploadDTO.setBillType("0"); |
||||
// TODO-dxk: 2023/2/27 含税、不含税金额 含税标志,这里需要确定
|
||||
// 合计金额计算
|
||||
redUploadDTO.setAmount(String.valueOf(taxfreeamt)); |
||||
// 含税税率标识
|
||||
redUploadDTO.setSLBZ("0"); |
||||
// 税种类别
|
||||
redUploadDTO.setSzlb("1"); |
||||
ValidateUtils.validate(redUploadDTO); |
||||
|
||||
|
||||
|
||||
if(redinfo.getRedinfodetailList() == null || redinfo.getRedinfodetailList().size() == 0){ |
||||
return new HXResponse("格式校验失败,请上传明细信息!"); |
||||
} |
||||
|
||||
|
||||
String paramChild = ""; |
||||
List<AisinoConsoleInvoiceRedUploadChildDTO> redUploadChildDTO = BeanUtil.copyToList(redinfo.getRedinfodetailList(),AisinoConsoleInvoiceRedUploadChildDTO.class); |
||||
for (AisinoConsoleInvoiceRedUploadChildDTO childDTO : redUploadChildDTO) { |
||||
|
||||
// TODO-dxk: 2023/2/27 含税、不含税金额
|
||||
childDTO.setHS_BZ(childDTO.getHS_BZ().equals("false")? "N":"Y"); |
||||
|
||||
paramChild = "<GoodsMx>" + JSONUtil.toXmlStr(JSONUtil.parse(childDTO)) + " </GoodsMx>"; |
||||
|
||||
ValidateUtils.validate(childDTO); |
||||
} |
||||
|
||||
// 组装xml报文
|
||||
String param = JSONUtil.toXmlStr(JSONUtil.parse(redUploadDTO)); |
||||
|
||||
// param = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
|
||||
param = "" + |
||||
"<FPXT>\n" + |
||||
" <INPUT>\n" + |
||||
" <RedInvReqBill>" + param; |
||||
|
||||
param = param + "<RedInvReqBillMx>"; |
||||
|
||||
param = param + paramChild; |
||||
|
||||
param = param + " </RedInvReqBillMx>\n" + |
||||
" </RedInvReqBill>\n" + |
||||
" </INPUT>\n" + |
||||
"</FPXT>"; |
||||
|
||||
|
||||
//发起请求
|
||||
AjaxResult ajaxResult = null; |
||||
try{ |
||||
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.RED_UPLOAD, param, companyservice); |
||||
}catch (Exception e){ |
||||
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}","", JSONObject.toJSONString(companyservice)); |
||||
e.printStackTrace(); |
||||
throw new JianshuiServiceException("系统异常!"); |
||||
} |
||||
|
||||
//返回报文解析
|
||||
if (ajaxResult.isError()) { |
||||
throw new JianshuiServiceException(ajaxResult.getMsg()); |
||||
} |
||||
|
||||
// todo-k: 返回报文解析这里还带看下具体的返回形式
|
||||
|
||||
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); |
||||
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; |
||||
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
||||
|
||||
|
||||
if (!StringUtils.equals("0000", retcode)) { |
||||
redinfo.setRedInfoStatus("2"); |
||||
redinfo.setRedInfoMessage(retmsg); |
||||
redinfoMapper.updateRedinfo(redinfo); |
||||
return new HXResponse(retmsg); |
||||
} |
||||
|
||||
// TODO-dxk: 2023/2/27 看下 RedInfoStatus 0 1 2代表什么
|
||||
redinfo.setRedInfoStatus("1"); |
||||
redinfo.setRedInfoMessage(retmsg); |
||||
redinfoMapper.updateRedinfo(redinfo); |
||||
return new HXResponse(retmsg); |
||||
} |
||||
|
||||
@Override |
||||
public AjaxResult queryRedInfo(Redinfo redinfo, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
/** 红字信息表下载 */ |
||||
@Override |
||||
public HXResponse downloadRedInfo(DownloadRedInfoDTO downloadRedInfoDTO, Companyservice companyservice) { |
||||
|
||||
// 查找之前的红票
|
||||
Redinfo redinfo = new Redinfo(); |
||||
redinfo.setRedInfoNo(downloadRedInfoDTO.getBillInfoNo()); |
||||
redinfo.setCompanyId(companyservice.getCompanyid()); |
||||
QueryWrapper<Redinfo> queryWrapper = new QueryWrapper<>(); |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getInvoiceLine())) { |
||||
queryWrapper.eq("invoice_type", downloadRedInfoDTO.getInvoiceLine()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getBuyerTaxNo())) { |
||||
queryWrapper.eq("buyer_taxnum", downloadRedInfoDTO.getBuyerTaxNo()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getExtensionNumber())) { |
||||
queryWrapper.eq("fjh", downloadRedInfoDTO.getExtensionNumber()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getTerminalNumber())) { |
||||
queryWrapper.eq("terminal_number", downloadRedInfoDTO.getTerminalNumber()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getBillTimeBegin())) { |
||||
queryWrapper.ge("bill_input_time", downloadRedInfoDTO.getBillTimeBegin()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getBillTimeEnd())) { |
||||
queryWrapper.le("bill_input_time", downloadRedInfoDTO.getBillTimeEnd()); |
||||
} |
||||
if (StringUtils.isNotEmpty(downloadRedInfoDTO.getBillNo())) { |
||||
queryWrapper.le("out_trade_orderno", downloadRedInfoDTO.getBillNo()); |
||||
} |
||||
queryWrapper.orderByDesc("id"); |
||||
queryWrapper.last(" limit 1 "); |
||||
Redinfo redInfoResult = redinfoMapper.selectOne(queryWrapper); |
||||
if (redInfoResult == null) { |
||||
HXResponse response = new HXResponse("9999", "未查到指定红字信息"); |
||||
return response; |
||||
} |
||||
|
||||
// 组装报文
|
||||
AisinoConsoleInvoiceRedDownloadDTO downloadDTO = BeanUtil.copyProperties(redInfoResult,AisinoConsoleInvoiceRedDownloadDTO.class); |
||||
downloadDTO.setYQZT("N"); |
||||
downloadDTO.setXXBFW("0"); |
||||
downloadDTO.setPAGENO("1"); |
||||
downloadDTO.setPAGESIZE("1000"); |
||||
|
||||
String param = JSONUtil.toXmlStr(JSONUtil.parse(downloadDTO)); |
||||
param = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" + |
||||
"<FPXT>\n" + |
||||
" <INPUT>\n" + param + "</INPUT>\n" + |
||||
"</FPXT>"; |
||||
|
||||
//发起请求
|
||||
AjaxResult ajaxResult = null; |
||||
try{ |
||||
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.RED_DOWLOAD, param, companyservice); |
||||
}catch (Exception e){ |
||||
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}","", JSONObject.toJSONString(companyservice)); |
||||
e.printStackTrace(); |
||||
throw new JianshuiServiceException("系统异常!"); |
||||
} |
||||
|
||||
//返回报文解析
|
||||
if (ajaxResult.isError()) { |
||||
throw new JianshuiServiceException(ajaxResult.getMsg()); |
||||
} |
||||
|
||||
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); |
||||
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; |
||||
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
||||
|
||||
// todo-k: 下载的返回报文需要单独处理,更新信息表状态?
|
||||
// todo-k: 返回的格式看看怎么处理一把,VO都已经创建
|
||||
|
||||
if (!StringUtils.equals("0000", retcode)) { |
||||
|
||||
return new HXResponse(retmsg); |
||||
} |
||||
|
||||
|
||||
return null; |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public HXResponse deprecateQueryInvoice(DeprecateQueryInvoiceDTO invoice, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 打印机查询 |
||||
* @param queryPrinterDTO |
||||
* @param companyservice |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public HXResponse queryPrinter(QueryPrinterDTO queryPrinterDTO, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HXResponse pushData(BillInfo billInfo, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 发票打印 |
||||
* @param printDTO |
||||
* @param companyservice |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public HXResponse batchPrint(PrintDTO printDTO, Companyservice companyservice) { |
||||
|
||||
return null; |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public AjaxResult syncStockInfo(Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HXResponse signInvoice(SignESealDTO signESealDTO, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HXResponse createESeal(CreateESealDTO createESealDTO, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public HXResponse registerESeal(RegisterESealDTO createESealDTO, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public AjaxResult SummaryReport(SummaryReportQueryDTO summaryReportQueryDTO, Companyservice companyservice) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Object callback(HttpServletRequest request) { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 简税转换总部控制台发票类型 |
||||
* |
||||
* @param invoiceType |
||||
* @return java.lang.Integer |
||||
* @author dxk |
||||
* @date 2022/6/28 20:17 |
||||
*/ |
||||
public static Integer CovertInvoiceType(String invoiceType) { |
||||
|
||||
/** |
||||
* 发票种类 invoice_type( p电子增值税普通发票 c增值税普通发票 s 增值税专用发票 e 收购发票 f 收购发票 r增值税普通发票) |
||||
*/ |
||||
if (StrUtil.isEmpty(invoiceType)) { |
||||
return -1; |
||||
} |
||||
if ("p".equals(invoiceType) || "c".equals(invoiceType) || "e".equals(invoiceType) || "f".equals(invoiceType) || "r".equals(invoiceType)) { |
||||
return 2; |
||||
} else if ("s".equals(invoiceType)) { |
||||
return 0; |
||||
} |
||||
|
||||
return -1; |
||||
} |
||||
|
||||
/** |
||||
* 总部控制台转简税发票类型 |
||||
* @author dxk |
||||
* @date 2022/6/29 17:12 |
||||
* @param invoiceType |
||||
* @return java.lang.String |
||||
*/ |
||||
public static String CovertInvoiceTypeReverse(String invoiceType){ |
||||
|
||||
if(invoiceType.equals("2")){ |
||||
return "p"; |
||||
}else if(invoiceType.equals("0")){ |
||||
return "s"; |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Object addCallback(HttpServletRequest request) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public Object decryptCallback(HttpServletRequest request) { |
||||
return null; |
||||
} |
||||
} |
Reference in new issue