发票交付

beta-enc
kane 2 years ago
parent ff4540a390
commit 871e7d471a
  1. 17
      jianshui-platform/src/main/java/com/jianshui/platform/mapper/CompanyServiceMapper.java
  2. 56
      jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java
  3. 16
      jianshui-platform/src/main/resources/com/jianshui/platform/mapper/CompanyServiceMapper.xml

@ -1,17 +0,0 @@
package com.jianshui.platform.mapper;
import com.jianshui.common.core.domain.entity.Companyservice;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @Author: xingze
* @Description: 企业信息持久层
* @CreateTime: 2023-06-06 12:05
* @Version: 1.0
**/
@Mapper
public interface CompanyServiceMapper {
Companyservice findByCompanyId(@Param("companyId") Long companyId);
}

@ -19,11 +19,11 @@ import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.platform.domain.InvoiceDelivery;
import com.jianshui.platform.dto.InvoiceDeliveryDTO;
import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO;
import com.jianshui.platform.mapper.CompanyServiceMapper;
import com.jianshui.platform.mapper.InvoiceDeliveryMapper;
import com.jianshui.platform.service.InvoiceDeliveryService;
import com.jianshui.system.domain.InvoiceAllApiLog;
import com.jianshui.system.domain.InvoiceAllYhdj;
import com.jianshui.system.mapper.CompanyserviceMapper;
import com.jianshui.system.mapper.InvoiceAllApiLogMapper;
import com.jianshui.system.mapper.InvoiceAllYhdjMapper;
import com.jianshui.system.mapper.SysUserMapper;
@ -47,7 +47,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private CompanyServiceMapper companyServiceMapper;
private CompanyserviceMapper companyServiceMapper;
@Autowired
private InvoiceAllYhdjMapper yhdjMapper;
@Autowired
@ -72,7 +72,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
//根据用户id获取用户信息
SysUser sysUser = sysUserMapper.selectUserById(userId);
//根据企业id获取企业信息
Companyservice companyservice = companyServiceMapper.findByCompanyId(sysUser.getCompanyId());
Companyservice companyservice = companyServiceMapper.selectCompanyserviceByCompanyid(sysUser.getCompanyId());
//获取登记用户信息
InvoiceAllYhdj userInfo = getUserInfo(companyservice);
if (BeanUtil.isEmpty(userInfo)) {
@ -86,10 +86,10 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
invoiceDeliveryDTO.setNsrsbh(userInfo.getNsrsbh());
//校验
ValidateUtils.validate(invoiceDeliveryDTO);
ValidateUtils.validate(dtos);
InvoiceDelivery invoiceDelivery = new InvoiceDelivery();
for (InvoiceDeliveryJsonDataDTO dto : dtos) {
invoiceDeliveryDTO.setJsonData(dto);
ValidateUtils.validate(invoiceDeliveryDTO);
//发送请求获取结果
JSONObject result = null;
try {
@ -99,40 +99,34 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
String code = result.get("code") != null ? result.get("code").toString() : "";
String msg = result.get("msg") != null ? result.get("msg").toString() : "";
String data = result.get("data") != null ? result.get("data").toString() : "";
//封装调用日志
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
allApiLog.setUrl(WebServiceConstant.INVOIVEDELIVERY);
allApiLog.setSendMsg(invoiceDeliveryDTO.toString());
allApiLog.setResultMsg(JSONUtil.toJsonStr(result));
allApiLog.setCompany(companyservice.getSellertax());
allApiLog.setIdentityId(companyservice.getIdentity());
allApiLog.setCreateTime(new Date());
//封装实体类
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery);
invoiceDelivery.setJflx(dto.getJflx());
invoiceDelivery.setFphm(dto.getFphm());
invoiceDelivery.setGmflxdh(dto.getGmflxdh());
invoiceDelivery.setGmfyx(dto.getGmfyx());
invoiceDelivery.setType("1");
invoiceDelivery.setClerk(sysUser.getUserId());
invoiceDelivery.setCreateTime(new Date());
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) {
//存入调用日志表
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
allApiLog.setUrl(WebServiceConstant.INVOIVEDELIVERY);
allApiLog.setSendMsg(invoiceDeliveryDTO.toString());
allApiLog.setResultMsg(JSONUtil.toJsonStr(result));
allApiLog.setCompany(companyservice.getSellertax());
allApiLog.setIdentityId(companyservice.getIdentity());
allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
//封装实体类
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery);
invoiceDelivery.setJflx(dto.getJflx());
invoiceDelivery.setFphm(dto.getFphm());
invoiceDelivery.setGmflxdh(dto.getGmflxdh());
invoiceDelivery.setGmfyx(dto.getGmfyx());
invoiceDelivery.setStatus("0");
invoiceDelivery.setType("1");
invoiceDelivery.setClerk(sysUser.getUserId());
invoiceDelivery.setCreateTime(new Date());
//将数据存入业务表
invoiceDelivery.setStatus("0");
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery);
} else {
//封装实体类
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery);
invoiceDelivery.setJflx(dto.getJflx());
invoiceDelivery.setFphm(dto.getFphm());
invoiceDelivery.setGmflxdh(dto.getGmflxdh());
invoiceDelivery.setGmfyx(dto.getGmfyx());
invoiceDelivery.setStatus("1");
invoiceDelivery.setType("1");
invoiceDelivery.setClerk(sysUser.getUserId());
invoiceDelivery.setCreateTime(new Date());
//存入日志调用表
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
//将数据存入业务表
invoiceDelivery.setStatus("1");
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery);
return new HXResponse(msg);
}

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jianshui.platform.mapper.CompanyServiceMapper">
<resultMap id="companyServiceResultMap" type="Companyservice">
<id column="companyid" property="companyid"/>
<result column="reback_type" property="rebackType"/>
<result column="create_user" property="createUser"/>
<result column="create_dept" property="createDept"/>
</resultMap>
<select id="findByCompanyId" resultMap="companyServiceResultMap">
select * from companyservice where companyid = #{companyId}
</select>
</mapper>
Loading…
Cancel
Save