md
This commit is contained in:
parent
5e4c297557
commit
64ae4941db
@ -215,6 +215,39 @@ public class EmisSettleBillController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点确认账单
|
||||||
|
*/
|
||||||
|
@Log(title = "站点确认账单", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/confirmSettleBillBySite/{ids}")
|
||||||
|
public AjaxResult confirmSettleBillBySite(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
if(ids!=null && ids.length>0){
|
||||||
|
for(int i=0;i<ids.length;i++){
|
||||||
|
try {
|
||||||
|
long id=ids[i];
|
||||||
|
EmisSettleBill emisSettleBill = new EmisSettleBill();
|
||||||
|
emisSettleBill.setConfirmSiteManCode(getLoginUser().getUser().getEmpCode());
|
||||||
|
emisSettleBill.setConfirmSiteCode(getLoginUser().getUser().getOwnerSiteCode());
|
||||||
|
emisSettleBill.setBlConfirmSite("1");
|
||||||
|
emisSettleBill.setId(id);
|
||||||
|
emisSettleBillService.updateEmisSettleBill(emisSettleBill);
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
// 返回子定义异常
|
||||||
|
if(ex instanceof EmisBizError){
|
||||||
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.error("确认异常,联系客服");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("确认成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "导出账单", businessType = BusinessType.EXPORT)
|
@Log(title = "导出账单", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportBill")
|
@PostMapping("/exportBill")
|
||||||
public void exportBill(HttpServletResponse response, EmisSettleBill emisSettleBill)
|
public void exportBill(HttpServletResponse response, EmisSettleBill emisSettleBill)
|
||||||
@ -339,11 +372,28 @@ public class EmisSettleBillController extends BaseController
|
|||||||
* 删除结算总账单
|
* 删除结算总账单
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('emis:emisSettleBill:remove')")
|
@PreAuthorize("@ss.hasPermi('emis:emisSettleBill:remove')")
|
||||||
@Log(title = "结算总账单", businessType = BusinessType.DELETE)
|
@Log(title = "删除结算总账单", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(emisSettleBillService.deleteEmisSettleBillByIds(ids));
|
if(ids!=null && ids.length>0){
|
||||||
|
for(int i=0;i<ids.length;i++){
|
||||||
|
try {
|
||||||
|
long id=ids[i];
|
||||||
|
emisSettleBillService.deleteEmisSettleBillById(id);
|
||||||
|
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
// 返回子定义异常
|
||||||
|
if(ex instanceof EmisBizError){
|
||||||
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.error("确认异常,联系客服");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("确认成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,13 @@ package com.xdadan.erp.web.emis;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -29,7 +35,6 @@ import com.xdadan.erp.common.core.controller.BaseController;
|
|||||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||||
import com.xdadan.erp.common.core.page.TableDataInfo;
|
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||||
import com.xdadan.erp.common.enums.BusinessType;
|
import com.xdadan.erp.common.enums.BusinessType;
|
||||||
import com.xdadan.erp.common.utils.StringUtils;
|
|
||||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
||||||
@ -107,8 +112,23 @@ public class EmisSettlePayRecordController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody EmisSettlePayRecord emisSettlePayRecord)
|
public AjaxResult add(@RequestBody EmisSettlePayRecord emisSettlePayRecord)
|
||||||
{
|
{
|
||||||
// 生成支付流水号
|
try {
|
||||||
return toAjax(emisSettlePayRecordService.insertEmisSettlePayRecord(emisSettlePayRecord));
|
return toAjax(emisSettlePayRecordService.insertEmisSettlePayRecord(emisSettlePayRecord));
|
||||||
|
}
|
||||||
|
catch (DuplicateKeyException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return AjaxResult.error("支付流水号重复!");
|
||||||
|
}
|
||||||
|
catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
// 返回子定义异常
|
||||||
|
if(ex instanceof EmisBizError){
|
||||||
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.error("服务器异常,联系客服");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -40,9 +40,9 @@ public class EmisSettleInvoiceRecord extends BaseEntity
|
|||||||
/* 申请时间 */
|
/* 申请时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date applyDate;
|
private Date applyDate;
|
||||||
/* 审核人 */
|
/* 申请人 */
|
||||||
private String applyManCode;
|
private String applyManCode;
|
||||||
/* 审核站点 */
|
/* 申请站点 */
|
||||||
private String applySiteCode;
|
private String applySiteCode;
|
||||||
/* 客户编码 */
|
/* 客户编码 */
|
||||||
private String customerCode;
|
private String customerCode;
|
||||||
@ -115,4 +115,17 @@ public class EmisSettleInvoiceRecord extends BaseEntity
|
|||||||
/* 使用的开票企业代码 */
|
/* 使用的开票企业代码 */
|
||||||
private String openComCode;
|
private String openComCode;
|
||||||
|
|
||||||
|
// 扩展信息
|
||||||
|
/* 申请 */
|
||||||
|
private String applyManName;
|
||||||
|
private String applySiteName;
|
||||||
|
|
||||||
|
/* 审核 */
|
||||||
|
private String auditManName;
|
||||||
|
private String auditSiteName;
|
||||||
|
|
||||||
|
private String opManName;
|
||||||
|
private String opSiteName;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,10 @@ public interface EmisSettleInvoiceRecordMapper extends BaseMapper<EmisSettleInvo
|
|||||||
public List<EmisSettleInvoiceRecord> selectEmisSettleInvoiceRecordList(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
public List<EmisSettleInvoiceRecord> selectEmisSettleInvoiceRecordList(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
||||||
|
|
||||||
|
|
||||||
/**
|
public List<EmisSettleInvoiceRecord> selectInvoiceRecordListBySettleBillNo(String settleBillNo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
* 检查是否重复
|
* 检查是否重复
|
||||||
*
|
*
|
||||||
* @param emisSettleInvoiceRecord
|
* @param emisSettleInvoiceRecord
|
||||||
|
|||||||
@ -37,7 +37,10 @@ public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecor
|
|||||||
public List<EmisSettlePayRecord> selectEmisSettlePayRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
public List<EmisSettlePayRecord> selectEmisSettlePayRecordList(EmisSettlePayRecord emisSettlePayRecord);
|
||||||
|
|
||||||
|
|
||||||
/**
|
public List<EmisSettlePayRecord> selectSettlePayRecordListBySettleBillNo(String settleBillNo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
* 检查是否重复
|
* 检查是否重复
|
||||||
*
|
*
|
||||||
* @param emisSettlePayRecord
|
* @param emisSettlePayRecord
|
||||||
|
|||||||
@ -130,6 +130,9 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
|||||||
// 更新为签收
|
// 更新为签收
|
||||||
public int updateSignStatus(EmisWaybill emisWaybill);
|
public int updateSignStatus(EmisWaybill emisWaybill);
|
||||||
|
|
||||||
|
// 更新为已付款
|
||||||
|
public int updatePayedStatus(EmisWaybill emisWaybill);
|
||||||
|
|
||||||
// 删除签收状态
|
// 删除签收状态
|
||||||
public int updateUnSignStatus(EmisWaybill emisWaybill);
|
public int updateUnSignStatus(EmisWaybill emisWaybill);
|
||||||
|
|
||||||
|
|||||||
@ -1175,7 +1175,6 @@ public class EmisBaseService {
|
|||||||
emisSiteSettleRecord.setCustomerCode(dt.getCustomerCode());
|
emisSiteSettleRecord.setCustomerCode(dt.getCustomerCode());
|
||||||
addSiteSettleRecord(emisSiteSettleRecord);
|
addSiteSettleRecord(emisSiteSettleRecord);
|
||||||
|
|
||||||
|
|
||||||
// 增加财务中心的收入
|
// 增加财务中心的收入
|
||||||
|
|
||||||
// 财务中心
|
// 财务中心
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public interface IEmisSettleBillService
|
|||||||
* @param ids 需要删除的结算总账单主键集合
|
* @param ids 需要删除的结算总账单主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisSettleBillByIds(Long[] ids);
|
public int deleteEmisSettleBillByIds(Long[] ids) throws EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除结算总账单信息
|
* 删除结算总账单信息
|
||||||
@ -84,5 +84,5 @@ public interface IEmisSettleBillService
|
|||||||
* @param id 结算总账单主键
|
* @param id 结算总账单主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisSettleBillById(Long id);
|
public int deleteEmisSettleBillById(Long id) throws EmisBizError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisSettleInvoiceRecord;
|
import com.xdadan.erp.emis.domain.EmisSettleInvoiceRecord;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisSettleInvoiceRecordService
|
* @ClassName EmisSettleInvoiceRecordService
|
||||||
* @Description 开票记录表
|
* @Description 开票记录表
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -50,7 +51,7 @@ public interface IEmisSettleInvoiceRecordService
|
|||||||
* @param emisSettleInvoiceRecord 开票记录表
|
* @param emisSettleInvoiceRecord 开票记录表
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord);
|
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord) throws EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改开票记录表
|
* 修改开票记录表
|
||||||
|
|||||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisSettlePayRecordService
|
* @ClassName EmisSettlePayRecordService
|
||||||
* @Description 账单收退款记录
|
* @Description 账单收退款记录
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -50,7 +51,7 @@ public interface IEmisSettlePayRecordService
|
|||||||
* @param emisSettlePayRecord 账单收退款记录
|
* @param emisSettlePayRecord 账单收退款记录
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord);
|
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改账单收退款记录
|
* 修改账单收退款记录
|
||||||
|
|||||||
@ -97,6 +97,9 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
|||||||
throw new EmisBizError(EmisBizErrorType.FAIL,"合账失败,未选择子账单");
|
throw new EmisBizError(EmisBizErrorType.FAIL,"合账失败,未选择子账单");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成账单号
|
||||||
|
emisSettleBill.setSettleBillNo(WaybillHelper.genSettleBillNo());
|
||||||
|
|
||||||
// 计算应收总账单金额
|
// 计算应收总账单金额
|
||||||
// 检查子账单是否可加入
|
// 检查子账单是否可加入
|
||||||
BigDecimal totalRecMoney = BigDecimal.ZERO;
|
BigDecimal totalRecMoney = BigDecimal.ZERO;
|
||||||
@ -264,7 +267,7 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 总账单重算
|
* 总账单重算
|
||||||
* @param emisSettleBill
|
* @param old
|
||||||
* @return
|
* @return
|
||||||
* @throws EmisBizError
|
* @throws EmisBizError
|
||||||
*/
|
*/
|
||||||
@ -345,9 +348,11 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteEmisSettleBillByIds(Long[] ids)
|
public int deleteEmisSettleBillByIds(Long[] ids) throws EmisBizError {
|
||||||
{
|
for(Long id:ids){
|
||||||
return emisSettleBillMapper.deleteEmisSettleBillByIds(ids);
|
deleteEmisSettleBillById(id);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,8 +362,28 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteEmisSettleBillById(Long id)
|
public int deleteEmisSettleBillById(Long id) throws EmisBizError {
|
||||||
{
|
// 获取
|
||||||
|
EmisSettleBill bill = selectEmisSettleBillById(id);
|
||||||
|
if(!"0".equals(bill.getPaymentStatus())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"已收款不允许删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!"0".equals(bill.getBlConfirmSite())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"业务已确认不允许删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!"0".equals(bill.getOpenBillStatus())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"已开票已确认不允许删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除子账单关联
|
||||||
|
List<EmisSettleSubBill> listSubBill=selectSubBillListBySettleBillNo(bill.getSettleBillNo());
|
||||||
|
for (EmisSettleSubBill subBllOld:listSubBill) {
|
||||||
|
subBllOld.setSettleBillNo(bill.getSettleBillNo());
|
||||||
|
emisSettleSubBillMapper.removeFromMainSettleBill(subBllOld);
|
||||||
|
}
|
||||||
|
|
||||||
return emisSettleBillMapper.deleteEmisSettleBillById(id);
|
return emisSettleBillMapper.deleteEmisSettleBillById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,16 @@
|
|||||||
|
|
||||||
package com.xdadan.erp.emis.service.impl;
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.*;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import com.xdadan.erp.emis.mapper.EmisSettleBillMapper;
|
||||||
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xdadan.erp.emis.domain.EmisSettleInvoiceRecord;
|
|
||||||
import com.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper;
|
import com.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper;
|
||||||
import com.xdadan.erp.emis.service.IEmisSettleInvoiceRecordService;
|
import com.xdadan.erp.emis.service.IEmisSettleInvoiceRecordService;
|
||||||
|
|
||||||
@ -24,11 +30,14 @@ import com.xdadan.erp.emis.service.IEmisSettleInvoiceRecordService;
|
|||||||
* @date 2024-07-21 13:31:26
|
* @date 2024-07-21 13:31:26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class EmisSettleInvoiceRecordServiceImpl implements IEmisSettleInvoiceRecordService
|
public class EmisSettleInvoiceRecordServiceImpl extends EmisBaseService implements IEmisSettleInvoiceRecordService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmisSettleInvoiceRecordMapper emisSettleInvoiceRecordMapper;
|
private EmisSettleInvoiceRecordMapper emisSettleInvoiceRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisSettleBillMapper emisSettleBillMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询开票记录表
|
* 查询开票记录表
|
||||||
*
|
*
|
||||||
@ -73,9 +82,62 @@ public class EmisSettleInvoiceRecordServiceImpl implements IEmisSettleInvoiceRec
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord)
|
public int insertEmisSettleInvoiceRecord(EmisSettleInvoiceRecord emisSettleInvoiceRecord) throws EmisBizError {
|
||||||
{
|
// 判断对应账单是否存在
|
||||||
return emisSettleInvoiceRecordMapper.insertEmisSettleInvoiceRecord(emisSettleInvoiceRecord);
|
EmisSettleBill emisSettleBill=getSettleBillBySettleBillNo(emisSettleInvoiceRecord.getSettleBillNo());
|
||||||
|
if(emisSettleBill==null){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"账单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!"1".equals(emisSettleBill.getBlConfirmSite())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"业务账单未确认");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 插入发票记录
|
||||||
|
emisSettleInvoiceRecordMapper.insertEmisSettleInvoiceRecord(emisSettleInvoiceRecord);
|
||||||
|
|
||||||
|
// 重算账单已开票金额
|
||||||
|
reCalcSettleBillInvoiceInfo(emisSettleInvoiceRecord.getSettleBillNo());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重算账单收款金额
|
||||||
|
* @param settleBillNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int reCalcSettleBillInvoiceInfo(String settleBillNo){
|
||||||
|
|
||||||
|
EmisSettleBill oldBill =getSettleBillBySettleBillNo(settleBillNo);
|
||||||
|
// 获取开票记录
|
||||||
|
List<EmisSettleInvoiceRecord> invoiceRecordList=emisSettleInvoiceRecordMapper.selectInvoiceRecordListBySettleBillNo(settleBillNo);
|
||||||
|
// 计算已开票金额
|
||||||
|
BigDecimal totalMoney = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for(EmisSettleInvoiceRecord item:invoiceRecordList){
|
||||||
|
totalMoney=totalMoney.add(item.getApplyMoney());
|
||||||
|
}
|
||||||
|
|
||||||
|
EmisSettleBill newBill = new EmisSettleBill();
|
||||||
|
newBill.setId(oldBill.getId());
|
||||||
|
newBill.setOpenBillStatus("1");
|
||||||
|
|
||||||
|
// 更新账单收款状态
|
||||||
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
|
||||||
|
// 更新子账单的收款状态
|
||||||
|
// 如果全部付款则更新运单的付款状态
|
||||||
|
// if(rstDif>=0){
|
||||||
|
// List<EmisSettleSubBill> listSubBill=emisSettleSubBillMapper.selectSubBillListBySettleBillNo(settleBillNo);
|
||||||
|
// for (EmisSettleSubBill subBill:listSubBill) {
|
||||||
|
// EmisWaybill emisWaybill = new EmisWaybill();
|
||||||
|
// emisWaybill.setBillCode(subBill.getBillCode());
|
||||||
|
// emisWaybillMapper.updatePayedStatus(emisWaybill);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -10,9 +10,19 @@
|
|||||||
|
|
||||||
package com.xdadan.erp.emis.service.impl;
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.EmisSettleBill;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisSettleSubBill;
|
||||||
|
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import com.xdadan.erp.emis.mapper.EmisSettleBillMapper;
|
||||||
|
import com.xdadan.erp.emis.mapper.EmisSettleSubBillMapper;
|
||||||
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
import com.xdadan.erp.emis.domain.EmisSettlePayRecord;
|
||||||
@ -26,11 +36,19 @@ import com.xdadan.erp.emis.service.IEmisSettlePayRecordService;
|
|||||||
* @date 2024-07-21 13:31:24
|
* @date 2024-07-21 13:31:24
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class EmisSettlePayRecordServiceImpl implements IEmisSettlePayRecordService
|
public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements IEmisSettlePayRecordService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmisSettlePayRecordMapper emisSettlePayRecordMapper;
|
private EmisSettlePayRecordMapper emisSettlePayRecordMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisSettleBillMapper emisSettleBillMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisSettleSubBillMapper emisSettleSubBillMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询账单收退款记录
|
* 查询账单收退款记录
|
||||||
*
|
*
|
||||||
@ -75,11 +93,88 @@ public class EmisSettlePayRecordServiceImpl implements IEmisSettlePayRecordServi
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord)
|
public int insertEmisSettlePayRecord(EmisSettlePayRecord emisSettlePayRecord) throws EmisBizError {
|
||||||
{
|
|
||||||
String payId= "PM"+WaybillHelper.genPayId();
|
if(StringUtils.isEmpty(emisSettlePayRecord.getSettleBillNo())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"账单编号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不重复的 id流水号
|
||||||
|
String payId= WaybillHelper.genPayId();
|
||||||
emisSettlePayRecord.setPayId(payId);
|
emisSettlePayRecord.setPayId(payId);
|
||||||
return emisSettlePayRecordMapper.insertEmisSettlePayRecord(emisSettlePayRecord);
|
// 插入数据
|
||||||
|
emisSettlePayRecordMapper.insertEmisSettlePayRecord(emisSettlePayRecord);
|
||||||
|
|
||||||
|
// 重新计算账单收款信息
|
||||||
|
reCalcSettleBillPayrecordInfo(emisSettlePayRecord.getSettleBillNo());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重算账单收款金额
|
||||||
|
* @param settleBillNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int reCalcSettleBillPayrecordInfo(String settleBillNo){
|
||||||
|
|
||||||
|
EmisSettleBill oldBill =getSettleBillBySettleBillNo(settleBillNo);
|
||||||
|
// 获取收款记录
|
||||||
|
List<EmisSettlePayRecord> payRecordList=emisSettlePayRecordMapper.selectSettlePayRecordListBySettleBillNo(settleBillNo);
|
||||||
|
// 计算已收款金额
|
||||||
|
BigDecimal totalPayMoney = BigDecimal.ZERO;
|
||||||
|
// 抵扣金额
|
||||||
|
|
||||||
|
BigDecimal satisfyMoney = BigDecimal.ZERO;
|
||||||
|
/* allowance_money */
|
||||||
|
BigDecimal allowanceMoney = BigDecimal.ZERO;
|
||||||
|
/* deduction_money */
|
||||||
|
BigDecimal deductionMoney = BigDecimal.ZERO;
|
||||||
|
/* other_money */
|
||||||
|
BigDecimal otherMoney = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for(EmisSettlePayRecord item:payRecordList){
|
||||||
|
totalPayMoney=totalPayMoney.add(item.getPayMoney());
|
||||||
|
satisfyMoney=satisfyMoney.add(item.getSatisfyMoney()==null?BigDecimal.ZERO:item.getSatisfyMoney());
|
||||||
|
allowanceMoney=allowanceMoney.add(item.getAllowanceMoney()==null?BigDecimal.ZERO:item.getAllowanceMoney());
|
||||||
|
deductionMoney=deductionMoney.add(item.getDeductionMoney()==null?BigDecimal.ZERO:item.getDeductionMoney());
|
||||||
|
otherMoney=otherMoney.add(item.getOtherMoney()==null?BigDecimal.ZERO:item.getOtherMoney());
|
||||||
|
}
|
||||||
|
|
||||||
|
EmisSettleBill newBill = new EmisSettleBill();
|
||||||
|
newBill.setId(oldBill.getId());
|
||||||
|
newBill.setRecedMoney(totalPayMoney);
|
||||||
|
newBill.setSatisfyMoney(satisfyMoney);
|
||||||
|
newBill.setAllowanceMoney(allowanceMoney);
|
||||||
|
newBill.setOtherMoney(otherMoney);
|
||||||
|
|
||||||
|
// 判断收款状态 收款金额
|
||||||
|
int rstDif=totalPayMoney.compareTo(oldBill.getRecMoney());
|
||||||
|
if( rstDif >= 0 ){
|
||||||
|
// 已收款
|
||||||
|
newBill.setPaymentStatus("1");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 部分收款
|
||||||
|
newBill.setPaymentStatus("2");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新账单收款状态
|
||||||
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
|
||||||
|
// 更新子账单的收款状态
|
||||||
|
// 如果全部付款则更新运单的付款状态
|
||||||
|
if(rstDif>=0){
|
||||||
|
List<EmisSettleSubBill> listSubBill=emisSettleSubBillMapper.selectSubBillListBySettleBillNo(settleBillNo);
|
||||||
|
for (EmisSettleSubBill subBill:listSubBill) {
|
||||||
|
EmisWaybill emisWaybill = new EmisWaybill();
|
||||||
|
emisWaybill.setBillCode(subBill.getBillCode());
|
||||||
|
emisWaybillMapper.updatePayedStatus(emisWaybill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xdadan.erp.emis.service.openbill.hx.HXOrderInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class OpenBillService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill.hx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HXOrderGoods implements Serializable {
|
||||||
|
|
||||||
|
private String goodsName;
|
||||||
|
private String goodsCode;
|
||||||
|
private String specType;
|
||||||
|
private String unit;
|
||||||
|
private String price;
|
||||||
|
private String num;
|
||||||
|
private String taxRate;
|
||||||
|
private String withTaxFlag;
|
||||||
|
//30408020102
|
||||||
|
// "goodsName": "测试商品11",
|
||||||
|
// "goodsCode": "1090511030000000000",
|
||||||
|
// "specType": "测试规格型号",
|
||||||
|
// "unit": "个",
|
||||||
|
// "price": "10",
|
||||||
|
// "num": "1",
|
||||||
|
// "taxRate": "0.06",
|
||||||
|
// "withTaxFlag": "1"
|
||||||
|
}
|
||||||
@ -0,0 +1,378 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill.hx;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待开订单信息请求参数
|
||||||
|
*
|
||||||
|
* @author yxx
|
||||||
|
* @date 2022/11/25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HXOrderInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -255533932402763341L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方代码
|
||||||
|
*/
|
||||||
|
private String buyerCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方名称
|
||||||
|
*/
|
||||||
|
private String buyerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方税号(企业要填,个人可为空;数电专票、二手车销售统一发票时必填)
|
||||||
|
*/
|
||||||
|
private String buyerTaxNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方电话(购方地址+电话总共不超100字符;二手车销售统一发票时必填
|
||||||
|
*/
|
||||||
|
private String buyerTel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方地址(购方地址+电话总共不超100字符;二手车销售统一发票时必填
|
||||||
|
*/
|
||||||
|
private String buyerAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方银行
|
||||||
|
*/
|
||||||
|
private String buyerBank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购方银行账号
|
||||||
|
*/
|
||||||
|
private String buyerBankAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方代码
|
||||||
|
*/
|
||||||
|
private String salerCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方名称
|
||||||
|
*/
|
||||||
|
private String salerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方税号
|
||||||
|
*/
|
||||||
|
private String salerTaxNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方电话
|
||||||
|
*/
|
||||||
|
private String salerTel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方地址
|
||||||
|
*/
|
||||||
|
private String salerAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方银行
|
||||||
|
*/
|
||||||
|
private String salerBank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销方银行账号
|
||||||
|
*/
|
||||||
|
private String salerBankAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号(每个企业唯一)
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单时间(销售日期)
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date orderDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲红时填写的对应原蓝票发票代码(开红票不能为空,不满12位,请左补0)
|
||||||
|
*/
|
||||||
|
private String oldInvoiceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲红时填写的对应原蓝票发票号码(开红票不能为空,不满8位,请左补0)
|
||||||
|
*/
|
||||||
|
private String oldInvoiceNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲红时填写的对应原蓝字数电纸票号码
|
||||||
|
*/
|
||||||
|
private String oldDigitalElePaperInvoiceNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原蓝票开票时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date oldInvoiceDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲红原因 1:销货退回;2:开票有误;3:服务中止;4:发生销售折让
|
||||||
|
*/
|
||||||
|
private String redReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作废原因(数电纸票时需要传(1:销货退回;2:开票有误;3:服务中止;4:其他),默认 2)
|
||||||
|
*/
|
||||||
|
private String invalidReason;
|
||||||
|
/**
|
||||||
|
* 其他作废原因详情(数电纸票且作废原因选择4-其他时需要传)
|
||||||
|
*/
|
||||||
|
private String specificReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红字信息表编号/红字确认单编号
|
||||||
|
*/
|
||||||
|
private String billInfoNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红字确认单uuid
|
||||||
|
*/
|
||||||
|
private String billUuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票备注(冲红时,在备注中注明“对应正数发票代码:XXXXXXXXX号码:YYYYYYYY”文案,其中“X”为发票代码,“Y”为发票号码,可以不填,接口会自动添加该文案;机动车发票蓝票时备注只能为空;数电发票时最长为200字符)
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并发票备注
|
||||||
|
*/
|
||||||
|
private String mergeRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购销方银行信息备注栏展示控制:0 不展示 1:展示购方信息 2:展示销方信息 3:展示购销方信息
|
||||||
|
*/
|
||||||
|
private String showBankAccountType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单备注
|
||||||
|
*/
|
||||||
|
private String orderRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复核人
|
||||||
|
*/
|
||||||
|
private String checker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收款人
|
||||||
|
*/
|
||||||
|
private String payee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票人ID(系统用户id)
|
||||||
|
*/
|
||||||
|
private Long clerkId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票员(数电发票时需要传入和开票登录账号对应的开票员姓名)
|
||||||
|
*/
|
||||||
|
private String clerk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清单标志:Y-清单,N-非清单(默认),电票固定为N
|
||||||
|
*/
|
||||||
|
private String listFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清单项目名称:对应发票票面项目名称(listFlag为Y时,必填,默认为“详见销货清单”)
|
||||||
|
*/
|
||||||
|
private String listName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送方式:-1-不推送, 0-邮箱, 1-手机(默认 ),2-邮箱+手机
|
||||||
|
*/
|
||||||
|
private String pushMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交付手机(pushMode为1或2时,此项为 必填)
|
||||||
|
*/
|
||||||
|
private String deliverPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交付邮箱(pushMode为0或2时,此项为 必填)
|
||||||
|
*/
|
||||||
|
private String deliverEmail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票类型:1-蓝票,2-红票(数电发票暂不支持红票)
|
||||||
|
*/
|
||||||
|
private String invoiceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票种类:p,普通发票(电票)(默认);c,普通发票(纸票);s,专用发票;e,收购发票(电票);f,收购发票(纸质);r,普通发票(卷式);b,增值税电子专用发票;j,机动车销售统一发票;u,二手车销售统一发票;bs:电子发票(增值税专用发票)-即数电专票,pc:电子发票(普通发票)-即数电普票
|
||||||
|
*/
|
||||||
|
private String invoiceLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特定要素代码
|
||||||
|
*/
|
||||||
|
private String specificFactor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分机号(只能为空或者数字)
|
||||||
|
*/
|
||||||
|
private String extensionNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端号(开票终端号,只能 为空或数字)
|
||||||
|
*/
|
||||||
|
private String terminalNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器编号(12位盘号)
|
||||||
|
*/
|
||||||
|
private String machineCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否隐藏编码表版本号 N-否 Y-是(默认N,在企业资质中也配置为是隐藏的时候,并且此字段传Y的时候代开发票 税率显示***)
|
||||||
|
*/
|
||||||
|
private String hiddenBmbbbh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定开票发票代码(只有票种为:c或f时才有效,满足普票开二联、收购票开五联;nextInvoiceCode、nextInvoiceNum必须同时有值或同时为空)
|
||||||
|
*/
|
||||||
|
private String nextInvoiceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定开票发票号码(只有票种为:c或f时才有效,满足普票开二联、收购票开五联;nextInvoiceCode、nextInvoiceNum必须同时有值或同时为空
|
||||||
|
*/
|
||||||
|
private String nextInvoiceNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买方经办人姓名(数电发票特有字段)
|
||||||
|
*/
|
||||||
|
private String buyerManagerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经办人证件类型:101-组织机构代码证, 102-营业执照, 103-税务登记证, 199-其他单位证件, 201-居民身份证, 202-军官证, 203-武警警官证, 204-士兵证, 205-军队离退休干部证, 206-残疾人证, 207-残疾军人证(1-8级), 208-外国护照, 210-港澳居民来往内地通行证, 212-中华人民共和国往来港澳通行证, 213-台湾居民来往大陆通行证, 214-大陆居民往来台湾通行证, 215-外国人居留证, 216-外交官证 299-其他个人证件(数电发票特有)
|
||||||
|
*/
|
||||||
|
private String managerCardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经办人证件号码(数电发票特有字段)
|
||||||
|
*/
|
||||||
|
private String managerCardNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买方自然人标志:0-否(默认),1-是;仅在开具数电普票(电子)时使用,如受票 方(发票抬头)为自然人
|
||||||
|
* 并要求能将发票归集在个人票夹中展示,需提供姓名及身份证号(自然人纳税人识别号),此参数传入1;如受票方(发票抬头)为个体工 商户
|
||||||
|
* 需提供社会统一信用代码或纳税人识别号,此参数传入0
|
||||||
|
*/
|
||||||
|
private String naturalPersonFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加模版名称(数电发票特有字段,附加模版有值时需要添加附加要素信息列表对象,需要先在电子税局平台维护好模版
|
||||||
|
*/
|
||||||
|
private String additionalElementName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不含税金额
|
||||||
|
*/
|
||||||
|
private BigDecimal exTaxAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合计税额
|
||||||
|
*/
|
||||||
|
private BigDecimal taxAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 价税合计
|
||||||
|
*/
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单类型:1-销售单,0-退货单
|
||||||
|
*/
|
||||||
|
private String orderType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售人id
|
||||||
|
*/
|
||||||
|
private Long saleMan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售人姓名
|
||||||
|
*/
|
||||||
|
private String saleManName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date deliveryTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价含税标志:0-不含税,1-含税
|
||||||
|
*/
|
||||||
|
private String withTaxFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纸质发票票种代码
|
||||||
|
*/
|
||||||
|
private String zpFppzDm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差额征税类型代码
|
||||||
|
*/
|
||||||
|
private String cezslxDm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减按征收类型代码
|
||||||
|
*/
|
||||||
|
private String jazslxDm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差额凭证明细列表
|
||||||
|
*/
|
||||||
|
private String cepzmxList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 特定要素明细列表
|
||||||
|
*/
|
||||||
|
private String tdysmxList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加要素明细列表
|
||||||
|
*/
|
||||||
|
private String fjysList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段1
|
||||||
|
*/
|
||||||
|
private String def01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段2
|
||||||
|
*/
|
||||||
|
private String def02;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备用字段3
|
||||||
|
*/
|
||||||
|
private String def03;
|
||||||
|
|
||||||
|
// ===========================明细信息 接口接收==============================
|
||||||
|
/**
|
||||||
|
* 商品明细信息
|
||||||
|
*/
|
||||||
|
private List<HXOrderGoods> detailInfos;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,421 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill.hx;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class HXSdk {
|
||||||
|
|
||||||
|
public static String HX_URLPREFIX="https://csfw.jsaisino.com/csapp/stms-saas-pc/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新对应税号的token
|
||||||
|
* @param taxNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 获取 token
|
||||||
|
* @param appKey
|
||||||
|
* @param secretKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getToken(String appKey,String secretKey) {
|
||||||
|
// 开放平台对接URL固定前缀
|
||||||
|
// 1、通过平台提供的appkey secretKey 获取token
|
||||||
|
// 2、建议蒋获取到的token塞入本地缓存 并设置有效期 7天 TODO
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/getToken";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("appKey",appKey);
|
||||||
|
jObjPost.put("secretKey",secretKey);
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
|
||||||
|
// {"code":"00000","data":"eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjE3ODI5NDA0OTc4NzIyMjgzNTMsImFjY291bnQiOiI5MTMyMDEwNE1BRDNMQkRLNEUiLCJ1dWlkIjoiZTljNzE1MjUtNmNlMi00OWI0LTg4M2QtN2MwMDI5ZDg0MDRmIiwicmVtZW1iZXJNZSI6ZmFsc2UsImV4cGlyYXRpb25EYXRlIjoxNzIyNDAwMjY4NzI5LCJjYVRva2VuIjpudWxsLCJ0ZW5hbnRDb2RlIjoiOTEzMjAxMDRNQUQzTEJESzRFIiwib3RoZXJzIjpudWxsLCJzdWIiOiIxNzgyOTQwNDk3ODcyMjI4MzUzIiwiaWF0IjoxNzIxNzk1NDY4LCJleHAiOjE3MjI0MDAyNjh9.2GNaRyRTGNPxUzEECvnwBbDd6AR1fb-GRwJDAouEVf-dm__u0epLKBKRF1GxIFYUh8NjPdhmoRIUwm1b8jFgOA","success":true,"message":"请求成功"}
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
String token = null;
|
||||||
|
|
||||||
|
if("00000".equals(jRstObj.getString("code"))){
|
||||||
|
token =jRstObj.getString("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isLoginSuccess(String token){
|
||||||
|
|
||||||
|
boolean isLoginSuccess=false;
|
||||||
|
String url = HX_URLPREFIX+"/open/service/isLoginSucceeded";
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).header("Authorization", token).body("{}").execute();
|
||||||
|
String result = response.body();
|
||||||
|
// {"success":true,"code":"00000","message":"请求成功","data":false}
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
|
||||||
|
if("00000".equals(jRstObj.getString("code"))){
|
||||||
|
isLoginSuccess =jRstObj.getBoolean("data");
|
||||||
|
}
|
||||||
|
return isLoginSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean firstLogin(String account,String token){
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/firstLogin";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("account",account);
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
if("00000".equals(jRstObj.getString("code"))){
|
||||||
|
return jRstObj.getBoolean("status");
|
||||||
|
}
|
||||||
|
|
||||||
|
// status string Y 1 短信验证状态 是否需要手机验证码验证:
|
||||||
|
// 1 是
|
||||||
|
// 0 否
|
||||||
|
// mobile string Y 11
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean secondLogin(String account,String smsCode,String token){
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/secondLogin";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("account",account);
|
||||||
|
jObjPost.put("smsCode",smsCode);
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
if("00000".equals(jRstObj.getString("code"))){
|
||||||
|
return jRstObj.getBoolean("data");
|
||||||
|
}
|
||||||
|
// data string Y true 成功 false :失败
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getNsrBaseInfo(String account,String smsCode,String token){
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/getNsrBaseInfo";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("account",account);
|
||||||
|
jObjPost.put("smsCode",smsCode);
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
if("00000".equals(jRstObj.getString("code"))){
|
||||||
|
return jRstObj.getBoolean("data");
|
||||||
|
}
|
||||||
|
// data string Y true 成功 false :失败
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param account
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject etaxAccountStatus(String account,String token){
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/etaxAccountStatus";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("account",account);
|
||||||
|
HttpResponse response = HttpUtil.createGet(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
return jRstObj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
1 account string Y 数电账号
|
||||||
|
2 isLogin boolean Y true:登录成功,
|
||||||
|
false:登录失败
|
||||||
|
3 isAuth boolean Y true:已认证
|
||||||
|
false:未认证
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步开票
|
||||||
|
* @param order
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject asyncOpenBillReceive(HXOrderInfo order,String token){
|
||||||
|
|
||||||
|
List<HXOrderInfo> orderList = new ArrayList<>();
|
||||||
|
orderList.add(order);
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/orderReceive";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("orders",orderList);
|
||||||
|
log.error("==>jObjPost==>{}",jObjPost.toJSONString());
|
||||||
|
HttpResponse response = HttpUtil.createPost(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
return jRstObj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"code": "00000",
|
||||||
|
"message": "请求成功",
|
||||||
|
"data": {
|
||||||
|
"succOrderNum": 1,
|
||||||
|
"succGoodsNum": 5,
|
||||||
|
"successDetatils": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"invoiceSerialNum": "12321321466587898"
|
||||||
|
"qrcodeInvoiceUrl": "https://csfw.jsaisino.com/csapp/stms-saas/login"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"failDetails": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"invoiceSerialNum": "12321321466587898"
|
||||||
|
"qrcodeInvoiceUrl": "https://csfw.jsaisino.com/csapp/stms-saas/login"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"code": "B181099",
|
||||||
|
"message": "订单信息接收失败,失败原因:订单信息校验失败",
|
||||||
|
"data": {
|
||||||
|
"succOrderNum": 0,
|
||||||
|
"succGoodsNum": 0,
|
||||||
|
"failDetails": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"failReason": "明细中商品名称不能为空"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exceptionClazz": null,
|
||||||
|
"exceptionTip": null,
|
||||||
|
"exceptionPlace": null
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票查询
|
||||||
|
* @param order
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static JSONObject queryInvoiceResult(String orderNo,String token){
|
||||||
|
|
||||||
|
/*
|
||||||
|
orderNos Array N 50 订单数组,最大支持200条订单
|
||||||
|
invoiceSerialNums Array N 32 开票请求流水号数组,最大支持200条,该值在订单接收接口中返回。开票请求流水号数组与订单数组任选其一,都传值则优先使用开票请求流水号查询开票结果
|
||||||
|
isOfferInvoiceDetail String N 1 是否需要提供明细 Y-提供,N-不提供(默认)
|
||||||
|
*/
|
||||||
|
List<String> orderNos = new ArrayList<>();
|
||||||
|
orderNos.add(orderNo);
|
||||||
|
|
||||||
|
String url = HX_URLPREFIX+"/open/service/queryInvoiceResult";
|
||||||
|
JSONObject jObjPost = new JSONObject();
|
||||||
|
jObjPost.put("orderNos",orderNos);
|
||||||
|
log.error("===>queryInvoiceResult==>{}",jObjPost.toJSONString());
|
||||||
|
HttpResponse response = HttpUtil.createPost(url).header("Authorization", token).body(jObjPost.toJSONString()).execute();
|
||||||
|
String result = response.body();
|
||||||
|
JSONObject jRstObj = JSONObject.parseObject(result);
|
||||||
|
return jRstObj;
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"code": "00000",
|
||||||
|
"message": "请求成功",
|
||||||
|
"data": {
|
||||||
|
"succOrderNum": 1,
|
||||||
|
"succGoodsNum": 5,
|
||||||
|
"successDetatils": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"invoiceSerialNum": "12321321466587898"
|
||||||
|
"qrcodeInvoiceUrl": "https://csfw.jsaisino.com/csapp/stms-saas/login"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"failDetails": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"invoiceSerialNum": "12321321466587898"
|
||||||
|
"qrcodeInvoiceUrl": "https://csfw.jsaisino.com/csapp/stms-saas/login"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"code": "B181099",
|
||||||
|
"message": "订单信息接收失败,失败原因:订单信息校验失败",
|
||||||
|
"data": {
|
||||||
|
"succOrderNum": 0,
|
||||||
|
"succGoodsNum": 0,
|
||||||
|
"failDetails": [
|
||||||
|
{
|
||||||
|
"orderNo": "12321321466587",
|
||||||
|
"failReason": "明细中商品名称不能为空"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exceptionClazz": null,
|
||||||
|
"exceptionTip": null,
|
||||||
|
"exceptionPlace": null
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main1(String[] args) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"orders":[{
|
||||||
|
"orderNo": "19030412532501000363",
|
||||||
|
"salerTaxNum": "339902999999789113",
|
||||||
|
"invoiceLine": "c",
|
||||||
|
"buyerName": "北京分公司",
|
||||||
|
"buyerTaxNum": "91610131783582683H",
|
||||||
|
"buyerAddress": "西安市高新区高新四路17号志诚商务C座5层",
|
||||||
|
"buyerTel": "029-62623805",
|
||||||
|
"buyerBank": "工行西安高新路支行",
|
||||||
|
"buyerBankAccount": "3700028719200070864",
|
||||||
|
"specificFactor": "0",
|
||||||
|
"deliverPhone": "17705172417",
|
||||||
|
"deliverEmail": "1392859652@qq.com",
|
||||||
|
"emailDeliveryFileFormats":"['XML','OFD','PDF']",
|
||||||
|
"withTaxFlag": "1",
|
||||||
|
"detailInfos": [{
|
||||||
|
"goodsName": "测试商品11",
|
||||||
|
"goodsCode": "1090511030000000000",
|
||||||
|
"specType": "测试规格型号",
|
||||||
|
"unit": "个",
|
||||||
|
"price": "10",
|
||||||
|
"num": "1",
|
||||||
|
"taxRate": "0.06",
|
||||||
|
"withTaxFlag": "1"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
"autoInvoiceFlag": "Y"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
(2)公司名称:江苏探路者国际物流有限公司
|
||||||
|
税号:9132010469040698XG
|
||||||
|
APP Key:9132010469040698XG
|
||||||
|
APP Secret:8962fd753b054da88409b18743a6e7c0
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
HXOrderInfo order = new HXOrderInfo();
|
||||||
|
String token=getToken("9132010469040698XG","8962fd753b054da88409b18743a6e7c0");
|
||||||
|
|
||||||
|
// 91320104MA258WWMX2 丝路卡航(江苏)物流服务有限公司 4000251756 南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1527号 交通银行股份有限公司南京新街口支行 320899991013001239978 2024-07-24 11:19:25 2024-07-24 11:45:21
|
||||||
|
order.setOrderNo("TST2024072400-2");
|
||||||
|
order.setBuyerTaxNum("91320104MA258WWMX2");
|
||||||
|
order.setBuyerName("丝路卡航(江苏)物流服务有限公司");
|
||||||
|
order.setBuyerAddress("南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1527号");
|
||||||
|
order.setBuyerTel("4000251756");
|
||||||
|
order.setBuyerBank("交通银行股份有限公司南京新街口支行");
|
||||||
|
order.setBuyerBankAccount("320899991013001239978");
|
||||||
|
order.setSpecificFactor("0");
|
||||||
|
// order.setDeliverPhone("123213");
|
||||||
|
order.setDeliverEmail("linfso@126.com");
|
||||||
|
|
||||||
|
order.setWithTaxFlag( "1");
|
||||||
|
|
||||||
|
// "emailDeliveryFileFormats":"['XML','OFD','PDF']",
|
||||||
|
|
||||||
|
// 蓝票
|
||||||
|
order.setInvoiceType("1");
|
||||||
|
/*
|
||||||
|
发票种类:
|
||||||
|
pc:普通发票(数电);
|
||||||
|
bs:专用发票(数电);
|
||||||
|
ec:数电普票(纸质);
|
||||||
|
es:数电专票(纸质);
|
||||||
|
p,普通发票(电票);
|
||||||
|
b,增值税电子专用发票;
|
||||||
|
c,普通发票(纸票);
|
||||||
|
s,专用发票;
|
||||||
|
r,普通发票(卷式);
|
||||||
|
j,机动车销售统一发票;
|
||||||
|
u,二手车销售统一发票;
|
||||||
|
e,收购发票(电票);
|
||||||
|
f,收购发票(纸质);
|
||||||
|
ret,铁路电子客票
|
||||||
|
eia,航空运输客票电子行程单
|
||||||
|
扫码开票仅支持数电普和数电专
|
||||||
|
*/
|
||||||
|
order.setInvoiceLine("p");
|
||||||
|
|
||||||
|
|
||||||
|
// 9132010469040698XG 江苏探路者国际物流有限公司 025-85657080 南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1137号 中国工商银行南京市新街口支行 4301010009100803890 2024-07-24 10:37:07 2024-07-24 11:45:39
|
||||||
|
//
|
||||||
|
// order.setSalerTaxNum("91320104MAD3LBDK4E");
|
||||||
|
// order.setSalerName("探路供应链(江苏)有限公司");
|
||||||
|
// order.setSalerTel("025-85657080");
|
||||||
|
// order.setSalerAddress("江苏省南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1128号");
|
||||||
|
// order.setSalerBank("招商银行股份有限公司南京新街口支行");
|
||||||
|
// order.setSalerBankAccount("125916943510000");
|
||||||
|
|
||||||
|
order.setSalerTaxNum("9132010469040698XG");
|
||||||
|
order.setSalerName("江苏探路者国际物流有限公司");
|
||||||
|
order.setSalerTel("025-85657080");
|
||||||
|
order.setSalerAddress("南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1137号");
|
||||||
|
order.setSalerBank("中国工商银行南京市新街口支行");
|
||||||
|
order.setSalerBankAccount("4301010009100803890");
|
||||||
|
|
||||||
|
List<HXOrderGoods> goodsList = new ArrayList<>();
|
||||||
|
HXOrderGoods goodsItem = new HXOrderGoods();
|
||||||
|
goodsItem.setGoodsCode("30408020102");
|
||||||
|
goodsItem.setGoodsName("国际代理运输");
|
||||||
|
goodsItem.setNum("1");
|
||||||
|
goodsItem.setUnit("次");
|
||||||
|
goodsItem.setPrice("1.00");
|
||||||
|
goodsItem.setTaxRate("0.0");
|
||||||
|
goodsItem.setSpecType("国际代理运输");
|
||||||
|
goodsList.add(goodsItem);
|
||||||
|
order.setDetailInfos(goodsList);
|
||||||
|
|
||||||
|
|
||||||
|
// 91320104MAD3LBDK4E 探路供应链(江苏)有限公司 025-85657080 江苏省南京市秦淮区正学路1号南京晨光1865创意产业园F3幢1128号 招商银行股份有限公司南京新街口支行 125916943510000 2024-07-24 11:16:58 2024-07-24 11:45:31
|
||||||
|
|
||||||
|
JSONObject jRstObj=HXSdk.asyncOpenBillReceive(order,token);
|
||||||
|
System.out.println(jRstObj.toJSONString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String token=getToken("9132010469040698XG","8962fd753b054da88409b18743a6e7c0");
|
||||||
|
JSONObject jRstObj=HXSdk.queryInvoiceResult("TST2024072400-2",token);
|
||||||
|
System.out.println(jRstObj.toJSONString());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill.hx;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票平台接口对接demo
|
||||||
|
* 本demo使用Hutool(5.8.21)提供的HttpUtil工具类实现http请求
|
||||||
|
*
|
||||||
|
* @author yxx
|
||||||
|
*/
|
||||||
|
public class OpenServiceDemo {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 开放平台对接URL固定前缀
|
||||||
|
String urlPrefix = "https://csfw.jsaisino.com/csapp/stms-saas-pc/";
|
||||||
|
// 1、通过平台提供的appkey secretKey 获取token
|
||||||
|
String getTokenUrlsuffix = "/open/service/getToken";
|
||||||
|
// String getTokenRequest = "{\"appKey\":\"91440400MA4WKU0K8A\",\"secretKey\":\"a12136297be249ee9ca5fd9c862c7ca2\"}";
|
||||||
|
String getTokenRequest = "{\"appKey\":\"91320104MAD3LBDK4E\",\"secretKey\":\"cf6e11de453f441bbd35691cda6442e3\"}";
|
||||||
|
HttpResponse getTokenResponse = HttpUtil.createGet(urlPrefix + getTokenUrlsuffix).body(getTokenRequest).execute();
|
||||||
|
String result = getTokenResponse.body();
|
||||||
|
JSONObject jsonObject1 = JSONObject.parseObject(result);
|
||||||
|
String token = null;
|
||||||
|
System.out.println(jsonObject1);
|
||||||
|
if("00000".equals(jsonObject1.getString("code"))){
|
||||||
|
token =jsonObject1.getString("data");
|
||||||
|
// 2、建议蒋获取到的token塞入本地缓存 并设置有效期 7天 TODO
|
||||||
|
}
|
||||||
|
// 3、从缓存中获取token 调用业务接口-示例
|
||||||
|
if(StrUtil.isNotEmpty(token)){
|
||||||
|
// 获取电局是否登录成功
|
||||||
|
String getEtaxLoginStatusUrlsuffix = "/open/service/isLoginSucceeded";
|
||||||
|
// 将token塞入请求头中
|
||||||
|
HttpResponse getEtaxLoginStatusResponse = HttpUtil.createGet(urlPrefix + getEtaxLoginStatusUrlsuffix).header("Authorization", token).body("{}").execute();
|
||||||
|
String getEtaxLoginStatusResult = getEtaxLoginStatusResponse.body();
|
||||||
|
System.out.println(getEtaxLoginStatusResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.xdadan.erp.emis.service.openbill.hx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 订单接收参数
|
||||||
|
* @Author NF_344 xieminmin
|
||||||
|
* @Date 2022-11-14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderReceiveInfoRequest implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3789592267606483751L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息
|
||||||
|
*/
|
||||||
|
private List<HXOrderInfo> orders;
|
||||||
|
|
||||||
|
}
|
||||||
@ -16,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -24,6 +26,8 @@ public class WaybillHelper {
|
|||||||
|
|
||||||
// 5位小数
|
// 5位小数
|
||||||
public static DecimalFormat dfCalc = new DecimalFormat("#.#####");
|
public static DecimalFormat dfCalc = new DecimalFormat("#.#####");
|
||||||
|
public static SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||||
|
|
||||||
|
|
||||||
// 生成客户编号
|
// 生成客户编号
|
||||||
// public static String genCustomerCode(){
|
// public static String genCustomerCode(){
|
||||||
@ -53,6 +57,17 @@ public class WaybillHelper {
|
|||||||
return payId.toString();
|
return payId.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成结算账单号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String genSettleBillNo(){
|
||||||
|
String billId = formatter.format(new Date());
|
||||||
|
billId += (int)((Math.random() * 9 + 1) * 100);
|
||||||
|
return billId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper">
|
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper">
|
||||||
|
|
||||||
<resultMap type="EmisSettleInvoiceRecord" id="EmisSettleInvoiceRecordResult">
|
<resultMap type="EmisSettleInvoiceRecord" id="EmisSettleInvoiceRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="applySeqNo" column="apply_seq_no" />
|
<result property="applySeqNo" column="apply_seq_no" />
|
||||||
<result property="applyDate" column="apply_date" />
|
<result property="applyDate" column="apply_date" />
|
||||||
@ -44,6 +44,18 @@
|
|||||||
<result property="openChStatus" column="open_ch_status" />
|
<result property="openChStatus" column="open_ch_status" />
|
||||||
<result property="openChStatusDesc" column="open_ch_status_desc" />
|
<result property="openChStatusDesc" column="open_ch_status_desc" />
|
||||||
<result property="openComCode" column="open_com_code" />
|
<result property="openComCode" column="open_com_code" />
|
||||||
|
|
||||||
|
|
||||||
|
<association property="applyManName" column="apply_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
|
||||||
|
<association property="applySiteName" column="apply_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
|
|
||||||
|
<association property="auditManName" column="audit_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
|
||||||
|
<association property="auditSiteName" column="audit_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
|
|
||||||
|
<association property="opManName" column="op_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
|
||||||
|
<association property="opSiteName" column="op_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||||
|
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmisSettleInvoiceRecordVo">
|
<sql id="selectEmisSettleInvoiceRecordVo">
|
||||||
@ -105,6 +117,12 @@
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectInvoiceRecordListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
|
||||||
|
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
|
from emis_settle_invoice_record a
|
||||||
|
where a.settle_bill_no = #{settleBillNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
|
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
|
||||||
select count(1) from emis_settle_invoice_record
|
select count(1) from emis_settle_invoice_record
|
||||||
where del_flag='0'
|
where del_flag='0'
|
||||||
|
|||||||
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettleInvoiceRelMapper">
|
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettleInvoiceRelMapper">
|
||||||
|
|
||||||
<resultMap type="EmisSettleInvoiceRel" id="EmisSettleInvoiceRelResult">
|
<resultMap type="EmisSettleInvoiceRel" id="EmisSettleInvoiceRelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="applySeqNo" column="apply_seq_no" />
|
<result property="applySeqNo" column="apply_seq_no" />
|
||||||
<result property="payId" column="pay_id" />
|
<result property="payId" column="pay_id" />
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettlePayRecordMapper">
|
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettlePayRecordMapper" >
|
||||||
|
|
||||||
<resultMap type="EmisSettlePayRecord" id="EmisSettlePayRecordResult">
|
<resultMap type="EmisSettlePayRecord" id="EmisSettlePayRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="payId" column="pay_id" />
|
<result property="payId" column="pay_id" />
|
||||||
<result property="payType" column="pay_type" />
|
<result property="payType" column="pay_type" />
|
||||||
@ -107,6 +107,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSettlePayRecordListBySettleBillNo" parameterType="Long" resultMap="EmisSettlePayRecordResult">
|
||||||
|
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||||
|
from emis_settle_pay_record a
|
||||||
|
where a.settle_bill_no = #{settleBillNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="checkUnique" parameterType="EmisSettlePayRecord" resultType="int">
|
<select id="checkUnique" parameterType="EmisSettlePayRecord" resultType="int">
|
||||||
select count(1) from emis_settle_pay_record
|
select count(1) from emis_settle_pay_record
|
||||||
where del_flag='0'
|
where del_flag='0'
|
||||||
|
|||||||
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettlePayRelMapper">
|
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSettlePayRelMapper">
|
||||||
|
|
||||||
<resultMap type="EmisSettlePayRel" id="EmisSettlePayRelResult">
|
<resultMap type="EmisSettlePayRel" id="EmisSettlePayRelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="payId" column="pay_id" />
|
<result property="payId" column="pay_id" />
|
||||||
<result property="billNo" column="bill_no" />
|
<result property="billNo" column="bill_no" />
|
||||||
|
|||||||
@ -2223,6 +2223,12 @@
|
|||||||
where bill_code=#{billCode}
|
where bill_code=#{billCode}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePayedStatus" parameterType="EmisWaybill">
|
||||||
|
update emis_waybill
|
||||||
|
set payment_status='1'
|
||||||
|
where bill_code=#{billCode}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateDispatchStatus" parameterType="EmisWaybill">
|
<update id="updateDispatchStatus" parameterType="EmisWaybill">
|
||||||
update emis_waybill set
|
update emis_waybill set
|
||||||
dispatch_man_code = #{dispatchManCode},
|
dispatch_man_code = #{dispatchManCode},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user