parent
95f0e1c708
commit
b2f6a6c49b
@ -0,0 +1,30 @@ |
||||
package com.jianshui.web.controller.platform; |
||||
|
||||
import com.jianshui.common.core.domain.AjaxResult; |
||||
import com.jianshui.platform.dto.RedInformationDTO; |
||||
import com.jianshui.platform.service.RedInformationService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 红字信息相关接口 |
||||
* @CreateTime: 2023-06-21 15:06 |
||||
* @Version: 1.0 |
||||
**/ |
||||
@Api(tags = "红字信息相关接口") |
||||
@RestController |
||||
@RequestMapping("/platForm/redInformation") |
||||
public class RedInformationController { |
||||
|
||||
@Autowired |
||||
private RedInformationService redInformationService; |
||||
|
||||
@ApiOperation("蓝字发票信息查询") |
||||
@PostMapping("/findBlueInvoice") |
||||
public AjaxResult findBlueInvoice(@RequestBody RedInformationDTO redInformationDTO){ |
||||
return redInformationService.findBlueInvoice(redInformationDTO); |
||||
} |
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.jianshui.platform.constant; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 异常信息常量类 |
||||
* @CreateTime: 2023-06-21 15:27 |
||||
* @Version: 1.0 |
||||
**/ |
||||
public class ExceptionInformationConstants { |
||||
// 发票代码为空
|
||||
public static final String FPDMISEMPTY = "发票代码不能为空"; |
||||
// 发票号码为空
|
||||
public static final String FPHMISEMPTY = "发票号码不能为空"; |
||||
// 开票日期为空
|
||||
public static final String KPRQISEMPTY = "开票时间不能为空"; |
||||
|
||||
// 未查询到发票信息
|
||||
public static final String NOTINVOICEINFORMATION = "本地未查询到对应的蓝字发票信息,点击确定继续录入单据"; |
||||
} |
@ -0,0 +1,14 @@ |
||||
package com.jianshui.platform.constant; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 红字信息常量类 |
||||
* @CreateTime: 2023-06-21 17:25 |
||||
* @Version: 1.0 |
||||
**/ |
||||
public class RedWordConstants { |
||||
// 销方类型
|
||||
public static final String XFTYPE = "0"; |
||||
// 购方类型(已抵扣)
|
||||
public static final String ISDEDUCTION = "1"; |
||||
} |
@ -0,0 +1,33 @@ |
||||
package com.jianshui.platform.dto; |
||||
|
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 红字信息填开类 |
||||
* @CreateTime: 2023-06-21 15:14 |
||||
* @Version: 1.0 |
||||
**/ |
||||
@Data |
||||
@ApiModel("红字信息填开类") |
||||
public class RedInformationDTO { |
||||
|
||||
@ApiModelProperty("发票类型") |
||||
private String fplx; |
||||
|
||||
@ApiModelProperty("申请类型 0-销方 1-购方已抵扣 2-购方未抵扣") |
||||
private String sqlx; |
||||
|
||||
@ApiModelProperty("发票代码") |
||||
private String fpdm; |
||||
|
||||
@ApiModelProperty("发票号码") |
||||
private String fphm; |
||||
|
||||
@ApiModelProperty("开票时间") |
||||
private String kprq; |
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.jianshui.platform.service; |
||||
|
||||
import com.jianshui.common.core.domain.AjaxResult; |
||||
import com.jianshui.platform.dto.RedInformationDTO; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 红字信息业务类 |
||||
* @CreateTime: 2023-06-21 15:20 |
||||
* @Version: 1.0 |
||||
**/ |
||||
public interface RedInformationService { |
||||
/** |
||||
* 功能描述: 获取蓝票信息 |
||||
* @param redInformationDTO |
||||
* @return : com.jianshui.common.core.domain.AjaxResult |
||||
*/ |
||||
AjaxResult findBlueInvoice(RedInformationDTO redInformationDTO); |
||||
} |
@ -0,0 +1,101 @@ |
||||
package com.jianshui.platform.service.impl; |
||||
|
||||
import com.jianshui.common.core.domain.AjaxResult; |
||||
import com.jianshui.common.core.domain.entity.Companyservice; |
||||
import com.jianshui.common.core.domain.entity.SysUser; |
||||
import com.jianshui.common.core.domain.model.LoginUser; |
||||
import com.jianshui.common.utils.SecurityUtils; |
||||
import com.jianshui.invoice.domain.Invoice; |
||||
import com.jianshui.invoice.domain.InvoiceDetail; |
||||
import com.jianshui.invoice.mapper.InvoiceMapper; |
||||
import com.jianshui.invoice.mapper.RedinfoMapper; |
||||
import com.jianshui.platform.constant.ExceptionInformationConstants; |
||||
import com.jianshui.platform.constant.RedWordConstants; |
||||
import com.jianshui.platform.dto.RedInformationDTO; |
||||
import com.jianshui.platform.service.RedInformationService; |
||||
import com.jianshui.platform.vo.BlueInvoiceVO; |
||||
import com.jianshui.system.mapper.CompanyserviceMapper; |
||||
import com.jianshui.system.mapper.SysUserMapper; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 红字信息业务类 |
||||
* @CreateTime: 2023-06-21 15:21 |
||||
* @Version: 1.0 |
||||
**/ |
||||
@Service |
||||
public class RedInformationServiceImpl implements RedInformationService { |
||||
|
||||
@Autowired |
||||
private InvoiceMapper invoiceMapper; |
||||
|
||||
@Autowired |
||||
private RedinfoMapper redinfoMapper; |
||||
|
||||
@Autowired |
||||
private SysUserMapper sysUserMapper; |
||||
|
||||
@Autowired |
||||
private CompanyserviceMapper companyserviceMapper; |
||||
|
||||
/** |
||||
* 功能描述: 蓝票信息获取 |
||||
* @param redInformationDTO |
||||
* @return : com.jianshui.common.core.domain.AjaxResult |
||||
*/ |
||||
@Override |
||||
public AjaxResult findBlueInvoice(RedInformationDTO redInformationDTO) { |
||||
//判空
|
||||
if (redInformationDTO.getFpdm().isEmpty()){ |
||||
return AjaxResult.error(ExceptionInformationConstants.FPDMISEMPTY); |
||||
} |
||||
if (redInformationDTO.getFphm().isEmpty()){ |
||||
return AjaxResult.error(ExceptionInformationConstants.FPHMISEMPTY); |
||||
} |
||||
if (redInformationDTO.getKprq().isEmpty()){ |
||||
return AjaxResult.error(ExceptionInformationConstants.KPRQISEMPTY); |
||||
} |
||||
//获取当前用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser(); |
||||
SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId()); |
||||
//根据用户信息获取企业信息
|
||||
Companyservice companyservice = companyserviceMapper.selectCompanyserviceByCompanyid(sysUser.getCompanyId()); |
||||
//销方类型
|
||||
if (RedWordConstants.XFTYPE.equals(redInformationDTO.getSqlx())){ |
||||
//查询蓝票信息
|
||||
Invoice invoice = invoiceMapper.selectByFpdmFphm(companyservice.getCompanyid(),redInformationDTO.getFpdm(), redInformationDTO.getFphm()); |
||||
int count = 0; |
||||
if (invoice != null){ |
||||
BlueInvoiceVO blueInvoiceVO = new BlueInvoiceVO(); |
||||
BeanUtils.copyProperties(invoice,blueInvoiceVO); |
||||
List<InvoiceDetail> invoiceDetailList = invoice.getInvoiceDetailList(); |
||||
for (InvoiceDetail invoiceDetail : invoiceDetailList) { |
||||
if (invoiceDetail != null){ |
||||
count++; |
||||
} |
||||
} |
||||
blueInvoiceVO.setDetailCount(count); |
||||
return AjaxResult.success(blueInvoiceVO); |
||||
} |
||||
return AjaxResult.error(ExceptionInformationConstants.NOTINVOICEINFORMATION); |
||||
}else if (RedWordConstants.ISDEDUCTION.equals(redInformationDTO.getSqlx())){ |
||||
//购方已抵扣
|
||||
BlueInvoiceVO blueInvoiceVO = new BlueInvoiceVO(); |
||||
blueInvoiceVO.setBuyerName(companyservice.getSellername()); |
||||
blueInvoiceVO.setBuyerTaxnum(companyservice.getSellertax()); |
||||
return AjaxResult.success(blueInvoiceVO); |
||||
}else { |
||||
//购方未抵扣
|
||||
BlueInvoiceVO blueInvoiceVO = new BlueInvoiceVO(); |
||||
BeanUtils.copyProperties(redInformationDTO,blueInvoiceVO); |
||||
blueInvoiceVO.setBuyerName(companyservice.getSellername()); |
||||
blueInvoiceVO.setBuyerTaxnum(companyservice.getSellertax()); |
||||
return AjaxResult.success(blueInvoiceVO); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,56 @@ |
||||
package com.jianshui.platform.vo; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import com.jianshui.common.annotation.Excel; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Author: kane |
||||
* @Description: 蓝票信息类 |
||||
* @CreateTime: 2023-06-21 15:59 |
||||
* @Version: 1.0 |
||||
**/ |
||||
@ApiModel("蓝票信息类") |
||||
@Data |
||||
public class BlueInvoiceVO { |
||||
|
||||
@ApiModelProperty("发票代码") |
||||
private String fpdm; |
||||
|
||||
@ApiModelProperty("发票号码") |
||||
private String fphm; |
||||
|
||||
@ApiModelProperty("购方名称") |
||||
private String buyerName; |
||||
|
||||
@ApiModelProperty("购方税号") |
||||
private String buyerTaxnum; |
||||
|
||||
@ApiModelProperty("购方地址") |
||||
private String buyerAddress; |
||||
|
||||
@ApiModelProperty("购买方银行") |
||||
private String buyerAccount; |
||||
|
||||
@ApiModelProperty("含税金额") |
||||
private BigDecimal taxamt; |
||||
|
||||
@ApiModelProperty("税额") |
||||
private BigDecimal tax; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
@ApiModelProperty("开票日期") |
||||
private Date kprq; |
||||
|
||||
@ApiModelProperty("开票人") |
||||
private String clerk; |
||||
@ApiModelProperty("作废类型") |
||||
private String deprecateType; |
||||
@ApiModelProperty("明细行数") |
||||
private Integer detailCount; |
||||
} |
Loading…
Reference in new issue